ChartPage3ViewModel.cs 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. using Prism.Commands;
  2. using Prism.Mvvm;
  3. using Prism.Services.Dialogs;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. namespace LogoForceTestApp.Modules.MainModule.ViewModels
  10. {
  11. internal class ChartPage3ViewModel : BindableBase, IDialogAware
  12. {
  13. public string Title => "chart3";
  14. public event Action<IDialogResult> RequestClose;
  15. public bool CanCloseDialog()
  16. {
  17. return true;
  18. }
  19. public void OnDialogClosed()
  20. {
  21. }
  22. public void OnDialogOpened(IDialogParameters parameters)
  23. {
  24. }
  25. public string C1 { get; set; }
  26. public string C2 { get; set; }
  27. public string C3 { get; set; }
  28. public string C4 { get; set; }
  29. public string C5 { get; set; }
  30. public DelegateCommand CloseCmd { get; set; }
  31. public ChartPage3ViewModel()
  32. {
  33. CloseCmd = new DelegateCommand(Close);
  34. }
  35. private void Close()
  36. {
  37. if (C1 == null && C2 == null && C3 == null && C4 == null && C5 == null)
  38. {
  39. return;
  40. }
  41. else
  42. {
  43. var dialog = new DialogResult();
  44. dialog.Parameters.Add("c1", C1);
  45. dialog.Parameters.Add("c2", C2);
  46. dialog.Parameters.Add("c3", C3);
  47. dialog.Parameters.Add("c4", C4);
  48. dialog.Parameters.Add("c5", C5);
  49. RequestClose?.Invoke(dialog);
  50. }
  51. }
  52. }
  53. }