Multiprocotol Terminalprogram (BAT)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
MultiTerm/MultiTerm.Core/ViewModel/TerminalViewModel.cs

35 lines
1.0 KiB

using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using MultiTerm.Core.Common;
namespace MultiTerm.Core.ViewModel;
public abstract partial class TerminalViewModel : ObservableObject, ITerminalViewModel
{
public abstract string Title { get; }
public abstract TerminalViewType ViewType { get; }
public ProtocolType ProtocolType { get; private set; }
public event EventHandler? ClosingEvent;
public TerminalViewModel(ProtocolType protocolType)
{
this.ProtocolType = protocolType;
}
/// <summary>
/// Method to override if any closing actions are required.
/// Closing can be cancelled using the return value.
/// </summary>
/// <returns>true if closing is allowed. false if it shall be cancelled.</returns>
protected virtual bool ClosingActions() { return true; }
[RelayCommand]
public void CloseRequest()
{
if (this.ClosingActions() == true)
{
ClosingEvent?.Invoke(this, EventArgs.Empty);
}
}
}