MainViewModel.cs 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. using SWRIS.Dtos;
  2. using System.Collections.Generic;
  3. using System.Collections.ObjectModel;
  4. using System.ComponentModel;
  5. namespace SWRIS.Models.ViewModel
  6. {
  7. public class MainViewModel : INotifyPropertyChanged
  8. {
  9. private string appName;
  10. private string version;
  11. private string copyright;
  12. private string currentPage = "Home";
  13. private DebugMessageModel debugMessage = new DebugMessageModel(string.Empty);
  14. public MainViewModel()
  15. {
  16. AppName = App.Config.AppName;
  17. Version = App.Config.Version;
  18. Copyright = App.Config.Copyright;
  19. SwitchInstances = App.Config.SwitchInstances;
  20. }
  21. public string AppName
  22. {
  23. get => appName;
  24. set { appName = value; OnPropertyChanged("AppName"); }
  25. }
  26. public string Version
  27. {
  28. get => version;
  29. set { version = value; OnPropertyChanged("Version"); }
  30. }
  31. public string Copyright
  32. {
  33. get => copyright;
  34. set { copyright = value; OnPropertyChanged("Copyright"); }
  35. }
  36. public string CurrentPage
  37. {
  38. get => currentPage;
  39. set { currentPage = value; OnPropertyChanged("CurrentPage"); }
  40. }
  41. public DebugMessageModel DebugMessage
  42. {
  43. get => debugMessage;
  44. set { debugMessage = value; OnPropertyChanged("DebugMessage"); }
  45. }
  46. public DateTimeModel SystemTime { set; get; } = new DateTimeModel();
  47. public List<SwitchInstance> SwitchInstances { get; set; } = new List<SwitchInstance>();
  48. public event PropertyChangedEventHandler PropertyChanged;
  49. protected internal virtual void OnPropertyChanged(string propertyName)
  50. {
  51. PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
  52. }
  53. }
  54. }