InitializeChromium handling

This commit is contained in:
Christian Wade 2020-03-09 18:50:28 -07:00
parent 80f3ee0c08
commit e33b020b56
3 changed files with 39 additions and 29 deletions

View File

@ -47,20 +47,22 @@ namespace AlmToolkit
/// Initialize the chrome browser with the html file to be opened
/// </summary>
private void InitializeChromium()
{
try
{
// Check if the page exists
string page = string.Format(@"{0}\html-resources\dist\index.html", Application.StartupPath);
if (!File.Exists(page))
{
MessageBox.Show("Error html file doesn't exist : " + page);
MessageBox.Show("Error html file doesn't exist : " + page, Utils.AssemblyProduct, MessageBoxButtons.OK, MessageBoxIcon.Error);
}
CefSettings settings = new CefSettings();
// Initialize cef with the provided settings
settings.CefCommandLineArgs.Add("disable-gpu", "1");
//settings.BrowserSubprocessPath = @"x86\CefSharp.BrowserSubprocess.exe";
settings.BrowserSubprocessPath = string.Format(@"{0}\x86\CefSharp.BrowserSubprocess.exe", Application.StartupPath); ;
settings.BrowserSubprocessPath = @"x86\CefSharp.BrowserSubprocess.exe";
//settings.BrowserSubprocessPath = string.Format(@"{0}\x86\CefSharp.BrowserSubprocess.exe", Application.StartupPath); ;
Cef.Initialize(settings, performDependencyCheck: false, browserProcessHandler: null);
// Create a browser component
@ -78,7 +80,15 @@ namespace AlmToolkit
// Register C# objects
chromeBrowser.RegisterAsyncJsObject("chromeDebugger", new ChromeDebugger(chromeBrowser, this));
chromeBrowser.RegisterAsyncJsObject("comparisonJSInteraction", _comparisonInter);
}
catch (FileNotFoundException)
{
MessageBox.Show("FileNotFoundException in InitializeChromium().\n\nPlease try to install C++ Redistributable Packages for Visual Studio x86, min version www.microsoft.com/download/details.aspx?id=40784", Utils.AssemblyProduct, MessageBoxButtons.OK, MessageBoxIcon.Error);
}
catch (Exception exc)
{
MessageBox.Show(exc.Message, Utils.AssemblyProduct, MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void ComparisonForm_Load(object sender, EventArgs e)