| | |
| | | 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<AssetsTankSingleMatchingViewModel> _allList = null;//所有列表 |
| | | private List<AssetsTankSingleMatchingViewModel> _allBindingList = null;//所有绑定列表 |
| | | private AssetsTankMainVmo _selected = null;//当前选中 |
| | | |
| | | private AssetsTankSingleMatchingViewModel _row; |
| | | private TankMatchingViewModel _viewModel; |
| | | |
| | | public class TankMatchingViewModel |
| | | { |
| | | public TankMatchingViewModel() |
| | | { |
| | | } |
| | | |
| | | public AssetsTankMainVmo Vmo { get; set; } |
| | | public string MatchingCurveDbId { get; set; } |
| | | |
| | | public List<HydroCurvePointViewModel> MatchingCurve { get; set; } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 绑定数据 |
| | |
| | | { |
| | | _allBindingList = _allBindingList.Where(x => !string.IsNullOrEmpty(x.Name) && x.Name.Contains(name)).ToList(); |
| | | } |
| | | var material = this.txtMaterial.Text.Trim(); |
| | | this.assetsTankSingleMatchingViewModelBindingSource.DataSource = _allBindingList; |
| | | this.assetsTankSingleMatchingViewModelBindingSource.ResetBindings(false); |
| | | } |
| | |
| | | /// <summary> |
| | | /// 获取 |
| | | /// </summary> |
| | | public AssetsTankMainVmo Get() |
| | | public TankMatchingViewModel Get() |
| | | { |
| | | var vm = this.gridView1.GetFocusedRow() as AssetsTankSingleMatchingViewModel; |
| | | if (vm == null) |
| | | { |
| | | return default; |
| | | } |
| | | return vm.Vmo; |
| | | /* var vm = this.gridView1.GetFocusedRow() as AssetsTankSingleMatchingViewModel; |
| | | if (vm == null) |
| | | { |
| | | return default; |
| | | } |
| | | _viewModel.Vmo = vm; |
| | | */ |
| | | return _viewModel; |
| | | } |
| | | |
| | | //聚焦改变 |
| | | private void gridView1_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e) |
| | | { |
| | | _viewModel = new TankMatchingViewModel(); |
| | | var row = this.gridView1.GetFocusedRow() as AssetsTankSingleMatchingViewModel; |
| | | if (row == null) |
| | | { |
| | | return; |
| | | } |
| | | _row = row; |
| | | _viewModel.Vmo = row.Vmo; |
| | | this.phartDiagramRelationGridViewCtrl1.SetBindingData(HStation.Assets.DataType.TankMain, 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(); |
| | | _viewModel.MatchingCurve = new List<HydroCurvePointViewModel>(); |
| | | foreach (var item in curve) |
| | | { |
| | | _viewModel.MatchingCurve.Add(new HydroCurvePointViewModel(item.X, item.Y)); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |