AppConfig.cs 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. 
  2. using GeekDesk.Constant;
  3. using System;
  4. using System.ComponentModel;
  5. using System.Windows;
  6. /// <summary>
  7. /// 程序设置
  8. /// </summary>
  9. namespace GeekDesk.ViewModel
  10. {
  11. [Serializable]
  12. public class AppConfig : INotifyPropertyChanged
  13. {
  14. private SortType menuSortType = SortType.CUSTOM; //菜单排序类型
  15. private SortType iconSortType = SortType.CUSTOM; //图表排序类型
  16. private double windowWidth = (double)DefaultConstant.WINDOW_WIDTH; //窗口宽度
  17. private double windowHeight = (double)DefaultConstant.WINDOW_HEIGHT; //窗口高度
  18. private double menuCardWidth = (double)DefaultConstant.MENU_CARD_WIDHT;//菜单栏宽度
  19. private int selectedMenuIndex = 0; //上次选中菜单索引
  20. private bool followMouse = true; //面板跟随鼠标 默认是
  21. private Visibility configIconVisible = Visibility.Visible; // 设置按钮是否显示
  22. private AppHideType appHideType = AppHideType.START_EXE; //面板关闭方式 (默认启动程序后)
  23. private Visibility startedShowPanel = Visibility.Visible; //启动时是否显示主面板 默认显示
  24. #region GetSet
  25. public Visibility StartedShowPanel
  26. {
  27. get
  28. {
  29. return startedShowPanel;
  30. }
  31. set
  32. {
  33. startedShowPanel = value;
  34. OnPropertyChanged("StartedShowPanel");
  35. }
  36. }
  37. public AppHideType AppHideType
  38. {
  39. get
  40. {
  41. return appHideType;
  42. }
  43. set
  44. {
  45. appHideType = value;
  46. OnPropertyChanged("AppHideType");
  47. }
  48. }
  49. public Visibility ConfigIconVisible
  50. {
  51. get
  52. {
  53. return configIconVisible;
  54. }
  55. set
  56. {
  57. configIconVisible = value;
  58. OnPropertyChanged("ConfigIconVisible");
  59. }
  60. }
  61. public bool FollowMouse
  62. {
  63. get
  64. {
  65. return followMouse;
  66. }
  67. set
  68. {
  69. followMouse = value;
  70. OnPropertyChanged("FollowMouse");
  71. }
  72. }
  73. public int SelectedMenuIndex
  74. {
  75. get
  76. {
  77. return selectedMenuIndex;
  78. }
  79. set
  80. {
  81. selectedMenuIndex = value;
  82. OnPropertyChanged("SelectedMenuIndex");
  83. }
  84. }
  85. public SortType MenuSortType
  86. {
  87. get
  88. {
  89. return menuSortType;
  90. }
  91. set
  92. {
  93. menuSortType = value;
  94. OnPropertyChanged("MenuSortType");
  95. }
  96. }
  97. public SortType IconSortType
  98. {
  99. get
  100. {
  101. return iconSortType;
  102. }
  103. set
  104. {
  105. iconSortType = value;
  106. OnPropertyChanged("IconSortType");
  107. }
  108. }
  109. public double WindowWidth
  110. {
  111. get
  112. {
  113. return windowWidth;
  114. }
  115. set
  116. {
  117. windowWidth = value;
  118. OnPropertyChanged("WindowWidth");
  119. }
  120. }
  121. public double WindowHeight
  122. {
  123. get
  124. {
  125. return windowHeight;
  126. }
  127. set
  128. {
  129. windowHeight = value;
  130. OnPropertyChanged("WindowHeight");
  131. }
  132. }
  133. public double MenuCardWidth
  134. {
  135. get
  136. {
  137. return menuCardWidth;
  138. }
  139. set
  140. {
  141. menuCardWidth = value;
  142. OnPropertyChanged("MenuCardWidth");
  143. }
  144. }
  145. [field: NonSerializedAttribute()]
  146. public event PropertyChangedEventHandler PropertyChanged;
  147. private void OnPropertyChanged(string propertyName)
  148. {
  149. PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
  150. }
  151. #endregion
  152. }
  153. }