Skip to content

Commit

Permalink
WinForms/WPF - Display MessageBox when Cef.Initialzie returns false
Browse files Browse the repository at this point in the history
  • Loading branch information
amaitland committed Jan 19, 2024
1 parent d29c915 commit 785e893
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
9 changes: 8 additions & 1 deletion CefSharp.MinimalExample.WinForms/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,14 @@ public static int Main(string[] args)
settings.CefCommandLineArgs.Add("enable-usermedia-screen-capturing");

//Perform dependency check to make sure all relevant resources are in our output directory.
Cef.Initialize(settings, performDependencyCheck: true, browserProcessHandler: null);
var initialized = Cef.Initialize(settings, performDependencyCheck: true, browserProcessHandler: null);

if (!initialized)
{
MessageBox.Show("Cef.Initialized failed, check the log file for more details.");

return 0;
}

Application.EnableVisualStyles();
Application.Run(new BrowserForm());
Expand Down
9 changes: 8 additions & 1 deletion CefSharp.MinimalExample.Wpf/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,14 @@ public App()
if (!Cef.IsInitialized)
{
//Perform dependency check to make sure all relevant resources are in our output directory.
Cef.Initialize(settings, performDependencyCheck: true, browserProcessHandler: null);
var initialized = Cef.Initialize(settings, performDependencyCheck: true, browserProcessHandler: null);

if(!initialized)
{
MessageBox.Show("Cef.Initialized failed, check the log file for more details.");

Shutdown();
}
}
}
}
Expand Down

0 comments on commit 785e893

Please sign in to comment.