- Timestamp:
- 07/26/18 17:05:16 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/HeuristicLab.Clients.OKB.Views/3.3/RunCreation/CreateFromExperimentMenuItem.cs
r15583 r16024 22 22 using System; 23 23 using System.Collections.Generic; 24 using System.Threading.Tasks; 24 25 using HeuristicLab.Core; 25 26 using HeuristicLab.MainForm; … … 41 42 protected override void OnActiveViewChanged(object sender, EventArgs e) { 42 43 IContentView activeView = MainFormManager.MainForm.ActiveView as IContentView; 43 ToolStripItem.Enabled = (activeView != null) && (activeView.Content != null) && ((activeView.Content is Experiment) || (activeView.Content is RunCollection) || (activeView.Content is IOptimizer)) && !activeView.Locked && OKBRoles.CheckUserPermissions(); 44 45 //The ToolStripItem is Disabled by default. 46 //If any of the following conditions apply, a Check for the user privilege can be omitted. 47 ToolStripItem.Enabled = false; 48 if (activeView == null) { return; } 49 if (activeView.Content == null) { return; } 50 if (!((activeView.Content is Experiment) 51 || (activeView.Content is RunCollection) 52 || (activeView.Content is IOptimizer))) { return; } 53 if (activeView.Locked) { return; } 54 55 //Check if the user has the required OKB permissions. 56 //In case of an server outage, a timeout may occur and the call takes a long time. 57 //To prevent a possible UI-freeze, the permission-check is implemented as async. 58 CheckPrivilege(); 59 } 60 61 private async void CheckPrivilege() { 62 await Task.Run(() => { 63 IContentView activeView = MainFormManager.MainForm.ActiveView as IContentView; 64 ToolStripItem.Enabled = true;//OKBRoles.CheckUserPermissions(); 65 }); 44 66 } 45 67
Note: See TracChangeset
for help on using the changeset viewer.