123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997 |
- using CollaborativePlatformMain.DFEntity;
- using CollaborativePlatformMain.Form.UserControlForm;
- using CollaborativePlatformMain.Util;
- using HandyControl.Controls;
- using System;
- using System.Collections.Generic;
- using System.Collections.ObjectModel;
- using System.Diagnostics.Eventing.Reader;
- using System.Drawing.Printing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Data;
- using System.Windows.Documents;
- using System.Windows.Input;
- using System.Windows.Media;
- using System.Windows.Media.Imaging;
- using System.Windows.Shapes;
- using Window = System.Windows.Window;
- using MessageBox = System.Windows.MessageBox;
- using static System.Net.Mime.MediaTypeNames;
- using CollaborativePlatformMain.Form.MessageSubPage;
- using CollaborativePlatformMain.Form.MessageSubPage.CreatLevel;
- namespace CollaborativePlatformMain.Form
- {
- /// <summary>
- /// HomepageForm.xaml 的交互逻辑
- /// </summary>
- public partial class HomepageForm : Window
- {
- public HomepageForm()
- {
- InitializeComponent();
- }
- #region 最左边消息
- /// <summary>
- /// 消息
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void message_Click(object sender, MouseButtonEventArgs e)
- {
- MenuItem menuItem = sender as MenuItem;
- ModifyBackground(menuItem);
- dp_message.Visibility = Visibility.Visible;
- dp_project.Visibility = Visibility.Collapsed;
- dp_contacts.Visibility = Visibility.Collapsed;
- dp_gallery.Visibility = Visibility.Collapsed;
- dp_tools.Visibility = Visibility.Collapsed;
- dp_threetools.Visibility = Visibility.Collapsed;
- seconMessagePage.Navigate(new SeconMessagePage(this));
- //SwitchMethod(sender as MenuItem, true);
- }
- /// <summary>
- /// 项目下TreeView绑定的数据
- /// </summary>
- private List<TreeViewBind> treeViewBinds = new List<TreeViewBind>();
- /// <summary>
- /// 项目
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void project_Click(object sender, MouseButtonEventArgs e)
- {
- MenuItem menuItem = sender as MenuItem;
- ModifyBackground(menuItem);
- dp_message.Visibility = Visibility.Collapsed;
- dp_project.Visibility = Visibility.Visible;
- dp_contacts.Visibility = Visibility.Collapsed;
- dp_gallery.Visibility = Visibility.Collapsed;
- dp_tools.Visibility = Visibility.Collapsed;
- dp_threetools.Visibility = Visibility.Collapsed;
- treeViewBinds = new List<TreeViewBind>();
- treeViewBinds.Add(
- new TreeViewBind("小学项目",
- new List<TreeViewBind>()
- {
- new TreeViewBind("一号楼",
- new List<TreeViewBind>()
- {
- new TreeViewBind("项目信息"),
- new TreeViewBind("团队成员"),
- new TreeViewBind("工作台", true),
- new TreeViewBind("自定义"),
- new TreeViewBind("+")
- }),
- new TreeViewBind("二号楼",
- new List<TreeViewBind>()
- {
- new TreeViewBind("项目信息"),
- new TreeViewBind("团队成员"),
- new TreeViewBind("工作台", true),
- new TreeViewBind("自定义"),
- new TreeViewBind("+")
- }),
- new TreeViewBind("三号楼",
- new List<TreeViewBind>()
- {
- new TreeViewBind("项目信息"),
- new TreeViewBind("团队成员"),
- new TreeViewBind("工作台", true),
- new TreeViewBind("自定义"),
- new TreeViewBind("+")
- })
- }));
- tr_vw.ItemsSource = null;
- tr_vw.ItemsSource = treeViewBinds;
- }
- /// <summary>
- /// 联系人
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void contacts_Click(object sender, MouseButtonEventArgs e)
- {
- MenuItem menuItem = sender as MenuItem;
- ModifyBackground(menuItem);
- dp_message.Visibility = Visibility.Collapsed;
- dp_project.Visibility = Visibility.Collapsed;
- dp_contacts.Visibility = Visibility.Visible;
- dp_gallery.Visibility = Visibility.Visible;
- dp_tools.Visibility = Visibility.Collapsed;
- dp_threetools.Visibility = Visibility.Collapsed;
- seconContactsPage.Navigate(new SeconContactsPage(this));
- }
- /// <summary>
- /// 图库大样图
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void gallery_Click(object sender, MouseButtonEventArgs e)
- {
- MenuItem menuItem = sender as MenuItem;
- ModifyBackground(menuItem);
- dp_message.Visibility = Visibility.Collapsed;
- dp_project.Visibility = Visibility.Collapsed;
- dp_contacts.Visibility = Visibility.Collapsed;
- dp_gallery.Visibility = Visibility.Visible;
- dp_tools.Visibility = Visibility.Collapsed;
- dp_threetools.Visibility = Visibility.Collapsed;
- seconLegendPage.Navigate(new SeconLegendPage());
- }
- /// <summary>
- /// 工具库
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void tool_Click(object sender, MouseButtonEventArgs e)
- {
- MenuItem menuItem = sender as MenuItem;
- ModifyBackground(menuItem);
- dp_message.Visibility = Visibility.Collapsed;
- dp_project.Visibility = Visibility.Collapsed;
- dp_contacts.Visibility = Visibility.Collapsed;
- dp_gallery.Visibility = Visibility.Collapsed;
- dp_tools.Visibility = Visibility.Visible;
- dp_threetools.Visibility = Visibility.Collapsed;
- List<string> sLists = new List<string>() { "平台图纸治理", "块处理", "大样处理", "图纸对比", "二维审查", "三维" };
- sp_tools.Children.Clear();
- foreach (string s in sLists)
- {
- Button button = new Button();
- button.Content = s;
- button.BorderThickness = new Thickness(0);
- button.Width = 180;
- button.Height = 30;
- button.Click += new RoutedEventHandler(toolnavigation_Click);
- button.HorizontalContentAlignment = HorizontalAlignment.Left;
- sp_tools.Children.Add(button);
- }
- if (ToolsForm == null)
- {
- ToolsForm = new ToolsForm(this, ToolLists);
- ToolsForm.Show();
- }
- }
- /// <summary>
- /// 三维
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void three_Click(object sender, MouseButtonEventArgs e)
- {
- MenuItem menuItem = sender as MenuItem;
- ModifyBackground(menuItem);
- dp_message.Visibility = Visibility.Collapsed;
- dp_project.Visibility = Visibility.Collapsed;
- dp_contacts.Visibility = Visibility.Collapsed;
- dp_gallery.Visibility = Visibility.Collapsed;
- dp_tools.Visibility = Visibility.Collapsed;
- dp_threetools.Visibility = Visibility.Visible;
- seconThreeTools.Navigate(new SeconThreeDimensionalPage(this));
- }
- /// <summary>
- /// 设置最左测导航的颜色
- /// </summary>
- /// <param name="menuItem"></param>
- /// <param name="isHoShow"></param>
- public void ModifyBackground(MenuItem menuItem)
- {
- List<MenuItem> allMenuItems = CollaborationUtil.GetChildObjects<System.Windows.Controls.MenuItem>(mu_leftMenu);
- foreach (var baseMenuItem in allMenuItems)
- {
- if (baseMenuItem.Header.ToString() == menuItem.Header.ToString())
- {
- baseMenuItem.Background = new SolidColorBrush(Colors.Beige);
- }
- else
- {
- baseMenuItem.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#1E9FFF"));
- }
- }
- }
- #endregion
- #region 工具中间按钮
- private ObservableCollection<CBButtonControlsData> ToolLists = new ObservableCollection<CBButtonControlsData>();
- /// <summary>
- /// 功能名字对应的功能数据
- /// </summary>
- private Dictionary<string, ObservableCollection<CBButtonControlsData>> ToolName_ToolDatas = new Dictionary<string, ObservableCollection<CBButtonControlsData>>()
- {
- {
- "平台图纸治理",new ObservableCollection<CBButtonControlsData>()
- {
- new CBButtonControlsData("功能1",false,""),
- new CBButtonControlsData("功能2",false,""),
- new CBButtonControlsData("功能3",false,""),
- new CBButtonControlsData("功能4",false,""),
- new CBButtonControlsData("功能5",false,""),
- new CBButtonControlsData("功能6",false,""),
- new CBButtonControlsData("功能7",false,""),
- new CBButtonControlsData("功能8",false,""),
- }
- },
- {
- "块处理",new ObservableCollection<CBButtonControlsData>()
- {
- new CBButtonControlsData("处理1",false,""),
- new CBButtonControlsData("处理2",false,""),
- new CBButtonControlsData("处理3",false,""),
- new CBButtonControlsData("处理4",false,""),
- new CBButtonControlsData("处理5",false,""),
- new CBButtonControlsData("处理6",false,""),
- new CBButtonControlsData("处理7",false,""),
- new CBButtonControlsData("处理8",false,""),
- }
- },
- {
- "大样处理",new ObservableCollection<CBButtonControlsData>()
- {
- new CBButtonControlsData("大样1",false,""),
- new CBButtonControlsData("大样2",false,""),
- new CBButtonControlsData("大样3",false,""),
- new CBButtonControlsData("大样4",false,""),
- new CBButtonControlsData("大样5",false,""),
- new CBButtonControlsData("大样6",false,""),
- new CBButtonControlsData("大样7",false,""),
- new CBButtonControlsData("大样8",false,""),
- }
- },
- {
- "图纸对比",new ObservableCollection<CBButtonControlsData>()
- {
- new CBButtonControlsData("图纸对比",false,"")
- }
- },
- {
- "二维审查",new ObservableCollection<CBButtonControlsData>()
- {
- new CBButtonControlsData("二维审查",false,"")
- }
- }, {
- "三维",new ObservableCollection<CBButtonControlsData>()
- {
- new CBButtonControlsData("三维",false,"")
- }
- },
- };
- private void toolnavigation_Click(object sender, RoutedEventArgs e)
- {
- Button button = sender as Button;
- if (button != null && ToolName_ToolDatas.ContainsKey(button.Content.ToString()))
- {
- ObservableCollection<CBButtonControlsData> cbButtonControls = ToolName_ToolDatas[button.Content.ToString()];
- wp_tools.Children.Clear();
- foreach (var cbButtonControl in cbButtonControls)
- {
- wp_tools.Children.Add(new CBButtonControls(cbButtonControl));
- }
- }
- }
- /// <summary>
- /// 添加漂浮工具
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void bt_addTools(object sender, RoutedEventArgs e)
- {
- foreach (var tool in ToolName_ToolDatas)
- {
- foreach (var value in tool.Value)
- {
- if (!value.CbIsCheck)
- {
- if (ToolLists.Where(x => x.Guid.Equals(value.Guid)).Count() > 0)
- {
- for (int i = 0; i < ToolLists.Count; i++)
- {
- if (ToolLists[i].Guid.Equals(value.Guid))
- {
- ToolLists.RemoveAt(i);
- i--;
- }
- }
- }
- }
- else
- {
- if (ToolLists.Where(x => x.Guid.Equals(value.Guid)).Count() > 0) continue;
- ToolLists.Add(value);
- }
- }
- }
- }
- /// <summary>
- /// 悬浮窗窗体
- /// </summary>
- public ToolsForm ToolsForm;
- /// <summary>
- /// 悬浮窗
- /// </summary>
- private ObservableCollection<LVProjectInfoEntity> ToolDatas = new ObservableCollection<LVProjectInfoEntity>()
- {
- new LVProjectInfoEntity("图纸对比", ""),
- new LVProjectInfoEntity("超模全解析", ""),
- new LVProjectInfoEntity("超模数字化建模", "")
- };
- #endregion
- #region 中间的按钮
- private void General_Click(object sender, MouseButtonEventArgs e)
- {
- }
- #endregion
- #region 横向通知消息栏
- private List<Button> menuItems = new List<Button>();
- /// <summary>
- /// 通知公告数据
- /// </summary>
- private List<NotificationAnnouncement> notificationDatas = new List<NotificationAnnouncement>();
- /// <summary>
- /// 通知公告
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void me_announcementClick(object sender, RoutedEventArgs e)
- {
- //notificationDatas = new List<NotificationAnnouncement>();
- //for (int i = 0; i < new List<string>() { "国博城项目建筑图纸更新", "北京大兴项目结构图纸更新", "绿地项目人防图纸更新" }.Count; i++)
- //{
- // NotificationAnnouncement notificationAnnouncement = new NotificationAnnouncement();
- // notificationAnnouncement.MessageCategory = "通知公告";
- // if (i == 0)
- // {
- // notificationAnnouncement.Content = "国博城项目总消息";
- // notificationAnnouncement.SpecificContent = "按甲方要求,国博城项目务必在4月15号之前完成报审版。";
- // }
- // else if (i == 1)
- // {
- // notificationAnnouncement.Content = "北京大兴项目总消息";
- // notificationAnnouncement.SpecificContent = "按甲方要求,北京大兴项目务必在4月22号之前完成报审版。";
- // }
- // else if (i == 2)
- // {
- // notificationAnnouncement.Content = "绿地项目总消息";
- // notificationAnnouncement.SpecificContent = "按甲方要求,绿地项目务必在4月30号之前完成报审版。";
- // }
- // notificationDatas.Add(notificationAnnouncement);
- //}
- //me_message.Children.Clear();
- //foreach (var notificationData in notificationDatas)
- //{
- // Button button = new Button();
- // button.Content = notificationData.Content;
- // button.BorderThickness = new Thickness(0);
- // button.Width = 180;
- // button.Height = 30;
- // button.Click += new RoutedEventHandler(messageBtnClick);
- // button.Tag = notificationData;
- // button.HorizontalContentAlignment = HorizontalAlignment.Left;
- // me_message.Children.Add(button);
- //}
- }
- /// <summary>
- /// 项目
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void me_projectClick(object sender, RoutedEventArgs e)
- {
- //notificationDatas = new List<NotificationAnnouncement>();
- //foreach (var xiangmu in new List<string>() { "国博城项目建筑图纸更新", "北京大兴项目结构图纸更新", "绿地项目人防图纸更新" })
- //{
- // NotificationAnnouncement notificationAnnouncement = new NotificationAnnouncement();
- // notificationAnnouncement.Content = xiangmu;
- // notificationAnnouncement.MessageCategory = "项目消息";
- // if (xiangmu.Equals("国博城项目建筑图纸更新"))
- // {
- // notificationAnnouncement.SpecificContent = "国博城项目建筑1#楼3层更新。";
- // }
- // else if (xiangmu.Equals("北京大兴项目结构图纸更新"))
- // {
- // notificationAnnouncement.SpecificContent = "北京大兴项目结构2#楼1层墙柱平法图更新。";
- // }
- // else if (xiangmu.Equals("绿地项目人防图纸更新"))
- // {
- // notificationAnnouncement.SpecificContent = "绿地项目地下人防图更新。";
- // }
- // notificationDatas.Add(notificationAnnouncement);
- //}
- //me_message.Children.Clear();
- //foreach (var notificationData in notificationDatas)
- //{
- // Button button = new Button();
- // button.Content = notificationData.Content;
- // button.BorderThickness = new Thickness(0);
- // button.Width = 180;
- // button.Height = 30;
- // button.Click += new RoutedEventHandler(messageBtnClick);
- // button.Tag = notificationData;
- // button.HorizontalContentAlignment = HorizontalAlignment.Left;
- // me_message.Children.Add(button);
- //}
- }
- /// <summary>
- /// 系统
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void me_systemClick(object sender, RoutedEventArgs e)
- {
- // NotificationAnnouncement notificationAnnouncement = new NotificationAnnouncement();
- // notificationAnnouncement.Content = "系统更新";
- // notificationAnnouncement.SpecificContent = "交互平台版本更新至2.0版本· 本次更新了:· 1.主界面消息分组。· 2.修改了登陆界面。· 请及时更新!!";
- // notificationAnnouncement.MessageCategory = "系统消息";
- // NotificationAnnouncement notificationAnnouncement2 = new NotificationAnnouncement();
- // notificationAnnouncement2.Content = "停服升级";
- // notificationAnnouncement2.SpecificContent = "交互平台版本将在4月13日8点20分至4月13日8点50分进行停服更新·本次停服更新不会导致您的数据丢失。";
- // notificationAnnouncement2.MessageCategory = "系统消息";
- // notificationDatas = new List<NotificationAnnouncement>()
- // {
- // notificationAnnouncement,
- // notificationAnnouncement2
- //};
- // me_message.Children.Clear();
- // foreach (var notificationData in notificationDatas)
- // {
- // Button button = new Button();
- // button.Content = notificationData.Content;
- // button.BorderThickness = new Thickness(0);
- // button.Width = 180;
- // button.Height = 30;
- // button.Click += new RoutedEventHandler(messageBtnClick);
- // button.Tag = notificationData;
- // button.HorizontalContentAlignment = HorizontalAlignment.Left;
- // me_message.Children.Add(button);
- // }
- }
- /// <summary>
- /// 具体消息按钮
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void messageBtnClick(object sender, RoutedEventArgs e)
- {
- //me_right.Children.Clear();
- //Button button = sender as Button;
- //NotificationAnnouncement announcement = button.Tag as NotificationAnnouncement;
- //List<string> specificContent = announcement.SpecificContent.Split('·').ToList();
- //foreach (var specificConten in specificContent)
- //{
- // TextBlock textBlock = new TextBlock();
- // textBlock.Text = specificConten;
- // textBlock.FontSize = 15;
- // textBlock.FontFamily = new FontFamily("黑体");
- // me_right.Children.Add(textBlock);
- //}
- //if (announcement.MessageCategory.Equals("项目消息"))
- //{
- // DockPanel dockPanel = new DockPanel();
- // dockPanel.Margin = new Thickness(0, 10, 30, 0);
- // dockPanel.HorizontalAlignment = HorizontalAlignment.Right;
- // TextBlock textBlock = new TextBlock();
- // textBlock.Text = "查看";
- // textBlock.FontSize = 13;
- // textBlock.Foreground = new SolidColorBrush(Colors.Green);
- // textBlock.TextDecorations = TextDecorations.Underline;
- // textBlock.Margin = new Thickness(0, 0, 10, 0);
- // textBlock.FontFamily = new FontFamily("黑体");
- // textBlock.PreviewMouseLeftButtonDown += new MouseButtonEventHandler(Message_Look);
- // dockPanel.Children.Add(textBlock);
- // TextBlock textBlock2 = new TextBlock();
- // textBlock2.Text = "忽略";
- // textBlock2.FontSize = 13;
- // textBlock2.FontFamily = new FontFamily("黑体");
- // textBlock2.Foreground = new SolidColorBrush(Colors.Green);
- // textBlock2.TextDecorations = TextDecorations.Underline;
- // textBlock2.PreviewMouseLeftButtonDown += new MouseButtonEventHandler(Message_Ignore);
- // dockPanel.Children.Add(textBlock2);
- // me_right.Children.Add(dockPanel);
- //}
- }
- /// <summary>
- /// 查看消息
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- public void Message_Look(object sender, RoutedEventArgs e)
- {
- MessageBox.Show("查看消息");
- }
- /// <summary>
- /// 忽略消息
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- public void Message_Ignore(object sender, RoutedEventArgs e)
- {
- MessageBox.Show("忽略消息");
- }
- #endregion
- #region 项目中间部分
- /// <summary>
- /// 项目信息示例
- /// </summary>
- private ObservableCollection<LVProjectInfoEntity> lvProjects = new ObservableCollection<LVProjectInfoEntity>()
- {
- new LVProjectInfoEntity("项目名称:", "北京大兴项目"),
- new LVProjectInfoEntity("项目业态:", "住宅"),
- new LVProjectInfoEntity("项目地址:", "山东省济南市"),
- new LVProjectInfoEntity("项目团队:", "项目团队")
- };
- /// <summary>
- /// 项目信息示例
- /// </summary>
- private ObservableCollection<LVTeamMembersEntity> lvTeamMemberss = new ObservableCollection<LVTeamMembersEntity>()
- {
- new LVTeamMembersEntity("主管:", "李明"),
- new LVTeamMembersEntity("建筑组员:", "李明"),
- new LVTeamMembersEntity("结构组员:", "张修"),
- new LVTeamMembersEntity("给排水组员:", "邢华"),
- new LVTeamMembersEntity("暖通组员:", "杨程"),
- new LVTeamMembersEntity("电气组员:", "欧瑞"),
- };
- /// <summary>
- /// 项目TreeView
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void tv_projectLeftButtonUp(object sender, MouseButtonEventArgs e)
- {
- #region 隐藏所有的无用控件
- lv_projectInfo.Visibility = Visibility.Collapsed;
- sp_info.Visibility = Visibility.Collapsed;
- sp_work.Visibility = Visibility.Collapsed;
- sp_addPro.Visibility = Visibility.Collapsed;
- #endregion
- TreeViewBind treeView = tr_vw.SelectedItem as TreeViewBind;
- if (treeView == null) return;
- string name = treeView.Name;
- if (name.Equals("项目信息"))
- {
- sp_info.Visibility = Visibility.Visible;
- lv_projectInfo.Visibility = Visibility.Visible;
- lv_projectInfo.ItemsSource = null;
- lv_projectInfo.ItemsSource = lvProjects;
- }
- else if (name.Equals("团队成员"))
- {
- sp_info.Visibility = Visibility.Visible;
- lv_projectInfo.Visibility = Visibility.Visible;
- lv_projectInfo.ItemsSource = null;
- lv_projectInfo.ItemsSource = lvTeamMemberss;
- }
- else if (name.Equals("工作台"))
- {
- sp_work.Visibility = Visibility.Visible;
- tr_is.ItemsSource = null;
- if (!treeView.IsPro)
- {
- List<TreeViewBind> TreeViewDatas = new List<TreeViewBind>();
- TreeViewDatas.Add(new TreeViewBind("小学项目", new List<TreeViewBind>() { new TreeViewBind("新建图纸") }));
- this.tr_is.ItemsSource = TreeViewDatas;
- }
- else
- {
- this.tr_is.ItemsSource = TreeViewDatas;
- }
- }
- else if (name.Equals("自定义"))
- {
- }
- }
- /// <summary>
- /// lv内修改按钮
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void btn_lv_update(object sender, RoutedEventArgs e)
- {
- Button button = sender as Button;
- LVProjectInfoEntity lvProjectInfo = button.Tag as LVProjectInfoEntity;
- if (lvProjectInfo != null)
- {
- }
- }
- /// <summary>
- /// 上传图纸
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void Button_Click(object sender, RoutedEventArgs e)
- {
- TreeViewBind treeViewBind = TreeViewDatas.First(s => s.Name.Equals("小学项目 一号楼"));
- UploadDrawingForm upWindow = new UploadDrawingForm(TreeViewDatas);
- foreach (var item in treeViewBind.Children)
- {
- if (item.Name.Equals("上传新图")) continue;
- upWindow.str.Add(item.Name);
- }
- upWindow.ShowDialog();
- this.tr_is.ItemsSource = null;
- this.tr_is.ItemsSource = TreeViewDatas;
- }
- #region 工作台
- /// <summary>
- /// 工作台数据绑定
- /// </summary>
- public static ObservableCollection<TreeViewBind> TreeViewDatas = new ObservableCollection<TreeViewBind>()
- {
- new TreeViewBind("小学项目 一号楼",
- new List<TreeViewBind>()
- {
- new TreeViewBind("上传图纸")
- })
- };
- /// <summary>
- /// 版本名称
- /// </summary>
- private List<string> ProVersions = new List<string>();
- /// <summary>
- /// 本专业
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void pre_Click(object sender, MouseButtonEventArgs e)
- {
- tr_all.Visibility = Visibility.Collapsed;
- tr_is.Visibility = Visibility.Visible;
- bt_proBig.Visibility = Visibility.Collapsed;
- }
- /// <summary>
- /// 全专业
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void all_Click(object sender, MouseButtonEventArgs e)
- {
- tr_is.Visibility = Visibility.Collapsed;
- tr_all.Visibility = Visibility.Visible;
- tv_building.ItemsSource = null;
- tv_building.ItemsSource = TreeViewDatas;
- bt_proBig.Visibility = Visibility.Visible;
- }
- /// <summary>
- /// treeview点击
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void tr_is_PreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e)
- {
- TreeViewBind treeView = tr_is.SelectedItem as TreeViewBind;
- //切换展开和下拉
- if (treeView == null)
- {
- return;
- }
- if (tr_is.ItemContainerGenerator.ContainerFromItem(treeView) is TreeViewItem currentItem)
- {
- if (!currentItem.IsExpanded)
- {
- currentItem.IsExpanded = true;
- }
- else
- {
- currentItem.IsExpanded = false;
- }
- }
- if (treeView.Name.Contains("更新图纸"))
- {
- TreeViewBind treeViewBind = TreeViewDatas.First(s => s.Name.Equals("小学项目 一号楼"));
- UploadDrawingForm upWindow = new UploadDrawingForm(TreeViewDatas);
- foreach (var item in treeViewBind.Children)
- {
- if (item.Name.Equals("治理图纸")) break;
- upWindow.str.Add(item.Name);
- }
- upWindow.ShowDialog();
- string t7 = DateTime.Now.ToShortTimeString();
- string t3 = DateTime.Now.ToLongDateString() + t7;
- string proVersion = "";
- if (ProVersions.Contains(t3 + "版本"))
- {
- int proVersionIndex = 0;
- for (int i = 0; i < 100; i++)
- {
- int j = i + 1;
- if (ProVersions.Contains(t3 + "(" + j + ")" + "版本"))
- {
- continue;
- }
- else
- {
- proVersionIndex = i + 1;
- break;
- }
- }
- proVersion = t3 + "(" + proVersionIndex + ")" + "版本";
- }
- else
- {
- proVersion = t3 + "版本";
- }
- ProVersions.Add(proVersion);
- TreeViewBind TreeViewBind1 = new TreeViewBind(proVersion, new List<TreeViewBind>()
- {
- new TreeViewBind("原图"),
- new TreeViewBind("对比图"),
- new TreeViewBind("治理图纸", new List<TreeViewBind>()
- {
- new TreeViewBind("F1"),
- new TreeViewBind("F2",
- new List<TreeViewBind>()
- {
- new TreeViewBind("墙柱"),
- new TreeViewBind("门窗"),
- new TreeViewBind("功能区标签"),
- new TreeViewBind("未命名")
- })
- })
- });
- int index = CollaborationUtil.GetIndexByTreeView("更新图纸", TreeViewDatas.FirstOrDefault().Children);
- TreeViewDatas.FirstOrDefault().Children.Insert(index, TreeViewBind1);
- this.tr_is.ItemsSource = null;
- this.tr_is.ItemsSource = TreeViewDatas;
- }
- else if (treeView.Name.Contains("上传图纸"))
- {
- string t7 = DateTime.Now.ToShortTimeString();
- string t3 = DateTime.Now.ToLongDateString() + t7;
- ProVersions.Add(t3 + "版本");
- TreeViewBind TreeViewBind1 = new TreeViewBind(t3 + "版本", new List<TreeViewBind>()
- {
- new TreeViewBind("原图"),
- new TreeViewBind("治理图纸", new List<TreeViewBind>()
- {
- new TreeViewBind("F1"),
- new TreeViewBind("F2",
- new List<TreeViewBind>()
- {
- new TreeViewBind("墙柱"),
- new TreeViewBind("门窗"),
- new TreeViewBind("功能区标签"),
- new TreeViewBind("未命名")
- })
- })
- });
- TreeViewDatas.FirstOrDefault().Children.Insert(0, TreeViewBind1);
- TreeViewDatas.FirstOrDefault().Children.Add(new TreeViewBind("更新图纸"));
- for (int i = 0; i < TreeViewDatas.FirstOrDefault().Children.Count; i++)
- {
- if (TreeViewDatas.FirstOrDefault().Children[i].Name.Equals("上传图纸"))
- {
- TreeViewDatas.FirstOrDefault().Children.RemoveAt(i);
- i--;
- break;
- }
- }
- tr_is.ItemsSource = null;
- tr_is.ItemsSource = TreeViewDatas;
- }
- }
- /// <summary>
- /// 放大
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void bt_proBigClick(object sender, RoutedEventArgs e)
- {
- ProjectForm projectForm = new ProjectForm(this, TreeViewDatas);
- this.Hide();
- projectForm.ShowDialog();
- this.Show();
- }
- #endregion
- #region 新增项目
- private void bt_addPro(object sender, RoutedEventArgs e)
- {
- #region 隐藏所有的无用控件
- lv_projectInfo.Visibility = Visibility.Collapsed;
- sp_info.Visibility = Visibility.Collapsed;
- sp_work.Visibility = Visibility.Collapsed;
- #endregion
- sp_addPro.Visibility = Visibility.Visible;
- }
- private void close_Click(object sender, RoutedEventArgs e)
- {
- gd_top.Visibility = Visibility.Collapsed;
- }
- private void bd_Initialized(object sender, EventArgs e)
- {
- }
- private void st_Initialized(object sender, EventArgs e)
- {
- }
- private void wt_Initialized(object sender, EventArgs e)
- {
- }
- private void wm_Initialized(object sender, EventArgs e)
- {
- }
- private void ele_Initialized(object sender, EventArgs e)
- {
- }
- private void submit_Click(object sender, RoutedEventArgs e)
- {
- }
- private void saveFile_Click(object sender, RoutedEventArgs e)
- {
- }
- private void savePage_Click(object sender, RoutedEventArgs e)
- {
- }
- private void ele_Click(object sender, RoutedEventArgs e)
- {
- }
- private void wm_Click(object sender, RoutedEventArgs e)
- {
- }
- private void wt_Click(object sender, RoutedEventArgs e)
- {
- }
- private void st_Click(object sender, RoutedEventArgs e)
- {
- }
- private void bd_Click(object sender, RoutedEventArgs e)
- {
- }
- #endregion
- #endregion
- /// <summary>
- /// 青蓝小助手
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void bt_qlxzs_Click(object sender, RoutedEventArgs e)
- {
- this.Visibility = Visibility.Collapsed;
- StandardizedAssistantForm assistantForm = new StandardizedAssistantForm(this);
- assistantForm.Show();
- }
- }
- }
|