123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219 |
- using CollaborativePlatformMain.DFEntity.MessageSubUtil;
- using CollaborativePlatformMain.Form.MessageSubPage.Project;
- using System;
- using System.Collections.Generic;
- 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;
- namespace CollaborativePlatformMain.Form.MessageSubPage
- {
- /// <summary>
- /// SeconProjectPage.xaml 的交互逻辑
- /// </summary>
- public partial class SeconProjectPage : Page
- {
- /// <summary>
- /// 父级窗体
- /// </summary>
- public HomepageForm HomepageForm;
- /// <summary>
- /// 项目信息
- /// </summary>
- public List<ProjectEntity> ProjectEntities = new List<ProjectEntity>();
- public SeconProjectPage(HomepageForm homepageForm)
- {
- InitializeComponent();
- HomepageForm = homepageForm;
- }
- /// <summary>
- /// 窗体初始化
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void Window_Loaded(object sender, RoutedEventArgs e)
- {
- }
- /// <summary>
- /// 新增项目
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void bt_addPro(object sender, RoutedEventArgs e)
- {
- sp_newProject.Visibility = Visibility.Visible;
- sp_ProjectInfo.Visibility = Visibility.Collapsed;
- sp_temp.Visibility = Visibility.Collapsed;
- sp_staging.Visibility = Visibility.Collapsed;
- sp_custom.Visibility = Visibility.Collapsed;
- threeNewProject.Navigate(new NewProjrctPage(this));
- }
- /// <summary>
- /// 刷新数据
- /// </summary>
- public void FlushData()
- {
- tr_vw.ItemsSource = null;
- tr_vw.ItemsSource = ProjectEntities;
- }
- public Dictionary<string, Page> id_Pages = new Dictionary<string, Page>();
- public static Dictionary<string, FullProfessionPage> floor_quanPages = new Dictionary<string, FullProfessionPage>();
- /// <summary>
- /// treeview点击事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void tv_projectLeftButtonUp(object sender, MouseButtonEventArgs e)
- {
- ProjectEntity selData = tr_vw.SelectedItem as ProjectEntity;
- if (selData == null) return;
- string node = selData.ProjectName;
- if (node == "项目信息")
- {
- sp_newProject.Visibility = Visibility.Collapsed;
- sp_ProjectInfo.Visibility = Visibility.Visible;
- sp_temp.Visibility = Visibility.Collapsed;
- sp_staging.Visibility = Visibility.Collapsed;
- sp_custom.Visibility = Visibility.Collapsed;
- if (id_Pages.Where(x => x.Key == selData.Id).Count() == 0)
- {
- ProjectInfoPage projectInfoPage = new ProjectInfoPage(selData.SubData);
- threeProInfoPage.Navigate(projectInfoPage);
- id_Pages.Add(selData.Id, projectInfoPage);
- }
- else
- {
- threeProInfoPage.Navigate(id_Pages[selData.Id]);
- }
- }
- else if (node == "团队成员")
- {
- sp_newProject.Visibility = Visibility.Collapsed;
- sp_ProjectInfo.Visibility = Visibility.Collapsed;
- sp_temp.Visibility = Visibility.Visible;
- sp_staging.Visibility = Visibility.Collapsed;
- sp_custom.Visibility = Visibility.Collapsed;
- if (id_Pages.Where(x => x.Key == selData.Id).Count() == 0)
- {
- TempPage tempPage = new TempPage();
- threeTempPage.Navigate(tempPage);
- id_Pages.Add(selData.Id, tempPage);
- }
- else
- {
- threeTempPage.Navigate(id_Pages[selData.Id]);
- }
- }
- else if (node == "工作台")
- {
- sp_newProject.Visibility = Visibility.Collapsed;
- sp_ProjectInfo.Visibility = Visibility.Collapsed;
- sp_temp.Visibility = Visibility.Collapsed;
- sp_staging.Visibility = Visibility.Visible;
- sp_custom.Visibility = Visibility.Collapsed;
- if (id_Pages.Where(x => x.Key == selData.Id).Count() == 0)
- {
- string firstData = "";
- GetFirstName(ProjectEntities, selData, ref firstData);
- OperatingFloorPage operatingFloorPage = new OperatingFloorPage(HomepageForm, firstData, true);
- threeStagingPage.Navigate(operatingFloorPage);
- id_Pages.Add(selData.Id, operatingFloorPage);
- }
- else
- {
- threeStagingPage.Navigate(id_Pages[selData.Id]);
- }
- }
- else if (node == "自定义")
- {
- sp_newProject.Visibility = Visibility.Collapsed;
- sp_ProjectInfo.Visibility = Visibility.Collapsed;
- sp_temp.Visibility = Visibility.Collapsed;
- sp_staging.Visibility = Visibility.Collapsed;
- sp_custom.Visibility = Visibility.Visible;
- if (id_Pages.Where(x => x.Key == selData.Id).Count() == 0)
- {
- //OperatingFloorPage operatingFloorPage = new OperatingFloorPage(Node);
- //threeCustomPage.Navigate(operatingFloorPage);
- //id_Pages.Add(selData.Id, operatingFloorPage);
- }
- else
- {
- threeCustomPage.Navigate(id_Pages[selData.Id]);
- }
- }
- }
- /// <summary>
- /// 获取当前选中的项目名称及楼栋名称
- /// </summary>
- /// <returns></returns>
- public bool GetFirstName(List<ProjectEntity> projectEntities, ProjectEntity selData, ref string firstData)
- {
- foreach (var project in projectEntities)
- {
- if (project.Id == selData.Id)
- {
- return true;
- }
- else
- {
- bool isSel = GetFirstName(project.SubBuildNodes, selData, ref firstData);
- if (isSel)
- {
- if (firstData == "")
- {
- firstData = project.ProjectName;
- }
- else
- {
- firstData = project.ProjectName + " " + firstData;
- }
- return true;
- }
- }
- }
- return false;
- }
- }
- }
|