HomepageForm.xaml.cs 37 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997
  1. using CollaborativePlatformMain.DFEntity;
  2. using CollaborativePlatformMain.Form.UserControlForm;
  3. using CollaborativePlatformMain.Util;
  4. using HandyControl.Controls;
  5. using System;
  6. using System.Collections.Generic;
  7. using System.Collections.ObjectModel;
  8. using System.Diagnostics.Eventing.Reader;
  9. using System.Drawing.Printing;
  10. using System.Linq;
  11. using System.Text;
  12. using System.Threading.Tasks;
  13. using System.Windows;
  14. using System.Windows.Controls;
  15. using System.Windows.Data;
  16. using System.Windows.Documents;
  17. using System.Windows.Input;
  18. using System.Windows.Media;
  19. using System.Windows.Media.Imaging;
  20. using System.Windows.Shapes;
  21. using Window = System.Windows.Window;
  22. using MessageBox = System.Windows.MessageBox;
  23. using static System.Net.Mime.MediaTypeNames;
  24. using CollaborativePlatformMain.Form.MessageSubPage;
  25. using CollaborativePlatformMain.Form.MessageSubPage.CreatLevel;
  26. namespace CollaborativePlatformMain.Form
  27. {
  28. /// <summary>
  29. /// HomepageForm.xaml 的交互逻辑
  30. /// </summary>
  31. public partial class HomepageForm : Window
  32. {
  33. public HomepageForm()
  34. {
  35. InitializeComponent();
  36. }
  37. #region 最左边消息
  38. /// <summary>
  39. /// 消息
  40. /// </summary>
  41. /// <param name="sender"></param>
  42. /// <param name="e"></param>
  43. private void message_Click(object sender, MouseButtonEventArgs e)
  44. {
  45. MenuItem menuItem = sender as MenuItem;
  46. ModifyBackground(menuItem);
  47. dp_message.Visibility = Visibility.Visible;
  48. dp_project.Visibility = Visibility.Collapsed;
  49. dp_contacts.Visibility = Visibility.Collapsed;
  50. dp_gallery.Visibility = Visibility.Collapsed;
  51. dp_tools.Visibility = Visibility.Collapsed;
  52. dp_threetools.Visibility = Visibility.Collapsed;
  53. seconMessagePage.Navigate(new SeconMessagePage(this));
  54. //SwitchMethod(sender as MenuItem, true);
  55. }
  56. /// <summary>
  57. /// 项目下TreeView绑定的数据
  58. /// </summary>
  59. private List<TreeViewBind> treeViewBinds = new List<TreeViewBind>();
  60. /// <summary>
  61. /// 项目
  62. /// </summary>
  63. /// <param name="sender"></param>
  64. /// <param name="e"></param>
  65. private void project_Click(object sender, MouseButtonEventArgs e)
  66. {
  67. MenuItem menuItem = sender as MenuItem;
  68. ModifyBackground(menuItem);
  69. dp_message.Visibility = Visibility.Collapsed;
  70. dp_project.Visibility = Visibility.Visible;
  71. dp_contacts.Visibility = Visibility.Collapsed;
  72. dp_gallery.Visibility = Visibility.Collapsed;
  73. dp_tools.Visibility = Visibility.Collapsed;
  74. dp_threetools.Visibility = Visibility.Collapsed;
  75. treeViewBinds = new List<TreeViewBind>();
  76. treeViewBinds.Add(
  77. new TreeViewBind("小学项目",
  78. new List<TreeViewBind>()
  79. {
  80. new TreeViewBind("一号楼",
  81. new List<TreeViewBind>()
  82. {
  83. new TreeViewBind("项目信息"),
  84. new TreeViewBind("团队成员"),
  85. new TreeViewBind("工作台", true),
  86. new TreeViewBind("自定义"),
  87. new TreeViewBind("+")
  88. }),
  89. new TreeViewBind("二号楼",
  90. new List<TreeViewBind>()
  91. {
  92. new TreeViewBind("项目信息"),
  93. new TreeViewBind("团队成员"),
  94. new TreeViewBind("工作台", true),
  95. new TreeViewBind("自定义"),
  96. new TreeViewBind("+")
  97. }),
  98. new TreeViewBind("三号楼",
  99. new List<TreeViewBind>()
  100. {
  101. new TreeViewBind("项目信息"),
  102. new TreeViewBind("团队成员"),
  103. new TreeViewBind("工作台", true),
  104. new TreeViewBind("自定义"),
  105. new TreeViewBind("+")
  106. })
  107. }));
  108. tr_vw.ItemsSource = null;
  109. tr_vw.ItemsSource = treeViewBinds;
  110. }
  111. /// <summary>
  112. /// 联系人
  113. /// </summary>
  114. /// <param name="sender"></param>
  115. /// <param name="e"></param>
  116. private void contacts_Click(object sender, MouseButtonEventArgs e)
  117. {
  118. MenuItem menuItem = sender as MenuItem;
  119. ModifyBackground(menuItem);
  120. dp_message.Visibility = Visibility.Collapsed;
  121. dp_project.Visibility = Visibility.Collapsed;
  122. dp_contacts.Visibility = Visibility.Visible;
  123. dp_gallery.Visibility = Visibility.Visible;
  124. dp_tools.Visibility = Visibility.Collapsed;
  125. dp_threetools.Visibility = Visibility.Collapsed;
  126. seconContactsPage.Navigate(new SeconContactsPage(this));
  127. }
  128. /// <summary>
  129. /// 图库大样图
  130. /// </summary>
  131. /// <param name="sender"></param>
  132. /// <param name="e"></param>
  133. private void gallery_Click(object sender, MouseButtonEventArgs e)
  134. {
  135. MenuItem menuItem = sender as MenuItem;
  136. ModifyBackground(menuItem);
  137. dp_message.Visibility = Visibility.Collapsed;
  138. dp_project.Visibility = Visibility.Collapsed;
  139. dp_contacts.Visibility = Visibility.Collapsed;
  140. dp_gallery.Visibility = Visibility.Visible;
  141. dp_tools.Visibility = Visibility.Collapsed;
  142. dp_threetools.Visibility = Visibility.Collapsed;
  143. seconLegendPage.Navigate(new SeconLegendPage());
  144. }
  145. /// <summary>
  146. /// 工具库
  147. /// </summary>
  148. /// <param name="sender"></param>
  149. /// <param name="e"></param>
  150. private void tool_Click(object sender, MouseButtonEventArgs e)
  151. {
  152. MenuItem menuItem = sender as MenuItem;
  153. ModifyBackground(menuItem);
  154. dp_message.Visibility = Visibility.Collapsed;
  155. dp_project.Visibility = Visibility.Collapsed;
  156. dp_contacts.Visibility = Visibility.Collapsed;
  157. dp_gallery.Visibility = Visibility.Collapsed;
  158. dp_tools.Visibility = Visibility.Visible;
  159. dp_threetools.Visibility = Visibility.Collapsed;
  160. List<string> sLists = new List<string>() { "平台图纸治理", "块处理", "大样处理", "图纸对比", "二维审查", "三维" };
  161. sp_tools.Children.Clear();
  162. foreach (string s in sLists)
  163. {
  164. Button button = new Button();
  165. button.Content = s;
  166. button.BorderThickness = new Thickness(0);
  167. button.Width = 180;
  168. button.Height = 30;
  169. button.Click += new RoutedEventHandler(toolnavigation_Click);
  170. button.HorizontalContentAlignment = HorizontalAlignment.Left;
  171. sp_tools.Children.Add(button);
  172. }
  173. if (ToolsForm == null)
  174. {
  175. ToolsForm = new ToolsForm(this, ToolLists);
  176. ToolsForm.Show();
  177. }
  178. }
  179. /// <summary>
  180. /// 三维
  181. /// </summary>
  182. /// <param name="sender"></param>
  183. /// <param name="e"></param>
  184. private void three_Click(object sender, MouseButtonEventArgs e)
  185. {
  186. MenuItem menuItem = sender as MenuItem;
  187. ModifyBackground(menuItem);
  188. dp_message.Visibility = Visibility.Collapsed;
  189. dp_project.Visibility = Visibility.Collapsed;
  190. dp_contacts.Visibility = Visibility.Collapsed;
  191. dp_gallery.Visibility = Visibility.Collapsed;
  192. dp_tools.Visibility = Visibility.Collapsed;
  193. dp_threetools.Visibility = Visibility.Visible;
  194. seconThreeTools.Navigate(new SeconThreeDimensionalPage(this));
  195. }
  196. /// <summary>
  197. /// 设置最左测导航的颜色
  198. /// </summary>
  199. /// <param name="menuItem"></param>
  200. /// <param name="isHoShow"></param>
  201. public void ModifyBackground(MenuItem menuItem)
  202. {
  203. List<MenuItem> allMenuItems = CollaborationUtil.GetChildObjects<System.Windows.Controls.MenuItem>(mu_leftMenu);
  204. foreach (var baseMenuItem in allMenuItems)
  205. {
  206. if (baseMenuItem.Header.ToString() == menuItem.Header.ToString())
  207. {
  208. baseMenuItem.Background = new SolidColorBrush(Colors.Beige);
  209. }
  210. else
  211. {
  212. baseMenuItem.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#1E9FFF"));
  213. }
  214. }
  215. }
  216. #endregion
  217. #region 工具中间按钮
  218. private ObservableCollection<CBButtonControlsData> ToolLists = new ObservableCollection<CBButtonControlsData>();
  219. /// <summary>
  220. /// 功能名字对应的功能数据
  221. /// </summary>
  222. private Dictionary<string, ObservableCollection<CBButtonControlsData>> ToolName_ToolDatas = new Dictionary<string, ObservableCollection<CBButtonControlsData>>()
  223. {
  224. {
  225. "平台图纸治理",new ObservableCollection<CBButtonControlsData>()
  226. {
  227. new CBButtonControlsData("功能1",false,""),
  228. new CBButtonControlsData("功能2",false,""),
  229. new CBButtonControlsData("功能3",false,""),
  230. new CBButtonControlsData("功能4",false,""),
  231. new CBButtonControlsData("功能5",false,""),
  232. new CBButtonControlsData("功能6",false,""),
  233. new CBButtonControlsData("功能7",false,""),
  234. new CBButtonControlsData("功能8",false,""),
  235. }
  236. },
  237. {
  238. "块处理",new ObservableCollection<CBButtonControlsData>()
  239. {
  240. new CBButtonControlsData("处理1",false,""),
  241. new CBButtonControlsData("处理2",false,""),
  242. new CBButtonControlsData("处理3",false,""),
  243. new CBButtonControlsData("处理4",false,""),
  244. new CBButtonControlsData("处理5",false,""),
  245. new CBButtonControlsData("处理6",false,""),
  246. new CBButtonControlsData("处理7",false,""),
  247. new CBButtonControlsData("处理8",false,""),
  248. }
  249. },
  250. {
  251. "大样处理",new ObservableCollection<CBButtonControlsData>()
  252. {
  253. new CBButtonControlsData("大样1",false,""),
  254. new CBButtonControlsData("大样2",false,""),
  255. new CBButtonControlsData("大样3",false,""),
  256. new CBButtonControlsData("大样4",false,""),
  257. new CBButtonControlsData("大样5",false,""),
  258. new CBButtonControlsData("大样6",false,""),
  259. new CBButtonControlsData("大样7",false,""),
  260. new CBButtonControlsData("大样8",false,""),
  261. }
  262. },
  263. {
  264. "图纸对比",new ObservableCollection<CBButtonControlsData>()
  265. {
  266. new CBButtonControlsData("图纸对比",false,"")
  267. }
  268. },
  269. {
  270. "二维审查",new ObservableCollection<CBButtonControlsData>()
  271. {
  272. new CBButtonControlsData("二维审查",false,"")
  273. }
  274. }, {
  275. "三维",new ObservableCollection<CBButtonControlsData>()
  276. {
  277. new CBButtonControlsData("三维",false,"")
  278. }
  279. },
  280. };
  281. private void toolnavigation_Click(object sender, RoutedEventArgs e)
  282. {
  283. Button button = sender as Button;
  284. if (button != null && ToolName_ToolDatas.ContainsKey(button.Content.ToString()))
  285. {
  286. ObservableCollection<CBButtonControlsData> cbButtonControls = ToolName_ToolDatas[button.Content.ToString()];
  287. wp_tools.Children.Clear();
  288. foreach (var cbButtonControl in cbButtonControls)
  289. {
  290. wp_tools.Children.Add(new CBButtonControls(cbButtonControl));
  291. }
  292. }
  293. }
  294. /// <summary>
  295. /// 添加漂浮工具
  296. /// </summary>
  297. /// <param name="sender"></param>
  298. /// <param name="e"></param>
  299. private void bt_addTools(object sender, RoutedEventArgs e)
  300. {
  301. foreach (var tool in ToolName_ToolDatas)
  302. {
  303. foreach (var value in tool.Value)
  304. {
  305. if (!value.CbIsCheck)
  306. {
  307. if (ToolLists.Where(x => x.Guid.Equals(value.Guid)).Count() > 0)
  308. {
  309. for (int i = 0; i < ToolLists.Count; i++)
  310. {
  311. if (ToolLists[i].Guid.Equals(value.Guid))
  312. {
  313. ToolLists.RemoveAt(i);
  314. i--;
  315. }
  316. }
  317. }
  318. }
  319. else
  320. {
  321. if (ToolLists.Where(x => x.Guid.Equals(value.Guid)).Count() > 0) continue;
  322. ToolLists.Add(value);
  323. }
  324. }
  325. }
  326. }
  327. /// <summary>
  328. /// 悬浮窗窗体
  329. /// </summary>
  330. public ToolsForm ToolsForm;
  331. /// <summary>
  332. /// 悬浮窗
  333. /// </summary>
  334. private ObservableCollection<LVProjectInfoEntity> ToolDatas = new ObservableCollection<LVProjectInfoEntity>()
  335. {
  336. new LVProjectInfoEntity("图纸对比", ""),
  337. new LVProjectInfoEntity("超模全解析", ""),
  338. new LVProjectInfoEntity("超模数字化建模", "")
  339. };
  340. #endregion
  341. #region 中间的按钮
  342. private void General_Click(object sender, MouseButtonEventArgs e)
  343. {
  344. }
  345. #endregion
  346. #region 横向通知消息栏
  347. private List<Button> menuItems = new List<Button>();
  348. /// <summary>
  349. /// 通知公告数据
  350. /// </summary>
  351. private List<NotificationAnnouncement> notificationDatas = new List<NotificationAnnouncement>();
  352. /// <summary>
  353. /// 通知公告
  354. /// </summary>
  355. /// <param name="sender"></param>
  356. /// <param name="e"></param>
  357. private void me_announcementClick(object sender, RoutedEventArgs e)
  358. {
  359. //notificationDatas = new List<NotificationAnnouncement>();
  360. //for (int i = 0; i < new List<string>() { "国博城项目建筑图纸更新", "北京大兴项目结构图纸更新", "绿地项目人防图纸更新" }.Count; i++)
  361. //{
  362. // NotificationAnnouncement notificationAnnouncement = new NotificationAnnouncement();
  363. // notificationAnnouncement.MessageCategory = "通知公告";
  364. // if (i == 0)
  365. // {
  366. // notificationAnnouncement.Content = "国博城项目总消息";
  367. // notificationAnnouncement.SpecificContent = "按甲方要求,国博城项目务必在4月15号之前完成报审版。";
  368. // }
  369. // else if (i == 1)
  370. // {
  371. // notificationAnnouncement.Content = "北京大兴项目总消息";
  372. // notificationAnnouncement.SpecificContent = "按甲方要求,北京大兴项目务必在4月22号之前完成报审版。";
  373. // }
  374. // else if (i == 2)
  375. // {
  376. // notificationAnnouncement.Content = "绿地项目总消息";
  377. // notificationAnnouncement.SpecificContent = "按甲方要求,绿地项目务必在4月30号之前完成报审版。";
  378. // }
  379. // notificationDatas.Add(notificationAnnouncement);
  380. //}
  381. //me_message.Children.Clear();
  382. //foreach (var notificationData in notificationDatas)
  383. //{
  384. // Button button = new Button();
  385. // button.Content = notificationData.Content;
  386. // button.BorderThickness = new Thickness(0);
  387. // button.Width = 180;
  388. // button.Height = 30;
  389. // button.Click += new RoutedEventHandler(messageBtnClick);
  390. // button.Tag = notificationData;
  391. // button.HorizontalContentAlignment = HorizontalAlignment.Left;
  392. // me_message.Children.Add(button);
  393. //}
  394. }
  395. /// <summary>
  396. /// 项目
  397. /// </summary>
  398. /// <param name="sender"></param>
  399. /// <param name="e"></param>
  400. private void me_projectClick(object sender, RoutedEventArgs e)
  401. {
  402. //notificationDatas = new List<NotificationAnnouncement>();
  403. //foreach (var xiangmu in new List<string>() { "国博城项目建筑图纸更新", "北京大兴项目结构图纸更新", "绿地项目人防图纸更新" })
  404. //{
  405. // NotificationAnnouncement notificationAnnouncement = new NotificationAnnouncement();
  406. // notificationAnnouncement.Content = xiangmu;
  407. // notificationAnnouncement.MessageCategory = "项目消息";
  408. // if (xiangmu.Equals("国博城项目建筑图纸更新"))
  409. // {
  410. // notificationAnnouncement.SpecificContent = "国博城项目建筑1#楼3层更新。";
  411. // }
  412. // else if (xiangmu.Equals("北京大兴项目结构图纸更新"))
  413. // {
  414. // notificationAnnouncement.SpecificContent = "北京大兴项目结构2#楼1层墙柱平法图更新。";
  415. // }
  416. // else if (xiangmu.Equals("绿地项目人防图纸更新"))
  417. // {
  418. // notificationAnnouncement.SpecificContent = "绿地项目地下人防图更新。";
  419. // }
  420. // notificationDatas.Add(notificationAnnouncement);
  421. //}
  422. //me_message.Children.Clear();
  423. //foreach (var notificationData in notificationDatas)
  424. //{
  425. // Button button = new Button();
  426. // button.Content = notificationData.Content;
  427. // button.BorderThickness = new Thickness(0);
  428. // button.Width = 180;
  429. // button.Height = 30;
  430. // button.Click += new RoutedEventHandler(messageBtnClick);
  431. // button.Tag = notificationData;
  432. // button.HorizontalContentAlignment = HorizontalAlignment.Left;
  433. // me_message.Children.Add(button);
  434. //}
  435. }
  436. /// <summary>
  437. /// 系统
  438. /// </summary>
  439. /// <param name="sender"></param>
  440. /// <param name="e"></param>
  441. private void me_systemClick(object sender, RoutedEventArgs e)
  442. {
  443. // NotificationAnnouncement notificationAnnouncement = new NotificationAnnouncement();
  444. // notificationAnnouncement.Content = "系统更新";
  445. // notificationAnnouncement.SpecificContent = "交互平台版本更新至2.0版本· 本次更新了:· 1.主界面消息分组。· 2.修改了登陆界面。· 请及时更新!!";
  446. // notificationAnnouncement.MessageCategory = "系统消息";
  447. // NotificationAnnouncement notificationAnnouncement2 = new NotificationAnnouncement();
  448. // notificationAnnouncement2.Content = "停服升级";
  449. // notificationAnnouncement2.SpecificContent = "交互平台版本将在4月13日8点20分至4月13日8点50分进行停服更新·本次停服更新不会导致您的数据丢失。";
  450. // notificationAnnouncement2.MessageCategory = "系统消息";
  451. // notificationDatas = new List<NotificationAnnouncement>()
  452. // {
  453. // notificationAnnouncement,
  454. // notificationAnnouncement2
  455. //};
  456. // me_message.Children.Clear();
  457. // foreach (var notificationData in notificationDatas)
  458. // {
  459. // Button button = new Button();
  460. // button.Content = notificationData.Content;
  461. // button.BorderThickness = new Thickness(0);
  462. // button.Width = 180;
  463. // button.Height = 30;
  464. // button.Click += new RoutedEventHandler(messageBtnClick);
  465. // button.Tag = notificationData;
  466. // button.HorizontalContentAlignment = HorizontalAlignment.Left;
  467. // me_message.Children.Add(button);
  468. // }
  469. }
  470. /// <summary>
  471. /// 具体消息按钮
  472. /// </summary>
  473. /// <param name="sender"></param>
  474. /// <param name="e"></param>
  475. private void messageBtnClick(object sender, RoutedEventArgs e)
  476. {
  477. //me_right.Children.Clear();
  478. //Button button = sender as Button;
  479. //NotificationAnnouncement announcement = button.Tag as NotificationAnnouncement;
  480. //List<string> specificContent = announcement.SpecificContent.Split('·').ToList();
  481. //foreach (var specificConten in specificContent)
  482. //{
  483. // TextBlock textBlock = new TextBlock();
  484. // textBlock.Text = specificConten;
  485. // textBlock.FontSize = 15;
  486. // textBlock.FontFamily = new FontFamily("黑体");
  487. // me_right.Children.Add(textBlock);
  488. //}
  489. //if (announcement.MessageCategory.Equals("项目消息"))
  490. //{
  491. // DockPanel dockPanel = new DockPanel();
  492. // dockPanel.Margin = new Thickness(0, 10, 30, 0);
  493. // dockPanel.HorizontalAlignment = HorizontalAlignment.Right;
  494. // TextBlock textBlock = new TextBlock();
  495. // textBlock.Text = "查看";
  496. // textBlock.FontSize = 13;
  497. // textBlock.Foreground = new SolidColorBrush(Colors.Green);
  498. // textBlock.TextDecorations = TextDecorations.Underline;
  499. // textBlock.Margin = new Thickness(0, 0, 10, 0);
  500. // textBlock.FontFamily = new FontFamily("黑体");
  501. // textBlock.PreviewMouseLeftButtonDown += new MouseButtonEventHandler(Message_Look);
  502. // dockPanel.Children.Add(textBlock);
  503. // TextBlock textBlock2 = new TextBlock();
  504. // textBlock2.Text = "忽略";
  505. // textBlock2.FontSize = 13;
  506. // textBlock2.FontFamily = new FontFamily("黑体");
  507. // textBlock2.Foreground = new SolidColorBrush(Colors.Green);
  508. // textBlock2.TextDecorations = TextDecorations.Underline;
  509. // textBlock2.PreviewMouseLeftButtonDown += new MouseButtonEventHandler(Message_Ignore);
  510. // dockPanel.Children.Add(textBlock2);
  511. // me_right.Children.Add(dockPanel);
  512. //}
  513. }
  514. /// <summary>
  515. /// 查看消息
  516. /// </summary>
  517. /// <param name="sender"></param>
  518. /// <param name="e"></param>
  519. public void Message_Look(object sender, RoutedEventArgs e)
  520. {
  521. MessageBox.Show("查看消息");
  522. }
  523. /// <summary>
  524. /// 忽略消息
  525. /// </summary>
  526. /// <param name="sender"></param>
  527. /// <param name="e"></param>
  528. public void Message_Ignore(object sender, RoutedEventArgs e)
  529. {
  530. MessageBox.Show("忽略消息");
  531. }
  532. #endregion
  533. #region 项目中间部分
  534. /// <summary>
  535. /// 项目信息示例
  536. /// </summary>
  537. private ObservableCollection<LVProjectInfoEntity> lvProjects = new ObservableCollection<LVProjectInfoEntity>()
  538. {
  539. new LVProjectInfoEntity("项目名称:", "北京大兴项目"),
  540. new LVProjectInfoEntity("项目业态:", "住宅"),
  541. new LVProjectInfoEntity("项目地址:", "山东省济南市"),
  542. new LVProjectInfoEntity("项目团队:", "项目团队")
  543. };
  544. /// <summary>
  545. /// 项目信息示例
  546. /// </summary>
  547. private ObservableCollection<LVTeamMembersEntity> lvTeamMemberss = new ObservableCollection<LVTeamMembersEntity>()
  548. {
  549. new LVTeamMembersEntity("主管:", "李明"),
  550. new LVTeamMembersEntity("建筑组员:", "李明"),
  551. new LVTeamMembersEntity("结构组员:", "张修"),
  552. new LVTeamMembersEntity("给排水组员:", "邢华"),
  553. new LVTeamMembersEntity("暖通组员:", "杨程"),
  554. new LVTeamMembersEntity("电气组员:", "欧瑞"),
  555. };
  556. /// <summary>
  557. /// 项目TreeView
  558. /// </summary>
  559. /// <param name="sender"></param>
  560. /// <param name="e"></param>
  561. private void tv_projectLeftButtonUp(object sender, MouseButtonEventArgs e)
  562. {
  563. #region 隐藏所有的无用控件
  564. lv_projectInfo.Visibility = Visibility.Collapsed;
  565. sp_info.Visibility = Visibility.Collapsed;
  566. sp_work.Visibility = Visibility.Collapsed;
  567. sp_addPro.Visibility = Visibility.Collapsed;
  568. #endregion
  569. TreeViewBind treeView = tr_vw.SelectedItem as TreeViewBind;
  570. if (treeView == null) return;
  571. string name = treeView.Name;
  572. if (name.Equals("项目信息"))
  573. {
  574. sp_info.Visibility = Visibility.Visible;
  575. lv_projectInfo.Visibility = Visibility.Visible;
  576. lv_projectInfo.ItemsSource = null;
  577. lv_projectInfo.ItemsSource = lvProjects;
  578. }
  579. else if (name.Equals("团队成员"))
  580. {
  581. sp_info.Visibility = Visibility.Visible;
  582. lv_projectInfo.Visibility = Visibility.Visible;
  583. lv_projectInfo.ItemsSource = null;
  584. lv_projectInfo.ItemsSource = lvTeamMemberss;
  585. }
  586. else if (name.Equals("工作台"))
  587. {
  588. sp_work.Visibility = Visibility.Visible;
  589. tr_is.ItemsSource = null;
  590. if (!treeView.IsPro)
  591. {
  592. List<TreeViewBind> TreeViewDatas = new List<TreeViewBind>();
  593. TreeViewDatas.Add(new TreeViewBind("小学项目", new List<TreeViewBind>() { new TreeViewBind("新建图纸") }));
  594. this.tr_is.ItemsSource = TreeViewDatas;
  595. }
  596. else
  597. {
  598. this.tr_is.ItemsSource = TreeViewDatas;
  599. }
  600. }
  601. else if (name.Equals("自定义"))
  602. {
  603. }
  604. }
  605. /// <summary>
  606. /// lv内修改按钮
  607. /// </summary>
  608. /// <param name="sender"></param>
  609. /// <param name="e"></param>
  610. private void btn_lv_update(object sender, RoutedEventArgs e)
  611. {
  612. Button button = sender as Button;
  613. LVProjectInfoEntity lvProjectInfo = button.Tag as LVProjectInfoEntity;
  614. if (lvProjectInfo != null)
  615. {
  616. }
  617. }
  618. /// <summary>
  619. /// 上传图纸
  620. /// </summary>
  621. /// <param name="sender"></param>
  622. /// <param name="e"></param>
  623. private void Button_Click(object sender, RoutedEventArgs e)
  624. {
  625. TreeViewBind treeViewBind = TreeViewDatas.First(s => s.Name.Equals("小学项目 一号楼"));
  626. UploadDrawingForm upWindow = new UploadDrawingForm(TreeViewDatas);
  627. foreach (var item in treeViewBind.Children)
  628. {
  629. if (item.Name.Equals("上传新图")) continue;
  630. upWindow.str.Add(item.Name);
  631. }
  632. upWindow.ShowDialog();
  633. this.tr_is.ItemsSource = null;
  634. this.tr_is.ItemsSource = TreeViewDatas;
  635. }
  636. #region 工作台
  637. /// <summary>
  638. /// 工作台数据绑定
  639. /// </summary>
  640. public static ObservableCollection<TreeViewBind> TreeViewDatas = new ObservableCollection<TreeViewBind>()
  641. {
  642. new TreeViewBind("小学项目 一号楼",
  643. new List<TreeViewBind>()
  644. {
  645. new TreeViewBind("上传图纸")
  646. })
  647. };
  648. /// <summary>
  649. /// 版本名称
  650. /// </summary>
  651. private List<string> ProVersions = new List<string>();
  652. /// <summary>
  653. /// 本专业
  654. /// </summary>
  655. /// <param name="sender"></param>
  656. /// <param name="e"></param>
  657. private void pre_Click(object sender, MouseButtonEventArgs e)
  658. {
  659. tr_all.Visibility = Visibility.Collapsed;
  660. tr_is.Visibility = Visibility.Visible;
  661. bt_proBig.Visibility = Visibility.Collapsed;
  662. }
  663. /// <summary>
  664. /// 全专业
  665. /// </summary>
  666. /// <param name="sender"></param>
  667. /// <param name="e"></param>
  668. private void all_Click(object sender, MouseButtonEventArgs e)
  669. {
  670. tr_is.Visibility = Visibility.Collapsed;
  671. tr_all.Visibility = Visibility.Visible;
  672. tv_building.ItemsSource = null;
  673. tv_building.ItemsSource = TreeViewDatas;
  674. bt_proBig.Visibility = Visibility.Visible;
  675. }
  676. /// <summary>
  677. /// treeview点击
  678. /// </summary>
  679. /// <param name="sender"></param>
  680. /// <param name="e"></param>
  681. private void tr_is_PreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e)
  682. {
  683. TreeViewBind treeView = tr_is.SelectedItem as TreeViewBind;
  684. //切换展开和下拉
  685. if (treeView == null)
  686. {
  687. return;
  688. }
  689. if (tr_is.ItemContainerGenerator.ContainerFromItem(treeView) is TreeViewItem currentItem)
  690. {
  691. if (!currentItem.IsExpanded)
  692. {
  693. currentItem.IsExpanded = true;
  694. }
  695. else
  696. {
  697. currentItem.IsExpanded = false;
  698. }
  699. }
  700. if (treeView.Name.Contains("更新图纸"))
  701. {
  702. TreeViewBind treeViewBind = TreeViewDatas.First(s => s.Name.Equals("小学项目 一号楼"));
  703. UploadDrawingForm upWindow = new UploadDrawingForm(TreeViewDatas);
  704. foreach (var item in treeViewBind.Children)
  705. {
  706. if (item.Name.Equals("治理图纸")) break;
  707. upWindow.str.Add(item.Name);
  708. }
  709. upWindow.ShowDialog();
  710. string t7 = DateTime.Now.ToShortTimeString();
  711. string t3 = DateTime.Now.ToLongDateString() + t7;
  712. string proVersion = "";
  713. if (ProVersions.Contains(t3 + "版本"))
  714. {
  715. int proVersionIndex = 0;
  716. for (int i = 0; i < 100; i++)
  717. {
  718. int j = i + 1;
  719. if (ProVersions.Contains(t3 + "(" + j + ")" + "版本"))
  720. {
  721. continue;
  722. }
  723. else
  724. {
  725. proVersionIndex = i + 1;
  726. break;
  727. }
  728. }
  729. proVersion = t3 + "(" + proVersionIndex + ")" + "版本";
  730. }
  731. else
  732. {
  733. proVersion = t3 + "版本";
  734. }
  735. ProVersions.Add(proVersion);
  736. TreeViewBind TreeViewBind1 = new TreeViewBind(proVersion, new List<TreeViewBind>()
  737. {
  738. new TreeViewBind("原图"),
  739. new TreeViewBind("对比图"),
  740. new TreeViewBind("治理图纸", new List<TreeViewBind>()
  741. {
  742. new TreeViewBind("F1"),
  743. new TreeViewBind("F2",
  744. new List<TreeViewBind>()
  745. {
  746. new TreeViewBind("墙柱"),
  747. new TreeViewBind("门窗"),
  748. new TreeViewBind("功能区标签"),
  749. new TreeViewBind("未命名")
  750. })
  751. })
  752. });
  753. int index = CollaborationUtil.GetIndexByTreeView("更新图纸", TreeViewDatas.FirstOrDefault().Children);
  754. TreeViewDatas.FirstOrDefault().Children.Insert(index, TreeViewBind1);
  755. this.tr_is.ItemsSource = null;
  756. this.tr_is.ItemsSource = TreeViewDatas;
  757. }
  758. else if (treeView.Name.Contains("上传图纸"))
  759. {
  760. string t7 = DateTime.Now.ToShortTimeString();
  761. string t3 = DateTime.Now.ToLongDateString() + t7;
  762. ProVersions.Add(t3 + "版本");
  763. TreeViewBind TreeViewBind1 = new TreeViewBind(t3 + "版本", new List<TreeViewBind>()
  764. {
  765. new TreeViewBind("原图"),
  766. new TreeViewBind("治理图纸", new List<TreeViewBind>()
  767. {
  768. new TreeViewBind("F1"),
  769. new TreeViewBind("F2",
  770. new List<TreeViewBind>()
  771. {
  772. new TreeViewBind("墙柱"),
  773. new TreeViewBind("门窗"),
  774. new TreeViewBind("功能区标签"),
  775. new TreeViewBind("未命名")
  776. })
  777. })
  778. });
  779. TreeViewDatas.FirstOrDefault().Children.Insert(0, TreeViewBind1);
  780. TreeViewDatas.FirstOrDefault().Children.Add(new TreeViewBind("更新图纸"));
  781. for (int i = 0; i < TreeViewDatas.FirstOrDefault().Children.Count; i++)
  782. {
  783. if (TreeViewDatas.FirstOrDefault().Children[i].Name.Equals("上传图纸"))
  784. {
  785. TreeViewDatas.FirstOrDefault().Children.RemoveAt(i);
  786. i--;
  787. break;
  788. }
  789. }
  790. tr_is.ItemsSource = null;
  791. tr_is.ItemsSource = TreeViewDatas;
  792. }
  793. }
  794. /// <summary>
  795. /// 放大
  796. /// </summary>
  797. /// <param name="sender"></param>
  798. /// <param name="e"></param>
  799. private void bt_proBigClick(object sender, RoutedEventArgs e)
  800. {
  801. ProjectForm projectForm = new ProjectForm(this, TreeViewDatas);
  802. this.Hide();
  803. projectForm.ShowDialog();
  804. this.Show();
  805. }
  806. #endregion
  807. #region 新增项目
  808. private void bt_addPro(object sender, RoutedEventArgs e)
  809. {
  810. #region 隐藏所有的无用控件
  811. lv_projectInfo.Visibility = Visibility.Collapsed;
  812. sp_info.Visibility = Visibility.Collapsed;
  813. sp_work.Visibility = Visibility.Collapsed;
  814. #endregion
  815. sp_addPro.Visibility = Visibility.Visible;
  816. }
  817. private void close_Click(object sender, RoutedEventArgs e)
  818. {
  819. gd_top.Visibility = Visibility.Collapsed;
  820. }
  821. private void bd_Initialized(object sender, EventArgs e)
  822. {
  823. }
  824. private void st_Initialized(object sender, EventArgs e)
  825. {
  826. }
  827. private void wt_Initialized(object sender, EventArgs e)
  828. {
  829. }
  830. private void wm_Initialized(object sender, EventArgs e)
  831. {
  832. }
  833. private void ele_Initialized(object sender, EventArgs e)
  834. {
  835. }
  836. private void submit_Click(object sender, RoutedEventArgs e)
  837. {
  838. }
  839. private void saveFile_Click(object sender, RoutedEventArgs e)
  840. {
  841. }
  842. private void savePage_Click(object sender, RoutedEventArgs e)
  843. {
  844. }
  845. private void ele_Click(object sender, RoutedEventArgs e)
  846. {
  847. }
  848. private void wm_Click(object sender, RoutedEventArgs e)
  849. {
  850. }
  851. private void wt_Click(object sender, RoutedEventArgs e)
  852. {
  853. }
  854. private void st_Click(object sender, RoutedEventArgs e)
  855. {
  856. }
  857. private void bd_Click(object sender, RoutedEventArgs e)
  858. {
  859. }
  860. #endregion
  861. #endregion
  862. /// <summary>
  863. /// 青蓝小助手
  864. /// </summary>
  865. /// <param name="sender"></param>
  866. /// <param name="e"></param>
  867. private void bt_qlxzs_Click(object sender, RoutedEventArgs e)
  868. {
  869. this.Visibility = Visibility.Collapsed;
  870. StandardizedAssistantForm assistantForm = new StandardizedAssistantForm(this);
  871. assistantForm.Show();
  872. }
  873. }
  874. }