Changeset 15627 for branches/HiveProjectManagement/HeuristicLab.Clients.Hive.JobManager/3.3/Views/RefreshableHiveJobView.cs
- Timestamp:
- 01/17/18 15:20:29 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HiveProjectManagement/HeuristicLab.Clients.Hive.JobManager/3.3/Views/RefreshableHiveJobView.cs
r15412 r15627 33 33 using HeuristicLab.Optimization; 34 34 using HeuristicLab.PluginInfrastructure; 35 using System.Collections.Generic; 35 36 36 37 namespace HeuristicLab.Clients.Hive.JobManager.Views { … … 44 45 private bool SuppressEvents { get; set; } 45 46 private object runCollectionViewLocker = new object(); 47 private Project selectedProject; 46 48 47 49 public new RefreshableJob Content { … … 129 131 nameTextBox.Text = Content.Job.Name; 130 132 executionTimeTextBox.Text = Content.ExecutionTime.ToString(); 131 //resourceNamesTextBox.Text = Content.Job.ResourceNames;132 133 refreshAutomaticallyCheckBox.Checked = Content.RefreshAutomatically; 134 135 // project look up 136 if(Content.Job.ProjectId != null && Content.Job.ProjectId != Guid.Empty) { 137 selectedProject = GetProject(Content.Job.ProjectId); 138 if(selectedProject != null) { 139 projectNameTextBox.Text = selectedProject.Name; 140 } else { 141 projectNameTextBox.Text = string.Empty; 142 } 143 } else { 144 selectedProject = null; 145 projectNameTextBox.Text = string.Empty; 146 } 147 133 148 logView.Content = Content.Log; 134 149 lock (runCollectionViewLocker) { … … 330 345 #region Control events 331 346 private void searchButton_Click(object sender, EventArgs e) { 332 if (hiveResourceSelectorDialog == null) 333 hiveResourceSelectorDialog = new HiveResourceSelectorDialog(); 347 if (hiveResourceSelectorDialog == null) { 348 hiveResourceSelectorDialog = new HiveResourceSelectorDialog(Content.Job.Id, Content.Job.ProjectId); 349 } else if(selectedProject != null) { 350 hiveResourceSelectorDialog.SelectedProjectId = Content.Job.ProjectId; 351 } else { 352 hiveResourceSelectorDialog.SelectedProjectId = null; 353 } 334 354 335 355 if (hiveResourceSelectorDialog.ShowDialog(this) == DialogResult.OK) { 336 var selectedProject = hiveResourceSelectorDialog.SelectedProject; 337 projectNameTextBox.Text = selectedProject.Name; 338 Content.Job.ProjectId = selectedProject.Id; 339 Content.Job.ResourceIds = hiveResourceSelectorDialog.SelectedResources.Select(x => x.Id).ToList(); 356 selectedProject = hiveResourceSelectorDialog.SelectedProject; 357 if(selectedProject != null) { 358 projectNameTextBox.Text = selectedProject.Name; 359 Content.Job.ProjectId = selectedProject.Id; 360 Content.Job.ResourceIds = hiveResourceSelectorDialog.SelectedResources.Select(x => x.Id).ToList(); 361 } else { 362 projectNameTextBox.Text = string.Empty; 363 Content.Job.ProjectId = Guid.Empty; 364 Content.Job.ResourceIds = null; 365 } 340 366 } 341 367 } … … 344 370 if (nameTextBox.Text.Trim() == string.Empty) { 345 371 MessageBox.Show("Please enter a name for the job before uploading it!", "HeuristicLab Hive Job Manager", MessageBoxButtons.OK, MessageBoxIcon.Information); 372 } else if (Content.Job.ProjectId == null || Content.Job.ProjectId == Guid.Empty) { 373 MessageBox.Show("Please select a project before uploading the job!", "HeuristicLab Hive Job Manager", MessageBoxButtons.OK, MessageBoxIcon.Information); 374 } else if (Content.Job.ResourceIds == null || !Content.Job.ResourceIds.Any()) { 375 MessageBox.Show("Please select resources before uploading the job!", "HeuristicLab Hive Job Manager", MessageBoxButtons.OK, MessageBoxIcon.Information); 346 376 } else if (Content.ExecutionState == ExecutionState.Paused) { 347 377 var task = System.Threading.Tasks.Task.Factory.StartNew(ResumeJobAsync, Content); … … 436 466 } 437 467 } 468 469 private Project GetProject(Guid projectId) { 470 return HiveServiceLocator.Instance.CallHiveService(s => s.GetProject(projectId)); 471 } 438 472 #endregion 439 473
Note: See TracChangeset
for help on using the changeset viewer.