Changeset 9933 for stable/HeuristicLab.Clients.Hive.JobManager
- Timestamp:
- 09/03/13 15:55:36 (11 years ago)
- Location:
- stable
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
stable
- Property svn:mergeinfo changed
/trunk/sources merged: 9849,9851,9865,9867-9868,9893-9896,9900-9901,9905,9907
- Property svn:mergeinfo changed
-
stable/HeuristicLab.Clients.Hive.JobManager/3.3/Views/HiveResourceSelector.cs
r9456 r9933 42 42 private ISet<TreeNode> filteredTreeNodes; 43 43 private ISet<TreeNode> nodeStore; 44 private Progress progress; 45 private ProgressView progressView; 46 44 47 45 private ISet<Resource> selectedResources; 48 46 public ISet<Resource> SelectedResources { … … 64 62 imageList.Images.Add(HeuristicLab.Common.Resources.VSImageLibrary.MonitorLarge); 65 63 imageList.Images.Add(HeuristicLab.Common.Resources.VSImageLibrary.NetworkCenterLarge); 66 progress = new Progress() { 67 CanBeCanceled = false, 68 ProgressState = ProgressState.Finished 69 }; 70 } 71 72 protected override void DeregisterContentEvents() { 73 if (progressView != null) { 74 progressView.Content = null; 75 progressView.Dispose(); 76 progressView = null; 77 } 78 base.DeregisterContentEvents(); 79 } 80 81 protected override void RegisterContentEvents() { 82 base.RegisterContentEvents(); 83 progressView = new ProgressView(this, progress); 84 } 85 64 } 65 86 66 public void StartProgressView() { 87 67 if (InvokeRequired) { 88 68 Invoke(new Action(StartProgressView)); 89 69 } else { 90 progress.Status= "Downloading resources. Please be patient.";91 progress.ProgressState = ProgressState.Started;70 var message = "Downloading resources. Please be patient."; 71 MainFormManager.GetMainForm<HeuristicLab.MainForm.WindowsForms.MainForm>().AddOperationProgressToView(this, message); 92 72 } 93 73 } … … 97 77 Invoke(new Action(FinishProgressView)); 98 78 } else { 99 progress.Finish();79 MainFormManager.GetMainForm<HeuristicLab.MainForm.WindowsForms.MainForm>().RemoveOperationProgressFromView(this); 100 80 } 101 81 } -
stable/HeuristicLab.Clients.Hive.JobManager/3.3/Views/RefreshableHiveJobListView.cs
r9559 r9933 34 34 [Content(typeof(ItemCollection<RefreshableJob>), false)] 35 35 public partial class RefreshableHiveJobListView : HeuristicLab.Core.Views.ItemCollectionView<RefreshableJob> { 36 private Progress progress;37 private ProgressView progressView;38 39 36 public RefreshableHiveJobListView() { 40 37 InitializeComponent(); … … 49 46 50 47 this.itemsListView.ListViewItemSorter = new ListViewItemDateComparer(0, SortOrder.Ascending); 51 52 progress = new Progress() {53 CanBeCanceled = false,54 ProgressState = ProgressState.Finished55 };56 progressView = new ProgressView(this, progress);57 48 } 58 49 … … 118 109 119 110 task.ContinueWith((t) => { 120 progress.Finish();111 MainFormManager.GetMainForm<HeuristicLab.MainForm.WindowsForms.MainForm>().RemoveOperationProgressFromView(this); 121 112 ErrorHandling.ShowErrorDialog("An error occured while deleting the job. ", t.Exception); 122 113 }, TaskContinuationOptions.OnlyOnFaulted); … … 129 120 130 121 private void DeleteHiveJobsAsync(object items) { 131 progress.Status = "Deleting job..."; 132 progress.ProgressState = ProgressState.Started; 133 progress.ProgressValue = 0.0; 122 MainFormManager.GetMainForm<HeuristicLab.MainForm.WindowsForms.MainForm>().AddOperationProgressToView(this, "Deleting job..."); 134 123 foreach (RefreshableJob item in (List<RefreshableJob>)items) { 135 124 Content.Remove(item); 136 125 } 137 progress.Finish();126 MainFormManager.GetMainForm<HeuristicLab.MainForm.WindowsForms.MainForm>().RemoveOperationProgressFromView(this); 138 127 } 139 128 … … 227 216 if (disposing) { 228 217 if (components != null) components.Dispose(); 229 progressView.Content = null;230 progressView.Dispose();231 218 } 232 219 base.Dispose(disposing); -
stable/HeuristicLab.Clients.Hive.JobManager/3.3/Views/RefreshableHiveJobView.cs
r9722 r9933 42 42 [Content(typeof(RefreshableJob), true)] 43 43 public partial class RefreshableHiveJobView : HeuristicLab.Core.Views.ItemView { 44 private Progress progress;45 private ProgressView progressView;46 44 private HiveResourceSelectorDialog hiveResourceSelectorDialog; 47 45 private bool SuppressEvents { get; set; } … … 58 56 public RefreshableHiveJobView() { 59 57 InitializeComponent(); 60 progress = new Progress() {61 CanBeCanceled = false,62 ProgressState = ProgressState.Finished63 };64 58 } 65 59 … … 72 66 Content.ExceptionOccured += new EventHandler<EventArgs<Exception>>(Content_ExceptionOccured); 73 67 Content.StateLogListChanged += new EventHandler(Content_StateLogListChanged); 74 Content.IsProgressingChanged += new EventHandler(Content_IsProgressingChanged);75 68 Content.HiveTasksChanged += new EventHandler(Content_HiveTasksChanged); 76 69 Content.ExecutionStateChanged += new EventHandler(Content_ExecutionStateChanged); … … 78 71 Content.Loaded += new EventHandler(Content_Loaded); 79 72 Content.TaskReceived += new EventHandler(Content_TaskReceived); 80 progressView = new ProgressView(this, progress);73 MainFormManager.GetMainForm<HeuristicLab.MainForm.WindowsForms.MainForm>().AddOperationProgressToView(this, Content.Progress); 81 74 } 82 75 … … 88 81 Content.ExceptionOccured -= new EventHandler<EventArgs<Exception>>(Content_ExceptionOccured); 89 82 Content.StateLogListChanged -= new EventHandler(Content_StateLogListChanged); 90 Content.IsProgressingChanged -= new EventHandler(Content_IsProgressingChanged);91 83 Content.HiveTasksChanged -= new EventHandler(Content_HiveTasksChanged); 92 84 Content.ExecutionStateChanged -= new EventHandler(Content_ExecutionStateChanged); … … 94 86 Content.Loaded -= new EventHandler(Content_Loaded); 95 87 Content.TaskReceived -= new EventHandler(Content_TaskReceived); 96 if (progressView != null) { 97 progressView.Content = null; 98 progressView.Dispose(); 99 progressView = null; 100 } 88 MainFormManager.GetMainForm<HeuristicLab.MainForm.WindowsForms.MainForm>().RemoveOperationProgressFromView(this, false); 101 89 DeregisterHiveExperimentEvents(); 102 90 DeregisterHiveTasksEvents(); … … 159 147 Content_HiveExperimentChanged(this, EventArgs.Empty); 160 148 Content_HiveTasksChanged(this, EventArgs.Empty); 161 Content_IsProgressingChanged(this, EventArgs.Empty);162 149 Content_StateLogListChanged(this, EventArgs.Empty); 163 150 HiveExperiment_PropertyChanged(this, new PropertyChangedEventArgs("Id")); … … 260 247 SetEnabledStateOfControls(); 261 248 } 262 private void Content_Prepared(object sender, EventArgs e) { 263 if (InvokeRequired) 264 Invoke(new EventHandler(Content_Prepared), sender, e); 265 else { 266 nameTextBox.Enabled = true; 267 Locked = false; 268 SetEnabledStateOfControls(); 269 } 270 } 271 private void Content_Started(object sender, EventArgs e) { 272 if (InvokeRequired) 273 Invoke(new EventHandler(Content_Started), sender, e); 274 else { 275 nameTextBox.Enabled = false; 276 SetEnabledStateOfControls(); 277 } 278 } 279 private void Content_Paused(object sender, EventArgs e) { 280 if (InvokeRequired) 281 Invoke(new EventHandler(Content_Paused), sender, e); 282 else { 283 nameTextBox.Enabled = true; 284 SetEnabledStateOfControls(); 285 } 286 } 287 private void Content_Stopped(object sender, EventArgs e) { 288 if (InvokeRequired) 289 Invoke(new EventHandler(Content_Stopped), sender, e); 290 else { 291 nameTextBox.Enabled = true; 292 Locked = false; 293 SetEnabledStateOfControls(); 294 } 295 } 249 296 250 private void Content_ExecutionTimeChanged(object sender, EventArgs e) { 297 251 if (InvokeRequired) … … 336 290 if (Content != null && Content.Job != null) { 337 291 RegisterHiveExperimentEvents(); 338 Content_IsProgressingChanged(sender, e);339 292 } 340 293 } … … 410 363 var task = System.Threading.Tasks.Task.Factory.StartNew(ResumeJobAsync, Content); 411 364 task.ContinueWith((t) => { 412 progress.Finish();365 Content.Progress.Finish(); 413 366 MessageBox.Show("An error occured resuming the job. See the log for more information.", "HeuristicLab Hive Job Manager", MessageBoxButtons.OK, MessageBoxIcon.Error); 414 367 Content.Log.LogException(t.Exception); … … 422 375 var task = System.Threading.Tasks.Task.Factory.StartNew(PauseJobAsync, Content); 423 376 task.ContinueWith((t) => { 424 progress.Finish();377 Content.Progress.Finish(); 425 378 MessageBox.Show("An error occured pausing the job. See the log for more information.", "HeuristicLab Hive Job Manager", MessageBoxButtons.OK, MessageBoxIcon.Error); 426 379 Content.Log.LogException(t.Exception); … … 431 384 var task = System.Threading.Tasks.Task.Factory.StartNew(StopJobAsync, Content); 432 385 task.ContinueWith((t) => { 433 progress.Finish();386 Content.Progress.Finish(); 434 387 MessageBox.Show("An error occured stopping the job. See the log for more information.", "HeuristicLab Hive Job Manager", MessageBoxButtons.OK, MessageBoxIcon.Error); 435 388 Content.Log.LogException(t.Exception); … … 439 392 440 393 private void PauseJobAsync(object job) { 441 progress.Status = "Pausing job..."; 442 progress.ProgressState = ProgressState.Started; 394 Content.Progress.Start("Pausing job..."); 443 395 HiveClient.PauseJob((RefreshableJob)job); 444 progress.Finish();396 Content.Progress.Finish(); 445 397 } 446 398 447 399 private void StopJobAsync(object job) { 448 progress.Status = "Stopping job..."; 449 progress.ProgressState = ProgressState.Started; 400 Content.Progress.Start("Stopping job..."); 450 401 HiveClient.StopJob((RefreshableJob)job); 451 progress.Finish();402 Content.Progress.Finish(); 452 403 } 453 404 454 405 private void ResumeJobAsync(object job) { 455 progress.Status = "Resuming job..."; 456 progress.ProgressState = ProgressState.Started; 406 Content.Progress.Start("Resuming job..."); 457 407 HiveClient.ResumeJob((RefreshableJob)job); 458 progress.Finish();408 Content.Progress.Finish(); 459 409 } 460 410 … … 507 457 stopButton.Enabled = Content.IsControllable && Content.ExecutionState == ExecutionState.Started && !Content.IsProgressing; 508 458 resetButton.Enabled = false; 509 }510 }511 #endregion512 513 #region Progress reporting514 private void Content_IsProgressingChanged(object sender, EventArgs e) {515 if (this.InvokeRequired) {516 Invoke(new EventHandler(Content_IsProgressingChanged), sender, e);517 } else {518 if (Content != null && Content.Progress != null && Content.IsProgressing) {519 progressView.Content = Content.Progress;520 } else if (Content != null) {521 progressView.Content = progress;522 }523 459 } 524 460 }
Note: See TracChangeset
for help on using the changeset viewer.