private void SaveButton_Click(object sender, EventArgs e) { // stop the flow of events this.rolesBindingSource.RaiseListChangedEvents = false; // commit edits in memory and unbind UnbindBindingSource(this.rolesBindingSource, true, true); try { _roles = _roles.Save(); RoleList.InvalidateCache(); RoleList.CacheList(); this.Close(); } catch (Csla.DataPortalException ex) { MessageBox.Show(ex.BusinessException.ToString(), "Error saving", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } catch (Exception ex) { MessageBox.Show(ex.ToString(), "Error saving", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } finally { this.rolesBindingSource.DataSource = _roles; this.rolesBindingSource.RaiseListChangedEvents = true; this.rolesBindingSource.ResetBindings(false); } }
private void RefreshButton_Click(object sender, EventArgs e) { if (CanRefresh()) { using (StatusBusy busy = new StatusBusy("Refreshing...")) { if (RebindUI(false, false)) { Project = ProjectTracker.Library.ProjectEdit.GetProject(Project.Id); RoleList.InvalidateCache(); RoleList.CacheList(); Setup(); } } } }