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.
27 lines
789 B
27 lines
789 B
using CommunityToolkit.Mvvm.ComponentModel;
|
|
using CommunityToolkit.Mvvm.Input;
|
|
|
|
namespace MultiTerm.Core.ViewModel;
|
|
|
|
public abstract partial class TerminalViewModel : ObservableObject, ITerminalViewModel
|
|
{
|
|
public abstract string Title { get; }
|
|
|
|
public event EventHandler? ClosingEvent;
|
|
|
|
/// <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);
|
|
}
|
|
}
|
|
}
|
|
|