|
|
|
|
@ -9,7 +9,6 @@ using MultiTerm.Core.Types; |
|
|
|
|
using MultiTerm.Protocols; |
|
|
|
|
using MultiTerm.Protocols.Model; |
|
|
|
|
using MultiTerm.Protocols.Types; |
|
|
|
|
using System.Text; |
|
|
|
|
|
|
|
|
|
namespace MultiTerm.Core.ViewModel; |
|
|
|
|
|
|
|
|
|
@ -104,8 +103,12 @@ public abstract partial class TerminalViewModel : ObservableObject, ITerminalVie |
|
|
|
|
{ |
|
|
|
|
if (this.CommunicationProtocol != null) |
|
|
|
|
{ |
|
|
|
|
// disconnect communication protocol |
|
|
|
|
this.OnViewModelRequestedDisconnect(this, EventArgs.Empty); |
|
|
|
|
// unsubscribe events |
|
|
|
|
this.CommunicationProtocol.ReceivedDataEvent -= CommunicationProtocol_ReceivedDataEvent; |
|
|
|
|
this.CommunicationProtocol.SentDataEvent -= CommunicationProtocol_SentDataEvent; |
|
|
|
|
// remove reference to object |
|
|
|
|
this.CommunicationProtocol = null; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
@ -230,11 +233,24 @@ public abstract partial class TerminalViewModel : ObservableObject, ITerminalVie |
|
|
|
|
[RelayCommand] |
|
|
|
|
public void CloseRequest() |
|
|
|
|
{ |
|
|
|
|
// run internal closing actions check if closing is allowed |
|
|
|
|
if (this.ClosingActions() == true) |
|
|
|
|
{ |
|
|
|
|
// disconnect communication protocol |
|
|
|
|
this.OnViewModelRequestedDisconnect(this, EventArgs.Empty); |
|
|
|
|
// raise event |
|
|
|
|
ClosingEvent?.Invoke(this, EventArgs.Empty); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void ForceClose() |
|
|
|
|
{ |
|
|
|
|
// internal closing options, ignore cancellation |
|
|
|
|
this.ClosingActions(); |
|
|
|
|
// disconnect communication protocol |
|
|
|
|
this.OnViewModelRequestedDisconnect(this, EventArgs.Empty); |
|
|
|
|
// do not raise closing event, since caller knows about closing |
|
|
|
|
} |
|
|
|
|
#endregion |
|
|
|
|
|
|
|
|
|
#region Newline Separator handling |
|
|
|
|
|