From e33b020b5606244bfa817c8d2fe2921de983da90 Mon Sep 17 00:00:00 2001 From: Christian Wade Date: Mon, 9 Mar 2020 18:50:28 -0700 Subject: [PATCH] InitializeChromium handling --- BismNormalizer/AlmToolkit/ComparisonForm.cs | 68 ++++++++++-------- .../BismNormalizer.IconSetup.exe | Bin 10240 -> 10240 bytes .../BismNormalizer/BismNormalizer.exe | Bin 16384 -> 16384 bytes 3 files changed, 39 insertions(+), 29 deletions(-) diff --git a/BismNormalizer/AlmToolkit/ComparisonForm.cs b/BismNormalizer/AlmToolkit/ComparisonForm.cs index 1578e1b..b80195d 100644 --- a/BismNormalizer/AlmToolkit/ComparisonForm.cs +++ b/BismNormalizer/AlmToolkit/ComparisonForm.cs @@ -48,37 +48,47 @@ namespace AlmToolkit /// private void InitializeChromium() { - // Check if the page exists - string page = string.Format(@"{0}\html-resources\dist\index.html", Application.StartupPath); - if (!File.Exists(page)) + try { - MessageBox.Show("Error html file doesn't exist : " + page); + // 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, 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); ; + + Cef.Initialize(settings, performDependencyCheck: false, browserProcessHandler: null); + // Create a browser component + chromeBrowser = new ChromiumWebBrowser(page); + // Add it to the form and fill it to the form window. + this.Controls.Add(chromeBrowser); + chromeBrowser.Dock = DockStyle.Fill; + chromeBrowser.BringToFront(); + + CefSharpSettings.LegacyJavascriptBindingEnabled = true; + + // Initialize the interaction variable + _comparisonInter = new ComparisonJSInteraction(this); + + // 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); } - - 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); ; - - Cef.Initialize(settings, performDependencyCheck: false, browserProcessHandler: null); - // Create a browser component - chromeBrowser = new ChromiumWebBrowser(page); - // Add it to the form and fill it to the form window. - this.Controls.Add(chromeBrowser); - chromeBrowser.Dock = DockStyle.Fill; - chromeBrowser.BringToFront(); - - CefSharpSettings.LegacyJavascriptBindingEnabled = true; - - // Initialize the interaction variable - _comparisonInter = new ComparisonJSInteraction(this); - - // Register C# objects - chromeBrowser.RegisterAsyncJsObject("chromeDebugger", new ChromeDebugger(chromeBrowser, this)); - chromeBrowser.RegisterAsyncJsObject("comparisonJSInteraction", _comparisonInter); - } private void ComparisonForm_Load(object sender, EventArgs e) diff --git a/BismNormalizer/BismNormalizer/BismNormalizer.IconSetup.exe b/BismNormalizer/BismNormalizer/BismNormalizer.IconSetup.exe index 3d7566924b09b3cb1ea672d6f7344610c860cdbc..18e4a7c886ab7cd710da384741ce3825ecfa2c9b 100644 GIT binary patch delta 86 zcmZn&Xb70l!R-GrZDTjDpg`Es1c%saU$d;p$=kYlg`f?S4p26Z0SK6YScZ{- l;g2B@3o|eT1-k^Bf74yIV~wuc9NQo}F_m7)%>p7HgaKNB9cBOk delta 86 zcmZn&Xb70l!TfJ!(#CFHL4k+9mtNU7>w8WUTfV%H^Jw(u6@oTQIzZVt1|VPpVi`sT mhChZtEX=?V6zmf0ed6WvV$~Rr^>60v^@+AzvROdngD?P@*&qo3 diff --git a/BismNormalizer/BismNormalizer/BismNormalizer.exe b/BismNormalizer/BismNormalizer/BismNormalizer.exe index 21b2dcc0bb6ae841b5d0a300930a318c08234acc..1e6316dfa6ac815ecec0099ff7f3e65302f011b1 100644 GIT binary patch delta 88 zcmZo@U~Fh$oY27>@G)&;x2SE@ez~ym{^kt^TbOi!vT+PRzy!oH nj0_Alfk14`zz`Jd63iM9*V8tS)2pG~^H%oLu#U|Wj0<=G;{G5L delta 88 zcmZo@U~Fh$oY2Aie`V6fZczh)`>UF-C%b&|UhrDU@4e$j&CMGOwlL`cW#brtfC-3Y o7#SF90)g0=fgvc^CHNh8@x$|5DtwpDU|k`7b>EK76O0RZ02e