lixiaojun
2024-12-05 77a4be9a061af13fcd7a0143cf6299172a6fa7f9
WinFrmUI/HStation.WinFrmUI.Xhs.Core/02-project/01-import/05-completed/XhsProjectSimulationAnalysisCtrl.cs
@@ -5,12 +5,16 @@
        public XhsProjectSimulationAnalysisCtrl()
        {
            InitializeComponent();
            this.gridView1.SetNormalView(30);
            this.gridView1.RegistCustomDrawRowIndicator(40);
        }
        private List<XhsProjectSimulationAnalysisViewModel> _allBindingList;
        public void SetBindingData(Model.RevitModel revitModel)
        {
            if (revitModel == null)
                return;
            _allBindingList = new List<XhsProjectSimulationAnalysisViewModel>();
            this.xhsProjectSimulationAnalysisViewModelBindingSource.DataSource = _allBindingList;
            var allRevitParterList = revitModel.GetAllParters();
@@ -28,19 +32,19 @@
                        {
                            case Revit.ePropStatus.Error:
                                {
                                    _allBindingList.Add(new XhsProjectSimulationAnalysisViewModel { Type = revitParter.Catalog, Code = revitParter.Code, Name = revitParter.Name, Description = revitParterPropStatus.StatusInfo });
                                    _allBindingList.Add(new XhsProjectSimulationAnalysisViewModel { Type = revitParter.Catalog, Code = revitParter.Id, Name = revitParter.Name, Description = revitParterPropStatus.StatusInfo, ErrorLevel = "Error", PropStatus = "错误" });
                                }
                                break;
                            case Revit.ePropStatus.Lack:
                                {
                                    _allBindingList.Add(new XhsProjectSimulationAnalysisViewModel { Type = revitParter.Catalog, Code = revitParter.Code, Name = revitParterPropStatus.PropName, Description = revitParterPropStatus.StatusInfo });
                                    _allBindingList.Add(new XhsProjectSimulationAnalysisViewModel { Type = revitParter.Catalog, Code = revitParter.Id, Name = revitParterPropStatus.PropName, Description = revitParterPropStatus.StatusInfo, ErrorLevel = "Lack", PropStatus = "缺省" });
                                }
                                break;
                            case Revit.ePropStatus.Abnormal:
                                {
                                    _allBindingList.Add(new XhsProjectSimulationAnalysisViewModel { Type = revitParter.Catalog, Code = revitParter.Code, Name = revitParterPropStatus.PropName, Description = revitParterPropStatus.StatusInfo });
                                    _allBindingList.Add(new XhsProjectSimulationAnalysisViewModel { Type = revitParter.Catalog, Code = revitParter.Id, Name = revitParterPropStatus.PropName, Description = revitParterPropStatus.StatusInfo, ErrorLevel = "Abnormal", PropStatus = "异常" });
                                }
                                break;
@@ -51,5 +55,35 @@
            }
            this.xhsProjectSimulationAnalysisViewModelBindingSource.ResetBindings(false);
        }
        //自定义单元格颜色
        private void gridView1_CustomDrawCell(object sender, DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs e)
        {
            var row = this.gridView1.GetRow(e.RowHandle) as XhsProjectSimulationAnalysisViewModel;
            if (row == null)
            {
                return;
            }
            if (e.RowHandle != this.gridView1.FocusedRowHandle)
            {
                switch (row.ErrorLevel)
                {
                    case "Error":
                        e.Appearance.BackColor = Color.Red;
                        e.Appearance.ForeColor = Color.White;
                        break;
                    case "Lack":
                        e.Appearance.BackColor = Color.Gray;
                        e.Appearance.ForeColor = Color.White;
                        break;
                    case "Abnormal":
                        e.Appearance.BackColor = Color.Orange;
                        e.Appearance.ForeColor = Color.White;
                        break;
                }
            };
        }
    }
}