- Timestamp:
- 12/21/18 17:09:39 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ProjectsView.cs
r16430 r16446 56 56 57 57 private readonly object locker = new object(); 58 private bool refreshingInternal = false; 59 private bool refreshingExternal = false; 58 60 59 61 public new IItemList<Project> Content { … … 70 72 HiveAdminClient.Instance.Refreshing += HiveAdminClient_Instance_Refreshing; 71 73 HiveAdminClient.Instance.Refreshed += HiveAdminClient_Instance_Refreshed; 72 AccessClient.Instance.Refreshing += AccessClient_Instance_Refreshing;73 AccessClient.Instance.Refreshed += AccessClient_Instance_Refreshed;74 74 } 75 75 76 76 #region Overrides 77 protected override void OnClosing(FormClosingEventArgs e) {78 AccessClient.Instance.Refreshed -= AccessClient_Instance_Refreshed;79 AccessClient.Instance.Refreshing -= AccessClient_Instance_Refreshing;80 HiveAdminClient.Instance.Refreshed -= HiveAdminClient_Instance_Refreshed;81 HiveAdminClient.Instance.Refreshing -= HiveAdminClient_Instance_Refreshing;82 base.OnClosing(e);83 }84 85 77 protected override void RegisterContentEvents() { 86 78 base.RegisterContentEvents(); … … 183 175 if (InvokeRequired) Invoke((Action<object, EventArgs>)HiveAdminClient_Instance_Refreshing, sender, e); 184 176 else { 177 lock (locker) { 178 if (refreshingExternal) return; 179 if (!refreshingInternal) refreshingExternal = true; 180 } 181 185 182 Progress.Show(this, "Refreshing ...", ProgressMode.Indeterminate); 186 183 SetEnabledStateOfControls(); … … 191 188 if (InvokeRequired) Invoke((Action<object, EventArgs>)HiveAdminClient_Instance_Refreshed, sender, e); 192 189 else { 193 Progress.Hide(this); 194 SetEnabledStateOfControls(); 195 } 196 } 197 198 private void AccessClient_Instance_Refreshing(object sender, EventArgs e) { 199 if (InvokeRequired) Invoke((Action<object, EventArgs>)AccessClient_Instance_Refreshing, sender, e); 200 else { 201 Progress.Show(this, "Refreshing ...", ProgressMode.Indeterminate); 202 SetEnabledStateOfControls(); 203 } 204 } 205 206 private void AccessClient_Instance_Refreshed(object sender, EventArgs e) { 207 if (InvokeRequired) Invoke((Action<object, EventArgs>)AccessClient_Instance_Refreshed, sender, e); 208 else { 190 if (refreshingExternal) refreshingExternal = false; 191 Content = HiveAdminClient.Instance.Projects; 192 209 193 Progress.Hide(this); 210 194 SetEnabledStateOfControls(); … … 215 199 await SecurityExceptionUtil.TryAsyncAndReportSecurityExceptions( 216 200 action: () => UpdateProjects()); 201 } 202 203 private void ProjectsView_Disposed(object sender, EventArgs e) { 204 HiveAdminClient.Instance.Refreshed -= HiveAdminClient_Instance_Refreshed; 205 HiveAdminClient.Instance.Refreshing -= HiveAdminClient_Instance_Refreshing; 217 206 } 218 207 … … 515 504 516 505 private void UpdateProjects() { 506 lock (locker) { 507 if (refreshingInternal || refreshingExternal) return; 508 refreshingInternal = true; 509 } 510 517 511 try { 518 512 HiveAdminClient.Instance.Refresh(); 519 Content = HiveAdminClient.Instance.Projects;520 513 } catch (AnonymousUserException) { 521 514 ShowHiveInformationDialog(); 515 } finally { 516 refreshingInternal = false; 522 517 } 523 518 }
Note: See TracChangeset
for help on using the changeset viewer.