| | |
| | | using DevExpress.XtraEditors; |
| | | using DevExpress.XtraBars.Ribbon.Drawing; |
| | | using DevExpress.XtraEditors; |
| | | using DevExpress.XtraMap; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.ComponentModel; |
| | |
| | | this.gridView1.RegistCustomDrawCell(Color.BurlyWood, Color.White); |
| | | this.generalSearchCtrl1.SearchEvent += Search; |
| | | this.generalSearchCtrl1.ClearEvent += Clear; |
| | | this.phartDiagramRelationGridViewCtrl1.SelectDataEvent += SelectData; |
| | | } |
| | | |
| | | public List<AssetsValveSingleMatchingViewModel> _allList = null;//所有列表 |
| | | private List<AssetsValveSingleMatchingViewModel> _allBindingList = null;//所有绑定列表 |
| | | private AssetsValveMainVmo _selected = null;//当前选中 |
| | | |
| | | private AssetsValveSingleMatchingViewModel _row; |
| | | private ValveMatchingViewModel _viewModel; |
| | | |
| | | public class ValveMatchingViewModel |
| | | { |
| | | public ValveMatchingViewModel() |
| | | { |
| | | } |
| | | |
| | | public AssetsValveMainVmo Vmo { get; set; } |
| | | public string MatchingCurveDbId { get; set; } |
| | | |
| | | public List<HydroCurvePointViewModel> MatchingCurveQL { get; set; } |
| | | public List<HydroCurvePointViewModel> MatchingCurveOL { get; set; } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 绑定数据 |
| | |
| | | /// <summary> |
| | | /// 获取 |
| | | /// </summary> |
| | | public AssetsValveMainVmo Get() |
| | | public ValveMatchingViewModel Get() |
| | | { |
| | | var vm = this.gridView1.GetFocusedRow() as AssetsValveSingleMatchingViewModel; |
| | | if (vm == null) |
| | | { |
| | | return default; |
| | | } |
| | | return vm.Vmo; |
| | | /* var vm = this.gridView1.GetFocusedRow() as AssetsValveSingleMatchingViewModel; |
| | | if (vm == null) |
| | | { |
| | | return default; |
| | | } |
| | | _viewModel.Vmo = vm; |
| | | */ |
| | | return _viewModel; |
| | | } |
| | | |
| | | //聚焦改变 |
| | | private void gridView1_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e) |
| | | { |
| | | _viewModel = new ValveMatchingViewModel(); |
| | | var row = this.gridView1.GetFocusedRow() as AssetsValveSingleMatchingViewModel; |
| | | if (row == null) |
| | | { |
| | | return; |
| | | } |
| | | _row = row; |
| | | _viewModel.Vmo = row.Vmo; |
| | | this.phartDiagramRelationGridViewCtrl1.SetBindingData(HStation.Assets.DataType.ValveMain, row.Vmo.ID); |
| | | } |
| | | |
| | | //曲线数据关联变化 |
| | | private void SelectData(List<PhartDiagramRelationExtensionsVmo> list) |
| | | { |
| | | if (list != null && list.Count > 0) |
| | | { |
| | | var def = list.OrderByDescending(x => x.Importance).First(); |
| | | _viewModel.MatchingCurveDbId = def.ID.ToString(); |
| | | var curve = def.Diagram.GraphList[0].GetFeatPointList(); |
| | | if (_row.ValveType == HStation.Assets.eValveType.GPV) |
| | | { |
| | | _viewModel.MatchingCurveQL = new List<HydroCurvePointViewModel>(); |
| | | foreach (var item in curve) |
| | | { |
| | | _viewModel.MatchingCurveQL.Add(new HydroCurvePointViewModel(item.X, item.Y)); |
| | | } |
| | | } |
| | | else if (_row.ValveType == HStation.Assets.eValveType.TCV) |
| | | { |
| | | _viewModel.MatchingCurveOL = new List<HydroCurvePointViewModel>(); |
| | | foreach (var item in curve) |
| | | { |
| | | _viewModel.MatchingCurveOL.Add(new HydroCurvePointViewModel(item.X, item.Y)); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |