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;
namespace CollaborativePlatformMain.Form
{
///
/// HomepageForm.xaml 的交互逻辑
///
public partial class HomepageForm : Window
{
public HomepageForm()
{
InitializeComponent();
}
#region 最左边消息
///
/// 消息
///
///
///
private void message_Click(object sender, MouseButtonEventArgs e)
{
SwitchMethod(sender as MenuItem, true);
}
///
/// 项目下TreeView绑定的数据
///
private List treeViewBinds = new List();
///
/// 项目
///
///
///
private void project_Click(object sender, MouseButtonEventArgs e)
{
SwitchMethod(sender as MenuItem, false);
treeViewBinds = new List();
treeViewBinds.Add(
new TreeViewBind("小学项目",
new List()
{
new TreeViewBind("一号楼",
new List()
{
new TreeViewBind("项目信息"),
new TreeViewBind("团队成员"),
new TreeViewBind("工作台", true),
new TreeViewBind("自定义"),
new TreeViewBind("+")
}),
new TreeViewBind("二号楼",
new List()
{
new TreeViewBind("项目信息"),
new TreeViewBind("团队成员"),
new TreeViewBind("工作台", true),
new TreeViewBind("自定义"),
new TreeViewBind("+")
}),
new TreeViewBind("三号楼",
new List()
{
new TreeViewBind("项目信息"),
new TreeViewBind("团队成员"),
new TreeViewBind("工作台", true),
new TreeViewBind("自定义"),
new TreeViewBind("+")
})
}));
tr_vw.ItemsSource = null;
tr_vw.ItemsSource = treeViewBinds;
}
///
/// 联系人
///
///
///
private void contacts_Click(object sender, MouseButtonEventArgs e)
{
SwitchMethod(sender as MenuItem, false);
List sLists = new List() { "建筑负责人", "结构负责人", "给排水负责人" };
sp_contacts.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_contacts.Children.Add(button);
}
}
///
/// 图库大样图
///
///
///
private void gallery_Click(object sender, MouseButtonEventArgs e)
{
SwitchMethod(sender as MenuItem, false);
}
///
/// 工具库
///
///
///
private void tool_Click(object sender, MouseButtonEventArgs e)
{
SwitchMethod(sender as MenuItem, false);
List sLists = new List() { "平台图纸治理", "块处理", "大样处理", "图纸对比", "二维审查", "三维" };
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();
}
}
///
/// 设置最左测导航的颜色和上边导航的显隐
///
///
///
public void SwitchMethod(MenuItem menuItem, bool isHoShow)
{
if (isHoShow)
{
sp_hzNavigation.Visibility = Visibility.Visible;
}
else
{
sp_hzNavigation.Visibility = Visibility.Collapsed;
}
List mis = CollaborationUtil.GetChildObjects(mu_leftMenu);
foreach (MenuItem mi in mis)
{
mi.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#1E9FFF"));
if (mi.Header.ToString().Replace(" ", "").Equals("消息"))
{
dp_message.Visibility = Visibility.Collapsed;
}
else if (mi.Header.ToString().Replace(" ", "").Equals("项目"))
{
dp_project.Visibility = Visibility.Collapsed;
}
else if (mi.Header.ToString().Replace(" ", "").Equals("工具库"))
{
dp_tools.Visibility = Visibility.Collapsed;
}
else if (mi.Header.ToString().Replace(" ", "").Equals("联系人"))
{
dp_contacts.Visibility = Visibility.Collapsed;
}
}
if (menuItem.Header.ToString().Replace(" ", "").Equals("消息"))
{
dp_message.Visibility = Visibility.Visible;
}
else if (menuItem.Header.ToString().Replace(" ", "").Equals("项目"))
{
dp_project.Visibility = Visibility.Visible;
}
else if (menuItem.Header.ToString().Replace(" ", "").Equals("工具库"))
{
dp_tools.Visibility = Visibility.Visible;
}
else if (menuItem.Header.ToString().Replace(" ", "").Equals("联系人"))
{
dp_contacts.Visibility = Visibility.Visible;
}
menuItem.Background = new SolidColorBrush(Colors.Beige);
me_message.Children.Clear();
}
#endregion
#region 工具中间按钮
private ObservableCollection ToolLists = new ObservableCollection();
///
/// 功能名字对应的功能数据
///
private Dictionary> ToolName_ToolDatas = new Dictionary>()
{
{
"平台图纸治理",new ObservableCollection()
{
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()
{
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()
{
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()
{
new CBButtonControlsData("图纸对比",false,"")
}
},
{
"二维审查",new ObservableCollection()
{
new CBButtonControlsData("二维审查",false,"")
}
}, {
"三维",new ObservableCollection()
{
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 cbButtonControls = ToolName_ToolDatas[button.Content.ToString()];
wp_tools.Children.Clear();
foreach (var cbButtonControl in cbButtonControls)
{
wp_tools.Children.Add(new CBButtonControls(cbButtonControl));
}
}
}
///
/// 添加漂浮工具
///
///
///
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);
}
}
}
}
///
/// 悬浮窗窗体
///
public ToolsForm ToolsForm;
///
/// 悬浮窗
///
private ObservableCollection ToolDatas = new ObservableCollection()
{
new LVProjectInfoEntity("图纸对比", ""),
new LVProjectInfoEntity("超模全解析", ""),
new LVProjectInfoEntity("超模数字化建模", "")
};
#endregion
#region 中间的按钮
private void General_Click(object sender, MouseButtonEventArgs e)
{
}
#endregion
#region 横向通知消息栏
private List menuItems = new List();
///
/// 通知公告数据
///
private List notificationDatas = new List();
///
/// 通知公告
///
///
///
private void me_announcementClick(object sender, RoutedEventArgs e)
{
notificationDatas = new List();
for (int i = 0; i < new List() { "国博城项目建筑图纸更新", "北京大兴项目结构图纸更新", "绿地项目人防图纸更新" }.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);
}
}
///
/// 项目
///
///
///
private void me_projectClick(object sender, RoutedEventArgs e)
{
notificationDatas = new List();
foreach (var xiangmu in new List() { "国博城项目建筑图纸更新", "北京大兴项目结构图纸更新", "绿地项目人防图纸更新" })
{
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);
}
}
///
/// 系统
///
///
///
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,
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);
}
}
///
/// 具体消息按钮
///
///
///
private void messageBtnClick(object sender, RoutedEventArgs e)
{
me_right.Children.Clear();
Button button = sender as Button;
NotificationAnnouncement announcement = button.Tag as NotificationAnnouncement;
List 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("黑体");
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;
dockPanel.Children.Add(textBlock2);
me_right.Children.Add(dockPanel);
}
}
#endregion
#region 项目中间部分
///
/// 项目信息示例
///
private ObservableCollection lvProjects = new ObservableCollection()
{
new LVProjectInfoEntity("项目名称:", "北京大兴项目"),
new LVProjectInfoEntity("项目业态:", "住宅"),
new LVProjectInfoEntity("项目地址:", "山东省济南市"),
new LVProjectInfoEntity("项目团队:", "项目团队")
};
///
/// 项目信息示例
///
private ObservableCollection lvTeamMemberss = new ObservableCollection()
{
new LVTeamMembersEntity("主管:", "李明"),
new LVTeamMembersEntity("建筑组员:", "李明"),
new LVTeamMembersEntity("结构组员:", "张修"),
new LVTeamMembersEntity("给排水组员:", "邢华"),
new LVTeamMembersEntity("暖通组员:", "杨程"),
new LVTeamMembersEntity("电气组员:", "欧瑞"),
};
///
/// 项目TreeView
///
///
///
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 TreeViewDatas = new List();
TreeViewDatas.Add(new TreeViewBind("小学项目", new List() { new TreeViewBind("新建图纸") }));
this.tr_is.ItemsSource = TreeViewDatas;
}
else
{
this.tr_is.ItemsSource = TreeViewDatas;
}
}
else if (name.Equals("自定义"))
{
}
}
///
/// lv内修改按钮
///
///
///
private void btn_lv_update(object sender, RoutedEventArgs e)
{
Button button = sender as Button;
LVProjectInfoEntity lvProjectInfo = button.Tag as LVProjectInfoEntity;
if (lvProjectInfo != null)
{
}
}
///
/// 上传图纸
///
///
///
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 工作台
///
/// 工作台数据绑定
///
public static ObservableCollection TreeViewDatas = new ObservableCollection()
{
new TreeViewBind("小学项目 一号楼",
new List()
{
new TreeViewBind("上传图纸")
})
};
///
/// 版本名称
///
private List ProVersions = new List();
///
/// 本专业
///
///
///
private void pre_Click(object sender, MouseButtonEventArgs e)
{
tr_all.Visibility = Visibility.Collapsed;
tr_is.Visibility = Visibility.Visible;
bt_proBig.Visibility = Visibility.Collapsed;
}
///
/// 全专业
///
///
///
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;
}
///
/// treeview点击
///
///
///
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()
{
new TreeViewBind("原图"),
new TreeViewBind("对比图"),
new TreeViewBind("治理图纸", new List()
{
new TreeViewBind("F1"),
new TreeViewBind("F2",
new List()
{
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()
{
new TreeViewBind("原图"),
new TreeViewBind("治理图纸", new List()
{
new TreeViewBind("F1"),
new TreeViewBind("F2",
new List()
{
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;
}
}
///
/// 放大
///
///
///
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
}
}