| | |
| | | using DevExpress.Utils.Svg; |
| | | using Mapster; |
| | | using Yw; |
| | | |
| | | namespace HStation.WinFrmUI |
| | | { |
| | |
| | | public CreateXhsSchemePipeChangePage() |
| | | { |
| | | InitializeComponent(); |
| | | InitialLinkStatus(); |
| | | this.layoutView1.SetDefuaulView(); |
| | | this.layoutView1.SetDefuaulView(); |
| | | this.layoutView1.SetFindPanel(); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | private bool _isInitialize = false;//是否初始化 |
| | | |
| | | private HStation.Vmo.XhsProjectVmo _project = null;//项目 |
| | | private HStation.Vmo.XhsProjectSiteVmo _project_site = null;//项目站 |
| | | private HStation.Vmo.XhsProjectSiteVmo _project_site = null;//项目站 |
| | | private List<CreateXhsSchemePipeChangeViewMdoel> _vm_list = null; |
| | | |
| | | |
| | | //初始化状态 |
| | | private void InitialLinkStatus() |
| | | { |
| | | this.repImgCmbStatus.BeginUpdate(); |
| | | this.repImgCmbStatus.Items.Clear(); |
| | | this.repImgCmbStatus.Items.Add("开启", "开启", -1); |
| | | this.repImgCmbStatus.Items.Add("关闭", "关闭", -1); |
| | | this.repImgCmbStatus.EndUpdate(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 初始化 |
| | |
| | | _project_site = t.ProjectSite; |
| | | if (t.HydroInfo.Pipes != null && t.HydroInfo.Pipes.Any()) |
| | | { |
| | | var svg_img = SvgImage.FromStream(new MemoryStream(HStation.WinFrmUI.Xhs.Core.Properties.Resources.pipe)); |
| | | |
| | | var svg = SvgImage.FromStream(new MemoryStream(HStation.WinFrmUI.Xhs.Core.Properties.Resources.pipe)); |
| | | _vm_list = new List<CreateXhsSchemePipeChangeViewMdoel>(); |
| | | foreach (var pipe in t.HydroInfo.Pipes) |
| | | { |
| | | var vm = new Yw.WinFrmUI.HydroPipeViewModel(pipe, t.HydroInfo).Adapt<CreateXhsSchemePipeChangeViewMdoel>(); |
| | | vm.SvgImage = svg_img; |
| | | _vm_list.Add(vm); |
| | | var vm = new Yw.WinFrmUI.HydroPipeViewModel(pipe, t.HydroInfo); |
| | | _vm_list.Add(new CreateXhsSchemePipeChangeViewMdoel(vm, svg)); |
| | | } |
| | | } |
| | | |
| | | //this.CreateXhsSchemePipeChangeViewMdoelBindingSource.DataSource = _vm_list; |
| | | //this.CreateXhsSchemePipeChangeViewMdoelBindingSource.ResetBindings(false); |
| | | } |
| | | |
| | | this.createXhsSchemePipeChangeViewMdoelBindingSource.DataSource = _vm_list; |
| | | this.createXhsSchemePipeChangeViewMdoelBindingSource.ResetBindings(false); |
| | | |
| | | ShowBimfaceCtrl(); |
| | | this.PageStateChangedEvent?.Invoke(); |
| | | } |
| | | |
| | | #region Bimface |
| | |
| | | { |
| | | _bimfaceCtrl = new SimulationBimfaceCtrl(); |
| | | _bimfaceCtrl.Dock = DockStyle.Fill; |
| | | await _bimfaceCtrl.InitialData(_project, _project_site); |
| | | await _bimfaceCtrl.InitialData(_project, _project_site); |
| | | _bimfaceCtrl.HydroMouseLeftClickEvent += (code) => |
| | | { |
| | | if (_vm_list == null || !_vm_list.Any()) |
| | | return; |
| | | var index = _vm_list.FindIndex(x => x.ViewModel.Code == code); |
| | | this.layoutView1.FocusedRowHandle = index; |
| | | }; |
| | | } |
| | | return _bimfaceCtrl; |
| | | } |
| | |
| | | this.sidePanel3dModel.Controls.Add(bimfaceCtrl); |
| | | } |
| | | |
| | | |
| | | #endregion |
| | | #endregion Bimface |
| | | |
| | | //保存 |
| | | private bool Save() |
| | |
| | | { |
| | | return false; |
| | | } |
| | | _vm.HydroInfo.Pipes = _vm_list.Adapt<List<Yw.Model.HydroPipeInfo>>(); |
| | | _vm_list.ForEach(x => x.ViewModel.UpdateVmoProperty()); |
| | | _vm.HydroInfo.Pipes = _vm_list.Select(x => x.ViewModel.Vmo).ToList(); |
| | | return true; |
| | | } |
| | | |
| | | // |
| | | //点击 |
| | | private async void layoutView1_CardClick(object sender, DevExpress.XtraGrid.Views.Layout.Events.CardClickEventArgs e) |
| | | { |
| | | var row = this.layoutView1.GetRow(e.RowHandle) as CreateXhsSchemePipeChangeViewMdoel; |
| | | if (row == null) |
| | | if (this.layoutView1.GetRow(e.RowHandle) is not CreateXhsSchemePipeChangeViewMdoel row) |
| | | return; |
| | | await _bimfaceCtrl?.ZoomAndSelectComponent(row.Code); |
| | | await _bimfaceCtrl?.ZoomAndSelectComponent(row.ViewModel.Code); |
| | | } |
| | | |
| | | //选中列变换 |
| | | private void layoutView1_FocusedColumnChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedColumnChangedEventArgs e) |
| | | { |
| | | if (e.FocusedColumn == this.colModelType) |
| | |
| | | return; |
| | | |
| | | var link_status = row.LinkStatus; |
| | | |
| | | var input = Yw.WinFrmUI.HydroMatchingHelper.Create(row.Vmo, _vm.HydroInfo); |
| | | var dlg = new SimulationPipeSingleMatchingDlg(); |
| | | |
| | | var input = Yw.WinFrmUI.HydroMatchingHelper.Create(row.ViewModel.Vmo, _vm.HydroInfo); |
| | | var dlg = new AssetsPipeSingleMatchingDlg(); |
| | | dlg.SetBindingData(input); |
| | | dlg.ReloadDataEvent += (output) => |
| | | { |
| | | Yw.WinFrmUI.HydroMatchingHelper.Apply(row, output); |
| | | row.LinkStatus = link_status; |
| | | Yw.WinFrmUI.HydroMatchingHelper.Apply(row.ViewModel, output); |
| | | row.LinkStatus = link_status; |
| | | if (!_vm.ChangeRecordList.Exists(x => x.Code == row.ViewModel.Code)) |
| | | { |
| | | _vm.ChangeRecordList.Add(new(Yw.Hydro.ParterCatalog.Pipe, row.ViewModel.Code, row.Name, row.SvgImage)); |
| | | } |
| | | }; |
| | | dlg.ShowDialog(); |
| | | } |
| | | } |
| | | |
| | | //单元格值变换 |
| | | private void layoutView1_CellValueChanged(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e) |
| | | { |
| | | if (this.layoutView1.GetRow(e.RowHandle) is not CreateXhsSchemePipeChangeViewMdoel row) |
| | | return; |
| | | if (!_vm.ChangeRecordList.Exists(x => x.Code == row.ViewModel.Code)) |
| | | { |
| | | _vm.ChangeRecordList.Add(new(Yw.Hydro.ParterCatalog.Pipe, row.ViewModel.Code, row.Name, row.SvgImage)); |
| | | } |
| | | } |
| | | |
| | |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | |
| | | } |
| | | } |