@@ -584,5 +584,17 @@
False
+
+ 0
+
+
+ False
+
+
+ False
+
+
+ False
+
\ No newline at end of file
diff --git a/mRemoteV1/Resources/Help/QuickConnect.htm b/mRemoteV1/Resources/Help/QuickConnect.htm
index 943e82e9a..3f784d495 100644
--- a/mRemoteV1/Resources/Help/QuickConnect.htm
+++ b/mRemoteV1/Resources/Help/QuickConnect.htm
@@ -1,13 +1,60 @@
-
-
-
- Quick Connect
-
-
-
-
-
- Sorry, not yet...
-
-
+
+
+
+ Quick Connect
+
+
+
+
+
+ The Quick Connect functionality of mRemoteNG allows you to quickly connect to a remote host using a variety of network protocols.
+
+
+
+ Use Cases
+
+
+
+ The primary use case for Quick Connect is to connect to remote hosts when you already remember the DNS hostname/IP address and the appropriate protocol for the connection.
+
+
+ An additional use case is to connect to remote hosts saved as a connection quickly.
+
+
+
+ Prerequisites
+
+
+
+ Knowledge of a DNS host name or IP address
+ Knowledge of an appropriate protocol to communicate with remote host
+
+ OR
+
+ A predefined mRemoteNG connection
+
+
+
+ Using QuickConnect
+
+
+
+ To use Quick Connect, ensure the Quick Connect toolbar is enabled by selecting View and then Quick Connect Toolbar .
+
+ Next, input a DNS host name or IP address into the box labeled "Connect". This box will also save previous entries during your session.
+
+
+
+
+
+
+
+ Select the appropriate network protocol by clicking the arrow next to the Connect box.
+
+
+
+
+ If you wish to use an existing connection, select the globe icon next to the protocol button and select the appropriate connection.
+
+
\ No newline at end of file
diff --git a/mRemoteV1/Resources/Help/Screenshots/Quick Connect/01.png b/mRemoteV1/Resources/Help/Screenshots/Quick Connect/01.png
new file mode 100644
index 000000000..3fa15b94d
Binary files /dev/null and b/mRemoteV1/Resources/Help/Screenshots/Quick Connect/01.png differ
diff --git a/mRemoteV1/Resources/Help/Screenshots/Quick Connect/02.png b/mRemoteV1/Resources/Help/Screenshots/Quick Connect/02.png
new file mode 100644
index 000000000..897788fd6
Binary files /dev/null and b/mRemoteV1/Resources/Help/Screenshots/Quick Connect/02.png differ
diff --git a/mRemoteV1/Resources/Help/Screenshots/Quick Connect/03.png b/mRemoteV1/Resources/Help/Screenshots/Quick Connect/03.png
new file mode 100644
index 000000000..2d662fd52
Binary files /dev/null and b/mRemoteV1/Resources/Help/Screenshots/Quick Connect/03.png differ
diff --git a/mRemoteV1/Resources/Help/Screenshots/Quickconnect/01.png b/mRemoteV1/Resources/Help/Screenshots/Quickconnect/01.png
new file mode 100644
index 000000000..3fa15b94d
Binary files /dev/null and b/mRemoteV1/Resources/Help/Screenshots/Quickconnect/01.png differ
diff --git a/mRemoteV1/Resources/Help/Screenshots/Quickconnect/02.png b/mRemoteV1/Resources/Help/Screenshots/Quickconnect/02.png
new file mode 100644
index 000000000..897788fd6
Binary files /dev/null and b/mRemoteV1/Resources/Help/Screenshots/Quickconnect/02.png differ
diff --git a/mRemoteV1/Resources/Help/Screenshots/Quickconnect/03.png b/mRemoteV1/Resources/Help/Screenshots/Quickconnect/03.png
new file mode 100644
index 000000000..2d662fd52
Binary files /dev/null and b/mRemoteV1/Resources/Help/Screenshots/Quickconnect/03.png differ
diff --git a/mRemoteV1/Resources/Language/Language.Designer.cs b/mRemoteV1/Resources/Language/Language.Designer.cs
index 899f6bc5e..4b674afca 100644
--- a/mRemoteV1/Resources/Language/Language.Designer.cs
+++ b/mRemoteV1/Resources/Language/Language.Designer.cs
@@ -4117,6 +4117,24 @@ namespace mRemoteNG {
}
}
+ ///
+ /// Looks up a localized string similar to Select whether to receive an alert after the RDP session disconnects due to inactivity.
+ ///
+ internal static string strPropertyDescriptionRDPAlertIdleTimeout {
+ get {
+ return ResourceManager.GetString("strPropertyDescriptionRDPAlertIdleTimeout", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to The number of minutes for the RDP session to sit idle before automatically disconnecting (for no limit use 0).
+ ///
+ internal static string strPropertyDescriptionRDPMinutesToIdleTimeout {
+ get {
+ return ResourceManager.GetString("strPropertyDescriptionRDPMinutesToIdleTimeout", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Select whether local disk drives should be shown on the remote host..
///
@@ -4603,6 +4621,24 @@ namespace mRemoteNG {
}
}
+ ///
+ /// Looks up a localized string similar to Alert on Idle Disconnect.
+ ///
+ internal static string strPropertyNameRDPAlertIdleTimeout {
+ get {
+ return ResourceManager.GetString("strPropertyNameRDPAlertIdleTimeout", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Minutes to Idle.
+ ///
+ internal static string strPropertyNameRDPMinutesToIdleTimeout {
+ get {
+ return ResourceManager.GetString("strPropertyNameRDPMinutesToIdleTimeout", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Disk Drives.
///
diff --git a/mRemoteV1/Resources/Language/Language.resx b/mRemoteV1/Resources/Language/Language.resx
index 34cff4195..a928e5068 100644
--- a/mRemoteV1/Resources/Language/Language.resx
+++ b/mRemoteV1/Resources/Language/Language.resx
@@ -2421,4 +2421,16 @@ mRemoteNG will now quit and begin with the installation.
Download
+
+ The number of minutes for the RDP session to sit idle before automatically disconnecting (for no limit use 0)
+
+
+ Minutes to Idle
+
+
+ Select whether to receive an alert after the RDP session disconnects due to inactivity
+
+
+ Alert on Idle Disconnect
+
\ No newline at end of file
diff --git a/mRemoteV1/Schemas/mremoteng_confcons_v2_6.xsd b/mRemoteV1/Schemas/mremoteng_confcons_v2_6.xsd
index a3fbb4c83..8f2b79160 100644
--- a/mRemoteV1/Schemas/mremoteng_confcons_v2_6.xsd
+++ b/mRemoteV1/Schemas/mremoteng_confcons_v2_6.xsd
@@ -34,6 +34,7 @@
+
@@ -46,6 +47,8 @@
+
+
@@ -114,6 +117,8 @@
+
+
diff --git a/mRemoteV1/Themes/ThemeInfo.cs b/mRemoteV1/Themes/ThemeInfo.cs
index 41ae1f189..fc72f5801 100644
--- a/mRemoteV1/Themes/ThemeInfo.cs
+++ b/mRemoteV1/Themes/ThemeInfo.cs
@@ -117,7 +117,7 @@ namespace mRemoteNG.Themes
{
if (_name == value)
{
- return ;
+ return;
}
_name = value;
NotifyPropertyChanged("Name");
@@ -135,7 +135,7 @@ namespace mRemoteNG.Themes
{
if (_windowBackgroundColor == value)
{
- return ;
+ return;
}
_windowBackgroundColor = value;
NotifyPropertyChanged("WindowBackgroundColor");
@@ -152,7 +152,7 @@ namespace mRemoteNG.Themes
{
if (_menuBackgroundColor == value)
{
- return ;
+ return;
}
_menuBackgroundColor = value;
NotifyPropertyChanged("MenuBackgroundColor");
@@ -169,7 +169,7 @@ namespace mRemoteNG.Themes
{
if (_menuTextColor == value)
{
- return ;
+ return;
}
_menuTextColor = value;
NotifyPropertyChanged("MenuTextColor");
@@ -187,7 +187,7 @@ namespace mRemoteNG.Themes
{
if (_toolbarBackgroundColor == value || value.A < 255)
{
- return ;
+ return;
}
_toolbarBackgroundColor = value;
NotifyPropertyChanged("ToolbarBackgroundColor");
@@ -204,7 +204,7 @@ namespace mRemoteNG.Themes
{
if (_toolbarTextColor == value)
{
- return ;
+ return;
}
_toolbarTextColor = value;
NotifyPropertyChanged("ToolbarTextColor");
@@ -223,7 +223,7 @@ namespace mRemoteNG.Themes
{
if (_connectionsPanelBackgroundColor == value || value.A < 255)
{
- return ;
+ return;
}
_connectionsPanelBackgroundColor = value;
NotifyPropertyChanged("ConnectionsPanelBackgroundColor");
@@ -240,7 +240,7 @@ namespace mRemoteNG.Themes
{
if (_connectionsPanelTextColor == value)
{
- return ;
+ return;
}
_connectionsPanelTextColor = value;
NotifyPropertyChanged("ConnectionsPanelTextColor");
@@ -260,7 +260,7 @@ namespace mRemoteNG.Themes
{
if (_connectionsPanelTreeLineColor == value)
{
- return ;
+ return;
}
_connectionsPanelTreeLineColor = value;
NotifyPropertyChanged("ConnectionsPanelTreeLineColor");
@@ -280,7 +280,7 @@ namespace mRemoteNG.Themes
{
if (_searchBoxBackgroundColor == value || value.A < 255)
{
- return ;
+ return;
}
_searchBoxBackgroundColor = value;
NotifyPropertyChanged("SearchBoxBackgroundColor");
@@ -300,7 +300,7 @@ namespace mRemoteNG.Themes
{
if (_searchBoxTextPromptColor == value)
{
- return ;
+ return;
}
_searchBoxTextPromptColor = value;
NotifyPropertyChanged("SearchBoxTextPromptColor");
@@ -320,7 +320,7 @@ namespace mRemoteNG.Themes
{
if (_searchBoxTextColor == value)
{
- return ;
+ return;
}
_searchBoxTextColor = value;
NotifyPropertyChanged("SearchBoxTextColor");
@@ -342,7 +342,7 @@ namespace mRemoteNG.Themes
{
if (_configPanelBackgroundColor == value || value.A < 255)
{
- return ;
+ return;
}
_configPanelBackgroundColor = value;
NotifyPropertyChanged("ConfigPanelBackgroundColor");
@@ -362,7 +362,7 @@ namespace mRemoteNG.Themes
{
if (_configPanelTextColor == value)
{
- return ;
+ return;
}
_configPanelTextColor = value;
NotifyPropertyChanged("ConfigPanelTextColor");
@@ -382,7 +382,7 @@ namespace mRemoteNG.Themes
{
if (_configPanelCategoryTextColor == value)
{
- return ;
+ return;
}
_configPanelCategoryTextColor = value;
NotifyPropertyChanged("ConfigPanelCategoryTextColor");
@@ -402,7 +402,7 @@ namespace mRemoteNG.Themes
{
if (_configPanelHelpBackgroundColor == value || value.A < 255)
{
- return ;
+ return;
}
_configPanelHelpBackgroundColor = value;
NotifyPropertyChanged("ConfigPanelHelpBackgroundColor");
@@ -422,7 +422,7 @@ namespace mRemoteNG.Themes
{
if (_configPanelHelpTextColor == value)
{
- return ;
+ return;
}
_configPanelHelpTextColor = value;
NotifyPropertyChanged("ConfigPanelHelpTextColor");
@@ -442,7 +442,7 @@ namespace mRemoteNG.Themes
{
if (_configPanelGridLineColor == value)
{
- return ;
+ return;
}
_configPanelGridLineColor = value;
NotifyPropertyChanged("ConfigPanelGridLineColor");
diff --git a/mRemoteV1/Themes/ThemeManager.cs b/mRemoteV1/Themes/ThemeManager.cs
index 4516c8874..6584f67f8 100644
--- a/mRemoteV1/Themes/ThemeManager.cs
+++ b/mRemoteV1/Themes/ThemeManager.cs
@@ -81,7 +81,7 @@ namespace mRemoteNG.Themes
{
if (e.PropertyName == "Name")
{
- return ;
+ return;
}
ThemeChangedEvent?.Invoke();
}
diff --git a/mRemoteV1/Tools/ExternalTool.cs b/mRemoteV1/Tools/ExternalTool.cs
index 9e25ae3c1..279e31de6 100644
--- a/mRemoteV1/Tools/ExternalTool.cs
+++ b/mRemoteV1/Tools/ExternalTool.cs
@@ -11,6 +11,7 @@ namespace mRemoteNG.Tools
{
public class ExternalTool
{
+ private readonly IConnectionInitiator _connectionInitiator = new ConnectionInitiator();
#region Public Properties
public string DisplayName { get; set; }
public string FileName { get; set; }
@@ -57,7 +58,7 @@ namespace mRemoteNG.Tools
private void StartExternalProcess()
{
- Process process = new Process();
+ var process = new Process();
SetProcessProperties(process, ConnectionInfo);
process.Start();
@@ -69,7 +70,7 @@ namespace mRemoteNG.Tools
private void SetProcessProperties(Process process, ConnectionInfo startConnectionInfo)
{
- ExternalToolArgumentParser argParser = new ExternalToolArgumentParser(startConnectionInfo);
+ var argParser = new ExternalToolArgumentParser(startConnectionInfo);
process.StartInfo.UseShellExecute = true;
process.StartInfo.FileName = argParser.ParseArguments(FileName);
process.StartInfo.Arguments = argParser.ParseArguments(Arguments);
@@ -79,18 +80,18 @@ namespace mRemoteNG.Tools
{
try
{
- ConnectionInfo newConnectionInfo = BuildConnectionInfoForIntegratedApp();
- ConnectionInitiator.OpenConnection(newConnectionInfo);
+ var newConnectionInfo = BuildConnectionInfoForIntegratedApp();
+ _connectionInitiator.OpenConnection(newConnectionInfo);
}
catch (Exception ex)
{
- Runtime.MessageCollector.AddExceptionMessage(message: "ExternalApp.StartIntegrated() failed.", ex: ex, logOnly: true);
+ Runtime.MessageCollector.AddExceptionMessage("ExternalApp.StartIntegrated() failed.", ex);
}
}
private ConnectionInfo BuildConnectionInfoForIntegratedApp()
{
- ConnectionInfo newConnectionInfo = GetAppropriateInstanceOfConnectionInfo();
+ var newConnectionInfo = GetAppropriateInstanceOfConnectionInfo();
SetConnectionInfoFields(newConnectionInfo);
return newConnectionInfo;
}
diff --git a/mRemoteV1/Tools/MiscTools.cs b/mRemoteV1/Tools/MiscTools.cs
index c67b67e33..b09c86150 100644
--- a/mRemoteV1/Tools/MiscTools.cs
+++ b/mRemoteV1/Tools/MiscTools.cs
@@ -14,7 +14,7 @@ using static System.String;
namespace mRemoteNG.Tools
{
- public class MiscTools
+ public static class MiscTools
{
public static Icon GetIconFromFile(string FileName)
{
@@ -112,7 +112,7 @@ namespace mRemoteNG.Tools
}
catch (Exception ex)
{
- Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg, "Taking Screenshot failed" + Environment.NewLine + ex.Message, true);
+ Runtime.MessageCollector.AddExceptionStackTrace("Taking Screenshot failed", ex);
}
return null;
@@ -120,7 +120,7 @@ namespace mRemoteNG.Tools
public class EnumTypeConverter : EnumConverter
{
- private Type _enumType;
+ private readonly Type _enumType;
public EnumTypeConverter(Type type) : base(type)
{
@@ -135,8 +135,8 @@ namespace mRemoteNG.Tools
public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destType)
{
if (value == null) return null;
- var fi = _enumType.GetField(Enum.GetName(_enumType, value: value));
- var dna = (DescriptionAttribute) (Attribute.GetCustomAttribute(fi, typeof(DescriptionAttribute)));
+ var fi = _enumType.GetField(Enum.GetName(_enumType, value));
+ var dna = (DescriptionAttribute) Attribute.GetCustomAttribute(fi, typeof(DescriptionAttribute));
return dna != null ? dna.Description : value.ToString();
}
@@ -150,9 +150,9 @@ namespace mRemoteNG.Tools
{
foreach (var fi in _enumType.GetFields())
{
- var dna = (DescriptionAttribute) (Attribute.GetCustomAttribute(fi, typeof(DescriptionAttribute)));
+ var dna = (DescriptionAttribute) Attribute.GetCustomAttribute(fi, typeof(DescriptionAttribute));
- if ((dna != null) && ((string) value == dna.Description))
+ if (dna != null && (string) value == dna.Description)
{
return Enum.Parse(_enumType, fi.Name);
}
@@ -167,12 +167,7 @@ namespace mRemoteNG.Tools
public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
{
- if (sourceType == typeof(string))
- {
- return true;
- }
-
- return base.CanConvertFrom(context, sourceType);
+ return sourceType == typeof(string) || base.CanConvertFrom(context, sourceType);
}
public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType)
@@ -193,7 +188,7 @@ namespace mRemoteNG.Tools
return false;
}
- throw (new Exception("Values must be \"Yes\" or \"No\""));
+ throw new Exception("Values must be \"Yes\" or \"No\"");
}
public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
@@ -220,63 +215,5 @@ namespace mRemoteNG.Tools
return svc;
}
}
-
- public class Fullscreen
- {
- public Fullscreen(Form handledForm)
- {
- _handledForm = handledForm;
- }
-
- private readonly Form _handledForm;
- private FormWindowState _savedWindowState;
- private FormBorderStyle _savedBorderStyle;
- private Rectangle _savedBounds;
-
- private bool _value;
- public bool Value
- {
- get
- {
- return _value;
- }
- set
- {
- if (_value == value)
- {
- return ;
- }
- if (!_value)
- {
- EnterFullscreen();
- }
- else
- {
- ExitFullscreen();
- }
- _value = value;
- }
- }
-
- private void EnterFullscreen()
- {
- _savedBorderStyle = _handledForm.FormBorderStyle;
- _savedWindowState = _handledForm.WindowState;
- _savedBounds = _handledForm.Bounds;
-
- _handledForm.FormBorderStyle = FormBorderStyle.None;
- if (_handledForm.WindowState == FormWindowState.Maximized)
- {
- _handledForm.WindowState = FormWindowState.Normal;
- }
- _handledForm.WindowState = FormWindowState.Maximized;
- }
- private void ExitFullscreen()
- {
- _handledForm.FormBorderStyle = _savedBorderStyle;
- _handledForm.WindowState = _savedWindowState;
- _handledForm.Bounds = _savedBounds;
- }
- }
}
}
\ No newline at end of file
diff --git a/mRemoteV1/Tools/NotificationAreaIcon.cs b/mRemoteV1/Tools/NotificationAreaIcon.cs
new file mode 100644
index 000000000..cd66a8554
--- /dev/null
+++ b/mRemoteV1/Tools/NotificationAreaIcon.cs
@@ -0,0 +1,128 @@
+using System;
+using System.Linq;
+using System.Windows.Forms;
+using mRemoteNG.App;
+using mRemoteNG.Connection;
+using mRemoteNG.UI.Forms;
+
+
+namespace mRemoteNG.Tools
+{
+ public class NotificationAreaIcon
+ {
+ private readonly NotifyIcon _nI;
+ private readonly ContextMenuStrip _cMen;
+ private readonly ToolStripMenuItem _cMenCons;
+ private readonly IConnectionInitiator _connectionInitiator = new ConnectionInitiator();
+
+ public bool Disposed { get; private set; }
+
+ public NotificationAreaIcon()
+ {
+ try
+ {
+ _cMenCons = new ToolStripMenuItem
+ {
+ Text = Language.strConnections,
+ Image = Resources.Root
+ };
+
+ var cMenSep1 = new ToolStripSeparator();
+
+ var cMenExit = new ToolStripMenuItem {Text = Language.strMenuExit};
+ cMenExit.Click += cMenExit_Click;
+
+ _cMen = new ContextMenuStrip
+ {
+ Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular,
+ System.Drawing.GraphicsUnit.Point, Convert.ToByte(0)),
+ RenderMode = ToolStripRenderMode.Professional
+ };
+ _cMen.Items.AddRange(new ToolStripItem[] {_cMenCons, cMenSep1, cMenExit});
+
+ _nI = new NotifyIcon
+ {
+ Text = @"mRemoteNG",
+ BalloonTipText = @"mRemoteNG",
+ Icon = Resources.mRemote_Icon,
+ ContextMenuStrip = _cMen,
+ Visible = true
+ };
+
+ _nI.MouseClick += nI_MouseClick;
+ _nI.MouseDoubleClick += nI_MouseDoubleClick;
+ }
+ catch (Exception ex)
+ {
+ Runtime.MessageCollector.AddExceptionStackTrace("Creating new SysTrayIcon failed", ex);
+ }
+ }
+
+ public void Dispose()
+ {
+ try
+ {
+ _nI.Visible = false;
+ _nI.Dispose();
+ _cMen.Dispose();
+ Disposed = true;
+ }
+ catch (Exception ex)
+ {
+ Runtime.MessageCollector.AddExceptionStackTrace("Disposing SysTrayIcon failed", ex);
+ }
+ }
+
+ private void nI_MouseClick(object sender, MouseEventArgs e)
+ {
+ if (e.Button != MouseButtons.Right) return;
+ _cMenCons.DropDownItems.Clear();
+ var menuItemsConverter = new ConnectionsTreeToMenuItemsConverter
+ {
+ MouseUpEventHandler = ConMenItem_MouseUp
+ };
+
+ // ReSharper disable once CoVariantArrayConversion
+ ToolStripItem[] rootMenuItems = menuItemsConverter.CreateToolStripDropDownItems(Runtime.ConnectionTreeModel).ToArray();
+ _cMenCons.DropDownItems.AddRange(rootMenuItems);
+ }
+
+ private static void nI_MouseDoubleClick(object sender, MouseEventArgs e)
+ {
+ if (frmMain.Default.Visible)
+ HideForm();
+ else
+ ShowForm();
+ }
+
+ private static void ShowForm()
+ {
+ frmMain.Default.Show();
+ frmMain.Default.WindowState = frmMain.Default.PreviousWindowState;
+
+ if (Settings.Default.ShowSystemTrayIcon) return;
+ Runtime.NotificationAreaIcon.Dispose();
+ Runtime.NotificationAreaIcon = null;
+ }
+
+ private static void HideForm()
+ {
+ frmMain.Default.Hide();
+ frmMain.Default.PreviousWindowState = frmMain.Default.WindowState;
+ }
+
+ private void ConMenItem_MouseUp(object sender, MouseEventArgs e)
+ {
+ if (e.Button != MouseButtons.Left) return;
+ if (!(((ToolStripMenuItem) sender).Tag is ConnectionInfo)) return;
+ if (frmMain.Default.Visible == false)
+ ShowForm();
+ _connectionInitiator.OpenConnection((ConnectionInfo) ((ToolStripMenuItem) sender).Tag);
+ }
+
+ private static void cMenExit_Click(object sender, EventArgs e)
+ {
+ Shutdown.Quit();
+ }
+ }
+}
\ No newline at end of file
diff --git a/mRemoteV1/Tools/ProcessController.cs b/mRemoteV1/Tools/ProcessController.cs
index 13c11145b..625b73fe0 100644
--- a/mRemoteV1/Tools/ProcessController.cs
+++ b/mRemoteV1/Tools/ProcessController.cs
@@ -83,7 +83,7 @@ namespace mRemoteNG.Tools
public void WaitForExit()
{
if (Process == null || Process.HasExited)
- return ;
+ return;
Process.WaitForExit();
}
#endregion
diff --git a/mRemoteV1/Tools/Tools.Controls.cs b/mRemoteV1/Tools/Tools.Controls.cs
deleted file mode 100644
index 1e92b03a2..000000000
--- a/mRemoteV1/Tools/Tools.Controls.cs
+++ /dev/null
@@ -1,161 +0,0 @@
-using System;
-using System.Linq;
-using System.Windows.Forms;
-using mRemoteNG.App;
-using mRemoteNG.Connection;
-using mRemoteNG.UI.Forms;
-
-
-namespace mRemoteNG.Tools
-{
- public class Controls
- {
- public class NotificationAreaIcon
- {
- private NotifyIcon _nI;
- private ContextMenuStrip _cMen;
- private ToolStripMenuItem _cMenCons;
-
- public bool Disposed { get; set; }
-
- public NotificationAreaIcon()
- {
- try
- {
- _cMenCons = new ToolStripMenuItem
- {
- Text = Language.strConnections,
- Image = Resources.Root
- };
-
- var cMenSep1 = new ToolStripSeparator();
-
- var cMenExit = new ToolStripMenuItem {Text = Language.strMenuExit};
- cMenExit.Click += cMenExit_Click;
-
- _cMen = new ContextMenuStrip
- {
- Font =
- new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular,
- System.Drawing.GraphicsUnit.Point, Convert.ToByte(0)),
- RenderMode = ToolStripRenderMode.Professional
- };
- _cMen.Items.AddRange(new ToolStripItem[] {_cMenCons, cMenSep1, cMenExit});
-
- _nI = new NotifyIcon
- {
- Text = "mRemote",
- BalloonTipText = "mRemote",
- Icon = Resources.mRemote_Icon,
- ContextMenuStrip = _cMen,
- Visible = true
- };
-
- _nI.MouseClick += nI_MouseClick;
- _nI.MouseDoubleClick += nI_MouseDoubleClick;
- }
- catch (Exception ex)
- {
- Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, "Creating new SysTrayIcon failed" + Environment.NewLine + ex.Message, true);
- }
- }
-
- public void Dispose()
- {
- try
- {
- _nI.Visible = false;
- _nI.Dispose();
- _cMen.Dispose();
- Disposed = true;
- }
- catch (Exception ex)
- {
- Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, "Disposing SysTrayIcon failed" + Environment.NewLine + ex.Message, true);
- }
- }
-
- private void nI_MouseClick(object sender, MouseEventArgs e)
- {
- if (e.Button != MouseButtons.Right) return;
- _cMenCons.DropDownItems.Clear();
- var menuItemsConverter = new ConnectionsTreeToMenuItemsConverter
- {
- MouseUpEventHandler = ConMenItem_MouseUp
- };
-
- ToolStripItem[] rootMenuItems = menuItemsConverter.CreateToolStripDropDownItems(Runtime.ConnectionTreeModel).ToArray();
- _cMenCons.DropDownItems.AddRange(rootMenuItems);
- }
-
- private void nI_MouseDoubleClick(object sender, MouseEventArgs e)
- {
- if (frmMain.Default.Visible)
- {
- HideForm();
- }
- else
- {
- ShowForm();
- }
- }
-
- private void ShowForm()
- {
- frmMain.Default.Show();
- frmMain.Default.WindowState = frmMain.Default.PreviousWindowState;
-
- if (Settings.Default.ShowSystemTrayIcon) return;
- Runtime.NotificationAreaIcon.Dispose();
- Runtime.NotificationAreaIcon = null;
- }
-
- private void HideForm()
- {
- frmMain.Default.Hide();
- frmMain.Default.PreviousWindowState = frmMain.Default.WindowState;
- }
-
- private void ConMenItem_MouseUp(Object sender, MouseEventArgs e)
- {
- if (e.Button != MouseButtons.Left) return;
- if (!(((Control) sender).Tag is ConnectionInfo)) return;
- if (frmMain.Default.Visible == false)
- {
- ShowForm();
- }
- ConnectionInitiator.OpenConnection((ConnectionInfo)((Control)sender).Tag);
- }
-
- private void cMenExit_Click(Object sender, EventArgs e)
- {
- Shutdown.Quit();
- }
- }
-
- public static SaveFileDialog ConnectionsSaveAsDialog()
- {
- var saveFileDialog = new SaveFileDialog();
- saveFileDialog.CheckPathExists = true;
- saveFileDialog.InitialDirectory = App.Info.ConnectionsFileInfo.DefaultConnectionsPath;
- saveFileDialog.FileName = App.Info.ConnectionsFileInfo.DefaultConnectionsFile;
- saveFileDialog.OverwritePrompt = true;
-
- saveFileDialog.Filter = Language.strFiltermRemoteXML + "|*.xml|" + Language.strFilterAll + "|*.*";
-
- return saveFileDialog;
- }
-
- public static OpenFileDialog ConnectionsLoadDialog()
- {
- var lDlg = new OpenFileDialog
- {
- CheckFileExists = true,
- InitialDirectory = App.Info.ConnectionsFileInfo.DefaultConnectionsPath,
- Filter = Language.strFiltermRemoteXML + "|*.xml|" + Language.strFilterAll + "|*.*"
- };
-
- return lDlg;
- }
- }
-}
\ No newline at end of file
diff --git a/mRemoteV1/Tree/AlwaysConfirmYes.cs b/mRemoteV1/Tree/AlwaysConfirmYes.cs
new file mode 100644
index 000000000..40d0989ec
--- /dev/null
+++ b/mRemoteV1/Tree/AlwaysConfirmYes.cs
@@ -0,0 +1,11 @@
+
+namespace mRemoteNG.Tree
+{
+ public class AlwaysConfirmYes : IConfirm
+ {
+ public bool Confirm()
+ {
+ return true;
+ }
+ }
+}
\ No newline at end of file
diff --git a/mRemoteV1/Tree/ClickHandlers/ExpandNodeClickHandler.cs b/mRemoteV1/Tree/ClickHandlers/ExpandNodeClickHandler.cs
new file mode 100644
index 000000000..63ae56e6e
--- /dev/null
+++ b/mRemoteV1/Tree/ClickHandlers/ExpandNodeClickHandler.cs
@@ -0,0 +1,28 @@
+using System;
+using mRemoteNG.Connection;
+using mRemoteNG.Container;
+using mRemoteNG.UI.Controls;
+
+
+namespace mRemoteNG.Tree
+{
+ public class ExpandNodeClickHandler : ITreeNodeClickHandler
+ {
+ private readonly IConnectionTree _connectionTree;
+
+ public ExpandNodeClickHandler(IConnectionTree connectionTree)
+ {
+ if (connectionTree == null)
+ throw new ArgumentNullException(nameof(connectionTree));
+
+ _connectionTree = connectionTree;
+ }
+
+ public void Execute(ConnectionInfo clickedNode)
+ {
+ var clickedNodeAsContainer = clickedNode as ContainerInfo;
+ if (clickedNodeAsContainer == null) return;
+ _connectionTree.ToggleExpansion(clickedNodeAsContainer);
+ }
+ }
+}
\ No newline at end of file
diff --git a/mRemoteV1/Tree/ClickHandlers/ITreeNodeClickHandler.cs b/mRemoteV1/Tree/ClickHandlers/ITreeNodeClickHandler.cs
new file mode 100644
index 000000000..40b2852a7
--- /dev/null
+++ b/mRemoteV1/Tree/ClickHandlers/ITreeNodeClickHandler.cs
@@ -0,0 +1,10 @@
+using mRemoteNG.Connection;
+
+
+namespace mRemoteNG.Tree
+{
+ public interface ITreeNodeClickHandler
+ {
+ void Execute(ConnectionInfo clickedNode);
+ }
+}
\ No newline at end of file
diff --git a/mRemoteV1/Tree/ClickHandlers/OpenConnectionClickHandler.cs b/mRemoteV1/Tree/ClickHandlers/OpenConnectionClickHandler.cs
new file mode 100644
index 000000000..078d94e81
--- /dev/null
+++ b/mRemoteV1/Tree/ClickHandlers/OpenConnectionClickHandler.cs
@@ -0,0 +1,26 @@
+using System;
+using mRemoteNG.Connection;
+
+
+namespace mRemoteNG.Tree
+{
+ public class OpenConnectionClickHandler : ITreeNodeClickHandler
+ {
+ private readonly IConnectionInitiator _connectionInitiator;
+
+ public OpenConnectionClickHandler(IConnectionInitiator connectionInitiator)
+ {
+ if (connectionInitiator == null)
+ throw new ArgumentNullException(nameof(connectionInitiator));
+ _connectionInitiator = connectionInitiator;
+ }
+
+ public void Execute(ConnectionInfo clickedNode)
+ {
+ if (clickedNode == null)
+ throw new ArgumentNullException(nameof(clickedNode));
+ if (clickedNode.GetTreeNodeType() != TreeNodeType.Connection && clickedNode.GetTreeNodeType() != TreeNodeType.PuttySession) return;
+ _connectionInitiator.OpenConnection(clickedNode);
+ }
+ }
+}
\ No newline at end of file
diff --git a/mRemoteV1/Tree/ClickHandlers/SwitchToConnectionClickHandler.cs b/mRemoteV1/Tree/ClickHandlers/SwitchToConnectionClickHandler.cs
new file mode 100644
index 000000000..5ed5ddf95
--- /dev/null
+++ b/mRemoteV1/Tree/ClickHandlers/SwitchToConnectionClickHandler.cs
@@ -0,0 +1,26 @@
+using System;
+using mRemoteNG.Connection;
+
+
+namespace mRemoteNG.Tree
+{
+ public class SwitchToConnectionClickHandler : ITreeNodeClickHandler
+ {
+ private readonly IConnectionInitiator _connectionInitiator;
+
+ public SwitchToConnectionClickHandler(IConnectionInitiator connectionInitiator)
+ {
+ if (connectionInitiator == null)
+ throw new ArgumentNullException(nameof(connectionInitiator));
+ _connectionInitiator = connectionInitiator;
+ }
+
+ public void Execute(ConnectionInfo clickedNode)
+ {
+ if (clickedNode == null)
+ throw new ArgumentNullException(nameof(clickedNode));
+ if (clickedNode.GetTreeNodeType() != TreeNodeType.Connection && clickedNode.GetTreeNodeType() != TreeNodeType.PuttySession) return;
+ _connectionInitiator.SwitchToOpenConnection(clickedNode);
+ }
+ }
+}
\ No newline at end of file
diff --git a/mRemoteV1/Tree/ClickHandlers/TreeNodeCompositeClickHandler.cs b/mRemoteV1/Tree/ClickHandlers/TreeNodeCompositeClickHandler.cs
new file mode 100644
index 000000000..39c7a7c25
--- /dev/null
+++ b/mRemoteV1/Tree/ClickHandlers/TreeNodeCompositeClickHandler.cs
@@ -0,0 +1,22 @@
+using System;
+using System.Collections.Generic;
+using mRemoteNG.Connection;
+
+
+namespace mRemoteNG.Tree
+{
+ public class TreeNodeCompositeClickHandler : ITreeNodeClickHandler
+ {
+ public IEnumerable ClickHandlers { get; set; } = new ITreeNodeClickHandler[0];
+
+ public void Execute(ConnectionInfo clickedNode)
+ {
+ if (clickedNode == null)
+ throw new ArgumentNullException(nameof(clickedNode));
+ foreach (var handler in ClickHandlers)
+ {
+ handler.Execute(clickedNode);
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/mRemoteV1/Tree/IConfirm.cs b/mRemoteV1/Tree/IConfirm.cs
new file mode 100644
index 000000000..e4434cb5b
--- /dev/null
+++ b/mRemoteV1/Tree/IConfirm.cs
@@ -0,0 +1,7 @@
+namespace mRemoteNG.Tree
+{
+ public interface IConfirm
+ {
+ bool Confirm();
+ }
+}
\ No newline at end of file
diff --git a/mRemoteV1/Tree/ObjectListViewExtensions.cs b/mRemoteV1/Tree/ObjectListViewExtensions.cs
deleted file mode 100644
index 2e7c1b554..000000000
--- a/mRemoteV1/Tree/ObjectListViewExtensions.cs
+++ /dev/null
@@ -1,24 +0,0 @@
-using System.Windows.Forms;
-using BrightIdeasSoftware;
-
-
-namespace mRemoteNG.Tree
-{
- public static class ObjectListViewExtensions
- {
- public static void Invoke(this Control control, MethodInvoker action)
- {
- control.Invoke(action);
- }
-
- public static void InvokeExpand(this TreeListView control, object model)
- {
- control.Invoke(() => control.Expand(model));
- }
-
- public static void InvokeRebuildAll(this TreeListView control, bool preserveState)
- {
- control.Invoke(() => control.RebuildAll(preserveState));
- }
- }
-}
\ No newline at end of file
diff --git a/mRemoteV1/Tree/PreviousSessionOpener.cs b/mRemoteV1/Tree/PreviousSessionOpener.cs
new file mode 100644
index 000000000..5df20c8ac
--- /dev/null
+++ b/mRemoteV1/Tree/PreviousSessionOpener.cs
@@ -0,0 +1,31 @@
+using System;
+using System.Linq;
+using mRemoteNG.Connection;
+using mRemoteNG.Container;
+using mRemoteNG.UI.Controls;
+
+
+namespace mRemoteNG.Tree
+{
+ public class PreviousSessionOpener : IConnectionTreeDelegate
+ {
+ private readonly IConnectionInitiator _connectionInitiator;
+
+ public PreviousSessionOpener(IConnectionInitiator connectionInitiator)
+ {
+ if (connectionInitiator == null)
+ throw new ArgumentNullException(nameof(connectionInitiator));
+ _connectionInitiator = connectionInitiator;
+ }
+
+ public void Execute(IConnectionTree connectionTree)
+ {
+ var connectionInfoList = connectionTree.GetRootConnectionNode().GetRecursiveChildList().Where(node => !(node is ContainerInfo));
+ var previouslyOpenedConnections = connectionInfoList.Where(item => item.PleaseConnect);
+ foreach (var connectionInfo in previouslyOpenedConnections)
+ {
+ _connectionInitiator.OpenConnection(connectionInfo);
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/mRemoteV1/Tree/PreviouslyOpenedFolderExpander.cs b/mRemoteV1/Tree/PreviouslyOpenedFolderExpander.cs
new file mode 100644
index 000000000..8b26236f7
--- /dev/null
+++ b/mRemoteV1/Tree/PreviouslyOpenedFolderExpander.cs
@@ -0,0 +1,19 @@
+using System.Linq;
+using mRemoteNG.Container;
+using mRemoteNG.UI.Controls;
+
+
+namespace mRemoteNG.Tree
+{
+ public class PreviouslyOpenedFolderExpander : IConnectionTreeDelegate
+ {
+ public void Execute(IConnectionTree connectionTree)
+ {
+ var rootNode = connectionTree.GetRootConnectionNode();
+ var containerList = connectionTree.ConnectionTreeModel.GetRecursiveChildList(rootNode).OfType();
+ var previouslyExpandedNodes = containerList.Where(container => container.IsExpanded);
+ connectionTree.ExpandedObjects = previouslyExpandedNodes;
+ connectionTree.InvokeRebuildAll(true);
+ }
+ }
+}
\ No newline at end of file
diff --git a/mRemoteV1/Tree/RootNodeExpander.cs b/mRemoteV1/Tree/RootNodeExpander.cs
new file mode 100644
index 000000000..bc02f0ae8
--- /dev/null
+++ b/mRemoteV1/Tree/RootNodeExpander.cs
@@ -0,0 +1,14 @@
+using mRemoteNG.UI.Controls;
+
+
+namespace mRemoteNG.Tree
+{
+ public class RootNodeExpander : IConnectionTreeDelegate
+ {
+ public void Execute(IConnectionTree connectionTree)
+ {
+ var rootConnectionNode = connectionTree.GetRootConnectionNode();
+ connectionTree.InvokeExpand(rootConnectionNode);
+ }
+ }
+}
\ No newline at end of file
diff --git a/mRemoteV1/Tree/SelectedConnectionDeletionConfirmer.cs b/mRemoteV1/Tree/SelectedConnectionDeletionConfirmer.cs
new file mode 100644
index 000000000..cb49f726d
--- /dev/null
+++ b/mRemoteV1/Tree/SelectedConnectionDeletionConfirmer.cs
@@ -0,0 +1,56 @@
+using System;
+using System.Windows.Forms;
+using mRemoteNG.Connection;
+using mRemoteNG.Container;
+using mRemoteNG.UI.Controls;
+
+
+namespace mRemoteNG.Tree
+{
+ public class SelectedConnectionDeletionConfirmer : IConfirm
+ {
+ private readonly IConnectionTree _connectionTree;
+ private readonly Func _confirmationFunc;
+
+ public SelectedConnectionDeletionConfirmer(IConnectionTree connectionTree, Func confirmationFunc)
+ {
+ _connectionTree = connectionTree;
+ _confirmationFunc = confirmationFunc;
+ }
+
+ public bool Confirm()
+ {
+ var deletionTarget = _connectionTree.SelectedNode;
+ var deletionTargetAsContainer = deletionTarget as ContainerInfo;
+ if (deletionTargetAsContainer != null)
+ return deletionTargetAsContainer.HasChildren()
+ ? UserConfirmsNonEmptyFolderDeletion(deletionTargetAsContainer)
+ : UserConfirmsEmptyFolderDeletion(deletionTargetAsContainer);
+ return UserConfirmsConnectionDeletion(deletionTarget);
+ }
+
+ private bool UserConfirmsEmptyFolderDeletion(AbstractConnectionInfoData deletionTarget)
+ {
+ var messagePrompt = string.Format(Language.strConfirmDeleteNodeFolder, deletionTarget.Name);
+ return PromptUser(messagePrompt);
+ }
+
+ private bool UserConfirmsNonEmptyFolderDeletion(AbstractConnectionInfoData deletionTarget)
+ {
+ var messagePrompt = string.Format(Language.strConfirmDeleteNodeFolderNotEmpty, deletionTarget.Name);
+ return PromptUser(messagePrompt);
+ }
+
+ private bool UserConfirmsConnectionDeletion(AbstractConnectionInfoData deletionTarget)
+ {
+ var messagePrompt = string.Format(Language.strConfirmDeleteNodeConnection, deletionTarget.Name);
+ return PromptUser(messagePrompt);
+ }
+
+ private bool PromptUser(string promptMessage)
+ {
+ var msgBoxResponse = _confirmationFunc.Invoke(promptMessage, Application.ProductName, MessageBoxButtons.YesNo, MessageBoxIcon.Question);
+ return msgBoxResponse == DialogResult.Yes;
+ }
+ }
+}
\ No newline at end of file
diff --git a/mRemoteV1/UI/Controls/ConnectionContextMenu.cs b/mRemoteV1/UI/Controls/ConnectionContextMenu.cs
index 3816d08ae..9ff0f1457 100644
--- a/mRemoteV1/UI/Controls/ConnectionContextMenu.cs
+++ b/mRemoteV1/UI/Controls/ConnectionContextMenu.cs
@@ -1,4 +1,5 @@
using System;
+using System.ComponentModel;
using System.Linq;
using System.Windows.Forms;
using mRemoteNG.App;
@@ -6,13 +7,14 @@ using mRemoteNG.Connection;
using mRemoteNG.Connection.Protocol;
using mRemoteNG.Container;
using mRemoteNG.Tools;
+using mRemoteNG.Tree;
using mRemoteNG.Tree.Root;
// ReSharper disable UnusedParameter.Local
namespace mRemoteNG.UI.Controls
{
- internal sealed class ConnectionContextMenu : ContextMenuStrip
+ public sealed class ConnectionContextMenu : ContextMenuStrip
{
private ToolStripMenuItem _cMenTreeAddConnection;
private ToolStripMenuItem _cMenTreeAddFolder;
@@ -44,14 +46,23 @@ namespace mRemoteNG.UI.Controls
private ToolStripMenuItem _cMenTreeImportFile;
private ToolStripMenuItem _cMenTreeImportActiveDirectory;
private ToolStripMenuItem _cMenTreeImportPortScan;
+ private readonly ConnectionTree _connectionTree;
+ private readonly IConnectionInitiator _connectionInitiator;
- public ConnectionContextMenu()
+ public ConnectionContextMenu(ConnectionTree connectionTree)
{
+ _connectionTree = connectionTree;
+ _connectionInitiator = new ConnectionInitiator();
InitializeComponent();
ApplyLanguage();
EnableShortcutKeys();
- Opening += (sender, args) => AddExternalApps();
+ Opening += (sender, args) =>
+ {
+ AddExternalApps();
+ ShowHideMenuItems();
+ };
+ Closing += (sender, args) => EnableMenuItemsRecursive(Items);
}
private void InitializeComponent()
@@ -384,104 +395,129 @@ namespace mRemoteNG.UI.Controls
_cMenTreeMoveDown.Text = Language.strMoveDown;
}
- internal void ShowHideTreeContextMenuItems(ConnectionInfo connectionInfo)
+ internal void ShowHideMenuItems()
{
- if (connectionInfo == null)
+ if (_connectionTree.SelectedNode == null)
return;
try
{
Enabled = true;
EnableMenuItemsRecursive(Items);
- if (connectionInfo is RootPuttySessionsNodeInfo)
+ if (_connectionTree.SelectedNode is RootPuttySessionsNodeInfo)
{
- _cMenTreeAddConnection.Enabled = false;
- _cMenTreeAddFolder.Enabled = false;
- _cMenTreeConnect.Enabled = false;
- _cMenTreeConnectWithOptions.Enabled = false;
- _cMenTreeDisconnect.Enabled = false;
- _cMenTreeToolsTransferFile.Enabled = false;
- _cMenTreeConnectWithOptions.Enabled = false;
- _cMenTreeToolsSort.Enabled = false;
- _cMenTreeToolsExternalApps.Enabled = false;
- _cMenTreeDuplicate.Enabled = false;
- _cMenTreeRename.Enabled = true;
- _cMenTreeDelete.Enabled = false;
- _cMenTreeMoveUp.Enabled = false;
- _cMenTreeMoveDown.Enabled = false;
+ ShowHideMenuItemsForRootPuttyNode();
}
- else if (connectionInfo is RootNodeInfo)
+ else if (_connectionTree.SelectedNode is RootNodeInfo)
{
- _cMenTreeConnect.Enabled = false;
- _cMenTreeConnectWithOptions.Enabled = false;
- _cMenTreeConnectWithOptionsConnectInFullscreen.Enabled = false;
- _cMenTreeConnectWithOptionsConnectToConsoleSession.Enabled = false;
- _cMenTreeConnectWithOptionsChoosePanelBeforeConnecting.Enabled = false;
- _cMenTreeDisconnect.Enabled = false;
- _cMenTreeToolsTransferFile.Enabled = false;
- _cMenTreeToolsExternalApps.Enabled = false;
- _cMenTreeDuplicate.Enabled = false;
- _cMenTreeDelete.Enabled = false;
- _cMenTreeMoveUp.Enabled = false;
- _cMenTreeMoveDown.Enabled = false;
+ ShowHideMenuItemsForRootConnectionNode();
}
- else if (connectionInfo is ContainerInfo)
+ else if (_connectionTree.SelectedNode is ContainerInfo)
{
- _cMenTreeConnectWithOptionsConnectInFullscreen.Enabled = false;
- _cMenTreeConnectWithOptionsConnectToConsoleSession.Enabled = false;
- _cMenTreeDisconnect.Enabled = false;
-
- var openConnections = ((ContainerInfo)connectionInfo).Children.Sum(child => child.OpenConnections.Count);
- if (openConnections > 0)
- _cMenTreeDisconnect.Enabled = true;
-
- _cMenTreeToolsTransferFile.Enabled = false;
- _cMenTreeToolsExternalApps.Enabled = false;
+ ShowHideMenuItemsForContainer(_connectionTree.SelectedNode);
}
- else if (connectionInfo is PuttySessionInfo)
+ else if (_connectionTree.SelectedNode is PuttySessionInfo)
{
- _cMenTreeAddConnection.Enabled = false;
- _cMenTreeAddFolder.Enabled = false;
-
- if (connectionInfo.OpenConnections.Count == 0)
- _cMenTreeDisconnect.Enabled = false;
-
- if (!(connectionInfo.Protocol == ProtocolType.SSH1 | connectionInfo.Protocol == ProtocolType.SSH2))
- _cMenTreeToolsTransferFile.Enabled = false;
-
- _cMenTreeConnectWithOptionsConnectInFullscreen.Enabled = false;
- _cMenTreeConnectWithOptionsConnectToConsoleSession.Enabled = false;
- _cMenTreeToolsSort.Enabled = false;
- _cMenTreeDuplicate.Enabled = false;
- _cMenTreeRename.Enabled = false;
- _cMenTreeDelete.Enabled = false;
- _cMenTreeMoveUp.Enabled = false;
- _cMenTreeMoveDown.Enabled = false;
+ ShowHideMenuItemsForPuttyNode(_connectionTree.SelectedNode);
}
else
{
- if (connectionInfo.OpenConnections.Count == 0)
- _cMenTreeDisconnect.Enabled = false;
-
- if (!(connectionInfo.Protocol == ProtocolType.SSH1 | connectionInfo.Protocol == ProtocolType.SSH2))
- _cMenTreeToolsTransferFile.Enabled = false;
-
- if (!(connectionInfo.Protocol == ProtocolType.RDP | connectionInfo.Protocol == ProtocolType.ICA))
- {
- _cMenTreeConnectWithOptionsConnectInFullscreen.Enabled = false;
- _cMenTreeConnectWithOptionsConnectToConsoleSession.Enabled = false;
- }
-
- if (connectionInfo.Protocol == ProtocolType.IntApp)
- _cMenTreeConnectWithOptionsNoCredentials.Enabled = false;
+ ShowHideMenuItemsForConnectionNode(_connectionTree.SelectedNode);
}
}
catch (Exception ex)
{
- Runtime.MessageCollector.AddExceptionStackTrace("ShowHideTreeContextMenuItems (UI.Window.ConnectionTreeWindow) failed", ex);
+ Runtime.MessageCollector.AddExceptionStackTrace("ShowHideMenuItems (UI.Controls.ConnectionContextMenu) failed", ex);
}
}
+ internal void ShowHideMenuItemsForRootPuttyNode()
+ {
+ _cMenTreeAddConnection.Enabled = false;
+ _cMenTreeAddFolder.Enabled = false;
+ _cMenTreeConnect.Enabled = false;
+ _cMenTreeConnectWithOptions.Enabled = false;
+ _cMenTreeDisconnect.Enabled = false;
+ _cMenTreeToolsTransferFile.Enabled = false;
+ _cMenTreeConnectWithOptions.Enabled = false;
+ _cMenTreeToolsSort.Enabled = false;
+ _cMenTreeToolsExternalApps.Enabled = false;
+ _cMenTreeDuplicate.Enabled = false;
+ _cMenTreeRename.Enabled = true;
+ _cMenTreeDelete.Enabled = false;
+ _cMenTreeMoveUp.Enabled = false;
+ _cMenTreeMoveDown.Enabled = false;
+ }
+
+ internal void ShowHideMenuItemsForRootConnectionNode()
+ {
+ _cMenTreeConnect.Enabled = false;
+ _cMenTreeConnectWithOptions.Enabled = false;
+ _cMenTreeConnectWithOptionsConnectInFullscreen.Enabled = false;
+ _cMenTreeConnectWithOptionsConnectToConsoleSession.Enabled = false;
+ _cMenTreeConnectWithOptionsChoosePanelBeforeConnecting.Enabled = false;
+ _cMenTreeDisconnect.Enabled = false;
+ _cMenTreeToolsTransferFile.Enabled = false;
+ _cMenTreeToolsExternalApps.Enabled = false;
+ _cMenTreeDuplicate.Enabled = false;
+ _cMenTreeDelete.Enabled = false;
+ _cMenTreeMoveUp.Enabled = false;
+ _cMenTreeMoveDown.Enabled = false;
+ }
+
+ internal void ShowHideMenuItemsForContainer(ConnectionInfo connectionInfo)
+ {
+ _cMenTreeConnectWithOptionsConnectInFullscreen.Enabled = false;
+ _cMenTreeConnectWithOptionsConnectToConsoleSession.Enabled = false;
+ _cMenTreeDisconnect.Enabled = false;
+
+ var openConnections = ((ContainerInfo)connectionInfo).Children.Sum(child => child.OpenConnections.Count);
+ if (openConnections > 0)
+ _cMenTreeDisconnect.Enabled = true;
+
+ _cMenTreeToolsTransferFile.Enabled = false;
+ _cMenTreeToolsExternalApps.Enabled = false;
+ }
+
+ internal void ShowHideMenuItemsForPuttyNode(ConnectionInfo connectionInfo)
+ {
+ _cMenTreeAddConnection.Enabled = false;
+ _cMenTreeAddFolder.Enabled = false;
+
+ if (connectionInfo.OpenConnections.Count == 0)
+ _cMenTreeDisconnect.Enabled = false;
+
+ if (!(connectionInfo.Protocol == ProtocolType.SSH1 | connectionInfo.Protocol == ProtocolType.SSH2))
+ _cMenTreeToolsTransferFile.Enabled = false;
+
+ _cMenTreeConnectWithOptionsConnectInFullscreen.Enabled = false;
+ _cMenTreeConnectWithOptionsConnectToConsoleSession.Enabled = false;
+ _cMenTreeToolsSort.Enabled = false;
+ _cMenTreeDuplicate.Enabled = false;
+ _cMenTreeRename.Enabled = false;
+ _cMenTreeDelete.Enabled = false;
+ _cMenTreeMoveUp.Enabled = false;
+ _cMenTreeMoveDown.Enabled = false;
+ }
+
+ internal void ShowHideMenuItemsForConnectionNode(ConnectionInfo connectionInfo)
+ {
+ if (connectionInfo.OpenConnections.Count == 0)
+ _cMenTreeDisconnect.Enabled = false;
+
+ if (!(connectionInfo.Protocol == ProtocolType.SSH1 | connectionInfo.Protocol == ProtocolType.SSH2))
+ _cMenTreeToolsTransferFile.Enabled = false;
+
+ if (!(connectionInfo.Protocol == ProtocolType.RDP | connectionInfo.Protocol == ProtocolType.ICA))
+ {
+ _cMenTreeConnectWithOptionsConnectInFullscreen.Enabled = false;
+ _cMenTreeConnectWithOptionsConnectToConsoleSession.Enabled = false;
+ }
+
+ if (connectionInfo.Protocol == ProtocolType.IntApp)
+ _cMenTreeConnectWithOptionsNoCredentials.Enabled = false;
+ }
+
internal void DisableShortcutKeys()
{
_cMenTreeConnect.ShortcutKeys = Keys.None;
@@ -553,183 +589,218 @@ namespace mRemoteNG.UI.Controls
_cMenTreeToolsExternalApps.DropDownItems.Clear();
}
- #region Events
- public event EventHandler ConnectClicked;
-
+ #region Click handlers
private void OnConnectClicked(object sender, EventArgs e)
{
- var handler = ConnectClicked;
- handler?.Invoke(this, e);
+ var selectedNodeAsContainer = _connectionTree.SelectedNode as ContainerInfo;
+ if (selectedNodeAsContainer != null)
+ _connectionInitiator.OpenConnection(selectedNodeAsContainer, ConnectionInfo.Force.DoNotJump);
+ else
+ _connectionInitiator.OpenConnection(_connectionTree.SelectedNode, ConnectionInfo.Force.DoNotJump);
}
- public event EventHandler ConnectToConsoleSessionClicked;
-
private void OnConnectToConsoleSessionClicked(object sender, EventArgs e)
{
- var handler = ConnectToConsoleSessionClicked;
- handler?.Invoke(this, e);
+ var selectedNodeAsContainer = _connectionTree.SelectedNode as ContainerInfo;
+ if (selectedNodeAsContainer != null)
+ _connectionInitiator.OpenConnection(selectedNodeAsContainer, ConnectionInfo.Force.UseConsoleSession | ConnectionInfo.Force.DoNotJump);
+ else
+ _connectionInitiator.OpenConnection(_connectionTree.SelectedNode, ConnectionInfo.Force.UseConsoleSession | ConnectionInfo.Force.DoNotJump);
}
-
- public event EventHandler DontConnectToConsoleSessionClicked;
private void OnDontConnectToConsoleSessionClicked(object sender, EventArgs e)
{
- var handler = DontConnectToConsoleSessionClicked;
- handler?.Invoke(this, e);
+ var selectedNodeAsContainer = _connectionTree.SelectedNode as ContainerInfo;
+ if (selectedNodeAsContainer != null)
+ _connectionInitiator.OpenConnection(selectedNodeAsContainer, ConnectionInfo.Force.DontUseConsoleSession | ConnectionInfo.Force.DoNotJump);
+ else
+ _connectionInitiator.OpenConnection(_connectionTree.SelectedNode, ConnectionInfo.Force.DontUseConsoleSession | ConnectionInfo.Force.DoNotJump);
}
- public event EventHandler ConnectInFullscreenClicked;
-
private void OnConnectInFullscreenClicked(object sender, EventArgs e)
{
- var handler = ConnectInFullscreenClicked;
- handler?.Invoke(this, e);
+ var selectedNodeAsContainer = _connectionTree.SelectedNode as ContainerInfo;
+ if (selectedNodeAsContainer != null)
+ _connectionInitiator.OpenConnection(selectedNodeAsContainer, ConnectionInfo.Force.Fullscreen | ConnectionInfo.Force.DoNotJump);
+ else
+ _connectionInitiator.OpenConnection(_connectionTree.SelectedNode, ConnectionInfo.Force.Fullscreen | ConnectionInfo.Force.DoNotJump);
}
- public event EventHandler ConnectWithNoCredentialsClick;
-
private void OnConnectWithNoCredentialsClick(object sender, EventArgs e)
{
- var handler = ConnectWithNoCredentialsClick;
- handler?.Invoke(this, e);
+ var selectedNodeAsContainer = _connectionTree.SelectedNode as ContainerInfo;
+ if (selectedNodeAsContainer != null)
+ _connectionInitiator.OpenConnection(selectedNodeAsContainer, ConnectionInfo.Force.NoCredentials);
+ else
+ _connectionInitiator.OpenConnection(_connectionTree.SelectedNode, ConnectionInfo.Force.NoCredentials);
}
- public event EventHandler ChoosePanelBeforeConnectingClicked;
-
private void OnChoosePanelBeforeConnectingClicked(object sender, EventArgs e)
{
- var handler = ChoosePanelBeforeConnectingClicked;
- handler?.Invoke(this, e);
+ var selectedNodeAsContainer = _connectionTree.SelectedNode as ContainerInfo;
+ if (selectedNodeAsContainer != null)
+ _connectionInitiator.OpenConnection(selectedNodeAsContainer, ConnectionInfo.Force.OverridePanel | ConnectionInfo.Force.DoNotJump);
+ else
+ _connectionInitiator.OpenConnection(_connectionTree.SelectedNode, ConnectionInfo.Force.OverridePanel | ConnectionInfo.Force.DoNotJump);
}
-
- public event EventHandler DisconnectClicked;
-
private void OnDisconnectClicked(object sender, EventArgs e)
{
- var handler = DisconnectClicked;
- handler?.Invoke(this, e);
+ DisconnectConnection(_connectionTree.SelectedNode);
}
- public event EventHandler TransferFileClicked;
+ public void DisconnectConnection(ConnectionInfo connectionInfo)
+ {
+ try
+ {
+ if (connectionInfo == null) return;
+ var nodeAsContainer = connectionInfo as ContainerInfo;
+ if (nodeAsContainer != null)
+ {
+ foreach (var child in nodeAsContainer.Children)
+ {
+ for (var i = 0; i <= child.OpenConnections.Count - 1; i++)
+ {
+ child.OpenConnections[i].Disconnect();
+ }
+ }
+ }
+ else
+ {
+ for (var i = 0; i <= connectionInfo.OpenConnections.Count - 1; i++)
+ {
+ connectionInfo.OpenConnections[i].Disconnect();
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ Runtime.MessageCollector.AddExceptionStackTrace("DisconnectConnection (UI.Window.ConnectionTreeWindow) failed", ex);
+ }
+ }
private void OnTransferFileClicked(object sender, EventArgs e)
{
- var handler = TransferFileClicked;
- handler?.Invoke(this, e);
+ SshTransferFile();
}
- public event EventHandler DuplicateClicked;
+ public void SshTransferFile()
+ {
+ try
+ {
+ Windows.Show(WindowType.SSHTransfer);
+ Windows.SshtransferForm.Hostname = _connectionTree.SelectedNode.Hostname;
+ Windows.SshtransferForm.Username = _connectionTree.SelectedNode.Username;
+ Windows.SshtransferForm.Password = _connectionTree.SelectedNode.Password;
+ Windows.SshtransferForm.Port = Convert.ToString(_connectionTree.SelectedNode.Port);
+ }
+ catch (Exception ex)
+ {
+ Runtime.MessageCollector.AddExceptionStackTrace("SSHTransferFile (UI.Window.ConnectionTreeWindow) failed", ex);
+ }
+ }
private void OnDuplicateClicked(object sender, EventArgs e)
{
- var handler = DuplicateClicked;
- handler?.Invoke(this, e);
+ _connectionTree.DuplicateSelectedNode();
}
- public event EventHandler RenameClicked;
-
private void OnRenameClicked(object sender, EventArgs e)
{
- var handler = RenameClicked;
- handler?.Invoke(this, e);
+ _connectionTree.RenameSelectedNode();
}
- public event EventHandler DeleteClicked;
-
private void OnDeleteClicked(object sender, EventArgs e)
{
- var handler = DeleteClicked;
- handler?.Invoke(this, e);
+ _connectionTree.DeleteSelectedNode();
}
- public event EventHandler ImportFileClicked;
-
private void OnImportFileClicked(object sender, EventArgs e)
{
- var handler = ImportFileClicked;
- handler?.Invoke(this, e);
+ var selectedNodeAsContainer = _connectionTree.SelectedNode as ContainerInfo ?? _connectionTree.SelectedNode.Parent;
+ Import.ImportFromFile(selectedNodeAsContainer);
}
- public event EventHandler ImportActiveDirectoryClicked;
-
private void OnImportActiveDirectoryClicked(object sender, EventArgs e)
{
- var handler = ImportActiveDirectoryClicked;
- handler?.Invoke(this, e);
+ Windows.Show(WindowType.ActiveDirectoryImport);
}
- public event EventHandler ImportPortScanClicked;
-
private void OnImportPortScanClicked(object sender, EventArgs e)
{
- var handler = ImportPortScanClicked;
- handler?.Invoke(this, e);
+ Windows.Show(WindowType.PortScan);
}
- public event EventHandler ExportFileClicked;
-
private void OnExportFileClicked(object sender, EventArgs e)
{
- var handler = ExportFileClicked;
- handler?.Invoke(this, e);
+ Export.ExportToFile(_connectionTree.SelectedNode, Runtime.ConnectionTreeModel);
}
- public event EventHandler AddConnectionClicked;
-
private void OnAddConnectionClicked(object sender, EventArgs e)
{
- var handler = AddConnectionClicked;
- handler?.Invoke(this, e);
+ _connectionTree.AddConnection();
+ Runtime.SaveConnectionsAsync();
}
- public event EventHandler AddFolderClicked;
-
private void OnAddFolderClicked(object sender, EventArgs e)
{
- var handler = AddFolderClicked;
- handler?.Invoke(this, e);
+ _connectionTree.AddFolder();
+ Runtime.SaveConnectionsAsync();
}
- public event EventHandler SortAscendingClicked;
-
private void OnSortAscendingClicked(object sender, EventArgs e)
{
- var handler = SortAscendingClicked;
- handler?.Invoke(this, e);
+ SortNodesRecursive(_connectionTree.SelectedNode, ListSortDirection.Ascending);
}
- public event EventHandler SortDescendingClicked;
-
private void OnSortDescendingClicked(object sender, EventArgs e)
{
- var handler = SortDescendingClicked;
- handler?.Invoke(this, e);
+ SortNodesRecursive(_connectionTree.SelectedNode, ListSortDirection.Descending);
}
- public event EventHandler MoveUpClicked;
-
private void OnMoveUpClicked(object sender, EventArgs e)
{
- var handler = MoveUpClicked;
- handler?.Invoke(this, e);
+ _connectionTree.SelectedNode.Parent.PromoteChild(_connectionTree.SelectedNode);
+ Runtime.SaveConnectionsAsync();
}
- public event EventHandler MoveDownClicked;
-
private void OnMoveDownClicked(object sender, EventArgs e)
{
- var handler = MoveDownClicked;
- handler?.Invoke(this, e);
+ _connectionTree.SelectedNode.Parent.DemoteChild(_connectionTree.SelectedNode);
+ Runtime.SaveConnectionsAsync();
}
- public event EventHandler ExternalToolClicked;
-
private void OnExternalToolClicked(object sender, EventArgs e)
{
- var handler = ExternalToolClicked;
- handler?.Invoke(sender, e);
+ StartExternalApp((ExternalTool)((ToolStripMenuItem)sender).Tag);
+ }
+
+ private void StartExternalApp(ExternalTool externalTool)
+ {
+ try
+ {
+ if (_connectionTree.SelectedNode.GetTreeNodeType() == TreeNodeType.Connection | _connectionTree.SelectedNode.GetTreeNodeType() == TreeNodeType.PuttySession)
+ externalTool.Start(_connectionTree.SelectedNode);
+ }
+ catch (Exception ex)
+ {
+ Runtime.MessageCollector.AddExceptionStackTrace("cMenTreeToolsExternalAppsEntry_Click failed (UI.Window.ConnectionTreeWindow)", ex);
+ }
}
#endregion
+
+ private void SortNodesRecursive(ConnectionInfo sortTarget, ListSortDirection sortDirection)
+ {
+ if (sortTarget == null)
+ sortTarget = _connectionTree.GetRootConnectionNode();
+
+ var sortTargetAsContainer = sortTarget as ContainerInfo;
+ if (sortTargetAsContainer != null)
+ sortTargetAsContainer.SortRecursive(sortDirection);
+ else
+ _connectionTree.SelectedNode.Parent.SortRecursive(sortDirection);
+
+ Runtime.SaveConnectionsAsync();
+ }
}
}
\ No newline at end of file
diff --git a/mRemoteV1/UI/Controls/ConnectionTree/ConnectionTree.Designer.cs b/mRemoteV1/UI/Controls/ConnectionTree/ConnectionTree.Designer.cs
new file mode 100644
index 000000000..2c3c0b1c5
--- /dev/null
+++ b/mRemoteV1/UI/Controls/ConnectionTree/ConnectionTree.Designer.cs
@@ -0,0 +1,36 @@
+namespace mRemoteNG.UI.Controls
+{
+ partial class ConnectionTree
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Component Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ components = new System.ComponentModel.Container();
+ }
+
+ #endregion
+ }
+}
diff --git a/mRemoteV1/UI/Controls/ConnectionTree/ConnectionTree.cs b/mRemoteV1/UI/Controls/ConnectionTree/ConnectionTree.cs
new file mode 100644
index 000000000..ea0769394
--- /dev/null
+++ b/mRemoteV1/UI/Controls/ConnectionTree/ConnectionTree.cs
@@ -0,0 +1,286 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.Specialized;
+using System.ComponentModel;
+using System.Linq;
+using System.Windows.Forms;
+using BrightIdeasSoftware;
+using mRemoteNG.App;
+using mRemoteNG.Config.Putty;
+using mRemoteNG.Connection;
+using mRemoteNG.Container;
+using mRemoteNG.Tree;
+using mRemoteNG.Tree.Root;
+
+
+namespace mRemoteNG.UI.Controls
+{
+ public partial class ConnectionTree : TreeListView, IConnectionTree
+ {
+ private ConnectionTreeModel _connectionTreeModel;
+ private readonly ConnectionTreeDragAndDropHandler _dragAndDropHandler = new ConnectionTreeDragAndDropHandler();
+ private readonly PuttySessionsManager _puttySessionsManager = PuttySessionsManager.Instance;
+
+ public ConnectionInfo SelectedNode => (ConnectionInfo) SelectedObject;
+
+ public NodeSearcher NodeSearcher { get; private set; }
+
+ public IConfirm NodeDeletionConfirmer { get; set; } = new AlwaysConfirmYes();
+
+ public IEnumerable PostSetupActions { get; set; } = new IConnectionTreeDelegate[0];
+
+ public ITreeNodeClickHandler DoubleClickHandler { get; set; } = new TreeNodeCompositeClickHandler();
+
+ public ITreeNodeClickHandler SingleClickHandler { get; set; } = new TreeNodeCompositeClickHandler();
+
+ public ConnectionTreeModel ConnectionTreeModel
+ {
+ get { return _connectionTreeModel; }
+ set
+ {
+ _connectionTreeModel = value;
+ PopulateTreeView();
+ }
+ }
+
+
+ public ConnectionTree()
+ {
+ InitializeComponent();
+ SetupConnectionTreeView();
+ }
+
+ #region ConnectionTree Setup
+ private void SetupConnectionTreeView()
+ {
+ var imageList = new StatusImageList();
+ SmallImageList = imageList.GetImageList();
+ AddColumns(imageList.ImageGetter);
+ LinkModelToView();
+ SetupDropSink();
+ SetEventHandlers();
+ }
+
+ private void AddColumns(ImageGetterDelegate imageGetterDelegate)
+ {
+ Columns.Add(new NameColumn(imageGetterDelegate));
+ }
+
+ private void LinkModelToView()
+ {
+ CanExpandGetter = item =>
+ {
+ var itemAsContainer = item as ContainerInfo;
+ return itemAsContainer?.Children.Count > 0;
+ };
+ ChildrenGetter = item => ((ContainerInfo)item).Children;
+ }
+
+ private void SetupDropSink()
+ {
+ DropSink = new SimpleDropSink
+ {
+ CanDropBetween = true
+ };
+ }
+
+ private void SetEventHandlers()
+ {
+ Collapsed += (sender, args) =>
+ {
+ var container = args.Model as ContainerInfo;
+ if (container != null)
+ container.IsExpanded = false;
+ };
+ Expanded += (sender, args) =>
+ {
+ var container = args.Model as ContainerInfo;
+ if (container != null)
+ container.IsExpanded = true;
+ };
+ SelectionChanged += tvConnections_AfterSelect;
+ MouseDoubleClick += OnMouse_DoubleClick;
+ MouseClick += OnMouse_SingleClick;
+ CellToolTipShowing += tvConnections_CellToolTipShowing;
+ ModelCanDrop += _dragAndDropHandler.HandleEvent_ModelCanDrop;
+ ModelDropped += _dragAndDropHandler.HandleEvent_ModelDropped;
+ }
+
+ private void PopulateTreeView()
+ {
+ UnregisterModelUpdateHandlers();
+ SetObjects(ConnectionTreeModel.RootNodes);
+ RegisterModelUpdateHandlers();
+ NodeSearcher = new NodeSearcher(ConnectionTreeModel);
+ ExecutePostSetupActions();
+ }
+
+ private void RegisterModelUpdateHandlers()
+ {
+ _puttySessionsManager.PuttySessionsCollectionChanged += OnPuttySessionsCollectionChanged;
+ ConnectionTreeModel.CollectionChanged += HandleCollectionChanged;
+ ConnectionTreeModel.PropertyChanged += HandleCollectionPropertyChanged;
+ }
+
+ private void UnregisterModelUpdateHandlers()
+ {
+ _puttySessionsManager.PuttySessionsCollectionChanged -= OnPuttySessionsCollectionChanged;
+ ConnectionTreeModel.CollectionChanged -= HandleCollectionChanged;
+ ConnectionTreeModel.PropertyChanged -= HandleCollectionPropertyChanged;
+ }
+
+ private void OnPuttySessionsCollectionChanged(object sender, NotifyCollectionChangedEventArgs args)
+ {
+ RefreshObjects(GetRootPuttyNodes().ToList());
+ }
+
+ private void HandleCollectionPropertyChanged(object sender, PropertyChangedEventArgs propertyChangedEventArgs)
+ {
+ //TODO for some reason property changed events are getting triggered twice for each changed property. should be just once. cant find source of duplication
+ var property = propertyChangedEventArgs.PropertyName;
+ if (property != "Name" && property != "OpenConnections") return;
+ var senderAsConnectionInfo = sender as ConnectionInfo;
+ if (senderAsConnectionInfo != null)
+ RefreshObject(senderAsConnectionInfo);
+ }
+
+ private void ExecutePostSetupActions()
+ {
+ foreach (var action in PostSetupActions)
+ {
+ action.Execute(this);
+ }
+ }
+ #endregion
+
+ #region ConnectionTree Behavior
+ public RootNodeInfo GetRootConnectionNode()
+ {
+ return (RootNodeInfo)Roots.Cast().First(item => item is RootNodeInfo);
+ }
+
+ public void InvokeExpand(object model)
+ {
+ Invoke((MethodInvoker)(() => Expand(model)));
+ }
+
+ public void InvokeRebuildAll(bool preserveState)
+ {
+ Invoke((MethodInvoker)(() => RebuildAll(preserveState)));
+ }
+
+ public IEnumerable GetRootPuttyNodes()
+ {
+ return Objects.OfType();
+ }
+
+ public void AddConnection()
+ {
+ try
+ {
+ AddNode(new ConnectionInfo());
+ }
+ catch (Exception ex)
+ {
+ Runtime.MessageCollector.AddExceptionStackTrace("UI.Window.Tree.AddConnection() failed.", ex);
+ }
+ }
+
+ public void AddFolder()
+ {
+ try
+ {
+ AddNode(new ContainerInfo());
+ }
+ catch (Exception ex)
+ {
+ Runtime.MessageCollector.AddExceptionStackTrace(Language.strErrorAddFolderFailed, ex);
+ }
+ }
+
+ private void AddNode(ConnectionInfo newNode)
+ {
+ if (SelectedNode == null) return;
+ DefaultConnectionInfo.Instance.SaveTo(newNode);
+ DefaultConnectionInheritance.Instance.SaveTo(newNode.Inheritance);
+ var selectedContainer = SelectedNode as ContainerInfo;
+ var parent = selectedContainer ?? SelectedNode?.Parent;
+ newNode.SetParent(parent);
+ Expand(parent);
+ SelectObject(newNode, true);
+ EnsureModelVisible(newNode);
+ }
+
+ public void DuplicateSelectedNode()
+ {
+ var newNode = SelectedNode.Clone();
+ newNode.Parent.SetChildBelow(newNode, SelectedNode);
+ Runtime.SaveConnectionsAsync();
+ }
+
+ public void RenameSelectedNode()
+ {
+ SelectedItem.BeginEdit();
+ Runtime.SaveConnectionsAsync();
+ }
+
+ public void DeleteSelectedNode()
+ {
+ if (SelectedNode is RootNodeInfo || SelectedNode is PuttySessionInfo) return;
+ if (!NodeDeletionConfirmer.Confirm()) return;
+ ConnectionTreeModel.DeleteNode(SelectedNode);
+ Runtime.SaveConnectionsAsync();
+ }
+
+ private void HandleCollectionChanged(object sender, NotifyCollectionChangedEventArgs args)
+ {
+ RefreshObject(sender);
+ }
+
+ private void tvConnections_AfterSelect(object sender, EventArgs e)
+ {
+ try
+ {
+ Windows.ConfigForm.SelectedTreeNode = SelectedNode;
+ }
+ catch (Exception ex)
+ {
+ Runtime.MessageCollector.AddExceptionStackTrace("tvConnections_AfterSelect (UI.Window.ConnectionTreeWindow) failed", ex);
+ }
+ }
+
+ private void OnMouse_DoubleClick(object sender, MouseEventArgs mouseEventArgs)
+ {
+ if (mouseEventArgs.Clicks < 2) return;
+ OLVColumn column;
+ var listItem = GetItemAt(mouseEventArgs.X, mouseEventArgs.Y, out column);
+ var clickedNode = listItem.RowObject as ConnectionInfo;
+ if (clickedNode == null) return;
+ DoubleClickHandler.Execute(clickedNode);
+ }
+
+ private void OnMouse_SingleClick(object sender, MouseEventArgs mouseEventArgs)
+ {
+ if (mouseEventArgs.Clicks > 1) return;
+ OLVColumn column;
+ var listItem = GetItemAt(mouseEventArgs.X, mouseEventArgs.Y, out column);
+ var clickedNode = listItem.RowObject as ConnectionInfo;
+ if (clickedNode == null) return;
+ SingleClickHandler.Execute(clickedNode);
+ }
+
+ private void tvConnections_CellToolTipShowing(object sender, ToolTipShowingEventArgs e)
+ {
+ try
+ {
+ var nodeProducingTooltip = (ConnectionInfo)e.Model;
+ e.Text = nodeProducingTooltip.Description;
+ }
+ catch (Exception ex)
+ {
+ Runtime.MessageCollector.AddExceptionStackTrace("tvConnections_MouseMove (UI.Window.ConnectionTreeWindow) failed", ex);
+ }
+ }
+ #endregion
+ }
+}
\ No newline at end of file
diff --git a/mRemoteV1/UI/Controls/ConnectionTree/IConnectionTree.cs b/mRemoteV1/UI/Controls/ConnectionTree/IConnectionTree.cs
new file mode 100644
index 000000000..3edc92875
--- /dev/null
+++ b/mRemoteV1/UI/Controls/ConnectionTree/IConnectionTree.cs
@@ -0,0 +1,25 @@
+using System.Collections;
+using mRemoteNG.Connection;
+using mRemoteNG.Tree;
+using mRemoteNG.Tree.Root;
+
+
+namespace mRemoteNG.UI.Controls
+{
+ public interface IConnectionTree
+ {
+ ConnectionTreeModel ConnectionTreeModel { get; set; }
+
+ ConnectionInfo SelectedNode { get; }
+
+ IEnumerable ExpandedObjects { get; set; }
+
+ RootNodeInfo GetRootConnectionNode();
+
+ void InvokeExpand(object model);
+
+ void InvokeRebuildAll(bool preserveState);
+
+ void ToggleExpansion(object model);
+ }
+}
\ No newline at end of file
diff --git a/mRemoteV1/UI/Controls/ConnectionTree/IConnectionTreeDelegate.cs b/mRemoteV1/UI/Controls/ConnectionTree/IConnectionTreeDelegate.cs
new file mode 100644
index 000000000..77643a1e5
--- /dev/null
+++ b/mRemoteV1/UI/Controls/ConnectionTree/IConnectionTreeDelegate.cs
@@ -0,0 +1,8 @@
+
+namespace mRemoteNG.UI.Controls
+{
+ public interface IConnectionTreeDelegate
+ {
+ void Execute(IConnectionTree connectionTree);
+ }
+}
\ No newline at end of file
diff --git a/mRemoteV1/UI/Controls/ConnectionTree/NameColumn.cs b/mRemoteV1/UI/Controls/ConnectionTree/NameColumn.cs
new file mode 100644
index 000000000..8903f1839
--- /dev/null
+++ b/mRemoteV1/UI/Controls/ConnectionTree/NameColumn.cs
@@ -0,0 +1,18 @@
+using BrightIdeasSoftware;
+using mRemoteNG.Connection;
+
+
+namespace mRemoteNG.UI.Controls
+{
+ public class NameColumn : OLVColumn
+ {
+ public NameColumn(ImageGetterDelegate imageGetterDelegate)
+ {
+ AspectName = "Name";
+ FillsFreeSpace = true;
+ IsButton = true;
+ AspectGetter = item => ((ConnectionInfo) item).Name;
+ ImageGetter = imageGetterDelegate;
+ }
+ }
+}
\ No newline at end of file
diff --git a/mRemoteV1/UI/Controls/QuickConnectComboBox.cs b/mRemoteV1/UI/Controls/QuickConnectComboBox.cs
index 0ea734364..2161a1e67 100644
--- a/mRemoteV1/UI/Controls/QuickConnectComboBox.cs
+++ b/mRemoteV1/UI/Controls/QuickConnectComboBox.cs
@@ -9,7 +9,7 @@ namespace mRemoteNG.UI.Controls
{
public class QuickConnectComboBox : ToolStripComboBox
{
- private ComboBox _comboBox;
+ private readonly ComboBox _comboBox;
private bool _ignoreEnter;
public QuickConnectComboBox()
@@ -53,7 +53,7 @@ namespace mRemoteNG.UI.Controls
// Items can't be removed from the ComboBox while it is dropped down without possibly causing
// an exception so we must close it, delete the item, and then drop it down again. When we
// close it programmatically, the SelectedItem may revert to Nothing, so we must save it first.
- object item = _comboBox.SelectedItem;
+ var item = _comboBox.SelectedItem;
_comboBox.DroppedDown = false;
_comboBox.Items.Remove(item);
_comboBox.SelectedIndex = -1;
@@ -66,29 +66,29 @@ namespace mRemoteNG.UI.Controls
}
}
- private void ComboBox_SelectedIndexChanged(Object sender, EventArgs e)
+ private void ComboBox_SelectedIndexChanged(object sender, EventArgs e)
{
if (!(_comboBox.SelectedItem is HistoryItem))
{
- return ;
+ return;
}
- HistoryItem historyItem = (HistoryItem) _comboBox.SelectedItem;
+ var historyItem = (HistoryItem) _comboBox.SelectedItem;
OnProtocolChanged(new ProtocolChangedEventArgs(historyItem.ConnectionInfo.Protocol));
}
private static void ComboBox_DrawItem(object sender, DrawItemEventArgs e)
{
- ComboBox comboBox = sender as ComboBox;
+ var comboBox = sender as ComboBox;
if (comboBox == null)
{
- return ;
+ return;
}
- object drawItem = comboBox.Items[e.Index];
+ var drawItem = comboBox.Items[e.Index];
string drawString;
if (drawItem is HistoryItem)
{
- HistoryItem historyItem = (HistoryItem) drawItem;
+ var historyItem = (HistoryItem) drawItem;
drawString = historyItem.ToString(true);
}
else
@@ -116,11 +116,8 @@ namespace mRemoteNG.UI.Controls
{
return false;
}
- if (ConnectionInfo.Protocol != other.ConnectionInfo.Protocol)
- {
- return false;
- }
- return true;
+
+ return ConnectionInfo.Protocol == other.ConnectionInfo.Protocol;
}
public override string ToString()
@@ -130,31 +127,25 @@ namespace mRemoteNG.UI.Controls
public string ToString(bool includeProtocol)
{
- string port = string.Empty;
+ var port = string.Empty;
if (ConnectionInfo.Port != ConnectionInfo.GetDefaultPort())
{
port = $":{ConnectionInfo.Port}";
}
- if (includeProtocol)
- {
- return $"{ConnectionInfo.Hostname}{port} ({ConnectionInfo.Protocol})";
- }
- else
- {
- return $"{ConnectionInfo.Hostname}{port}";
- }
+
+ return includeProtocol ? $"{ConnectionInfo.Hostname}{port} ({ConnectionInfo.Protocol})" : $"{ConnectionInfo.Hostname}{port}";
}
}
private bool Exists(HistoryItem searchItem)
{
- foreach (object item in _comboBox.Items)
+ foreach (var item in _comboBox.Items)
{
if (!(item is HistoryItem))
{
continue;
}
- HistoryItem historyItem = (HistoryItem) item;
+ var historyItem = (HistoryItem) item;
if (historyItem.Equals(searchItem))
{
return true;
@@ -167,7 +158,7 @@ namespace mRemoteNG.UI.Controls
{
try
{
- HistoryItem historyItem = new HistoryItem {ConnectionInfo = connectionInfo};
+ var historyItem = new HistoryItem {ConnectionInfo = connectionInfo};
if (!Exists(historyItem))
{
_comboBox.Items.Insert(0, historyItem);
@@ -175,7 +166,7 @@ namespace mRemoteNG.UI.Controls
}
catch (Exception ex)
{
- Runtime.MessageCollector.AddExceptionMessage(Language.strQuickConnectAddFailed, ex, Messages.MessageClass.ErrorMsg, true);
+ Runtime.MessageCollector.AddExceptionMessage(Language.strQuickConnectAddFailed, ex);
}
}
@@ -209,7 +200,8 @@ namespace mRemoteNG.UI.Controls
private void OnConnectRequested(ConnectRequestedEventArgs e)
{
- ConnectRequestedEvent?.Invoke(this, new ConnectRequestedEventArgs(e.ConnectionString));
+ // TODO: Any reason to not jsut pass "e"?
+ ConnectRequestedEvent?.Invoke(this, new ConnectRequestedEventArgs(e.ConnectionString));
}
public class ProtocolChangedEventArgs : EventArgs
@@ -241,6 +233,7 @@ namespace mRemoteNG.UI.Controls
private void OnProtocolChanged(ProtocolChangedEventArgs e)
{
+ // TODO: Any reason to not jsut pass "e"?
ProtocolChangedEvent?.Invoke(this, new ProtocolChangedEventArgs(e.Protocol));
}
#endregion
diff --git a/mRemoteV1/UI/Controls/StatusImageList.cs b/mRemoteV1/UI/Controls/StatusImageList.cs
new file mode 100644
index 000000000..b5a2413d2
--- /dev/null
+++ b/mRemoteV1/UI/Controls/StatusImageList.cs
@@ -0,0 +1,57 @@
+using System;
+using System.Drawing;
+using System.Windows.Forms;
+using mRemoteNG.App;
+using mRemoteNG.Connection;
+using mRemoteNG.Container;
+using mRemoteNG.Tree.Root;
+
+
+namespace mRemoteNG.UI.Controls
+{
+ public class StatusImageList
+ {
+ public ImageList GetImageList()
+ {
+ var imageList = new ImageList
+ {
+ ColorDepth = ColorDepth.Depth32Bit,
+ ImageSize = new Size(16, 16),
+ TransparentColor = Color.Transparent
+ };
+ FillImageList(imageList);
+ return imageList;
+ }
+
+ public object ImageGetter(object rowObject)
+ {
+ if (rowObject is RootPuttySessionsNodeInfo) return "PuttySessions";
+ if (rowObject is RootNodeInfo) return "Root";
+ if (rowObject is ContainerInfo) return "Folder";
+ var connection = rowObject as ConnectionInfo;
+ if (connection == null) return "";
+ return connection.OpenConnections.Count > 0 ? "Play" : "Pause";
+ }
+
+ private void FillImageList(ImageList imageList)
+ {
+ try
+ {
+ imageList.Images.Add(Resources.Root);
+ imageList.Images.SetKeyName(0, "Root");
+ imageList.Images.Add(Resources.Folder);
+ imageList.Images.SetKeyName(1, "Folder");
+ imageList.Images.Add(Resources.Play);
+ imageList.Images.SetKeyName(2, "Play");
+ imageList.Images.Add(Resources.Pause);
+ imageList.Images.SetKeyName(3, "Pause");
+ imageList.Images.Add(Resources.PuttySessions);
+ imageList.Images.SetKeyName(4, "PuttySessions");
+ }
+ catch (Exception ex)
+ {
+ Runtime.MessageCollector.AddExceptionStackTrace($"Unable to fill the image list of type {nameof(StatusImageList)}", ex);
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/mRemoteV1/UI/Controls/ToolStripSplitButton.cs b/mRemoteV1/UI/Controls/ToolStripSplitButton.cs
index 033b448f9..ed7090851 100644
--- a/mRemoteV1/UI/Controls/ToolStripSplitButton.cs
+++ b/mRemoteV1/UI/Controls/ToolStripSplitButton.cs
@@ -22,7 +22,7 @@ namespace mRemoteNG.UI.Controls
{
if (e.CloseReason != ToolStripDropDownCloseReason.AppClicked)
{
- return ;
+ return;
}
Rectangle dropDownButtonBoundsClient = DropDownButtonBounds; // Relative to the ToolStripSplitButton
diff --git a/mRemoteV1/UI/Forms/ExportForm.cs b/mRemoteV1/UI/Forms/ExportForm.cs
index 652124597..a7a74c3b2 100644
--- a/mRemoteV1/UI/Forms/ExportForm.cs
+++ b/mRemoteV1/UI/Forms/ExportForm.cs
@@ -205,7 +205,7 @@ namespace mRemoteNG.UI.Forms
SelectFileTypeBasedOnSaveFormat(saveFileDialog);
if (saveFileDialog.ShowDialog(this) != DialogResult.OK)
- return ;
+ return;
txtFileName.Text = saveFileDialog.FileName;
}
diff --git a/mRemoteV1/UI/Forms/OptionsPages/AppearancePage.cs b/mRemoteV1/UI/Forms/OptionsPages/AppearancePage.cs
index 3a9a229fd..fd5c2a34c 100644
--- a/mRemoteV1/UI/Forms/OptionsPages/AppearancePage.cs
+++ b/mRemoteV1/UI/Forms/OptionsPages/AppearancePage.cs
@@ -1,6 +1,7 @@
using System;
using System.Windows.Forms;
using mRemoteNG.App;
+using mRemoteNG.Tools;
namespace mRemoteNG.UI.Forms.OptionsPages
{
@@ -79,7 +80,7 @@ namespace mRemoteNG.UI.Forms.OptionsPages
{
if (Runtime.NotificationAreaIcon == null)
{
- Runtime.NotificationAreaIcon = new Tools.Controls.NotificationAreaIcon();
+ Runtime.NotificationAreaIcon = new NotificationAreaIcon();
}
}
else
diff --git a/mRemoteV1/UI/Forms/OptionsPages/UpdatesPage.Designer.cs b/mRemoteV1/UI/Forms/OptionsPages/UpdatesPage.Designer.cs
index 78e3ce2ac..06617d63a 100644
--- a/mRemoteV1/UI/Forms/OptionsPages/UpdatesPage.Designer.cs
+++ b/mRemoteV1/UI/Forms/OptionsPages/UpdatesPage.Designer.cs
@@ -29,243 +29,294 @@ namespace mRemoteNG.UI.Forms.OptionsPages
//Do not modify it using the code editor.
[System.Diagnostics.DebuggerStepThrough()]private void InitializeComponent()
{
- System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(UpdatesPage));
- this.lblUpdatesExplanation = new System.Windows.Forms.Label();
- this.pnlUpdateCheck = new System.Windows.Forms.Panel();
- this.btnUpdateCheckNow = new System.Windows.Forms.Button();
- this.btnUpdateCheckNow.Click += new System.EventHandler(this.btnUpdateCheckNow_Click);
- this.chkCheckForUpdatesOnStartup = new System.Windows.Forms.CheckBox();
- this.chkCheckForUpdatesOnStartup.CheckedChanged += new System.EventHandler(this.chkCheckForUpdatesOnStartup_CheckedChanged);
- this.cboUpdateCheckFrequency = new System.Windows.Forms.ComboBox();
- this.pnlProxy = new System.Windows.Forms.Panel();
- this.pnlProxyBasic = new System.Windows.Forms.Panel();
- this.lblProxyAddress = new System.Windows.Forms.Label();
- this.txtProxyAddress = new System.Windows.Forms.TextBox();
- this.lblProxyPort = new System.Windows.Forms.Label();
- this.numProxyPort = new System.Windows.Forms.NumericUpDown();
- this.chkUseProxyForAutomaticUpdates = new System.Windows.Forms.CheckBox();
- this.chkUseProxyForAutomaticUpdates.CheckedChanged += new System.EventHandler(this.chkUseProxyForAutomaticUpdates_CheckedChanged);
- this.chkUseProxyAuthentication = new System.Windows.Forms.CheckBox();
- this.chkUseProxyAuthentication.CheckedChanged += new System.EventHandler(this.chkUseProxyAuthentication_CheckedChanged);
- this.pnlProxyAuthentication = new System.Windows.Forms.Panel();
- this.lblProxyUsername = new System.Windows.Forms.Label();
- this.txtProxyUsername = new System.Windows.Forms.TextBox();
- this.lblProxyPassword = new System.Windows.Forms.Label();
- this.txtProxyPassword = new System.Windows.Forms.TextBox();
- this.btnTestProxy = new System.Windows.Forms.Button();
- this.btnTestProxy.Click += new System.EventHandler(this.btnTestProxy_Click);
- this.pnlUpdateCheck.SuspendLayout();
- this.pnlProxy.SuspendLayout();
- this.pnlProxyBasic.SuspendLayout();
- ((System.ComponentModel.ISupportInitialize) this.numProxyPort).BeginInit();
- this.pnlProxyAuthentication.SuspendLayout();
- this.SuspendLayout();
- //
- //lblUpdatesExplanation
- //
- this.lblUpdatesExplanation.Location = new System.Drawing.Point(3, 0);
- this.lblUpdatesExplanation.Name = "lblUpdatesExplanation";
- this.lblUpdatesExplanation.Size = new System.Drawing.Size(536, 40);
- this.lblUpdatesExplanation.TabIndex = 3;
- this.lblUpdatesExplanation.Text = "mRemoteNG can periodically connect to the mRemoteNG website to check for updates.";
- //
- //pnlUpdateCheck
- //
- this.pnlUpdateCheck.Controls.Add(this.btnUpdateCheckNow);
- this.pnlUpdateCheck.Controls.Add(this.chkCheckForUpdatesOnStartup);
- this.pnlUpdateCheck.Controls.Add(this.cboUpdateCheckFrequency);
- this.pnlUpdateCheck.Location = new System.Drawing.Point(0, 48);
- this.pnlUpdateCheck.Name = "pnlUpdateCheck";
- this.pnlUpdateCheck.Size = new System.Drawing.Size(610, 120);
- this.pnlUpdateCheck.TabIndex = 4;
- //
- //btnUpdateCheckNow
- //
- this.btnUpdateCheckNow.Location = new System.Drawing.Point(3, 80);
- this.btnUpdateCheckNow.Name = "btnUpdateCheckNow";
- this.btnUpdateCheckNow.Size = new System.Drawing.Size(120, 32);
- this.btnUpdateCheckNow.TabIndex = 2;
- this.btnUpdateCheckNow.Text = "Check Now";
- this.btnUpdateCheckNow.UseVisualStyleBackColor = true;
- //
- //chkCheckForUpdatesOnStartup
- //
- this.chkCheckForUpdatesOnStartup.AutoSize = true;
- this.chkCheckForUpdatesOnStartup.Location = new System.Drawing.Point(3, 8);
- this.chkCheckForUpdatesOnStartup.Name = "chkCheckForUpdatesOnStartup";
- this.chkCheckForUpdatesOnStartup.Size = new System.Drawing.Size(213, 17);
- this.chkCheckForUpdatesOnStartup.TabIndex = 0;
- this.chkCheckForUpdatesOnStartup.Text = "Check for updates";
- this.chkCheckForUpdatesOnStartup.UseVisualStyleBackColor = true;
- //
- //cboUpdateCheckFrequency
- //
- this.cboUpdateCheckFrequency.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
- this.cboUpdateCheckFrequency.FormattingEnabled = true;
- this.cboUpdateCheckFrequency.Location = new System.Drawing.Point(48, 40);
- this.cboUpdateCheckFrequency.Name = "cboUpdateCheckFrequency";
- this.cboUpdateCheckFrequency.Size = new System.Drawing.Size(128, 21);
- this.cboUpdateCheckFrequency.TabIndex = 1;
- //
- //pnlProxy
- //
- this.pnlProxy.Controls.Add(this.pnlProxyBasic);
- this.pnlProxy.Controls.Add(this.chkUseProxyForAutomaticUpdates);
- this.pnlProxy.Controls.Add(this.chkUseProxyAuthentication);
- this.pnlProxy.Controls.Add(this.pnlProxyAuthentication);
- this.pnlProxy.Controls.Add(this.btnTestProxy);
- this.pnlProxy.Location = new System.Drawing.Point(0, 200);
- this.pnlProxy.Name = "pnlProxy";
- this.pnlProxy.Size = new System.Drawing.Size(610, 224);
- this.pnlProxy.TabIndex = 5;
- //
- //pnlProxyBasic
- //
- this.pnlProxyBasic.Controls.Add(this.lblProxyAddress);
- this.pnlProxyBasic.Controls.Add(this.txtProxyAddress);
- this.pnlProxyBasic.Controls.Add(this.lblProxyPort);
- this.pnlProxyBasic.Controls.Add(this.numProxyPort);
- this.pnlProxyBasic.Enabled = false;
- this.pnlProxyBasic.Location = new System.Drawing.Point(3, 32);
- this.pnlProxyBasic.Name = "pnlProxyBasic";
- this.pnlProxyBasic.Size = new System.Drawing.Size(604, 40);
- this.pnlProxyBasic.TabIndex = 1;
- //
- //lblProxyAddress
- //
- this.lblProxyAddress.Location = new System.Drawing.Point(8, 4);
- this.lblProxyAddress.Name = "lblProxyAddress";
- this.lblProxyAddress.Size = new System.Drawing.Size(96, 24);
- this.lblProxyAddress.TabIndex = 0;
- this.lblProxyAddress.Text = "Address:";
- this.lblProxyAddress.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
- //
- //txtProxyAddress
- //
- this.txtProxyAddress.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
- this.txtProxyAddress.Location = new System.Drawing.Point(104, 8);
- this.txtProxyAddress.Name = "txtProxyAddress";
- this.txtProxyAddress.Size = new System.Drawing.Size(240, 20);
- this.txtProxyAddress.TabIndex = 1;
- //
- //lblProxyPort
- //
- this.lblProxyPort.Location = new System.Drawing.Point(350, 5);
- this.lblProxyPort.Name = "lblProxyPort";
- this.lblProxyPort.Size = new System.Drawing.Size(64, 23);
- this.lblProxyPort.TabIndex = 2;
- this.lblProxyPort.Text = "Port:";
- this.lblProxyPort.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
- //
- //numProxyPort
- //
- this.numProxyPort.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
- this.numProxyPort.Location = new System.Drawing.Point(420, 8);
- this.numProxyPort.Maximum = new decimal(new int[] {65535, 0, 0, 0});
- this.numProxyPort.Minimum = new decimal(new int[] {1, 0, 0, 0});
- this.numProxyPort.Name = "numProxyPort";
- this.numProxyPort.Size = new System.Drawing.Size(64, 20);
- this.numProxyPort.TabIndex = 3;
- this.numProxyPort.Value = new decimal(new int[] {80, 0, 0, 0});
- //
- //chkUseProxyForAutomaticUpdates
- //
- this.chkUseProxyForAutomaticUpdates.AutoSize = true;
- this.chkUseProxyForAutomaticUpdates.Location = new System.Drawing.Point(3, 8);
- this.chkUseProxyForAutomaticUpdates.Name = "chkUseProxyForAutomaticUpdates";
- this.chkUseProxyForAutomaticUpdates.Size = new System.Drawing.Size(168, 17);
- this.chkUseProxyForAutomaticUpdates.TabIndex = 0;
- this.chkUseProxyForAutomaticUpdates.Text = "Use a proxy server to connect";
- this.chkUseProxyForAutomaticUpdates.UseVisualStyleBackColor = true;
- //
- //chkUseProxyAuthentication
- //
- this.chkUseProxyAuthentication.AutoSize = true;
- this.chkUseProxyAuthentication.Enabled = false;
- this.chkUseProxyAuthentication.Location = new System.Drawing.Point(27, 80);
- this.chkUseProxyAuthentication.Name = "chkUseProxyAuthentication";
- this.chkUseProxyAuthentication.Size = new System.Drawing.Size(216, 17);
- this.chkUseProxyAuthentication.TabIndex = 2;
- this.chkUseProxyAuthentication.Text = "This proxy server requires authentication";
- this.chkUseProxyAuthentication.UseVisualStyleBackColor = true;
- //
- //pnlProxyAuthentication
- //
- this.pnlProxyAuthentication.Controls.Add(this.lblProxyUsername);
- this.pnlProxyAuthentication.Controls.Add(this.txtProxyUsername);
- this.pnlProxyAuthentication.Controls.Add(this.lblProxyPassword);
- this.pnlProxyAuthentication.Controls.Add(this.txtProxyPassword);
- this.pnlProxyAuthentication.Enabled = false;
- this.pnlProxyAuthentication.Location = new System.Drawing.Point(3, 104);
- this.pnlProxyAuthentication.Name = "pnlProxyAuthentication";
- this.pnlProxyAuthentication.Size = new System.Drawing.Size(604, 72);
- this.pnlProxyAuthentication.TabIndex = 3;
- //
- //lblProxyUsername
- //
- this.lblProxyUsername.Location = new System.Drawing.Point(8, 4);
- this.lblProxyUsername.Name = "lblProxyUsername";
- this.lblProxyUsername.Size = new System.Drawing.Size(96, 24);
- this.lblProxyUsername.TabIndex = 0;
- this.lblProxyUsername.Text = "Username:";
- this.lblProxyUsername.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
- //
- //txtProxyUsername
- //
- this.txtProxyUsername.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
- this.txtProxyUsername.Location = new System.Drawing.Point(104, 8);
- this.txtProxyUsername.Name = "txtProxyUsername";
- this.txtProxyUsername.Size = new System.Drawing.Size(240, 20);
- this.txtProxyUsername.TabIndex = 1;
- //
- //lblProxyPassword
- //
- this.lblProxyPassword.Location = new System.Drawing.Point(8, 36);
- this.lblProxyPassword.Name = "lblProxyPassword";
- this.lblProxyPassword.Size = new System.Drawing.Size(96, 24);
- this.lblProxyPassword.TabIndex = 2;
- this.lblProxyPassword.Text = "Password:";
- this.lblProxyPassword.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
- //
- //txtProxyPassword
- //
- this.txtProxyPassword.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
- this.txtProxyPassword.Location = new System.Drawing.Point(104, 40);
- this.txtProxyPassword.Name = "txtProxyPassword";
- this.txtProxyPassword.Size = new System.Drawing.Size(240, 20);
- this.txtProxyPassword.TabIndex = 3;
- this.txtProxyPassword.UseSystemPasswordChar = true;
- //
- //btnTestProxy
- //
- this.btnTestProxy.Location = new System.Drawing.Point(3, 184);
- this.btnTestProxy.Name = "btnTestProxy";
- this.btnTestProxy.Size = new System.Drawing.Size(120, 32);
- this.btnTestProxy.TabIndex = 4;
- this.btnTestProxy.Text = "Test Proxy";
- this.btnTestProxy.UseVisualStyleBackColor = true;
- //
- //UpdatesPage
- //
- this.AutoScaleDimensions = new System.Drawing.SizeF((float) (6.0F), (float) (13.0F));
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.Controls.Add(this.lblUpdatesExplanation);
- this.Controls.Add(this.pnlUpdateCheck);
- this.Controls.Add(this.pnlProxy);
- this.Name = "UpdatesPage";
- this.PageIcon = (System.Drawing.Icon) (resources.GetObject("$this.PageIcon"));
- this.Size = new System.Drawing.Size(610, 489);
- this.pnlUpdateCheck.ResumeLayout(false);
- this.pnlUpdateCheck.PerformLayout();
- this.pnlProxy.ResumeLayout(false);
- this.pnlProxy.PerformLayout();
- this.pnlProxyBasic.ResumeLayout(false);
- this.pnlProxyBasic.PerformLayout();
- ((System.ComponentModel.ISupportInitialize) this.numProxyPort).EndInit();
- this.pnlProxyAuthentication.ResumeLayout(false);
- this.pnlProxyAuthentication.PerformLayout();
- this.ResumeLayout(false);
-
+ System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(UpdatesPage));
+ this.lblUpdatesExplanation = new System.Windows.Forms.Label();
+ this.pnlUpdateCheck = new System.Windows.Forms.Panel();
+ this.textBox1 = new System.Windows.Forms.TextBox();
+ this.lblReleaseChannel = new System.Windows.Forms.Label();
+ this.cboReleaseChannel = new System.Windows.Forms.ComboBox();
+ this.btnUpdateCheckNow = new System.Windows.Forms.Button();
+ this.chkCheckForUpdatesOnStartup = new System.Windows.Forms.CheckBox();
+ this.cboUpdateCheckFrequency = new System.Windows.Forms.ComboBox();
+ this.pnlProxy = new System.Windows.Forms.Panel();
+ this.pnlProxyBasic = new System.Windows.Forms.Panel();
+ this.lblProxyAddress = new System.Windows.Forms.Label();
+ this.txtProxyAddress = new System.Windows.Forms.TextBox();
+ this.lblProxyPort = new System.Windows.Forms.Label();
+ this.numProxyPort = new System.Windows.Forms.NumericUpDown();
+ this.chkUseProxyForAutomaticUpdates = new System.Windows.Forms.CheckBox();
+ this.chkUseProxyAuthentication = new System.Windows.Forms.CheckBox();
+ this.pnlProxyAuthentication = new System.Windows.Forms.Panel();
+ this.lblProxyUsername = new System.Windows.Forms.Label();
+ this.txtProxyUsername = new System.Windows.Forms.TextBox();
+ this.lblProxyPassword = new System.Windows.Forms.Label();
+ this.txtProxyPassword = new System.Windows.Forms.TextBox();
+ this.btnTestProxy = new System.Windows.Forms.Button();
+ this.pnlUpdateCheck.SuspendLayout();
+ this.pnlProxy.SuspendLayout();
+ this.pnlProxyBasic.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.numProxyPort)).BeginInit();
+ this.pnlProxyAuthentication.SuspendLayout();
+ this.SuspendLayout();
+ //
+ // lblUpdatesExplanation
+ //
+ this.lblUpdatesExplanation.Location = new System.Drawing.Point(3, 0);
+ this.lblUpdatesExplanation.Name = "lblUpdatesExplanation";
+ this.lblUpdatesExplanation.Size = new System.Drawing.Size(536, 40);
+ this.lblUpdatesExplanation.TabIndex = 3;
+ this.lblUpdatesExplanation.Text = "mRemoteNG can periodically connect to the mRemoteNG website to check for updates." +
+ "";
+ //
+ // pnlUpdateCheck
+ //
+ this.pnlUpdateCheck.Controls.Add(this.textBox1);
+ this.pnlUpdateCheck.Controls.Add(this.lblReleaseChannel);
+ this.pnlUpdateCheck.Controls.Add(this.cboReleaseChannel);
+ this.pnlUpdateCheck.Controls.Add(this.btnUpdateCheckNow);
+ this.pnlUpdateCheck.Controls.Add(this.chkCheckForUpdatesOnStartup);
+ this.pnlUpdateCheck.Controls.Add(this.cboUpdateCheckFrequency);
+ this.pnlUpdateCheck.Location = new System.Drawing.Point(0, 48);
+ this.pnlUpdateCheck.Name = "pnlUpdateCheck";
+ this.pnlUpdateCheck.Size = new System.Drawing.Size(610, 120);
+ this.pnlUpdateCheck.TabIndex = 4;
+ //
+ // textBox1
+ //
+ this.textBox1.BackColor = System.Drawing.SystemColors.Control;
+ this.textBox1.BorderStyle = System.Windows.Forms.BorderStyle.None;
+ this.textBox1.Location = new System.Drawing.Point(226, 68);
+ this.textBox1.Multiline = true;
+ this.textBox1.Name = "textBox1";
+ this.textBox1.ReadOnly = true;
+ this.textBox1.Size = new System.Drawing.Size(366, 44);
+ this.textBox1.TabIndex = 5;
+ this.textBox1.Text = "Stable channel includes final releases only.\r\nBeta channel includes Betas & Relea" +
+ "se Candidates.\r\nDevelopment Channel includes Alphas, Betas & Release Candidates." +
+ "";
+ //
+ // lblReleaseChannel
+ //
+ this.lblReleaseChannel.AutoSize = true;
+ this.lblReleaseChannel.Location = new System.Drawing.Point(223, 12);
+ this.lblReleaseChannel.Name = "lblReleaseChannel";
+ this.lblReleaseChannel.Size = new System.Drawing.Size(91, 13);
+ this.lblReleaseChannel.TabIndex = 4;
+ this.lblReleaseChannel.Text = "Release Channel:";
+ //
+ // cboReleaseChannel
+ //
+ this.cboReleaseChannel.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
+ this.cboReleaseChannel.FormattingEnabled = true;
+ this.cboReleaseChannel.Location = new System.Drawing.Point(226, 41);
+ this.cboReleaseChannel.Name = "cboReleaseChannel";
+ this.cboReleaseChannel.Size = new System.Drawing.Size(121, 21);
+ this.cboReleaseChannel.TabIndex = 3;
+ //
+ // btnUpdateCheckNow
+ //
+ this.btnUpdateCheckNow.Location = new System.Drawing.Point(3, 80);
+ this.btnUpdateCheckNow.Name = "btnUpdateCheckNow";
+ this.btnUpdateCheckNow.Size = new System.Drawing.Size(120, 32);
+ this.btnUpdateCheckNow.TabIndex = 2;
+ this.btnUpdateCheckNow.Text = "Check Now";
+ this.btnUpdateCheckNow.UseVisualStyleBackColor = true;
+ this.btnUpdateCheckNow.Click += new System.EventHandler(this.btnUpdateCheckNow_Click);
+ //
+ // chkCheckForUpdatesOnStartup
+ //
+ this.chkCheckForUpdatesOnStartup.AutoSize = true;
+ this.chkCheckForUpdatesOnStartup.Location = new System.Drawing.Point(3, 8);
+ this.chkCheckForUpdatesOnStartup.Name = "chkCheckForUpdatesOnStartup";
+ this.chkCheckForUpdatesOnStartup.Size = new System.Drawing.Size(113, 17);
+ this.chkCheckForUpdatesOnStartup.TabIndex = 0;
+ this.chkCheckForUpdatesOnStartup.Text = "Check for updates";
+ this.chkCheckForUpdatesOnStartup.UseVisualStyleBackColor = true;
+ this.chkCheckForUpdatesOnStartup.CheckedChanged += new System.EventHandler(this.chkCheckForUpdatesOnStartup_CheckedChanged);
+ //
+ // cboUpdateCheckFrequency
+ //
+ this.cboUpdateCheckFrequency.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
+ this.cboUpdateCheckFrequency.FormattingEnabled = true;
+ this.cboUpdateCheckFrequency.Location = new System.Drawing.Point(3, 41);
+ this.cboUpdateCheckFrequency.Name = "cboUpdateCheckFrequency";
+ this.cboUpdateCheckFrequency.Size = new System.Drawing.Size(128, 21);
+ this.cboUpdateCheckFrequency.TabIndex = 1;
+ //
+ // pnlProxy
+ //
+ this.pnlProxy.Controls.Add(this.pnlProxyBasic);
+ this.pnlProxy.Controls.Add(this.chkUseProxyForAutomaticUpdates);
+ this.pnlProxy.Controls.Add(this.chkUseProxyAuthentication);
+ this.pnlProxy.Controls.Add(this.pnlProxyAuthentication);
+ this.pnlProxy.Controls.Add(this.btnTestProxy);
+ this.pnlProxy.Location = new System.Drawing.Point(0, 200);
+ this.pnlProxy.Name = "pnlProxy";
+ this.pnlProxy.Size = new System.Drawing.Size(610, 224);
+ this.pnlProxy.TabIndex = 5;
+ //
+ // pnlProxyBasic
+ //
+ this.pnlProxyBasic.Controls.Add(this.lblProxyAddress);
+ this.pnlProxyBasic.Controls.Add(this.txtProxyAddress);
+ this.pnlProxyBasic.Controls.Add(this.lblProxyPort);
+ this.pnlProxyBasic.Controls.Add(this.numProxyPort);
+ this.pnlProxyBasic.Enabled = false;
+ this.pnlProxyBasic.Location = new System.Drawing.Point(3, 32);
+ this.pnlProxyBasic.Name = "pnlProxyBasic";
+ this.pnlProxyBasic.Size = new System.Drawing.Size(604, 40);
+ this.pnlProxyBasic.TabIndex = 1;
+ //
+ // lblProxyAddress
+ //
+ this.lblProxyAddress.Location = new System.Drawing.Point(8, 4);
+ this.lblProxyAddress.Name = "lblProxyAddress";
+ this.lblProxyAddress.Size = new System.Drawing.Size(96, 24);
+ this.lblProxyAddress.TabIndex = 0;
+ this.lblProxyAddress.Text = "Address:";
+ this.lblProxyAddress.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
+ //
+ // txtProxyAddress
+ //
+ this.txtProxyAddress.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
+ this.txtProxyAddress.Location = new System.Drawing.Point(104, 8);
+ this.txtProxyAddress.Name = "txtProxyAddress";
+ this.txtProxyAddress.Size = new System.Drawing.Size(240, 20);
+ this.txtProxyAddress.TabIndex = 1;
+ //
+ // lblProxyPort
+ //
+ this.lblProxyPort.Location = new System.Drawing.Point(350, 5);
+ this.lblProxyPort.Name = "lblProxyPort";
+ this.lblProxyPort.Size = new System.Drawing.Size(64, 23);
+ this.lblProxyPort.TabIndex = 2;
+ this.lblProxyPort.Text = "Port:";
+ this.lblProxyPort.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
+ //
+ // numProxyPort
+ //
+ this.numProxyPort.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
+ this.numProxyPort.Location = new System.Drawing.Point(420, 8);
+ this.numProxyPort.Maximum = new decimal(new int[] {
+ 65535,
+ 0,
+ 0,
+ 0});
+ this.numProxyPort.Minimum = new decimal(new int[] {
+ 1,
+ 0,
+ 0,
+ 0});
+ this.numProxyPort.Name = "numProxyPort";
+ this.numProxyPort.Size = new System.Drawing.Size(64, 20);
+ this.numProxyPort.TabIndex = 3;
+ this.numProxyPort.Value = new decimal(new int[] {
+ 80,
+ 0,
+ 0,
+ 0});
+ //
+ // chkUseProxyForAutomaticUpdates
+ //
+ this.chkUseProxyForAutomaticUpdates.AutoSize = true;
+ this.chkUseProxyForAutomaticUpdates.Location = new System.Drawing.Point(3, 8);
+ this.chkUseProxyForAutomaticUpdates.Name = "chkUseProxyForAutomaticUpdates";
+ this.chkUseProxyForAutomaticUpdates.Size = new System.Drawing.Size(168, 17);
+ this.chkUseProxyForAutomaticUpdates.TabIndex = 0;
+ this.chkUseProxyForAutomaticUpdates.Text = "Use a proxy server to connect";
+ this.chkUseProxyForAutomaticUpdates.UseVisualStyleBackColor = true;
+ this.chkUseProxyForAutomaticUpdates.CheckedChanged += new System.EventHandler(this.chkUseProxyForAutomaticUpdates_CheckedChanged);
+ //
+ // chkUseProxyAuthentication
+ //
+ this.chkUseProxyAuthentication.AutoSize = true;
+ this.chkUseProxyAuthentication.Enabled = false;
+ this.chkUseProxyAuthentication.Location = new System.Drawing.Point(27, 80);
+ this.chkUseProxyAuthentication.Name = "chkUseProxyAuthentication";
+ this.chkUseProxyAuthentication.Size = new System.Drawing.Size(216, 17);
+ this.chkUseProxyAuthentication.TabIndex = 2;
+ this.chkUseProxyAuthentication.Text = "This proxy server requires authentication";
+ this.chkUseProxyAuthentication.UseVisualStyleBackColor = true;
+ this.chkUseProxyAuthentication.CheckedChanged += new System.EventHandler(this.chkUseProxyAuthentication_CheckedChanged);
+ //
+ // pnlProxyAuthentication
+ //
+ this.pnlProxyAuthentication.Controls.Add(this.lblProxyUsername);
+ this.pnlProxyAuthentication.Controls.Add(this.txtProxyUsername);
+ this.pnlProxyAuthentication.Controls.Add(this.lblProxyPassword);
+ this.pnlProxyAuthentication.Controls.Add(this.txtProxyPassword);
+ this.pnlProxyAuthentication.Enabled = false;
+ this.pnlProxyAuthentication.Location = new System.Drawing.Point(3, 104);
+ this.pnlProxyAuthentication.Name = "pnlProxyAuthentication";
+ this.pnlProxyAuthentication.Size = new System.Drawing.Size(604, 72);
+ this.pnlProxyAuthentication.TabIndex = 3;
+ //
+ // lblProxyUsername
+ //
+ this.lblProxyUsername.Location = new System.Drawing.Point(8, 4);
+ this.lblProxyUsername.Name = "lblProxyUsername";
+ this.lblProxyUsername.Size = new System.Drawing.Size(96, 24);
+ this.lblProxyUsername.TabIndex = 0;
+ this.lblProxyUsername.Text = "Username:";
+ this.lblProxyUsername.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
+ //
+ // txtProxyUsername
+ //
+ this.txtProxyUsername.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
+ this.txtProxyUsername.Location = new System.Drawing.Point(104, 8);
+ this.txtProxyUsername.Name = "txtProxyUsername";
+ this.txtProxyUsername.Size = new System.Drawing.Size(240, 20);
+ this.txtProxyUsername.TabIndex = 1;
+ //
+ // lblProxyPassword
+ //
+ this.lblProxyPassword.Location = new System.Drawing.Point(8, 36);
+ this.lblProxyPassword.Name = "lblProxyPassword";
+ this.lblProxyPassword.Size = new System.Drawing.Size(96, 24);
+ this.lblProxyPassword.TabIndex = 2;
+ this.lblProxyPassword.Text = "Password:";
+ this.lblProxyPassword.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
+ //
+ // txtProxyPassword
+ //
+ this.txtProxyPassword.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
+ this.txtProxyPassword.Location = new System.Drawing.Point(104, 40);
+ this.txtProxyPassword.Name = "txtProxyPassword";
+ this.txtProxyPassword.Size = new System.Drawing.Size(240, 20);
+ this.txtProxyPassword.TabIndex = 3;
+ this.txtProxyPassword.UseSystemPasswordChar = true;
+ //
+ // btnTestProxy
+ //
+ this.btnTestProxy.Location = new System.Drawing.Point(3, 184);
+ this.btnTestProxy.Name = "btnTestProxy";
+ this.btnTestProxy.Size = new System.Drawing.Size(120, 32);
+ this.btnTestProxy.TabIndex = 4;
+ this.btnTestProxy.Text = "Test Proxy";
+ this.btnTestProxy.UseVisualStyleBackColor = true;
+ this.btnTestProxy.Click += new System.EventHandler(this.btnTestProxy_Click);
+ //
+ // UpdatesPage
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.Controls.Add(this.lblUpdatesExplanation);
+ this.Controls.Add(this.pnlUpdateCheck);
+ this.Controls.Add(this.pnlProxy);
+ this.Name = "UpdatesPage";
+ this.PageIcon = ((System.Drawing.Icon)(resources.GetObject("$this.PageIcon")));
+ this.Size = new System.Drawing.Size(610, 489);
+ this.pnlUpdateCheck.ResumeLayout(false);
+ this.pnlUpdateCheck.PerformLayout();
+ this.pnlProxy.ResumeLayout(false);
+ this.pnlProxy.PerformLayout();
+ this.pnlProxyBasic.ResumeLayout(false);
+ this.pnlProxyBasic.PerformLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.numProxyPort)).EndInit();
+ this.pnlProxyAuthentication.ResumeLayout(false);
+ this.pnlProxyAuthentication.PerformLayout();
+ this.ResumeLayout(false);
+
}
internal System.Windows.Forms.Label lblUpdatesExplanation;
internal System.Windows.Forms.Panel pnlUpdateCheck;
@@ -286,6 +337,8 @@ namespace mRemoteNG.UI.Forms.OptionsPages
internal System.Windows.Forms.Label lblProxyPassword;
internal System.Windows.Forms.TextBox txtProxyPassword;
internal System.Windows.Forms.Button btnTestProxy;
-
- }
+ private System.Windows.Forms.Label lblReleaseChannel;
+ private System.Windows.Forms.ComboBox cboReleaseChannel;
+ private System.Windows.Forms.TextBox textBox1;
+ }
}
\ No newline at end of file
diff --git a/mRemoteV1/UI/Forms/OptionsPages/UpdatesPage.cs b/mRemoteV1/UI/Forms/OptionsPages/UpdatesPage.cs
index b1d49f2b0..2ea1fea1e 100644
--- a/mRemoteV1/UI/Forms/OptionsPages/UpdatesPage.cs
+++ b/mRemoteV1/UI/Forms/OptionsPages/UpdatesPage.cs
@@ -2,6 +2,7 @@ using System;
using System.ComponentModel;
using System.Windows.Forms;
using mRemoteNG.App;
+using mRemoteNG.App.Info;
using mRemoteNG.App.Update;
using mRemoteNG.Security.SymmetricEncryption;
using mRemoteNG.Tools;
@@ -84,6 +85,25 @@ namespace mRemoteNG.UI.Forms.OptionsPages
break;
}
+ var stable = cboReleaseChannel.Items.Add(UpdateChannelInfo.STABLE);
+ var beta = cboReleaseChannel.Items.Add(UpdateChannelInfo.BETA);
+ var dev = cboReleaseChannel.Items.Add(UpdateChannelInfo.DEV);
+ switch (Settings.Default.UpdateChannel)
+ {
+ case UpdateChannelInfo.STABLE:
+ cboReleaseChannel.SelectedIndex = stable;
+ break;
+ case UpdateChannelInfo.BETA:
+ cboReleaseChannel.SelectedIndex = beta;
+ break;
+ case UpdateChannelInfo.DEV:
+ cboReleaseChannel.SelectedIndex = dev;
+ break;
+ default:
+ cboReleaseChannel.SelectedIndex = stable;
+ break;
+ }
+
chkUseProxyForAutomaticUpdates.Checked = Convert.ToBoolean(Settings.Default.UpdateUseProxy);
pnlProxyBasic.Enabled = Convert.ToBoolean(Settings.Default.UpdateUseProxy);
txtProxyAddress.Text = Convert.ToString(Settings.Default.UpdateProxyAddress);
@@ -116,6 +136,8 @@ namespace mRemoteNG.UI.Forms.OptionsPages
Settings.Default.CheckForUpdatesFrequencyDays = 31;
}
+ Settings.Default.UpdateChannel = cboReleaseChannel.Text;
+
Settings.Default.UpdateUseProxy = chkUseProxyForAutomaticUpdates.Checked;
Settings.Default.UpdateProxyAddress = txtProxyAddress.Text;
Settings.Default.UpdateProxyPort = (int) numProxyPort.Value;
diff --git a/mRemoteV1/UI/Forms/OptionsPages/UpdatesPage.resx b/mRemoteV1/UI/Forms/OptionsPages/UpdatesPage.resx
index 90e6d05ef..cef4dd5fc 100644
--- a/mRemoteV1/UI/Forms/OptionsPages/UpdatesPage.resx
+++ b/mRemoteV1/UI/Forms/OptionsPages/UpdatesPage.resx
@@ -112,12 +112,12 @@
2.0
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
+
AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
diff --git a/mRemoteV1/UI/Forms/frmMain.cs b/mRemoteV1/UI/Forms/frmMain.cs
index 5d632e74f..d76d507b9 100644
--- a/mRemoteV1/UI/Forms/frmMain.cs
+++ b/mRemoteV1/UI/Forms/frmMain.cs
@@ -44,6 +44,8 @@ namespace mRemoteNG.UI.Forms
private ConnectionInfo _selectedConnection;
private SystemMenu _systemMenu;
private ConnectionTreeWindow ConnectionTreeWindow { get; set; }
+ private readonly IConnectionInitiator _connectionInitiator = new ConnectionInitiator();
+
@@ -51,7 +53,7 @@ namespace mRemoteNG.UI.Forms
{
_showFullPathInTitle = Settings.Default.ShowCompleteConsPathInTitle;
InitializeComponent();
- Fullscreen = new MiscTools.Fullscreen(this);
+ _fullscreen = new Fullscreen(this);
pnlDock.Theme = new VS2012LightTheme();
}
@@ -120,10 +122,68 @@ namespace mRemoteNG.UI.Forms
}
}
- public MiscTools.Fullscreen Fullscreen { get; set; }
+ internal Fullscreen _fullscreen { get; set; }
+
+ internal class Fullscreen
+ {
+ public Fullscreen(Form handledForm)
+ {
+ _handledForm = handledForm;
+ }
+
+ private readonly Form _handledForm;
+ private FormWindowState _savedWindowState;
+ private FormBorderStyle _savedBorderStyle;
+ private Rectangle _savedBounds;
+
+ private bool _value;
+ public bool Value
+ {
+ get
+ {
+ return _value;
+ }
+ set
+ {
+ if (_value == value)
+ {
+ return;
+ }
+ if (!_value)
+ {
+ EnterFullscreen();
+ }
+ else
+ {
+ ExitFullscreen();
+ }
+ _value = value;
+ }
+ }
+
+ private void EnterFullscreen()
+ {
+ _savedBorderStyle = _handledForm.FormBorderStyle;
+ _savedWindowState = _handledForm.WindowState;
+ _savedBounds = _handledForm.Bounds;
+
+ _handledForm.FormBorderStyle = FormBorderStyle.None;
+ if (_handledForm.WindowState == FormWindowState.Maximized)
+ {
+ _handledForm.WindowState = FormWindowState.Normal;
+ }
+ _handledForm.WindowState = FormWindowState.Maximized;
+ }
+ private void ExitFullscreen()
+ {
+ _handledForm.FormBorderStyle = _savedBorderStyle;
+ _handledForm.WindowState = _savedWindowState;
+ _handledForm.Bounds = _savedBounds;
+ }
+ }
#endregion
-
+
#region Startup & Shutdown
private void frmMain_Load(object sender, EventArgs e)
{
@@ -164,7 +224,7 @@ namespace mRemoteNG.UI.Forms
ConnectionTreeWindow = Windows.TreeForm;
}
- private void ApplyLanguage()
+ private void ApplyLanguage()
{
mMenFile.Text = Language.strMenuFile;
mMenFileNew.Text = Language.strMenuNewConnectionFile;
@@ -384,11 +444,11 @@ namespace mRemoteNG.UI.Forms
}
catch (Exception ex)
{
- Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg, string.Format(Language.strErrorAddExternalToolsToToolBarFailed, ex.Message), true);
+ Runtime.MessageCollector.AddExceptionStackTrace(Language.strErrorAddExternalToolsToToolBarFailed, ex);
}
}
- private void tsExtAppEntry_Click(object sender, EventArgs e)
+ private static void tsExtAppEntry_Click(object sender, EventArgs e)
{
var extA = (ExternalTool)((ToolStripButton)sender).Tag;
@@ -426,6 +486,7 @@ namespace mRemoteNG.UI.Forms
private void mMenFile_DropDownOpening(object sender, EventArgs e)
{
var selectedNodeType = ConnectionTreeWindow.SelectedNode?.GetTreeNodeType();
+ // ReSharper disable once SwitchStatementMissingSomeCases
switch (selectedNodeType)
{
case TreeNodeType.Root:
@@ -494,19 +555,19 @@ namespace mRemoteNG.UI.Forms
private void mMenFileNewConnection_Click(object sender, EventArgs e)
{
- ConnectionTreeWindow.AddConnection();
+ ConnectionTreeWindow.ConnectionTree.AddConnection();
Runtime.SaveConnectionsAsync();
}
private void mMenFileNewFolder_Click(object sender, EventArgs e)
{
- ConnectionTreeWindow.AddFolder();
+ ConnectionTreeWindow.ConnectionTree.AddFolder();
Runtime.SaveConnectionsAsync();
}
private void mMenFileNew_Click(object sender, EventArgs e)
{
- var saveFileDialog = Tools.Controls.ConnectionsSaveAsDialog();
+ var saveFileDialog = ConnectionsSaveAsDialog();
if (saveFileDialog.ShowDialog() != DialogResult.OK)
{
return;
@@ -546,19 +607,19 @@ namespace mRemoteNG.UI.Forms
private void mMenFileDelete_Click(object sender, EventArgs e)
{
- ConnectionTreeWindow.DeleteSelectedNode();
+ ConnectionTreeWindow.ConnectionTree.DeleteSelectedNode();
Runtime.SaveConnectionsAsync();
}
private void mMenFileRename_Click(object sender, EventArgs e)
{
- ConnectionTreeWindow.RenameSelectedNode();
+ ConnectionTreeWindow.ConnectionTree.RenameSelectedNode();
Runtime.SaveConnectionsAsync();
}
private void mMenFileDuplicate_Click(object sender, EventArgs e)
{
- ConnectionTreeWindow.DuplicateSelectedNode();
+ ConnectionTreeWindow.ConnectionTree.DuplicateSelectedNode();
Runtime.SaveConnectionsAsync();
}
@@ -584,7 +645,7 @@ namespace mRemoteNG.UI.Forms
foreach (var i in ICList)
{
i.Protocol.Close();
- ConnectionInitiator.OpenConnection(i.Info, ConnectionInfo.Force.DoNotJump);
+ _connectionInitiator.OpenConnection(i.Info, ConnectionInfo.Force.DoNotJump);
}
// throw it on the garbage collector
@@ -623,6 +684,18 @@ namespace mRemoteNG.UI.Forms
{
Shutdown.Quit();
}
+
+ public static SaveFileDialog ConnectionsSaveAsDialog()
+ {
+ return new SaveFileDialog
+ {
+ CheckPathExists = true,
+ InitialDirectory = ConnectionsFileInfo.DefaultConnectionsPath,
+ FileName = ConnectionsFileInfo.DefaultConnectionsFile,
+ OverwritePrompt = true,
+ Filter = Language.strFiltermRemoteXML + @"|*.xml|" + Language.strFilterAll + @"|*.*"
+ };
+ }
#endregion
#region View
@@ -733,7 +806,7 @@ namespace mRemoteNG.UI.Forms
MessageBoxIcon.Question);
if (msgBoxResult == DialogResult.Yes)
{
- Startup.Instance.SetDefaultLayout();
+ Default.SetDefaultLayout();
}
}
@@ -772,8 +845,8 @@ namespace mRemoteNG.UI.Forms
private void mMenViewFullscreen_Click(object sender, EventArgs e)
{
- Fullscreen.Value = !Fullscreen.Value;
- mMenViewFullscreen.Checked = Fullscreen.Value;
+ _fullscreen.Value = !_fullscreen.Value;
+ mMenViewFullscreen.Checked = _fullscreen.Value;
}
#endregion
@@ -834,7 +907,7 @@ namespace mRemoteNG.UI.Forms
}
catch (Exception ex)
{
- Runtime.MessageCollector.AddExceptionMessage("PopulateQuickConnectProtocolMenu() failed.", ex, MessageClass.ErrorMsg, true);
+ Runtime.MessageCollector.AddExceptionStackTrace("PopulateQuickConnectProtocolMenu() failed.", ex);
}
}
@@ -859,11 +932,11 @@ namespace mRemoteNG.UI.Forms
return;
}
cmbQuickConnect.Add(connectionInfo);
- ConnectionInitiator.OpenConnection(connectionInfo, ConnectionInfo.Force.DoNotJump);
+ _connectionInitiator.OpenConnection(connectionInfo, ConnectionInfo.Force.DoNotJump);
}
catch (Exception ex)
{
- Runtime.MessageCollector.AddExceptionMessage("btnQuickConnect_ButtonClick() failed.", ex, MessageClass.ErrorMsg, true);
+ Runtime.MessageCollector.AddExceptionStackTrace("btnQuickConnect_ButtonClick() failed.", ex);
}
}
@@ -935,13 +1008,14 @@ namespace mRemoteNG.UI.Forms
btnConnections.DropDownItems.AddRange(rootMenuItems);
}
- private static void ConnectionsMenuItem_MouseUp(object sender, MouseEventArgs e)
+ private void ConnectionsMenuItem_MouseUp(object sender, MouseEventArgs e)
{
if (e.Button != MouseButtons.Left) return;
+ if (((ToolStripMenuItem) sender).Tag is ContainerInfo) return;
var tag = ((ToolStripMenuItem)sender).Tag as ConnectionInfo;
if (tag != null)
{
- ConnectionInitiator.OpenConnection(tag);
+ _connectionInitiator.OpenConnection(tag);
}
}
#endregion
@@ -959,7 +1033,7 @@ namespace mRemoteNG.UI.Forms
if (!Settings.Default.MinimizeToTray) return;
if (Runtime.NotificationAreaIcon == null)
{
- Runtime.NotificationAreaIcon = new Tools.Controls.NotificationAreaIcon();
+ Runtime.NotificationAreaIcon = new NotificationAreaIcon();
}
Hide();
}
@@ -1056,7 +1130,7 @@ namespace mRemoteNG.UI.Forms
}
catch (Exception ex)
{
- Runtime.MessageCollector.AddExceptionMessage("frmMain WndProc failed", ex, MessageClass.ErrorMsg, true);
+ Runtime.MessageCollector.AddExceptionStackTrace("frmMain WndProc failed", ex);
}
base.WndProc(ref m);
@@ -1068,6 +1142,9 @@ namespace mRemoteNG.UI.Forms
if (w?.TabController.SelectedTab == null) return;
var tab = w.TabController.SelectedTab;
var ifc = (InterfaceControl)tab.Tag;
+
+ if (ifc == null) return;
+
ifc.Protocol.Focus();
((ConnectionWindow) ifc.FindForm())?.RefreshInterfaceController();
}
@@ -1201,6 +1278,26 @@ namespace mRemoteNG.UI.Forms
_systemMenu.InsertMenuItem(_systemMenu.SystemMenuHandle, 0, SystemMenu.Flags.MF_POPUP | SystemMenu.Flags.MF_BYPOSITION, popMen, Language.strSendTo);
_systemMenu.InsertMenuItem(_systemMenu.SystemMenuHandle, 1, SystemMenu.Flags.MF_BYPOSITION | SystemMenu.Flags.MF_SEPARATOR, IntPtr.Zero, null);
}
+
+ public void SetDefaultLayout()
+ {
+ Default.pnlDock.Visible = false;
+
+ Default.pnlDock.DockLeftPortion = Default.pnlDock.Width * 0.2;
+ Default.pnlDock.DockRightPortion = Default.pnlDock.Width * 0.2;
+ Default.pnlDock.DockTopPortion = Default.pnlDock.Height * 0.25;
+ Default.pnlDock.DockBottomPortion = Default.pnlDock.Height * 0.25;
+
+ Windows.TreePanel.Show(Default.pnlDock, DockState.DockLeft);
+ Windows.ConfigPanel.Show(Default.pnlDock);
+ Windows.ConfigPanel.DockTo(Windows.TreePanel.Pane, DockStyle.Bottom, -1);
+ Windows.ErrorsPanel.Show(Default.pnlDock, DockState.Document);
+
+ Windows.ErrorsForm.Hide();
+ Windows.ScreenshotForm.Hide();
+
+ Default.pnlDock.Visible = true;
+ }
#endregion
#region Events
diff --git a/mRemoteV1/UI/Window/AboutWindow.cs b/mRemoteV1/UI/Window/AboutWindow.cs
index a97f17d12..0eb418789 100644
--- a/mRemoteV1/UI/Window/AboutWindow.cs
+++ b/mRemoteV1/UI/Window/AboutWindow.cs
@@ -5,6 +5,8 @@ using System.IO;
using System.Text;
using mRemoteNG.App;
using mRemoteNG.App.Info;
+// ReSharper disable ArrangeRedundantParentheses
+// ReSharper disable RedundantCast
namespace mRemoteNG.UI.Window
{
@@ -22,6 +24,7 @@ namespace mRemoteNG.UI.Window
internal Label lblEdition;
internal Label lblCredits;
internal TextBox txtCredits;
+ private TextBox verText;
internal Panel pnlTop;
private void InitializeComponent()
@@ -38,6 +41,7 @@ namespace mRemoteNG.UI.Window
this.lblChangeLog = new System.Windows.Forms.Label();
this.lblLicense = new System.Windows.Forms.Label();
this.lblCopyright = new System.Windows.Forms.Label();
+ this.verText = new System.Windows.Forms.TextBox();
this.pnlTop.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pbLogo)).BeginInit();
this.pnlBottom.SuspendLayout();
@@ -86,6 +90,7 @@ namespace mRemoteNG.UI.Window
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.pnlBottom.BackColor = System.Drawing.SystemColors.Control;
+ this.pnlBottom.Controls.Add(this.verText);
this.pnlBottom.Controls.Add(this.lblCredits);
this.pnlBottom.Controls.Add(this.txtCredits);
this.pnlBottom.Controls.Add(this.txtChangeLog);
@@ -206,6 +211,18 @@ namespace mRemoteNG.UI.Window
this.lblCopyright.Text = "Copyright";
this.lblCopyright.UseCompatibleTextRendering = true;
//
+ // verText
+ //
+ this.verText.BackColor = System.Drawing.SystemColors.Control;
+ this.verText.BorderStyle = System.Windows.Forms.BorderStyle.None;
+ this.verText.Font = new System.Drawing.Font("Segoe UI", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.verText.Location = new System.Drawing.Point(69, 51);
+ this.verText.Name = "verText";
+ this.verText.Size = new System.Drawing.Size(147, 20);
+ this.verText.TabIndex = 12;
+ this.verText.TabStop = false;
+ this.verText.Text = "w.x.y.z";
+ //
// AboutWindow
//
this.BackColor = System.Drawing.SystemColors.Control;
@@ -282,34 +299,37 @@ namespace mRemoteNG.UI.Window
#endregion
#region Form Stuff
- private void About_Load(object sender, EventArgs e)
- {
- ApplyLanguage();
- ApplyEditions();
-
- try
- {
- lblCopyright.Text = GeneralAppInfo.Copyright;
-
- lblVersion.Text = @"Version " + GeneralAppInfo.ApplicationVersion;
-
- if (File.Exists(GeneralAppInfo.HomePath + "\\CHANGELOG.TXT"))
- {
- using (var sR = new StreamReader(GeneralAppInfo.HomePath + "\\CHANGELOG.TXT"))
- txtChangeLog.Text = sR.ReadToEnd();
- }
- if (File.Exists(GeneralAppInfo.HomePath + "\\CREDITS.TXT"))
- {
- using (var sR = new StreamReader(GeneralAppInfo.HomePath + "\\CREDITS.TXT", Encoding.Default, true))
- txtCredits.Text = sR.ReadToEnd();
- }
- }
- catch (Exception ex)
- {
- Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, "Loading About failed" + Environment.NewLine + ex.Message, true);
- }
- }
+ private void About_Load(object sender, EventArgs e)
+ {
+ ApplyLanguage();
+ ApplyEditions();
+
+ try
+ {
+ lblCopyright.Text = GeneralAppInfo.Copyright;
+
+ lblVersion.Text = @"Version ";
+ verText.Text = GeneralAppInfo.ApplicationVersion;
+
+ if (File.Exists(GeneralAppInfo.HomePath + "\\CHANGELOG.TXT"))
+ {
+ using (var sR = new StreamReader(GeneralAppInfo.HomePath + "\\CHANGELOG.TXT"))
+ txtChangeLog.Text = sR.ReadToEnd();
+ }
+
+ if (File.Exists(GeneralAppInfo.HomePath + "\\CREDITS.TXT"))
+ {
+ using (var sR = new StreamReader(GeneralAppInfo.HomePath + "\\CREDITS.TXT", Encoding.Default, true))
+ txtCredits.Text = sR.ReadToEnd();
+ }
+ }
+ catch (Exception ex)
+ {
+ Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg,
+ "Loading About failed" + Environment.NewLine + ex.Message, true);
+ }
+ }
#if false
private void llblFAMFAMFAM_LinkClicked(Object sender, LinkLabelLinkClickedEventArgs e)
diff --git a/mRemoteV1/UI/Window/ActiveDirectoryImportWindow.Designer.cs b/mRemoteV1/UI/Window/ActiveDirectoryImportWindow.Designer.cs
index 1713a9584..b842e70c6 100644
--- a/mRemoteV1/UI/Window/ActiveDirectoryImportWindow.Designer.cs
+++ b/mRemoteV1/UI/Window/ActiveDirectoryImportWindow.Designer.cs
@@ -64,9 +64,9 @@ namespace mRemoteNG.UI.Window
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.ActiveDirectoryTree.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
- this.ActiveDirectoryTree.Domain = "tant-a01";
+ this.ActiveDirectoryTree.Domain = "DOMAIN";
this.ActiveDirectoryTree.Location = new System.Drawing.Point(12, 52);
- this.ActiveDirectoryTree.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+ this.ActiveDirectoryTree.Margin = new System.Windows.Forms.Padding(4);
this.ActiveDirectoryTree.Name = "ActiveDirectoryTree";
this.ActiveDirectoryTree.SelectedNode = null;
this.ActiveDirectoryTree.Size = new System.Drawing.Size(506, 280);
diff --git a/mRemoteV1/UI/Window/ActiveDirectoryImportWindow.cs b/mRemoteV1/UI/Window/ActiveDirectoryImportWindow.cs
index f97dc9534..373806c54 100644
--- a/mRemoteV1/UI/Window/ActiveDirectoryImportWindow.cs
+++ b/mRemoteV1/UI/Window/ActiveDirectoryImportWindow.cs
@@ -8,81 +8,96 @@ using mRemoteNG.Container;
namespace mRemoteNG.UI.Window
{
- public partial class ActiveDirectoryImportWindow
- {
+ public partial class ActiveDirectoryImportWindow
+ {
+ private string CurrentDomain;
+
#region Constructors
- public ActiveDirectoryImportWindow(DockContent panel)
- {
- InitializeComponent();
- Runtime.FontOverride(this);
- WindowType = WindowType.ActiveDirectoryImport;
- DockPnl = panel;
- }
+
+ public ActiveDirectoryImportWindow(DockContent panel)
+ {
+ InitializeComponent();
+ Runtime.FontOverride(this);
+ WindowType = WindowType.ActiveDirectoryImport;
+ DockPnl = panel;
+ CurrentDomain = Environment.UserDomainName;
+ }
+
#endregion
-
+
#region Private Methods
+
#region Event Handlers
- private void ADImport_Load(object sender, EventArgs e)
- {
- ApplyLanguage();
- txtDomain.Text = ActiveDirectoryTree.Domain;
- EnableDisableImportButton();
- }
+ private void ADImport_Load(object sender, EventArgs e)
+ {
+ ApplyLanguage();
+ txtDomain.Text = CurrentDomain;
+ ActiveDirectoryTree.Domain = CurrentDomain;
+ EnableDisableImportButton();
+
+ // Domain doesn't refresh on load, so it defaults to DOMAIN without this...
+ ChangeDomain();
+ }
- private void btnImport_Click(object sender, EventArgs e)
- {
- var selectedNode = Windows.TreeForm.SelectedNode;
- ContainerInfo importDestination;
- if (selectedNode != null)
- importDestination = selectedNode as ContainerInfo ?? selectedNode.Parent;
- else
- importDestination = Runtime.ConnectionTreeModel.RootNodes.First();
+ private void btnImport_Click(object sender, EventArgs e)
+ {
+ var selectedNode = Windows.TreeForm.SelectedNode;
+ ContainerInfo importDestination;
+ if (selectedNode != null)
+ importDestination = selectedNode as ContainerInfo ?? selectedNode.Parent;
+ else
+ importDestination = Runtime.ConnectionTreeModel.RootNodes.First();
- Import.ImportFromActiveDirectory(ActiveDirectoryTree.ADPath, importDestination, chkSubOU.Checked);
- }
+ Import.ImportFromActiveDirectory(ActiveDirectoryTree.ADPath, importDestination, chkSubOU.Checked);
+ }
+ /*
private static void txtDomain_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
{
if (e.KeyCode == Keys.Enter)
e.IsInputKey = true;
}
+ */
- private void txtDomain_KeyDown(object sender, KeyEventArgs e)
- {
- if (e.KeyCode != Keys.Enter) return;
- ChangeDomain();
- e.SuppressKeyPress = true;
- }
+ private void txtDomain_KeyDown(object sender, KeyEventArgs e)
+ {
+ if (e.KeyCode != Keys.Enter) return;
+ ChangeDomain();
+ e.SuppressKeyPress = true;
+ }
- private void btnChangeDomain_Click(object sender, EventArgs e)
- {
- ChangeDomain();
- }
+ private void btnChangeDomain_Click(object sender, EventArgs e)
+ {
+ ChangeDomain();
+ }
+
+ private void ActiveDirectoryTree_ADPathChanged(object sender)
+ {
+ EnableDisableImportButton();
+ }
- private void ActiveDirectoryTree_ADPathChanged(object sender)
- {
- EnableDisableImportButton();
- }
#endregion
-
- private void ApplyLanguage()
- {
- btnImport.Text = Language.strButtonImport;
- lblDomain.Text = Language.strLabelDomain;
- btnChangeDomain.Text = Language.strButtonChange;
- }
-
- private void ChangeDomain()
- {
- ActiveDirectoryTree.Domain = txtDomain.Text;
- ActiveDirectoryTree.Refresh();
- }
-
- private void EnableDisableImportButton()
- {
- btnImport.Enabled = !string.IsNullOrEmpty(ActiveDirectoryTree.ADPath);
- }
+
+ private void ApplyLanguage()
+ {
+ btnImport.Text = Language.strButtonImport;
+ lblDomain.Text = Language.strLabelDomain;
+ btnChangeDomain.Text = Language.strButtonChange;
+ }
+
+ private void ChangeDomain()
+ {
+ CurrentDomain = txtDomain.Text;
+ ActiveDirectoryTree.Domain = CurrentDomain;
+ ActiveDirectoryTree.Refresh();
+ }
+
+ private void EnableDisableImportButton()
+ {
+ btnImport.Enabled = !string.IsNullOrEmpty(ActiveDirectoryTree.ADPath);
+ }
+
#endregion
private void btnClose_Click(object sender, EventArgs e)
diff --git a/mRemoteV1/UI/Window/ConfigWindow.cs b/mRemoteV1/UI/Window/ConfigWindow.cs
index ff947b279..f529aab83 100644
--- a/mRemoteV1/UI/Window/ConfigWindow.cs
+++ b/mRemoteV1/UI/Window/ConfigWindow.cs
@@ -812,6 +812,8 @@ namespace mRemoteNG.UI.Window
strHide.Add("RDGatewayUseConnectionCredentials");
strHide.Add("RDGatewayUsername");
strHide.Add("RDPAuthenticationLevel");
+ strHide.Add("RDPMinutesToIdleTimeout");
+ strHide.Add("RDPAlertIdleTimeout");
strHide.Add("LoadBalanceInfo");
strHide.Add("RedirectDiskDrives");
strHide.Add("RedirectKeys");
@@ -870,6 +872,10 @@ namespace mRemoteNG.UI.Window
strHide.Add("VNCProxyUsername");
strHide.Add("VNCSmartSizeMode");
strHide.Add("VNCViewOnly");
+ if (conI.RDPMinutesToIdleTimeout <= 0)
+ {
+ strHide.Add("RDPAlertIdleTimeout");
+ }
if (conI.RDGatewayUsageMethod == ProtocolRDP.RDGatewayUsageMethod.Never)
{
strHide.Add("RDGatewayDomain");
@@ -910,7 +916,9 @@ namespace mRemoteNG.UI.Window
strHide.Add("RDGatewayUseConnectionCredentials");
strHide.Add("RDGatewayUsername");
strHide.Add("RDPAuthenticationLevel");
- strHide.Add("LoadBalanceInfo");
+ strHide.Add("RDPMinutesToIdleTimeout");
+ strHide.Add("RDPAlertIdleTimeout");
+ strHide.Add("LoadBalanceInfo");
strHide.Add("RedirectDiskDrives");
strHide.Add("RedirectKeys");
strHide.Add("RedirectPorts");
@@ -953,7 +961,9 @@ namespace mRemoteNG.UI.Window
strHide.Add("RDGatewayUseConnectionCredentials");
strHide.Add("RDGatewayUsername");
strHide.Add("RDPAuthenticationLevel");
- strHide.Add("LoadBalanceInfo");
+ strHide.Add("RDPMinutesToIdleTimeout");
+ strHide.Add("RDPAlertIdleTimeout");
+ strHide.Add("LoadBalanceInfo");
strHide.Add("RedirectDiskDrives");
strHide.Add("RedirectKeys");
strHide.Add("RedirectPorts");
@@ -995,7 +1005,9 @@ namespace mRemoteNG.UI.Window
strHide.Add("RDGatewayUseConnectionCredentials");
strHide.Add("RDGatewayUsername");
strHide.Add("RDPAuthenticationLevel");
- strHide.Add("LoadBalanceInfo");
+ strHide.Add("RDPMinutesToIdleTimeout");
+ strHide.Add("RDPAlertIdleTimeout");
+ strHide.Add("LoadBalanceInfo");
strHide.Add("RedirectDiskDrives");
strHide.Add("RedirectKeys");
strHide.Add("RedirectPorts");
@@ -1038,7 +1050,9 @@ namespace mRemoteNG.UI.Window
strHide.Add("RDGatewayUseConnectionCredentials");
strHide.Add("RDGatewayUsername");
strHide.Add("RDPAuthenticationLevel");
- strHide.Add("LoadBalanceInfo");
+ strHide.Add("RDPMinutesToIdleTimeout");
+ strHide.Add("RDPAlertIdleTimeout");
+ strHide.Add("LoadBalanceInfo");
strHide.Add("RedirectDiskDrives");
strHide.Add("RedirectKeys");
strHide.Add("RedirectPorts");
@@ -1082,7 +1096,9 @@ namespace mRemoteNG.UI.Window
strHide.Add("RDGatewayUseConnectionCredentials");
strHide.Add("RDGatewayUsername");
strHide.Add("RDPAuthenticationLevel");
- strHide.Add("LoadBalanceInfo");
+ strHide.Add("RDPMinutesToIdleTimeout");
+ strHide.Add("RDPAlertIdleTimeout");
+ strHide.Add("LoadBalanceInfo");
strHide.Add("RedirectDiskDrives");
strHide.Add("RedirectKeys");
strHide.Add("RedirectPorts");
@@ -1126,7 +1142,9 @@ namespace mRemoteNG.UI.Window
strHide.Add("RDGatewayUseConnectionCredentials");
strHide.Add("RDGatewayUsername");
strHide.Add("RDPAuthenticationLevel");
- strHide.Add("LoadBalanceInfo");
+ strHide.Add("RDPMinutesToIdleTimeout");
+ strHide.Add("RDPAlertIdleTimeout");
+ strHide.Add("LoadBalanceInfo");
strHide.Add("RedirectDiskDrives");
strHide.Add("RedirectKeys");
strHide.Add("RedirectPorts");
@@ -1170,7 +1188,9 @@ namespace mRemoteNG.UI.Window
strHide.Add("RDGatewayUseConnectionCredentials");
strHide.Add("RDGatewayUsername");
strHide.Add("RDPAuthenticationLevel");
- strHide.Add("LoadBalanceInfo");
+ strHide.Add("RDPMinutesToIdleTimeout");
+ strHide.Add("RDPAlertIdleTimeout");
+ strHide.Add("LoadBalanceInfo");
strHide.Add("RedirectDiskDrives");
strHide.Add("RedirectKeys");
strHide.Add("RedirectPorts");
@@ -1212,7 +1232,9 @@ namespace mRemoteNG.UI.Window
strHide.Add("RDGatewayUseConnectionCredentials");
strHide.Add("RDGatewayUsername");
strHide.Add("RDPAuthenticationLevel");
- strHide.Add("LoadBalanceInfo");
+ strHide.Add("RDPMinutesToIdleTimeout");
+ strHide.Add("RDPAlertIdleTimeout");
+ strHide.Add("LoadBalanceInfo");
strHide.Add("RedirectDiskDrives");
strHide.Add("RedirectKeys");
strHide.Add("RedirectPorts");
@@ -1250,7 +1272,9 @@ namespace mRemoteNG.UI.Window
strHide.Add("RDGatewayUseConnectionCredentials");
strHide.Add("RDGatewayUsername");
strHide.Add("RDPAuthenticationLevel");
- strHide.Add("LoadBalanceInfo");
+ strHide.Add("RDPMinutesToIdleTimeout");
+ strHide.Add("RDPAlertIdleTimeout");
+ strHide.Add("LoadBalanceInfo");
strHide.Add("RedirectDiskDrives");
strHide.Add("RedirectKeys");
strHide.Add("RedirectPorts");
@@ -1291,7 +1315,9 @@ namespace mRemoteNG.UI.Window
strHide.Add("RDGatewayUseConnectionCredentials");
strHide.Add("RDGatewayUsername");
strHide.Add("RDPAuthenticationLevel");
- strHide.Add("LoadBalanceInfo");
+ strHide.Add("RDPMinutesToIdleTimeout");
+ strHide.Add("RDPAlertIdleTimeout");
+ strHide.Add("LoadBalanceInfo");
strHide.Add("RedirectDiskDrives");
strHide.Add("RedirectKeys");
strHide.Add("RedirectPorts");
@@ -1372,6 +1398,10 @@ namespace mRemoteNG.UI.Window
strHide.Add("ICAEncryptionStrength");
if (conI.Inheritance.RDPAuthenticationLevel)
strHide.Add("RDPAuthenticationLevel");
+ if (conI.Inheritance.RDPMinutesToIdleTimeout)
+ strHide.Add("RDPMinutesToIdleTimeout");
+ if (conI.Inheritance.RDPAlertIdleTimeout)
+ strHide.Add("RDPAlertIdleTimeout");
if (conI.Inheritance.LoadBalanceInfo)
strHide.Add("LoadBalanceInfo");
if (conI.Inheritance.Username)
diff --git a/mRemoteV1/UI/Window/ConnectionTreeWindow.Designer.cs b/mRemoteV1/UI/Window/ConnectionTreeWindow.Designer.cs
index 82865b44a..ed23b42f3 100644
--- a/mRemoteV1/UI/Window/ConnectionTreeWindow.Designer.cs
+++ b/mRemoteV1/UI/Window/ConnectionTreeWindow.Designer.cs
@@ -7,7 +7,6 @@ namespace mRemoteNG.UI.Window
#region Windows Form Designer generated code
internal System.Windows.Forms.TextBox txtSearch;
internal System.Windows.Forms.Panel pnlConnections;
- internal System.Windows.Forms.ImageList imgListTree;
internal System.Windows.Forms.MenuStrip msMain;
internal System.Windows.Forms.ToolStripMenuItem mMenView;
internal System.Windows.Forms.ToolStripMenuItem mMenViewExpandAllFolders;
@@ -17,13 +16,10 @@ namespace mRemoteNG.UI.Window
internal System.Windows.Forms.ToolStripMenuItem mMenAddConnection;
internal System.Windows.Forms.ToolStripMenuItem mMenAddFolder;
public System.Windows.Forms.TreeView tvConnections;
- public BrightIdeasSoftware.TreeListView olvConnections;
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
- this.olvConnections = new BrightIdeasSoftware.TreeListView();
- this.olvNameColumn = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn()));
- this.imgListTree = new System.Windows.Forms.ImageList(this.components);
+ this.olvConnections = new mRemoteNG.UI.Controls.ConnectionTree();
this.pnlConnections = new System.Windows.Forms.Panel();
this.PictureBox1 = new System.Windows.Forms.PictureBox();
this.txtSearch = new System.Windows.Forms.TextBox();
@@ -42,20 +38,16 @@ namespace mRemoteNG.UI.Window
//
// olvConnections
//
- this.olvConnections.AllColumns.Add(this.olvNameColumn);
this.olvConnections.AllowDrop = true;
this.olvConnections.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.olvConnections.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.olvConnections.CellEditUseWholeCell = false;
- this.olvConnections.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
- this.olvNameColumn});
this.olvConnections.Cursor = System.Windows.Forms.Cursors.Default;
this.olvConnections.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None;
this.olvConnections.HideSelection = false;
this.olvConnections.IsSimpleDragSource = true;
- this.olvConnections.IsSimpleDropSink = true;
this.olvConnections.LabelEdit = true;
this.olvConnections.Location = new System.Drawing.Point(0, 0);
this.olvConnections.MultiSelect = false;
@@ -64,7 +56,6 @@ namespace mRemoteNG.UI.Window
this.olvConnections.SelectedForeColor = System.Drawing.SystemColors.HighlightText;
this.olvConnections.ShowGroups = false;
this.olvConnections.Size = new System.Drawing.Size(192, 410);
- this.olvConnections.SmallImageList = this.imgListTree;
this.olvConnections.TabIndex = 20;
this.olvConnections.UnfocusedSelectedBackColor = System.Drawing.SystemColors.Highlight;
this.olvConnections.UnfocusedSelectedForeColor = System.Drawing.SystemColors.HighlightText;
@@ -72,18 +63,6 @@ namespace mRemoteNG.UI.Window
this.olvConnections.View = System.Windows.Forms.View.Details;
this.olvConnections.VirtualMode = true;
//
- // olvNameColumn
- //
- this.olvNameColumn.AspectName = "Name";
- this.olvNameColumn.FillsFreeSpace = true;
- this.olvNameColumn.IsButton = true;
- //
- // imgListTree
- //
- this.imgListTree.ColorDepth = System.Windows.Forms.ColorDepth.Depth32Bit;
- this.imgListTree.ImageSize = new System.Drawing.Size(16, 16);
- this.imgListTree.TransparentColor = System.Drawing.Color.Transparent;
- //
// pnlConnections
//
this.pnlConnections.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
@@ -214,6 +193,6 @@ namespace mRemoteNG.UI.Window
#endregion
private System.ComponentModel.IContainer components;
- private BrightIdeasSoftware.OLVColumn olvNameColumn;
+ private Controls.ConnectionTree olvConnections;
}
}
diff --git a/mRemoteV1/UI/Window/ConnectionTreeWindow.cs b/mRemoteV1/UI/Window/ConnectionTreeWindow.cs
index c3d8ad3bc..3ce13648c 100644
--- a/mRemoteV1/UI/Window/ConnectionTreeWindow.cs
+++ b/mRemoteV1/UI/Window/ConnectionTreeWindow.cs
@@ -3,17 +3,10 @@ using mRemoteNG.Connection;
using mRemoteNG.Container;
using mRemoteNG.Tree;
using System;
-using System.Collections;
using System.Collections.Generic;
-using System.Collections.Specialized;
using System.ComponentModel;
using System.Drawing;
-using System.Linq;
using System.Windows.Forms;
-using BrightIdeasSoftware;
-using mRemoteNG.Config.Putty;
-using mRemoteNG.Tools;
-using mRemoteNG.Tree.Root;
using mRemoteNG.UI.Controls;
using WeifenLuo.WinFormsUI.Docking;
@@ -22,22 +15,16 @@ namespace mRemoteNG.UI.Window
{
public partial class ConnectionTreeWindow
{
- private ConnectionTreeModel _connectionTreeModel;
- private readonly ConnectionTreeDragAndDropHandler _dragAndDropHandler = new ConnectionTreeDragAndDropHandler();
- private NodeSearcher _nodeSearcher;
- private readonly ConnectionContextMenu _contextMenu = new ConnectionContextMenu();
- private readonly PuttySessionsManager _puttySessionsManager = PuttySessionsManager.Instance;
+ private readonly ConnectionContextMenu _contextMenu;
+ private readonly IConnectionInitiator _connectionInitiator = new ConnectionInitiator();
- public ConnectionInfo SelectedNode => (ConnectionInfo) olvConnections.SelectedObject;
- public ConnectionTreeModel ConnectionTreeModel
+ public ConnectionInfo SelectedNode => olvConnections.SelectedNode;
+
+ public ConnectionTree ConnectionTree
{
- get { return _connectionTreeModel; }
- set
- {
- _connectionTreeModel = value;
- PopulateTreeView();
- }
+ get { return olvConnections; }
+ set { olvConnections = value; }
}
public ConnectionTreeWindow(DockContent panel)
@@ -45,235 +32,12 @@ namespace mRemoteNG.UI.Window
WindowType = WindowType.Tree;
DockPnl = panel;
InitializeComponent();
-
- FillImageList();
- LinkModelToView();
- SetupDropSink();
- SetEventHandlers();
- }
-
- private void FillImageList()
- {
- try
- {
- imgListTree.Images.Add(Resources.Root);
- imgListTree.Images.SetKeyName(0, "Root");
- imgListTree.Images.Add(Resources.Folder);
- imgListTree.Images.SetKeyName(1, "Folder");
- imgListTree.Images.Add(Resources.Play);
- imgListTree.Images.SetKeyName(2, "Play");
- imgListTree.Images.Add(Resources.Pause);
- imgListTree.Images.SetKeyName(3, "Pause");
- imgListTree.Images.Add(Resources.PuttySessions);
- imgListTree.Images.SetKeyName(4, "PuttySessions");
- }
- catch (Exception ex)
- {
- Runtime.MessageCollector.AddExceptionStackTrace("FillImageList (UI.Window.ConnectionTreeWindow) failed", ex);
- }
- }
-
- private void LinkModelToView()
- {
- olvNameColumn.AspectGetter = item => ((ConnectionInfo)item).Name;
- olvNameColumn.ImageGetter = ConnectionImageGetter;
- olvConnections.CanExpandGetter = item =>
- {
- var itemAsContainer = item as ContainerInfo;
- return itemAsContainer?.Children.Count > 0;
- };
- olvConnections.ChildrenGetter = item => ((ContainerInfo)item).Children;
+ _contextMenu = new ConnectionContextMenu(olvConnections);
olvConnections.ContextMenuStrip = _contextMenu;
- }
-
- private void SetupDropSink()
- {
- var dropSink = (SimpleDropSink)olvConnections.DropSink;
- dropSink.CanDropBetween = true;
- }
-
- private static object ConnectionImageGetter(object rowObject)
- {
- if (rowObject is RootPuttySessionsNodeInfo) return "PuttySessions";
- if (rowObject is RootNodeInfo) return "Root";
- if (rowObject is ContainerInfo) return "Folder";
- var connection = rowObject as ConnectionInfo;
- if (connection == null) return "";
- return connection.OpenConnections.Count > 0 ? "Play" : "Pause";
- }
-
- private void SetEventHandlers()
- {
- SetTreeEventHandlers();
- SetContextMenuEventHandlers();
SetMenuEventHandlers();
- }
-
- private void SetTreeEventHandlers()
- {
- olvConnections.Collapsed += (sender, args) =>
- {
- var container = args.Model as ContainerInfo;
- if (container != null)
- container.IsExpanded = false;
- };
- olvConnections.Expanded += (sender, args) =>
- {
- var container = args.Model as ContainerInfo;
- if (container != null)
- container.IsExpanded = true;
- };
- olvConnections.BeforeLabelEdit += tvConnections_BeforeLabelEdit;
- olvConnections.AfterLabelEdit += tvConnections_AfterLabelEdit;
- olvConnections.SelectionChanged += tvConnections_AfterSelect;
- olvConnections.CellClick += tvConnections_NodeMouseSingleClick;
- olvConnections.CellClick += tvConnections_NodeMouseDoubleClick;
- olvConnections.CellToolTipShowing += tvConnections_CellToolTipShowing;
- olvConnections.ModelCanDrop += _dragAndDropHandler.HandleEvent_ModelCanDrop;
- olvConnections.ModelDropped += _dragAndDropHandler.HandleEvent_ModelDropped;
- olvConnections.KeyDown += tvConnections_KeyDown;
- olvConnections.KeyPress += tvConnections_KeyPress;
- }
-
- private void SetContextMenuEventHandlers()
- {
- _contextMenu.Opening += (sender, args) => _contextMenu.ShowHideTreeContextMenuItems(SelectedNode);
- _contextMenu.ConnectClicked += (sender, args) =>
- {
- var selectedNodeAsContainer = SelectedNode as ContainerInfo;
- if (selectedNodeAsContainer != null)
- ConnectionInitiator.OpenConnection(selectedNodeAsContainer, ConnectionInfo.Force.DoNotJump);
- else
- ConnectionInitiator.OpenConnection(SelectedNode, ConnectionInfo.Force.DoNotJump);
- };
- _contextMenu.ConnectToConsoleSessionClicked += (sender, args) =>
- {
- var selectedNodeAsContainer = SelectedNode as ContainerInfo;
- if (selectedNodeAsContainer != null)
- ConnectionInitiator.OpenConnection(selectedNodeAsContainer, ConnectionInfo.Force.UseConsoleSession | ConnectionInfo.Force.DoNotJump);
- else
- ConnectionInitiator.OpenConnection(SelectedNode, ConnectionInfo.Force.UseConsoleSession | ConnectionInfo.Force.DoNotJump);
- };
- _contextMenu.DontConnectToConsoleSessionClicked += (sender, args) =>
- {
- var selectedNodeAsContainer = SelectedNode as ContainerInfo;
- if (selectedNodeAsContainer != null)
- ConnectionInitiator.OpenConnection(selectedNodeAsContainer, ConnectionInfo.Force.DontUseConsoleSession | ConnectionInfo.Force.DoNotJump);
- else
- ConnectionInitiator.OpenConnection(SelectedNode, ConnectionInfo.Force.DontUseConsoleSession | ConnectionInfo.Force.DoNotJump);
- };
- _contextMenu.ConnectInFullscreenClicked += (sender, args) =>
- {
- var selectedNodeAsContainer = SelectedNode as ContainerInfo;
- if (selectedNodeAsContainer != null)
- ConnectionInitiator.OpenConnection(selectedNodeAsContainer, ConnectionInfo.Force.Fullscreen | ConnectionInfo.Force.DoNotJump);
- else
- ConnectionInitiator.OpenConnection(SelectedNode, ConnectionInfo.Force.Fullscreen | ConnectionInfo.Force.DoNotJump);
- };
- _contextMenu.ConnectWithNoCredentialsClick += (sender, args) =>
- {
- var selectedNodeAsContainer = SelectedNode as ContainerInfo;
- if (selectedNodeAsContainer != null)
- ConnectionInitiator.OpenConnection(selectedNodeAsContainer, ConnectionInfo.Force.NoCredentials);
- else
- ConnectionInitiator.OpenConnection(SelectedNode, ConnectionInfo.Force.NoCredentials);
- };
- _contextMenu.ChoosePanelBeforeConnectingClicked += (sender, args) =>
- {
- var selectedNodeAsContainer = SelectedNode as ContainerInfo;
- if (selectedNodeAsContainer != null)
- ConnectionInitiator.OpenConnection(selectedNodeAsContainer, ConnectionInfo.Force.OverridePanel | ConnectionInfo.Force.DoNotJump);
- else
- ConnectionInitiator.OpenConnection(SelectedNode, ConnectionInfo.Force.OverridePanel | ConnectionInfo.Force.DoNotJump);
- };
- _contextMenu.DisconnectClicked += (sender, args) => DisconnectConnection(SelectedNode);
- _contextMenu.TransferFileClicked += (sender, args) => SshTransferFile();
- _contextMenu.DuplicateClicked += (sender, args) => DuplicateSelectedNode();
- _contextMenu.RenameClicked += (sender, args) => RenameSelectedNode();
- _contextMenu.DeleteClicked += (sender, args) => DeleteSelectedNode();
- _contextMenu.ImportFileClicked += (sender, args) =>
- {
- var selectedNodeAsContainer = SelectedNode as ContainerInfo ?? SelectedNode.Parent;
- Import.ImportFromFile(selectedNodeAsContainer);
- };
- _contextMenu.ImportActiveDirectoryClicked += (sender, args) => Windows.Show(WindowType.ActiveDirectoryImport);
- _contextMenu.ImportPortScanClicked += (sender, args) => Windows.Show(WindowType.PortScan);
- _contextMenu.ExportFileClicked += (sender, args) => Export.ExportToFile(SelectedNode, Runtime.ConnectionTreeModel);
- _contextMenu.AddConnectionClicked += cMenTreeAddConnection_Click;
- _contextMenu.AddFolderClicked += cMenTreeAddFolder_Click;
- _contextMenu.SortAscendingClicked += (sender, args) => SortNodesRecursive(SelectedNode, ListSortDirection.Ascending);
- _contextMenu.SortDescendingClicked += (sender, args) => SortNodesRecursive(SelectedNode, ListSortDirection.Descending);
- _contextMenu.MoveUpClicked += cMenTreeMoveUp_Click;
- _contextMenu.MoveDownClicked += cMenTreeMoveDown_Click;
- _contextMenu.ExternalToolClicked += (sender, args) => StartExternalApp((ExternalTool)((ToolStripMenuItem)sender).Tag);
- }
-
- private void SetMenuEventHandlers()
- {
- mMenViewExpandAllFolders.Click += (sender, args) => olvConnections.ExpandAll();
- mMenViewCollapseAllFolders.Click += (sender, args) =>
- {
- olvConnections.CollapseAll();
- olvConnections.Expand(GetRootConnectionNode());
- };
- mMenSortAscending.Click += (sender, args) => SortNodesRecursive(GetRootConnectionNode(), ListSortDirection.Ascending);
- }
-
- private void PopulateTreeView()
- {
- UnregisterModelUpdateHandlers();
- olvConnections.SetObjects(ConnectionTreeModel.RootNodes);
- RegisterModelUpdateHandlers();
- _nodeSearcher = new NodeSearcher(ConnectionTreeModel);
- ExpandPreviouslyOpenedFolders();
- ExpandRootConnectionNode();
- OpenConnectionsFromLastSession();
- }
-
- private void RegisterModelUpdateHandlers()
- {
- _puttySessionsManager.PuttySessionsCollectionChanged += OnPuttySessionsCollectionChanged;
- ConnectionTreeModel.CollectionChanged += HandleCollectionChanged;
- ConnectionTreeModel.PropertyChanged += HandleCollectionPropertyChanged;
- }
-
- private void UnregisterModelUpdateHandlers()
- {
- _puttySessionsManager.PuttySessionsCollectionChanged -= OnPuttySessionsCollectionChanged;
- ConnectionTreeModel.CollectionChanged -= HandleCollectionChanged;
- ConnectionTreeModel.PropertyChanged -= HandleCollectionPropertyChanged;
- }
-
- private void OnPuttySessionsCollectionChanged(object sender, NotifyCollectionChangedEventArgs args)
- {
- RefreshTreeObjects(GetRootPuttyNodes().ToList());
- }
-
- private void HandleCollectionPropertyChanged(object sender, PropertyChangedEventArgs propertyChangedEventArgs)
- {
- //TODO for some reason property changed events are getting triggered twice for each changed property. should be just once. cant find source of duplication
- var property = propertyChangedEventArgs.PropertyName;
- if (property != "Name" && property != "OpenConnections") return;
- var senderAsConnectionInfo = sender as ConnectionInfo;
- if (senderAsConnectionInfo != null)
- RefreshTreeObject(senderAsConnectionInfo);
- }
-
- private void ExpandRootConnectionNode()
- {
- var rootConnectionNode = GetRootConnectionNode();
- olvConnections.InvokeExpand(rootConnectionNode);
- }
-
- private RootNodeInfo GetRootConnectionNode()
- {
- return (RootNodeInfo)olvConnections.Roots.Cast().First(item => item is RootNodeInfo);
- }
-
- private IEnumerable GetRootPuttyNodes()
- {
- return olvConnections.Objects.OfType();
- }
+ SetConnectionTreeEventHandlers();
+ Settings.Default.PropertyChanged += (sender, args) => SetConnectionTreeEventHandlers();
+ }
#region Form Stuff
private void Tree_Load(object sender, EventArgs e)
@@ -316,226 +80,88 @@ namespace mRemoteNG.UI.Window
}
#endregion
- private void ExpandPreviouslyOpenedFolders()
- {
- var containerList = ConnectionTreeModel.GetRecursiveChildList(GetRootConnectionNode()).OfType();
- var previouslyExpandedNodes = containerList.Where(container => container.IsExpanded);
- olvConnections.ExpandedObjects = previouslyExpandedNodes;
- olvConnections.InvokeRebuildAll(true);
- }
-
- private void OpenConnectionsFromLastSession()
- {
- if (!Settings.Default.OpenConsFromLastSession || Settings.Default.NoReconnect) return;
- var connectionInfoList = GetRootConnectionNode().GetRecursiveChildList().Where(node => !(node is ContainerInfo));
- var previouslyOpenedConnections = connectionInfoList.Where(item => item.PleaseConnect);
- foreach (var connectionInfo in previouslyOpenedConnections)
- {
- ConnectionInitiator.OpenConnection(connectionInfo);
- }
- }
-
- public void EnsureRootNodeVisible()
+ #region ConnectionTree
+ private void SetConnectionTreeEventHandlers()
{
- olvConnections.EnsureModelVisible(GetRootConnectionNode());
+ olvConnections.NodeDeletionConfirmer = new SelectedConnectionDeletionConfirmer(olvConnections, MessageBox.Show);
+ olvConnections.BeforeLabelEdit += tvConnections_BeforeLabelEdit;
+ olvConnections.AfterLabelEdit += tvConnections_AfterLabelEdit;
+ olvConnections.KeyDown += tvConnections_KeyDown;
+ olvConnections.KeyPress += tvConnections_KeyPress;
+ SetTreePostSetupActions();
+ SetConnectionTreeDoubleClickHandlers();
+ SetConnectionTreeSingleClickHandlers();
}
- public void DuplicateSelectedNode()
- {
- var newNode = SelectedNode.Clone();
- newNode.Parent.SetChildBelow(newNode, SelectedNode);
- Runtime.SaveConnectionsAsync();
- }
-
- public void RenameSelectedNode()
- {
- olvConnections.SelectedItem.BeginEdit();
- Runtime.SaveConnectionsAsync();
- }
-
- public void DeleteSelectedNode()
- {
- if (SelectedNode is RootNodeInfo || SelectedNode is PuttySessionInfo) return;
- if (!UserConfirmsDeletion()) return;
- ConnectionTreeModel.DeleteNode(SelectedNode);
- Runtime.SaveConnectionsAsync();
- }
-
- private bool UserConfirmsDeletion()
+ private void SetTreePostSetupActions()
{
- var selectedNodeAsContainer = SelectedNode as ContainerInfo;
- if (selectedNodeAsContainer != null)
- return selectedNodeAsContainer.HasChildren()
- ? UserConfirmsNonEmptyFolderDeletion()
- : UserConfirmsEmptyFolderDeletion();
- return UserConfirmsConnectionDeletion();
- }
-
- private bool UserConfirmsEmptyFolderDeletion()
- {
- var messagePrompt = string.Format(Language.strConfirmDeleteNodeFolder, SelectedNode.Name);
- return PromptUser(messagePrompt);
- }
-
- private bool UserConfirmsNonEmptyFolderDeletion()
- {
- var messagePrompt = string.Format(Language.strConfirmDeleteNodeFolderNotEmpty, SelectedNode.Name);
- return PromptUser(messagePrompt);
- }
-
- private bool UserConfirmsConnectionDeletion()
- {
- var messagePrompt = string.Format(Language.strConfirmDeleteNodeConnection, SelectedNode.Name);
- return PromptUser(messagePrompt);
- }
-
- private static bool PromptUser(string promptMessage)
- {
- var msgBoxResponse = MessageBox.Show(promptMessage, Application.ProductName, MessageBoxButtons.YesNo, MessageBoxIcon.Question);
- return (msgBoxResponse == DialogResult.Yes);
- }
-
- #region Private Methods
- private void tvConnections_BeforeLabelEdit(object sender, LabelEditEventArgs e)
- {
- _contextMenu.DisableShortcutKeys();
- }
-
- private void tvConnections_AfterLabelEdit(object sender, LabelEditEventArgs e)
- {
- try
- {
- _contextMenu.EnableShortcutKeys();
- ConnectionTreeModel.RenameNode(SelectedNode, e.Label);
- Windows.ConfigForm.SelectedTreeNode = SelectedNode;
- Runtime.SaveConnectionsAsync();
- }
- catch (Exception ex)
- {
- Runtime.MessageCollector.AddExceptionStackTrace("tvConnections_AfterLabelEdit (UI.Window.ConnectionTreeWindow) failed", ex);
- }
- }
-
- private void tvConnections_AfterSelect(object sender, EventArgs e)
- {
- try
- {
- Windows.ConfigForm.SelectedTreeNode = SelectedNode;
- }
- catch (Exception ex)
- {
- Runtime.MessageCollector.AddExceptionStackTrace("tvConnections_AfterSelect (UI.Window.ConnectionTreeWindow) failed", ex);
- }
- }
-
- private void tvConnections_NodeMouseSingleClick(object sender, CellClickEventArgs e)
- {
- try
- {
- if (e.ClickCount > 1) return;
- var clickedNode = e.Model as ConnectionInfo;
-
- if (clickedNode == null) return;
- if (clickedNode.GetTreeNodeType() != TreeNodeType.Connection && clickedNode.GetTreeNodeType() != TreeNodeType.PuttySession) return;
- if (Settings.Default.SingleClickOnConnectionOpensIt)
- ConnectionInitiator.OpenConnection(SelectedNode);
-
- if (Settings.Default.SingleClickSwitchesToOpenConnection)
- ConnectionInitiator.SwitchToOpenConnection(SelectedNode);
- }
- catch (Exception ex)
- {
- Runtime.MessageCollector.AddExceptionStackTrace("tvConnections_NodeMouseClick (UI.Window.ConnectionTreeWindow) failed", ex);
- }
- }
-
- private void tvConnections_NodeMouseDoubleClick(object sender, CellClickEventArgs e)
- {
- if (e.ClickCount < 2) return;
- var clickedNodeAsContainer = e.Model as ContainerInfo;
- if (clickedNodeAsContainer != null)
- {
- olvConnections.ToggleExpansion(clickedNodeAsContainer);
- }
-
- var clickedNode = e.Model as ConnectionInfo;
- if (clickedNode?.GetTreeNodeType() == TreeNodeType.Connection |
- clickedNode?.GetTreeNodeType() == TreeNodeType.PuttySession)
- {
- ConnectionInitiator.OpenConnection(SelectedNode);
- }
- }
-
- private void tvConnections_CellToolTipShowing(object sender, ToolTipShowingEventArgs e)
- {
- try
- {
- var nodeProducingTooltip = (ConnectionInfo) e.Model;
- e.Text = nodeProducingTooltip.Description;
- }
- catch (Exception ex)
- {
- Runtime.MessageCollector.AddExceptionStackTrace("tvConnections_MouseMove (UI.Window.ConnectionTreeWindow) failed", ex);
- }
- }
-
- private void HandleCollectionChanged(object sender, NotifyCollectionChangedEventArgs args)
- {
- var senderAsContainerInfo = sender as ContainerInfo;
- // ReSharper disable once SwitchStatementMissingSomeCases
- switch (args?.Action)
+ var actions = new List
{
- case NotifyCollectionChangedAction.Add:
- var childList = senderAsContainerInfo?.Children;
- ConnectionInfo otherChild = null;
- if (childList?.Count > 1)
- otherChild = childList.First(child => !args.NewItems.Contains(child));
- RefreshTreeObject(otherChild ?? senderAsContainerInfo);
- break;
- case NotifyCollectionChangedAction.Remove:
- RefreshTreeObjects(args.OldItems);
- break;
- case NotifyCollectionChangedAction.Move:
- RefreshTreeObjects(args.OldItems);
- break;
- case NotifyCollectionChangedAction.Reset:
- RefreshTreeObject(senderAsContainerInfo);
- break;
- case NotifyCollectionChangedAction.Replace:
- break;
- case null:
- break;
- }
+ new PreviouslyOpenedFolderExpander(),
+ new RootNodeExpander()
+ };
+
+ if (Settings.Default.OpenConsFromLastSession && !Settings.Default.NoReconnect)
+ actions.Add(new PreviousSessionOpener(_connectionInitiator));
+
+ olvConnections.PostSetupActions = actions;
}
- private void RefreshTreeObject(ConnectionInfo modelObject)
+ private void SetConnectionTreeDoubleClickHandlers()
{
- olvConnections.RefreshObject(modelObject);
+ var doubleClickHandler = new TreeNodeCompositeClickHandler
+ {
+ ClickHandlers = new ITreeNodeClickHandler[]
+ {
+ new ExpandNodeClickHandler(olvConnections),
+ new OpenConnectionClickHandler(_connectionInitiator)
+ }
+ };
+ olvConnections.DoubleClickHandler = doubleClickHandler;
}
- private void RefreshTreeObjects(IList modelObjects)
- {
- olvConnections.RefreshObjects(modelObjects);
- }
+ private void SetConnectionTreeSingleClickHandlers()
+ {
+ var handlers = new List();
+ if (Settings.Default.SingleClickOnConnectionOpensIt)
+ handlers.Add(new OpenConnectionClickHandler(_connectionInitiator));
+ if (Settings.Default.SingleClickSwitchesToOpenConnection)
+ handlers.Add(new SwitchToConnectionClickHandler(_connectionInitiator));
+ var singleClickHandler = new TreeNodeCompositeClickHandler {ClickHandlers = handlers};
+ olvConnections.SingleClickHandler = singleClickHandler;
+ }
+ #endregion
+
+ #region Top Menu
+ private void SetMenuEventHandlers()
+ {
+ mMenViewExpandAllFolders.Click += (sender, args) => olvConnections.ExpandAll();
+ mMenViewCollapseAllFolders.Click += (sender, args) =>
+ {
+ olvConnections.CollapseAll();
+ olvConnections.Expand(olvConnections.GetRootConnectionNode());
+ };
+ mMenSortAscending.Click += (sender, args) => SortNodesRecursive(olvConnections.GetRootConnectionNode(), ListSortDirection.Ascending);
+ }
#endregion
#region Tree Context Menu
private void cMenTreeAddConnection_Click(object sender, EventArgs e)
{
- AddConnection();
+ olvConnections.AddConnection();
Runtime.SaveConnectionsAsync();
}
private void cMenTreeAddFolder_Click(object sender, EventArgs e)
{
- AddFolder();
+ olvConnections.AddFolder();
Runtime.SaveConnectionsAsync();
}
private void SortNodesRecursive(ConnectionInfo sortTarget, ListSortDirection sortDirection)
{
if (sortTarget == null)
- sortTarget = GetRootConnectionNode();
+ sortTarget = olvConnections.GetRootConnectionNode();
var sortTargetAsContainer = sortTarget as ContainerInfo;
if (sortTargetAsContainer != null)
@@ -546,115 +172,25 @@ namespace mRemoteNG.UI.Window
Runtime.SaveConnectionsAsync();
}
- private void cMenTreeMoveUp_Click(object sender, EventArgs e)
- {
- SelectedNode.Parent.PromoteChild(SelectedNode);
- Runtime.SaveConnectionsAsync();
- }
-
- private void cMenTreeMoveDown_Click(object sender, EventArgs e)
- {
- SelectedNode.Parent.DemoteChild(SelectedNode);
- Runtime.SaveConnectionsAsync();
- }
- #endregion
-
- #region Context Menu Actions
- public void AddConnection()
- {
- try
- {
- AddNode(new ConnectionInfo());
- }
- catch (Exception ex)
- {
- Runtime.MessageCollector.AddExceptionStackTrace("UI.Window.Tree.AddConnection() failed.", ex);
- }
- }
-
- public void AddFolder()
- {
- try
- {
- AddNode(new ContainerInfo());
- }
- catch (Exception ex)
- {
- Runtime.MessageCollector.AddExceptionStackTrace(Language.strErrorAddFolderFailed, ex);
- }
- }
-
- private void AddNode(ConnectionInfo newNode)
- {
- if (SelectedNode == null) return;
- DefaultConnectionInfo.Instance.SaveTo(newNode);
- DefaultConnectionInheritance.Instance.SaveTo(newNode.Inheritance);
- var selectedContainer = SelectedNode as ContainerInfo;
- var parent = selectedContainer ?? SelectedNode?.Parent;
- newNode.SetParent(parent);
- olvConnections.Expand(parent);
- olvConnections.SelectObject(newNode);
- olvConnections.EnsureModelVisible(newNode);
+ private void tvConnections_BeforeLabelEdit(object sender, LabelEditEventArgs e)
+ {
+ _contextMenu.DisableShortcutKeys();
}
- private void DisconnectConnection(ConnectionInfo connectionInfo)
- {
- try
- {
- if (connectionInfo == null) return;
- var nodeAsContainer = connectionInfo as ContainerInfo;
- if (nodeAsContainer != null)
- {
- foreach (var child in nodeAsContainer.Children)
- {
- for (var i = 0; i <= child.OpenConnections.Count - 1; i++)
- {
- child.OpenConnections[i].Disconnect();
- }
- }
- }
- else
- {
- for (var i = 0; i <= connectionInfo.OpenConnections.Count - 1; i++)
- {
- connectionInfo.OpenConnections[i].Disconnect();
- }
- }
- }
- catch (Exception ex)
- {
- Runtime.MessageCollector.AddExceptionStackTrace("DisconnectConnection (UI.Window.ConnectionTreeWindow) failed", ex);
- }
- }
-
- private void SshTransferFile()
- {
- try
- {
- Windows.Show(WindowType.SSHTransfer);
- Windows.SshtransferForm.Hostname = SelectedNode.Hostname;
- Windows.SshtransferForm.Username = SelectedNode.Username;
- Windows.SshtransferForm.Password = SelectedNode.Password;
- Windows.SshtransferForm.Port = Convert.ToString(SelectedNode.Port);
- }
- catch (Exception ex)
- {
- Runtime.MessageCollector.AddExceptionStackTrace("SSHTransferFile (UI.Window.ConnectionTreeWindow) failed", ex);
- }
- }
-
- private void StartExternalApp(ExternalTool externalTool)
- {
- try
- {
- if (SelectedNode.GetTreeNodeType() == TreeNodeType.Connection | SelectedNode.GetTreeNodeType() == TreeNodeType.PuttySession)
- externalTool.Start(SelectedNode);
- }
- catch (Exception ex)
- {
- Runtime.MessageCollector.AddExceptionStackTrace("cMenTreeToolsExternalAppsEntry_Click failed (UI.Window.ConnectionTreeWindow)", ex);
- }
- }
+ private void tvConnections_AfterLabelEdit(object sender, LabelEditEventArgs e)
+ {
+ try
+ {
+ _contextMenu.EnableShortcutKeys();
+ ConnectionTree.ConnectionTreeModel.RenameNode(SelectedNode, e.Label);
+ Windows.ConfigForm.SelectedTreeNode = SelectedNode;
+ Runtime.SaveConnectionsAsync();
+ }
+ catch (Exception ex)
+ {
+ Runtime.MessageCollector.AddExceptionStackTrace("tvConnections_AfterLabelEdit (UI.Window.ConnectionTreeWindow) failed", ex);
+ }
+ }
#endregion
#region Search
@@ -683,13 +219,13 @@ namespace mRemoteNG.UI.Window
}
else if (e.KeyCode == Keys.Up)
{
- var match = _nodeSearcher.PreviousMatch();
+ var match = olvConnections.NodeSearcher.PreviousMatch();
JumpToNode(match);
e.Handled = true;
}
else if (e.KeyCode == Keys.Down)
{
- var match = _nodeSearcher.NextMatch();
+ var match = olvConnections.NodeSearcher.NextMatch();
JumpToNode(match);
e.Handled = true;
}
@@ -707,8 +243,8 @@ namespace mRemoteNG.UI.Window
private void txtSearch_TextChanged(object sender, EventArgs e)
{
if (txtSearch.Text == "") return;
- _nodeSearcher?.SearchByName(txtSearch.Text);
- JumpToNode(_nodeSearcher?.CurrentMatch);
+ olvConnections.NodeSearcher?.SearchByName(txtSearch.Text);
+ JumpToNode(olvConnections.NodeSearcher?.CurrentMatch);
}
private void JumpToNode(ConnectionInfo connectionInfo)
@@ -755,7 +291,7 @@ namespace mRemoteNG.UI.Window
if (e.KeyCode == Keys.Enter)
{
e.Handled = true;
- ConnectionInitiator.OpenConnection(SelectedNode);
+ _connectionInitiator.OpenConnection(SelectedNode);
}
else if (e.Control && e.KeyCode == Keys.F)
{
diff --git a/mRemoteV1/UI/Window/ConnectionTreeWindow.resx b/mRemoteV1/UI/Window/ConnectionTreeWindow.resx
index dfeabba7a..584bd6853 100644
--- a/mRemoteV1/UI/Window/ConnectionTreeWindow.resx
+++ b/mRemoteV1/UI/Window/ConnectionTreeWindow.resx
@@ -117,9 +117,6 @@
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
- 17, 17
-
119, 19
diff --git a/mRemoteV1/UI/Window/ConnectionWindow.cs b/mRemoteV1/UI/Window/ConnectionWindow.cs
index 4c8c12b3d..c4e04f289 100644
--- a/mRemoteV1/UI/Window/ConnectionWindow.cs
+++ b/mRemoteV1/UI/Window/ConnectionWindow.cs
@@ -15,7 +15,6 @@ using mRemoteNG.UI.Forms;
using mRemoteNG.UI.TaskDialog;
using mRemoteNG.App.Info;
using mRemoteNG.Container;
-using mRemoteNG.Messages;
using mRemoteNG.Tools;
using mRemoteNG.UI.Forms.Input;
using Message = System.Windows.Forms.Message;
@@ -28,7 +27,8 @@ namespace mRemoteNG.UI.Window
public partial class ConnectionWindow : BaseWindow
{
public TabControl TabController;
-
+ private readonly IConnectionInitiator _connectionInitiator = new ConnectionInitiator();
+
#region Public Methods
public ConnectionWindow(DockContent panel, string formText = "")
@@ -144,7 +144,7 @@ namespace mRemoteNG.UI.Window
}
catch (Exception ex)
{
- Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg, "AddConnectionTab (UI.Window.ConnectionWindow) failed" + Environment.NewLine + ex.Message, true);
+ Runtime.MessageCollector.AddExceptionMessage("AddConnectionTab (UI.Window.ConnectionWindow) failed", ex);
}
return null;
@@ -223,8 +223,8 @@ namespace mRemoteNG.UI.Window
private void Connection_FormClosing(object sender, FormClosingEventArgs e)
{
if (!frmMain.Default.IsClosing &&
- ((Settings.Default.ConfirmCloseConnection == (int)ConfirmCloseEnum.All & TabController.TabPages.Count > 0) ||
- (Settings.Default.ConfirmCloseConnection == (int)ConfirmCloseEnum.Multiple & TabController.TabPages.Count > 1)))
+ (Settings.Default.ConfirmCloseConnection == (int)ConfirmCloseEnum.All & TabController.TabPages.Count > 0 ||
+ Settings.Default.ConfirmCloseConnection == (int)ConfirmCloseEnum.Multiple & TabController.TabPages.Count > 1))
{
var result = CTaskDialog.MessageBox(this, GeneralAppInfo.ProductName, string.Format(Language.strConfirmCloseConnectionPanelMainInstruction, Text), "", "", "", Language.strCheckboxDoNotShowThisMessageAgain, ETaskDialogButtons.YesNo, ESysIcons.Question, ESysIcons.Question);
if (CTaskDialog.VerificationChecked)
@@ -249,7 +249,7 @@ namespace mRemoteNG.UI.Window
}
catch (Exception ex)
{
- Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg, "UI.Window.Connection.Connection_FormClosing() failed" + Environment.NewLine + ex.Message, true);
+ Runtime.MessageCollector.AddExceptionMessage("UI.Window.Connection.Connection_FormClosing() failed", ex);
}
}
@@ -308,7 +308,7 @@ namespace mRemoteNG.UI.Window
}
catch (Exception ex)
{
- Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg, "UI.Window.Connection.CloseConnectionTab() failed" + Environment.NewLine + ex.Message, true);
+ Runtime.MessageCollector.AddExceptionMessage("UI.Window.Connection.CloseConnectionTab() failed", ex);
}
UpdateSelectedConnection();
@@ -334,9 +334,9 @@ namespace mRemoteNG.UI.Window
var modelAsContainer = model as ContainerInfo;
var modelAsConnection = model as ConnectionInfo;
if (modelAsContainer != null)
- ConnectionInitiator.OpenConnection(modelAsContainer);
+ _connectionInitiator.OpenConnection(modelAsContainer);
else if (modelAsConnection != null)
- ConnectionInitiator.OpenConnection(modelAsConnection);
+ _connectionInitiator.OpenConnection(modelAsConnection);
}
}
@@ -413,7 +413,7 @@ namespace mRemoteNG.UI.Window
}
catch (Exception ex)
{
- Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg, "ShowHideMenuButtons (UI.Window.ConnectionWindow) failed" + Environment.NewLine + ex.Message, true);
+ Runtime.MessageCollector.AddExceptionMessage("ShowHideMenuButtons (UI.Window.ConnectionWindow) failed", ex);
}
}
#endregion
@@ -440,7 +440,7 @@ namespace mRemoteNG.UI.Window
}
catch (Exception ex)
{
- Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg, "ToggleSmartSize (UI.Window.ConnectionWindow) failed" + Environment.NewLine + ex.Message, true);
+ Runtime.MessageCollector.AddExceptionMessage("ToggleSmartSize (UI.Window.ConnectionWindow) failed", ex);
}
}
@@ -458,7 +458,7 @@ namespace mRemoteNG.UI.Window
}
catch (Exception ex)
{
- Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg, "TransferFile (UI.Window.ConnectionWindow) failed" + Environment.NewLine + ex.Message, true);
+ Runtime.MessageCollector.AddExceptionMessage("TransferFile (UI.Window.ConnectionWindow) failed", ex);
}
}
@@ -479,7 +479,7 @@ namespace mRemoteNG.UI.Window
}
catch (Exception ex)
{
- Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg, "SSHTransferFile (UI.Window.ConnectionWindow) failed" + Environment.NewLine + ex.Message, true);
+ Runtime.MessageCollector.AddExceptionMessage("SSHTransferFile (UI.Window.ConnectionWindow) failed", ex);
}
}
@@ -493,7 +493,7 @@ namespace mRemoteNG.UI.Window
}
catch (Exception ex)
{
- Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg, "VNCTransferFile (UI.Window.ConnectionWindow) failed" + Environment.NewLine + ex.Message, true);
+ Runtime.MessageCollector.AddExceptionMessage("VNCTransferFile (UI.Window.ConnectionWindow) failed", ex);
}
}
@@ -509,7 +509,7 @@ namespace mRemoteNG.UI.Window
}
catch (Exception ex)
{
- Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg, "ToggleViewOnly (UI.Window.ConnectionWindow) failed" + Environment.NewLine + ex.Message, true);
+ Runtime.MessageCollector.AddExceptionMessage("ToggleViewOnly (UI.Window.ConnectionWindow) failed", ex);
}
}
@@ -523,7 +523,7 @@ namespace mRemoteNG.UI.Window
}
catch (Exception ex)
{
- Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg, "StartChat (UI.Window.ConnectionWindow) failed" + Environment.NewLine + ex.Message, true);
+ Runtime.MessageCollector.AddExceptionMessage("StartChat (UI.Window.ConnectionWindow) failed", ex);
}
}
@@ -537,7 +537,7 @@ namespace mRemoteNG.UI.Window
}
catch (Exception ex)
{
- Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg, "RefreshScreen (UI.Window.ConnectionWindow) failed" + Environment.NewLine + ex.Message, true);
+ Runtime.MessageCollector.AddExceptionMessage("RefreshScreen (UI.Window.ConnectionWindow) failed", ex);
}
}
@@ -551,7 +551,7 @@ namespace mRemoteNG.UI.Window
}
catch (Exception ex)
{
- Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg, "SendSpecialKeys (UI.Window.ConnectionWindow) failed" + Environment.NewLine + ex.Message, true);
+ Runtime.MessageCollector.AddExceptionMessage("SendSpecialKeys (UI.Window.ConnectionWindow) failed", ex);
}
}
@@ -565,7 +565,7 @@ namespace mRemoteNG.UI.Window
}
catch (Exception ex)
{
- Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg, "ToggleFullscreen (UI.Window.ConnectionWindow) failed" + Environment.NewLine + ex.Message, true);
+ Runtime.MessageCollector.AddExceptionMessage("ToggleFullscreen (UI.Window.ConnectionWindow) failed", ex);
}
}
@@ -579,7 +579,7 @@ namespace mRemoteNG.UI.Window
}
catch (Exception ex)
{
- Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg, "ShowPuttySettingsDialog (UI.Window.ConnectionWindow) failed" + Environment.NewLine + ex.Message, true);
+ Runtime.MessageCollector.AddExceptionMessage("ShowPuttySettingsDialog (UI.Window.ConnectionWindow) failed", ex);
}
}
@@ -627,7 +627,7 @@ namespace mRemoteNG.UI.Window
}
catch (Exception ex)
{
- Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg, "cmenTabExternalAppsEntry_Click failed (UI.Window.ConnectionWindow)" + Environment.NewLine + ex.Message, true);
+ Runtime.MessageCollector.AddExceptionMessage("cmenTabExternalAppsEntry_Click failed (UI.Window.ConnectionWindow)", ex);
}
}
@@ -640,7 +640,7 @@ namespace mRemoteNG.UI.Window
}
catch (Exception ex)
{
- Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg, "CloseTabMenu (UI.Window.ConnectionWindow) failed" + Environment.NewLine + ex.Message, true);
+ Runtime.MessageCollector.AddExceptionMessage("CloseTabMenu (UI.Window.ConnectionWindow) failed", ex);
}
}
@@ -650,12 +650,12 @@ namespace mRemoteNG.UI.Window
{
var interfaceControl = TabController.SelectedTab?.Tag as InterfaceControl;
if (interfaceControl == null) return;
- ConnectionInitiator.OpenConnection(interfaceControl.Info, ConnectionInfo.Force.DoNotJump);
+ _connectionInitiator.OpenConnection(interfaceControl.Info, ConnectionInfo.Force.DoNotJump);
_ignoreChangeSelectedTabClick = false;
}
catch (Exception ex)
{
- Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg, "DuplicateTab (UI.Window.ConnectionWindow) failed" + Environment.NewLine + ex.Message, true);
+ Runtime.MessageCollector.AddExceptionMessage("DuplicateTab (UI.Window.ConnectionWindow) failed", ex);
}
}
@@ -666,11 +666,11 @@ namespace mRemoteNG.UI.Window
var interfaceControl = TabController.SelectedTab?.Tag as InterfaceControl;
if (interfaceControl == null) return;
interfaceControl.Protocol.Close();
- ConnectionInitiator.OpenConnection(interfaceControl.Info, ConnectionInfo.Force.DoNotJump);
+ _connectionInitiator.OpenConnection(interfaceControl.Info, ConnectionInfo.Force.DoNotJump);
}
catch (Exception ex)
{
- Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg, "Reconnect (UI.Window.ConnectionWindow) failed" + Environment.NewLine + ex.Message, true);
+ Runtime.MessageCollector.AddExceptionMessage("Reconnect (UI.Window.ConnectionWindow) failed", ex);
}
}
@@ -678,13 +678,13 @@ namespace mRemoteNG.UI.Window
{
try
{
- var newTitle = "";
+ var newTitle = TabController.SelectedTab.Title;
if (input.InputBox(Language.strNewTitle, Language.strNewTitle + ":", ref newTitle) == DialogResult.OK && !string.IsNullOrEmpty(newTitle))
TabController.SelectedTab.Title = newTitle.Replace("&", "&&");
}
catch (Exception ex)
{
- Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg, "RenameTab (UI.Window.ConnectionWindow) failed" + Environment.NewLine + ex.Message, true);
+ Runtime.MessageCollector.AddExceptionMessage("RenameTab (UI.Window.ConnectionWindow) failed", ex);
}
}
@@ -724,7 +724,7 @@ namespace mRemoteNG.UI.Window
}
catch (Exception ex)
{
- Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg, "Couldn\'t close tab" + Environment.NewLine + ex.Message, true);
+ Runtime.MessageCollector.AddExceptionMessage("Couldn't close tab", ex);
}
}
else
@@ -740,7 +740,7 @@ namespace mRemoteNG.UI.Window
}
catch (Exception ex)
{
- Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg, "Couldn\'t close tab" + Environment.NewLine + ex.Message, true);
+ Runtime.MessageCollector.AddExceptionMessage("Couldn't close tab", ex);
}
if (TabController.TabPages.Count == 0)
@@ -784,7 +784,7 @@ namespace mRemoteNG.UI.Window
if (elapsedTicks > SystemInformation.DoubleClickTime || !_doubleClickRectangle.Contains(MousePosition))
{
_firstClickTicks = currentTicks;
- _doubleClickRectangle = new Rectangle(MousePosition.X - (SystemInformation.DoubleClickSize.Width / 2), MousePosition.Y - (SystemInformation.DoubleClickSize.Height / 2), SystemInformation.DoubleClickSize.Width, SystemInformation.DoubleClickSize.Height);
+ _doubleClickRectangle = new Rectangle(MousePosition.X - SystemInformation.DoubleClickSize.Width / 2, MousePosition.Y - SystemInformation.DoubleClickSize.Height / 2, SystemInformation.DoubleClickSize.Width, SystemInformation.DoubleClickSize.Height);
FocusInterfaceController();
}
else
@@ -805,7 +805,7 @@ namespace mRemoteNG.UI.Window
}
catch (Exception ex)
{
- Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg, "TabController_MouseUp (UI.Window.ConnectionWindow) failed" + Environment.NewLine + ex.Message, true);
+ Runtime.MessageCollector.AddExceptionMessage("TabController_MouseUp (UI.Window.ConnectionWindow) failed", ex);
}
}
@@ -818,7 +818,7 @@ namespace mRemoteNG.UI.Window
}
catch (Exception ex)
{
- Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg, "FocusIC (UI.Window.ConnectionWindow) failed" + Environment.NewLine + ex.Message, true);
+ Runtime.MessageCollector.AddExceptionMessage("FocusIC (UI.Window.ConnectionWindow) failed", ex);
}
}
@@ -832,7 +832,7 @@ namespace mRemoteNG.UI.Window
}
catch (Exception ex)
{
- Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg, "RefreshIC (UI.Window.Connection) failed" + Environment.NewLine + ex.Message, true);
+ Runtime.MessageCollector.AddExceptionMessage("RefreshIC (UI.Window.Connection) failed", ex);
}
}
#endregion
@@ -862,7 +862,7 @@ namespace mRemoteNG.UI.Window
}
catch (Exception ex)
{
- Runtime.MessageCollector.AddExceptionMessage(message: "UI.Window.Connection.WndProc() failed.", ex: ex, logOnly: true);
+ Runtime.MessageCollector.AddExceptionMessage("UI.Window.Connection.WndProc() failed.", ex);
}
base.WndProc(ref m);
diff --git a/mRemoteV1/UI/Window/PortScanWindow.cs b/mRemoteV1/UI/Window/PortScanWindow.cs
index 073bebb5c..10ea61c4d 100644
--- a/mRemoteV1/UI/Window/PortScanWindow.cs
+++ b/mRemoteV1/UI/Window/PortScanWindow.cs
@@ -211,7 +211,7 @@ namespace mRemoteNG.UI.Window
if (InvokeRequired)
{
Invoke(new PortScannerHostScannedDelegate(PortScanner_HostScanned), new object[] {host, scannedCount, totalCount});
- return ;
+ return;
}
Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg, "Host scanned " + host.HostIp, true);
@@ -233,7 +233,7 @@ namespace mRemoteNG.UI.Window
if (InvokeRequired)
{
Invoke(new PortScannerScanComplete(PortScanner_ScanComplete), new object[] {hosts});
- return ;
+ return;
}
Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg, Language.strPortScanComplete);
diff --git a/mRemoteV1/UI/Window/UpdateWindow.cs b/mRemoteV1/UI/Window/UpdateWindow.cs
index 55489483b..31027bc18 100644
--- a/mRemoteV1/UI/Window/UpdateWindow.cs
+++ b/mRemoteV1/UI/Window/UpdateWindow.cs
@@ -6,6 +6,7 @@ using System.Net;
using System.Windows.Forms;
using mRemoteNG.App;
using mRemoteNG.App.Update;
+using mRemoteNG.Messages;
using WeifenLuo.WinFormsUI.Docking;
#if !PORTABLE
@@ -163,17 +164,13 @@ namespace mRemoteNG.UI.Window
{
lblStatus.Text = Language.strNoUpdateAvailable;
lblStatus.ForeColor = Color.ForestGreen;
-
- if (_appUpdate.CurrentUpdateInfo != null)
- {
- var updateInfo = _appUpdate.CurrentUpdateInfo;
- if (updateInfo.IsValid && updateInfo.Version != null)
- {
- lblLatestVersion.Text = updateInfo.Version.ToString();
- lblLatestVersionLabel.Visible = true;
- lblLatestVersion.Visible = true;
- }
- }
+
+ if (_appUpdate.CurrentUpdateInfo == null) return;
+ var updateInfo = _appUpdate.CurrentUpdateInfo;
+ if (!updateInfo.IsValid || updateInfo.Version == null) return;
+ lblLatestVersion.Text = updateInfo.Version.ToString();
+ lblLatestVersionLabel.Visible = true;
+ lblLatestVersion.Visible = true;
}
}
catch (Exception ex)
@@ -181,7 +178,7 @@ namespace mRemoteNG.UI.Window
lblStatus.Text = Language.strUpdateCheckFailedLabel;
lblStatus.ForeColor = Color.OrangeRed;
- Runtime.MessageCollector.AddExceptionMessage(Language.strUpdateCheckCompleteFailed, ex);
+ Runtime.MessageCollector.AddExceptionStackTrace(Language.strUpdateCheckCompleteFailed, ex);
}
}
@@ -207,7 +204,7 @@ namespace mRemoteNG.UI.Window
}
catch (Exception ex)
{
- Runtime.MessageCollector.AddExceptionMessage(Language.strUpdateGetChangeLogFailed, ex);
+ Runtime.MessageCollector.AddExceptionStackTrace(Language.strUpdateGetChangeLogFailed, ex);
}
}
@@ -230,7 +227,7 @@ namespace mRemoteNG.UI.Window
}
catch (Exception ex)
{
- Runtime.MessageCollector.AddExceptionMessage(Language.strUpdateDownloadFailed, ex);
+ Runtime.MessageCollector.AddExceptionStackTrace(Language.strUpdateDownloadFailed, ex);
}
}
#endregion
@@ -267,8 +264,9 @@ namespace mRemoteNG.UI.Window
}
catch (Exception ex)
{
- Runtime.MessageCollector.AddExceptionMessage(Language.strUpdateDownloadCompleteFailed, ex);
- }
+ Runtime.MessageCollector.AddExceptionStackTrace(Language.strUpdateDownloadCompleteFailed, ex);
+ Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg, ex.Message);
+ }
}
#endregion
}
diff --git a/mRemoteV1/app.config b/mRemoteV1/app.config
index 9f5783443..41ac45650 100644
--- a/mRemoteV1/app.config
+++ b/mRemoteV1/app.config
@@ -415,6 +415,18 @@
False
+
+ 0
+
+
+ False
+
+
+ False
+
+
+ False
+
5500
@@ -544,6 +556,9 @@
False
+
+ release
+
@@ -601,6 +616,18 @@
False
+
+ 0
+
+
+ False
+
+
+ False
+
+
+ False
+
@@ -608,9 +635,6 @@
de,el,en,en-US,es-AR,es,fr,hu,it,ja-JP,nb-NO,nl,pt,pt-BR,pl,ru,uk,tr-TR,zh-CN,zh-TW
-
- release
-
https://mremoteng.org/
diff --git a/mRemoteV1/mRemoteV1.csproj b/mRemoteV1/mRemoteV1.csproj
index 65fb2a1b5..fb3569c37 100644
--- a/mRemoteV1/mRemoteV1.csproj
+++ b/mRemoteV1/mRemoteV1.csproj
@@ -187,6 +187,7 @@
+
@@ -209,17 +210,34 @@
+
+
+
+
+
+
-
+
+
+
+
+
+
Component
+
+ Component
+
+
+ ConnectionTree.cs
+
Component
@@ -227,12 +245,18 @@
FilteredPropertyGrid.cs
+
UserControl
+
+
+ Component
+
Component
+
Component
@@ -389,8 +413,6 @@
UserControl
-
-
@@ -763,6 +785,15 @@
PreserveNewest
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
PreserveNewest
diff --git a/mRemoteV1/mRemoteV1.csproj.DotSettings b/mRemoteV1/mRemoteV1.csproj.DotSettings
new file mode 100644
index 000000000..07f70d627
--- /dev/null
+++ b/mRemoteV1/mRemoteV1.csproj.DotSettings
@@ -0,0 +1,3 @@
+
+ True
+ True
\ No newline at end of file