- Timestamp:
- 01/02/12 11:40:31 (13 years ago)
- Location:
- branches/RegressionBenchmarks
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/RegressionBenchmarks
-
branches/RegressionBenchmarks/HeuristicLab.Clients.Hive.JobManager/3.3/MenuItems/JobManagerMenuItem.cs
r6976 r7255 25 25 26 26 namespace HeuristicLab.Optimizer.MenuItems { 27 public class ExperimentManagerMenuItem : HeuristicLab.MainForm.WindowsForms.MenuItem, IOptimizerUserInterfaceItemProvider {27 public class JobManagerMenuItem : HeuristicLab.MainForm.WindowsForms.MenuItem, IOptimizerUserInterfaceItemProvider { 28 28 public override string Name { 29 29 get { return "&Job Manager"; } -
branches/RegressionBenchmarks/HeuristicLab.Clients.Hive.JobManager/3.3/Views/HiveJobManagerView.Designer.cs
r6976 r7255 79 79 this.Controls.Add(this.refreshButton); 80 80 this.Controls.Add(this.hiveExperimentListView); 81 this.Name = " HiveExperimentManagerView";81 this.Name = "JobManagerView"; 82 82 this.Size = new System.Drawing.Size(735, 524); 83 83 this.ResumeLayout(false); -
branches/RegressionBenchmarks/HeuristicLab.Clients.Hive.JobManager/3.3/Views/RefreshableHiveJobListView.cs
r7078 r7255 54 54 55 55 protected override void removeButton_Click(object sender, EventArgs e) { 56 DialogResult result = MessageBox.Show("This action will permanently delete this job (also on the hive server). Continue?", "HeuristicLab Hive Job Manager", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); 57 if (result == DialogResult.OK) { 58 base.removeButton_Click(sender, e); 56 DialogResult result = MessageBox.Show("This action will permanently delete this job (also on the Hive server). Continue?", "HeuristicLab Hive Job Manager", MessageBoxButtons.YesNo, MessageBoxIcon.Question); 57 if (result == DialogResult.Yes) { 58 System.Windows.Forms.ListView.SelectedListViewItemCollection selectedItems = itemsListView.SelectedItems; 59 bool inProgress = false; 60 foreach (ListViewItem item in selectedItems) { 61 RefreshableJob job = item.Tag as RefreshableJob; 62 if (job != null && job.IsProgressing) { 63 inProgress = true; 64 break; 65 } 66 } 67 68 if (inProgress) { 69 MessageBox.Show("You can't delete jobs which are currently uploading or downloading." + Environment.NewLine + "Please wait for the jobs to complete and try again. ", "HeuristicLab Hive Job Manager", MessageBoxButtons.OK, MessageBoxIcon.Warning); 70 return; 71 } else { 72 base.removeButton_Click(sender, e); 73 } 59 74 } 60 75 } 61 76 62 77 protected override void Content_ItemsAdded(object sender, Collections.CollectionItemsChangedEventArgs<RefreshableJob> e) { 63 base.Content_ItemsAdded(sender, e); 64 foreach (ColumnHeader c in this.itemsListView.Columns) { 65 c.AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent); 66 } 67 foreach (var item in e.Items) { 68 item.ItemImageChanged += new EventHandler(item_ItemImageChanged); 78 if (InvokeRequired) { 79 Invoke(new CollectionItemsChangedEventHandler<RefreshableJob>(Content_ItemsAdded), sender, e); 80 } else { 81 base.Content_ItemsAdded(sender, e); 82 foreach (ColumnHeader c in this.itemsListView.Columns) { 83 c.AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent); 84 } 85 foreach (var item in e.Items) { 86 item.ItemImageChanged += new EventHandler(item_ItemImageChanged); 87 } 69 88 } 70 89 } 71 90 72 91 void item_ItemImageChanged(object sender, EventArgs e) { 73 if (this.itemsListView.InvokeRequired) { 74 Invoke(new EventHandler(item_ItemImageChanged), sender, e); 75 } else { 76 RefreshableJob job = sender as RefreshableJob; 77 if (job != null) { 78 foreach (ListViewItem item in this.itemsListView.Items) { 79 if (item.Tag != null) 80 { 81 RefreshableJob cur = item.Tag as RefreshableJob; 82 if (cur != null && cur == job) 83 { 84 this.UpdateListViewItemImage(item); 85 } 86 } 92 if (this.itemsListView.InvokeRequired) { 93 Invoke(new EventHandler(item_ItemImageChanged), sender, e); 94 } else { 95 RefreshableJob job = sender as RefreshableJob; 96 if (job != null) { 97 foreach (ListViewItem item in this.itemsListView.Items) { 98 if (item.Tag != null) { 99 RefreshableJob cur = item.Tag as RefreshableJob; 100 if (cur != null && cur == job) { 101 this.UpdateListViewItemImage(item); 102 } 87 103 } 88 } 104 } 105 } 89 106 } 90 107 } 91 108 92 109 protected override void Content_ItemsRemoved(object sender, CollectionItemsChangedEventArgs<RefreshableJob> e) { 93 base.Content_ItemsRemoved(sender, e); 94 foreach (var item in e.Items) { 95 item.ItemImageChanged -= new EventHandler(item_ItemImageChanged); 96 } 97 if (Content != null && Content.Count == 0) { 98 foreach (ColumnHeader c in this.itemsListView.Columns) { 99 c.AutoResize(ColumnHeaderAutoResizeStyle.HeaderSize); 110 if (InvokeRequired) { 111 Invoke(new CollectionItemsChangedEventHandler<RefreshableJob>(Content_ItemsRemoved), sender, e); 112 } else { 113 base.Content_ItemsRemoved(sender, e); 114 foreach (var item in e.Items) { 115 item.ItemImageChanged -= new EventHandler(item_ItemImageChanged); 116 } 117 if (Content != null && Content.Count == 0) { 118 foreach (ColumnHeader c in this.itemsListView.Columns) { 119 c.AutoResize(ColumnHeaderAutoResizeStyle.HeaderSize); 120 } 100 121 } 101 122 } -
branches/RegressionBenchmarks/HeuristicLab.Clients.Hive.JobManager/3.3/Views/RefreshableHiveJobView.Designer.cs
r6976 r7255 28 28 this.tabControl = new System.Windows.Forms.TabControl(); 29 29 this.tasksTabPage = new System.Windows.Forms.TabPage(); 30 this.jobsTreeView = new HeuristicLab.Clients.Hive.Views. ExperimentManager.HiveTaskItemTreeView();30 this.jobsTreeView = new HeuristicLab.Clients.Hive.Views.HiveTaskItemTreeView(); 31 31 this.permissionTabPage = new System.Windows.Forms.TabPage(); 32 32 this.refreshPermissionsButton = new System.Windows.Forms.Button(); 33 33 this.hiveExperimentPermissionListView = new HeuristicLab.Clients.Hive.JobManager.Views.HiveJobPermissionListView(); 34 34 this.runsTabPage = new System.Windows.Forms.TabPage(); 35 this.runCollectionViewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost(); 35 36 this.stateTabPage = new System.Windows.Forms.TabPage(); 36 37 this.stateLogViewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost(); … … 58 59 this.calculatingLabel = new System.Windows.Forms.Label(); 59 60 this.jobsLabel = new System.Windows.Forms.Label(); 60 this.runCollectionViewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost();61 61 this.tabControl.SuspendLayout(); 62 62 this.tasksTabPage.SuspendLayout(); … … 107 107 this.jobsTreeView.ReadOnly = false; 108 108 this.jobsTreeView.Size = new System.Drawing.Size(704, 420); 109 this.jobsTreeView.TabIndex = 0;109 this.jobsTreeView.TabIndex = 4; 110 110 this.jobsTreeView.DragDrop += new System.Windows.Forms.DragEventHandler(this.jobsTreeView_DragDrop); 111 111 this.jobsTreeView.DragEnter += new System.Windows.Forms.DragEventHandler(this.jobsTreeView_DragEnter); … … 159 159 this.runsTabPage.Text = "Runs"; 160 160 this.runsTabPage.UseVisualStyleBackColor = true; 161 // 162 // runCollectionViewHost 163 // 164 this.runCollectionViewHost.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 165 | System.Windows.Forms.AnchorStyles.Left) 166 | System.Windows.Forms.AnchorStyles.Right))); 167 this.runCollectionViewHost.Caption = "View"; 168 this.runCollectionViewHost.Content = null; 169 this.runCollectionViewHost.Enabled = false; 170 this.runCollectionViewHost.Location = new System.Drawing.Point(3, 3); 171 this.runCollectionViewHost.Name = "runCollectionViewHost"; 172 this.runCollectionViewHost.ReadOnly = false; 173 this.runCollectionViewHost.Size = new System.Drawing.Size(703, 420); 174 this.runCollectionViewHost.TabIndex = 2; 175 this.runCollectionViewHost.ViewsLabelVisible = true; 176 this.runCollectionViewHost.ViewType = null; 161 177 // 162 178 // stateTabPage … … 294 310 this.resourceNamesTextBox.Name = "resourceNamesTextBox"; 295 311 this.resourceNamesTextBox.Size = new System.Drawing.Size(415, 20); 296 this.resourceNamesTextBox.TabIndex = 14;312 this.resourceNamesTextBox.TabIndex = 2; 297 313 this.resourceNamesTextBox.Validated += new System.EventHandler(this.resourceNamesTextBox_Validated); 298 314 // … … 313 329 this.nameTextBox.Name = "nameTextBox"; 314 330 this.nameTextBox.Size = new System.Drawing.Size(501, 20); 315 this.nameTextBox.TabIndex = 21;331 this.nameTextBox.TabIndex = 1; 316 332 this.nameTextBox.Validated += new System.EventHandler(this.nameTextBox_Validated); 317 333 // … … 334 350 this.isPrivilegedCheckBox.Name = "isPrivilegedCheckBox"; 335 351 this.isPrivilegedCheckBox.Size = new System.Drawing.Size(72, 17); 336 this.isPrivilegedCheckBox.TabIndex = 26;352 this.isPrivilegedCheckBox.TabIndex = 3; 337 353 this.isPrivilegedCheckBox.Text = "Privileged"; 338 354 this.toolTip.SetToolTip(this.isPrivilegedCheckBox, "If checked, the task will be executed in a privileged sandbox on the slave."); … … 420 436 this.jobsLabel.TabIndex = 0; 421 437 this.jobsLabel.Text = "Waiting:"; 422 //423 // runCollectionViewHost424 //425 this.runCollectionViewHost.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)426 | System.Windows.Forms.AnchorStyles.Left)427 | System.Windows.Forms.AnchorStyles.Right)));428 this.runCollectionViewHost.Caption = "View";429 this.runCollectionViewHost.Content = null;430 this.runCollectionViewHost.Enabled = false;431 this.runCollectionViewHost.Location = new System.Drawing.Point(3, 3);432 this.runCollectionViewHost.Name = "runCollectionViewHost";433 this.runCollectionViewHost.ReadOnly = false;434 this.runCollectionViewHost.Size = new System.Drawing.Size(703, 420);435 this.runCollectionViewHost.TabIndex = 2;436 this.runCollectionViewHost.ViewsLabelVisible = true;437 this.runCollectionViewHost.ViewType = null;438 438 // 439 439 // RefreshableHiveJobView … … 484 484 private Core.Views.LogView logView; 485 485 private System.Windows.Forms.TabPage tasksTabPage; 486 private HeuristicLab.Clients.Hive.Views. ExperimentManager.HiveTaskItemTreeView jobsTreeView;486 private HeuristicLab.Clients.Hive.Views.HiveTaskItemTreeView jobsTreeView; 487 487 private System.Windows.Forms.Label nameLabel; 488 488 private System.Windows.Forms.TextBox nameTextBox; -
branches/RegressionBenchmarks/HeuristicLab.Clients.Hive.JobManager/3.3/Views/RefreshableHiveJobView.cs
r7068 r7255 24 24 using System.Linq; 25 25 using System.Threading; 26 using System.Threading.Tasks; 26 27 using System.Windows.Forms; 27 28 using HeuristicLab.Clients.Hive.Views; … … 301 302 } 302 303 private void Content_ExceptionOccured(object sender, EventArgs<Exception> e) { 303 // don't show exception, it is logged anyway304 throw e.Value; 304 305 } 305 306 private void Content_StateLogListChanged(object sender, EventArgs e) { … … 317 318 } 318 319 } 319 320 320 321 321 private void UpdateStateLogList() { … … 336 336 if (nameTextBox.Text.Trim() == string.Empty) { 337 337 MessageBox.Show("Please enter a name for the job before uploading it!", "HeuristicLab Hive Job Manager", MessageBoxButtons.OK, MessageBoxIcon.Information); 338 } else if (Content.ExecutionState == ExecutionState.Paused) { 339 var task = System.Threading.Tasks.Task.Factory.StartNew(ResumeJobAsync, Content); 340 task.ContinueWith((t) => { 341 FinishProgressView(); 342 MessageBox.Show("An error occured resuming the job. See the log for more information.", "HeuristicLab Hive Job Manager", MessageBoxButtons.OK, MessageBoxIcon.Error); 343 Content.Log.LogException(t.Exception); 344 }, TaskContinuationOptions.OnlyOnFaulted); 338 345 } else { 339 346 HiveClient.StartJob((Exception ex) => ErrorHandling.ShowErrorDialog(this, "Start failed.", ex), Content, new CancellationToken()); 340 347 } 341 348 } 349 342 350 private void pauseButton_Click(object sender, EventArgs e) { 343 HiveClient.PauseJob(Content); 344 } 351 var task = System.Threading.Tasks.Task.Factory.StartNew(PauseJobAsync, Content); 352 task.ContinueWith((t) => { 353 FinishProgressView(); 354 MessageBox.Show("An error occured pausing the job. See the log for more information.", "HeuristicLab Hive Job Manager", MessageBoxButtons.OK, MessageBoxIcon.Error); 355 Content.Log.LogException(t.Exception); 356 }, TaskContinuationOptions.OnlyOnFaulted); 357 } 358 345 359 private void stopButton_Click(object sender, EventArgs e) { 346 HiveClient.StopJob(Content); 360 var task = System.Threading.Tasks.Task.Factory.StartNew(StopJobAsync, Content); 361 task.ContinueWith((t) => { 362 FinishProgressView(); 363 MessageBox.Show("An error occured stopping the job. See the log for more information.", "HeuristicLab Hive Job Manager", MessageBoxButtons.OK, MessageBoxIcon.Error); 364 Content.Log.LogException(t.Exception); 365 }, TaskContinuationOptions.OnlyOnFaulted); 347 366 } 348 367 private void resetButton_Click(object sender, EventArgs e) { } 368 369 private void PauseJobAsync(object job) { 370 IProgress prog = new Progress(); 371 prog.Status = "Pausing job..."; 372 SetProgressView(prog); 373 HiveClient.PauseJob((RefreshableJob)job); 374 FinishProgressView(); 375 } 376 377 private void StopJobAsync(object job) { 378 IProgress prog = new Progress(); 379 prog.Status = "Stopping job..."; 380 SetProgressView(prog); 381 HiveClient.StopJob((RefreshableJob)job); 382 FinishProgressView(); 383 } 384 385 private void ResumeJobAsync(object job) { 386 IProgress prog = new Progress(); 387 prog.Status = "Resuming job..."; 388 SetProgressView(prog); 389 HiveClient.ResumeJob((RefreshableJob)job); 390 FinishProgressView(); 391 } 349 392 350 393 private void nameTextBox_Validated(object sender, EventArgs e) { … … 385 428 } 386 429 } 387 388 389 430 #endregion 390 431 … … 394 435 startButton.Enabled = pauseButton.Enabled = stopButton.Enabled = resetButton.Enabled = false; 395 436 } else { 396 startButton.Enabled = Content.IsControllable && Content.HiveTasks != null && Content.HiveTasks.Count > 0 && Content.ExecutionState == ExecutionState.Prepared;437 startButton.Enabled = Content.IsControllable && Content.HiveTasks != null && Content.HiveTasks.Count > 0 && (Content.ExecutionState == ExecutionState.Prepared || Content.ExecutionState == ExecutionState.Paused); 397 438 pauseButton.Enabled = Content.IsControllable && Content.ExecutionState == ExecutionState.Started; 398 439 stopButton.Enabled = Content.IsControllable && Content.ExecutionState == ExecutionState.Started; … … 416 457 417 458 private void SetProgressView() { 418 if (progressView == null) { 419 progressView = new ProgressView(this, Content.Progress); 420 } 421 progressView.Progress = Content.Progress; 459 if (InvokeRequired) { 460 Invoke(new Action(SetProgressView)); 461 } else { 462 if (progressView == null) { 463 progressView = new ProgressView(this, Content.Progress); 464 } else { 465 progressView.Progress = Content.Progress; 466 } 467 } 468 } 469 470 private void SetProgressView(IProgress progress) { 471 if (InvokeRequired) { 472 Invoke(new Action<IProgress>(SetProgressView), progress); 473 } else { 474 if (progressView == null) { 475 progressView = new ProgressView(this, progress); 476 } else { 477 progressView.Progress = progress; 478 } 479 } 422 480 } 423 481 424 482 private void FinishProgressView() { 425 if (progressView != null) { 426 progressView.Finish(); 427 progressView = null; 428 SetEnabledStateOfControls(); 483 if (InvokeRequired) { 484 Invoke(new Action(FinishProgressView)); 485 } else { 486 if (progressView != null) { 487 progressView.Finish(); 488 progressView = null; 489 SetEnabledStateOfControls(); 490 } 429 491 } 430 492 } … … 471 533 if (tabControl.SelectedTab == permissionTabPage) { 472 534 if (!Content.IsSharable) { 473 MessageBox.Show("Unable to load tab. You have insufficient access privileges.");535 MessageBox.Show("Unable to load permissions. You have insufficient access privileges.", "HeuristicLab Hive Job Manager", MessageBoxButtons.OK, MessageBoxIcon.Information); 474 536 tabControl.SelectedTab = tasksTabPage; 475 537 }
Note: See TracChangeset
for help on using the changeset viewer.