WatermarkCreateTextContentViewModel.cs 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. using Prism.Commands;
  2. using Prism.Mvvm;
  3. using Prism.Regions;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Linq;
  7. namespace PDF_Office.ViewModels.EditTools.Watermark
  8. {
  9. public class WatermarkCreateTextContentViewModel : BindableBase,INavigationAware
  10. {
  11. private List<string> _opacityList = new List<string>();
  12. public List<string> OpacityList
  13. {
  14. get { return _opacityList; }
  15. set
  16. {
  17. SetProperty(ref _opacityList, value);
  18. }
  19. }
  20. private void InitOpacityList()
  21. {
  22. OpacityList.Clear();
  23. for (int temp = 0; temp <= 100; temp += 10)
  24. {
  25. OpacityList.Add(temp.ToString() + " %");
  26. }
  27. }
  28. private List<string> _rotationList = new List<string>();
  29. public List<string> RotationList
  30. {
  31. get { return _rotationList; }
  32. set
  33. {
  34. SetProperty(ref _rotationList, value);
  35. }
  36. }
  37. private void InitRotationList()
  38. {
  39. RotationList.Clear();
  40. for (int temp = -45; temp <= 45; temp += 15)
  41. {
  42. RotationList.Add(temp.ToString());
  43. }
  44. }
  45. private List<string> _fontSizeList = new List<string>();
  46. public List<string> FontSizeList
  47. {
  48. get { return _fontSizeList; }
  49. set
  50. {
  51. SetProperty(ref _fontSizeList, value);
  52. }
  53. }
  54. private void InitFontSizeList()
  55. {
  56. FontSizeList.Clear();
  57. FontSizeList.Add("自动");
  58. for (int temp = 8; temp <= 15; temp += 1)
  59. {
  60. FontSizeList.Add(temp.ToString() + "pt");
  61. }
  62. }
  63. private List<string> _scaleList = new List<string>();
  64. public List<string> ScaleList
  65. {
  66. get { return _scaleList; }
  67. set
  68. {
  69. SetProperty(ref _scaleList, value);
  70. }
  71. }
  72. private void InitScaleList()
  73. {
  74. ScaleList.Clear();
  75. for (int temp = 0; temp <= 100; temp += 10)
  76. {
  77. ScaleList.Add(temp.ToString() + " %");
  78. }
  79. }
  80. private List<string> _isFrontList = new List<string>();
  81. public List<string> IsFrontList
  82. {
  83. get { return _isFrontList; }
  84. set
  85. {
  86. SetProperty(ref _isFrontList, value);
  87. }
  88. }
  89. private void InitIsFrontList()
  90. {
  91. IsFrontList.Clear();
  92. IsFrontList.Add("位于页面上方");
  93. IsFrontList.Add("位于页面下方");
  94. }
  95. private int _rotationValue = 0;
  96. public int RotationValue
  97. {
  98. get { return _rotationValue; }
  99. set
  100. {
  101. SetProperty(ref _rotationValue, value);
  102. }
  103. }
  104. private int _opacityValue = 100;
  105. public int OpacityValue
  106. {
  107. get { return _opacityValue; }
  108. set
  109. {
  110. SetProperty(ref _opacityValue, value);
  111. }
  112. }
  113. private int _relativeScaleValue = 50;
  114. public int RelativeScaleValue
  115. {
  116. get { return _relativeScaleValue; }
  117. set
  118. {
  119. SetProperty(ref _relativeScaleValue, value);
  120. }
  121. }
  122. private string _vertOffsetValue = "0";
  123. public string VertOffsetValue
  124. {
  125. get { return _vertOffsetValue; }
  126. set
  127. {
  128. SetProperty(ref _vertOffsetValue, value);
  129. }
  130. }
  131. private string _horizOffsetValue = "0";
  132. public string HorizOffsetValue
  133. {
  134. get { return _horizOffsetValue; }
  135. set
  136. {
  137. SetProperty(ref _horizOffsetValue, value);
  138. }
  139. }
  140. private string _verticalSpacingValue = "6";
  141. public string VerticalSpacingValue
  142. {
  143. get { return _verticalSpacingValue; }
  144. set
  145. {
  146. SetProperty(ref _verticalSpacingValue, value);
  147. }
  148. }
  149. private string _horizontalSpacingValue = "6";
  150. public string HorizontalSpacingValue
  151. {
  152. get { return _horizontalSpacingValue; }
  153. set
  154. {
  155. SetProperty(ref _horizontalSpacingValue, value);
  156. }
  157. }
  158. public WatermarkCreateTextContentViewModel()
  159. {
  160. }
  161. private void InitList() {
  162. InitOpacityList();
  163. InitFontSizeList();
  164. InitIsFrontList();
  165. InitRotationList();
  166. InitScaleList();
  167. }
  168. public bool IsNavigationTarget(NavigationContext navigationContext)
  169. {
  170. return true;
  171. }
  172. public void OnNavigatedFrom(NavigationContext navigationContext)
  173. {
  174. }
  175. public void OnNavigatedTo(NavigationContext navigationContext)
  176. {
  177. InitList();
  178. }
  179. }
  180. }