SeconMessagePage.xaml.cs 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318
  1. using CollaborativePlatformMain.DFEntity.MessageSubUtil;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. using System.Windows;
  8. using System.Windows.Controls;
  9. using System.Windows.Data;
  10. using System.Windows.Documents;
  11. using System.Windows.Input;
  12. using System.Windows.Media;
  13. using System.Windows.Media.Imaging;
  14. using System.Windows.Shapes;
  15. namespace CollaborativePlatformMain.Form.MessageSubPage
  16. {
  17. /// <summary>
  18. /// SeconMessagePage.xaml 的交互逻辑
  19. /// </summary>
  20. public partial class SeconMessagePage : Page
  21. {
  22. /// <summary>
  23. /// 父级窗体
  24. /// </summary>
  25. public HomepageForm Homepage;
  26. /// <summary>
  27. /// 有参构造
  28. /// </summary>
  29. /// <param name="homepageForm">父级窗体</param>
  30. public SeconMessagePage(HomepageForm homepageForm)
  31. {
  32. InitializeComponent();
  33. Homepage = homepageForm;
  34. }
  35. public List<MessageData> tongzhis1 = new List<MessageData>();
  36. public List<MessageData> tongzhis2 = new List<MessageData>();
  37. public List<MessageData> xiangmu1 = new List<MessageData>();
  38. public List<MessageData> xiangmu2 = new List<MessageData>();
  39. public List<MessageData> xitong1 = new List<MessageData>();
  40. public List<MessageData> xitong2 = new List<MessageData>();
  41. /// <summary>
  42. /// 窗体初始化
  43. /// </summary>
  44. /// <param name="sender"></param>
  45. /// <param name="e"></param>
  46. private void Window_Loaded(object sender, RoutedEventArgs e)
  47. {
  48. List<string> secondaryNodes = new List<string>() { "通知公告", "项目", "系统" };
  49. for (int i = 0; i < secondaryNodes.Count; i++)
  50. {
  51. if (i == 0)
  52. {
  53. List<string> projects = new List<string>() { "国博城项目总消息", "北京大兴项目总消息", "绿地项目总消息" };
  54. MessageData messageData = new MessageData();
  55. messageData.SeconNode = secondaryNodes[i];
  56. messageData.ThreeNodes = projects;
  57. tongzhis1.Add(messageData);
  58. for (int j = 0; j < projects.Count; j++)
  59. {
  60. MessageData threeData = new MessageData();
  61. threeData.SeconNode = projects[j];
  62. if (j == 0)
  63. {
  64. List<string> nodes = new List<string>() { "按甲方要求,国博城项目务必在4月15号之前完成报审版。" };
  65. threeData.ThreeNodes = nodes;
  66. }
  67. else if (j == 1)
  68. {
  69. List<string> nodes = new List<string>() { "按甲方要求,北京大兴项目务必在4月22号之前完成报审版。" };
  70. threeData.ThreeNodes = nodes;
  71. }
  72. else if (j == 2)
  73. {
  74. List<string> nodes = new List<string>() { "按甲方要求,绿地项目务必在4月30号之前完成报审版。" };
  75. threeData.ThreeNodes = nodes;
  76. }
  77. tongzhis2.Add(threeData);
  78. }
  79. }
  80. else if (i == 1)
  81. {
  82. List<string> projects = new List<string>() { "国博城项目建筑图纸更新", "北京大兴项目结构图纸更新", "绿地项目人防图纸更新" };
  83. MessageData messageData = new MessageData();
  84. messageData.SeconNode = secondaryNodes[i];
  85. messageData.ThreeNodes = projects;
  86. xiangmu1.Add(messageData);
  87. for (int j = 0; j < projects.Count; j++)
  88. {
  89. MessageData threeData = new MessageData();
  90. threeData.SeconNode = projects[j];
  91. if (j == 0)
  92. {
  93. List<string> nodes = new List<string>() { "国博城项目建筑1#楼3层更新。" };
  94. threeData.ThreeNodes = nodes;
  95. }
  96. else if (j == 1)
  97. {
  98. List<string> nodes = new List<string>() { "北京大兴项目结构2#楼1层墙柱平法图更新。" };
  99. threeData.ThreeNodes = nodes;
  100. }
  101. else if (j == 2)
  102. {
  103. List<string> nodes = new List<string>() { "绿地项目地下人防图更新。" };
  104. threeData.ThreeNodes = nodes;
  105. }
  106. xiangmu2.Add(threeData);
  107. }
  108. }
  109. else if (i == 2)
  110. {
  111. List<string> projects = new List<string>() { "系统更新", "停服升级" };
  112. MessageData messageData = new MessageData();
  113. messageData.SeconNode = secondaryNodes[i];
  114. messageData.ThreeNodes = projects;
  115. xitong1.Add(messageData);
  116. for (int j = 0; j < projects.Count; j++)
  117. {
  118. MessageData threeData = new MessageData();
  119. threeData.SeconNode = projects[j];
  120. if (j == 0)
  121. {
  122. List<string> nodes = new List<string>() { "交互平台版本更新至2.0版本",
  123. " 本次更新了:",
  124. " 1.主界面消息分组。",
  125. " 2.修改了登陆界面。",
  126. " 请及时更新!!",};
  127. threeData.ThreeNodes = nodes;
  128. }
  129. else if (j == 1)
  130. {
  131. List<string> nodes = new List<string>() { "交互平台版本将在4月13日8点20分至4月13日8点50分进行停服更新",
  132. "本次停服更新不会导致您的数据丢失。"};
  133. threeData.ThreeNodes = nodes;
  134. }
  135. xitong2.Add(threeData);
  136. }
  137. }
  138. }
  139. me_message.Children.Clear();
  140. foreach (var item in tongzhis2)
  141. {
  142. Button button = new Button();
  143. button.Content = item.SeconNode;
  144. button.BorderThickness = new Thickness(0);
  145. button.Width = 180;
  146. button.Height = 30;
  147. button.Tag = item;
  148. button.Click += new RoutedEventHandler(messageBtnClick);
  149. button.HorizontalContentAlignment = HorizontalAlignment.Left;
  150. me_message.Children.Add(button);
  151. }
  152. }
  153. /// <summary>
  154. /// 二级菜单选中的元素
  155. /// </summary>
  156. public static string SelectNode = "";
  157. /// <summary>
  158. /// 通知公告
  159. /// </summary>
  160. /// <param name="sender"></param>
  161. /// <param name="e"></param>
  162. private void me_announcementClick(object sender, RoutedEventArgs e)
  163. {
  164. MenuItem menu = sender as MenuItem;
  165. if (menu == null) return;
  166. me_message.Children.Clear();
  167. foreach (var item in tongzhis2)
  168. {
  169. Button button = new Button();
  170. button.Content = item.SeconNode;
  171. button.BorderThickness = new Thickness(0);
  172. button.Width = 180;
  173. button.Height = 30;
  174. button.Background= Brushes.WhiteSmoke;
  175. button.Visibility = Visibility.Visible;
  176. button.Click += new RoutedEventHandler(messageBtnClick);
  177. button.Tag = item;
  178. button.HorizontalContentAlignment = HorizontalAlignment.Left;
  179. me_message.Children.Add(button);
  180. }
  181. SelectNode = menu.Header.ToString();
  182. }
  183. /// <summary>
  184. /// 项目
  185. /// </summary>
  186. /// <param name="sender"></param>
  187. /// <param name="e"></param>
  188. private void me_projectClick(object sender, RoutedEventArgs e)
  189. {
  190. MenuItem menu = sender as MenuItem;
  191. if (menu == null) return;
  192. me_message.Children.Clear();
  193. foreach (var item in xiangmu2)
  194. {
  195. Button button = new Button();
  196. button.Content = item.SeconNode;
  197. button.BorderThickness = new Thickness(0);
  198. button.Width = 180;
  199. button.Height = 30;
  200. button.Tag = item;
  201. button.Click += new RoutedEventHandler(messageBtnClick);
  202. button.HorizontalContentAlignment = HorizontalAlignment.Left;
  203. me_message.Children.Add(button);
  204. }
  205. SelectNode = menu.Header.ToString();
  206. }
  207. /// <summary>
  208. /// 系统
  209. /// </summary>
  210. /// <param name="sender"></param>
  211. /// <param name="e"></param>
  212. private void me_systemClick(object sender, RoutedEventArgs e)
  213. {
  214. MenuItem menu = sender as MenuItem;
  215. if (menu == null) return;
  216. me_message.Children.Clear();
  217. foreach (var item in xitong2)
  218. {
  219. Button button = new Button();
  220. button.Content = item.SeconNode;
  221. button.BorderThickness = new Thickness(0);
  222. button.Width = 180;
  223. button.Height = 30;
  224. button.Tag = item;
  225. button.Click += new RoutedEventHandler(messageBtnClick);
  226. button.HorizontalContentAlignment = HorizontalAlignment.Left;
  227. me_message.Children.Add(button);
  228. }
  229. SelectNode = menu.Header.ToString();
  230. }
  231. /// <summary>
  232. /// 具体消息按钮
  233. /// </summary>
  234. /// <param name="sender"></param>
  235. /// <param name="e"></param>
  236. private void messageBtnClick(object sender, RoutedEventArgs e)
  237. {
  238. Button button = sender as Button;
  239. MessageData announcement = button.Tag as MessageData;
  240. if (announcement == null) return;
  241. List<string> specificContent = announcement.ThreeNodes;
  242. me_right.Children.Clear();
  243. foreach (var specificConten in specificContent)
  244. {
  245. TextBlock textBlock = new TextBlock();
  246. textBlock.Text = specificConten;
  247. textBlock.FontSize = 15;
  248. textBlock.FontFamily = new FontFamily("黑体");
  249. me_right.Children.Add(textBlock);
  250. }
  251. if (SelectNode.Equals("项目"))
  252. {
  253. DockPanel dockPanel = new DockPanel();
  254. dockPanel.Margin = new Thickness(0, 10, 30, 0);
  255. dockPanel.HorizontalAlignment = HorizontalAlignment.Right;
  256. TextBlock textBlock = new TextBlock();
  257. textBlock.Text = "查看";
  258. textBlock.FontSize = 13;
  259. textBlock.Foreground = new SolidColorBrush(Colors.Green);
  260. textBlock.TextDecorations = TextDecorations.Underline;
  261. textBlock.Margin = new Thickness(0, 0, 10, 0);
  262. textBlock.FontFamily = new FontFamily("黑体");
  263. //textBlock.PreviewMouseLeftButtonDown += new MouseButtonEventHandler(Message_Look);
  264. dockPanel.Children.Add(textBlock);
  265. TextBlock textBlock2 = new TextBlock();
  266. textBlock2.Text = "忽略";
  267. textBlock2.FontSize = 13;
  268. textBlock2.FontFamily = new FontFamily("黑体");
  269. textBlock2.Foreground = new SolidColorBrush(Colors.Green);
  270. textBlock2.TextDecorations = TextDecorations.Underline;
  271. //textBlock2.PreviewMouseLeftButtonDown += new MouseButtonEventHandler(Message_Ignore);
  272. dockPanel.Children.Add(textBlock2);
  273. me_right.Children.Add(dockPanel);
  274. }
  275. }
  276. }
  277. }