LoadPortOperateViewModel.cs 766 B

123456789101112131415161718192021222324252627282930313233343536
  1. using CommunityToolkit.Mvvm.Input;
  2. using System.Windows.Media;
  3. namespace SummaryModule.Dialogs.ViewModels;
  4. internal partial class LoadPortOperateViewModel : ObservableObject, IDialogAware
  5. {
  6. public DialogCloseListener RequestClose { get; }
  7. [ObservableProperty]
  8. private string? _Title;
  9. [ObservableProperty]
  10. private ImageSource? _ImageSource;
  11. public bool CanCloseDialog()
  12. {
  13. return true;
  14. }
  15. public void OnDialogClosed()
  16. {
  17. }
  18. public void OnDialogOpened(IDialogParameters parameters)
  19. {
  20. if (parameters.TryGetValue<string>("Hardware", out string? name))
  21. this.Title = $"{name} Operate";
  22. }
  23. [RelayCommand]
  24. private void Close()
  25. {
  26. this.RequestClose.Invoke();
  27. }
  28. }