revised help window to use cefsharp instead of gecko

This commit is contained in:
Faryan Rezagholi
2020-05-26 10:39:05 +02:00
parent 421076062c
commit 6b392f55c6
3 changed files with 53 additions and 60 deletions

View File

@@ -0,0 +1,42 @@

namespace mRemoteNG.UI.Window
{
partial class HelpWindow
{
#region Windows Form Designer generated code
private void InitializeComponent()
{
this.cefBrwoser = new CefSharp.WinForms.ChromiumWebBrowser();
this.SuspendLayout();
//
// chromiumWebBrowser1
//
this.cefBrwoser.ActivateBrowserOnCreation = false;
this.cefBrwoser.Dock = System.Windows.Forms.DockStyle.Fill;
this.cefBrwoser.Location = new System.Drawing.Point(0, 0);
this.cefBrwoser.Name = "chromiumWebBrowser1";
this.cefBrwoser.Size = new System.Drawing.Size(1117, 705);
this.cefBrwoser.TabIndex = 0;
//
// HelpWindow
//
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.BackColor = System.Drawing.SystemColors.Control;
this.ClientSize = new System.Drawing.Size(1117, 705);
this.Controls.Add(this.cefBrwoser);
this.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.ForeColor = System.Drawing.SystemColors.ControlText;
this.Icon = global::mRemoteNG.Resources.Help_Icon;
this.Name = "HelpWindow";
this.TabText = "Help";
this.Text = "Help";
this.Load += new System.EventHandler(this.HelpWindow_Load);
this.ResumeLayout(false);
}
#endregion
private CefSharp.WinForms.ChromiumWebBrowser cefBrwoser;
}
}

View File

@@ -1,78 +1,24 @@
using mRemoteNG.App.Info;
using CefSharp;
using mRemoteNG.Connection.Protocol.Http;
using System;
using System.Diagnostics;
using Gecko;
using WeifenLuo.WinFormsUI.Docking;
namespace mRemoteNG.UI.Window
{
public class HelpWindow : BaseWindow
public partial class HelpWindow : BaseWindow
{
private GeckoWebBrowser geckoWebBrowser;
#region Form Init
private void InitializeComponent()
{
this.geckoWebBrowser = new Gecko.GeckoWebBrowser();
this.SuspendLayout();
//
// geckoWebBrowser
//
this.geckoWebBrowser.Dock = System.Windows.Forms.DockStyle.Fill;
this.geckoWebBrowser.FrameEventsPropagateToMainWindow = false;
this.geckoWebBrowser.Location = new System.Drawing.Point(0, 0);
this.geckoWebBrowser.Name = "geckoWebBrowser";
this.geckoWebBrowser.Size = new System.Drawing.Size(542, 323);
this.geckoWebBrowser.TabIndex = 0;
this.geckoWebBrowser.UseHttpActivityObserver = false;
this.geckoWebBrowser.DomClick += new System.EventHandler<Gecko.DomMouseEventArgs>(this.LinkClicked);
//
// HelpWindow
//
this.ClientSize = new System.Drawing.Size(542, 323);
this.Controls.Add(this.geckoWebBrowser);
this.Icon = global::mRemoteNG.Resources.Help_Icon;
this.Name = "HelpWindow";
this.TabText = "Help";
this.Text = "Help";
this.Load += new System.EventHandler(this.HelpWindow_Load);
this.ResumeLayout(false);
}
#endregion
#region Public Methods
public HelpWindow()
{
WindowType = WindowType.Help;
DockPnl = new DockContent();
if (!Xpcom.IsInitialized)
Xpcom.Initialize("Firefox");
InitializeComponent();
}
#endregion
#region Private Methods
private void HelpWindow_Load(object sender, EventArgs e) => geckoWebBrowser.Navigate(GeneralAppInfo.HomePath + @"\Help\index.html");
private void LinkClicked(object sender, DomMouseEventArgs e)
private void HelpWindow_Load(object sender, EventArgs e)
{
var url = ((GeckoWebBrowser) sender).StatusText;
if (url.StartsWith("file://"))
{
geckoWebBrowser.Navigate(url);
e.Handled = true;
return;
}
Process.Start(url);
e.Handled = true;
cefBrwoser.RequestHandler = new RequestHandler();
cefBrwoser.Load($@"{Cef.CefCommitHash}://help/");
}
#endregion
}
}

View File

@@ -267,6 +267,8 @@
<Compile Include="Connection\IConnectionInitiator.cs" />
<Compile Include="Connection\IInheritable.cs" />
<Compile Include="Connection\IHasParent.cs" />
<Compile Include="Connection\Protocol\Http\Connection.Protocol.HTTP.DownloadHandler.cs" />
<Compile Include="Connection\Protocol\Http\Connection.Protocol.HTTP.RequestHandler.cs" />
<Compile Include="Connection\Protocol\Http\Connection.Protocol.HTTPS.CertEvent.cs" />
<Compile Include="Connection\Protocol\ProtocolFactory.cs" />
<Compile Include="Connection\Protocol\RDP\AuthenticationLevel.cs" />
@@ -822,6 +824,9 @@
<SubType>Form</SubType>
</Compile>
<Compile Include="UI\WindowList.cs" />
<Compile Include="UI\Window\HelpWindow.Designer.cs">
<DependentUpon>HelpWindow.cs</DependentUpon>
</Compile>
<Compile Include="UI\Window\PortScanWindow.Designer.cs">
<DependentUpon>PortScanWindow.cs</DependentUpon>
</Compile>