Changeset 9363 for branches/OaaS/HeuristicLab.Clients.Hive.JobManager
- Timestamp:
- 04/16/13 13:13:41 (12 years ago)
- Location:
- branches/OaaS
- Files:
-
- 13 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/OaaS
- Property svn:ignore
-
old new 21 21 protoc.exe 22 22 _ReSharper.HeuristicLab 3.3 Tests 23 Google.ProtocolBuffers-2.4.1.473.dll 23 24 packages
-
- Property svn:mergeinfo changed
- Property svn:ignore
-
branches/OaaS/HeuristicLab.Clients.Hive.JobManager/3.3/HeuristicLab.Clients.Hive.JobManager-3.3.csproj
r9253 r9363 99 99 <ItemGroup> 100 100 <Compile Include="ExtensionMethods\TreeNodeExtensions.cs" /> 101 <Compile Include="ListViewItemDateComparer.cs" /> 101 102 <Compile Include="Plugin.cs" /> 102 103 <Compile Include="Views\HiveJobManagerView.cs"> … … 233 234 <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> 234 235 <PropertyGroup> 235 <PreBuildEvent >set Path=%25Path%25;$(ProjectDir);$(SolutionDir)236 <PreBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">set Path=%25Path%25;$(ProjectDir);$(SolutionDir) 236 237 set ProjectDir=$(ProjectDir) 237 238 set SolutionDir=$(SolutionDir) … … 239 240 240 241 call PreBuildEvent.cmd</PreBuildEvent> 242 <PreBuildEvent Condition=" '$(OS)' != 'Windows_NT' "> 243 export ProjectDir=$(ProjectDir) 244 export SolutionDir=$(SolutionDir) 245 246 $SolutionDir/PreBuildEvent.sh 247 </PreBuildEvent> 241 248 </PropertyGroup> 242 249 <PropertyGroup> -
branches/OaaS/HeuristicLab.Clients.Hive.JobManager/3.3/Plugin.cs.frame
r7259 r9363 23 23 24 24 namespace HeuristicLab.Clients.Hive.JobManager { 25 [Plugin("HeuristicLab.Clients.Hive.JobManager", "3.3. 6.$WCREV$")]25 [Plugin("HeuristicLab.Clients.Hive.JobManager", "3.3.7.$WCREV$")] 26 26 [PluginFile("HeuristicLab.Clients.Hive.JobManager-3.3.dll", PluginFileType.Assembly)] 27 27 [PluginDependency("HeuristicLab.Clients.Hive", "3.3")] -
branches/OaaS/HeuristicLab.Clients.Hive.JobManager/3.3/Properties/AssemblyInfo.cs.frame
r7260 r9363 55 55 // [assembly: AssemblyVersion("1.0.*")] 56 56 [assembly: AssemblyVersion("3.3.0.0")] 57 [assembly: AssemblyFileVersion("3.3. 6.$WCREV$")]57 [assembly: AssemblyFileVersion("3.3.7.$WCREV$")] -
branches/OaaS/HeuristicLab.Clients.Hive.JobManager/3.3/Views/HiveJobManagerView.cs
r7259 r9363 25 25 using System.Windows.Forms; 26 26 using HeuristicLab.Clients.Hive.Views; 27 using HeuristicLab.Collections;28 27 using HeuristicLab.MainForm; 29 28 using HeuristicLab.MainForm.WindowsForms; … … 54 53 Content.Refreshing += new EventHandler(Content_Refreshing); 55 54 Content.Refreshed += new EventHandler(Content_Refreshed); 56 Content.HiveExperimentsChanged += new EventHandler(Content_HiveExperimentsChanged);57 58 55 } 59 56 … … 61 58 Content.Refreshing -= new EventHandler(Content_Refreshing); 62 59 Content.Refreshed -= new EventHandler(Content_Refreshed); 63 Content.HiveExperimentsChanged -= new EventHandler(Content_HiveExperimentsChanged);64 60 base.DeregisterContentEvents(); 65 61 } … … 123 119 124 120 protected override void OnClosing(FormClosingEventArgs e) { 125 base.OnClosing(e); 126 if (Content != null && Content.Jobs != null) { 127 foreach (var exp in Content.Jobs.OfType<RefreshableJob>()) { 128 if (exp.RefreshAutomatically) { 129 exp.RefreshAutomatically = false; // stop result polling 130 } 121 if (Content != null && Content.Jobs.Any(x => x.IsProgressing)) { 122 DialogResult result = MessageBox.Show("There are still unfinished down/uploads. Are you sure you want to close the window?", "HeuristicLab Hive Job Manager", MessageBoxButtons.YesNo, MessageBoxIcon.Question); 123 124 if (result == DialogResult.No) { 125 e.Cancel = true; 131 126 } 127 } else { 128 base.OnClosing(e); 132 129 } 133 130 } 134 131 135 private void HiveExperiments_ItemsRemoved(object sender, CollectionItemsChangedEventArgs<RefreshableJob> e) { 136 foreach (var item in e.Items) { 137 HiveClient.Delete(item); 132 protected override void OnClosed(FormClosedEventArgs e) { 133 if (Content != null) { 134 Content.ClearHiveClient(); 135 Content = null; 138 136 } 139 } 140 141 private void Content_HiveExperimentsChanged(object sender, EventArgs e) { 142 Content.Jobs.ItemsRemoved += new CollectionItemsChangedEventHandler<RefreshableJob>(HiveExperiments_ItemsRemoved); 137 base.OnClosed(e); 143 138 } 144 139 } -
branches/OaaS/HeuristicLab.Clients.Hive.JobManager/3.3/Views/HiveJobPermissionListView.Designer.cs
r7967 r9363 1 namespace HeuristicLab.Clients.Hive.JobManager.Views { 1 #region License Information 2 /* HeuristicLab 3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 * 5 * This file is part of HeuristicLab. 6 * 7 * HeuristicLab is free software: you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation, either version 3 of the License, or 10 * (at your option) any later version. 11 * 12 * HeuristicLab is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>. 19 */ 20 #endregion 21 22 namespace HeuristicLab.Clients.Hive.JobManager.Views { 2 23 partial class HiveJobPermissionListView { 3 24 /// <summary> -
branches/OaaS/HeuristicLab.Clients.Hive.JobManager/3.3/Views/HiveJobPermissionView.Designer.cs
r7967 r9363 1 namespace HeuristicLab.Clients.Hive.JobManager.Views { 1 #region License Information 2 /* HeuristicLab 3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 * 5 * This file is part of HeuristicLab. 6 * 7 * HeuristicLab is free software: you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation, either version 3 of the License, or 10 * (at your option) any later version. 11 * 12 * HeuristicLab is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>. 19 */ 20 #endregion 21 22 namespace HeuristicLab.Clients.Hive.JobManager.Views { 2 23 partial class HiveJobPermissionView { 3 24 /// <summary> -
branches/OaaS/HeuristicLab.Clients.Hive.JobManager/3.3/Views/HiveResourceSelector.Designer.cs
r7967 r9363 1 namespace HeuristicLab.Clients.Hive.JobManager.Views { 1 #region License Information 2 /* HeuristicLab 3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 * 5 * This file is part of HeuristicLab. 6 * 7 * HeuristicLab is free software: you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation, either version 3 of the License, or 10 * (at your option) any later version. 11 * 12 * HeuristicLab is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>. 19 */ 20 #endregion 21 22 namespace HeuristicLab.Clients.Hive.JobManager.Views { 2 23 partial class HiveResourceSelector { 3 24 /// <summary> -
branches/OaaS/HeuristicLab.Clients.Hive.JobManager/3.3/Views/HiveResourceSelectorDialog.Designer.cs
r8165 r9363 1 namespace HeuristicLab.Clients.Hive.JobManager.Views { 1 #region License Information 2 /* HeuristicLab 3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 * 5 * This file is part of HeuristicLab. 6 * 7 * HeuristicLab is free software: you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation, either version 3 of the License, or 10 * (at your option) any later version. 11 * 12 * HeuristicLab is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>. 19 */ 20 #endregion 21 22 namespace HeuristicLab.Clients.Hive.JobManager.Views { 2 23 partial class HiveResourceSelectorDialog { 3 24 /// <summary> -
branches/OaaS/HeuristicLab.Clients.Hive.JobManager/3.3/Views/RefreshableHiveJobListView.Designer.cs
r7967 r9363 1 namespace HeuristicLab.Clients.Hive.JobManager.Views { 1 #region License Information 2 /* HeuristicLab 3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 * 5 * This file is part of HeuristicLab. 6 * 7 * HeuristicLab is free software: you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation, either version 3 of the License, or 10 * (at your option) any later version. 11 * 12 * HeuristicLab is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>. 19 */ 20 #endregion 21 22 namespace HeuristicLab.Clients.Hive.JobManager.Views { 2 23 partial class RefreshableHiveJobListView { 3 24 /// <summary> … … 6 27 private System.ComponentModel.IContainer components = null; 7 28 8 /// <summary>9 /// Clean up any resources being used.10 /// </summary>11 /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>12 protected override void Dispose(bool disposing) {13 if (disposing) {14 if (components != null) components.Dispose();15 }16 base.Dispose(disposing);17 }18 29 19 30 #region Component Designer generated code -
branches/OaaS/HeuristicLab.Clients.Hive.JobManager/3.3/Views/RefreshableHiveJobListView.cs
r7259 r9363 21 21 22 22 using System; 23 using System.Collections.Generic; 24 using System.Threading.Tasks; 23 25 using System.Windows.Forms; 24 26 using HeuristicLab.Collections; 25 27 using HeuristicLab.Core; 26 28 using HeuristicLab.MainForm; 29 using HeuristicLab.MainForm.WindowsForms; 30 using HeuristicLab.PluginInfrastructure; 27 31 28 32 namespace HeuristicLab.Clients.Hive.JobManager.Views { … … 30 34 [Content(typeof(ItemCollection<RefreshableJob>), false)] 31 35 public partial class RefreshableHiveJobListView : HeuristicLab.Core.Views.ItemCollectionView<RefreshableJob> { 36 private Progress progress; 37 private ProgressView progressView; 32 38 33 39 public RefreshableHiveJobListView() { 34 40 InitializeComponent(); 35 41 itemsGroupBox.Text = "Jobs"; 36 this.itemsListView.View = View.Details;42 this.itemsListView.View = System.Windows.Forms.View.Details; 37 43 this.itemsListView.Columns.Clear(); 38 44 this.itemsListView.Columns.Add(new ColumnHeader("Date") { Text = "Date" }); … … 43 49 this.itemsListView.HeaderStyle = ColumnHeaderStyle.Clickable; 44 50 this.itemsListView.FullRowSelect = true; 51 52 this.itemsListView.ListViewItemSorter = new ListViewItemDateComparer(0, SortOrder.Ascending); 45 53 this.itemsListView.Sorting = SortOrder.Ascending; 46 54 this.itemsListView.Sort(); 55 56 progress = new Progress() { 57 CanBeCanceled = false, 58 ProgressState = ProgressState.Finished 59 }; 60 progressView = new ProgressView(this, progress); 47 61 } 48 62 49 63 protected override RefreshableJob CreateItem() { 50 var refreshableJob = new RefreshableJob() { IsAllowedPrivileged = HiveClient.Instance.IsAllowedPrivileged };64 var refreshableJob = new RefreshableJob(); 51 65 refreshableJob.Job.Name = "New Hive Job"; 52 66 return refreshableJob; 67 } 68 69 protected override void OnLockedChanged() { 70 base.OnLockedChanged(); 71 72 itemsListView.Enabled = !Locked; 73 addButton.Enabled = !Locked; 74 sortAscendingButton.Enabled = !Locked; 75 sortDescendingButton.Enabled = !Locked; 76 removeButton.Enabled = !Locked; 77 } 78 79 protected override void SetEnabledStateOfControls() { 80 // if the view is locked, a job is currently beeing deleted and everything should be disabled 81 if (!Locked) 82 base.SetEnabledStateOfControls(); 53 83 } 54 84 … … 58 88 System.Windows.Forms.ListView.SelectedListViewItemCollection selectedItems = itemsListView.SelectedItems; 59 89 bool inProgress = false; 60 foreach (ListViewItem item in selectedItems) { 90 foreach (ListViewItem item in selectedItems) { 61 91 RefreshableJob job = item.Tag as RefreshableJob; 62 92 if (job != null && job.IsProgressing) { … … 70 100 return; 71 101 } else { 72 base.removeButton_Click(sender, e); 73 } 74 } 102 DeleteHiveJobs(e); 103 } 104 } 105 } 106 107 private void DeleteHiveJobs(EventArgs e) { 108 if (itemsListView.SelectedItems.Count > 0) { 109 List<RefreshableJob> items = new List<RefreshableJob>(); 110 foreach (ListViewItem item in itemsListView.SelectedItems) 111 items.Add((RefreshableJob)item.Tag); 112 113 var task = System.Threading.Tasks.Task.Factory.StartNew(DeleteHiveJobsAsync, items); 114 115 task.ContinueWith((t) => { 116 progress.Finish(); 117 ErrorHandling.ShowErrorDialog("An error occured while deleting the job. ", t.Exception); 118 }, TaskContinuationOptions.OnlyOnFaulted); 119 120 task.ContinueWith((t) => { 121 itemsListView.Invoke(new Action(() => itemsListView.SelectedItems.Clear())); 122 }, TaskContinuationOptions.OnlyOnRanToCompletion); 123 } 124 } 125 126 private void DeleteHiveJobsAsync(object items) { 127 progress.Status = "Deleting job..."; 128 progress.ProgressState = ProgressState.Started; 129 progress.ProgressValue = 0.0; 130 foreach (RefreshableJob item in (List<RefreshableJob>)items) { 131 Content.Remove(item); 132 } 133 progress.Finish(); 75 134 } 76 135 … … 126 185 ListViewItem listViewItem = base.CreateListViewItem(item); 127 186 listViewItem.SubItems.Clear(); 128 listViewItem.SubItems.Insert(0, new ListViewItem.ListViewSubItem(listViewItem, item.Job.DateCreated.ToString( "dd.MM.yyyy HH:mm")));187 listViewItem.SubItems.Insert(0, new ListViewItem.ListViewSubItem(listViewItem, item.Job.DateCreated.ToString())); 129 188 listViewItem.SubItems.Insert(1, new ListViewItem.ListViewSubItem(listViewItem, item.Job.Name)); 130 189 listViewItem.Group = GetListViewGroup(item.Job.OwnerUsername); … … 156 215 return newGroup; 157 216 } 217 218 /// <summary> 219 /// Clean up any resources being used. 220 /// </summary> 221 /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> 222 protected override void Dispose(bool disposing) { 223 if (disposing) { 224 if (components != null) components.Dispose(); 225 progressView.Content = null; 226 progressView.Dispose(); 227 } 228 base.Dispose(disposing); 229 } 158 230 } 159 231 } -
branches/OaaS/HeuristicLab.Clients.Hive.JobManager/3.3/Views/RefreshableHiveJobView.Designer.cs
r8090 r9363 1 namespace HeuristicLab.Clients.Hive.JobManager.Views { 1 #region License Information 2 /* HeuristicLab 3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 * 5 * This file is part of HeuristicLab. 6 * 7 * HeuristicLab is free software: you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation, either version 3 of the License, or 10 * (at your option) any later version. 11 * 12 * HeuristicLab is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>. 19 */ 20 #endregion 21 22 namespace HeuristicLab.Clients.Hive.JobManager.Views { 2 23 partial class RefreshableHiveJobView { 3 24 /// <summary> … … 50 71 this.refreshButton = new System.Windows.Forms.Button(); 51 72 this.isPrivilegedCheckBox = new System.Windows.Forms.CheckBox(); 73 this.UnloadButton = new System.Windows.Forms.Button(); 52 74 this.refreshAutomaticallyCheckBox = new System.Windows.Forms.CheckBox(); 53 75 this.infoGroupBox = new System.Windows.Forms.GroupBox(); … … 70 92 // tabControl 71 93 // 94 this.tabControl.AllowDrop = true; 72 95 this.tabControl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 73 96 | System.Windows.Forms.AnchorStyles.Left) … … 354 377 this.toolTip.SetToolTip(this.isPrivilegedCheckBox, "If checked, the task will be executed in a privileged sandbox on the slave."); 355 378 this.isPrivilegedCheckBox.UseVisualStyleBackColor = true; 356 this.isPrivilegedCheckBox.Validated += new System.EventHandler(this.isPrivilegedCheckBox_Validated); 379 this.isPrivilegedCheckBox.CheckedChanged += new System.EventHandler(this.isPrivilegedCheckBox_CheckChanged); 380 // 381 // UnloadButton 382 // 383 this.UnloadButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.Disconnect; 384 this.UnloadButton.Location = new System.Drawing.Point(30, 0); 385 this.UnloadButton.Name = "UnloadButton"; 386 this.UnloadButton.Size = new System.Drawing.Size(24, 24); 387 this.UnloadButton.TabIndex = 27; 388 this.toolTip.SetToolTip(this.UnloadButton, "Unload Job"); 389 this.UnloadButton.UseVisualStyleBackColor = true; 390 this.UnloadButton.Click += new System.EventHandler(this.UnloadButton_Click); 357 391 // 358 392 // refreshAutomaticallyCheckBox 359 393 // 360 394 this.refreshAutomaticallyCheckBox.AutoSize = true; 361 this.refreshAutomaticallyCheckBox.Location = new System.Drawing.Point( 30, 5);395 this.refreshAutomaticallyCheckBox.Location = new System.Drawing.Point(70, 3); 362 396 this.refreshAutomaticallyCheckBox.Name = "refreshAutomaticallyCheckBox"; 363 397 this.refreshAutomaticallyCheckBox.Size = new System.Drawing.Size(127, 17); … … 450 484 // RefreshableHiveJobView 451 485 // 452 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);453 486 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit; 487 this.Controls.Add(this.UnloadButton); 454 488 this.Controls.Add(this.searchButton); 455 489 this.Controls.Add(this.isPrivilegedCheckBox); … … 484 518 #endregion 485 519 486 private System.Windows.Forms.TabControl tabControl;487 520 private System.Windows.Forms.Button startButton; 488 521 private System.Windows.Forms.Button stopButton; … … 518 551 private MainForm.WindowsForms.ViewHost runCollectionViewHost; 519 552 private System.Windows.Forms.Button searchButton; 553 private MainForm.WindowsForms.DragOverTabControl tabControl; 554 private System.Windows.Forms.Button UnloadButton; 520 555 521 556 } -
branches/OaaS/HeuristicLab.Clients.Hive.JobManager/3.3/Views/RefreshableHiveJobView.cs
r8186 r9363 45 45 private ProgressView progressView; 46 46 private HiveResourceSelectorDialog hiveResourceSelectorDialog; 47 private bool SuppressEvents { get; set; } 48 private object runCollectionViewLocker = new object(); 47 49 48 50 public new RefreshableJob Content { … … 98 100 progressView = null; 99 101 } 102 DeregisterHiveExperimentEvents(); 103 DeregisterHiveTasksEvents(); 100 104 base.DeregisterContentEvents(); 101 105 } … … 109 113 } 110 114 111 private void RegisterHive JobEvents() {115 private void RegisterHiveTasksEvents() { 112 116 Content.HiveTasks.ItemsAdded += new CollectionItemsChangedEventHandler<HiveTask>(HiveTasks_ItemsAdded); 113 117 Content.HiveTasks.ItemsRemoved += new CollectionItemsChangedEventHandler<HiveTask>(HiveTasks_ItemsRemoved); 114 118 Content.HiveTasks.CollectionReset += new CollectionItemsChangedEventHandler<HiveTask>(HiveTasks_CollectionReset); 115 119 } 116 private void DeregisterHive JobEvents() {120 private void DeregisterHiveTasksEvents() { 117 121 Content.HiveTasks.ItemsAdded -= new CollectionItemsChangedEventHandler<HiveTask>(HiveTasks_ItemsAdded); 118 122 Content.HiveTasks.ItemsRemoved -= new CollectionItemsChangedEventHandler<HiveTask>(HiveTasks_ItemsRemoved); … … 122 126 protected override void OnContentChanged() { 123 127 base.OnContentChanged(); 124 if (Content == null) { 125 nameTextBox.Text = string.Empty; 126 executionTimeTextBox.Text = string.Empty; 127 resourceNamesTextBox.Text = string.Empty; 128 isPrivilegedCheckBox.Checked = false; 129 logView.Content = null; 130 refreshAutomaticallyCheckBox.Checked = false; 131 runCollectionViewHost.Content = null; 132 } else { 133 nameTextBox.Text = Content.Job.Name; 134 executionTimeTextBox.Text = Content.ExecutionTime.ToString(); 135 resourceNamesTextBox.Text = Content.Job.ResourceNames; 136 isPrivilegedCheckBox.Checked = Content.Job.IsPrivileged; 137 refreshAutomaticallyCheckBox.Checked = Content.RefreshAutomatically; 138 logView.Content = Content.Log; 139 runCollectionViewHost.Content = GetAllRunsFromJob(Content); 128 SuppressEvents = true; 129 try { 130 if (Content == null) { 131 nameTextBox.Text = string.Empty; 132 executionTimeTextBox.Text = string.Empty; 133 resourceNamesTextBox.Text = string.Empty; 134 isPrivilegedCheckBox.Checked = false; 135 refreshAutomaticallyCheckBox.Checked = false; 136 lock (runCollectionViewLocker) { 137 runCollectionViewHost.Content = null; 138 } 139 logView.Content = null; 140 jobsTreeView.Content = null; 141 hiveExperimentPermissionListView.Content = null; 142 stateLogViewHost.Content = null; 143 } else { 144 nameTextBox.Text = Content.Job.Name; 145 executionTimeTextBox.Text = Content.ExecutionTime.ToString(); 146 resourceNamesTextBox.Text = Content.Job.ResourceNames; 147 isPrivilegedCheckBox.Checked = Content.IsAllowedPrivileged; 148 refreshAutomaticallyCheckBox.Checked = Content.RefreshAutomatically; 149 logView.Content = Content.Log; 150 lock (runCollectionViewLocker) { 151 runCollectionViewHost.Content = GetAllRunsFromJob(Content); 152 } 153 } 154 } 155 finally { 156 SuppressEvents = false; 140 157 } 141 158 hiveExperimentPermissionListView.Content = null; // has to be filled by refresh button … … 149 166 } 150 167 168 protected override void OnLockedChanged() { 169 base.OnLockedChanged(); 170 executionTimeTextBox.Enabled = !Locked; 171 jobsTextBox.Enabled = !Locked; 172 calculatingTextBox.Enabled = !Locked; 173 finishedTextBox.Enabled = !Locked; 174 tabControl.Enabled = !Locked; 175 nameTextBox.Enabled = !Locked; 176 resourceNamesTextBox.Enabled = !Locked; 177 searchButton.Enabled = !Locked; 178 jobsTreeView.Enabled = !Locked; 179 isPrivilegedCheckBox.Enabled = !Locked; 180 refreshAutomaticallyCheckBox.Enabled = !Locked; 181 refreshButton.Enabled = !Locked; 182 UnloadButton.Enabled = !Locked; 183 startButton.Enabled = !Locked; 184 pauseButton.Enabled = !Locked; 185 stopButton.Enabled = !Locked; 186 resetButton.Enabled = !Locked; 187 } 188 151 189 protected override void SetEnabledStateOfControls() { 152 190 base.SetEnabledStateOfControls(); 153 executionTimeTextBox.Enabled = Content != null; 154 jobsTextBox.ReadOnly = true; 155 calculatingTextBox.ReadOnly = true; 156 finishedTextBox.ReadOnly = true; 157 158 if (Content != null) { 159 bool alreadyUploaded = Content.Id != Guid.Empty; 160 bool jobsLoaded = Content.HiveTasks != null && Content.HiveTasks.All(x => x.Task.Id != Guid.Empty); 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; 172 } 173 SetEnabledStateOfExecutableButtons(); 174 tabControl_SelectedIndexChanged(this, EventArgs.Empty); // ensure sharing tabpage is disabled 191 if (!Locked) { 192 executionTimeTextBox.Enabled = Content != null; 193 jobsTextBox.ReadOnly = true; 194 calculatingTextBox.ReadOnly = true; 195 finishedTextBox.ReadOnly = true; 196 197 if (Content != null) { 198 bool alreadyUploaded = Content.Id != Guid.Empty; 199 bool jobsLoaded = Content.HiveTasks != null && Content.HiveTasks.All(x => x.Task.Id != Guid.Empty); 200 tabControl.Enabled = !Content.IsProgressing; 201 202 this.nameTextBox.ReadOnly = !Content.IsControllable || Content.ExecutionState != ExecutionState.Prepared || alreadyUploaded || Content.IsProgressing; 203 this.resourceNamesTextBox.ReadOnly = !Content.IsControllable || Content.ExecutionState != ExecutionState.Prepared || alreadyUploaded || Content.IsProgressing; 204 this.searchButton.Enabled = Content.IsControllable && Content.ExecutionState == ExecutionState.Prepared && !alreadyUploaded && !Content.IsProgressing; 205 this.jobsTreeView.ReadOnly = !Content.IsControllable || Content.ExecutionState != ExecutionState.Prepared || alreadyUploaded || Content.IsProgressing; 206 207 this.isPrivilegedCheckBox.Enabled = HiveClient.Instance.IsAllowedPrivileged && Content.IsControllable && !(Content.ExecutionState != ExecutionState.Prepared || alreadyUploaded) && !Content.IsProgressing; 208 this.refreshAutomaticallyCheckBox.Enabled = Content.IsControllable && alreadyUploaded && jobsLoaded && Content.ExecutionState == ExecutionState.Started && !Content.IsProgressing; 209 this.refreshButton.Enabled = Content.IsDownloadable && alreadyUploaded && !Content.IsProgressing; 210 211 this.UnloadButton.Enabled = Content.HiveTasks != null && Content.HiveTasks.Count > 0 && alreadyUploaded && !Content.IsProgressing; 212 } 213 SetEnabledStateOfExecutableButtons(); 214 tabControl_SelectedIndexChanged(this, EventArgs.Empty); // ensure sharing tabpage is disabled 215 } 175 216 } 176 217 … … 185 226 #region Content Events 186 227 void Content_TaskReceived(object sender, EventArgs e) { 187 runCollectionViewHost.Content = GetAllRunsFromJob(Content); 228 lock (runCollectionViewLocker) { 229 runCollectionViewHost.Content = GetAllRunsFromJob(Content); 230 } 188 231 } 189 232 … … 272 315 if (Content != null && Content.HiveTasks != null) { 273 316 jobsTreeView.Content = Content.HiveTasks; 274 RegisterHive JobEvents();317 RegisterHiveTasksEvents(); 275 318 } else { 276 319 jobsTreeView.Content = null; … … 281 324 282 325 void Content_Loaded(object sender, EventArgs e) { 283 runCollectionViewHost.Content = GetAllRunsFromJob(Content); 326 lock (runCollectionViewLocker) { 327 runCollectionViewHost.Content = GetAllRunsFromJob(Content); 328 } 284 329 } 285 330 … … 329 374 Invoke(new EventHandler(Content_IsAllowedPrivilegedChanged), sender, e); 330 375 else { 376 isPrivilegedCheckBox.Checked = Content.IsAllowedPrivileged; 331 377 SetEnabledStateOfControls(); 332 378 } … … 357 403 } 358 404 resourceNamesTextBox.Text = sb.ToString(); 405 if (Content.Job.ResourceNames != resourceNamesTextBox.Text) 406 Content.Job.ResourceNames = resourceNamesTextBox.Text; 359 407 } 360 408 } … … 416 464 417 465 private void nameTextBox_Validated(object sender, EventArgs e) { 418 if ( Content.Job.Name != nameTextBox.Text)466 if (!SuppressEvents && Content.Job != null && Content.Job.Name != nameTextBox.Text) 419 467 Content.Job.Name = nameTextBox.Text; 420 468 } 421 469 422 470 private void resourceNamesTextBox_Validated(object sender, EventArgs e) { 423 if ( Content.Job.ResourceNames != resourceNamesTextBox.Text)471 if (!SuppressEvents && Content.Job != null && Content.Job.ResourceNames != resourceNamesTextBox.Text) 424 472 Content.Job.ResourceNames = resourceNamesTextBox.Text; 425 473 } 426 474 427 475 private void refreshAutomaticallyCheckBox_CheckedChanged(object sender, EventArgs e) { 428 if (Content != null ) Content.RefreshAutomatically = refreshAutomaticallyCheckBox.Checked;429 } 430 431 private void isPrivilegedCheckBox_ Validated(object sender, EventArgs e) {432 if (Content != null ) Content.Job.IsPrivileged = isPrivilegedCheckBox.Checked;476 if (Content != null && !SuppressEvents) Content.RefreshAutomatically = refreshAutomaticallyCheckBox.Checked; 477 } 478 479 private void isPrivilegedCheckBox_CheckChanged(object sender, EventArgs e) { 480 if (Content != null && !SuppressEvents) Content.IsAllowedPrivileged = isPrivilegedCheckBox.Checked; 433 481 } 434 482 … … 505 553 if (e.Effect.HasFlag(DragDropEffects.Copy)) { 506 554 newOptimizer = (IOptimizer)optimizer.Clone(); 555 newOptimizer.Runs.Clear(); 507 556 } else { 508 557 newOptimizer = optimizer; … … 529 578 private RunCollection GetAllRunsFromJob(RefreshableJob job) { 530 579 if (job != null) { 531 RunCollection runs = new RunCollection() ;580 RunCollection runs = new RunCollection() { OptimizerName = job.ItemName }; 532 581 533 582 foreach (HiveTask subTask in job.HiveTasks) { 534 583 if (subTask is OptimizerHiveTask) { 535 584 OptimizerHiveTask ohTask = subTask as OptimizerHiveTask; 536 runs.AddRange(ohTask.ItemTask.Item.Runs); 585 ohTask.ExecuteReadActionOnItemTask(new Action(delegate() { 586 runs.AddRange(ohTask.ItemTask.Item.Runs); 587 })); 537 588 } 538 589 } … … 542 593 } 543 594 } 595 596 private void UnloadButton_Click(object sender, EventArgs e) { 597 Content.Unload(); 598 runCollectionViewHost.Content = null; 599 stateLogViewHost.Content = null; 600 hiveExperimentPermissionListView.Content = null; 601 jobsTreeView.Content = null; 602 603 SetEnabledStateOfControls(); 604 } 544 605 } 545 606 }
Note: See TracChangeset
for help on using the changeset viewer.