lixiaojun
2024-10-22 2ef8058f388b9e8c030b50d695334976576f9687
优化检查控件
已修改4个文件
53 ■■■■ 文件已修改
WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/06-simulation/XhsProjectSimulationCorePage.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
WinFrmUI/Yw.WinFrmUI.Hydro.Core/05-check/01-control/HydroCheckItemViewModel.cs 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WinFrmUI/Yw.WinFrmUI.Hydro.Core/05-check/01-control/HydroCheckResultCtrl.Designer.cs 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WinFrmUI/Yw.WinFrmUI.Hydro.Core/05-check/01-control/HydroCheckResultCtrl.cs 42 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/06-simulation/XhsProjectSimulationCorePage.cs
@@ -570,7 +570,7 @@
        #endregion 水力校验
        #region 保存水力信息
        #region 保存信息
        //保存
        private async void barBtnSave_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
WinFrmUI/Yw.WinFrmUI.Hydro.Core/05-check/01-control/HydroCheckItemViewModel.cs
@@ -34,6 +34,7 @@
            this.Code = rhs.Code;
            this.Failed = rhs.Failed;
            this.Reason = rhs.Reason;
            this.SortCode = rhs.Failed ? 1 : 2;
        }
        /// <summary>
@@ -66,6 +67,13 @@
        [DisplayName("检查原因")]
        public string Reason { get; set; }
        /// <summary>
        /// 排序码
        /// </summary>
        [DisplayName("排序码")]
        [Browsable(false)]
        public int SortCode { get; set; }
    }
}
WinFrmUI/Yw.WinFrmUI.Hydro.Core/05-check/01-control/HydroCheckResultCtrl.Designer.cs
@@ -178,6 +178,7 @@
            gridView1.Name = "gridView1";
            gridView1.ViewCaption = "校验明细";
            gridView1.RowClick += gridView1_RowClick;
            gridView1.CustomDrawCell += gridView1_CustomDrawCell;
            // 
            // colMode
            // 
WinFrmUI/Yw.WinFrmUI.Hydro.Core/05-check/01-control/HydroCheckResultCtrl.cs
@@ -7,7 +7,7 @@
            InitializeComponent();
            this.gridView1.SetNormalView(30);
            this.gridView1.RegistCustomDrawRowIndicator(40);
            this.gridView1.ShowFindPanel();
            //this.gridView1.ShowFindPanel();
        }
        /// <summary>
@@ -30,11 +30,11 @@
            {
                this.peSucceed.Image = Yw.WinFrmUI.Hydro.Core.Properties.Resources.failed_64;
            }
            this.txtMode.EditValue = HydroCheckMode.Count();
            this.txtType.EditValue = HydroCheckType.Count();
            this.txtItems.EditValue = result.Items.Count;
            this.txtSucceedItems.EditValue = result.Items.Count(x => !x.Failed);
            this.txtFailedItems.EditValue = result.Items.Count(x => x.Failed);
            this.txtMode.EditValue = $"{HydroCheckMode.Count()}种";
            this.txtType.EditValue = $"{HydroCheckType.Count()}类";
            this.txtItems.EditValue = $"{result.Items.Count}个";
            this.txtSucceedItems.EditValue = $"{result.Items.Count(x => !x.Failed)}个";
            this.txtFailedItems.EditValue = $"{result.Items.Count(x => x.Failed)}个";
            _allBindingList = new List<HydroCheckItemViewModel>();
            foreach (var item in result.Items)
@@ -42,6 +42,7 @@
                var vm = new HydroCheckItemViewModel(item);
                _allBindingList.Add(vm);
            }
            _allBindingList = _allBindingList.OrderBy(x => x.SortCode).ToList();
            this.hydroCheckItemViewModelBindingSource.DataSource = _allBindingList;
            this.hydroCheckItemViewModelBindingSource.ResetBindings(false);
        }
@@ -57,5 +58,34 @@
            this.HydroClickEvent?.Invoke(row.Code);
        }
        //自定义单元格颜色
        private void gridView1_CustomDrawCell(object sender, DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs e)
        {
            var row = this.gridView1.GetRow(e.RowHandle) as HydroCheckItemViewModel;
            if (row == null)
            {
                return;
            }
            if (e.RowHandle != this.gridView1.FocusedRowHandle)
            {
                if (row.Failed)
                {
                    e.Appearance.BackColor = Color.Red;
                    e.Appearance.ForeColor = Color.White;
                }
                else
                {
                    e.Appearance.BackColor = Color.Green;
                    e.Appearance.ForeColor = Color.White;
                }
            }
            else
            {
                e.Appearance.BackColor = Color.Orange;
                e.Appearance.ForeColor = Color.White;
            }
        }
    }
}