|
|
|
@ -12,10 +12,27 @@ public abstract partial class TerminalViewModel : ObservableObject, ITerminalVie |
|
|
|
public abstract TerminalViewType ViewType { get; } |
|
|
|
public abstract TerminalViewType ViewType { get; } |
|
|
|
public ProtocolType ProtocolType { get; set; } |
|
|
|
public ProtocolType ProtocolType { get; set; } |
|
|
|
public ICommunicationProtocol? CommunicationProtocol { get; set; } |
|
|
|
public ICommunicationProtocol? CommunicationProtocol { get; set; } |
|
|
|
public IProtocolSettingsViewModel? ProtocolSettings { get; set; } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public event EventHandler? ClosingEvent; |
|
|
|
public event EventHandler? ClosingEvent; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private IProtocolSettingsViewModel? protocolSettings; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public IProtocolSettingsViewModel? ProtocolSettings |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
get { return protocolSettings; } |
|
|
|
|
|
|
|
set |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
protocolSettings = value; |
|
|
|
|
|
|
|
// register event handler for connection request from viewmodel |
|
|
|
|
|
|
|
if(value != null) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
protocolSettings!.ConnectRequested += OnViewModelRequestedConnect; |
|
|
|
|
|
|
|
protocolSettings!.DisconnectRequested += OnViewModelRequestedDisconnect; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
/// <summary> |
|
|
|
/// Method to override if any closing actions are required. |
|
|
|
/// Method to override if any closing actions are required. |
|
|
|
/// Closing can be cancelled using the return value. |
|
|
|
/// Closing can be cancelled using the return value. |
|
|
|
@ -31,4 +48,14 @@ public abstract partial class TerminalViewModel : ObservableObject, ITerminalVie |
|
|
|
ClosingEvent?.Invoke(this, EventArgs.Empty); |
|
|
|
ClosingEvent?.Invoke(this, EventArgs.Empty); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void OnViewModelRequestedConnect(object? sender, EventArgs e) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
this.CommunicationProtocol?.Connect(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void OnViewModelRequestedDisconnect(object? sender, EventArgs e) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
this.CommunicationProtocol?.Disconnect(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|