InitializeChromium handling
This commit is contained in:
parent
80f3ee0c08
commit
e33b020b56
@ -48,37 +48,47 @@ namespace AlmToolkit
|
||||
/// </summary>
|
||||
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)
|
||||
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user