Page1ViewModel.cs 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. using System;
  2. using System.Collections.Generic;
  3. using MsBox.Avalonia;
  4. using MsBox.Avalonia.Enums;
  5. using ReactiveUI;
  6. namespace AvaloniaApplication10.ViewModels
  7. {
  8. public class Page1ViewModel : ReactiveObject
  9. {
  10. string _message = "Äîáðî ïîæàëîâàòü";
  11. public string Message
  12. {
  13. get => _message;
  14. set => this.RaiseAndSetIfChanged(ref _message, value);
  15. }
  16. // âûçîâ ðàçëè÷íûõ äèàëîãîâûõ îêîí
  17. public async void changeMessage()
  18. {
  19. Message = "Ïðèâåò, ìèð";
  20. ButtonResult result = await MessageBoxManager.GetMessageBoxStandard("Îêíî ïîêàçà ñîîáùåíèÿ","Ìû íàæàëè íà êíîïêó",ButtonEnum.YesNo).ShowAsync();
  21. switch(result)
  22. {
  23. case ButtonResult.Yes:
  24. {
  25. await MessageBoxManager.GetMessageBoxStandard("Îêíî ïîêàçà ñîîáùåíèÿ", "Äà", ButtonEnum.Ok).ShowAsync();
  26. break;
  27. }
  28. case ButtonResult.No:
  29. {
  30. await MessageBoxManager.GetMessageBoxStandard("Îêíî ïîêàçà ñîîáùåíèÿ", "íåò", ButtonEnum.Ok).ShowAsync();
  31. break;
  32. }
  33. }
  34. }
  35. }
  36. }