| | |
| | | this.gridView2.SetNormalView(); |
| | | } |
| | | |
| | | public class PhartViewModel |
| | | { |
| | | public long ID { get; set; } |
| | | public string OtherName { get; set; } |
| | | public int Importance { get; set; } |
| | | public int SortCode { get; set; } |
| | | } |
| | | |
| | | |
| | | private List<PumpSingleMatchingViewModel> _allBindingList = null; |
| | | |
| | | private BLL.AssetsPumpMain _pumpBll = null; |
| | |
| | | _allBindingList.Add(new PumpSingleMatchingViewModel(Main)); |
| | | } |
| | | this.gridControl2.DataSource = _allBindingList; |
| | | this.searchControl1.Text = pumpMatchingViewModel.ModelType; |
| | | // this.searchControl1.Text = pumpMatchingViewModel.ModelType; |
| | | for (int i = 0; i < _allBindingList.Count; i++) |
| | | { |
| | | if (long.TryParse(pumpMatchingViewModel.DbId, out long dbID)) |
| | | { |
| | | if (_allBindingList[i].ID == dbID) |
| | | { |
| | | // 设置第i行为当前聚焦行 |
| | | gridView2.FocusedRowHandle = i; |
| | | |
| | | /* // 假设你想让第二列(索引从0开始)成为聚焦列 |
| | | int columnIndexToFocus = 1; |
| | | gridView2.FocusedColumn = gridView1.Columns[columnIndexToFocus]; |
| | | |
| | | // 如果你知道列名而不是索引,也可以通过名字来查找列 |
| | | // gridView1.FocusedColumn = gridView1.Columns["YourColumnName"];*/ |
| | | } |
| | | } |
| | | } |
| | |
| | | //泵型号列表选择项切换事件 |
| | | private async void gridView2_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e) |
| | | { |
| | | _allPhartList = new List<PhartViewModel>(); |
| | | var vm = this.gridView2.GetCurrentViewModel(_allBindingList); |
| | | if (vm != null) |
| | | { |
| | |
| | | _pumpMatchingViewModel.MatchingRatedP = vm.RatedPower; |
| | | _pumpMatchingViewModel.MatchingRatedQ = vm.RatedFlow; |
| | | var list = await _bll_ex.Value.GetByPumpMainID(vm.ID); |
| | | _allPhartList = new List<PhartViewModel>(); |
| | | if (list != null && list.Any()) |
| | | { |
| | | foreach (var item in list) |
| | |
| | | } |
| | | } |
| | | } |
| | | if (_pumpMatchingViewModel.MatchingCurveDbId != null) |
| | | this.phartViewModelBindingSource.DataSource = _allPhartList; |
| | | if (_pumpMatchingViewModel.CurveDbId != null) |
| | | { |
| | | for (int i = 0; i < _allPhartList.Count; i++) |
| | | { |
| | | if (_allBindingList[i].ID.ToString() == _pumpMatchingViewModel.MatchingCurveDbId) |
| | | if (_allPhartList[i].ID.ToString() == _pumpMatchingViewModel.CurveDbId) |
| | | { |
| | | gridView1.FocusedRowHandle = i; |
| | | } |
| | | } |
| | | } |
| | | this.gridControl1.DataSource = _allPhartList; |
| | | this.phartViewModelBindingSource.ResetBindings(false); |
| | | } |
| | | |
| | | //曲线列表选择项切换事件 |