namespace HStation.WinFrmUI { public partial class BluntheadSingleMatchingForm : DevExpress.XtraEditors.XtraUserControl { public BluntheadSingleMatchingForm() { InitializeComponent(); this.gridView3.SetNormalView(); } private HydroBluntheadMatchingViewModel _BluntheadMatchingViewModel; private BLL.AssetsBluntheadMain _BluntheadBll; private List _allBindingList; public async void SetBindingData(HydroBluntheadMatchingViewModel BluntheadMatchingViewModel) { _BluntheadMatchingViewModel = BluntheadMatchingViewModel; _allBindingList = new List(); _BluntheadBll = new BLL.AssetsBluntheadMain(); var allAssetsBluntheadMain = await _BluntheadBll.GetAll(); foreach (var Main in allAssetsBluntheadMain) { _allBindingList.Add(new BluntheadSingleMatchingViewModel(Main)); } this.BluntheadSingleMatchingViewModelBindingSource.DataSource = _allBindingList; this.BluntheadSingleMatchingViewModelBindingSource.ResetBindings(false); this.searchControl1.Text = _BluntheadMatchingViewModel.ModelType; } //选择项切换事件 private void gridView3_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e) { var vm = this.gridView3.GetCurrentViewModel(_allBindingList); if (vm != null) { _BluntheadMatchingViewModel.MatchingDbId = vm.ID.ToString(); _BluntheadMatchingViewModel.MatchingMinorLoss = vm.MinorLoss; _BluntheadMatchingViewModel.MatchingCaliber = vm.Caliber; _BluntheadMatchingViewModel.MatchingMaterial = vm.Material; _BluntheadMatchingViewModel.MatchingModelType = vm.ModelType; } } } }