HomepageForm.xaml.cs 36 KB

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