Changeset 8165 for trunk/sources/HeuristicLab.Clients.Hive.JobManager
- Timestamp:
- 06/29/12 23:12:32 (12 years ago)
- Location:
- trunk/sources/HeuristicLab.Clients.Hive.JobManager/3.3/Views
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Clients.Hive.JobManager/3.3/Views/HiveResourceSelector.cs
r8160 r8165 42 42 private ISet<TreeNode> filteredTreeNodes; 43 43 private ISet<TreeNode> nodeStore; 44 private IProgress currentProgress; 44 private Progress progress; 45 private ProgressView progressView; 45 46 46 47 private ISet<Resource> selectedResources; … … 48 49 get { return selectedResources; } 49 50 set { selectedResources = value; } 50 }51 52 private ProgressView progressView;53 public ProgressView ProgressView {54 get { return progressView; }55 set { progressView = value; }56 51 } 57 52 … … 69 64 imageList.Images.Add(HeuristicLab.Common.Resources.VSImageLibrary.MonitorLarge); 70 65 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); 71 84 } 72 85 … … 75 88 Invoke(new Action(StartProgressView)); 76 89 } else { 77 currentProgress = new Progress(); 78 currentProgress.Status = "Downloading resources. Please be patient."; 79 if (progressView == null) { 80 progressView = new ProgressView(this); 81 } 82 progressView.Progress = currentProgress; 90 progress.Status = "Downloading resources. Please be patient."; 91 progress.ProgressState = ProgressState.Started; 83 92 } 84 93 } … … 88 97 Invoke(new Action(FinishProgressView)); 89 98 } else { 90 currentProgress.Finish();99 progress.Finish(); 91 100 } 92 101 } -
trunk/sources/HeuristicLab.Clients.Hive.JobManager/3.3/Views/HiveResourceSelectorDialog.Designer.cs
r7967 r8165 73 73 this.hiveResourceSelector.Location = new System.Drawing.Point(12, 12); 74 74 this.hiveResourceSelector.Name = "hiveResourceSelector"; 75 this.hiveResourceSelector.ProgressView = null;76 75 this.hiveResourceSelector.ReadOnly = false; 77 76 this.hiveResourceSelector.Size = new System.Drawing.Size(549, 591); -
trunk/sources/HeuristicLab.Clients.Hive.JobManager/3.3/Views/RefreshableHiveJobView.cs
r8160 r8165 42 42 [Content(typeof(RefreshableJob), true)] 43 43 public partial class RefreshableHiveJobView : HeuristicLab.Core.Views.ItemView { 44 private Progress progress; 44 45 private ProgressView progressView; 45 46 private HiveResourceSelectorDialog hiveResourceSelectorDialog; … … 55 56 public RefreshableHiveJobView() { 56 57 InitializeComponent(); 57 progressView = new ProgressView(this); 58 progress = new Progress() { 59 CanBeCanceled = true, 60 ProgressState = ProgressState.Finished 61 }; 58 62 } 59 63 … … 73 77 Content.Loaded += new EventHandler(Content_Loaded); 74 78 Content.TaskReceived += new EventHandler(Content_TaskReceived); 79 progressView = new ProgressView(this, progress); 75 80 } 76 81 … … 88 93 Content.Loaded -= new EventHandler(Content_Loaded); 89 94 Content.TaskReceived -= new EventHandler(Content_TaskReceived); 95 if (progressView != null) { 96 progressView.Content = null; 97 progressView.Dispose(); 98 progressView = null; 99 } 90 100 base.DeregisterContentEvents(); 91 101 } … … 356 366 var task = System.Threading.Tasks.Task.Factory.StartNew(ResumeJobAsync, Content); 357 367 task.ContinueWith((t) => { 358 FinishProgressView();368 progress.Finish(); 359 369 MessageBox.Show("An error occured resuming the job. See the log for more information.", "HeuristicLab Hive Job Manager", MessageBoxButtons.OK, MessageBoxIcon.Error); 360 370 Content.Log.LogException(t.Exception); … … 368 378 var task = System.Threading.Tasks.Task.Factory.StartNew(PauseJobAsync, Content); 369 379 task.ContinueWith((t) => { 370 FinishProgressView();380 progress.Finish(); 371 381 MessageBox.Show("An error occured pausing the job. See the log for more information.", "HeuristicLab Hive Job Manager", MessageBoxButtons.OK, MessageBoxIcon.Error); 372 382 Content.Log.LogException(t.Exception); … … 377 387 var task = System.Threading.Tasks.Task.Factory.StartNew(StopJobAsync, Content); 378 388 task.ContinueWith((t) => { 379 FinishProgressView();389 progress.Finish(); 380 390 MessageBox.Show("An error occured stopping the job. See the log for more information.", "HeuristicLab Hive Job Manager", MessageBoxButtons.OK, MessageBoxIcon.Error); 381 391 Content.Log.LogException(t.Exception); … … 385 395 386 396 private void PauseJobAsync(object job) { 387 IProgress prog = new Progress(); 388 prog.Status = "Pausing job..."; 389 SetProgressView(prog); 397 progress.Status = "Pausing job..."; 398 progress.ProgressState = ProgressState.Started; 390 399 HiveClient.PauseJob((RefreshableJob)job); 391 FinishProgressView();392 400 } 393 401 394 402 private void StopJobAsync(object job) { 395 IProgress prog = new Progress(); 396 prog.Status = "Stopping job..."; 397 SetProgressView(prog); 403 progress.Status = "Stopping job..."; 404 progress.ProgressState = ProgressState.Started; 398 405 HiveClient.StopJob((RefreshableJob)job); 399 FinishProgressView();400 406 } 401 407 402 408 private void ResumeJobAsync(object job) { 403 IProgress prog = new Progress(); 404 prog.Status = "Resuming job..."; 405 SetProgressView(prog); 409 progress.Status = "Resuming job..."; 410 progress.ProgressState = ProgressState.Started; 406 411 HiveClient.ResumeJob((RefreshableJob)job); 407 FinishProgressView();408 412 } 409 413 … … 466 470 } else { 467 471 if (Content != null && Content.Progress != null && Content.IsProgressing) { 468 SetProgressView();472 progressView.Content = Content.Progress; 469 473 } else { 470 progressView.Progress = null; 471 } 472 } 473 } 474 475 private void SetProgressView() { 476 if (InvokeRequired) { 477 Invoke(new Action(SetProgressView)); 478 } else { 479 progressView.Progress = Content.Progress; 480 } 481 } 482 483 private void SetProgressView(IProgress progress) { 484 if (InvokeRequired) { 485 Invoke(new Action<IProgress>(SetProgressView), progress); 486 } else { 487 progressView.Progress = progress; 488 } 489 } 490 491 private void FinishProgressView() { 492 if (InvokeRequired) { 493 Invoke(new Action(FinishProgressView)); 494 } else { 495 if (Content != null && Content.Progress != null) 496 Content.Progress.Finish(); 474 progressView.Content = progress; 475 } 497 476 } 498 477 }
Note: See TracChangeset
for help on using the changeset viewer.