RegionNames.cs 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  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. /// 阅读页PDFViewer 对应的Content RegionName
  40. /// </summary>
  41. public static string WatermarkViwerRegionName
  42. {
  43. get
  44. {
  45. return GetRegionName("WatermarkViwerRegionName");
  46. }
  47. }
  48. public static string BackgroundViewerRegionName
  49. {
  50. get
  51. {
  52. return GetRegionName("BackgroundViewerRegionName");
  53. }
  54. }
  55. public static string BatesViewerRegionName
  56. {
  57. get
  58. {
  59. return GetRegionName("BatesViewerRegionName");
  60. }
  61. }
  62. public static string HeaderFooterViewerRegionName
  63. {
  64. get
  65. {
  66. return GetRegionName("HeaderFooterViewerRegionName");
  67. }
  68. }
  69. public static string RedactionViewerRegionName
  70. {
  71. get
  72. {
  73. return GetRegionName("RedactionViewerRegionName");
  74. }
  75. }
  76. /// <summary>
  77. /// BOTA内容项 对应的Content RegionName
  78. /// </summary>
  79. public static string BOTARegionName
  80. {
  81. get
  82. {
  83. return GetRegionName("BOTARegionName");
  84. }
  85. }
  86. /// <summary>
  87. /// 属性面板 对应的Content RegionName
  88. /// </summary>
  89. public static string PropertyRegionName
  90. {
  91. get
  92. {
  93. return GetRegionName("PropertyRegionName");
  94. }
  95. }
  96. /// <summary>
  97. /// 工具功能(页面编辑、水印、密文等)对应的Content RegionName
  98. /// </summary>
  99. public static string ToolContentRegionName
  100. {
  101. get
  102. {
  103. return GetRegionName("ToolContentRegionName");
  104. }
  105. }
  106. /// <summary>
  107. /// 工具菜单栏对应的Content RegionName
  108. /// </summary>
  109. public static string ToolsBarContentRegionName
  110. {
  111. get
  112. {
  113. return GetRegionName("ToolsBarContentRegionName");
  114. }
  115. }
  116. /// <summary>
  117. /// 底部工具栏对应的Content RegionName
  118. /// </summary>
  119. public static string BottomToolRegionName
  120. {
  121. get
  122. {
  123. return GetRegionName("BottomToolRegionName");
  124. }
  125. }
  126. /// <summary>
  127. /// 视图模块-分屏视图
  128. /// </summary>
  129. public static string SplitScreenViewRegionName
  130. {
  131. get
  132. {
  133. return GetRegionName("SplitScreenViewRegionName");
  134. }
  135. }
  136. /// <summary>
  137. /// 视图模块-主题颜色
  138. /// </summary>
  139. public static string ThemesContentName
  140. {
  141. get
  142. {
  143. return GetRegionName("ThemesContentName");
  144. }
  145. }
  146. /// <summary>
  147. /// 视图模块-阅读模式
  148. /// </summary>
  149. public static string ReadModeRegionName
  150. {
  151. get
  152. {
  153. return GetRegionName("ReadModeRegionName");
  154. }
  155. }
  156. /// <summary>
  157. /// 获取MainWindowsViewModel RegionNames字典里的RegionName,
  158. /// 如果字典里没有键值就新建一个GUID,并插入到
  159. /// </summary>
  160. /// <returns></returns>
  161. public static string GetRegionName(string key)
  162. {
  163. if (App.mainWindowViewModel.SelectedItem.RegionContentNames.ContainsKey(key))
  164. {
  165. return App.mainWindowViewModel.SelectedItem.RegionContentNames[key];
  166. }
  167. else
  168. {
  169. string name = Guid.NewGuid().ToString();
  170. App.mainWindowViewModel.SelectedItem.RegionContentNames[key] = name;
  171. return name;
  172. }
  173. }
  174. /// <summary>
  175. /// 如果不存在key,则插入key,并设置Value
  176. /// 如果存在key,则更改Value
  177. /// </summary>
  178. public static void SetRegionName(string key, string Value)
  179. {
  180. if (App.mainWindowViewModel.SelectedItem.RegionContentNames.ContainsKey(key))
  181. {
  182. App.mainWindowViewModel.SelectedItem.RegionContentNames[key] = Value;
  183. }
  184. else
  185. {
  186. App.mainWindowViewModel.SelectedItem.RegionContentNames[key] = Value;
  187. }
  188. }
  189. }
  190. }