HomepageForm.xaml.cs 35 KB

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