AnnotateModel.cs 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  1. using PDF_Office.Properties;
  2. using PDFSettings;
  3. using Prism.Mvvm;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows;
  10. using System.Windows.Media;
  11. namespace PDF_Office.Model.SettingsDialog
  12. {
  13. public class AnnotateModel:BindableBase
  14. {
  15. private Color highLightColor;
  16. public Color HighLightColor
  17. {
  18. get { return highLightColor; }
  19. set
  20. {
  21. SetProperty(ref highLightColor, value);
  22. }
  23. }
  24. private Color underLineColor;
  25. public Color UnderLineColor
  26. {
  27. get { return underLineColor; }
  28. set
  29. {
  30. SetProperty(ref underLineColor, value);
  31. }
  32. }
  33. private Color strikethroughColor;
  34. public Color StrikethroughColor
  35. {
  36. get { return strikethroughColor; }
  37. set
  38. {
  39. SetProperty(ref strikethroughColor, value);
  40. }
  41. }
  42. private Color freeHandColor;
  43. public Color FreeHandColor
  44. {
  45. get { return freeHandColor; }
  46. set
  47. {
  48. SetProperty(ref freeHandColor, value);
  49. }
  50. }
  51. private Color textAnnoteColor;
  52. public Color TextAnnoteColor
  53. {
  54. get { return textAnnoteColor; }
  55. set
  56. {
  57. SetProperty(ref textAnnoteColor, value);
  58. }
  59. }
  60. private Color noteAnnoteColor;
  61. public Color NoteAnnoteColor
  62. {
  63. get { return noteAnnoteColor; }
  64. set
  65. {
  66. SetProperty(ref noteAnnoteColor, value);
  67. }
  68. }
  69. private Color rectangleBorderColor;
  70. public Color RectangleBorderColor
  71. {
  72. get { return rectangleBorderColor; }
  73. set
  74. {
  75. SetProperty(ref rectangleBorderColor, value);
  76. }
  77. }
  78. private Color rectangleFillColor;
  79. public Color RectangleFillColor
  80. {
  81. get { return rectangleFillColor; }
  82. set
  83. {
  84. SetProperty(ref rectangleFillColor, value);
  85. }
  86. }
  87. private Color circleBorderColor;
  88. public Color CircleBorderColor
  89. {
  90. get { return circleBorderColor; }
  91. set
  92. {
  93. SetProperty(ref circleBorderColor, value);
  94. }
  95. }
  96. private Color circleFillColor;
  97. public Color CircleFillColor
  98. {
  99. get { return circleFillColor; }
  100. set
  101. {
  102. SetProperty(ref circleFillColor, value);
  103. }
  104. }
  105. private Color lineColor;
  106. public Color LineColor
  107. {
  108. get { return lineColor; }
  109. set
  110. {
  111. SetProperty(ref lineColor, value);
  112. }
  113. }
  114. private TextAlignment textAlign;
  115. public TextAlignment TextAlign
  116. {
  117. get { return textAlign; }
  118. set
  119. {
  120. SetProperty(ref textAlign, value);
  121. }
  122. }
  123. private string textFontFamaily;
  124. public string TextFontFamaily
  125. {
  126. get { return textFontFamaily; }
  127. set
  128. {
  129. SetProperty(ref textFontFamaily, value);
  130. }
  131. }
  132. private string anchoredFamaily;
  133. public string AnchoredFamaily
  134. {
  135. get { return anchoredFamaily; }
  136. set
  137. {
  138. SetProperty(ref anchoredFamaily, value);
  139. }
  140. }
  141. public AnnotateModel()
  142. {
  143. InitFromSettings();
  144. }
  145. private void InitFromSettings()
  146. {
  147. var annote = Settings.Default.AppProperties.Annotate;
  148. this.HighLightColor = annote.HighLightColor;
  149. this.UnderLineColor = annote.UnderLineColor;
  150. this.StrikethroughColor = annote.StrikethroughColor;
  151. this.FreeHandColor = annote.FreeHandColor;
  152. this.TextAnnoteColor = annote.TextAnnoteColor;
  153. this.NoteAnnoteColor = annote.NoteAnnoteColor;
  154. this.RectangleBorderColor = annote.RectangleBorderColor;
  155. this.RectangleFillColor = annote.RectangleFillColor;
  156. this.CircleBorderColor = annote.CircleBorderColor;
  157. this.CircleFillColor = annote.CircleFillColor;
  158. this.LineColor = annote.LineColor;
  159. this.TextFontFamaily = annote.TextFontFamaily;
  160. this.AnchoredFamaily = annote.AnchoredFamaily;
  161. this.TextAlign = annote.TextAlign;
  162. }
  163. public void Save()
  164. {
  165. AnnotatePropertyClass annote = new AnnotatePropertyClass();
  166. annote.HighLightColor = this.HighLightColor;
  167. annote.UnderLineColor = this.UnderLineColor;
  168. annote.StrikethroughColor = this.StrikethroughColor;
  169. annote.FreeHandColor = this.FreeHandColor;
  170. annote.TextAnnoteColor = this.TextAnnoteColor;
  171. annote.NoteAnnoteColor = this.NoteAnnoteColor;
  172. annote.RectangleBorderColor = this.RectangleBorderColor;
  173. annote.RectangleFillColor = this.RectangleFillColor;
  174. annote.CircleBorderColor = this.CircleBorderColor;
  175. annote.CircleFillColor = this.CircleFillColor;
  176. annote.LineColor = this.LineColor;
  177. annote.TextFontFamaily = this.TextFontFamaily;
  178. annote.AnchoredFamaily = this.AnchoredFamaily;
  179. annote.TextAlign = this.TextAlign;
  180. Settings.Default.AppProperties.Annotate = annote;
  181. }
  182. public void Reset()
  183. {
  184. InitFromSettings();
  185. }
  186. }
  187. }