RegionNames.cs 4.4 KB

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