Changeset 16314 for branches/2845_EnhancedProgress
- Timestamp:
- 11/21/18 15:02:52 (6 years ago)
- Location:
- branches/2845_EnhancedProgress
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2845_EnhancedProgress/HeuristicLab.Algorithms.Benchmarks/3.3/BenchmarkAlgorithm.cs
r16311 r16314 39 39 [Creatable(CreatableAttribute.Categories.TestingAndAnalysis, Priority = 130)] 40 40 [StorableClass] 41 public sealed class BenchmarkAlgorithm : IAlgorithm {41 public sealed class BenchmarkAlgorithm : IAlgorithm, IStorableContent { 42 42 private CancellationTokenSource cancellationTokenSource; 43 44 public string Filename { get; set; } 43 45 44 46 public string ItemName { -
branches/2845_EnhancedProgress/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ProjectJobsView.cs
r16312 r16314 81 81 base.RegisterContentEvents(); 82 82 matrixView.DataGridView.SelectionChanged += DataGridView_SelectionChanged; 83 MainForm Manager.GetMainForm<HeuristicLab.MainForm.WindowsForms.MainForm>().AddProgressToView(this, progress);83 MainForm.Progress.AddProgressToView(this, progress); 84 84 } 85 85 86 86 protected override void DeregisterContentEvents() { 87 87 matrixView.DataGridView.SelectionChanged -= DataGridView_SelectionChanged; 88 MainForm Manager.GetMainForm<HeuristicLab.MainForm.WindowsForms.MainForm>().RemoveProgressFromView(this, false);88 MainForm.Progress.RemoveProgressFromView(this, false); 89 89 base.DeregisterContentEvents(); 90 90 } … … 191 191 192 192 if (result == DialogResult.Yes) { 193 progress.Start ("Resuming job(s)...");193 progress.StartMarquee("Resuming job(s)..."); 194 194 SetEnabledStateOfControls(); 195 195 var task = System.Threading.Tasks.Task.Factory.StartNew(ResumeJobsAsync, jobs); -
branches/2845_EnhancedProgress/HeuristicLab.Clients.Hive.JobManager/3.3/Views/RefreshableHiveJobView.cs
r16311 r16314 75 75 Content.Loaded += new EventHandler(Content_Loaded); 76 76 Content.TaskReceived += new EventHandler(Content_TaskReceived); 77 MainFormManager.GetMainForm<HeuristicLab.MainForm.WindowsForms.MainForm>().AddProgressToView(this, Content.Progress);77 Progress.AddProgressToView(this, Content.Progress); 78 78 } 79 79 … … 90 90 Content.Loaded -= new EventHandler(Content_Loaded); 91 91 Content.TaskReceived -= new EventHandler(Content_TaskReceived); 92 MainFormManager.GetMainForm<HeuristicLab.MainForm.WindowsForms.MainForm>().RemoveProgressFromView(this, false);92 Progress.RemoveProgressFromView(this, false); 93 93 DeregisterHiveExperimentEvents(); 94 94 DeregisterHiveTasksEvents(); … … 133 133 stateLogViewHost.Content = null; 134 134 } else { 135 if (Content.Job != null136 && Content.Job.Id != Guid.Empty 135 if (Content.Job != null 136 && Content.Job.Id != Guid.Empty 137 137 && !originalJobProjectAssignment.ContainsKey(Content.Job.Id)) { 138 138 originalJobProjectAssignment.Add(Content.Job.Id, Content.Job.ProjectId); … … 159 159 projectNameTextBox.Text = HiveClient.Instance.GetProjectAncestry(Content.Job.ProjectId); 160 160 projectNameTextBox.Text += " (" + (cores.HasValue ? cores.Value.ToString() : "0") + " cores)"; 161 } 161 } 162 162 } 163 163 } else if (Content.Job != null && Content.Job.ProjectId != Guid.Empty) { … … 167 167 } 168 168 169 if (hiveResourceSelectorDialog == null)169 if (hiveResourceSelectorDialog == null) 170 170 hiveResourceSelectorDialog = new HiveResourceSelectorDialog(Content.Job.Id, Content.Job.ProjectId); 171 171 … … 203 203 executionTimeTextBox.Text = Content.ExecutionTime.ToString(); 204 204 refreshAutomaticallyCheckBox.Checked = Content.RefreshAutomatically; 205 205 206 206 logView.Content = Content.Log; 207 207 lock (runCollectionViewLocker) { … … 408 408 if (hiveResourceSelectorDialog == null) { 409 409 hiveResourceSelectorDialog = new HiveResourceSelectorDialog(Content.Job.Id, Content.Job.ProjectId); 410 } else if (hiveResourceSelectorDialog.JobId != Content.Job.Id) {410 } else if (hiveResourceSelectorDialog.JobId != Content.Job.Id) { 411 411 hiveResourceSelectorDialog.JobId = Content.Job.Id; 412 412 hiveResourceSelectorDialog.SelectedProjectId = Content.Job.ProjectId; … … 418 418 hiveResourceSelectorDialog.ProjectId = Guid.Empty; 419 419 } 420 } else if (hiveResourceSelectorDialog.JobId == Guid.Empty && Content.Job.Id == Guid.Empty) {420 } else if (hiveResourceSelectorDialog.JobId == Guid.Empty && Content.Job.Id == Guid.Empty) { 421 421 hiveResourceSelectorDialog.JobId = Content.Job.Id; 422 422 hiveResourceSelectorDialog.ProjectId = Guid.Empty; … … 430 430 if (hiveResourceSelectorDialog.ShowDialog(this) == DialogResult.OK) { 431 431 selectedProject = hiveResourceSelectorDialog.SelectedProject; 432 if (selectedProject != null) {432 if (selectedProject != null) { 433 433 Content.Job.ProjectId = selectedProject.Id; 434 434 Content.Job.ResourceIds = hiveResourceSelectorDialog.SelectedResources.Select(x => x.Id).ToList(); … … 582 582 startButton.Enabled = pauseButton.Enabled = stopButton.Enabled = false; 583 583 } else { 584 startButton.Enabled = Content.IsControllable && Content.HiveTasks != null && Content.HiveTasks.Count > 0 585 && Content.Job.ProjectId != Guid.Empty && Content.Job.ResourceIds != null && Content.Job.ResourceIds.Any()584 startButton.Enabled = Content.IsControllable && Content.HiveTasks != null && Content.HiveTasks.Count > 0 585 && Content.Job.ProjectId != Guid.Empty && Content.Job.ResourceIds != null && Content.Job.ResourceIds.Any() 586 586 && (Content.ExecutionState == ExecutionState.Prepared || Content.ExecutionState == ExecutionState.Paused) && !Content.IsProgressing; 587 587 pauseButton.Enabled = Content.IsControllable && Content.ExecutionState == ExecutionState.Started && !Content.IsProgressing; … … 589 589 } 590 590 } 591 591 592 592 private Project GetProject(Guid projectId) { 593 593 return HiveServiceLocator.Instance.CallHiveService(s => s.GetProject(projectId)); … … 595 595 596 596 private void UpdateSelectorDialog() { 597 if (hiveResourceSelectorDialog != null) {597 if (hiveResourceSelectorDialog != null) { 598 598 hiveResourceSelectorDialog = null; 599 599 //hiveResourceSelectorDialog.JobId = Content.Job.Id; -
branches/2845_EnhancedProgress/HeuristicLab.Clients.Hive.Views/3.3/HiveTasks/OptimizerHiveTaskView.cs
r16311 r16314 58 58 base.RegisterContentEvents(); 59 59 Content.IsControllableChanged += new EventHandler(Content_IsControllableChanged); 60 MainFormManager.GetMainForm<HeuristicLab.MainForm.WindowsForms.MainForm>().AddProgressToView(this, Content.Progress);60 Progress.AddProgressToView(this, Content.Progress); 61 61 } 62 62 63 63 protected override void DeregisterContentEvents() { 64 64 Content.IsControllableChanged -= new EventHandler(Content_IsControllableChanged); 65 MainFormManager.GetMainForm<HeuristicLab.MainForm.WindowsForms.MainForm>().RemoveProgressFromView(this, false);65 Progress.RemoveProgressFromView(this, false); 66 66 base.DeregisterContentEvents(); 67 67 } -
branches/2845_EnhancedProgress/HeuristicLab.MainForm.WindowsForms/3.3/MainForms/MainForm.cs
r16311 r16314 353 353 /// Adds a <see cref="ProgressView"/> to the <see cref="ContentView"/>s showing the specified content. 354 354 /// </summary> 355 publicvoid AddProgressToContent(IContent content, IProgress progress, bool addToObjectGraphObjects = true) {355 internal void AddProgressToContent(IContent content, IProgress progress, bool addToObjectGraphObjects = true) { 356 356 if (InvokeRequired) { 357 357 Invoke((Action<IContent, IProgress, bool>)AddProgressToContent, content, progress, addToObjectGraphObjects); … … 381 381 /// Adds a <see cref="ProgressView"/> to the specified view. 382 382 /// </summary> 383 publicvoid AddProgressToView(Control control, IProgress progress) {383 internal void AddProgressToView(Control control, IProgress progress) { 384 384 if (InvokeRequired) { 385 385 Invoke((Action<Control, IProgress>)AddProgressToView, control, progress); … … 405 405 /// Removes an existing <see cref="ProgressView"/> from the <see cref="ContentView"/>s showing the specified content. 406 406 /// </summary> 407 publicvoid RemoveProgressFromContent(IContent content, bool finishProgress = true) {407 internal void RemoveProgressFromContent(IContent content, bool finishProgress = true) { 408 408 if (InvokeRequired) { 409 409 Invoke((Action<IContent, bool>)RemoveProgressFromContent, content, finishProgress); … … 426 426 /// Removes an existing <see cref="ProgressView"/> from the specified view. 427 427 /// </summary> 428 publicvoid RemoveProgressFromView(Control control, bool finishProgress = true) {428 internal void RemoveProgressFromView(Control control, bool finishProgress = true) { 429 429 if (InvokeRequired) { 430 430 Invoke((Action<Control, bool>)RemoveProgressFromView, control, finishProgress); -
branches/2845_EnhancedProgress/HeuristicLab.MainForm.WindowsForms/3.3/Progress.cs
r16311 r16314 140 140 var progress = new Progress(); 141 141 progress.Start(progressMessage, initialProgressValue); 142 AddProgressToContent(content, progress, addToObjectGraphObjects); 143 return progress; 144 } 145 /// <summary> 146 /// Shows a started Progress in Marquee-mode on all Views of the specified content. 147 /// </summary> 148 public static IProgress ShowMarquee(IContent content, string progressMessage, bool addToObjectGraphObjects = true) { 149 var progress = new Progress(); 150 progress.StartMarquee(progressMessage); 151 AddProgressToContent(content, progress, addToObjectGraphObjects); 152 return progress; 153 } 154 155 /// <summary> 156 /// Shows a started Progress in Continuous-mode on the specified view. 157 /// </summary> 158 public static IProgress Show(Control control, string progressMessage, double initialProgressValue = 0) { 159 var progress = new Progress(); 160 progress.Start(progressMessage, initialProgressValue); 161 AddProgressToView(control, progress); 162 return progress; 163 } 164 /// <summary> 165 /// Shows a started Progress in Marquee-mode on the specified view. 166 /// </summary> 167 public static IProgress ShowMarquee(Control control, string progressMessage) { 168 var progress = new Progress(); 169 progress.StartMarquee(progressMessage); 170 AddProgressToView(control, progress); 171 return progress; 172 } 173 174 /// <summary> 175 /// Hides the Progress from all Views of the specified content. 176 /// </summary> 177 public static void Hide(IContent content) { 178 RemoveProgressFromContent(content); 179 } 180 /// <summary> 181 /// Hides the Progress from the specified view. 182 /// </summary> 183 public static void Hide(Control control) { 184 RemoveProgressFromView(control); 185 } 186 #endregion 187 188 #region Interface to from MainForm 189 public static IProgress AddProgressToContent(IContent content, IProgress progress, bool addToObjectGraphObjects = true) { 142 190 MainFormManager.GetMainForm<WindowsForms.MainForm>().AddProgressToContent(content, progress, addToObjectGraphObjects); 143 191 return progress; 144 192 } 145 /// <summary> 146 /// Shows a started Progress in Marquee-mode on all Views of the specified content. 147 /// </summary> 148 public static IProgress ShowMarquee(IContent content, string progressMessage, bool addToObjectGraphObjects = true) { 149 var progress = new Progress(); 150 progress.StartMarquee(progressMessage); 151 MainFormManager.GetMainForm<WindowsForms.MainForm>().AddProgressToContent(content, progress, addToObjectGraphObjects); 152 return progress; 153 } 154 155 /// <summary> 156 /// Shows a started Progress in Continuous-mode on the specified view. 157 /// </summary> 158 public static IProgress Show(Control control, string progressMessage, double initialProgressValue = 0) { 159 var progress = new Progress(); 160 progress.Start(progressMessage, initialProgressValue); 193 public static IProgress AddProgressToView(Control control, IProgress progress) { 161 194 MainFormManager.GetMainForm<WindowsForms.MainForm>().AddProgressToView(control, progress); 162 195 return progress; 163 196 } 164 /// <summary> 165 /// Shows a started Progress in Marquee-mode on the specified view. 166 /// </summary> 167 public static IProgress ShowMarquee(Control control, string progressMessage) { 168 var progress = new Progress(); 169 progress.StartMarquee(progressMessage); 170 MainFormManager.GetMainForm<WindowsForms.MainForm>().AddProgressToView(control, progress); 171 return progress; 172 } 173 174 /// <summary> 175 /// Hides the Progress fom all Views of the specified content. 176 /// </summary> 177 public static void Hide(IContent content) { 178 MainFormManager.GetMainForm<WindowsForms.MainForm>().RemoveProgressFromContent(content); 179 } 180 /// <summary> 181 /// Hides the Progress fom the specified view. 182 /// </summary> 183 public static void Hide(Control control) { 184 MainFormManager.GetMainForm<WindowsForms.MainForm>().RemoveProgressFromView(control); 197 198 public static void RemoveProgressFromContent(IContent content, bool finishProgress = true) { 199 MainFormManager.GetMainForm<WindowsForms.MainForm>().RemoveProgressFromContent(content, finishProgress); 200 } 201 public static void RemoveProgressFromView(Control control, bool finishProgress = true) { 202 MainFormManager.GetMainForm<WindowsForms.MainForm>().RemoveProgressFromView(control, finishProgress); 185 203 } 186 204 #endregion -
branches/2845_EnhancedProgress/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/InteractiveSymbolicDataAnalysisSolutionSimplifierView.cs
r16311 r16314 154 154 Content.ProblemDataChanged += Content_Changed; 155 155 treeChart.Repainted += treeChart_Repainted; 156 MainFormManager.GetMainForm<MainForm.WindowsForms.MainForm>().AddProgressToView(grpSimplify, progress);156 Progress.AddProgressToView(grpSimplify, progress); 157 157 progress.StopRequested += progress_StopRequested; 158 158 } … … 162 162 Content.ProblemDataChanged -= Content_Changed; 163 163 treeChart.Repainted -= treeChart_Repainted; 164 MainFormManager.GetMainForm<MainForm.WindowsForms.MainForm>().RemoveProgressFromView(grpSimplify, false);164 Progress.RemoveProgressFromView(grpSimplify, false); 165 165 progress.StopRequested -= progress_StopRequested; 166 166 }
Note: See TracChangeset
for help on using the changeset viewer.