RegionNames.cs 4.7 KB

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