lixiaojun
2025-01-07 db26311246d1c1cecadf4a22dc44ffa570ee40f2
WinFrmUI/Yw.WinFrmUI.Hydro.Core/06-visual/15-pipe/HydroPipeListCtrl.cs
@@ -31,10 +31,7 @@
        /// 水力改变视图事件
        /// </summary>
        public event Action<List<HydroVisualViewModel>> HydroChangedViewEvent;
        /// <summary>
        /// 构件改变事件
        /// </summary>
        public event Action<HydroParterInfo, eChangeType> ParterChangedEvent;
        /// <summary>
        /// 是否拥有水力列表
@@ -44,34 +41,54 @@
            get { return _allList != null && _allList.Count > 0; }
        }
        //所有列表
        private List<HydroPipeViewModel> _allList = null;
        //所有绑定列表
        private List<HydroPipeViewModel> _allBindingList = null;
        private List<HydroPipeViewModel> _allList = null;//所有列表
        private List<HydroPipeViewModel> _allBindingList = null;//所有绑定列表
        private HydroChangeHelper _changeHelper = null;//改变辅助类
        private HydroPropStatusHelper _propStatusHelper = null;//属性状态辅助类
        /// <summary>
        /// 绑定数据
        /// </summary>
        public void SetBindingData(Yw.Model.HydroModelInfo hydroInfo)
        public void SetBindingData
            (
                Yw.Model.HydroModelInfo hydroInfo,
                HydroChangeHelper changeHelper = null,
                HydroPropStatusHelper propStatusHelper = null
            )
        {
            SetBindingData(hydroInfo, allCalcuResultVisualDict: null);
            SetBindingData(hydroInfo, allCalcuResultVisualDict: null, changeHelper, propStatusHelper);
        }
        /// <summary>
        /// 绑定数据
        /// </summary>
        public void SetBindingData(Yw.Model.HydroModelInfo hydroInfo, List<HydroCalcuVisualResult> allCalcuResultList)
        public void SetBindingData
            (
                Yw.Model.HydroModelInfo hydroInfo,
                List<HydroCalcuVisualResult> allCalcuResultList,
                HydroChangeHelper changeHelper = null,
                HydroPropStatusHelper propStatusHelper = null
            )
        {
            var allCalcuResultVisualDict = allCalcuResultList?.ToDictionary(x => x.Code);
            SetBindingData(hydroInfo, allCalcuResultVisualDict);
            SetBindingData(hydroInfo, allCalcuResultVisualDict, changeHelper, propStatusHelper);
        }
        /// <summary>
        /// 绑定数据
        /// </summary>
        public void SetBindingData(Yw.Model.HydroModelInfo hydroInfo, Dictionary<string, HydroCalcuVisualResult> allCalcuResultVisualDict)
        public void SetBindingData
            (
                HydroModelInfo hydroInfo,
                Dictionary<string, HydroCalcuVisualResult> allCalcuResultVisualDict,
                HydroChangeHelper changeHelper = null,
                HydroPropStatusHelper propStatusHelper = null
            )
        {
            _allList = new List<HydroPipeViewModel>();
            _changeHelper = changeHelper;
            _propStatusHelper = propStatusHelper;
            if (hydroInfo != null && hydroInfo.Pipes != null && hydroInfo.Pipes.Count > 0)
            {
                foreach (var visual in hydroInfo.Pipes)
@@ -91,9 +108,16 @@
        /// <summary>
        /// 绑定数据
        /// </summary>
        public void SetBindingData(List<HydroVisualViewModel> allVisualViewModelList)
        public void SetBindingData
            (
                List<HydroVisualViewModel> allVisualViewModelList,
                HydroChangeHelper changeHelper = null,
                HydroPropStatusHelper propStatusHelper = null
            )
        {
            _allList = new List<HydroPipeViewModel>();
            _changeHelper = changeHelper;
            _propStatusHelper = propStatusHelper;
            allVisualViewModelList?.ForEach(x =>
            {
                if (x.Vmo.Catalog == Yw.Hydro.ParterCatalog.Pipe)
@@ -248,7 +272,7 @@
                return;
            }
            var dlg = new SetHydroPipeDlg();
            dlg.SetBindingData(_allBindingList.Select(x => x.Vmo).ToList());
            dlg.SetBindingData(_allBindingList.Select(x => x.Vmo).ToList(), _changeHelper, _propStatusHelper);
            dlg.ReloadDataEvent += (list) =>
            {
                if (list == null || list.Count < 1)
@@ -261,12 +285,11 @@
                this.HydroChangedViewEvent?.Invoke(allVisualViewModelList);
                var allVisualInfoList = allVisualViewModelList.Select(x => x.Vmo).ToList();
                this.HydroChangedInfoEvent?.Invoke(allVisualInfoList);
                list.ForEach(x => this.ParterChangedEvent?.Invoke(x, eChangeType.Update));
            };
            dlg.ShowDialog();
        }
        //行单元点击事件
        private void gridView1_RowCellClick(object sender, DevExpress.XtraGrid.Views.Grid.RowCellClickEventArgs e)
        {
            var row = this.gridView1.GetRow(e.RowHandle) as HydroPipeViewModel;
@@ -278,7 +301,7 @@
            if (e.Column == this.colSet)
            {
                var dlg = new SetHydroPipeDlg();
                dlg.SetBindingData(row.Vmo);
                dlg.SetBindingData(row.Vmo, _changeHelper, _propStatusHelper);
                dlg.ReloadDataEvent += (list) =>
                {
                    if (list == null || list.Count < 1)
@@ -289,7 +312,6 @@
                    this.gridView1.RefreshRow(e.RowHandle);
                    this.HydroChangedViewEvent?.Invoke(new List<HydroVisualViewModel>() { row });
                    this.HydroChangedInfoEvent?.Invoke(new List<HydroVisualInfo>() { row.Vmo });
                    this.ParterChangedEvent?.Invoke(row.Vmo, eChangeType.Update);
                };
                dlg.ShowDialog();
            }
@@ -435,5 +457,7 @@
            this.colCalcuQ.Visible = true;
            this.colSet.Visible = false;
        }
    }
}