- Timestamp:
- 07/03/12 16:46:35 (12 years ago)
- Location:
- branches/GP-MoveOperators
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/GP-MoveOperators
- Property svn:mergeinfo changed
/trunk/sources merged: 8084,8088-8090,8092-8100,8102-8113,8115,8117-8132,8134-8146,8148-8156,8158-8160,8163-8170,8173-8176,8178-8190,8192-8205
- Property svn:mergeinfo changed
-
branches/GP-MoveOperators/HeuristicLab.Clients.Hive.JobManager/3.3/Views/HiveResourceSelector.cs
r8085 r8206 42 42 private ISet<TreeNode> filteredTreeNodes; 43 43 private ISet<TreeNode> nodeStore; 44 private Progress progress; 45 private ProgressView progressView; 44 46 45 47 private ISet<Resource> selectedResources; … … 47 49 get { return selectedResources; } 48 50 set { selectedResources = value; } 49 }50 51 private ProgressView progressView;52 public ProgressView ProgressView {53 get { return progressView; }54 set { progressView = value; }55 51 } 56 52 … … 68 64 imageList.Images.Add(HeuristicLab.Common.Resources.VSImageLibrary.MonitorLarge); 69 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); 70 84 } 71 85 … … 74 88 Invoke(new Action(StartProgressView)); 75 89 } else { 76 if (progressView == null) { 77 IProgress prog = new Progress(); 78 prog.Status = "Downloading resources. Please be patient."; 79 progressView = new ProgressView(this, prog); 80 } 90 progress.Status = "Downloading resources. Please be patient."; 91 progress.ProgressState = ProgressState.Started; 81 92 } 82 93 } … … 86 97 Invoke(new Action(FinishProgressView)); 87 98 } else { 88 if (progressView != null) { 89 progressView.Finish(); 90 progressView = null; 91 SetEnabledStateOfControls(); 92 } 99 progress.Finish(); 93 100 } 94 101 } -
branches/GP-MoveOperators/HeuristicLab.Clients.Hive.JobManager/3.3/Views/HiveResourceSelectorDialog.Designer.cs
r8085 r8206 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); -
branches/GP-MoveOperators/HeuristicLab.Clients.Hive.JobManager/3.3/Views/RefreshableHiveJobView.Designer.cs
r8085 r8206 365 365 this.refreshAutomaticallyCheckBox.Text = "&Refresh automatically"; 366 366 this.refreshAutomaticallyCheckBox.UseVisualStyleBackColor = true; 367 this.refreshAutomaticallyCheckBox. Validated += new System.EventHandler(this.refreshAutomaticallyCheckBox_Validated);367 this.refreshAutomaticallyCheckBox.CheckedChanged += new System.EventHandler(this.refreshAutomaticallyCheckBox_CheckedChanged); 368 368 // 369 369 // infoGroupBox -
branches/GP-MoveOperators/HeuristicLab.Clients.Hive.JobManager/3.3/Views/RefreshableHiveJobView.cs
r8085 r8206 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(); 58 progress = new Progress() { 59 CanBeCanceled = false, 60 ProgressState = ProgressState.Finished 61 }; 57 62 } 58 63 … … 72 77 Content.Loaded += new EventHandler(Content_Loaded); 73 78 Content.TaskReceived += new EventHandler(Content_TaskReceived); 79 progressView = new ProgressView(this, progress); 74 80 } 75 81 … … 87 93 Content.Loaded -= new EventHandler(Content_Loaded); 88 94 Content.TaskReceived -= new EventHandler(Content_TaskReceived); 95 if (progressView != null) { 96 progressView.Content = null; 97 progressView.Dispose(); 98 progressView = null; 99 } 89 100 base.DeregisterContentEvents(); 90 101 } … … 148 159 bool alreadyUploaded = Content.Id != Guid.Empty; 149 160 bool jobsLoaded = Content.HiveTasks != null && Content.HiveTasks.All(x => x.Task.Id != Guid.Empty); 150 151 this.nameTextBox.ReadOnly = !Content.IsControllable || Content.ExecutionState != ExecutionState.Prepared || alreadyUploaded; 152 this.resourceNamesTextBox.ReadOnly = !Content.IsControllable || Content.ExecutionState != ExecutionState.Prepared || alreadyUploaded; 153 this.searchButton.Enabled = Content.IsControllable && !(Content.ExecutionState != ExecutionState.Prepared || alreadyUploaded); 154 this.jobsTreeView.ReadOnly = !Content.IsControllable || Content.ExecutionState != ExecutionState.Prepared || alreadyUploaded; 155 156 this.isPrivilegedCheckBox.Enabled = Content.IsAllowedPrivileged && Content.IsControllable && !(Content.ExecutionState != ExecutionState.Prepared || alreadyUploaded); // TODO: check if user has the rights to do this 157 this.refreshAutomaticallyCheckBox.Enabled = Content.IsControllable && alreadyUploaded && jobsLoaded && Content.ExecutionState == ExecutionState.Started; 158 this.refreshButton.Enabled = Content.IsDownloadable && alreadyUploaded; 159 this.Locked = !Content.IsControllable || Content.ExecutionState == ExecutionState.Started; 161 tabControl.Enabled = !Content.IsProgressing; 162 163 this.nameTextBox.ReadOnly = !Content.IsControllable || Content.ExecutionState != ExecutionState.Prepared || alreadyUploaded || Content.IsProgressing; 164 this.resourceNamesTextBox.ReadOnly = !Content.IsControllable || Content.ExecutionState != ExecutionState.Prepared || alreadyUploaded || Content.IsProgressing; 165 this.searchButton.Enabled = (Content.IsControllable && !(Content.ExecutionState != ExecutionState.Prepared || alreadyUploaded)) || !Content.IsProgressing; 166 this.jobsTreeView.ReadOnly = !Content.IsControllable || Content.ExecutionState != ExecutionState.Prepared || alreadyUploaded || Content.IsProgressing; 167 168 this.isPrivilegedCheckBox.Enabled = Content.IsAllowedPrivileged && Content.IsControllable && !(Content.ExecutionState != ExecutionState.Prepared || alreadyUploaded) && !Content.IsProgressing; 169 this.refreshAutomaticallyCheckBox.Enabled = Content.IsControllable && alreadyUploaded && jobsLoaded && Content.ExecutionState == ExecutionState.Started && !Content.IsProgressing; 170 this.refreshButton.Enabled = Content.IsDownloadable && alreadyUploaded && !Content.IsProgressing; 171 this.Locked = !Content.IsControllable || Content.ExecutionState == ExecutionState.Started || Content.IsProgressing; 160 172 } 161 173 SetEnabledStateOfExecutableButtons(); … … 342 354 foreach (Resource resource in hiveResourceSelectorDialog.GetSelectedResources()) { 343 355 sb.Append(resource.Name); 344 sb.Append("; 356 sb.Append(";"); 345 357 } 346 358 resourceNamesTextBox.Text = sb.ToString(); … … 354 366 var task = System.Threading.Tasks.Task.Factory.StartNew(ResumeJobAsync, Content); 355 367 task.ContinueWith((t) => { 356 FinishProgressView();368 progress.Finish(); 357 369 MessageBox.Show("An error occured resuming the job. See the log for more information.", "HeuristicLab Hive Job Manager", MessageBoxButtons.OK, MessageBoxIcon.Error); 358 370 Content.Log.LogException(t.Exception); … … 366 378 var task = System.Threading.Tasks.Task.Factory.StartNew(PauseJobAsync, Content); 367 379 task.ContinueWith((t) => { 368 FinishProgressView();380 progress.Finish(); 369 381 MessageBox.Show("An error occured pausing the job. See the log for more information.", "HeuristicLab Hive Job Manager", MessageBoxButtons.OK, MessageBoxIcon.Error); 370 382 Content.Log.LogException(t.Exception); … … 375 387 var task = System.Threading.Tasks.Task.Factory.StartNew(StopJobAsync, Content); 376 388 task.ContinueWith((t) => { 377 FinishProgressView();389 progress.Finish(); 378 390 MessageBox.Show("An error occured stopping the job. See the log for more information.", "HeuristicLab Hive Job Manager", MessageBoxButtons.OK, MessageBoxIcon.Error); 379 391 Content.Log.LogException(t.Exception); … … 383 395 384 396 private void PauseJobAsync(object job) { 385 IProgress prog = new Progress(); 386 prog.Status = "Pausing job..."; 387 SetProgressView(prog); 397 progress.Status = "Pausing job..."; 398 progress.ProgressState = ProgressState.Started; 388 399 HiveClient.PauseJob((RefreshableJob)job); 389 FinishProgressView();400 progress.Finish(); 390 401 } 391 402 392 403 private void StopJobAsync(object job) { 393 IProgress prog = new Progress(); 394 prog.Status = "Stopping job..."; 395 SetProgressView(prog); 404 progress.Status = "Stopping job..."; 405 progress.ProgressState = ProgressState.Started; 396 406 HiveClient.StopJob((RefreshableJob)job); 397 FinishProgressView();407 progress.Finish(); 398 408 } 399 409 400 410 private void ResumeJobAsync(object job) { 401 IProgress prog = new Progress(); 402 prog.Status = "Resuming job..."; 403 SetProgressView(prog); 411 progress.Status = "Resuming job..."; 412 progress.ProgressState = ProgressState.Started; 404 413 HiveClient.ResumeJob((RefreshableJob)job); 405 FinishProgressView();414 progress.Finish(); 406 415 } 407 416 … … 416 425 } 417 426 418 private void refreshAutomaticallyCheckBox_ Validated(object sender, EventArgs e) {427 private void refreshAutomaticallyCheckBox_CheckedChanged(object sender, EventArgs e) { 419 428 if (Content != null) Content.RefreshAutomatically = refreshAutomaticallyCheckBox.Checked; 420 429 } … … 450 459 startButton.Enabled = pauseButton.Enabled = stopButton.Enabled = resetButton.Enabled = false; 451 460 } else { 452 startButton.Enabled = Content.IsControllable && Content.HiveTasks != null && Content.HiveTasks.Count > 0 && (Content.ExecutionState == ExecutionState.Prepared || Content.ExecutionState == ExecutionState.Paused) ;453 pauseButton.Enabled = Content.IsControllable && Content.ExecutionState == ExecutionState.Started ;454 stopButton.Enabled = Content.IsControllable && Content.ExecutionState == ExecutionState.Started ;461 startButton.Enabled = Content.IsControllable && Content.HiveTasks != null && Content.HiveTasks.Count > 0 && (Content.ExecutionState == ExecutionState.Prepared || Content.ExecutionState == ExecutionState.Paused) && !Content.IsProgressing; 462 pauseButton.Enabled = Content.IsControllable && Content.ExecutionState == ExecutionState.Started && !Content.IsProgressing; 463 stopButton.Enabled = Content.IsControllable && Content.ExecutionState == ExecutionState.Started && !Content.IsProgressing; 455 464 resetButton.Enabled = false; 456 465 } … … 463 472 Invoke(new EventHandler(Content_IsProgressingChanged), sender, e); 464 473 } else { 465 if (Content != null && Content.IsProgressing) { 466 SetProgressView(); 467 } else { 468 FinishProgressView(); 469 } 470 } 471 } 472 473 private void SetProgressView() { 474 if (InvokeRequired) { 475 Invoke(new Action(SetProgressView)); 476 } else { 477 if (progressView == null) { 478 progressView = new ProgressView(this, Content.Progress); 479 } else { 480 progressView.Progress = Content.Progress; 481 } 482 } 483 } 484 485 private void SetProgressView(IProgress progress) { 486 if (InvokeRequired) { 487 Invoke(new Action<IProgress>(SetProgressView), progress); 488 } else { 489 if (progressView == null) { 490 progressView = new ProgressView(this, progress); 491 } else { 492 progressView.Progress = progress; 493 } 494 } 495 } 496 497 private void FinishProgressView() { 498 if (InvokeRequired) { 499 Invoke(new Action(FinishProgressView)); 500 } else { 501 if (progressView != null) { 502 progressView.Finish(); 503 progressView = null; 504 SetEnabledStateOfControls(); 474 if (Content != null && Content.Progress != null && Content.IsProgressing) { 475 progressView.Content = Content.Progress; 476 } else if (Content != null) { 477 progressView.Content = progress; 505 478 } 506 479 }
Note: See TracChangeset
for help on using the changeset viewer.