private void OnSelectedProfileChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e) { if(_loading) return; if(_selectedProfileControl!= null) _selectedProfileControl.SaveData(); _selectedProfileControl = gridViewProfiles.GetFocusedRow() as ProfileControl; LoadActiveProfile(); }
public void AddProfile() { using (var form = new FormEditProfile(true)) { if (form.ShowDialog(FormMain.Instance) != DialogResult.OK) return; var newProfileModel = new LinkConfigProfileModel(); newProfileModel.name = form.ProfileName; newProfileModel.order = _profileModels.Any() ? _profileModels.Max(pm => pm.order) + 1 : 0; _profileModels.Add(newProfileModel); var newProfileControl = new ProfileControl(newProfileModel); _profileControls.Add(newProfileControl); newProfileControl.SaveData(); RefreshGrid(); gridViewProfiles.FocusedRowHandle = _profileControls.IndexOf(newProfileControl); } }
private void ApplyData() { foreach (var profileModel in _profileModels) { var profileControl = new ProfileControl(profileModel); _profileControls.Add(profileControl); } RefreshGrid(); _selectedProfileControl = gridViewProfiles.GetFocusedRow() as ProfileControl; LoadActiveProfile(); }