RegionNames.cs 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Runtime.CompilerServices;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. namespace PDF_Office.Model
  8. {
  9. /// <summary>
  10. /// 存放公用模块的RegionName
  11. /// </summary>
  12. public static class RegionNames
  13. {
  14. /// <summary>
  15. /// 最外层的Region名称
  16. /// </summary>
  17. public static string MainRegion = "MainRegion";
  18. /// <summary>
  19. /// 首页右侧快捷工具Content RegionName
  20. /// </summary>
  21. public static string ToolRegionName
  22. {
  23. get
  24. {
  25. return GetRegionName("ToolRegionName");
  26. }
  27. }
  28. /// <summary>
  29. /// 阅读页PDFViewer 对应的Content RegionName
  30. /// </summary>
  31. public static string ViwerRegionName
  32. {
  33. get
  34. {
  35. return GetRegionName("ViwerRegionName");
  36. }
  37. }
  38. /// <summary>
  39. /// 阅读页顶部Tip 对应的Content RegionName
  40. /// </summary>
  41. public static string TipContentRegionName
  42. {
  43. get
  44. {
  45. return GetRegionName("TipContentRegionName");
  46. }
  47. }
  48. public static string ReadRegionName
  49. {
  50. get
  51. {
  52. return GetRegionName("ReadRegionName");
  53. }
  54. }
  55. /// <summary>
  56. /// 阅读页PDFViewer 对应的Content RegionName
  57. /// </summary>
  58. public static string WatermarkViwerRegionName
  59. {
  60. get
  61. {
  62. return GetRegionName("WatermarkViwerRegionName");
  63. }
  64. }
  65. public static string BackgroundViewerRegionName
  66. {
  67. get
  68. {
  69. return GetRegionName("BackgroundViewerRegionName");
  70. }
  71. }
  72. public static string BatesViewerRegionName
  73. {
  74. get
  75. {
  76. return GetRegionName("BatesViewerRegionName");
  77. }
  78. }
  79. public static string HeaderFooterViewerRegionName
  80. {
  81. get
  82. {
  83. return GetRegionName("HeaderFooterViewerRegionName");
  84. }
  85. }
  86. public static string RedactionViewerRegionName
  87. {
  88. get
  89. {
  90. return GetRegionName("RedactionViewerRegionName");
  91. }
  92. }
  93. /// <summary>
  94. /// BOTA内容项 对应的Content RegionName
  95. /// </summary>
  96. public static string BOTARegionName
  97. {
  98. get
  99. {
  100. return GetRegionName("BOTARegionName");
  101. }
  102. }
  103. /// <summary>
  104. /// 属性面板 对应的Content RegionName
  105. /// </summary>
  106. public static string PropertyRegionName
  107. {
  108. get
  109. {
  110. return GetRegionName("PropertyRegionName");
  111. }
  112. }
  113. /// <summary>
  114. /// 工具功能(页面编辑、水印、密文等)对应的Content RegionName
  115. /// </summary>
  116. public static string ToolContentRegionName
  117. {
  118. get
  119. {
  120. return GetRegionName("ToolContentRegionName");
  121. }
  122. }
  123. /// <summary>
  124. /// 工具菜单栏对应的Content RegionName
  125. /// </summary>
  126. public static string ToolsBarContentRegionName
  127. {
  128. get
  129. {
  130. return GetRegionName("ToolsBarContentRegionName");
  131. }
  132. }
  133. /// <summary>
  134. /// 底部工具栏对应的Content RegionName
  135. /// </summary>
  136. public static string BottomToolRegionName
  137. {
  138. get
  139. {
  140. return GetRegionName("BottomToolRegionName");
  141. }
  142. }
  143. /// <summary>
  144. /// 视图模块-分屏视图
  145. /// </summary>
  146. public static string SplitScreenViewRegionName
  147. {
  148. get
  149. {
  150. return GetRegionName("SplitScreenViewRegionName");
  151. }
  152. }
  153. /// <summary>
  154. /// 视图模块-分屏视图-PDF
  155. /// </summary>
  156. public static string SplitViewRegionName
  157. {
  158. get
  159. {
  160. return GetRegionName("SplitViewRegionName");
  161. }
  162. }
  163. /// <summary>
  164. /// 视图模块-分屏视图-页面控件
  165. /// </summary>
  166. public static string SplitScreenPageRegionName
  167. {
  168. get
  169. {
  170. return GetRegionName("SplitScreenPageRegionName");
  171. }
  172. }
  173. /// <summary>
  174. /// 视图模块-主题颜色
  175. /// </summary>
  176. public static string ThemesContentName
  177. {
  178. get
  179. {
  180. return GetRegionName("ThemesContentName");
  181. }
  182. }
  183. /// <summary>
  184. /// 视图模块-阅读模式
  185. /// </summary>
  186. public static string ReadModeRegionName
  187. {
  188. get
  189. {
  190. return GetRegionName("ReadModeRegionName");
  191. }
  192. }
  193. public static string ReadModePageRegionName
  194. {
  195. get
  196. {
  197. return GetRegionName("ReadModePageRegionName");
  198. }
  199. }
  200. public static string OCRViewerRegionName
  201. {
  202. get
  203. {
  204. return GetRegionName("OCRViewerRegionName");
  205. }
  206. }
  207. /// <summary>
  208. /// 获取MainWindowsViewModel RegionNames字典里的RegionName,
  209. /// 如果字典里没有键值就新建一个GUID,并插入到
  210. /// </summary>
  211. /// <returns></returns>
  212. public static string GetRegionName(string key)
  213. {
  214. if (App.mainWindowViewModel.SelectedItem.RegionContentNames.ContainsKey(key))
  215. {
  216. return App.mainWindowViewModel.SelectedItem.RegionContentNames[key];
  217. }
  218. else
  219. {
  220. string name = Guid.NewGuid().ToString();
  221. App.mainWindowViewModel.SelectedItem.RegionContentNames[key] = name;
  222. return name;
  223. }
  224. }
  225. /// <summary>
  226. /// 如果不存在key,则插入key,并设置Value
  227. /// 如果存在key,则更改Value
  228. /// </summary>
  229. public static void SetRegionName(string key, string Value)
  230. {
  231. if (App.mainWindowViewModel.SelectedItem.RegionContentNames.ContainsKey(key))
  232. {
  233. App.mainWindowViewModel.SelectedItem.RegionContentNames[key] = Value;
  234. }
  235. else
  236. {
  237. App.mainWindowViewModel.SelectedItem.RegionContentNames[key] = Value;
  238. }
  239. }
  240. }
  241. }