/// <summary> /// Handles changes in the datasource selection. /// </summary> private void OnSelChangedDataSource(Object source, EventArgs e) { if (IsLoading()) { return; } DataSourceItem newDataSource = null; if (_cmbDataSource.IsSet()) { newDataSource = (DataSourceItem)_cmbDataSource.SelectedItem; } if (newDataSource != null) { if (newDataSource.IsSelectable() == false) { using (new LoadingModeResource(this)) { if (_currentDataSource == null) { _cmbDataSource.SelectedIndex = -1; } else { _cmbDataSource.SelectedItem = _currentDataSource; } } return; } } _currentDataSource = newDataSource; if (_currentDataSource is ListSourceDataSourceItem) { ((ListSourceDataSourceItem)_currentDataSource).CurrentDataMember = null; } _dataSourceDirty = true; LoadDataMembers(); LoadDataSourceFields(); SetDirty(); UpdateEnabledVisibleState(); }
/// <include file='doc\DataGridGeneralPage.uex' path='docs/doc[@for="DataGridGeneralPage.OnSelChangedDataSource"]/*' /> /// <devdoc> /// Handles changes in the datasource selection. /// </devdoc> private void OnSelChangedDataSource(object source, EventArgs e) { if (IsLoading()) { return; } DataSourceItem newDataSource = null; if (dataSourceCombo.IsSet()) { newDataSource = (DataSourceItem)dataSourceCombo.SelectedItem; } if (newDataSource != null) { if (newDataSource.IsSelectable() == false) { EnterLoadingMode(); if (currentDataSource == null) { dataSourceCombo.SelectedIndex = -1; } else { dataSourceCombo.SelectedItem = currentDataSource; } ExitLoadingMode(); return; } } currentDataSource = newDataSource; if (currentDataSource is ListSourceDataSourceItem) { ((ListSourceDataSourceItem)currentDataSource).CurrentDataMember = null; } LoadDataMembers(); LoadDataSourceFields(); dataSourceDirty = true; SetDirty(); UpdateEnabledVisibleState(); }