duheng
2024-12-04 ca1ccd0dd9f2d6936368f07d14a2b29b309fd151
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
namespace HStation.WinFrmUI
{
    public partial class FlowmeterSingleMatchingForm : DevExpress.XtraEditors.XtraUserControl
    {
        public FlowmeterSingleMatchingForm()
        {
            InitializeComponent();
            this.gridView3.SetNormalView();
        }
 
        private HydroFlowmeterMatchingViewModel _FlowmeterMatchingViewModel;
        private BLL.AssetsFlowmeterMain _FlowmeterBll;
        private List<FlowmeterSingleMatchingViewModel> _allBindingList;
 
        public async void SetBindingData(HydroFlowmeterMatchingViewModel FlowmeterMatchingViewModel)
        {
            _FlowmeterMatchingViewModel = FlowmeterMatchingViewModel;
            _allBindingList = new List<FlowmeterSingleMatchingViewModel>();
            _FlowmeterBll = new BLL.AssetsFlowmeterMain();
            var allAssetsFlowmeterMain = await _FlowmeterBll.GetAll();
            foreach (var Main in allAssetsFlowmeterMain)
            {
                _allBindingList.Add(new FlowmeterSingleMatchingViewModel(Main));
            }
            this.FlowmeterSingleMatchingViewModelBindingSource.DataSource = _allBindingList;
            this.FlowmeterSingleMatchingViewModelBindingSource.ResetBindings(false);
            this.searchControl1.Text = _FlowmeterMatchingViewModel.ModelType;
        }
 
        //选择项切换事件
        private void gridView3_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e)
        {
            var vm = this.gridView3.GetCurrentViewModel(_allBindingList);
            if (vm != null)
            {
                _FlowmeterMatchingViewModel.MatchingDbId = vm.ID.ToString();
                _FlowmeterMatchingViewModel.MatchingMinorLoss = vm.MinorLoss;
                _FlowmeterMatchingViewModel.MatchingModelType = vm.ModelType;
            }
        }
    }
}