FloorDrawingForm.xaml.cs 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. using CollaborativePlatformMain.DFEntity;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. using System.Windows;
  8. using System.Windows.Controls;
  9. using System.Windows.Data;
  10. using System.Windows.Documents;
  11. using System.Windows.Input;
  12. using System.Windows.Media;
  13. using System.Windows.Media.Imaging;
  14. using System.Windows.Shapes;
  15. namespace CollaborativePlatformMain.Form
  16. {
  17. /// <summary>
  18. /// FloorDrawingForm.xaml 的交互逻辑
  19. /// </summary>
  20. public partial class FloorDrawingForm : Window
  21. {
  22. /// <summary>
  23. /// 父级窗体
  24. /// </summary>
  25. public UploadDrawingForm UploadDrawingForm;
  26. /// <summary>
  27. /// 窗体数据
  28. /// </summary>
  29. public List<FloorLayerData> FloorDatas = new List<FloorLayerData>();
  30. /// <summary>
  31. /// 楼层管理器
  32. /// </summary>
  33. public FloorDrawingForm(UploadDrawingForm uploadDrawingForm)
  34. {
  35. InitializeComponent();
  36. UploadDrawingForm = uploadDrawingForm;
  37. }
  38. /// <summary>
  39. /// 窗体初始化
  40. /// </summary>
  41. /// <param name="sender"></param>
  42. /// <param name="e"></param>
  43. private void Window_Loaded(object sender, RoutedEventArgs e)
  44. {
  45. Dictionary<int, string> keyValuePairs = new Dictionary<int, string>();
  46. keyValuePairs.Add(0, "墙体");
  47. keyValuePairs.Add(1, "门窗");
  48. keyValuePairs.Add(2, "房间标签");
  49. keyValuePairs.Add(3, "车位");
  50. int num = 1;
  51. for (int i = 0; i < 5; i++)
  52. {
  53. List<FloorLayerData> layerDatas = new List<FloorLayerData>();
  54. for (int j = 0; j < 4; j++)
  55. {
  56. FloorLayerData layerData = new FloorLayerData(keyValuePairs[j]);
  57. layerDatas.Add(layerData);
  58. num++;
  59. }
  60. FloorDatas.Add(new FloorLayerData("F" + i, "", layerDatas));
  61. }
  62. sv_floor.ItemsSource = null;
  63. sv_floor.ItemsSource = FloorDatas;
  64. }
  65. /// <summary>
  66. /// 窗体关闭事件
  67. /// </summary>
  68. /// <param name="sender"></param>
  69. /// <param name="e"></param>
  70. private void Window_Closed(object sender, EventArgs e)
  71. {
  72. UploadDrawingForm.Visibility = Visibility.Visible;
  73. }
  74. /// <summary>
  75. /// 楼层鼠标点击事件
  76. /// </summary>
  77. /// <param name="sender"></param>
  78. /// <param name="e"></param>
  79. private void tb_FloorName_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
  80. {
  81. TextBlock textBlock = sender as TextBlock;
  82. if (textBlock == null) return;
  83. FloorLayerData floorLayerData = textBlock.DataContext as FloorLayerData;
  84. if (floorLayerData == null) return;
  85. sv_layer.ItemsSource = null;
  86. sv_layer.ItemsSource = floorLayerData.SubDatas;
  87. }
  88. /// <summary>
  89. /// 图层鼠标点击事件
  90. /// </summary>
  91. /// <param name="sender"></param>
  92. /// <param name="e"></param>
  93. private void tb_LayerName_PreviewMouseLeftButtonDown_1(object sender, MouseButtonEventArgs e)
  94. {
  95. }
  96. /// <summary>
  97. /// 确定事件
  98. /// </summary>
  99. /// <param name="sender"></param>
  100. /// <param name="e"></param>
  101. private void bt_determine_Click(object sender, RoutedEventArgs e)
  102. {
  103. UploadDrawingForm.ArchLayerDatas = FloorDatas;
  104. UploadDrawingForm.bt_xaunze.Background = Brushes.Green;
  105. Dictionary<int, string> keyValuePairs = new Dictionary<int, string>();
  106. keyValuePairs.Add(0, "风管");
  107. keyValuePairs.Add(1, "风机");
  108. keyValuePairs.Add(2, "风口");
  109. keyValuePairs.Add(3, "水管");
  110. List<FloorLayerData> warmDatas = new List<FloorLayerData>();
  111. int num = 1;
  112. for (int i = 0; i < 5; i++)
  113. {
  114. List<FloorLayerData> layerDatas = new List<FloorLayerData>();
  115. for (int j = 0; j < 4; j++)
  116. {
  117. FloorLayerData layerData = new FloorLayerData(keyValuePairs[j]);
  118. layerDatas.Add(layerData);
  119. num++;
  120. }
  121. warmDatas.Add(new FloorLayerData("F" + i, "", layerDatas));
  122. }
  123. UploadDrawingForm.WarmLayerDatas = warmDatas;
  124. this.Close();
  125. }
  126. }
  127. }