mirror of
https://github.com/mRemoteNG/mRemoteNG.git
synced 2026-02-26 03:58:45 +08:00
more syntax fixing
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -59,3 +59,11 @@ C:\Users\vsparda\Documents\Repositories\mRemoteNG_MyFork\mRemoteV1.ConvertedToC#
|
||||
C:\Users\vsparda\Documents\Repositories\mRemoteNG_MyFork\mRemoteV1.ConvertedToC#\obj\Debug Portable\mRemoteNG.Language.Language.zh-TW.resources
|
||||
C:\Users\vsparda\Documents\Repositories\mRemoteNG_MyFork\mRemoteV1.ConvertedToC#\obj\Debug Portable\mRemoteV1.Converted.csproj.GenerateResource.Cache
|
||||
C:\Users\vsparda\Documents\Repositories\mRemoteNG_MyFork\mRemoteV1.ConvertedToC#\obj\Debug Portable\mRemoteNG.Properties.Resources.resources
|
||||
C:\Users\David\Documents\Repositories\mRemoteNG_MyFork\mRemoteV1.ConvertedToC#\bin\Debug Portable\mRemoteNG.exe.config
|
||||
C:\Users\David\Documents\Repositories\mRemoteNG_MyFork\mRemoteV1.ConvertedToC#\obj\Debug Portable\Interop.EOLWTSCOM.dll
|
||||
C:\Users\David\Documents\Repositories\mRemoteNG_MyFork\mRemoteV1.ConvertedToC#\obj\Debug Portable\Interop.MSTSCLib.dll
|
||||
C:\Users\David\Documents\Repositories\mRemoteNG_MyFork\mRemoteV1.ConvertedToC#\obj\Debug Portable\Interop.SHDocVw.dll
|
||||
C:\Users\David\Documents\Repositories\mRemoteNG_MyFork\mRemoteV1.ConvertedToC#\obj\Debug Portable\Interop.WFICALib.dll
|
||||
C:\Users\David\Documents\Repositories\mRemoteNG_MyFork\mRemoteV1.ConvertedToC#\obj\Debug Portable\AxInterop.MSTSCLib.dll
|
||||
C:\Users\David\Documents\Repositories\mRemoteNG_MyFork\mRemoteV1.ConvertedToC#\obj\Debug Portable\AxInterop.WFICALib.dll
|
||||
C:\Users\David\Documents\Repositories\mRemoteNG_MyFork\mRemoteV1.ConvertedToC#\obj\Debug Portable\mRemoteV1.Converted.csproj.ResolveComReference.cache
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -26,6 +26,7 @@ using System.Xml;
|
||||
//using System.Environment;
|
||||
using System.Management;
|
||||
using Microsoft.Win32;
|
||||
using mRemoteNG.Connection.Protocol;
|
||||
//using Timer = System.Timers.Timer;
|
||||
|
||||
|
||||
@@ -1679,7 +1680,7 @@ namespace mRemoteNG.App
|
||||
#endregion
|
||||
|
||||
#region Opening Connection
|
||||
public static Connection.Info CreateQuickConnect(string connectionString, Protocol.Protocols protocol)
|
||||
public static Connection.Info CreateQuickConnect(string connectionString, Protocols protocol)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -1842,46 +1843,46 @@ namespace mRemoteNG.App
|
||||
}
|
||||
}
|
||||
|
||||
Protocol.Base newProtocol = default(Protocol.Base);
|
||||
Base newProtocol = default(Base);
|
||||
// Create connection based on protocol type
|
||||
switch (newConnectionInfo.Protocol)
|
||||
{
|
||||
case Protocol.Protocols.RDP:
|
||||
newProtocol = new Protocol.RDP();
|
||||
case Protocols.RDP:
|
||||
newProtocol = new RDP();
|
||||
((RDP) newProtocol).tmrReconnect.Elapsed += ((RDP) newProtocol).tmrReconnect_Elapsed;
|
||||
((RDP) newProtocol).tmrReconnect.Elapsed += ((RDP) newProtocol).tmrReconnect_Elapsed;
|
||||
break;
|
||||
case Protocol.Protocols.VNC:
|
||||
newProtocol = new Protocol.VNC();
|
||||
case Protocols.VNC:
|
||||
newProtocol = new VNC();
|
||||
break;
|
||||
case Protocol.Protocols.SSH1:
|
||||
newProtocol = new Protocol.SSH1();
|
||||
case Protocols.SSH1:
|
||||
newProtocol = new SSH1();
|
||||
break;
|
||||
case Protocol.Protocols.SSH2:
|
||||
newProtocol = new Protocol.SSH2();
|
||||
case Protocols.SSH2:
|
||||
newProtocol = new SSH2();
|
||||
break;
|
||||
case Protocol.Protocols.Telnet:
|
||||
newProtocol = new Protocol.Telnet();
|
||||
case Protocols.Telnet:
|
||||
newProtocol = new Telnet();
|
||||
break;
|
||||
case Protocol.Protocols.Rlogin:
|
||||
newProtocol = new Protocol.Rlogin();
|
||||
case Protocols.Rlogin:
|
||||
newProtocol = new Rlogin();
|
||||
break;
|
||||
case Protocol.Protocols.RAW:
|
||||
newProtocol = new Protocol.RAW();
|
||||
case Protocols.RAW:
|
||||
newProtocol = new RAW();
|
||||
break;
|
||||
case Protocol.Protocols.HTTP:
|
||||
newProtocol = new Protocol.HTTP(newConnectionInfo.RenderingEngine);
|
||||
case Protocols.HTTP:
|
||||
newProtocol = new HTTP(newConnectionInfo.RenderingEngine);
|
||||
break;
|
||||
case Protocol.Protocols.HTTPS:
|
||||
newProtocol = new Protocol.HTTPS(newConnectionInfo.RenderingEngine);
|
||||
case Protocols.HTTPS:
|
||||
newProtocol = new HTTPS(newConnectionInfo.RenderingEngine);
|
||||
break;
|
||||
case Protocol.Protocols.ICA:
|
||||
newProtocol = new Protocol.ICA();
|
||||
case Protocols.ICA:
|
||||
newProtocol = new ICA();
|
||||
((ICA) newProtocol).tmrReconnect.Elapsed += ((ICA) newProtocol).tmrReconnect_Elapsed;
|
||||
((ICA) newProtocol).tmrReconnect.Elapsed += ((ICA) newProtocol).tmrReconnect_Elapsed;
|
||||
break;
|
||||
case Protocol.Protocols.IntApp:
|
||||
newProtocol = new Protocol.IntegratedProgram();
|
||||
case Protocols.IntApp:
|
||||
newProtocol = new IntegratedProgram();
|
||||
|
||||
if (newConnectionInfo.ExtApp == "")
|
||||
{
|
||||
|
||||
@@ -12,6 +12,7 @@ using System.ComponentModel;
|
||||
using mRemoteNG.Config;
|
||||
using mRemoteNG.Tools;
|
||||
using System.Reflection;
|
||||
using mRemoteNG.App;
|
||||
|
||||
|
||||
namespace mRemoteNG.Connection
|
||||
@@ -658,10 +659,11 @@ namespace mRemoteNG.Connection
|
||||
#endregion
|
||||
#region Misc
|
||||
private string _preExtApp; // VBConversions Note: Initial value cannot be assigned here since it is non-static. Assignment has been moved to the class constructors.
|
||||
[LocalizedCategory("strCategoryMiscellaneous", 7),
|
||||
LocalizedDisplayName("strPropertyNameExternalToolBefore"),
|
||||
LocalizedDescription("strPropertyDescriptionExternalToolBefore"),
|
||||
TypeConverter(typeof(Tools.ExternalToolsTypeConverter))]public virtual string PreExtApp
|
||||
[LocalizedAttributes.LocalizedCategory("strCategoryMiscellaneous", 7),
|
||||
LocalizedAttributes.LocalizedDisplayName("strPropertyNameExternalToolBefore"),
|
||||
LocalizedAttributes.LocalizedDescription("strPropertyDescriptionExternalToolBefore"),
|
||||
TypeConverter(typeof(Tools.ExternalToolsTypeConverter))]
|
||||
public virtual string PreExtApp
|
||||
{
|
||||
get
|
||||
{
|
||||
@@ -674,10 +676,11 @@ TypeConverter(typeof(Tools.ExternalToolsTypeConverter))]public virtual string Pr
|
||||
}
|
||||
|
||||
private string _postExtApp; // VBConversions Note: Initial value cannot be assigned here since it is non-static. Assignment has been moved to the class constructors.
|
||||
[LocalizedCategory("strCategoryMiscellaneous", 7),
|
||||
LocalizedDisplayName("strPropertyNameExternalToolAfter"),
|
||||
LocalizedDescription("strPropertyDescriptionExternalToolAfter"),
|
||||
TypeConverter(typeof(Tools.ExternalToolsTypeConverter))]public virtual string PostExtApp
|
||||
[LocalizedAttributes.LocalizedCategory("strCategoryMiscellaneous", 7),
|
||||
LocalizedAttributes.LocalizedDisplayName("strPropertyNameExternalToolAfter"),
|
||||
LocalizedAttributes.LocalizedDescription("strPropertyDescriptionExternalToolAfter"),
|
||||
TypeConverter(typeof(Tools.ExternalToolsTypeConverter))]
|
||||
public virtual string PostExtApp
|
||||
{
|
||||
get
|
||||
{
|
||||
@@ -690,9 +693,10 @@ TypeConverter(typeof(Tools.ExternalToolsTypeConverter))]public virtual string Po
|
||||
}
|
||||
|
||||
private string _macAddress; // VBConversions Note: Initial value cannot be assigned here since it is non-static. Assignment has been moved to the class constructors.
|
||||
[LocalizedCategory("strCategoryMiscellaneous", 7),
|
||||
LocalizedDisplayName("strPropertyNameMACAddress"),
|
||||
LocalizedDescription("strPropertyDescriptionMACAddress")]public virtual string MacAddress
|
||||
[LocalizedAttributes.LocalizedCategory("strCategoryMiscellaneous", 7),
|
||||
LocalizedAttributes.LocalizedDisplayName("strPropertyNameMACAddress"),
|
||||
LocalizedAttributes.LocalizedDescription("strPropertyDescriptionMACAddress")]
|
||||
public virtual string MacAddress
|
||||
{
|
||||
get
|
||||
{
|
||||
@@ -705,9 +709,10 @@ LocalizedDescription("strPropertyDescriptionMACAddress")]public virtual string M
|
||||
}
|
||||
|
||||
private string _userField; // VBConversions Note: Initial value cannot be assigned here since it is non-static. Assignment has been moved to the class constructors.
|
||||
[LocalizedCategory("strCategoryMiscellaneous", 7),
|
||||
LocalizedDisplayName("strPropertyNameUser1"),
|
||||
LocalizedDescription("strPropertyDescriptionUser1")]public virtual string UserField
|
||||
[LocalizedAttributes.LocalizedCategory("strCategoryMiscellaneous", 7),
|
||||
LocalizedAttributes.LocalizedDisplayName("strPropertyNameUser1"),
|
||||
LocalizedAttributes.LocalizedDescription("strPropertyDescriptionUser1")]
|
||||
public virtual string UserField
|
||||
{
|
||||
get
|
||||
{
|
||||
@@ -1154,8 +1159,7 @@ LocalizedDescription("strPropertyDescriptionUser1")]public virtual string UserFi
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
mRemoteNG.Messages.Collector
|
||||
MessageCollector.AddExceptionMessage(My.Language.strConnectionSetDefaultPortFailed, ex, Messages.MessageClass.ErrorMsg);
|
||||
Runtime.MessageCollector.AddExceptionMessage(My.Language.strConnectionSetDefaultPortFailed, ex, Messages.MessageClass.ErrorMsg);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// VBConversions Note: VB project level imports
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using AxWFICALib;
|
||||
@@ -9,67 +8,59 @@ using AxMSTSCLib;
|
||||
using Microsoft.VisualBasic;
|
||||
using System.Collections;
|
||||
using System.Windows.Forms;
|
||||
// End of VB project level imports
|
||||
|
||||
//using mRemoteNG.App.Runtime;
|
||||
using mRemoteNG.App;
|
||||
|
||||
|
||||
namespace mRemoteNG
|
||||
namespace mRemoteNG.Connection
|
||||
{
|
||||
namespace Protocol
|
||||
public partial class InterfaceControl
|
||||
{
|
||||
public partial class InterfaceControl
|
||||
#region Properties
|
||||
private Connection.Protocol.Base _Protocol;
|
||||
public Connection.Protocol.Base Protocol
|
||||
{
|
||||
#region Properties
|
||||
private Connection.Protocol.Base _Protocol;
|
||||
public Connection.Protocol.Base Protocol
|
||||
get
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._Protocol;
|
||||
}
|
||||
set
|
||||
{
|
||||
this._Protocol = value;
|
||||
}
|
||||
return this._Protocol;
|
||||
}
|
||||
|
||||
private Info _Info;
|
||||
public Info Info
|
||||
set
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._Info;
|
||||
}
|
||||
set
|
||||
{
|
||||
this._Info = value;
|
||||
}
|
||||
this._Protocol = value;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
public InterfaceControl(Control Parent, Connection.Protocol.Base Protocol, Connection.Info Info)
|
||||
{
|
||||
try
|
||||
{
|
||||
this._Protocol = Protocol;
|
||||
this._Info = Info;
|
||||
this.Parent = Parent;
|
||||
this.Location = new Point(0, 0);
|
||||
this.Size = this.Parent.Size;
|
||||
this.Anchor = (System.Windows.Forms.AnchorStyles) (AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top);
|
||||
InitializeComponent();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, "Couldn\'t create new InterfaceControl" + Constants.vbNewLine + ex.Message);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
private Info _Info;
|
||||
public Info Info
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._Info;
|
||||
}
|
||||
set
|
||||
{
|
||||
this._Info = value;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
public InterfaceControl(Control Parent, Connection.Protocol.Base Protocol, Connection.Info Info)
|
||||
{
|
||||
try
|
||||
{
|
||||
this._Protocol = Protocol;
|
||||
this._Info = Info;
|
||||
this.Parent = Parent;
|
||||
this.Location = new Point(0, 0);
|
||||
this.Size = this.Parent.Size;
|
||||
this.Anchor = (System.Windows.Forms.AnchorStyles) (AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top);
|
||||
InitializeComponent();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, "Couldn\'t create new InterfaceControl" + Constants.vbNewLine + ex.Message);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// VBConversions Note: VB project level imports
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using AxWFICALib;
|
||||
@@ -9,127 +8,113 @@ using AxMSTSCLib;
|
||||
using Microsoft.VisualBasic;
|
||||
using System.Collections;
|
||||
using System.Windows.Forms;
|
||||
// End of VB project level imports
|
||||
|
||||
using System.ComponentModel;
|
||||
using mRemoteNG.Messages;
|
||||
//using mRemoteNG.Tools.LocalizedAttributes;
|
||||
using mRemoteNG.My;
|
||||
//using mRemoteNG.App.Runtime;
|
||||
using mRemoteNG.App;
|
||||
using mRemoteNG.Tools;
|
||||
|
||||
|
||||
namespace mRemoteNG.PuttySession
|
||||
namespace mRemoteNG.Connection.PuttySession
|
||||
{
|
||||
public class Info : Connection.Info, IComponent
|
||||
{
|
||||
#region Commands
|
||||
[Command(),LocalizedAttributes.LocalizedDisplayName("strPuttySessionSettings")]
|
||||
public void SessionSettings()
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
#region Commands
|
||||
[Command(),LocalizedAttributes.LocalizedDisplayName("strPuttySessionSettings")]
|
||||
public void SessionSettings()
|
||||
{
|
||||
try
|
||||
{
|
||||
PuttyProcessController puttyProcess = new PuttyProcessController();
|
||||
if (!puttyProcess.Start())
|
||||
{
|
||||
return ;
|
||||
}
|
||||
if (puttyProcess.SelectListBoxItem(PuttySession))
|
||||
{
|
||||
puttyProcess.ClickButton("&Load");
|
||||
}
|
||||
puttyProcess.SetControlText("Button", "&Cancel", "&Close");
|
||||
puttyProcess.SetControlVisible("Button", "&Open", false);
|
||||
puttyProcess.WaitForExit();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageCollector.AddMessage(MessageClass.ErrorMsg, Language.strErrorCouldNotLaunchPutty + Constants.vbNewLine + ex.Message, false);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
[Browsable(false)]public Root.PuttySessions.Info RootPuttySessionsInfo {get; set;}
|
||||
|
||||
[ReadOnly(true)]public override string PuttySession {get; set;}
|
||||
|
||||
[ReadOnly(true)]public override string
|
||||
Name {get; set;}
|
||||
|
||||
[ReadOnly(true),
|
||||
Browsable(false)]public override string Description {get; set;}
|
||||
|
||||
[ReadOnly(true), Browsable(false)]public override string Icon
|
||||
PuttyProcessController puttyProcess = new PuttyProcessController();
|
||||
if (!puttyProcess.Start())
|
||||
{
|
||||
get
|
||||
{
|
||||
return "PuTTY";
|
||||
}
|
||||
set
|
||||
{
|
||||
|
||||
}
|
||||
return ;
|
||||
}
|
||||
|
||||
[ReadOnly(true), Browsable(false)]public override string Panel
|
||||
if (puttyProcess.SelectListBoxItem(PuttySession))
|
||||
{
|
||||
get
|
||||
{
|
||||
return RootPuttySessionsInfo.Panel;
|
||||
}
|
||||
set
|
||||
{
|
||||
|
||||
}
|
||||
puttyProcess.ClickButton("&Load");
|
||||
}
|
||||
|
||||
[ReadOnly(true)]public override string Hostname {get; set;}
|
||||
|
||||
[ReadOnly(true)]public override string
|
||||
Username {get; set;}
|
||||
|
||||
[ReadOnly(true),
|
||||
Browsable(false)]public override string Password {get; set;}
|
||||
|
||||
[ReadOnly(true)]public override Protocol.Protocols Protocol {get; set;}
|
||||
|
||||
[ReadOnly(true)]public override int
|
||||
Port {get; set;}
|
||||
|
||||
[ReadOnly(true),
|
||||
Browsable(false)]public override string PreExtApp {get; set;}
|
||||
|
||||
[ReadOnly(true),
|
||||
Browsable(false)]public override string PostExtApp {get; set;}
|
||||
|
||||
[ReadOnly(true),
|
||||
Browsable(false)]public override string MacAddress {get; set;}
|
||||
|
||||
[ReadOnly(true), Browsable(false)]public override string UserField {get; set;}
|
||||
#endregion
|
||||
|
||||
#region IComponent
|
||||
[Browsable(false)]public ISite Site
|
||||
{
|
||||
get
|
||||
{
|
||||
return new PropertyGridCommandSite(this);
|
||||
}
|
||||
set
|
||||
{
|
||||
throw (new NotImplementedException());
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
if (Disposed != null)
|
||||
Disposed(this, EventArgs.Empty);
|
||||
}
|
||||
|
||||
public event EventHandler Disposed;
|
||||
#endregion
|
||||
puttyProcess.SetControlText("Button", "&Cancel", "&Close");
|
||||
puttyProcess.SetControlVisible("Button", "&Open", false);
|
||||
puttyProcess.WaitForExit();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg, Language.strErrorCouldNotLaunchPutty + Constants.vbNewLine + ex.Message, false);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
[Browsable(false)]
|
||||
public Root.PuttySessions.Info RootPuttySessionsInfo {get; set;}
|
||||
|
||||
[ReadOnly(true)]
|
||||
public override string PuttySession {get; set;}
|
||||
|
||||
[ReadOnly(true)]
|
||||
public override string Name {get; set;}
|
||||
|
||||
[ReadOnly(true), Browsable(false)]
|
||||
public override string Description {get; set;}
|
||||
|
||||
[ReadOnly(true), Browsable(false)]
|
||||
public override string Icon
|
||||
{
|
||||
get { return "PuTTY"; }
|
||||
set { }
|
||||
}
|
||||
|
||||
[ReadOnly(true), Browsable(false)]
|
||||
public override string Panel
|
||||
{
|
||||
get { return RootPuttySessionsInfo.Panel; }
|
||||
set { }
|
||||
}
|
||||
|
||||
[ReadOnly(true)]
|
||||
public override string Hostname {get; set;}
|
||||
|
||||
[ReadOnly(true)]
|
||||
public override string Username {get; set;}
|
||||
|
||||
[ReadOnly(true), Browsable(false)]
|
||||
public override string Password {get; set;}
|
||||
|
||||
[ReadOnly(true)]
|
||||
public override Protocol.Protocols Protocol {get; set;}
|
||||
|
||||
[ReadOnly(true)]
|
||||
public override int Port {get; set;}
|
||||
|
||||
[ReadOnly(true), Browsable(false)]
|
||||
public override string PreExtApp {get; set;}
|
||||
|
||||
[ReadOnly(true), Browsable(false)]
|
||||
public override string PostExtApp {get; set;}
|
||||
|
||||
[ReadOnly(true), Browsable(false)]
|
||||
public override string MacAddress {get; set;}
|
||||
|
||||
[ReadOnly(true), Browsable(false)]
|
||||
public override string UserField {get; set;}
|
||||
#endregion
|
||||
|
||||
#region IComponent
|
||||
[Browsable(false)]
|
||||
public ISite Site
|
||||
{
|
||||
get { return new PropertyGridCommandSite(this); }
|
||||
set { throw (new NotImplementedException()); }
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
if (Disposed != null)
|
||||
Disposed(this, EventArgs.Empty);
|
||||
}
|
||||
|
||||
public event EventHandler Disposed;
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// VBConversions Note: VB project level imports
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using AxWFICALib;
|
||||
@@ -9,289 +8,284 @@ using AxMSTSCLib;
|
||||
using Microsoft.VisualBasic;
|
||||
using System.Collections;
|
||||
using System.Windows.Forms;
|
||||
// End of VB project level imports
|
||||
|
||||
using System.ComponentModel;
|
||||
|
||||
|
||||
namespace mRemoteNG
|
||||
namespace mRemoteNG.Controls
|
||||
{
|
||||
namespace Controls
|
||||
public class ListView : System.Windows.Forms.ListView
|
||||
{
|
||||
public class ListView : System.Windows.Forms.ListView
|
||||
#region Public Properties
|
||||
[Category("Appearance"), DefaultValue(typeof(Color), "HighlightText")]
|
||||
public Color HighlightForeColor {get; set;}
|
||||
|
||||
[Category("Appearance"), DefaultValue(typeof(Color), "Highlight")]
|
||||
public Color HighlightBackColor {get; set;}
|
||||
|
||||
[Category("Appearance"), DefaultValue(typeof(Color), "HotTrack")]
|
||||
public Color HighlightBorderColor {get; set;}
|
||||
|
||||
[Category("Appearance"), DefaultValue(typeof(Color), "ControlText")]
|
||||
public Color InactiveHighlightForeColor {get; set;}
|
||||
|
||||
[Category("Appearance"), DefaultValue(typeof(Color), "Control")]
|
||||
public Color InactiveHighlightBackColor {get; set;}
|
||||
|
||||
[Category("Appearance"), DefaultValue(typeof(Color), "ControlDark")]
|
||||
public Color InactiveHighlightBorderColor {get; set;}
|
||||
|
||||
[Category("Appearance"), DefaultValue(true)]
|
||||
private bool _ShowFocusCues = true;
|
||||
public bool ShowFocusCues
|
||||
{
|
||||
|
||||
#region Public Properties
|
||||
[Category("Appearance"),
|
||||
DefaultValue(typeof(Color), "HighlightText")]public Color HighlightForeColor {get; set;}
|
||||
|
||||
[Category("Appearance"),
|
||||
DefaultValue(typeof(Color), "Highlight")]public Color HighlightBackColor {get; set;}
|
||||
|
||||
[Category("Appearance"),
|
||||
DefaultValue(typeof(Color), "HotTrack")]public Color HighlightBorderColor {get; set;}
|
||||
|
||||
[Category("Appearance"),
|
||||
DefaultValue(typeof(Color), "ControlText")]public Color InactiveHighlightForeColor {get; set;}
|
||||
|
||||
[Category("Appearance"),
|
||||
DefaultValue(typeof(Color), "Control")]public Color InactiveHighlightBackColor {get; set;}
|
||||
|
||||
[Category("Appearance"),
|
||||
DefaultValue(typeof(Color), "ControlDark")]public Color InactiveHighlightBorderColor {get; set;}
|
||||
|
||||
[Category("Appearance"),
|
||||
DefaultValue(true)]private bool _ShowFocusCues = true;
|
||||
private bool ShowFocusCues
|
||||
{
|
||||
get
|
||||
{
|
||||
return _ShowFocusCues;
|
||||
}
|
||||
set
|
||||
{
|
||||
_ShowFocusCues = value;
|
||||
}
|
||||
}
|
||||
|
||||
[Category("Appearance")]private Alignment _LabelAlignment = new Alignment(VerticalAlignment.Top, HorizontalAlignment.Left);
|
||||
private Alignment LabelAlignment
|
||||
get
|
||||
{
|
||||
get
|
||||
{
|
||||
return _LabelAlignment;
|
||||
}
|
||||
set
|
||||
{
|
||||
_LabelAlignment = value;
|
||||
}
|
||||
return _ShowFocusCues;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
public ListView()
|
||||
set
|
||||
{
|
||||
// VBConversions Note: Non-static class variable initialization is below. Class variables cannot be initially assigned non-static values in C#.
|
||||
HighlightForeColor = SystemColors.HighlightText;
|
||||
HighlightBackColor = SystemColors.Highlight;
|
||||
HighlightBorderColor = SystemColors.HotTrack;
|
||||
InactiveHighlightForeColor = SystemColors.ControlText;
|
||||
InactiveHighlightBackColor = SystemColors.Control;
|
||||
InactiveHighlightBorderColor = SystemColors.ControlDark;
|
||||
|
||||
OwnerDraw = true;
|
||||
_ShowFocusCues = value;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
#region Protected Methods
|
||||
protected override void OnDrawItem(DrawListViewItemEventArgs e)
|
||||
[Category("Appearance")]
|
||||
private Alignment _LabelAlignment = new Alignment(VerticalAlignment.Top, HorizontalAlignment.Left);
|
||||
public Alignment LabelAlignment
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!(View == View.Tile))
|
||||
{
|
||||
base.OnDrawItem(e);
|
||||
}
|
||||
if (e.ItemIndex < 0)
|
||||
{
|
||||
base.OnDrawItem(e);
|
||||
}
|
||||
|
||||
Brush foreColorBrush = null;
|
||||
Brush backColorBrush = null;
|
||||
Pen borderPen = null;
|
||||
try
|
||||
{
|
||||
if (Focused)
|
||||
{
|
||||
borderPen = new Pen(HighlightBorderColor);
|
||||
}
|
||||
else
|
||||
{
|
||||
borderPen = new Pen(InactiveHighlightBorderColor);
|
||||
}
|
||||
|
||||
if (e.Item.Selected)
|
||||
{
|
||||
if (Focused)
|
||||
{
|
||||
foreColorBrush = new SolidBrush(HighlightForeColor);
|
||||
backColorBrush = new SolidBrush(HighlightBackColor);
|
||||
}
|
||||
else
|
||||
{
|
||||
foreColorBrush = new SolidBrush(InactiveHighlightForeColor);
|
||||
backColorBrush = new SolidBrush(InactiveHighlightBackColor);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
foreColorBrush = new SolidBrush(e.Item.ForeColor);
|
||||
backColorBrush = new SolidBrush(BackColor);
|
||||
}
|
||||
|
||||
e.Graphics.FillRectangle(backColorBrush, e.Bounds);
|
||||
|
||||
if (Focused && ShowFocusCues)
|
||||
{
|
||||
e.DrawFocusRectangle();
|
||||
}
|
||||
else if (e.Item.Selected)
|
||||
{
|
||||
e.Graphics.DrawRectangle(borderPen, e.Bounds.X, e.Bounds.Y, e.Bounds.Width - 1, e.Bounds.Height - 1);
|
||||
}
|
||||
|
||||
Rectangle imageBounds = new Rectangle(e.Bounds.X + 2, e.Bounds.Y + 6, 16, 16);
|
||||
Rectangle textBounds = e.Bounds;
|
||||
|
||||
if (e.Item.ImageList != null)
|
||||
{
|
||||
Image image = null;
|
||||
if (!string.IsNullOrEmpty(e.Item.ImageKey) && e.Item.ImageList.Images.ContainsKey(e.Item.ImageKey))
|
||||
{
|
||||
image = e.Item.ImageList.Images[e.Item.ImageKey];
|
||||
}
|
||||
else if (!(e.Item.ImageIndex < 0) & e.Item.ImageList.Images.Count > e.Item.ImageIndex)
|
||||
{
|
||||
image = e.Item.ImageList.Images[e.Item.ImageIndex];
|
||||
}
|
||||
if (image != null)
|
||||
{
|
||||
e.Graphics.DrawImageUnscaledAndClipped(image, imageBounds);
|
||||
textBounds.X = textBounds.Left + 20;
|
||||
textBounds.Width = textBounds.Width - 20;
|
||||
}
|
||||
}
|
||||
|
||||
e.Graphics.DrawString(e.Item.Text, e.Item.Font, foreColorBrush, textBounds, GetStringFormat());
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (foreColorBrush != null)
|
||||
{
|
||||
foreColorBrush.Dispose();
|
||||
}
|
||||
if (backColorBrush != null)
|
||||
{
|
||||
backColorBrush.Dispose();
|
||||
}
|
||||
if (borderPen != null)
|
||||
{
|
||||
borderPen.Dispose();
|
||||
}
|
||||
}
|
||||
return _LabelAlignment;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Private Methods
|
||||
private StringFormat GetStringFormat()
|
||||
set
|
||||
{
|
||||
StringFormat format = StringFormat.GenericDefault;
|
||||
_LabelAlignment = value;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
public ListView()
|
||||
{
|
||||
// VBConversions Note: Non-static class variable initialization is below. Class variables cannot be initially assigned non-static values in C#.
|
||||
HighlightForeColor = SystemColors.HighlightText;
|
||||
HighlightBackColor = SystemColors.Highlight;
|
||||
HighlightBorderColor = SystemColors.HotTrack;
|
||||
InactiveHighlightForeColor = SystemColors.ControlText;
|
||||
InactiveHighlightBackColor = SystemColors.Control;
|
||||
InactiveHighlightBorderColor = SystemColors.ControlDark;
|
||||
|
||||
switch (LabelAlignment.Vertical)
|
||||
{
|
||||
case VerticalAlignment.Top:
|
||||
format.LineAlignment = StringAlignment.Near;
|
||||
break;
|
||||
case VerticalAlignment.Middle:
|
||||
format.LineAlignment = StringAlignment.Center;
|
||||
break;
|
||||
case VerticalAlignment.Bottom:
|
||||
format.LineAlignment = StringAlignment.Far;
|
||||
break;
|
||||
}
|
||||
OwnerDraw = true;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Protected Methods
|
||||
protected override void OnDrawItem(DrawListViewItemEventArgs e)
|
||||
{
|
||||
if (!(View == View.Tile))
|
||||
{
|
||||
base.OnDrawItem(e);
|
||||
}
|
||||
if (e.ItemIndex < 0)
|
||||
{
|
||||
base.OnDrawItem(e);
|
||||
}
|
||||
|
||||
switch (LabelAlignment.Horizontal)
|
||||
Brush foreColorBrush = null;
|
||||
Brush backColorBrush = null;
|
||||
Pen borderPen = null;
|
||||
try
|
||||
{
|
||||
if (Focused)
|
||||
{
|
||||
case HorizontalAlignment.Left:
|
||||
format.Alignment = StringAlignment.Near;
|
||||
break;
|
||||
case HorizontalAlignment.Center:
|
||||
format.Alignment = StringAlignment.Center;
|
||||
break;
|
||||
case HorizontalAlignment.Right:
|
||||
format.Alignment = StringAlignment.Far;
|
||||
break;
|
||||
}
|
||||
|
||||
if (RightToLeft)
|
||||
{
|
||||
format.FormatFlags = (System.Drawing.StringFormatFlags) (format.FormatFlags | StringFormatFlags.DirectionRightToLeft);
|
||||
}
|
||||
|
||||
if (LabelWrap)
|
||||
{
|
||||
format.FormatFlags = (System.Drawing.StringFormatFlags) (format.FormatFlags
|
||||
& ~StringFormatFlags.NoWrap);
|
||||
borderPen = new Pen(HighlightBorderColor);
|
||||
}
|
||||
else
|
||||
{
|
||||
format.FormatFlags = (System.Drawing.StringFormatFlags) (format.FormatFlags | StringFormatFlags.NoWrap);
|
||||
borderPen = new Pen(InactiveHighlightBorderColor);
|
||||
}
|
||||
|
||||
return format;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
[TypeConverter(typeof(ExpandableObjectConverter))]public class Alignment
|
||||
{
|
||||
public Alignment()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public Alignment(VerticalAlignment verticalAlignment, HorizontalAlignment horizontalAlignment)
|
||||
{
|
||||
Vertical = verticalAlignment;
|
||||
Horizontal = horizontalAlignment;
|
||||
}
|
||||
|
||||
[NotifyParentProperty(true),
|
||||
DefaultValue(VerticalAlignment.Top)]private VerticalAlignment _Vertical = VerticalAlignment.Top;
|
||||
private VerticalAlignment Vertical
|
||||
|
||||
if (e.Item.Selected)
|
||||
{
|
||||
get
|
||||
if (Focused)
|
||||
{
|
||||
return _Vertical;
|
||||
foreColorBrush = new SolidBrush(HighlightForeColor);
|
||||
backColorBrush = new SolidBrush(HighlightBackColor);
|
||||
}
|
||||
set
|
||||
else
|
||||
{
|
||||
_Vertical = value;
|
||||
foreColorBrush = new SolidBrush(InactiveHighlightForeColor);
|
||||
backColorBrush = new SolidBrush(InactiveHighlightBackColor);
|
||||
}
|
||||
}
|
||||
|
||||
[NotifyParentProperty(true),
|
||||
DefaultValue(HorizontalAlignment.Left)]private HorizontalAlignment _Horizontal = HorizontalAlignment.Left;
|
||||
private HorizontalAlignment Horizontal
|
||||
else
|
||||
{
|
||||
get
|
||||
foreColorBrush = new SolidBrush(e.Item.ForeColor);
|
||||
backColorBrush = new SolidBrush(BackColor);
|
||||
}
|
||||
|
||||
e.Graphics.FillRectangle(backColorBrush, e.Bounds);
|
||||
|
||||
if (Focused && ShowFocusCues)
|
||||
{
|
||||
e.DrawFocusRectangle();
|
||||
}
|
||||
else if (e.Item.Selected)
|
||||
{
|
||||
e.Graphics.DrawRectangle(borderPen, e.Bounds.X, e.Bounds.Y, e.Bounds.Width - 1, e.Bounds.Height - 1);
|
||||
}
|
||||
|
||||
Rectangle imageBounds = new Rectangle(e.Bounds.X + 2, e.Bounds.Y + 6, 16, 16);
|
||||
Rectangle textBounds = e.Bounds;
|
||||
|
||||
if (e.Item.ImageList != null)
|
||||
{
|
||||
Image image = null;
|
||||
if (!string.IsNullOrEmpty(e.Item.ImageKey) && e.Item.ImageList.Images.ContainsKey(e.Item.ImageKey))
|
||||
{
|
||||
return _Horizontal;
|
||||
image = e.Item.ImageList.Images[e.Item.ImageKey];
|
||||
}
|
||||
set
|
||||
else if (!(e.Item.ImageIndex < 0) & e.Item.ImageList.Images.Count > e.Item.ImageIndex)
|
||||
{
|
||||
_Horizontal = value;
|
||||
image = e.Item.ImageList.Images[e.Item.ImageIndex];
|
||||
}
|
||||
if (image != null)
|
||||
{
|
||||
e.Graphics.DrawImageUnscaledAndClipped(image, imageBounds);
|
||||
textBounds.X = textBounds.Left + 20;
|
||||
textBounds.Width = textBounds.Width - 20;
|
||||
}
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
|
||||
e.Graphics.DrawString(e.Item.Text, e.Item.Font, foreColorBrush, textBounds, GetStringFormat());
|
||||
}
|
||||
finally
|
||||
{
|
||||
return string.Format("{0}, {1}", Vertical, Horizontal);
|
||||
if (foreColorBrush != null)
|
||||
{
|
||||
foreColorBrush.Dispose();
|
||||
}
|
||||
if (backColorBrush != null)
|
||||
{
|
||||
backColorBrush.Dispose();
|
||||
}
|
||||
if (borderPen != null)
|
||||
{
|
||||
borderPen.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public enum VerticalAlignment
|
||||
#endregion
|
||||
|
||||
#region Private Methods
|
||||
private StringFormat GetStringFormat()
|
||||
{
|
||||
Top,
|
||||
Middle,
|
||||
Bottom
|
||||
StringFormat format = StringFormat.GenericDefault;
|
||||
|
||||
switch (LabelAlignment.Vertical)
|
||||
{
|
||||
case VerticalAlignment.Top:
|
||||
format.LineAlignment = StringAlignment.Near;
|
||||
break;
|
||||
case VerticalAlignment.Middle:
|
||||
format.LineAlignment = StringAlignment.Center;
|
||||
break;
|
||||
case VerticalAlignment.Bottom:
|
||||
format.LineAlignment = StringAlignment.Far;
|
||||
break;
|
||||
}
|
||||
|
||||
switch (LabelAlignment.Horizontal)
|
||||
{
|
||||
case HorizontalAlignment.Left:
|
||||
format.Alignment = StringAlignment.Near;
|
||||
break;
|
||||
case HorizontalAlignment.Center:
|
||||
format.Alignment = StringAlignment.Center;
|
||||
break;
|
||||
case HorizontalAlignment.Right:
|
||||
format.Alignment = StringAlignment.Far;
|
||||
break;
|
||||
}
|
||||
|
||||
if (RightToLeft)
|
||||
{
|
||||
format.FormatFlags = (System.Drawing.StringFormatFlags) (format.FormatFlags | StringFormatFlags.DirectionRightToLeft);
|
||||
}
|
||||
|
||||
if (LabelWrap)
|
||||
{
|
||||
format.FormatFlags = (System.Drawing.StringFormatFlags) (format.FormatFlags
|
||||
& ~StringFormatFlags.NoWrap);
|
||||
}
|
||||
else
|
||||
{
|
||||
format.FormatFlags = (System.Drawing.StringFormatFlags) (format.FormatFlags | StringFormatFlags.NoWrap);
|
||||
}
|
||||
|
||||
return format;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
public enum HorizontalAlignment
|
||||
[TypeConverter(typeof(ExpandableObjectConverter))]
|
||||
public class Alignment
|
||||
{
|
||||
public Alignment()
|
||||
{
|
||||
Left,
|
||||
Center,
|
||||
Right
|
||||
|
||||
}
|
||||
|
||||
public Alignment(VerticalAlignment verticalAlignment, HorizontalAlignment horizontalAlignment)
|
||||
{
|
||||
Vertical = verticalAlignment;
|
||||
Horizontal = horizontalAlignment;
|
||||
}
|
||||
|
||||
[NotifyParentProperty(true), DefaultValue(VerticalAlignment.Top)]
|
||||
private VerticalAlignment _Vertical = VerticalAlignment.Top;
|
||||
public VerticalAlignment Vertical
|
||||
{
|
||||
get
|
||||
{
|
||||
return _Vertical;
|
||||
}
|
||||
set
|
||||
{
|
||||
_Vertical = value;
|
||||
}
|
||||
}
|
||||
|
||||
[NotifyParentProperty(true), DefaultValue(HorizontalAlignment.Left)]
|
||||
private HorizontalAlignment _Horizontal = HorizontalAlignment.Left;
|
||||
public HorizontalAlignment Horizontal
|
||||
{
|
||||
get
|
||||
{
|
||||
return _Horizontal;
|
||||
}
|
||||
set
|
||||
{
|
||||
_Horizontal = value;
|
||||
}
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Format("{0}, {1}", Vertical, Horizontal);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public enum VerticalAlignment
|
||||
{
|
||||
Top,
|
||||
Middle,
|
||||
Bottom
|
||||
}
|
||||
|
||||
public enum HorizontalAlignment
|
||||
{
|
||||
Left,
|
||||
Center,
|
||||
Right
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// VBConversions Note: VB project level imports
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using AxWFICALib;
|
||||
@@ -9,273 +8,268 @@ using AxMSTSCLib;
|
||||
using Microsoft.VisualBasic;
|
||||
using System.Collections;
|
||||
using System.Windows.Forms;
|
||||
// End of VB project level imports
|
||||
|
||||
//using mRemoteNG.App.Runtime;
|
||||
using mRemoteNG.Connection;
|
||||
using mRemoteNG.Connection.Protocol;
|
||||
using mRemoteNG.App;
|
||||
|
||||
|
||||
namespace mRemoteNG
|
||||
namespace mRemoteNG.Controls
|
||||
{
|
||||
namespace Controls
|
||||
public class QuickConnectComboBox : ToolStripComboBox
|
||||
{
|
||||
public class QuickConnectComboBox : ToolStripComboBox
|
||||
|
||||
private ComboBox _comboBox;
|
||||
private bool _ignoreEnter = false;
|
||||
|
||||
public QuickConnectComboBox()
|
||||
{
|
||||
|
||||
private ComboBox _comboBox;
|
||||
private bool _ignoreEnter = false;
|
||||
|
||||
public QuickConnectComboBox()
|
||||
{
|
||||
_comboBox = ComboBox;
|
||||
_comboBox.PreviewKeyDown += ComboBox_PreviewKeyDown;
|
||||
_comboBox.SelectedIndexChanged += ComboBox_SelectedIndexChanged;
|
||||
_comboBox.DrawItem += ComboBox_DrawItem;
|
||||
_comboBox.DrawMode = DrawMode.OwnerDrawFixed;
|
||||
_comboBox = ComboBox;
|
||||
_comboBox.PreviewKeyDown += ComboBox_PreviewKeyDown;
|
||||
_comboBox.SelectedIndexChanged += ComboBox_SelectedIndexChanged;
|
||||
_comboBox.DrawItem += ComboBox_DrawItem;
|
||||
_comboBox.DrawMode = DrawMode.OwnerDrawFixed;
|
||||
|
||||
// This makes it so that _ignoreEnter works correctly before any items are added to the combo box
|
||||
_comboBox.Items.Clear();
|
||||
}
|
||||
// This makes it so that _ignoreEnter works correctly before any items are added to the combo box
|
||||
_comboBox.Items.Clear();
|
||||
}
|
||||
|
||||
private void ComboBox_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
|
||||
private void ComboBox_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
|
||||
{
|
||||
if (e.KeyCode == Keys.Enter & _comboBox.DroppedDown)
|
||||
{
|
||||
if (e.KeyCode == Keys.Enter & _comboBox.DroppedDown)
|
||||
_ignoreEnter = true;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnKeyDown(KeyEventArgs e)
|
||||
{
|
||||
base.OnKeyDown(e);
|
||||
if (e.KeyCode == Keys.Enter)
|
||||
{
|
||||
// Only connect if Enter was not pressed while the combo box was dropped down
|
||||
if (!_ignoreEnter)
|
||||
{
|
||||
_ignoreEnter = true;
|
||||
OnConnectRequested(new ConnectRequestedEventArgs(_comboBox.Text));
|
||||
}
|
||||
_ignoreEnter = false;
|
||||
e.Handled = true;
|
||||
}
|
||||
|
||||
protected override void OnKeyDown(KeyEventArgs e)
|
||||
else if (e.KeyCode == Keys.Delete & _comboBox.DroppedDown)
|
||||
{
|
||||
base.OnKeyDown(e);
|
||||
if (e.KeyCode == Keys.Enter)
|
||||
if (!(_comboBox.SelectedIndex == -1))
|
||||
{
|
||||
// Only connect if Enter was not pressed while the combo box was dropped down
|
||||
if (!_ignoreEnter)
|
||||
// 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;
|
||||
_comboBox.DroppedDown = false;
|
||||
_comboBox.Items.Remove(item);
|
||||
_comboBox.SelectedIndex = -1;
|
||||
if (!(_comboBox.Items.Count == 0))
|
||||
{
|
||||
OnConnectRequested(new ConnectRequestedEventArgs(_comboBox.Text));
|
||||
_comboBox.DroppedDown = true;
|
||||
}
|
||||
_ignoreEnter = false;
|
||||
e.Handled = true;
|
||||
}
|
||||
else if (e.KeyCode == Keys.Delete & _comboBox.DroppedDown)
|
||||
{
|
||||
if (!(_comboBox.SelectedIndex == -1))
|
||||
{
|
||||
// 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;
|
||||
_comboBox.DroppedDown = false;
|
||||
_comboBox.Items.Remove(item);
|
||||
_comboBox.SelectedIndex = -1;
|
||||
if (!(_comboBox.Items.Count == 0))
|
||||
{
|
||||
_comboBox.DroppedDown = true;
|
||||
}
|
||||
}
|
||||
e.Handled = true;
|
||||
}
|
||||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void ComboBox_SelectedIndexChanged(System.Object sender, EventArgs e)
|
||||
private void ComboBox_SelectedIndexChanged(System.Object sender, EventArgs e)
|
||||
{
|
||||
if (!(_comboBox.SelectedItem is HistoryItem))
|
||||
{
|
||||
if (!(_comboBox.SelectedItem is HistoryItem))
|
||||
{
|
||||
return ;
|
||||
}
|
||||
HistoryItem historyItem = (HistoryItem) _comboBox.SelectedItem;
|
||||
OnProtocolChanged(new ProtocolChangedEventArgs(historyItem.ConnectionInfo.Protocol));
|
||||
return ;
|
||||
}
|
||||
HistoryItem historyItem = (HistoryItem) _comboBox.SelectedItem;
|
||||
OnProtocolChanged(new ProtocolChangedEventArgs(historyItem.ConnectionInfo.Protocol));
|
||||
}
|
||||
|
||||
private static void ComboBox_DrawItem(object sender, DrawItemEventArgs e)
|
||||
private static void ComboBox_DrawItem(object sender, DrawItemEventArgs e)
|
||||
{
|
||||
ComboBox comboBox = sender as ComboBox;
|
||||
if (comboBox == null)
|
||||
{
|
||||
ComboBox comboBox = sender as ComboBox;
|
||||
if (comboBox == null)
|
||||
{
|
||||
return ;
|
||||
}
|
||||
object drawItem = comboBox.Items[e.Index];
|
||||
return ;
|
||||
}
|
||||
object drawItem = comboBox.Items[e.Index];
|
||||
|
||||
string drawString = "";
|
||||
if (drawItem is HistoryItem)
|
||||
string drawString = "";
|
||||
if (drawItem is HistoryItem)
|
||||
{
|
||||
HistoryItem historyItem = (HistoryItem) drawItem;
|
||||
drawString = historyItem.ToString[true];
|
||||
}
|
||||
else
|
||||
{
|
||||
drawString = drawItem.ToString();
|
||||
}
|
||||
|
||||
e.DrawBackground();
|
||||
e.Graphics.DrawString(drawString, e.Font, new SolidBrush(e.ForeColor), new RectangleF(e.Bounds.X, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height));
|
||||
e.DrawFocusRectangle();
|
||||
}
|
||||
|
||||
private struct HistoryItem : IEquatable<HistoryItem>
|
||||
{
|
||||
|
||||
public Info ConnectionInfo {get; set;}
|
||||
|
||||
public bool Equals(HistoryItem other)
|
||||
{
|
||||
if (!(ConnectionInfo.Hostname == other.ConnectionInfo.Hostname))
|
||||
{
|
||||
HistoryItem historyItem = (HistoryItem) drawItem;
|
||||
drawString = historyItem.ToString[true];
|
||||
return false;
|
||||
}
|
||||
if (!(ConnectionInfo.Port == other.ConnectionInfo.Port))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (!(ConnectionInfo.Protocol == other.ConnectionInfo.Protocol))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return ToString(false);
|
||||
}
|
||||
|
||||
public string ToString(bool includeProtocol)
|
||||
{
|
||||
string port = string.Empty;
|
||||
if (!(ConnectionInfo.Port == ConnectionInfo.GetDefaultPort()))
|
||||
{
|
||||
port = string.Format(":{0}", ConnectionInfo.Port);
|
||||
}
|
||||
if (includeProtocol)
|
||||
{
|
||||
return string.Format("{0}{1} ({2})", ConnectionInfo.Hostname, port, ConnectionInfo.Protocol);
|
||||
}
|
||||
else
|
||||
{
|
||||
drawString = drawItem.ToString();
|
||||
return string.Format("{0}{1}", ConnectionInfo.Hostname, port);
|
||||
}
|
||||
|
||||
e.DrawBackground();
|
||||
e.Graphics.DrawString(drawString, e.Font, new SolidBrush(e.ForeColor), new RectangleF(e.Bounds.X, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height));
|
||||
e.DrawFocusRectangle();
|
||||
}
|
||||
}
|
||||
|
||||
private struct HistoryItem : IEquatable<HistoryItem>
|
||||
private bool Exists(HistoryItem searchItem)
|
||||
{
|
||||
foreach (object item in _comboBox.Items)
|
||||
{
|
||||
|
||||
public Protocol.Info ConnectionInfo {get; set;}
|
||||
|
||||
public bool Equals(HistoryItem other)
|
||||
if (!(item is HistoryItem))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
HistoryItem historyItem = (HistoryItem) item;
|
||||
if (historyItem.Equals(searchItem))
|
||||
{
|
||||
if (!(ConnectionInfo.Hostname == other.ConnectionInfo.Hostname))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (!(ConnectionInfo.Port == other.ConnectionInfo.Port))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (!(ConnectionInfo.Protocol == other.ConnectionInfo.Protocol))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return ToString(false);
|
||||
}
|
||||
|
||||
public string ToString(bool includeProtocol)
|
||||
{
|
||||
string port = string.Empty;
|
||||
if (!(ConnectionInfo.Port == ConnectionInfo.GetDefaultPort()))
|
||||
{
|
||||
port = string.Format(":{0}", ConnectionInfo.Port);
|
||||
}
|
||||
if (includeProtocol)
|
||||
{
|
||||
return string.Format("{0}{1} ({2})", ConnectionInfo.Hostname, port, ConnectionInfo.Protocol);
|
||||
}
|
||||
else
|
||||
{
|
||||
return string.Format("{0}{1}", ConnectionInfo.Hostname, port);
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private bool Exists(HistoryItem searchItem)
|
||||
public void Add(Info connectionInfo)
|
||||
{
|
||||
try
|
||||
{
|
||||
foreach (object item in _comboBox.Items)
|
||||
HistoryItem historyItem = new HistoryItem();
|
||||
historyItem.ConnectionInfo = connectionInfo;
|
||||
if (!Exists(historyItem))
|
||||
{
|
||||
if (!(item is HistoryItem))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
HistoryItem historyItem = (HistoryItem) item;
|
||||
if (historyItem.Equals(searchItem))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void Add(Protocol.Info connectionInfo)
|
||||
{
|
||||
try
|
||||
{
|
||||
HistoryItem historyItem = new HistoryItem();
|
||||
historyItem.ConnectionInfo = connectionInfo;
|
||||
if (!Exists(historyItem))
|
||||
{
|
||||
_comboBox.Items.Insert(0, historyItem);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageCollector.AddExceptionMessage(My.Language.strQuickConnectAddFailed, ex, Messages.MessageClass.ErrorMsg, true);
|
||||
_comboBox.Items.Insert(0, historyItem);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Runtime.MessageCollector.AddExceptionMessage(My.Language.strQuickConnectAddFailed, ex, Messages.MessageClass.ErrorMsg, true);
|
||||
}
|
||||
}
|
||||
|
||||
#region Events
|
||||
public class ConnectRequestedEventArgs : EventArgs
|
||||
public class ConnectRequestedEventArgs : EventArgs
|
||||
{
|
||||
|
||||
public ConnectRequestedEventArgs(string connectionString)
|
||||
{
|
||||
_connectionString = connectionString;
|
||||
}
|
||||
|
||||
public ConnectRequestedEventArgs(string connectionString)
|
||||
{
|
||||
_connectionString = connectionString;
|
||||
}
|
||||
|
||||
private string _connectionString;
|
||||
private string _connectionString;
|
||||
|
||||
public string ConnectionString
|
||||
{
|
||||
get
|
||||
{
|
||||
return _connectionString;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public delegate void ConnectRequestedEventHandler(object sender, ConnectRequestedEventArgs e);
|
||||
private ConnectRequestedEventHandler ConnectRequestedEvent;
|
||||
|
||||
public event ConnectRequestedEventHandler ConnectRequested
|
||||
{
|
||||
add
|
||||
get
|
||||
{
|
||||
ConnectRequestedEvent = (ConnectRequestedEventHandler) System.Delegate.Combine(ConnectRequestedEvent, value);
|
||||
}
|
||||
remove
|
||||
{
|
||||
ConnectRequestedEvent = (ConnectRequestedEventHandler) System.Delegate.Remove(ConnectRequestedEvent, value);
|
||||
return _connectionString;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected virtual void OnConnectRequested(ConnectRequestedEventArgs e)
|
||||
{
|
||||
if (ConnectRequestedEvent != null)
|
||||
ConnectRequestedEvent(this, new ConnectRequestedEventArgs(e.ConnectionString));
|
||||
}
|
||||
|
||||
public class ProtocolChangedEventArgs : EventArgs
|
||||
{
|
||||
|
||||
public ProtocolChangedEventArgs(Protocol.Protocol.Protocols protocol)
|
||||
{
|
||||
_protocol = protocol;
|
||||
}
|
||||
|
||||
private Protocol.Protocol.Protocols _protocol;
|
||||
|
||||
public Protocol.Protocol.Protocols Protocol
|
||||
{
|
||||
get
|
||||
{
|
||||
return _protocol;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public delegate void ProtocolChangedEventHandler(object sender, ProtocolChangedEventArgs e);
|
||||
private ProtocolChangedEventHandler ProtocolChangedEvent;
|
||||
|
||||
public event ProtocolChangedEventHandler ProtocolChanged
|
||||
{
|
||||
add
|
||||
{
|
||||
ProtocolChangedEvent = (ProtocolChangedEventHandler) System.Delegate.Combine(ProtocolChangedEvent, value);
|
||||
}
|
||||
remove
|
||||
{
|
||||
ProtocolChangedEvent = (ProtocolChangedEventHandler) System.Delegate.Remove(ProtocolChangedEvent, value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected virtual void OnProtocolChanged(ProtocolChangedEventArgs e)
|
||||
{
|
||||
if (ProtocolChangedEvent != null)
|
||||
ProtocolChangedEvent(this, new ProtocolChangedEventArgs(e.Protocol));
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
public delegate void ConnectRequestedEventHandler(object sender, ConnectRequestedEventArgs e);
|
||||
private ConnectRequestedEventHandler ConnectRequestedEvent;
|
||||
|
||||
public event ConnectRequestedEventHandler ConnectRequested
|
||||
{
|
||||
add
|
||||
{
|
||||
ConnectRequestedEvent = (ConnectRequestedEventHandler) System.Delegate.Combine(ConnectRequestedEvent, value);
|
||||
}
|
||||
remove
|
||||
{
|
||||
ConnectRequestedEvent = (ConnectRequestedEventHandler) System.Delegate.Remove(ConnectRequestedEvent, value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected virtual void OnConnectRequested(ConnectRequestedEventArgs e)
|
||||
{
|
||||
if (ConnectRequestedEvent != null)
|
||||
ConnectRequestedEvent(this, new ConnectRequestedEventArgs(e.ConnectionString));
|
||||
}
|
||||
|
||||
public class ProtocolChangedEventArgs : EventArgs
|
||||
{
|
||||
|
||||
public ProtocolChangedEventArgs(Protocols protocol)
|
||||
{
|
||||
_protocol = protocol;
|
||||
}
|
||||
|
||||
private Protocols _protocol;
|
||||
|
||||
public Protocols Protocol
|
||||
{
|
||||
get
|
||||
{
|
||||
return _protocol;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public delegate void ProtocolChangedEventHandler(object sender, ProtocolChangedEventArgs e);
|
||||
private ProtocolChangedEventHandler ProtocolChangedEvent;
|
||||
|
||||
public event ProtocolChangedEventHandler ProtocolChanged
|
||||
{
|
||||
add
|
||||
{
|
||||
ProtocolChangedEvent = (ProtocolChangedEventHandler) System.Delegate.Combine(ProtocolChangedEvent, value);
|
||||
}
|
||||
remove
|
||||
{
|
||||
ProtocolChangedEvent = (ProtocolChangedEventHandler) System.Delegate.Remove(ProtocolChangedEvent, value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected virtual void OnProtocolChanged(ProtocolChangedEventArgs e)
|
||||
{
|
||||
if (ProtocolChangedEvent != null)
|
||||
ProtocolChangedEvent(this, new ProtocolChangedEventArgs(e.Protocol));
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
380
mRemoteV1/CS/Forms/OptionsPages/KeyboardPage.Designer.cs
generated
380
mRemoteV1/CS/Forms/OptionsPages/KeyboardPage.Designer.cs
generated
@@ -1,4 +1,3 @@
|
||||
// VBConversions Note: VB project level imports
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using AxWFICALib;
|
||||
@@ -9,208 +8,207 @@ using AxMSTSCLib;
|
||||
using Microsoft.VisualBasic;
|
||||
using System.Collections;
|
||||
using System.Windows.Forms;
|
||||
// End of VB project level imports
|
||||
|
||||
|
||||
namespace mRemoteNG.Forms.OptionsPages
|
||||
{
|
||||
[global::Microsoft.VisualBasic.CompilerServices.DesignerGenerated()]public
|
||||
partial class KeyboardPage : OptionsPage
|
||||
{
|
||||
|
||||
//UserControl overrides dispose to clean up the component list.
|
||||
[System.Diagnostics.DebuggerNonUserCode()]protected override void Dispose(bool disposing)
|
||||
{
|
||||
|
||||
//UserControl overrides dispose to clean up the component list.
|
||||
[System.Diagnostics.DebuggerNonUserCode()]protected override void Dispose(bool disposing)
|
||||
try
|
||||
{
|
||||
try
|
||||
if (disposing && components != null)
|
||||
{
|
||||
if (disposing && components != null)
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
base.Dispose(disposing);
|
||||
components.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
//Required by the Windows Form Designer
|
||||
private System.ComponentModel.Container components = null;
|
||||
|
||||
//NOTE: The following procedure is required by the Windows Form Designer
|
||||
//It can be modified using the Windows Form Designer.
|
||||
//Do not modify it using the code editor.
|
||||
[System.Diagnostics.DebuggerStepThrough()]private void InitializeComponent()
|
||||
finally
|
||||
{
|
||||
System.Windows.Forms.GroupBox LineGroupBox = default(System.Windows.Forms.GroupBox);
|
||||
mRemoteNG.Controls.Alignment Alignment1 = new mRemoteNG.Controls.Alignment();
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(KeyboardPage));
|
||||
this.btnDeleteKeyboardShortcut = new System.Windows.Forms.Button();
|
||||
this.btnDeleteKeyboardShortcut.Click += new System.EventHandler(this.btnDeleteKeyboardShortcut_Click);
|
||||
this.btnNewKeyboardShortcut = new System.Windows.Forms.Button();
|
||||
this.btnNewKeyboardShortcut.Click += new System.EventHandler(this.btnNewKeyboardShortcut_Click);
|
||||
this.grpModifyKeyboardShortcut = new System.Windows.Forms.GroupBox();
|
||||
this.hotModifyKeyboardShortcut = new SharedLibraryNG.HotkeyControl();
|
||||
this.hotModifyKeyboardShortcut.TextChanged += new System.EventHandler(this.hotModifyKeyboardShortcut_TextChanged);
|
||||
this.btnResetAllKeyboardShortcuts = new System.Windows.Forms.Button();
|
||||
this.btnResetAllKeyboardShortcuts.Click += new System.EventHandler(this.btnResetAllKeyboardShortcuts_Click);
|
||||
this.btnResetKeyboardShortcuts = new System.Windows.Forms.Button();
|
||||
this.btnResetKeyboardShortcuts.Click += new System.EventHandler(this.btnResetKeyboardShortcuts_Click);
|
||||
this.lblKeyboardCommand = new System.Windows.Forms.Label();
|
||||
this.lstKeyboardShortcuts = new System.Windows.Forms.ListBox();
|
||||
this.lstKeyboardShortcuts.SelectedIndexChanged += new System.EventHandler(this.lstKeyboardShortcuts_SelectedIndexChanged);
|
||||
this.lblKeyboardShortcuts = new System.Windows.Forms.Label();
|
||||
this.lvKeyboardCommands = new mRemoteNG.Controls.ListView();
|
||||
this.lvKeyboardCommands.SelectedIndexChanged += new System.EventHandler(this.lvKeyboardCommands_SelectedIndexChanged);
|
||||
LineGroupBox = new System.Windows.Forms.GroupBox();
|
||||
this.grpModifyKeyboardShortcut.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
//LineGroupBox
|
||||
//
|
||||
LineGroupBox.Location = new System.Drawing.Point(212, 20);
|
||||
LineGroupBox.Name = "LineGroupBox";
|
||||
LineGroupBox.Size = new System.Drawing.Size(398, 3);
|
||||
LineGroupBox.TabIndex = 19;
|
||||
LineGroupBox.TabStop = false;
|
||||
//
|
||||
//btnDeleteKeyboardShortcut
|
||||
//
|
||||
this.btnDeleteKeyboardShortcut.Location = new System.Drawing.Point(293, 151);
|
||||
this.btnDeleteKeyboardShortcut.Name = "btnDeleteKeyboardShortcut";
|
||||
this.btnDeleteKeyboardShortcut.Size = new System.Drawing.Size(75, 23);
|
||||
this.btnDeleteKeyboardShortcut.TabIndex = 15;
|
||||
this.btnDeleteKeyboardShortcut.Text = "&Delete";
|
||||
this.btnDeleteKeyboardShortcut.UseVisualStyleBackColor = true;
|
||||
//
|
||||
//btnNewKeyboardShortcut
|
||||
//
|
||||
this.btnNewKeyboardShortcut.Location = new System.Drawing.Point(212, 151);
|
||||
this.btnNewKeyboardShortcut.Name = "btnNewKeyboardShortcut";
|
||||
this.btnNewKeyboardShortcut.Size = new System.Drawing.Size(75, 23);
|
||||
this.btnNewKeyboardShortcut.TabIndex = 14;
|
||||
this.btnNewKeyboardShortcut.Text = "&New";
|
||||
this.btnNewKeyboardShortcut.UseVisualStyleBackColor = true;
|
||||
//
|
||||
//grpModifyKeyboardShortcut
|
||||
//
|
||||
this.grpModifyKeyboardShortcut.Controls.Add(this.hotModifyKeyboardShortcut);
|
||||
this.grpModifyKeyboardShortcut.Location = new System.Drawing.Point(212, 180);
|
||||
this.grpModifyKeyboardShortcut.Name = "grpModifyKeyboardShortcut";
|
||||
this.grpModifyKeyboardShortcut.Size = new System.Drawing.Size(398, 103);
|
||||
this.grpModifyKeyboardShortcut.TabIndex = 17;
|
||||
this.grpModifyKeyboardShortcut.TabStop = false;
|
||||
this.grpModifyKeyboardShortcut.Text = "Modify Shortcut";
|
||||
//
|
||||
//hotModifyKeyboardShortcut
|
||||
//
|
||||
this.hotModifyKeyboardShortcut.HotkeyModifiers = System.Windows.Forms.Keys.None;
|
||||
this.hotModifyKeyboardShortcut.KeyCode = System.Windows.Forms.Keys.None;
|
||||
this.hotModifyKeyboardShortcut.Location = new System.Drawing.Point(27, 41);
|
||||
this.hotModifyKeyboardShortcut.Name = "hotModifyKeyboardShortcut";
|
||||
this.hotModifyKeyboardShortcut.Size = new System.Drawing.Size(344, 20);
|
||||
this.hotModifyKeyboardShortcut.TabIndex = 0;
|
||||
this.hotModifyKeyboardShortcut.Text = "None";
|
||||
//
|
||||
//btnResetAllKeyboardShortcuts
|
||||
//
|
||||
this.btnResetAllKeyboardShortcuts.Location = new System.Drawing.Point(3, 466);
|
||||
this.btnResetAllKeyboardShortcuts.Name = "btnResetAllKeyboardShortcuts";
|
||||
this.btnResetAllKeyboardShortcuts.Size = new System.Drawing.Size(120, 23);
|
||||
this.btnResetAllKeyboardShortcuts.TabIndex = 18;
|
||||
this.btnResetAllKeyboardShortcuts.Text = "Reset &All to Default";
|
||||
this.btnResetAllKeyboardShortcuts.UseVisualStyleBackColor = true;
|
||||
//
|
||||
//btnResetKeyboardShortcuts
|
||||
//
|
||||
this.btnResetKeyboardShortcuts.Location = new System.Drawing.Point(490, 151);
|
||||
this.btnResetKeyboardShortcuts.Name = "btnResetKeyboardShortcuts";
|
||||
this.btnResetKeyboardShortcuts.Size = new System.Drawing.Size(120, 23);
|
||||
this.btnResetKeyboardShortcuts.TabIndex = 16;
|
||||
this.btnResetKeyboardShortcuts.Text = "&Reset to Default";
|
||||
this.btnResetKeyboardShortcuts.UseVisualStyleBackColor = true;
|
||||
//
|
||||
//lblKeyboardCommand
|
||||
//
|
||||
this.lblKeyboardCommand.AutoSize = true;
|
||||
this.lblKeyboardCommand.Font = new System.Drawing.Font("Microsoft Sans Serif", (float) (10.0F), System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, System.Convert.ToByte(0));
|
||||
this.lblKeyboardCommand.Location = new System.Drawing.Point(209, 0);
|
||||
this.lblKeyboardCommand.Name = "lblKeyboardCommand";
|
||||
this.lblKeyboardCommand.Size = new System.Drawing.Size(71, 17);
|
||||
this.lblKeyboardCommand.TabIndex = 11;
|
||||
this.lblKeyboardCommand.Text = "Command";
|
||||
//
|
||||
//lstKeyboardShortcuts
|
||||
//
|
||||
this.lstKeyboardShortcuts.FormattingEnabled = true;
|
||||
this.lstKeyboardShortcuts.Location = new System.Drawing.Point(212, 50);
|
||||
this.lstKeyboardShortcuts.Name = "lstKeyboardShortcuts";
|
||||
this.lstKeyboardShortcuts.Size = new System.Drawing.Size(398, 95);
|
||||
this.lstKeyboardShortcuts.TabIndex = 13;
|
||||
//
|
||||
//lblKeyboardShortcuts
|
||||
//
|
||||
this.lblKeyboardShortcuts.AutoSize = true;
|
||||
this.lblKeyboardShortcuts.Location = new System.Drawing.Point(209, 34);
|
||||
this.lblKeyboardShortcuts.Name = "lblKeyboardShortcuts";
|
||||
this.lblKeyboardShortcuts.Size = new System.Drawing.Size(100, 13);
|
||||
this.lblKeyboardShortcuts.TabIndex = 12;
|
||||
this.lblKeyboardShortcuts.Text = "Keyboard Shortcuts";
|
||||
//
|
||||
//lvKeyboardCommands
|
||||
//
|
||||
this.lvKeyboardCommands.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable;
|
||||
this.lvKeyboardCommands.HideSelection = false;
|
||||
this.lvKeyboardCommands.InactiveHighlightBackColor = System.Drawing.SystemColors.Highlight;
|
||||
this.lvKeyboardCommands.InactiveHighlightBorderColor = System.Drawing.SystemColors.HotTrack;
|
||||
this.lvKeyboardCommands.InactiveHighlightForeColor = System.Drawing.SystemColors.HighlightText;
|
||||
Alignment1.Horizontal = mRemoteNG.Controls.HorizontalAlignment.Left;
|
||||
Alignment1.Vertical = mRemoteNG.Controls.VerticalAlignment.Middle;
|
||||
this.lvKeyboardCommands.LabelAlignment = Alignment1;
|
||||
this.lvKeyboardCommands.LabelWrap = false;
|
||||
this.lvKeyboardCommands.Location = new System.Drawing.Point(3, 0);
|
||||
this.lvKeyboardCommands.MultiSelect = false;
|
||||
this.lvKeyboardCommands.Name = "lvKeyboardCommands";
|
||||
this.lvKeyboardCommands.OwnerDraw = true;
|
||||
this.lvKeyboardCommands.Size = new System.Drawing.Size(200, 460);
|
||||
this.lvKeyboardCommands.TabIndex = 10;
|
||||
this.lvKeyboardCommands.TileSize = new System.Drawing.Size(196, 20);
|
||||
this.lvKeyboardCommands.UseCompatibleStateImageBehavior = false;
|
||||
this.lvKeyboardCommands.View = System.Windows.Forms.View.Tile;
|
||||
//
|
||||
//KeyboardPage
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF((float) (6.0F), (float) (13.0F));
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(LineGroupBox);
|
||||
this.Controls.Add(this.btnDeleteKeyboardShortcut);
|
||||
this.Controls.Add(this.btnNewKeyboardShortcut);
|
||||
this.Controls.Add(this.grpModifyKeyboardShortcut);
|
||||
this.Controls.Add(this.btnResetAllKeyboardShortcuts);
|
||||
this.Controls.Add(this.btnResetKeyboardShortcuts);
|
||||
this.Controls.Add(this.lblKeyboardCommand);
|
||||
this.Controls.Add(this.lstKeyboardShortcuts);
|
||||
this.Controls.Add(this.lblKeyboardShortcuts);
|
||||
this.Controls.Add(this.lvKeyboardCommands);
|
||||
this.Name = "KeyboardPage";
|
||||
this.PageIcon = (System.Drawing.Icon) (resources.GetObject("$this.PageIcon"));
|
||||
this.Size = new System.Drawing.Size(610, 489);
|
||||
this.grpModifyKeyboardShortcut.ResumeLayout(false);
|
||||
this.grpModifyKeyboardShortcut.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
internal System.Windows.Forms.Button btnDeleteKeyboardShortcut;
|
||||
internal System.Windows.Forms.Button btnNewKeyboardShortcut;
|
||||
internal System.Windows.Forms.GroupBox grpModifyKeyboardShortcut;
|
||||
internal SharedLibraryNG.HotkeyControl hotModifyKeyboardShortcut;
|
||||
internal System.Windows.Forms.Button btnResetAllKeyboardShortcuts;
|
||||
internal System.Windows.Forms.Button btnResetKeyboardShortcuts;
|
||||
internal System.Windows.Forms.Label lblKeyboardCommand;
|
||||
internal System.Windows.Forms.ListBox lstKeyboardShortcuts;
|
||||
internal System.Windows.Forms.Label lblKeyboardShortcuts;
|
||||
internal mRemoteNG.Controls.ListView lvKeyboardCommands;
|
||||
|
||||
}
|
||||
|
||||
//Required by the Windows Form Designer
|
||||
private System.ComponentModel.Container components = null;
|
||||
|
||||
//NOTE: The following procedure is required by the Windows Form Designer
|
||||
//It can be modified using the Windows Form Designer.
|
||||
//Do not modify it using the code editor.
|
||||
[System.Diagnostics.DebuggerStepThrough()]private void InitializeComponent()
|
||||
{
|
||||
System.Windows.Forms.GroupBox LineGroupBox = default(System.Windows.Forms.GroupBox);
|
||||
mRemoteNG.Controls.Alignment Alignment1 = new mRemoteNG.Controls.Alignment();
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(KeyboardPage));
|
||||
this.btnDeleteKeyboardShortcut = new System.Windows.Forms.Button();
|
||||
this.btnDeleteKeyboardShortcut.Click += new System.EventHandler(this.btnDeleteKeyboardShortcut_Click);
|
||||
this.btnNewKeyboardShortcut = new System.Windows.Forms.Button();
|
||||
this.btnNewKeyboardShortcut.Click += new System.EventHandler(this.btnNewKeyboardShortcut_Click);
|
||||
this.grpModifyKeyboardShortcut = new System.Windows.Forms.GroupBox();
|
||||
this.hotModifyKeyboardShortcut = new SharedLibraryNG.HotkeyControl();
|
||||
this.hotModifyKeyboardShortcut.TextChanged += new System.EventHandler(this.hotModifyKeyboardShortcut_TextChanged);
|
||||
this.btnResetAllKeyboardShortcuts = new System.Windows.Forms.Button();
|
||||
this.btnResetAllKeyboardShortcuts.Click += new System.EventHandler(this.btnResetAllKeyboardShortcuts_Click);
|
||||
this.btnResetKeyboardShortcuts = new System.Windows.Forms.Button();
|
||||
this.btnResetKeyboardShortcuts.Click += new System.EventHandler(this.btnResetKeyboardShortcuts_Click);
|
||||
this.lblKeyboardCommand = new System.Windows.Forms.Label();
|
||||
this.lstKeyboardShortcuts = new System.Windows.Forms.ListBox();
|
||||
this.lstKeyboardShortcuts.SelectedIndexChanged += new System.EventHandler(this.lstKeyboardShortcuts_SelectedIndexChanged);
|
||||
this.lblKeyboardShortcuts = new System.Windows.Forms.Label();
|
||||
this.lvKeyboardCommands = new mRemoteNG.Controls.ListView();
|
||||
this.lvKeyboardCommands.SelectedIndexChanged += new System.EventHandler(this.lvKeyboardCommands_SelectedIndexChanged);
|
||||
LineGroupBox = new System.Windows.Forms.GroupBox();
|
||||
this.grpModifyKeyboardShortcut.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
//LineGroupBox
|
||||
//
|
||||
LineGroupBox.Location = new System.Drawing.Point(212, 20);
|
||||
LineGroupBox.Name = "LineGroupBox";
|
||||
LineGroupBox.Size = new System.Drawing.Size(398, 3);
|
||||
LineGroupBox.TabIndex = 19;
|
||||
LineGroupBox.TabStop = false;
|
||||
//
|
||||
//btnDeleteKeyboardShortcut
|
||||
//
|
||||
this.btnDeleteKeyboardShortcut.Location = new System.Drawing.Point(293, 151);
|
||||
this.btnDeleteKeyboardShortcut.Name = "btnDeleteKeyboardShortcut";
|
||||
this.btnDeleteKeyboardShortcut.Size = new System.Drawing.Size(75, 23);
|
||||
this.btnDeleteKeyboardShortcut.TabIndex = 15;
|
||||
this.btnDeleteKeyboardShortcut.Text = "&Delete";
|
||||
this.btnDeleteKeyboardShortcut.UseVisualStyleBackColor = true;
|
||||
//
|
||||
//btnNewKeyboardShortcut
|
||||
//
|
||||
this.btnNewKeyboardShortcut.Location = new System.Drawing.Point(212, 151);
|
||||
this.btnNewKeyboardShortcut.Name = "btnNewKeyboardShortcut";
|
||||
this.btnNewKeyboardShortcut.Size = new System.Drawing.Size(75, 23);
|
||||
this.btnNewKeyboardShortcut.TabIndex = 14;
|
||||
this.btnNewKeyboardShortcut.Text = "&New";
|
||||
this.btnNewKeyboardShortcut.UseVisualStyleBackColor = true;
|
||||
//
|
||||
//grpModifyKeyboardShortcut
|
||||
//
|
||||
this.grpModifyKeyboardShortcut.Controls.Add(this.hotModifyKeyboardShortcut);
|
||||
this.grpModifyKeyboardShortcut.Location = new System.Drawing.Point(212, 180);
|
||||
this.grpModifyKeyboardShortcut.Name = "grpModifyKeyboardShortcut";
|
||||
this.grpModifyKeyboardShortcut.Size = new System.Drawing.Size(398, 103);
|
||||
this.grpModifyKeyboardShortcut.TabIndex = 17;
|
||||
this.grpModifyKeyboardShortcut.TabStop = false;
|
||||
this.grpModifyKeyboardShortcut.Text = "Modify Shortcut";
|
||||
//
|
||||
//hotModifyKeyboardShortcut
|
||||
//
|
||||
this.hotModifyKeyboardShortcut.HotkeyModifiers = System.Windows.Forms.Keys.None;
|
||||
this.hotModifyKeyboardShortcut.KeyCode = System.Windows.Forms.Keys.None;
|
||||
this.hotModifyKeyboardShortcut.Location = new System.Drawing.Point(27, 41);
|
||||
this.hotModifyKeyboardShortcut.Name = "hotModifyKeyboardShortcut";
|
||||
this.hotModifyKeyboardShortcut.Size = new System.Drawing.Size(344, 20);
|
||||
this.hotModifyKeyboardShortcut.TabIndex = 0;
|
||||
this.hotModifyKeyboardShortcut.Text = "None";
|
||||
//
|
||||
//btnResetAllKeyboardShortcuts
|
||||
//
|
||||
this.btnResetAllKeyboardShortcuts.Location = new System.Drawing.Point(3, 466);
|
||||
this.btnResetAllKeyboardShortcuts.Name = "btnResetAllKeyboardShortcuts";
|
||||
this.btnResetAllKeyboardShortcuts.Size = new System.Drawing.Size(120, 23);
|
||||
this.btnResetAllKeyboardShortcuts.TabIndex = 18;
|
||||
this.btnResetAllKeyboardShortcuts.Text = "Reset &All to Default";
|
||||
this.btnResetAllKeyboardShortcuts.UseVisualStyleBackColor = true;
|
||||
//
|
||||
//btnResetKeyboardShortcuts
|
||||
//
|
||||
this.btnResetKeyboardShortcuts.Location = new System.Drawing.Point(490, 151);
|
||||
this.btnResetKeyboardShortcuts.Name = "btnResetKeyboardShortcuts";
|
||||
this.btnResetKeyboardShortcuts.Size = new System.Drawing.Size(120, 23);
|
||||
this.btnResetKeyboardShortcuts.TabIndex = 16;
|
||||
this.btnResetKeyboardShortcuts.Text = "&Reset to Default";
|
||||
this.btnResetKeyboardShortcuts.UseVisualStyleBackColor = true;
|
||||
//
|
||||
//lblKeyboardCommand
|
||||
//
|
||||
this.lblKeyboardCommand.AutoSize = true;
|
||||
this.lblKeyboardCommand.Font = new System.Drawing.Font("Microsoft Sans Serif", (float) (10.0F), System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, System.Convert.ToByte(0));
|
||||
this.lblKeyboardCommand.Location = new System.Drawing.Point(209, 0);
|
||||
this.lblKeyboardCommand.Name = "lblKeyboardCommand";
|
||||
this.lblKeyboardCommand.Size = new System.Drawing.Size(71, 17);
|
||||
this.lblKeyboardCommand.TabIndex = 11;
|
||||
this.lblKeyboardCommand.Text = "Command";
|
||||
//
|
||||
//lstKeyboardShortcuts
|
||||
//
|
||||
this.lstKeyboardShortcuts.FormattingEnabled = true;
|
||||
this.lstKeyboardShortcuts.Location = new System.Drawing.Point(212, 50);
|
||||
this.lstKeyboardShortcuts.Name = "lstKeyboardShortcuts";
|
||||
this.lstKeyboardShortcuts.Size = new System.Drawing.Size(398, 95);
|
||||
this.lstKeyboardShortcuts.TabIndex = 13;
|
||||
//
|
||||
//lblKeyboardShortcuts
|
||||
//
|
||||
this.lblKeyboardShortcuts.AutoSize = true;
|
||||
this.lblKeyboardShortcuts.Location = new System.Drawing.Point(209, 34);
|
||||
this.lblKeyboardShortcuts.Name = "lblKeyboardShortcuts";
|
||||
this.lblKeyboardShortcuts.Size = new System.Drawing.Size(100, 13);
|
||||
this.lblKeyboardShortcuts.TabIndex = 12;
|
||||
this.lblKeyboardShortcuts.Text = "Keyboard Shortcuts";
|
||||
//
|
||||
//lvKeyboardCommands
|
||||
//
|
||||
this.lvKeyboardCommands.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable;
|
||||
this.lvKeyboardCommands.HideSelection = false;
|
||||
this.lvKeyboardCommands.InactiveHighlightBackColor = System.Drawing.SystemColors.Highlight;
|
||||
this.lvKeyboardCommands.InactiveHighlightBorderColor = System.Drawing.SystemColors.HotTrack;
|
||||
this.lvKeyboardCommands.InactiveHighlightForeColor = System.Drawing.SystemColors.HighlightText;
|
||||
Alignment1.Horizontal = mRemoteNG.Controls.HorizontalAlignment.Left;
|
||||
Alignment1.Vertical = mRemoteNG.Controls.VerticalAlignment.Middle;
|
||||
this.lvKeyboardCommands.LabelAlignment = Alignment1;
|
||||
this.lvKeyboardCommands.LabelWrap = false;
|
||||
this.lvKeyboardCommands.Location = new System.Drawing.Point(3, 0);
|
||||
this.lvKeyboardCommands.MultiSelect = false;
|
||||
this.lvKeyboardCommands.Name = "lvKeyboardCommands";
|
||||
this.lvKeyboardCommands.OwnerDraw = true;
|
||||
this.lvKeyboardCommands.Size = new System.Drawing.Size(200, 460);
|
||||
this.lvKeyboardCommands.TabIndex = 10;
|
||||
this.lvKeyboardCommands.TileSize = new System.Drawing.Size(196, 20);
|
||||
this.lvKeyboardCommands.UseCompatibleStateImageBehavior = false;
|
||||
this.lvKeyboardCommands.View = System.Windows.Forms.View.Tile;
|
||||
//
|
||||
//KeyboardPage
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF((float) (6.0F), (float) (13.0F));
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(LineGroupBox);
|
||||
this.Controls.Add(this.btnDeleteKeyboardShortcut);
|
||||
this.Controls.Add(this.btnNewKeyboardShortcut);
|
||||
this.Controls.Add(this.grpModifyKeyboardShortcut);
|
||||
this.Controls.Add(this.btnResetAllKeyboardShortcuts);
|
||||
this.Controls.Add(this.btnResetKeyboardShortcuts);
|
||||
this.Controls.Add(this.lblKeyboardCommand);
|
||||
this.Controls.Add(this.lstKeyboardShortcuts);
|
||||
this.Controls.Add(this.lblKeyboardShortcuts);
|
||||
this.Controls.Add(this.lvKeyboardCommands);
|
||||
this.Name = "KeyboardPage";
|
||||
this.PageIcon = (System.Drawing.Icon) (resources.GetObject("$this.PageIcon"));
|
||||
this.Size = new System.Drawing.Size(610, 489);
|
||||
this.grpModifyKeyboardShortcut.ResumeLayout(false);
|
||||
this.grpModifyKeyboardShortcut.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
internal System.Windows.Forms.Button btnDeleteKeyboardShortcut;
|
||||
internal System.Windows.Forms.Button btnNewKeyboardShortcut;
|
||||
internal System.Windows.Forms.GroupBox grpModifyKeyboardShortcut;
|
||||
internal SharedLibraryNG.HotkeyControl hotModifyKeyboardShortcut;
|
||||
internal System.Windows.Forms.Button btnResetAllKeyboardShortcuts;
|
||||
internal System.Windows.Forms.Button btnResetKeyboardShortcuts;
|
||||
internal System.Windows.Forms.Label lblKeyboardCommand;
|
||||
internal System.Windows.Forms.ListBox lstKeyboardShortcuts;
|
||||
internal System.Windows.Forms.Label lblKeyboardShortcuts;
|
||||
internal mRemoteNG.Controls.ListView lvKeyboardCommands;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// VBConversions Note: VB project level imports
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using AxWFICALib;
|
||||
@@ -9,8 +8,6 @@ using AxMSTSCLib;
|
||||
using Microsoft.VisualBasic;
|
||||
using System.Collections;
|
||||
using System.Windows.Forms;
|
||||
// End of VB project level imports
|
||||
|
||||
using mRemoteNG.Config;
|
||||
using mRemoteNG.My;
|
||||
|
||||
@@ -18,249 +15,245 @@ using mRemoteNG.My;
|
||||
namespace mRemoteNG.Forms.OptionsPages
|
||||
{
|
||||
public partial class KeyboardPage
|
||||
{
|
||||
public KeyboardPage()
|
||||
{
|
||||
public KeyboardPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
public override string PageName
|
||||
{
|
||||
get
|
||||
{
|
||||
return Language.strOptionsTabKeyboard;
|
||||
}
|
||||
set
|
||||
{
|
||||
}
|
||||
}
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public override string PageName
|
||||
{
|
||||
get { return Language.strOptionsTabKeyboard; }
|
||||
set {}
|
||||
}
|
||||
|
||||
public override void ApplyLanguage()
|
||||
{
|
||||
base.ApplyLanguage();
|
||||
public override void ApplyLanguage()
|
||||
{
|
||||
base.ApplyLanguage();
|
||||
|
||||
lblKeyboardShortcuts.Text = Language.strOptionsKeyboardLabelKeyboardShortcuts;
|
||||
btnNewKeyboardShortcut.Text = Language.strOptionsKeyboardButtonNew;
|
||||
btnDeleteKeyboardShortcut.Text = Language.strOptionsKeyboardButtonDelete;
|
||||
btnResetKeyboardShortcuts.Text = Language.strOptionsKeyboardButtonReset;
|
||||
grpModifyKeyboardShortcut.Text = Language.strOptionsKeyboardGroupModifyShortcut;
|
||||
btnResetAllKeyboardShortcuts.Text = Language.strOptionsKeyboardButtonResetAll;
|
||||
lblKeyboardShortcuts.Text = Language.strOptionsKeyboardLabelKeyboardShortcuts;
|
||||
btnNewKeyboardShortcut.Text = Language.strOptionsKeyboardButtonNew;
|
||||
btnDeleteKeyboardShortcut.Text = Language.strOptionsKeyboardButtonDelete;
|
||||
btnResetKeyboardShortcuts.Text = Language.strOptionsKeyboardButtonReset;
|
||||
grpModifyKeyboardShortcut.Text = Language.strOptionsKeyboardGroupModifyShortcut;
|
||||
btnResetAllKeyboardShortcuts.Text = Language.strOptionsKeyboardButtonResetAll;
|
||||
}
|
||||
|
||||
public override void LoadSettings()
|
||||
{
|
||||
_tabsListViewGroup = new ListViewGroup(Language.strOptionsKeyboardCommandsGroupTabs);
|
||||
_previousTabListViewItem = new ListViewItem(Language.strOptionsKeyboardCommandsPreviousTab, _tabsListViewGroup);
|
||||
_nextTabListViewItem = new ListViewItem(Language.strOptionsKeyboardCommandsNextTab, _tabsListViewGroup);
|
||||
|
||||
_keyboardShortcutMap = KeyboardShortcuts.Map.Clone();
|
||||
|
||||
lvKeyboardCommands.Groups.Add(_tabsListViewGroup);
|
||||
lvKeyboardCommands.Items.Add(_previousTabListViewItem);
|
||||
lvKeyboardCommands.Items.Add(_nextTabListViewItem);
|
||||
_previousTabListViewItem.Selected = true;
|
||||
}
|
||||
|
||||
public override void SaveSettings()
|
||||
{
|
||||
base.SaveSettings();
|
||||
|
||||
if (_keyboardShortcutMap != null)
|
||||
{
|
||||
KeyboardShortcuts.Map = _keyboardShortcutMap;
|
||||
}
|
||||
}
|
||||
|
||||
public override void LoadSettings()
|
||||
#region Private Fields
|
||||
private KeyboardShortcutMap _keyboardShortcutMap;
|
||||
private ListViewGroup _tabsListViewGroup;
|
||||
private ListViewItem _previousTabListViewItem;
|
||||
private ListViewItem _nextTabListViewItem;
|
||||
private bool _ignoreKeyboardShortcutTextChanged = false;
|
||||
#endregion
|
||||
|
||||
#region Private Methods
|
||||
#region Event Handlers
|
||||
public void lvKeyboardCommands_SelectedIndexChanged(System.Object sender, EventArgs e)
|
||||
{
|
||||
bool isItemSelected = lvKeyboardCommands.SelectedItems.Count == 1;
|
||||
EnableKeyboardShortcutControls(isItemSelected);
|
||||
|
||||
if (!isItemSelected)
|
||||
{
|
||||
_tabsListViewGroup = new ListViewGroup(Language.strOptionsKeyboardCommandsGroupTabs);
|
||||
_previousTabListViewItem = new ListViewItem(Language.strOptionsKeyboardCommandsPreviousTab, _tabsListViewGroup);
|
||||
_nextTabListViewItem = new ListViewItem(Language.strOptionsKeyboardCommandsNextTab, _tabsListViewGroup);
|
||||
|
||||
_keyboardShortcutMap = KeyboardShortcuts.Map.Clone();
|
||||
|
||||
lvKeyboardCommands.Groups.Add(_tabsListViewGroup);
|
||||
lvKeyboardCommands.Items.Add(_previousTabListViewItem);
|
||||
lvKeyboardCommands.Items.Add(_nextTabListViewItem);
|
||||
_previousTabListViewItem.Selected = true;
|
||||
return ;
|
||||
}
|
||||
|
||||
public override void SaveSettings()
|
||||
{
|
||||
base.SaveSettings();
|
||||
|
||||
if (_keyboardShortcutMap != null)
|
||||
{
|
||||
KeyboardShortcuts.Map = _keyboardShortcutMap;
|
||||
}
|
||||
ListViewItem selectedItem = lvKeyboardCommands.SelectedItems[0];
|
||||
|
||||
lblKeyboardCommand.Text = selectedItem.Text;
|
||||
lstKeyboardShortcuts.Items.Clear();
|
||||
|
||||
lstKeyboardShortcuts.Items.AddRange(_keyboardShortcutMap.GetShortcutKeys(GetSelectedShortcutCommand()));
|
||||
|
||||
if (lstKeyboardShortcuts.Items.Count > 0)
|
||||
{
|
||||
lstKeyboardShortcuts.SelectedIndex = 0;
|
||||
}
|
||||
}
|
||||
|
||||
#region Private Fields
|
||||
private KeyboardShortcutMap _keyboardShortcutMap;
|
||||
private ListViewGroup _tabsListViewGroup;
|
||||
private ListViewItem _previousTabListViewItem;
|
||||
private ListViewItem _nextTabListViewItem;
|
||||
private bool _ignoreKeyboardShortcutTextChanged = false;
|
||||
#endregion
|
||||
|
||||
#region Private Methods
|
||||
#region Event Handlers
|
||||
public void lvKeyboardCommands_SelectedIndexChanged(System.Object sender, EventArgs e)
|
||||
public void lstKeyboardShortcuts_SelectedIndexChanged(System.Object sender, EventArgs e)
|
||||
{
|
||||
bool isItemSelected = lstKeyboardShortcuts.SelectedItems.Count == 1;
|
||||
|
||||
btnDeleteKeyboardShortcut.Enabled = isItemSelected;
|
||||
grpModifyKeyboardShortcut.Enabled = isItemSelected;
|
||||
hotModifyKeyboardShortcut.Enabled = isItemSelected;
|
||||
|
||||
if (!isItemSelected)
|
||||
{
|
||||
bool isItemSelected = lvKeyboardCommands.SelectedItems.Count == 1;
|
||||
EnableKeyboardShortcutControls(isItemSelected);
|
||||
|
||||
if (!isItemSelected)
|
||||
{
|
||||
return ;
|
||||
}
|
||||
|
||||
ListViewItem selectedItem = lvKeyboardCommands.SelectedItems[0];
|
||||
|
||||
lblKeyboardCommand.Text = selectedItem.Text;
|
||||
lstKeyboardShortcuts.Items.Clear();
|
||||
|
||||
lstKeyboardShortcuts.Items.AddRange(_keyboardShortcutMap.GetShortcutKeys(GetSelectedShortcutCommand()));
|
||||
|
||||
if (lstKeyboardShortcuts.Items.Count > 0)
|
||||
{
|
||||
lstKeyboardShortcuts.SelectedIndex = 0;
|
||||
}
|
||||
hotModifyKeyboardShortcut.Text = string.Empty;
|
||||
return ;
|
||||
}
|
||||
|
||||
public void lstKeyboardShortcuts_SelectedIndexChanged(System.Object sender, EventArgs e)
|
||||
|
||||
object selectedItem = lstKeyboardShortcuts.SelectedItems[0];
|
||||
ShortcutKey shortcutKey = selectedItem as ShortcutKey;
|
||||
if (shortcutKey == null)
|
||||
{
|
||||
bool isItemSelected = lstKeyboardShortcuts.SelectedItems.Count == 1;
|
||||
return ;
|
||||
}
|
||||
|
||||
btnDeleteKeyboardShortcut.Enabled = isItemSelected;
|
||||
grpModifyKeyboardShortcut.Enabled = isItemSelected;
|
||||
hotModifyKeyboardShortcut.Enabled = isItemSelected;
|
||||
Keys keysValue = System.Windows.Forms.Keys.A;
|
||||
Keys keyCode = System.Windows.Forms.Keys.A;
|
||||
Keys modifiers = System.Windows.Forms.Keys.A;
|
||||
|
||||
if (!isItemSelected)
|
||||
{
|
||||
hotModifyKeyboardShortcut.Text = string.Empty;
|
||||
return ;
|
||||
}
|
||||
|
||||
object selectedItem = lstKeyboardShortcuts.SelectedItems[0];
|
||||
ShortcutKey shortcutKey = selectedItem as ShortcutKey;
|
||||
_ignoreKeyboardShortcutTextChanged = true;
|
||||
hotModifyKeyboardShortcut.KeyCode = keyCode;
|
||||
hotModifyKeyboardShortcut.HotkeyModifiers = modifiers;
|
||||
_ignoreKeyboardShortcutTextChanged = false;
|
||||
}
|
||||
|
||||
public void btnNewKeyboardShortcut_Click(System.Object sender, EventArgs e)
|
||||
{
|
||||
foreach (object item in lstKeyboardShortcuts.Items)
|
||||
{
|
||||
ShortcutKey shortcutKey = item as ShortcutKey;
|
||||
if (shortcutKey == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (shortcutKey == 0)
|
||||
{
|
||||
lstKeyboardShortcuts.SelectedItem = item;
|
||||
return ;
|
||||
}
|
||||
|
||||
Keys keysValue = System.Windows.Forms.Keys.A;
|
||||
Keys keyCode = System.Windows.Forms.Keys.A;
|
||||
Keys modifiers = System.Windows.Forms.Keys.A;
|
||||
|
||||
_ignoreKeyboardShortcutTextChanged = true;
|
||||
hotModifyKeyboardShortcut.KeyCode = keyCode;
|
||||
hotModifyKeyboardShortcut.HotkeyModifiers = modifiers;
|
||||
_ignoreKeyboardShortcutTextChanged = false;
|
||||
}
|
||||
|
||||
public void btnNewKeyboardShortcut_Click(System.Object sender, EventArgs e)
|
||||
{
|
||||
foreach (object item in lstKeyboardShortcuts.Items)
|
||||
{
|
||||
ShortcutKey shortcutKey = item as ShortcutKey;
|
||||
if (shortcutKey == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (shortcutKey == 0)
|
||||
{
|
||||
lstKeyboardShortcuts.SelectedItem = item;
|
||||
return ;
|
||||
}
|
||||
}
|
||||
|
||||
lstKeyboardShortcuts.SelectedIndex = lstKeyboardShortcuts.Items.Add(new ShortcutKey(Keys.None));
|
||||
hotModifyKeyboardShortcut.Focus();
|
||||
}
|
||||
|
||||
public void btnDeleteKeyboardShortcut_Click(System.Object sender, EventArgs e)
|
||||
{
|
||||
int selectedIndex = lstKeyboardShortcuts.SelectedIndex;
|
||||
|
||||
ShortcutCommand command = (ShortcutCommand) (GetSelectedShortcutCommand());
|
||||
ShortcutKey key = lstKeyboardShortcuts.SelectedItem as ShortcutKey;
|
||||
if (!(command == ShortcutCommand.None) & key != null)
|
||||
{
|
||||
_keyboardShortcutMap.Remove(GetSelectedShortcutCommand(), key);
|
||||
}
|
||||
|
||||
lstKeyboardShortcuts.Items.Remove(lstKeyboardShortcuts.SelectedItem);
|
||||
|
||||
if (selectedIndex >= lstKeyboardShortcuts.Items.Count)
|
||||
{
|
||||
selectedIndex = lstKeyboardShortcuts.Items.Count - 1;
|
||||
}
|
||||
lstKeyboardShortcuts.SelectedIndex = selectedIndex;
|
||||
}
|
||||
|
||||
public void btnResetAllKeyboardShortcuts_Click(System.Object sender, EventArgs e)
|
||||
{
|
||||
_keyboardShortcutMap = KeyboardShortcuts.DefaultMap.Clone();
|
||||
lvKeyboardCommands_SelectedIndexChanged(this, new EventArgs());
|
||||
}
|
||||
|
||||
public void btnResetKeyboardShortcuts_Click(System.Object sender, EventArgs e)
|
||||
{
|
||||
ShortcutCommand command = (ShortcutCommand) (GetSelectedShortcutCommand());
|
||||
if (command == ShortcutCommand.None)
|
||||
{
|
||||
return ;
|
||||
}
|
||||
_keyboardShortcutMap.SetShortcutKeys(command, KeyboardShortcuts.DefaultMap.GetShortcutKeys(command));
|
||||
lvKeyboardCommands_SelectedIndexChanged(this, new EventArgs());
|
||||
}
|
||||
|
||||
public void hotModifyKeyboardShortcut_TextChanged(System.Object sender, EventArgs e)
|
||||
{
|
||||
if (_ignoreKeyboardShortcutTextChanged || lstKeyboardShortcuts.SelectedIndex < 0 | lstKeyboardShortcuts.SelectedIndex >= lstKeyboardShortcuts.Items.Count)
|
||||
{
|
||||
return ;
|
||||
}
|
||||
|
||||
Keys keysValue = System.Windows.Forms.Keys.A;
|
||||
|
||||
bool hadFocus = hotModifyKeyboardShortcut.ContainsFocus;
|
||||
|
||||
ShortcutCommand command = (ShortcutCommand) (GetSelectedShortcutCommand());
|
||||
ShortcutKey newShortcutKey = new ShortcutKey(keysValue);
|
||||
|
||||
if (!(command == ShortcutCommand.None))
|
||||
{
|
||||
ShortcutKey oldShortcutKey = lstKeyboardShortcuts.SelectedItem as ShortcutKey;
|
||||
if (oldShortcutKey != null)
|
||||
{
|
||||
_keyboardShortcutMap.Remove(command, oldShortcutKey);
|
||||
}
|
||||
_keyboardShortcutMap.Add(command, newShortcutKey);
|
||||
}
|
||||
|
||||
lstKeyboardShortcuts.Items[lstKeyboardShortcuts.SelectedIndex] = newShortcutKey;
|
||||
|
||||
if (hadFocus)
|
||||
{
|
||||
hotModifyKeyboardShortcut.Focus();
|
||||
hotModifyKeyboardShortcut.Select(hotModifyKeyboardShortcut.TextLength, 0);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
private ShortcutCommand GetSelectedShortcutCommand()
|
||||
{
|
||||
if (!(lvKeyboardCommands.SelectedItems.Count == 1))
|
||||
{
|
||||
return ShortcutCommand.None;
|
||||
}
|
||||
|
||||
ListViewItem selectedItem = lvKeyboardCommands.SelectedItems[0];
|
||||
if (selectedItem == _previousTabListViewItem)
|
||||
{
|
||||
return ShortcutCommand.PreviousTab;
|
||||
}
|
||||
else if (selectedItem == _nextTabListViewItem)
|
||||
{
|
||||
return ShortcutCommand.NextTab;
|
||||
}
|
||||
}
|
||||
|
||||
private void EnableKeyboardShortcutControls(bool enable = true)
|
||||
{
|
||||
lblKeyboardCommand.Visible = enable;
|
||||
lblKeyboardShortcuts.Enabled = enable;
|
||||
lstKeyboardShortcuts.Enabled = enable;
|
||||
btnNewKeyboardShortcut.Enabled = enable;
|
||||
btnResetKeyboardShortcuts.Enabled = enable;
|
||||
|
||||
if (!enable)
|
||||
{
|
||||
btnDeleteKeyboardShortcut.Enabled = false;
|
||||
grpModifyKeyboardShortcut.Enabled = false;
|
||||
hotModifyKeyboardShortcut.Enabled = false;
|
||||
|
||||
lstKeyboardShortcuts.Items.Clear();
|
||||
hotModifyKeyboardShortcut.Text = string.Empty;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
lstKeyboardShortcuts.SelectedIndex = lstKeyboardShortcuts.Items.Add(new ShortcutKey(Keys.None));
|
||||
hotModifyKeyboardShortcut.Focus();
|
||||
}
|
||||
|
||||
public void btnDeleteKeyboardShortcut_Click(System.Object sender, EventArgs e)
|
||||
{
|
||||
int selectedIndex = lstKeyboardShortcuts.SelectedIndex;
|
||||
|
||||
ShortcutCommand command = (ShortcutCommand) (GetSelectedShortcutCommand());
|
||||
ShortcutKey key = lstKeyboardShortcuts.SelectedItem as ShortcutKey;
|
||||
if (!(command == ShortcutCommand.None) & key != null)
|
||||
{
|
||||
_keyboardShortcutMap.Remove(GetSelectedShortcutCommand(), key);
|
||||
}
|
||||
|
||||
lstKeyboardShortcuts.Items.Remove(lstKeyboardShortcuts.SelectedItem);
|
||||
|
||||
if (selectedIndex >= lstKeyboardShortcuts.Items.Count)
|
||||
{
|
||||
selectedIndex = lstKeyboardShortcuts.Items.Count - 1;
|
||||
}
|
||||
lstKeyboardShortcuts.SelectedIndex = selectedIndex;
|
||||
}
|
||||
|
||||
public void btnResetAllKeyboardShortcuts_Click(System.Object sender, EventArgs e)
|
||||
{
|
||||
_keyboardShortcutMap = KeyboardShortcuts.DefaultMap.Clone();
|
||||
lvKeyboardCommands_SelectedIndexChanged(this, new EventArgs());
|
||||
}
|
||||
|
||||
public void btnResetKeyboardShortcuts_Click(System.Object sender, EventArgs e)
|
||||
{
|
||||
ShortcutCommand command = (ShortcutCommand) (GetSelectedShortcutCommand());
|
||||
if (command == ShortcutCommand.None)
|
||||
{
|
||||
return ;
|
||||
}
|
||||
_keyboardShortcutMap.SetShortcutKeys(command, KeyboardShortcuts.DefaultMap.GetShortcutKeys(command));
|
||||
lvKeyboardCommands_SelectedIndexChanged(this, new EventArgs());
|
||||
}
|
||||
|
||||
public void hotModifyKeyboardShortcut_TextChanged(System.Object sender, EventArgs e)
|
||||
{
|
||||
if (_ignoreKeyboardShortcutTextChanged || lstKeyboardShortcuts.SelectedIndex < 0 | lstKeyboardShortcuts.SelectedIndex >= lstKeyboardShortcuts.Items.Count)
|
||||
{
|
||||
return ;
|
||||
}
|
||||
|
||||
Keys keysValue = System.Windows.Forms.Keys.A;
|
||||
|
||||
bool hadFocus = hotModifyKeyboardShortcut.ContainsFocus;
|
||||
|
||||
ShortcutCommand command = (ShortcutCommand) (GetSelectedShortcutCommand());
|
||||
ShortcutKey newShortcutKey = new ShortcutKey(keysValue);
|
||||
|
||||
if (!(command == ShortcutCommand.None))
|
||||
{
|
||||
ShortcutKey oldShortcutKey = lstKeyboardShortcuts.SelectedItem as ShortcutKey;
|
||||
if (oldShortcutKey != null)
|
||||
{
|
||||
_keyboardShortcutMap.Remove(command, oldShortcutKey);
|
||||
}
|
||||
_keyboardShortcutMap.Add(command, newShortcutKey);
|
||||
}
|
||||
|
||||
lstKeyboardShortcuts.Items[lstKeyboardShortcuts.SelectedIndex] = newShortcutKey;
|
||||
|
||||
if (hadFocus)
|
||||
{
|
||||
hotModifyKeyboardShortcut.Focus();
|
||||
hotModifyKeyboardShortcut.Select(hotModifyKeyboardShortcut.TextLength, 0);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
private ShortcutCommand GetSelectedShortcutCommand()
|
||||
{
|
||||
if (!(lvKeyboardCommands.SelectedItems.Count == 1))
|
||||
{
|
||||
return ShortcutCommand.None;
|
||||
}
|
||||
|
||||
ListViewItem selectedItem = lvKeyboardCommands.SelectedItems[0];
|
||||
if (selectedItem == _previousTabListViewItem)
|
||||
{
|
||||
return ShortcutCommand.PreviousTab;
|
||||
}
|
||||
else if (selectedItem == _nextTabListViewItem)
|
||||
{
|
||||
return ShortcutCommand.NextTab;
|
||||
}
|
||||
}
|
||||
|
||||
private void EnableKeyboardShortcutControls(bool enable = true)
|
||||
{
|
||||
lblKeyboardCommand.Visible = enable;
|
||||
lblKeyboardShortcuts.Enabled = enable;
|
||||
lstKeyboardShortcuts.Enabled = enable;
|
||||
btnNewKeyboardShortcut.Enabled = enable;
|
||||
btnResetKeyboardShortcuts.Enabled = enable;
|
||||
|
||||
if (!enable)
|
||||
{
|
||||
btnDeleteKeyboardShortcut.Enabled = false;
|
||||
grpModifyKeyboardShortcut.Enabled = false;
|
||||
hotModifyKeyboardShortcut.Enabled = false;
|
||||
|
||||
lstKeyboardShortcuts.Items.Clear();
|
||||
hotModifyKeyboardShortcut.Text = string.Empty;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,3 @@
|
||||
// VBConversions Note: VB project level imports
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using AxWFICALib;
|
||||
@@ -9,153 +8,151 @@ using AxMSTSCLib;
|
||||
using Microsoft.VisualBasic;
|
||||
using System.Collections;
|
||||
using System.Windows.Forms;
|
||||
// End of VB project level imports
|
||||
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
|
||||
namespace mRemoteNG.Tools
|
||||
{
|
||||
public class WindowPlacement
|
||||
{
|
||||
#region Windows API
|
||||
#region Functions
|
||||
[DllImport("user32", ExactSpelling=true, CharSet=CharSet.Ansi, SetLastError=true)]
|
||||
private static extern bool GetWindowPlacement(System.IntPtr hWnd, ref WINDOWPLACEMENT lpwndpl);
|
||||
[DllImport("user32", ExactSpelling=true, CharSet=CharSet.Ansi, SetLastError=true)]
|
||||
private static extern bool SetWindowPlacement(System.IntPtr hWnd, ref WINDOWPLACEMENT lpwndpl);
|
||||
#endregion
|
||||
|
||||
#region Structures
|
||||
private struct WINDOWPLACEMENT
|
||||
{
|
||||
#region Windows API
|
||||
#region Functions
|
||||
[DllImport("user32", ExactSpelling=true, CharSet=CharSet.Ansi, SetLastError=true)]
|
||||
private static extern bool GetWindowPlacement(System.IntPtr hWnd, ref WINDOWPLACEMENT lpwndpl);
|
||||
[DllImport("user32", ExactSpelling=true, CharSet=CharSet.Ansi, SetLastError=true)]
|
||||
private static extern bool SetWindowPlacement(System.IntPtr hWnd, ref WINDOWPLACEMENT lpwndpl);
|
||||
#endregion
|
||||
|
||||
#region Structures
|
||||
private struct WINDOWPLACEMENT
|
||||
{
|
||||
public UInt32 length;
|
||||
public UInt32 flags;
|
||||
public UInt32 showCmd;
|
||||
public POINT ptMinPosition;
|
||||
public POINT ptMaxPosition;
|
||||
public RECT rcNormalPosition;
|
||||
}
|
||||
|
||||
private struct POINT
|
||||
{
|
||||
public long x;
|
||||
public long y;
|
||||
}
|
||||
|
||||
private struct RECT
|
||||
{
|
||||
public long left;
|
||||
public long top;
|
||||
public long right;
|
||||
public long bottom;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Constants
|
||||
// WINDOWPLACEMENT.flags values
|
||||
private const UInt32 WPF_SETMINPOSITION = 0x1;
|
||||
private const UInt32 WPF_RESTORETOMAXIMIZED = 0x2;
|
||||
private const UInt32 WPF_ASYNCWINDOWPLACEMENT = 0x4;
|
||||
|
||||
// WINDOWPLACEMENT.showCmd values
|
||||
private const UInt32 SW_HIDE = 0;
|
||||
private const UInt32 SW_SHOWNORMAL = 1;
|
||||
private const UInt32 SW_SHOWMINIMIZED = 2;
|
||||
private const UInt32 SW_SHOWMAXIMIZED = 3;
|
||||
private const UInt32 SW_MAXIMIZE = 3;
|
||||
private const UInt32 SW_SHOWNOACTIVATE = 4;
|
||||
private const UInt32 SW_SHOW = 5;
|
||||
private const UInt32 SW_MINIMIZE = 6;
|
||||
private const UInt32 SW_SHOWMINNOACTIVE = 7;
|
||||
private const UInt32 SW_SHOWNA = 8;
|
||||
private const UInt32 SW_RESTORE = 9;
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region Private Variables
|
||||
private Windows.Forms.Form _form;
|
||||
#endregion
|
||||
|
||||
#region Constructors/Destructors
|
||||
public WindowPlacement(Windows.Forms.Form form)
|
||||
{
|
||||
_form = form;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Public Properties
|
||||
public Windows.Forms.Form Form
|
||||
{
|
||||
get
|
||||
{
|
||||
return _form;
|
||||
}
|
||||
set
|
||||
{
|
||||
_form = value;
|
||||
}
|
||||
}
|
||||
|
||||
public bool RestoreToMaximized
|
||||
{
|
||||
get
|
||||
{
|
||||
WINDOWPLACEMENT windowPlacement = GetWindowPlacement();
|
||||
return windowPlacement.flags & WPF_RESTORETOMAXIMIZED;
|
||||
}
|
||||
set
|
||||
{
|
||||
WINDOWPLACEMENT windowPlacement = GetWindowPlacement();
|
||||
if (value)
|
||||
{
|
||||
windowPlacement.flags = windowPlacement.flags | WPF_RESTORETOMAXIMIZED;
|
||||
}
|
||||
else
|
||||
{
|
||||
windowPlacement.flags = windowPlacement.flags & ~WPF_RESTORETOMAXIMIZED;
|
||||
}
|
||||
SetWindowPlacement(windowPlacement);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Private Functions
|
||||
private WINDOWPLACEMENT GetWindowPlacement()
|
||||
{
|
||||
if (_form == null)
|
||||
{
|
||||
throw (new System.NullReferenceException("WindowPlacement.Form is not set."));
|
||||
}
|
||||
WINDOWPLACEMENT windowPlacement = new WINDOWPLACEMENT();
|
||||
windowPlacement.length = Marshal.SizeOf(windowPlacement);
|
||||
try
|
||||
{
|
||||
GetWindowPlacement(_form.Handle, ref windowPlacement);
|
||||
return windowPlacement;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
private bool SetWindowPlacement(WINDOWPLACEMENT windowPlacement)
|
||||
{
|
||||
if (_form == null)
|
||||
{
|
||||
throw (new System.NullReferenceException("WindowPlacement.Form is not set."));
|
||||
}
|
||||
windowPlacement.length = Marshal.SizeOf(windowPlacement);
|
||||
try
|
||||
{
|
||||
return SetWindowPlacement(_form.Handle, ref windowPlacement);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
public UInt32 length;
|
||||
public UInt32 flags;
|
||||
public UInt32 showCmd;
|
||||
public POINT ptMinPosition;
|
||||
public POINT ptMaxPosition;
|
||||
public RECT rcNormalPosition;
|
||||
}
|
||||
|
||||
private struct POINT
|
||||
{
|
||||
public long x;
|
||||
public long y;
|
||||
}
|
||||
|
||||
private struct RECT
|
||||
{
|
||||
public long left;
|
||||
public long top;
|
||||
public long right;
|
||||
public long bottom;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Constants
|
||||
// WINDOWPLACEMENT.flags values
|
||||
private const UInt32 WPF_SETMINPOSITION = 0x1;
|
||||
private const UInt32 WPF_RESTORETOMAXIMIZED = 0x2;
|
||||
private const UInt32 WPF_ASYNCWINDOWPLACEMENT = 0x4;
|
||||
|
||||
// WINDOWPLACEMENT.showCmd values
|
||||
private const UInt32 SW_HIDE = 0;
|
||||
private const UInt32 SW_SHOWNORMAL = 1;
|
||||
private const UInt32 SW_SHOWMINIMIZED = 2;
|
||||
private const UInt32 SW_SHOWMAXIMIZED = 3;
|
||||
private const UInt32 SW_MAXIMIZE = 3;
|
||||
private const UInt32 SW_SHOWNOACTIVATE = 4;
|
||||
private const UInt32 SW_SHOW = 5;
|
||||
private const UInt32 SW_MINIMIZE = 6;
|
||||
private const UInt32 SW_SHOWMINNOACTIVE = 7;
|
||||
private const UInt32 SW_SHOWNA = 8;
|
||||
private const UInt32 SW_RESTORE = 9;
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region Private Variables
|
||||
private Form _form;
|
||||
#endregion
|
||||
|
||||
#region Constructors/Destructors
|
||||
public WindowPlacement(Form form)
|
||||
{
|
||||
_form = form;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Public Properties
|
||||
public Form Form
|
||||
{
|
||||
get
|
||||
{
|
||||
return _form;
|
||||
}
|
||||
set
|
||||
{
|
||||
_form = value;
|
||||
}
|
||||
}
|
||||
|
||||
public bool RestoreToMaximized
|
||||
{
|
||||
get
|
||||
{
|
||||
WINDOWPLACEMENT windowPlacement = GetWindowPlacement();
|
||||
return windowPlacement.flags & WPF_RESTORETOMAXIMIZED;
|
||||
}
|
||||
set
|
||||
{
|
||||
WINDOWPLACEMENT windowPlacement = GetWindowPlacement();
|
||||
if (value)
|
||||
{
|
||||
windowPlacement.flags = windowPlacement.flags | WPF_RESTORETOMAXIMIZED;
|
||||
}
|
||||
else
|
||||
{
|
||||
windowPlacement.flags = windowPlacement.flags & ~WPF_RESTORETOMAXIMIZED;
|
||||
}
|
||||
SetWindowPlacement(windowPlacement);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Private Functions
|
||||
private WINDOWPLACEMENT GetWindowPlacement()
|
||||
{
|
||||
if (_form == null)
|
||||
{
|
||||
throw (new System.NullReferenceException("WindowPlacement.Form is not set."));
|
||||
}
|
||||
WINDOWPLACEMENT windowPlacement = new WINDOWPLACEMENT();
|
||||
windowPlacement.length = (uint)Marshal.SizeOf(windowPlacement);
|
||||
try
|
||||
{
|
||||
GetWindowPlacement(_form.Handle, ref windowPlacement);
|
||||
return windowPlacement;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
private bool SetWindowPlacement(WINDOWPLACEMENT windowPlacement)
|
||||
{
|
||||
if (_form == null)
|
||||
{
|
||||
throw (new System.NullReferenceException("WindowPlacement.Form is not set."));
|
||||
}
|
||||
windowPlacement.length = (uint)Marshal.SizeOf(windowPlacement);
|
||||
try
|
||||
{
|
||||
return SetWindowPlacement(_form.Handle, ref windowPlacement);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,7 +93,6 @@
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.VisualBasic" />
|
||||
<Reference Include="mscorlib" />
|
||||
<Reference Include="C:\Users\vsparda\Documents\Repositories\mRemoteNG_MyFork\SharedLibraryNG\bin\Debug\SharedLibraryNG.dll" />
|
||||
<Reference Include="ADTree, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>References\ADTree.dll</HintPath>
|
||||
@@ -281,9 +280,7 @@
|
||||
<Compile Include="Connection\Connection.InterfaceControl.Designer.cs">
|
||||
<DependentUpon>Connection.InterfaceControl.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Connection\Connection.InterfaceControl.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Connection\Connection.InterfaceControl.cs" />
|
||||
<Compile Include="Connection\Connection.List.cs" />
|
||||
<Compile Include="Connection\Connection.Protocol.Base.cs" />
|
||||
<Compile Include="Connection\Connection.Protocol.HTTP.cs" />
|
||||
@@ -372,15 +369,21 @@
|
||||
<Compile Include="Tools\Tools.SystemMenu.cs" />
|
||||
<Compile Include="Tools\Tools.WindowPlacement.cs" />
|
||||
<Compile Include="Tree\Tree.Node.cs" />
|
||||
<Compile Include="UI\UI.Window.About.cs" />
|
||||
<Compile Include="UI\UI.Window.About.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="UI\UI.Window.ActiveDirectoryImport.Designer.cs">
|
||||
<DependentUpon>UI.Window.ActiveDirectoryImport.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="UI\UI.Window.ActiveDirectoryImport.cs" />
|
||||
<Compile Include="UI\UI.Window.ActiveDirectoryImport.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="UI\UI.Window.Announcement.Designer.cs">
|
||||
<DependentUpon>UI.Window.Announcement.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="UI\UI.Window.Announcement.cs" />
|
||||
<Compile Include="UI\UI.Window.Announcement.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="UI\UI.Window.Base.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
@@ -390,7 +393,9 @@
|
||||
<Compile Include="UI\UI.Window.Config.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="UI\UI.Window.Connection.cs" />
|
||||
<Compile Include="UI\UI.Window.Connection.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="UI\UI.Window.ErrorsAndInfos.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
@@ -1159,7 +1164,12 @@
|
||||
<Isolated>False</Isolated>
|
||||
</COMReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\SharedLibraryNG\SharedLibraryNG.csproj">
|
||||
<Project>{0f615504-5f30-4cf2-8341-1de7fec95a23}</Project>
|
||||
<Name>SharedLibraryNG</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.VisualBasic" />
|
||||
<Reference Include="mscorlib" />
|
||||
|
||||
@@ -1,9 +1,14 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 2013
|
||||
VisualStudioVersion = 12.0.40629.0
|
||||
VisualStudioVersion = 12.0.31101.0
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "mRemoteV1", "mRemoteV1.csproj", "{4934A491-40BC-4E5B-9166-EA1169A220F6}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{0F615504-5F30-4CF2-8341-1DE7FEC95A23} = {0F615504-5F30-4CF2-8341-1DE7FEC95A23}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SharedLibraryNG", "..\..\SharedLibraryNG\SharedLibraryNG.csproj", "{0F615504-5F30-4CF2-8341-1DE7FEC95A23}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
@@ -21,6 +26,14 @@ Global
|
||||
{4934A491-40BC-4E5B-9166-EA1169A220F6}.Release Portable|Any CPU.Build.0 = Release Portable|Any CPU
|
||||
{4934A491-40BC-4E5B-9166-EA1169A220F6}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{4934A491-40BC-4E5B-9166-EA1169A220F6}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{0F615504-5F30-4CF2-8341-1DE7FEC95A23}.Debug Portable|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{0F615504-5F30-4CF2-8341-1DE7FEC95A23}.Debug Portable|Any CPU.Build.0 = Debug|Any CPU
|
||||
{0F615504-5F30-4CF2-8341-1DE7FEC95A23}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{0F615504-5F30-4CF2-8341-1DE7FEC95A23}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{0F615504-5F30-4CF2-8341-1DE7FEC95A23}.Release Portable|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{0F615504-5F30-4CF2-8341-1DE7FEC95A23}.Release Portable|Any CPU.Build.0 = Release|Any CPU
|
||||
{0F615504-5F30-4CF2-8341-1DE7FEC95A23}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{0F615504-5F30-4CF2-8341-1DE7FEC95A23}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -73,3 +73,63 @@ C:\Users\vsparda\Documents\Repositories\mRemoteNG_MyFork\mRemoteV1\CS\obj\Debug
|
||||
C:\Users\vsparda\Documents\Repositories\mRemoteNG_MyFork\mRemoteV1\CS\obj\Debug Portable\mRemoteNG.UI.Window.Tree.resources
|
||||
C:\Users\vsparda\Documents\Repositories\mRemoteNG_MyFork\mRemoteV1\CS\obj\Debug Portable\mRemoteNG.UI.Window.UltraVNCSC.resources
|
||||
C:\Users\vsparda\Documents\Repositories\mRemoteNG_MyFork\mRemoteV1\CS\obj\Debug Portable\mRemoteNG.UI.Window.Update.resources
|
||||
C:\Users\David\Documents\Repositories\mRemoteNG_MyFork\mRemoteV1\CS\bin\Debug Portable\mRemoteNG.exe.config
|
||||
C:\Users\David\Documents\Repositories\mRemoteNG_MyFork\mRemoteV1\CS\obj\Debug Portable\Interop.EOLWTSCOM.dll
|
||||
C:\Users\David\Documents\Repositories\mRemoteNG_MyFork\mRemoteV1\CS\obj\Debug Portable\Interop.MSTSCLib.dll
|
||||
C:\Users\David\Documents\Repositories\mRemoteNG_MyFork\mRemoteV1\CS\obj\Debug Portable\Interop.SHDocVw.dll
|
||||
C:\Users\David\Documents\Repositories\mRemoteNG_MyFork\mRemoteV1\CS\obj\Debug Portable\Interop.WFICALib.dll
|
||||
C:\Users\David\Documents\Repositories\mRemoteNG_MyFork\mRemoteV1\CS\obj\Debug Portable\AxInterop.MSTSCLib.dll
|
||||
C:\Users\David\Documents\Repositories\mRemoteNG_MyFork\mRemoteV1\CS\obj\Debug Portable\AxInterop.WFICALib.dll
|
||||
C:\Users\David\Documents\Repositories\mRemoteNG_MyFork\mRemoteV1\CS\obj\Debug Portable\mRemoteV1.csproj.ResolveComReference.cache
|
||||
C:\Users\David\Documents\Repositories\mRemoteNG_MyFork\mRemoteV1\CS\obj\Debug Portable\mRemoteV1.csprojResolveAssemblyReference.cache
|
||||
C:\Users\David\Documents\Repositories\mRemoteNG_MyFork\mRemoteV1\CS\obj\Debug Portable\mRemoteNG.frmChoosePanel.resources
|
||||
C:\Users\David\Documents\Repositories\mRemoteNG_MyFork\mRemoteV1\CS\obj\Debug Portable\mRemoteNG.frmMain.resources
|
||||
C:\Users\David\Documents\Repositories\mRemoteNG_MyFork\mRemoteV1\CS\obj\Debug Portable\mRemoteNG.Forms.PasswordForm.resources
|
||||
C:\Users\David\Documents\Repositories\mRemoteNG_MyFork\mRemoteV1\CS\obj\Debug Portable\mRemoteNG.Forms.OptionsPages.AdvancedPage.resources
|
||||
C:\Users\David\Documents\Repositories\mRemoteNG_MyFork\mRemoteV1\CS\obj\Debug Portable\mRemoteNG.Forms.OptionsPages.AppearancePage.resources
|
||||
C:\Users\David\Documents\Repositories\mRemoteNG_MyFork\mRemoteV1\CS\obj\Debug Portable\mRemoteNG.Forms.OptionsPages.ConnectionsPage.resources
|
||||
C:\Users\David\Documents\Repositories\mRemoteNG_MyFork\mRemoteV1\CS\obj\Debug Portable\mRemoteNG.Forms.OptionsForm.resources
|
||||
C:\Users\David\Documents\Repositories\mRemoteNG_MyFork\mRemoteV1\CS\obj\Debug Portable\mRemoteNG.Forms.OptionsPages.KeyboardPage.resources
|
||||
C:\Users\David\Documents\Repositories\mRemoteNG_MyFork\mRemoteV1\CS\obj\Debug Portable\mRemoteNG.Forms.OptionsPages.SqlServerPage.resources
|
||||
C:\Users\David\Documents\Repositories\mRemoteNG_MyFork\mRemoteV1\CS\obj\Debug Portable\mRemoteNG.Forms.OptionsPages.StartupExitPage.resources
|
||||
C:\Users\David\Documents\Repositories\mRemoteNG_MyFork\mRemoteV1\CS\obj\Debug Portable\mRemoteNG.Forms.OptionsPages.TabsPanelsPage.resources
|
||||
C:\Users\David\Documents\Repositories\mRemoteNG_MyFork\mRemoteV1\CS\obj\Debug Portable\mRemoteNG.Forms.OptionsPages.ThemePage.resources
|
||||
C:\Users\David\Documents\Repositories\mRemoteNG_MyFork\mRemoteV1\CS\obj\Debug Portable\mRemoteNG.Forms.OptionsPages.UpdatesPage.resources
|
||||
C:\Users\David\Documents\Repositories\mRemoteNG_MyFork\mRemoteV1\CS\obj\Debug Portable\mRemoteNG.Language.Language.resources
|
||||
C:\Users\David\Documents\Repositories\mRemoteNG_MyFork\mRemoteV1\CS\obj\Debug Portable\mRemoteNG.Properties.Resources.resources
|
||||
C:\Users\David\Documents\Repositories\mRemoteNG_MyFork\mRemoteV1\CS\obj\Debug Portable\mRemoteNG.ReconnectGroup.resources
|
||||
C:\Users\David\Documents\Repositories\mRemoteNG_MyFork\mRemoteV1\CS\obj\Debug Portable\mRemoteNG.UI.Window.About.resources
|
||||
C:\Users\David\Documents\Repositories\mRemoteNG_MyFork\mRemoteV1\CS\obj\Debug Portable\mRemoteNG.UI.Window.ActiveDirectoryImport.resources
|
||||
C:\Users\David\Documents\Repositories\mRemoteNG_MyFork\mRemoteV1\CS\obj\Debug Portable\mRemoteNG.UI.Window.Announcement.resources
|
||||
C:\Users\David\Documents\Repositories\mRemoteNG_MyFork\mRemoteV1\CS\obj\Debug Portable\mRemoteNG.UI.Window.ComponentsCheck.resources
|
||||
C:\Users\David\Documents\Repositories\mRemoteNG_MyFork\mRemoteV1\CS\obj\Debug Portable\mRemoteNG.UI.Window.Config.resources
|
||||
C:\Users\David\Documents\Repositories\mRemoteNG_MyFork\mRemoteV1\CS\obj\Debug Portable\mRemoteNG.UI.Window.Connection.resources
|
||||
C:\Users\David\Documents\Repositories\mRemoteNG_MyFork\mRemoteV1\CS\obj\Debug Portable\mRemoteNG.UI.Window.ErrorsAndInfos.resources
|
||||
C:\Users\David\Documents\Repositories\mRemoteNG_MyFork\mRemoteV1\CS\obj\Debug Portable\mRemoteNG.UI.Window.ExternalTools.resources
|
||||
C:\Users\David\Documents\Repositories\mRemoteNG_MyFork\mRemoteV1\CS\obj\Debug Portable\mRemoteNG.UI.Window.Help.resources
|
||||
C:\Users\David\Documents\Repositories\mRemoteNG_MyFork\mRemoteV1\CS\obj\Debug Portable\mRemoteNG.UI.Window.PortScan.resources
|
||||
C:\Users\David\Documents\Repositories\mRemoteNG_MyFork\mRemoteV1\CS\obj\Debug Portable\mRemoteNG.Forms.ExportForm.resources
|
||||
C:\Users\David\Documents\Repositories\mRemoteNG_MyFork\mRemoteV1\CS\obj\Debug Portable\mRemoteNG.UI.Window.ScreenshotManager.resources
|
||||
C:\Users\David\Documents\Repositories\mRemoteNG_MyFork\mRemoteV1\CS\obj\Debug Portable\mRemoteNG.UI.Window.Sessions.resources
|
||||
C:\Users\David\Documents\Repositories\mRemoteNG_MyFork\mRemoteV1\CS\obj\Debug Portable\mRemoteNG.UI.Window.SSHTransfer.resources
|
||||
C:\Users\David\Documents\Repositories\mRemoteNG_MyFork\mRemoteV1\CS\obj\Debug Portable\mRemoteNG.UI.Window.Tree.resources
|
||||
C:\Users\David\Documents\Repositories\mRemoteNG_MyFork\mRemoteV1\CS\obj\Debug Portable\mRemoteNG.UI.Window.UltraVNCSC.resources
|
||||
C:\Users\David\Documents\Repositories\mRemoteNG_MyFork\mRemoteV1\CS\obj\Debug Portable\mRemoteNG.UI.Window.Update.resources
|
||||
C:\Users\David\Documents\Repositories\mRemoteNG_MyFork\mRemoteV1\CS\obj\Debug Portable\mRemoteNG.Language.Language.de.resources
|
||||
C:\Users\David\Documents\Repositories\mRemoteNG_MyFork\mRemoteV1\CS\obj\Debug Portable\mRemoteNG.Language.Language.el.resources
|
||||
C:\Users\David\Documents\Repositories\mRemoteNG_MyFork\mRemoteV1\CS\obj\Debug Portable\mRemoteNG.Language.Language.en-US.resources
|
||||
C:\Users\David\Documents\Repositories\mRemoteNG_MyFork\mRemoteV1\CS\obj\Debug Portable\mRemoteNG.Language.Language.es-AR.resources
|
||||
C:\Users\David\Documents\Repositories\mRemoteNG_MyFork\mRemoteV1\CS\obj\Debug Portable\mRemoteNG.Language.Language.es.resources
|
||||
C:\Users\David\Documents\Repositories\mRemoteNG_MyFork\mRemoteV1\CS\obj\Debug Portable\mRemoteNG.Language.Language.hu.resources
|
||||
C:\Users\David\Documents\Repositories\mRemoteNG_MyFork\mRemoteV1\CS\obj\Debug Portable\mRemoteNG.Language.Language.it.resources
|
||||
C:\Users\David\Documents\Repositories\mRemoteNG_MyFork\mRemoteV1\CS\obj\Debug Portable\mRemoteNG.Language.Language.nb-NO.resources
|
||||
C:\Users\David\Documents\Repositories\mRemoteNG_MyFork\mRemoteV1\CS\obj\Debug Portable\mRemoteNG.Language.Language.nl.resources
|
||||
C:\Users\David\Documents\Repositories\mRemoteNG_MyFork\mRemoteV1\CS\obj\Debug Portable\mRemoteNG.Language.Language.pt-BR.resources
|
||||
C:\Users\David\Documents\Repositories\mRemoteNG_MyFork\mRemoteV1\CS\obj\Debug Portable\mRemoteNG.Language.Language.pt.resources
|
||||
C:\Users\David\Documents\Repositories\mRemoteNG_MyFork\mRemoteV1\CS\obj\Debug Portable\mRemoteNG.Language.Language.fr.resources
|
||||
C:\Users\David\Documents\Repositories\mRemoteNG_MyFork\mRemoteV1\CS\obj\Debug Portable\mRemoteNG.Language.Language.pl.resources
|
||||
C:\Users\David\Documents\Repositories\mRemoteNG_MyFork\mRemoteV1\CS\obj\Debug Portable\mRemoteNG.Language.Language.ru.resources
|
||||
C:\Users\David\Documents\Repositories\mRemoteNG_MyFork\mRemoteV1\CS\obj\Debug Portable\mRemoteNG.Language.Language.uk.resources
|
||||
C:\Users\David\Documents\Repositories\mRemoteNG_MyFork\mRemoteV1\CS\obj\Debug Portable\mRemoteNG.Language.Language.zh-CN.resources
|
||||
C:\Users\David\Documents\Repositories\mRemoteNG_MyFork\mRemoteV1\CS\obj\Debug Portable\mRemoteNG.Language.Language.zh-TW.resources
|
||||
C:\Users\David\Documents\Repositories\mRemoteNG_MyFork\mRemoteV1\CS\obj\Debug Portable\mRemoteV1.csproj.GenerateResource.Cache
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user