using CollaborativePlatformMain.DFEntity.MessageSubUtil;
using CollaborativePlatformMain.Form.MessageSubPage.CreatLevel;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
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
{
///
/// SeconThreeDimensionalPage.xaml 的交互逻辑
///
public partial class SeconThreeDimensionalPage : Page
{
///
/// 父级窗体
///
public HomepageForm Homepage;
///
/// 三维模型数据
///
public List ThreeModelEntities = new List();
///
/// 标高信息
///
public ObservableCollection LevelTableEntities = new ObservableCollection();
public SeconThreeDimensionalPage(HomepageForm homepage)
{
InitializeComponent();
Homepage = homepage;
}
///
/// 窗体初始化
///
///
///
private void Window_Loaded(object sender, RoutedEventArgs e)
{
ThreeModelEntities = new List();
ThreeModelEntity threeModelEntity1 = new ThreeModelEntity("自动建模", new List());
ThreeModelEntity subData1 = new ThreeModelEntity("碰撞检查");
ThreeModelEntity subData2 = new ThreeModelEntity("净高分析");
ThreeModelEntity subData3 = new ThreeModelEntity("条文审查");
ThreeModelEntity threeModelEntity2 = new ThreeModelEntity("模型应用", new List() { subData1, subData2, subData3 });
ThreeModelEntity threeModelEntity3 = new ThreeModelEntity("模型服务", new List());
ThreeModelEntities.Add(threeModelEntity1);
ThreeModelEntities.Add(threeModelEntity2);
ThreeModelEntities.Add(threeModelEntity3);
tr_threemodel.ItemsSource = null;
tr_threemodel.ItemsSource = ThreeModelEntities;
//bt_autoModel.BorderThickness = new Thickness(0);
//bt_modelUser.BorderThickness = new Thickness(0);
//bt_modelEmploy.BorderThickness = new Thickness(0);
}
///
/// 创建标高体系
///
///
///
private void bt_creatLevel_Click(object sender, RoutedEventArgs e)
{
CreatLevelForm creatLevelForm = new CreatLevelForm(this);
creatLevelForm.Show();
}
///
/// 设置标高
///
public void SetLevelData()
{
sp_creatLevel.Children.Clear();
foreach (var levelTableEntity in LevelTableEntities)
{
Label label = new Label();
label.Content = levelTableEntity.LevelNmae;
label.BorderThickness = new Thickness(0);
label.HorizontalAlignment = HorizontalAlignment.Left;
//label.Width = 80;
Button button = new Button();
button.Content = "上传图纸";
button.BorderThickness = new Thickness(0);
button.Width = 80;
button.HorizontalAlignment = HorizontalAlignment.Left;
button.Click += new RoutedEventHandler(UploadDrawings);
DockPanel dockPanel = new DockPanel();
dockPanel.Children.Add(label);
dockPanel.Children.Add(button);
sp_creatLevel.Children.Add(dockPanel);
}
}
///
/// 上传图纸-CAD截取
///
///
///
public void UploadDrawings(object sender, RoutedEventArgs e)
{
}
///
/// 上传图纸到服务器
///
///
///
private void upDrawing_Click(object sender, RoutedEventArgs e)
{
int a = 1;
}
private void tr_threemodel_PreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e)
{
}
///
/// 点击数据
///
///
///
private void Button_Click(object sender, RoutedEventArgs e)
{
Button button = sender as Button;
string value = button.Content.ToString();
if (value == "自动建模")
{
sp_autoModel.Visibility = Visibility.Visible;
sp_modelUser1.Visibility = Visibility.Collapsed;
sp_modelUser2.Visibility = Visibility.Collapsed;
sp_modelUser3.Visibility = Visibility.Collapsed;
sp_modelEmploy.Visibility = Visibility.Collapsed;
}
else if (value == "模型应用")
{
//sp_autoModel.Visibility = Visibility.Collapsed;
//sp_modelUser1.Visibility = Visibility.Collapsed;
//sp_modelUser2.Visibility = Visibility.Collapsed;
//sp_modelUser3.Visibility = Visibility.Collapsed;
//sp_modelEmploy.Visibility = Visibility.Collapsed;
}
else if (value == "模型服务")
{
sp_autoModel.Visibility = Visibility.Collapsed;
sp_modelUser1.Visibility = Visibility.Collapsed;
sp_modelUser2.Visibility = Visibility.Collapsed;
sp_modelUser3.Visibility = Visibility.Collapsed;
sp_modelEmploy.Visibility = Visibility.Visible;
}
else if (value == "碰撞检查")
{
sp_autoModel.Visibility = Visibility.Collapsed;
sp_modelUser1.Visibility = Visibility.Visible;
sp_modelUser2.Visibility = Visibility.Collapsed;
sp_modelUser3.Visibility = Visibility.Collapsed;
sp_modelEmploy.Visibility = Visibility.Collapsed;
}
else if (value == "净高分析")
{
sp_autoModel.Visibility = Visibility.Collapsed;
sp_modelUser1.Visibility = Visibility.Collapsed;
sp_modelUser2.Visibility = Visibility.Visible;
sp_modelUser3.Visibility = Visibility.Collapsed;
sp_modelEmploy.Visibility = Visibility.Collapsed;
}
else if (value == "条文审查")
{
sp_autoModel.Visibility = Visibility.Collapsed;
sp_modelUser1.Visibility = Visibility.Collapsed;
sp_modelUser2.Visibility = Visibility.Collapsed;
sp_modelUser3.Visibility = Visibility.Visible;
sp_modelEmploy.Visibility = Visibility.Collapsed;
}
}
///
/// 鼠标双击类型
///
///
///
private void TextBox_MouseDoubleClick(object sender, MouseButtonEventArgs e)
{
bool isSelectDwg = ShowSelectDWGFiles(out string filePath);
if (isSelectDwg)
{
selectModelApplication1.Text = "";
selectModelApplication1.Text = filePath;
}
}
///
/// 新增
///
///
///
private void Button_Click_1(object sender, RoutedEventArgs e)
{
TextBox textBox = new TextBox();
textBox.Width = 80;
textBox.Margin = new Thickness(0, 5, 0, 0);
sp_objectName.Children.Add(textBox);
Button button = new Button();
button.Width = 80;
button.Content = "上传";
button.Margin = new Thickness(0, 5, 0, 0);
sp_objectDraw.Children.Add(button);
}
///
/// 选择单个文件
///
///
///
public static bool ShowSelectDWGFiles(out string filePath)
{
filePath = "";
System.Windows.Forms.OpenFileDialog dlg = new System.Windows.Forms.OpenFileDialog();
dlg.Multiselect = false;//等于true表示可以选择多个文件
dlg.DefaultExt = ".rvt";
dlg.Filter = "RVT 文件|*.rvt";
if (dlg.ShowDialog() != System.Windows.Forms.DialogResult.OK) return false;
filePath = dlg.FileName;
return true;
}
private void SelectmodelServices_MouseDoubleClick(object sender, MouseButtonEventArgs e)
{
bool isSelectDwg = ShowSelectDWGFiles(out string filePath);
if (isSelectDwg)
{
selectModelServices.Text = "";
selectModelServices.Text = filePath;
selectModelServices.Foreground = Brushes.Black;
}
}
///
/// 碰撞检测
///
///
///
private void TextBox_MouseDoubleClick1(object sender, MouseButtonEventArgs e)
{
bool isSelectDwg = ShowSelectDWGFiles(out string filePath);
if (isSelectDwg)
{
selectModelApplication1.Text = "";
selectModelApplication1.Text = filePath;
selectModelApplication1.Foreground = Brushes.Black;
}
}
///
/// 净高分析
///
///
///
private void TextBox_MouseDoubleClick2(object sender, MouseButtonEventArgs e)
{
bool isSelectDwg = ShowSelectDWGFiles(out string filePath);
if (isSelectDwg)
{
selectModelApplication2.Text = "";
selectModelApplication2.Text = filePath;
selectModelApplication2.Foreground = Brushes.Black;
}
}
///
/// 条文审查
///
///
///
private void TextBox_MouseDoubleClick3(object sender, MouseButtonEventArgs e)
{
bool isSelectDwg = ShowSelectDWGFiles(out string filePath);
if (isSelectDwg)
{
selectModelApplication3.Text = "";
selectModelApplication3.Text = filePath;
selectModelApplication3.Foreground = Brushes.Black;
}
}
}
}