diff --git a/mRemoteV1/Connection/Protocol/ProtocolBase.cs b/mRemoteV1/Connection/Protocol/ProtocolBase.cs index 8b204f045..2a6082e05 100644 --- a/mRemoteV1/Connection/Protocol/ProtocolBase.cs +++ b/mRemoteV1/Connection/Protocol/ProtocolBase.cs @@ -86,7 +86,7 @@ namespace mRemoteNG.Connection.Protocol } public virtual void ResizeBegin(object sender, EventArgs e) - { + { } public virtual void Resize(object sender, EventArgs e) @@ -96,7 +96,7 @@ namespace mRemoteNG.Connection.Protocol public virtual void ResizeEnd(object sender, EventArgs e) { } - + public virtual bool Initialize() { try @@ -119,7 +119,7 @@ namespace mRemoteNG.Connection.Protocol return false; } } - + public virtual bool Connect() { if (InterfaceControl.Info.Protocol == ProtocolType.RDP) return false; @@ -127,12 +127,12 @@ namespace mRemoteNG.Connection.Protocol ConnectedEvent(this); return true; } - + public virtual void Disconnect() { Close(); } - + public virtual void Close() { var t = new Thread(CloseBG); @@ -140,14 +140,14 @@ namespace mRemoteNG.Connection.Protocol t.IsBackground = true; t.Start(); } - + private void CloseBG() { ClosedEvent?.Invoke(this); try { tmrReconnect.Enabled = false; - + if (Control != null) { try @@ -170,7 +170,7 @@ namespace mRemoteNG.Connection.Protocol { SetTagToNothing(); } - + DisposeInterface(); } catch (Exception ex) @@ -183,7 +183,7 @@ namespace mRemoteNG.Connection.Protocol Runtime.MessageCollector?.AddExceptionStackTrace("Couldn't Close InterfaceControl BG (Connection.Protocol.Base)", ex); } } - + private delegate void DisposeInterfaceCB(); private void DisposeInterface() { @@ -197,7 +197,7 @@ namespace mRemoteNG.Connection.Protocol _interfaceControl.Dispose(); } } - + private delegate void SetTagToNothingCB(); private void SetTagToNothing() { @@ -211,7 +211,7 @@ namespace mRemoteNG.Connection.Protocol _interfaceControl.Parent.Tag = null; } } - + private delegate void DisposeControlCB(); private void DisposeControl() { @@ -226,7 +226,7 @@ namespace mRemoteNG.Connection.Protocol } } #endregion - + #region Events public delegate void ConnectingEventHandler(object sender); public event ConnectingEventHandler Connecting @@ -234,43 +234,43 @@ namespace mRemoteNG.Connection.Protocol add => ConnectingEvent = (ConnectingEventHandler) Delegate.Combine(ConnectingEvent, value); remove => ConnectingEvent = (ConnectingEventHandler) Delegate.Remove(ConnectingEvent, value); } - + public delegate void ConnectedEventHandler(object sender); public event ConnectedEventHandler Connected { add => ConnectedEvent = (ConnectedEventHandler) Delegate.Combine(ConnectedEvent, value); remove => ConnectedEvent = (ConnectedEventHandler) Delegate.Remove(ConnectedEvent, value); } - + public delegate void DisconnectedEventHandler(object sender, string disconnectedMessage, int? reasonCode); public event DisconnectedEventHandler Disconnected { add => DisconnectedEvent = (DisconnectedEventHandler) Delegate.Combine(DisconnectedEvent, value); remove => DisconnectedEvent = (DisconnectedEventHandler) Delegate.Remove(DisconnectedEvent, value); } - + public delegate void ErrorOccuredEventHandler(object sender, string errorMessage, int? errorCode); public event ErrorOccuredEventHandler ErrorOccured { add => ErrorOccuredEvent = (ErrorOccuredEventHandler) Delegate.Combine(ErrorOccuredEvent, value); remove => ErrorOccuredEvent = (ErrorOccuredEventHandler) Delegate.Remove(ErrorOccuredEvent, value); } - + public delegate void ClosingEventHandler(object sender); public event ClosingEventHandler Closing { add => ClosingEvent = (ClosingEventHandler) Delegate.Combine(ClosingEvent, value); remove => ClosingEvent = (ClosingEventHandler) Delegate.Remove(ClosingEvent, value); } - + public delegate void ClosedEventHandler(object sender); public event ClosedEventHandler Closed { add => ClosedEvent = (ClosedEventHandler) Delegate.Combine(ClosedEvent, value); remove => ClosedEvent = (ClosedEventHandler) Delegate.Remove(ClosedEvent, value); } - - + + public void Event_Closing(object sender) { ClosingEvent?.Invoke(sender); diff --git a/mRemoteV1/Connection/Protocol/PuttyBase.cs b/mRemoteV1/Connection/Protocol/PuttyBase.cs index 1b26a8024..039e4ea7c 100644 --- a/mRemoteV1/Connection/Protocol/PuttyBase.cs +++ b/mRemoteV1/Connection/Protocol/PuttyBase.cs @@ -213,7 +213,6 @@ namespace mRemoteNG.Connection.Protocol InterfaceControl.Height + SystemInformation.CaptionHeight + scaledFrameBorderHeight * 2, true); } - } catch (Exception ex) {