RegionNames.cs 7.1 KB

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