- Timestamp:
- 04/15/16 09:37:26 (9 years ago)
- Location:
- branches/PerformanceComparison/HeuristicLab.OptimizationExpertSystem/3.3
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/PerformanceComparison/HeuristicLab.OptimizationExpertSystem/3.3/Menu/0_Config/30_DownloadFromOkbMenuItem.cs
r13748 r13767 56 56 protected override void OnToolStripItemSet(EventArgs e) { 57 57 base.OnToolStripItemSet(e); 58 ToolStripItem.Enabled = MainForm.ExpertSystem.Problem.ProblemId != -1;58 SetToolStripItemEnabled(MainForm.ExpertSystem.Problem.ProblemId != -1); 59 59 MainForm.ExpertSystem.Problem.ProblemChanged += OnProblemChanged; 60 60 MainForm.ExpertSystem.DownloadStarted += OnDownloadStarted; … … 62 62 63 63 private void OnProblemChanged(object sender, EventArgs e) { 64 ToolStripItem.Enabled = MainForm.ExpertSystem.Problem.ProblemId != -1;64 SetToolStripItemEnabled(MainForm.ExpertSystem.Problem.ProblemId != -1); 65 65 } 66 66 67 67 private void OnDownloadStarted(object sender, EventArgs<IProgress> e) { 68 ToolStripItem.Enabled = false;68 SetToolStripItemEnabled(false); 69 69 e.Value.ProgressStateChanged += DownloadProgressOnStateChanged; 70 70 } … … 73 73 var progress = (IProgress)sender; 74 74 if (progress.ProgressState == ProgressState.Finished || progress.ProgressState == ProgressState.Canceled) { 75 ToolStripItem.Enabled = true;75 SetToolStripItemEnabled(true); 76 76 progress.ProgressStateChanged -= DownloadProgressOnStateChanged; 77 77 } 78 78 } 79 80 private void SetToolStripItemEnabled(bool state) { 81 if (ToolStripItem.Owner != null && ToolStripItem.Owner.InvokeRequired) { ToolStripItem.Owner.Invoke((Action<bool>)SetToolStripItemEnabled, state); return; } 82 ToolStripItem.Enabled = state; 83 } 79 84 } 80 85 } -
branches/PerformanceComparison/HeuristicLab.OptimizationExpertSystem/3.3/Toolbar/DownloadFromOKBToolbarItem.cs
r13748 r13767 50 50 protected override void OnToolStripItemSet(EventArgs e) { 51 51 base.OnToolStripItemSet(e); 52 ToolStripItem.Enabled = MainForm.ExpertSystem.Problem.ProblemId != -1;52 SetToolStripItemEnabled(MainForm.ExpertSystem.Problem.ProblemId != -1); 53 53 MainForm.ExpertSystem.Problem.ProblemChanged += OnProblemChanged; 54 54 MainForm.ExpertSystem.DownloadStarted += OnDownloadStarted; … … 56 56 57 57 private void OnProblemChanged(object sender, EventArgs e) { 58 ToolStripItem.Enabled = MainForm.ExpertSystem.Problem.ProblemId != -1;58 SetToolStripItemEnabled(MainForm.ExpertSystem.Problem.ProblemId != -1); 59 59 } 60 60 61 61 private void OnDownloadStarted(object sender, EventArgs<IProgress> e) { 62 ToolStripItem.Enabled = false;62 SetToolStripItemEnabled(false); 63 63 e.Value.ProgressStateChanged += DownloadProgressOnStateChanged; 64 64 } … … 67 67 var progress = (IProgress)sender; 68 68 if (progress.ProgressState == ProgressState.Finished || progress.ProgressState == ProgressState.Canceled) { 69 ToolStripItem.Enabled = true;69 SetToolStripItemEnabled(true); 70 70 progress.ProgressStateChanged -= DownloadProgressOnStateChanged; 71 71 } 72 72 } 73 74 private void SetToolStripItemEnabled(bool state) { 75 if (ToolStripItem.Owner != null && ToolStripItem.Owner.InvokeRequired) { ToolStripItem.Owner.Invoke((Action<bool>)SetToolStripItemEnabled, state); return; } 76 ToolStripItem.Enabled = state; 77 } 73 78 } 74 79 }
Note: See TracChangeset
for help on using the changeset viewer.