using CollaborativePlatformMain.DFEntity; using CollaborativePlatformMain.DFEntity.MessageSubUtil; using CollaborativePlatformMain.Form.MessageSubPage.Project; using CollaborativePlatformMain.Form.UserControlForm; 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 { /// /// UploadDrawingForm.xaml 的交互逻辑 /// public partial class UploadDrawingForm : Window { /// /// 父级窗体 /// public OperatingFloorPage OperatingFloorPage; /// /// 是否为更新图纸 /// public bool IsRenew = false; /// /// 更新、上传图纸 /// /// public UploadDrawingForm(OperatingFloorPage operatingFloorPage, bool isRenew) { InitializeComponent(); OperatingFloorPage = operatingFloorPage; IsRenew = isRenew; } /// /// 窗体初始化 /// /// /// private void Window_Loaded(object sender, RoutedEventArgs e) { if (IsRenew) { sp_duibi.Visibility = Visibility.Visible; } #region 对比版本 ObservableCollection operatEntities = OperatingFloorPage.ArchOperaDatas; //版本号 List versions = new List(); foreach (var operatEntity in operatEntities) { versions.AddRange(operatEntity.SubDatas.Select(x => x.Node)); } cb_dwgName.ItemsSource = null; cb_dwgName.ItemsSource = versions; #endregion } /// /// 单选框点击事件 /// /// /// private void ButtonBase_OnClick(object sender, RoutedEventArgs e) { RadioButton radioButton = sender as RadioButton; if (radioButton.Content.Equals("是")) { sp_contrast.Visibility = Visibility.Visible; } else { sp_contrast.Visibility = Visibility.Collapsed; } } /// /// 上传图纸 /// /// /// private void Button_Click(object sender, RoutedEventArgs e) { //List operatEntities = OperatingFloorPage.AllOperatDatas; SetOPerData(ArchLayerDatas, ref OperatingFloorPage.ArchOperaDatas); SetOPerData(WarmLayerDatas, ref OperatingFloorPage.WarmOperaDatas); //更新数据 OperatingFloorPage.ReplaceData(); this.Close(); } /// /// 更换数据 /// /// /// public void SetOPerData(List floorLayerDatas, ref ObservableCollection operatEntities) { //二级 ObservableCollection twoDatas = new ObservableCollection(); twoDatas.Add(new OperatEntity("原图纸", "", new ObservableCollection(), false)); //对比图 if (IsRenew) { //对比版本 string banben = cb_dwgName.SelectedItem as string; //选择的对比范围 List selNativeDatas = cb_floor.ItemsSource.Where(x => x.IsSelect).ToList(); ObservableCollection duibiDatas = new ObservableCollection(); foreach (var nativeDataInfo in selNativeDatas) { duibiDatas.Add(new OperatEntity(nativeDataInfo.Name, "", new ObservableCollection(), false)); } twoDatas.Add(new OperatEntity("对比图-" + banben, "", duibiDatas, false)); } //三级 ObservableCollection threeDatas = new ObservableCollection(); threeDatas.Add(new OperatEntity("整栋图", "", new ObservableCollection(), false)); //四级 ObservableCollection fourDatas = new ObservableCollection(); foreach (var floorLayerData in floorLayerDatas) { //五级 ObservableCollection fiveDatas = new ObservableCollection(); List layersDatas = floorLayerData.SubDatas; foreach (var layerData in layersDatas) { fiveDatas.Add(new OperatEntity(layerData.LayerName, "", new ObservableCollection(), true)); } fourDatas.Add(new OperatEntity(floorLayerData.FloorName, "", fiveDatas, false)); } threeDatas.Add(new OperatEntity("分层图", "", fourDatas, false)); twoDatas.Add(new OperatEntity("治理图纸", "", threeDatas, false)); OperatEntity firstData = new OperatEntity(tb_dwgName.Text.ToString(), "", twoDatas, false); //添加数据 foreach (var operatEntity in operatEntities) { operatEntity.SubDatas.Add(firstData); break; } } /// /// 窗体数据 /// public List ArchLayerDatas = new List(); public List StruLayerDatas = new List(); public List WaterLayerDatas = new List(); public List WarmLayerDatas = new List(); public List EleLayerDatas = new List(); /// /// 选择图纸 /// /// /// private void bt_xaunze_Click(object sender, RoutedEventArgs e) { FloorDrawingForm floorDrawingForm = new FloorDrawingForm(this); floorDrawingForm.Show(); this.Hide(); } /// /// 对比版本改变事件 /// 目的:实时刷新对比范围 /// /// /// private void cb_dwgName_SelectionChanged(object sender, SelectionChangedEventArgs e) { //选中的对比版本 string selValue = cb_dwgName.SelectedItem.ToString(); //对比范围 List floorValues = new List(); bool isBreak = false; ObservableCollection operatEntities = OperatingFloorPage.ArchOperaDatas; foreach (var operatEntity in operatEntities) { //版本号 foreach (var twoData in operatEntity.SubDatas) { if (twoData.Node == selValue) { //原图、对比图、治理图 foreach (var threeData in twoData.SubDatas) { if (threeData.Node.Contains("治理")) { //整栋图、分层图 foreach (var fourData in threeData.SubDatas) { if (fourData.Node.Contains("分层")) { foreach (var fiveData in fourData.SubDatas) { floorValues.Add(fiveData.Node); } } } } } isBreak = true; break; } } if (isBreak) break; } //赋值 List nativeDataInfos = new List(); foreach (var floorValue in floorValues) { nativeDataInfos.Add(new NativeDataInfo(Guid.NewGuid().ToString(), floorValue)); } cb_floor.ItemsSource = nativeDataInfos; } } }