InitialVIewModel.cs 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  1. using ComPDFKitViewer;
  2. using PDF_Master.Properties;
  3. using PDFSettings;
  4. using Prism.Mvvm;
  5. using System;
  6. using System.Collections.Generic;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Threading.Tasks;
  10. using System.Windows.Media;
  11. namespace PDF_Master.Model.SettingsDialog
  12. {
  13. public class InitialVIewModel:BindableBase
  14. {
  15. private ViewMode pageView;
  16. public ViewMode PageView
  17. {
  18. get { return pageView; }
  19. set
  20. {
  21. SetProperty(ref pageView, value);
  22. }
  23. }
  24. private FitMode zoomMode;
  25. public FitMode ZoomMode
  26. {
  27. get { return zoomMode; }
  28. set
  29. {
  30. SetProperty(ref zoomMode, value);
  31. }
  32. }
  33. private bool notShowBOTA;
  34. public bool NotShowBOTA
  35. {
  36. get { return notShowBOTA; }
  37. set
  38. {
  39. SetProperty(ref notShowBOTA, value);
  40. }
  41. }
  42. private bool rememberBOTA;
  43. public bool RememberBOTA
  44. {
  45. get { return rememberBOTA; }
  46. set
  47. {
  48. SetProperty(ref rememberBOTA, value);
  49. }
  50. }
  51. private bool isBOTAOpen;
  52. public bool IsBOTAOpen
  53. {
  54. get { return isBOTAOpen; }
  55. set
  56. {
  57. SetProperty(ref isBOTAOpen, value);
  58. }
  59. }
  60. private bool showOutLine;
  61. public bool ShowOutLine
  62. {
  63. get { return showOutLine; }
  64. set
  65. {
  66. SetProperty(ref showOutLine, value);
  67. }
  68. }
  69. private bool autoExpandProperty;
  70. public bool AutoExpandProperty
  71. {
  72. get { return autoExpandProperty; }
  73. set
  74. {
  75. SetProperty(ref autoExpandProperty, value);
  76. }
  77. }
  78. private bool clickOpenProperty;
  79. public bool ClickOpenProperty
  80. {
  81. get { return clickOpenProperty; }
  82. set
  83. {
  84. SetProperty(ref clickOpenProperty, value);
  85. }
  86. }
  87. private Color backGround;
  88. public Color BackGround
  89. {
  90. get { return backGround; }
  91. set
  92. {
  93. SetProperty(ref backGround, value);
  94. }
  95. }
  96. private Color backGroundInFulWindow;
  97. public Color BackGroundInFulWindow
  98. {
  99. get { return backGroundInFulWindow; }
  100. set
  101. {
  102. SetProperty(ref backGroundInFulWindow, value);
  103. }
  104. }
  105. private bool hignlightForm;
  106. public bool HignlightForm
  107. {
  108. get { return hignlightForm; }
  109. set
  110. {
  111. SetProperty(ref hignlightForm, value);
  112. }
  113. }
  114. private bool highlightLink;
  115. public bool HighlightLink
  116. {
  117. get { return highlightLink; }
  118. set
  119. {
  120. SetProperty(ref highlightLink, value);
  121. }
  122. }
  123. private Color formHighLightColor;
  124. public Color FormHighLightColor
  125. {
  126. get { return formHighLightColor; }
  127. set
  128. {
  129. SetProperty(ref formHighLightColor, value);
  130. }
  131. }
  132. private Color requiredFieldsColor;
  133. public Color RequiredFieldsColor
  134. {
  135. get { return requiredFieldsColor; }
  136. set
  137. {
  138. SetProperty(ref requiredFieldsColor, value);
  139. }
  140. }
  141. public InitialVIewModel()
  142. {
  143. InitFromSettings();
  144. }
  145. private void InitFromSettings()
  146. {
  147. var view = Settings.Default.AppProperties.InitialVIew;
  148. this.PageView = view.PageView;
  149. this.ZoomMode = view.ZoomMode;
  150. this.NotShowBOTA = view.NotShowBOTA;
  151. this.RememberBOTA = view.RememberBOTA;
  152. this.ShowOutLine = view.ShowOutLine;
  153. this.AutoExpandProperty =view.AutoExpandProperty;
  154. this.ClickOpenProperty = view.ClickOpenProperty;
  155. this.BackGround = view.BackGround;
  156. this.BackGroundInFulWindow = view.BackGroundInFulWindow;
  157. this.HignlightForm = view.HignlightForm;
  158. this.HighlightLink = view.HighlightLink;
  159. this.FormHighLightColor = view.FormHighLightColor;
  160. this.RequiredFieldsColor = view.RequiredFieldsColor;
  161. }
  162. public void Save()
  163. {
  164. InitialVIewPropertyClass view = new InitialVIewPropertyClass();
  165. view.PageView = this.PageView;
  166. view.ZoomMode = this.ZoomMode;
  167. view.NotShowBOTA = this.NotShowBOTA;
  168. view.RememberBOTA = this.RememberBOTA;
  169. view.ShowOutLine = this.ShowOutLine;
  170. view.AutoExpandProperty = this.AutoExpandProperty;
  171. view.ClickOpenProperty = this.ClickOpenProperty;
  172. view.BackGround = this.BackGround;
  173. view.BackGroundInFulWindow = this.BackGroundInFulWindow;
  174. view.HignlightForm = this.HignlightForm;
  175. view.HighlightLink = this.HighlightLink;
  176. view.FormHighLightColor = this.FormHighLightColor;
  177. view.RequiredFieldsColor = this.RequiredFieldsColor;
  178. Settings.Default.AppProperties.InitialVIew = view;
  179. }
  180. public void Reset()
  181. {
  182. var view = new InitialVIewPropertyClass();
  183. this.PageView = view.PageView;
  184. this.ZoomMode = view.ZoomMode;
  185. this.NotShowBOTA = view.NotShowBOTA;
  186. this.RememberBOTA = view.RememberBOTA;
  187. this.ShowOutLine = view.ShowOutLine;
  188. this.AutoExpandProperty = view.AutoExpandProperty;
  189. this.ClickOpenProperty = view.ClickOpenProperty;
  190. this.BackGround = view.BackGround;
  191. this.BackGroundInFulWindow = view.BackGroundInFulWindow;
  192. this.HignlightForm = view.HignlightForm;
  193. this.HighlightLink = view.HighlightLink;
  194. this.FormHighLightColor = view.FormHighLightColor;
  195. this.RequiredFieldsColor = view.RequiredFieldsColor;
  196. }
  197. }
  198. }