SeconThreeDimensionalPage.xaml.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316
  1. using CollaborativePlatformMain.DFEntity.MessageSubUtil;
  2. using CollaborativePlatformMain.Form.MessageSubPage.CreatLevel;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Collections.ObjectModel;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows;
  10. using System.Windows.Controls;
  11. using System.Windows.Data;
  12. using System.Windows.Documents;
  13. using System.Windows.Input;
  14. using System.Windows.Media;
  15. using System.Windows.Media.Imaging;
  16. using System.Windows.Shapes;
  17. namespace CollaborativePlatformMain.Form.MessageSubPage
  18. {
  19. /// <summary>
  20. /// SeconThreeDimensionalPage.xaml 的交互逻辑
  21. /// </summary>
  22. public partial class SeconThreeDimensionalPage : Page
  23. {
  24. /// <summary>
  25. /// 父级窗体
  26. /// </summary>
  27. public HomepageForm Homepage;
  28. /// <summary>
  29. /// 三维模型数据
  30. /// </summary>
  31. public List<ThreeModelEntity> ThreeModelEntities = new List<ThreeModelEntity>();
  32. /// <summary>
  33. /// 标高信息
  34. /// </summary>
  35. public ObservableCollection<LevelTableEntity> LevelTableEntities = new ObservableCollection<LevelTableEntity>();
  36. public SeconThreeDimensionalPage(HomepageForm homepage)
  37. {
  38. InitializeComponent();
  39. Homepage = homepage;
  40. }
  41. /// <summary>
  42. /// 窗体初始化
  43. /// </summary>
  44. /// <param name="sender"></param>
  45. /// <param name="e"></param>
  46. private void Window_Loaded(object sender, RoutedEventArgs e)
  47. {
  48. ThreeModelEntities = new List<ThreeModelEntity>();
  49. ThreeModelEntity threeModelEntity1 = new ThreeModelEntity("自动建模", new List<ThreeModelEntity>());
  50. ThreeModelEntity subData1 = new ThreeModelEntity("碰撞检查");
  51. ThreeModelEntity subData2 = new ThreeModelEntity("净高分析");
  52. ThreeModelEntity subData3 = new ThreeModelEntity("条文审查");
  53. ThreeModelEntity threeModelEntity2 = new ThreeModelEntity("模型应用", new List<ThreeModelEntity>() { subData1, subData2, subData3 });
  54. ThreeModelEntity threeModelEntity3 = new ThreeModelEntity("模型服务", new List<ThreeModelEntity>());
  55. ThreeModelEntities.Add(threeModelEntity1);
  56. ThreeModelEntities.Add(threeModelEntity2);
  57. ThreeModelEntities.Add(threeModelEntity3);
  58. tr_threemodel.ItemsSource = null;
  59. tr_threemodel.ItemsSource = ThreeModelEntities;
  60. //bt_autoModel.BorderThickness = new Thickness(0);
  61. //bt_modelUser.BorderThickness = new Thickness(0);
  62. //bt_modelEmploy.BorderThickness = new Thickness(0);
  63. }
  64. /// <summary>
  65. /// 创建标高体系
  66. /// </summary>
  67. /// <param name="sender"></param>
  68. /// <param name="e"></param>
  69. private void bt_creatLevel_Click(object sender, RoutedEventArgs e)
  70. {
  71. CreatLevelForm creatLevelForm = new CreatLevelForm(this);
  72. creatLevelForm.Show();
  73. }
  74. /// <summary>
  75. /// 设置标高
  76. /// </summary>
  77. public void SetLevelData()
  78. {
  79. sp_creatLevel.Children.Clear();
  80. foreach (var levelTableEntity in LevelTableEntities)
  81. {
  82. Label label = new Label();
  83. label.Content = levelTableEntity.LevelNmae;
  84. label.BorderThickness = new Thickness(0);
  85. label.HorizontalAlignment = HorizontalAlignment.Left;
  86. //label.Width = 80;
  87. Button button = new Button();
  88. button.Content = "上传图纸";
  89. button.BorderThickness = new Thickness(0);
  90. button.Width = 80;
  91. button.HorizontalAlignment = HorizontalAlignment.Left;
  92. button.Click += new RoutedEventHandler(UploadDrawings);
  93. DockPanel dockPanel = new DockPanel();
  94. dockPanel.Children.Add(label);
  95. dockPanel.Children.Add(button);
  96. sp_creatLevel.Children.Add(dockPanel);
  97. }
  98. }
  99. /// <summary>
  100. /// 上传图纸-CAD截取
  101. /// </summary>
  102. /// <param name="sender"></param>
  103. /// <param name="e"></param>
  104. public void UploadDrawings(object sender, RoutedEventArgs e)
  105. {
  106. }
  107. /// <summary>
  108. /// 上传图纸到服务器
  109. /// </summary>
  110. /// <param name="sender"></param>
  111. /// <param name="e"></param>
  112. private void upDrawing_Click(object sender, RoutedEventArgs e)
  113. {
  114. int a = 1;
  115. }
  116. private void tr_threemodel_PreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e)
  117. {
  118. }
  119. /// <summary>
  120. /// 点击数据
  121. /// </summary>
  122. /// <param name="sender"></param>
  123. /// <param name="e"></param>
  124. private void Button_Click(object sender, RoutedEventArgs e)
  125. {
  126. Button button = sender as Button;
  127. string value = button.Content.ToString();
  128. if (value == "自动建模")
  129. {
  130. sp_autoModel.Visibility = Visibility.Visible;
  131. sp_modelUser1.Visibility = Visibility.Collapsed;
  132. sp_modelUser2.Visibility = Visibility.Collapsed;
  133. sp_modelUser3.Visibility = Visibility.Collapsed;
  134. sp_modelEmploy.Visibility = Visibility.Collapsed;
  135. }
  136. else if (value == "模型应用")
  137. {
  138. //sp_autoModel.Visibility = Visibility.Collapsed;
  139. //sp_modelUser1.Visibility = Visibility.Collapsed;
  140. //sp_modelUser2.Visibility = Visibility.Collapsed;
  141. //sp_modelUser3.Visibility = Visibility.Collapsed;
  142. //sp_modelEmploy.Visibility = Visibility.Collapsed;
  143. }
  144. else if (value == "模型服务")
  145. {
  146. sp_autoModel.Visibility = Visibility.Collapsed;
  147. sp_modelUser1.Visibility = Visibility.Collapsed;
  148. sp_modelUser2.Visibility = Visibility.Collapsed;
  149. sp_modelUser3.Visibility = Visibility.Collapsed;
  150. sp_modelEmploy.Visibility = Visibility.Visible;
  151. }
  152. else if (value == "碰撞检查")
  153. {
  154. sp_autoModel.Visibility = Visibility.Collapsed;
  155. sp_modelUser1.Visibility = Visibility.Visible;
  156. sp_modelUser2.Visibility = Visibility.Collapsed;
  157. sp_modelUser3.Visibility = Visibility.Collapsed;
  158. sp_modelEmploy.Visibility = Visibility.Collapsed;
  159. }
  160. else if (value == "净高分析")
  161. {
  162. sp_autoModel.Visibility = Visibility.Collapsed;
  163. sp_modelUser1.Visibility = Visibility.Collapsed;
  164. sp_modelUser2.Visibility = Visibility.Visible;
  165. sp_modelUser3.Visibility = Visibility.Collapsed;
  166. sp_modelEmploy.Visibility = Visibility.Collapsed;
  167. }
  168. else if (value == "条文审查")
  169. {
  170. sp_autoModel.Visibility = Visibility.Collapsed;
  171. sp_modelUser1.Visibility = Visibility.Collapsed;
  172. sp_modelUser2.Visibility = Visibility.Collapsed;
  173. sp_modelUser3.Visibility = Visibility.Visible;
  174. sp_modelEmploy.Visibility = Visibility.Collapsed;
  175. }
  176. }
  177. /// <summary>
  178. /// 鼠标双击类型
  179. /// </summary>
  180. /// <param name="sender"></param>
  181. /// <param name="e"></param>
  182. private void TextBox_MouseDoubleClick(object sender, MouseButtonEventArgs e)
  183. {
  184. bool isSelectDwg = ShowSelectDWGFiles(out string filePath);
  185. if (isSelectDwg)
  186. {
  187. selectModelApplication1.Text = "";
  188. selectModelApplication1.Text = filePath;
  189. }
  190. }
  191. /// <summary>
  192. /// 新增
  193. /// </summary>
  194. /// <param name="sender"></param>
  195. /// <param name="e"></param>
  196. private void Button_Click_1(object sender, RoutedEventArgs e)
  197. {
  198. TextBox textBox = new TextBox();
  199. textBox.Width = 80;
  200. textBox.Margin = new Thickness(0, 5, 0, 0);
  201. sp_objectName.Children.Add(textBox);
  202. Button button = new Button();
  203. button.Width = 80;
  204. button.Content = "上传";
  205. button.Margin = new Thickness(0, 5, 0, 0);
  206. sp_objectDraw.Children.Add(button);
  207. }
  208. /// <summary>
  209. /// 选择单个文件
  210. /// </summary>
  211. /// <param name="filePath"></param>
  212. /// <returns></returns>
  213. public static bool ShowSelectDWGFiles(out string filePath)
  214. {
  215. filePath = "";
  216. System.Windows.Forms.OpenFileDialog dlg = new System.Windows.Forms.OpenFileDialog();
  217. dlg.Multiselect = false;//等于true表示可以选择多个文件
  218. dlg.DefaultExt = ".rvt";
  219. dlg.Filter = "RVT 文件|*.rvt";
  220. if (dlg.ShowDialog() != System.Windows.Forms.DialogResult.OK) return false;
  221. filePath = dlg.FileName;
  222. return true;
  223. }
  224. private void SelectmodelServices_MouseDoubleClick(object sender, MouseButtonEventArgs e)
  225. {
  226. bool isSelectDwg = ShowSelectDWGFiles(out string filePath);
  227. if (isSelectDwg)
  228. {
  229. selectModelServices.Text = "";
  230. selectModelServices.Text = filePath;
  231. selectModelServices.Foreground = Brushes.Black;
  232. }
  233. }
  234. /// <summary>
  235. /// 碰撞检测
  236. /// </summary>
  237. /// <param name="sender"></param>
  238. /// <param name="e"></param>
  239. private void TextBox_MouseDoubleClick1(object sender, MouseButtonEventArgs e)
  240. {
  241. bool isSelectDwg = ShowSelectDWGFiles(out string filePath);
  242. if (isSelectDwg)
  243. {
  244. selectModelApplication1.Text = "";
  245. selectModelApplication1.Text = filePath;
  246. selectModelApplication1.Foreground = Brushes.Black;
  247. }
  248. }
  249. /// <summary>
  250. /// 净高分析
  251. /// </summary>
  252. /// <param name="sender"></param>
  253. /// <param name="e"></param>
  254. private void TextBox_MouseDoubleClick2(object sender, MouseButtonEventArgs e)
  255. {
  256. bool isSelectDwg = ShowSelectDWGFiles(out string filePath);
  257. if (isSelectDwg)
  258. {
  259. selectModelApplication2.Text = "";
  260. selectModelApplication2.Text = filePath;
  261. selectModelApplication2.Foreground = Brushes.Black;
  262. }
  263. }
  264. /// <summary>
  265. /// 条文审查
  266. /// </summary>
  267. /// <param name="sender"></param>
  268. /// <param name="e"></param>
  269. private void TextBox_MouseDoubleClick3(object sender, MouseButtonEventArgs e)
  270. {
  271. bool isSelectDwg = ShowSelectDWGFiles(out string filePath);
  272. if (isSelectDwg)
  273. {
  274. selectModelApplication3.Text = "";
  275. selectModelApplication3.Text = filePath;
  276. selectModelApplication3.Foreground = Brushes.Black;
  277. }
  278. }
  279. }
  280. }