using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.Input; using System; using System.Windows; using System.Windows.Input; namespace BBWYB.Client.ViewModels { public class BaseVM : ObservableRecipient { public Guid VMId { get; set; } public ICommand LoadCommand { get; set; } public ICommand UnloadCommand { get; set; } public ICommand CopyTextCommand { get; set; } public BaseVM() { VMId = Guid.NewGuid(); LoadCommand = new RelayCommand(Load); UnloadCommand = new RelayCommand(Unload); CopyTextCommand = new RelayCommand(s => { try { Clipboard.SetText(s); } catch (Exception ex) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine(ex); Console.ResetColor(); } }); } public virtual void Refresh() { } protected virtual void Load() { } protected virtual void Unload() { } } }