Update tab text for HTTP(S) connections

This commit is contained in:
Sean Kaim
2019-02-20 23:03:31 -05:00
parent 1fec4b33b2
commit 1bb18abf5a

View File

@@ -1,8 +1,9 @@
using System;
using System;
using System.Windows.Forms;
using Gecko;
using mRemoteNG.Tools;
using mRemoteNG.App;
using mRemoteNG.UI.Tabs;
namespace mRemoteNG.Connection.Protocol.Http
@@ -48,8 +49,7 @@ namespace mRemoteNG.Connection.Protocol.Http
try
{
var objTabPage = InterfaceControl.Parent as TabPage;
// if (objTabPage != null) tabTitle = objTabPage.Title;
if (InterfaceControl.Parent is ConnectionTab objConnectionTab) tabTitle = objConnectionTab.TabText;
}
catch (Exception)
{
@@ -168,8 +168,7 @@ namespace mRemoteNG.Connection.Protocol.Http
private void wBrowser_Navigated(object sender, WebBrowserNavigatedEventArgs e)
{
var objWebBrowser = wBrowser as WebBrowser;
if (objWebBrowser == null) return;
if (!(wBrowser is WebBrowser objWebBrowser)) return;
// This can only be set once the WebBrowser control is shown, it will throw a COM exception otherwise.
objWebBrowser.AllowWebBrowserDrop = false;
@@ -181,9 +180,7 @@ namespace mRemoteNG.Connection.Protocol.Http
{
try
{
var tabP = InterfaceControl.Parent as TabPage;
if (tabP == null) return;
if (!(InterfaceControl.Parent is ConnectionTab tabP)) return;
string shortTitle;
if (InterfaceControl.Info.RenderingEngine == RenderingEngine.Gecko)
@@ -209,14 +206,14 @@ namespace mRemoteNG.Connection.Protocol.Http
}
}
/* if (!string.IsNullOrEmpty(tabTitle))
if (!string.IsNullOrEmpty(tabTitle))
{
tabP.Title = tabTitle + @" - " + shortTitle;
tabP.TabText = tabTitle + @" - " + shortTitle;
}
else
{
tabP.Title = shortTitle;
}*/
tabP.TabText = shortTitle;
}
}
catch (Exception ex)
{
@@ -229,9 +226,7 @@ namespace mRemoteNG.Connection.Protocol.Http
{
try
{
var tabP = InterfaceControl.Parent as TabPage;
if (tabP == null) return;
if (!(InterfaceControl.Parent is ConnectionTab tabP)) return;
string shortTitle;
if (InterfaceControl.Info.RenderingEngine == RenderingEngine.Gecko)
@@ -257,14 +252,14 @@ namespace mRemoteNG.Connection.Protocol.Http
}
}
/* if (!string.IsNullOrEmpty(tabTitle))
if (!string.IsNullOrEmpty(tabTitle))
{
tabP.Title = tabTitle + @" - " + shortTitle;
tabP.TabText = tabTitle + @" - " + shortTitle;
}
else
{
tabP.Title = shortTitle;
}*/
tabP.TabText = shortTitle;
}
}
catch (Exception ex)
{