mirror of
https://github.com/mRemoteNG/mRemoteNG.git
synced 2026-02-17 22:11:48 +08:00
Removed cefBrowser_InitializedChanged event handling because this actually had no use to the browser loading and being usable. Fixed the issue of the CEF Browser not loading the requested URL on connect. Changed the loading logic of the CEF Browser to wait for cefBrowser_LoadingStateChanged to trigger and to look at if it is still loading before logging that the browser is initialised. Altered cefBrowser_LoadingStateChanged to register itself as an event once the browser is loaded as we don't care for any more events once we know it is safe to issue the Browser.Load() method. Updated Connect to record when it has been requested so that if the browser initialises after this request, it can retrigger the code to load the required URL automatically. Removed the dispose code, though this might need to be reimplemented after testing. Updated App.config and .csproj with settings defined in CEF user documentation. Updated some of the CEF Settings to recommended values.
This commit is contained in:
@@ -20,6 +20,7 @@ namespace mRemoteNG.Connection.Protocol.Http
|
||||
protected int defaultPort;
|
||||
private string tabTitle;
|
||||
private bool browserInitialised = false;
|
||||
private bool connectCalled = false;
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -102,7 +103,6 @@ namespace mRemoteNG.Connection.Protocol.Http
|
||||
var CEFBrowser = (ChromiumWebBrowser)wBrowser;
|
||||
if (CEFBrowser != null)
|
||||
{
|
||||
CEFBrowser.IsBrowserInitializedChanged += cefBrowser_InitializedChanged;
|
||||
CEFBrowser.LoadingStateChanged += cefBrowser_LoadingStateChanged;
|
||||
CEFBrowser.TitleChanged += wBrowser_DocumentTitleChanged;
|
||||
}
|
||||
@@ -133,21 +133,6 @@ namespace mRemoteNG.Connection.Protocol.Http
|
||||
}
|
||||
}
|
||||
|
||||
~HTTPBase()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (InterfaceControl.Info.RenderingEngine == RenderingEngine.CEF)
|
||||
{
|
||||
((ChromiumWebBrowser)wBrowser).Dispose();
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
public override bool Connect()
|
||||
{
|
||||
try
|
||||
@@ -169,6 +154,7 @@ namespace mRemoteNG.Connection.Protocol.Http
|
||||
}
|
||||
|
||||
base.Connect();
|
||||
connectCalled = true;
|
||||
return true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -232,16 +218,20 @@ namespace mRemoteNG.Connection.Protocol.Http
|
||||
|
||||
#region Events
|
||||
|
||||
private void cefBrowser_InitializedChanged(object sender, IsBrowserInitializedChangedEventArgs e)
|
||||
{
|
||||
browserInitialised = e.IsBrowserInitialized;
|
||||
}
|
||||
|
||||
private void cefBrowser_LoadingStateChanged(object sender, LoadingStateChangedEventArgs e)
|
||||
{
|
||||
if (browserInitialised == true)
|
||||
browserInitialised = !e.IsLoading;
|
||||
if (browserInitialised)
|
||||
{
|
||||
Connect();
|
||||
// Unhook the loading state changes now, as navigation is done by the user on links in the control
|
||||
((ChromiumWebBrowser)wBrowser).LoadingStateChanged -= cefBrowser_LoadingStateChanged;
|
||||
|
||||
// If this Connection has already been asked to connect but the browser hadn't finished initalising
|
||||
// then the connect wouldn't have been allowed to take place, so now we can call it!
|
||||
if (connectCalled)
|
||||
{
|
||||
Connect();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -156,6 +156,13 @@ namespace mRemoteNG.UI.Forms
|
||||
|
||||
SetMenuDependencies();
|
||||
|
||||
//Monitor parent process exit and close subprocesses if parent process exits first
|
||||
//This will at some point in the future becomes the default
|
||||
CefSharpSettings.SubprocessExitIfParentProcessClosed = true;
|
||||
|
||||
//For Windows 7 and above, best to include relevant app.manifest entries as well
|
||||
Cef.EnableHighDPISupport();
|
||||
|
||||
CefSettings settings = new CefSettings();
|
||||
settings.LogSeverity = CefSharp.LogSeverity.Verbose;
|
||||
Cef.Initialize(settings);
|
||||
|
||||
@@ -778,6 +778,7 @@
|
||||
<runtime>
|
||||
<generatePublisherEvidence enabled="false" />
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<probing privatePath="x86"/>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="WeifenLuo.WinFormsUI.Docking" publicKeyToken="5cded1a1a0a7b481" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-3.0.6.0" newVersion="3.0.6.0" />
|
||||
|
||||
@@ -50,6 +50,7 @@
|
||||
<UseApplicationTrust>false</UseApplicationTrust>
|
||||
<PublishWizardCompleted>true</PublishWizardCompleted>
|
||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||
<CefSharpAnyCpuSupport>true</CefSharpAnyCpuSupport>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="ADTree">
|
||||
@@ -1141,7 +1142,9 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include=".editorconfig" />
|
||||
<None Include="app.config" />
|
||||
<None Include="app.config">
|
||||
<SubType>Designer</SubType>
|
||||
</None>
|
||||
<None Include="..\CHANGELOG.md">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
|
||||
Reference in New Issue
Block a user