From 33b5627e2d1092f6931165b7f9f1a16de65d765d Mon Sep 17 00:00:00 2001
From: Shuxia Ning <NingShuxia0927@outlook.com>
Date: 星期二, 17 十二月 2024 09:43:57 +0800
Subject: [PATCH] 曲线底层修改

---
 WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/04-scheme/02-change/01-pump/CreateXhsSchemePumpChangePage.cs |   52 +++++++++++++++++++++++++++++++++++++---------------
 1 files changed, 37 insertions(+), 15 deletions(-)

diff --git a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/04-scheme/02-change/01-pump/CreateXhsSchemePumpChangePage.cs b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/04-scheme/02-change/01-pump/CreateXhsSchemePumpChangePage.cs
index d28b533..dd3751f 100644
--- a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/04-scheme/02-change/01-pump/CreateXhsSchemePumpChangePage.cs
+++ b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/04-scheme/02-change/01-pump/CreateXhsSchemePumpChangePage.cs
@@ -10,7 +10,8 @@
         {
             InitializeComponent();
             InitialLinkStatus();
-            this.layoutView1.SetDefuaulView(); 
+            this.layoutView1.SetDefuaulView();
+            this.layoutView1.SetFindPanel();
         }
 
         /// <summary>
@@ -51,17 +52,15 @@
             _project_site = t.ProjectSite;
             if (t.HydroInfo.Pumps != null && t.HydroInfo.Pumps.Any())
             {
-                var svg_img = SvgImage.FromStream(new MemoryStream(HStation.WinFrmUI.Xhs.Core.Properties.Resources.pump));
-
+                var svg = SvgImage.FromStream(new MemoryStream(HStation.WinFrmUI.Xhs.Core.Properties.Resources.pump));
                 _vm_list = new List<CreateXhsSchemePumpChangeViewMdoel>();
                 foreach (var pump in t.HydroInfo.Pumps)
                 {
-                    var vm = new Yw.WinFrmUI.HydroPumpViewModel(pump, t.HydroInfo).Adapt<CreateXhsSchemePumpChangeViewMdoel>();
-                    vm.SvgImage = svg_img;  
-                    _vm_list.Add(vm);
+                    var vm = new Yw.WinFrmUI.HydroPumpViewModel(pump, t.HydroInfo);
+                    _vm_list.Add(new CreateXhsSchemePumpChangeViewMdoel(vm, svg));
                 }
-            }  
-  
+            }
+
             this.createXhsSchemePumpChangeViewMdoelBindingSource.DataSource = _vm_list;
             this.createXhsSchemePumpChangeViewMdoelBindingSource.ResetBindings(false);
 
@@ -82,7 +81,14 @@
             {
                 _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;
         }
@@ -109,19 +115,21 @@
             {
                 return false;
             }
-            _vm.HydroInfo.Pumps = _vm_list.Adapt<List<Yw.Model.HydroPumpInfo>>();
+            _vm_list.ForEach(x => x.ViewModel.UpdateVmoProperty());
+            _vm.HydroInfo.Pumps = _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 CreateXhsSchemePumpChangeViewMdoel;
             if (row == null)
                 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)
@@ -132,20 +140,34 @@
 
                 var link_status = row.LinkStatus;
                 var current_hz = row.CurrentHz;
-
-                var input = Yw.WinFrmUI.HydroMatchingHelper.Create(row.Vmo, _vm.HydroInfo);
+                var input = Yw.WinFrmUI.HydroMatchingHelper.Create(row.ViewModel.Vmo, _vm.HydroInfo);
                 var dlg = new SimulationPumpSingleMatchingDlg();
                 dlg.SetBindingData(input);
                 dlg.ReloadDataEvent += (output) =>
                 {
-                    Yw.WinFrmUI.HydroMatchingHelper.Apply(row, output);
+                    Yw.WinFrmUI.HydroMatchingHelper.Apply(row.ViewModel, output);
                     row.LinkStatus = link_status;
                     row.CurrentHz = current_hz;
+                    if (!_vm.ChangeRecordList.Exists(x => x.Code == row.ViewModel.Code))
+                    {
+                        _vm.ChangeRecordList.Add(new(Yw.Hydro.ParterCatalog.Pump, 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 CreateXhsSchemePumpChangeViewMdoel row)
+                return;
+            if (!_vm.ChangeRecordList.Exists(x => x.Code == row.ViewModel.Code))
+            {
+                _vm.ChangeRecordList.Add(new(Yw.Hydro.ParterCatalog.Pump, row.ViewModel.Code, row.Name,row.SvgImage));
+            }
+        }
+
         /// <summary>
         /// 鍏佽涓婁竴姝�
         /// </summary>

--
Gitblit v1.9.3