Free cookie consent management tool by TermsFeed Policy Generator

source: stable/HeuristicLab.Clients.Hive.JobManager/3.3/Views/RefreshableHiveJobView.cs @ 16654

Last change on this file since 16654 was 15584, checked in by swagner, 7 years ago

#2640: Updated year of copyrights in license headers on stable

File size: 23.0 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2018 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
22using System;
23using System.ComponentModel;
24using System.Linq;
25using System.Text;
26using System.Threading;
27using System.Threading.Tasks;
28using System.Windows.Forms;
29using HeuristicLab.Collections;
30using HeuristicLab.Common;
31using HeuristicLab.Core;
32using HeuristicLab.MainForm;
33using HeuristicLab.MainForm.WindowsForms;
34using HeuristicLab.Optimization;
35using HeuristicLab.PluginInfrastructure;
36
37namespace HeuristicLab.Clients.Hive.JobManager.Views {
38  /// <summary>
39  /// The base class for visual representations of items.
40  /// </summary>
41  [View("Hive Job View")]
42  [Content(typeof(RefreshableJob), true)]
43  public partial class RefreshableHiveJobView : HeuristicLab.Core.Views.ItemView {
44    private HiveResourceSelectorDialog hiveResourceSelectorDialog;
45    private bool SuppressEvents { get; set; }
46    private object runCollectionViewLocker = new object();
47
48    public new RefreshableJob Content {
49      get { return (RefreshableJob)base.Content; }
50      set { base.Content = value; }
51    }
52
53    /// <summary>
54    /// Initializes a new instance of <see cref="ItemBaseView"/>.
55    /// </summary>
56    public RefreshableHiveJobView() {
57      InitializeComponent();
58    }
59
60    protected override void RegisterContentEvents() {
61      base.RegisterContentEvents();
62      Content.RefreshAutomaticallyChanged += new EventHandler(Content_RefreshAutomaticallyChanged);
63      Content.JobChanged += new EventHandler(Content_HiveExperimentChanged);
64      Content.IsControllableChanged += new EventHandler(Content_IsControllableChanged);
65      Content.JobStatisticsChanged += new EventHandler(Content_JobStatisticsChanged);
66      Content.ExceptionOccured += new EventHandler<EventArgs<Exception>>(Content_ExceptionOccured);
67      Content.StateLogListChanged += new EventHandler(Content_StateLogListChanged);
68      Content.HiveTasksChanged += new EventHandler(Content_HiveTasksChanged);
69      Content.ExecutionStateChanged += new EventHandler(Content_ExecutionStateChanged);
70      Content.ExecutionTimeChanged += new EventHandler(Content_ExecutionTimeChanged);
71      Content.Loaded += new EventHandler(Content_Loaded);
72      Content.TaskReceived += new EventHandler(Content_TaskReceived);
73      MainFormManager.GetMainForm<HeuristicLab.MainForm.WindowsForms.MainForm>().AddOperationProgressToView(this, Content.Progress);
74    }
75
76    protected override void DeregisterContentEvents() {
77      Content.RefreshAutomaticallyChanged -= new EventHandler(Content_RefreshAutomaticallyChanged);
78      Content.JobChanged -= new EventHandler(Content_HiveExperimentChanged);
79      Content.IsControllableChanged -= new EventHandler(Content_IsControllableChanged);
80      Content.JobStatisticsChanged -= new EventHandler(Content_JobStatisticsChanged);
81      Content.ExceptionOccured -= new EventHandler<EventArgs<Exception>>(Content_ExceptionOccured);
82      Content.StateLogListChanged -= new EventHandler(Content_StateLogListChanged);
83      Content.HiveTasksChanged -= new EventHandler(Content_HiveTasksChanged);
84      Content.ExecutionStateChanged -= new EventHandler(Content_ExecutionStateChanged);
85      Content.ExecutionTimeChanged -= new EventHandler(Content_ExecutionTimeChanged);
86      Content.Loaded -= new EventHandler(Content_Loaded);
87      Content.TaskReceived -= new EventHandler(Content_TaskReceived);
88      MainFormManager.GetMainForm<HeuristicLab.MainForm.WindowsForms.MainForm>().RemoveOperationProgressFromView(this, false);
89      DeregisterHiveExperimentEvents();
90      DeregisterHiveTasksEvents();
91      base.DeregisterContentEvents();
92    }
93
94    private void RegisterHiveExperimentEvents() {
95      Content.Job.PropertyChanged += new PropertyChangedEventHandler(HiveExperiment_PropertyChanged);
96    }
97
98    private void DeregisterHiveExperimentEvents() {
99      Content.Job.PropertyChanged -= new PropertyChangedEventHandler(HiveExperiment_PropertyChanged);
100    }
101
102    private void RegisterHiveTasksEvents() {
103      Content.HiveTasks.ItemsAdded += new CollectionItemsChangedEventHandler<HiveTask>(HiveTasks_ItemsAdded);
104      Content.HiveTasks.ItemsRemoved += new CollectionItemsChangedEventHandler<HiveTask>(HiveTasks_ItemsRemoved);
105      Content.HiveTasks.CollectionReset += new CollectionItemsChangedEventHandler<HiveTask>(HiveTasks_CollectionReset);
106    }
107    private void DeregisterHiveTasksEvents() {
108      Content.HiveTasks.ItemsAdded -= new CollectionItemsChangedEventHandler<HiveTask>(HiveTasks_ItemsAdded);
109      Content.HiveTasks.ItemsRemoved -= new CollectionItemsChangedEventHandler<HiveTask>(HiveTasks_ItemsRemoved);
110      Content.HiveTasks.CollectionReset -= new CollectionItemsChangedEventHandler<HiveTask>(HiveTasks_CollectionReset);
111    }
112
113    protected override void OnContentChanged() {
114      base.OnContentChanged();
115      SuppressEvents = true;
116      try {
117        if (Content == null) {
118          nameTextBox.Text = string.Empty;
119          executionTimeTextBox.Text = string.Empty;
120          resourceNamesTextBox.Text = string.Empty;
121          refreshAutomaticallyCheckBox.Checked = false;
122          lock (runCollectionViewLocker) {
123            runCollectionViewHost.Content = null;
124          }
125          logView.Content = null;
126          jobsTreeView.Content = null;
127          hiveExperimentPermissionListView.Content = null;
128          stateLogViewHost.Content = null;
129        } else {
130          nameTextBox.Text = Content.Job.Name;
131          executionTimeTextBox.Text = Content.ExecutionTime.ToString();
132          resourceNamesTextBox.Text = Content.Job.ResourceNames;
133          refreshAutomaticallyCheckBox.Checked = Content.RefreshAutomatically;
134          logView.Content = Content.Log;
135          lock (runCollectionViewLocker) {
136            runCollectionViewHost.Content = GetAllRunsFromJob(Content);
137          }
138        }
139      }
140      finally {
141        SuppressEvents = false;
142      }
143      hiveExperimentPermissionListView.Content = null; // has to be filled by refresh button
144      Content_JobStatisticsChanged(this, EventArgs.Empty);
145      Content_HiveExperimentChanged(this, EventArgs.Empty);
146      Content_HiveTasksChanged(this, EventArgs.Empty);
147      Content_StateLogListChanged(this, EventArgs.Empty);
148      HiveExperiment_PropertyChanged(this, new PropertyChangedEventArgs("Id"));
149      SetEnabledStateOfControls();
150    }
151
152    protected override void OnLockedChanged() {
153      base.OnLockedChanged();
154      executionTimeTextBox.Enabled = !Locked;
155      jobsTextBox.Enabled = !Locked;
156      calculatingTextBox.Enabled = !Locked;
157      finishedTextBox.Enabled = !Locked;
158      tabControl.Enabled = !Locked;
159      nameTextBox.Enabled = !Locked;
160      resourceNamesTextBox.Enabled = !Locked;
161      searchButton.Enabled = !Locked;
162      jobsTreeView.Enabled = !Locked;
163      refreshAutomaticallyCheckBox.Enabled = !Locked;
164      refreshButton.Enabled = !Locked;
165      UnloadButton.Enabled = !Locked;
166      startButton.Enabled = !Locked;
167      pauseButton.Enabled = !Locked;
168      stopButton.Enabled = !Locked;
169    }
170
171    protected override void SetEnabledStateOfControls() {
172      base.SetEnabledStateOfControls();
173      if (!Locked) {
174        executionTimeTextBox.Enabled = Content != null;
175        jobsTextBox.ReadOnly = true;
176        calculatingTextBox.ReadOnly = true;
177        finishedTextBox.ReadOnly = true;
178
179        if (Content != null) {
180          bool alreadyUploaded = Content.Id != Guid.Empty;
181          bool jobsLoaded = Content.HiveTasks != null && Content.HiveTasks.All(x => x.Task.Id != Guid.Empty);
182          tabControl.Enabled = !Content.IsProgressing;
183
184          this.nameTextBox.ReadOnly = !Content.IsControllable || Content.ExecutionState != ExecutionState.Prepared || alreadyUploaded || Content.IsProgressing;
185          this.resourceNamesTextBox.ReadOnly = !Content.IsControllable || Content.ExecutionState != ExecutionState.Prepared || alreadyUploaded || Content.IsProgressing;
186          this.searchButton.Enabled = Content.IsControllable && Content.ExecutionState == ExecutionState.Prepared && !alreadyUploaded && !Content.IsProgressing;
187          this.jobsTreeView.ReadOnly = !Content.IsControllable || Content.ExecutionState != ExecutionState.Prepared || alreadyUploaded || Content.IsProgressing;
188
189          this.refreshAutomaticallyCheckBox.Enabled = Content.IsControllable && alreadyUploaded && jobsLoaded && (Content.ExecutionState == ExecutionState.Started || Content.ExecutionState == ExecutionState.Paused) && !Content.IsProgressing;
190          this.refreshButton.Enabled = Content.IsDownloadable && alreadyUploaded && !Content.IsProgressing;
191
192          this.UnloadButton.Enabled = Content.HiveTasks != null && Content.HiveTasks.Count > 0 && alreadyUploaded && !Content.IsProgressing;
193        }
194        SetEnabledStateOfExecutableButtons();
195        tabControl_SelectedIndexChanged(this, EventArgs.Empty); // ensure sharing tabpage is disabled
196      }
197    }
198
199    protected override void OnClosed(FormClosedEventArgs e) {
200      if (Content != null) {
201        if (Content.RefreshAutomatically)
202          Content.StopResultPolling();
203      }
204      base.OnClosed(e);
205    }
206
207    #region Content Events
208    void Content_TaskReceived(object sender, EventArgs e) {
209      lock (runCollectionViewLocker) {
210        runCollectionViewHost.Content = GetAllRunsFromJob(Content);
211      }
212    }
213
214    private void HiveTasks_ItemsAdded(object sender, CollectionItemsChangedEventArgs<HiveTask> e) {
215      if (InvokeRequired)
216        Invoke(new CollectionItemsChangedEventHandler<HiveTask>(HiveTasks_ItemsAdded), sender, e);
217      else {
218        SetEnabledStateOfControls();
219      }
220    }
221
222    private void HiveTasks_ItemsRemoved(object sender, CollectionItemsChangedEventArgs<HiveTask> e) {
223      if (InvokeRequired)
224        Invoke(new CollectionItemsChangedEventHandler<HiveTask>(HiveTasks_ItemsRemoved), sender, e);
225      else {
226        SetEnabledStateOfControls();
227      }
228    }
229
230    private void HiveTasks_CollectionReset(object sender, CollectionItemsChangedEventArgs<HiveTask> e) {
231      if (InvokeRequired)
232        Invoke(new CollectionItemsChangedEventHandler<HiveTask>(HiveTasks_CollectionReset), sender, e);
233      else {
234        SetEnabledStateOfControls();
235      }
236    }
237
238    private void Content_ExecutionStateChanged(object sender, EventArgs e) {
239      if (InvokeRequired)
240        Invoke(new EventHandler(Content_ExecutionStateChanged), sender, e);
241      else
242        SetEnabledStateOfControls();
243    }
244
245    private void Content_ExecutionTimeChanged(object sender, EventArgs e) {
246      if (InvokeRequired)
247        Invoke(new EventHandler(Content_ExecutionTimeChanged), sender, e);
248      else
249        executionTimeTextBox.Text = Content.ExecutionTime.ToString();
250    }
251    private void Content_RefreshAutomaticallyChanged(object sender, EventArgs e) {
252      if (InvokeRequired)
253        Invoke(new EventHandler(Content_RefreshAutomaticallyChanged), sender, e);
254      else {
255        refreshAutomaticallyCheckBox.Checked = Content.RefreshAutomatically;
256        SetEnabledStateOfControls();
257      }
258    }
259    private void Content_HiveTasksChanged(object sender, EventArgs e) {
260      if (InvokeRequired)
261        Invoke(new EventHandler(Content_HiveTasksChanged), sender, e);
262      else {
263        if (Content != null && Content.HiveTasks != null) {
264          jobsTreeView.Content = Content.HiveTasks;
265          RegisterHiveTasksEvents();
266        } else {
267          jobsTreeView.Content = null;
268        }
269        SetEnabledStateOfControls();
270      }
271    }
272
273    void Content_Loaded(object sender, EventArgs e) {
274      lock (runCollectionViewLocker) {
275        runCollectionViewHost.Content = GetAllRunsFromJob(Content);
276      }
277    }
278
279    private void Content_HiveExperimentChanged(object sender, EventArgs e) {
280      if (Content != null && Content.Job != null) {
281        RegisterHiveExperimentEvents();
282      }
283    }
284    private void Content_IsControllableChanged(object sender, EventArgs e) {
285      SetEnabledStateOfControls();
286    }
287    private void Content_JobStatisticsChanged(object sender, EventArgs e) {
288      if (InvokeRequired)
289        Invoke(new EventHandler(Content_JobStatisticsChanged), sender, e);
290      else {
291        if (Content != null) {
292          jobsTextBox.Text = (Content.Job.JobCount - Content.Job.CalculatingCount - Content.Job.FinishedCount).ToString();
293          calculatingTextBox.Text = Content.Job.CalculatingCount.ToString();
294          finishedTextBox.Text = Content.Job.FinishedCount.ToString();
295        } else {
296          jobsTextBox.Text = "0";
297          calculatingTextBox.Text = "0";
298          finishedTextBox.Text = "0";
299        }
300      }
301    }
302    private void Content_ExceptionOccured(object sender, EventArgs<Exception> e) {
303      if (InvokeRequired)
304        Invoke(new EventHandler<EventArgs<Exception>>(Content_ExceptionOccured), sender, e);
305      else {
306        //don't show the error dialog when downloading tasks, the HiveClient will throw an exception and the dialog will be shown then
307        if (sender.GetType() != typeof(ConcurrentTaskDownloader<ItemTask>) && sender.GetType() != typeof(TaskDownloader)) {
308          ErrorHandling.ShowErrorDialog(this, e.Value);
309        }
310      }
311    }
312    private void Content_StateLogListChanged(object sender, EventArgs e) {
313      if (InvokeRequired)
314        Invoke(new EventHandler(Content_StateLogListChanged), sender, e);
315      else {
316        UpdateStateLogList();
317      }
318    }
319
320    private void UpdateStateLogList() {
321      if (Content != null && this.Content.Job != null) {
322        stateLogViewHost.Content = this.Content.StateLogList;
323      } else {
324        stateLogViewHost.Content = null;
325      }
326    }
327
328    private void HiveExperiment_PropertyChanged(object sender, PropertyChangedEventArgs e) {
329      if (this.Content != null && e.PropertyName == "Id") this.hiveExperimentPermissionListView.HiveExperimentId = this.Content.Job.Id;
330    }
331    #endregion
332
333    #region Control events
334    private void searchButton_Click(object sender, EventArgs e) {
335      if (hiveResourceSelectorDialog == null)
336        hiveResourceSelectorDialog = new HiveResourceSelectorDialog();
337      if (hiveResourceSelectorDialog.ShowDialog(this) == DialogResult.OK) {
338        StringBuilder sb = new StringBuilder();
339        foreach (Resource resource in hiveResourceSelectorDialog.GetSelectedResources()) {
340          sb.Append(resource.Name);
341          sb.Append(";");
342        }
343        resourceNamesTextBox.Text = sb.ToString();
344        if (Content.Job.ResourceNames != resourceNamesTextBox.Text)
345          Content.Job.ResourceNames = resourceNamesTextBox.Text;
346      }
347    }
348
349    private void startButton_Click(object sender, EventArgs e) {
350      if (nameTextBox.Text.Trim() == string.Empty) {
351        MessageBox.Show("Please enter a name for the job before uploading it!", "HeuristicLab Hive Job Manager", MessageBoxButtons.OK, MessageBoxIcon.Information);
352      } else if (Content.ExecutionState == ExecutionState.Paused) {
353        var task = System.Threading.Tasks.Task.Factory.StartNew(ResumeJobAsync, Content);
354        task.ContinueWith((t) => {
355          Content.Progress.Finish();
356          MessageBox.Show("An error occured resuming the job. See the log for more information.", "HeuristicLab Hive Job Manager", MessageBoxButtons.OK, MessageBoxIcon.Error);
357          Content.Log.LogException(t.Exception);
358        }, TaskContinuationOptions.OnlyOnFaulted);
359      } else {
360        HiveClient.StartJob((Exception ex) => ErrorHandling.ShowErrorDialog(this, "Start failed.", ex), Content, new CancellationToken());
361      }
362    }
363
364    private void pauseButton_Click(object sender, EventArgs e) {
365      var task = System.Threading.Tasks.Task.Factory.StartNew(PauseJobAsync, Content);
366      task.ContinueWith((t) => {
367        Content.Progress.Finish();
368        MessageBox.Show("An error occured pausing the job. See the log for more information.", "HeuristicLab Hive Job Manager", MessageBoxButtons.OK, MessageBoxIcon.Error);
369        Content.Log.LogException(t.Exception);
370      }, TaskContinuationOptions.OnlyOnFaulted);
371    }
372
373    private void stopButton_Click(object sender, EventArgs e) {
374      var task = System.Threading.Tasks.Task.Factory.StartNew(StopJobAsync, Content);
375      task.ContinueWith((t) => {
376        Content.Progress.Finish();
377        MessageBox.Show("An error occured stopping the job. See the log for more information.", "HeuristicLab Hive Job Manager", MessageBoxButtons.OK, MessageBoxIcon.Error);
378        Content.Log.LogException(t.Exception);
379      }, TaskContinuationOptions.OnlyOnFaulted);
380    }
381
382    private void PauseJobAsync(object job) {
383      Content.Progress.Start("Pausing job...");
384      HiveClient.PauseJob((RefreshableJob)job);
385      Content.Progress.Finish();
386    }
387
388    private void StopJobAsync(object job) {
389      Content.Progress.Start("Stopping job...");
390      HiveClient.StopJob((RefreshableJob)job);
391      Content.Progress.Finish();
392    }
393
394    private void ResumeJobAsync(object job) {
395      Content.Progress.Start("Resuming job...");
396      HiveClient.ResumeJob((RefreshableJob)job);
397      Content.Progress.Finish();
398    }
399
400    private void nameTextBox_Validated(object sender, EventArgs e) {
401      if (!SuppressEvents && Content.Job != null && Content.Job.Name != nameTextBox.Text)
402        Content.Job.Name = nameTextBox.Text;
403    }
404
405    private void resourceNamesTextBox_Validated(object sender, EventArgs e) {
406      if (!SuppressEvents && Content.Job != null && Content.Job.ResourceNames != resourceNamesTextBox.Text)
407        Content.Job.ResourceNames = resourceNamesTextBox.Text;
408    }
409
410    private void refreshAutomaticallyCheckBox_CheckedChanged(object sender, EventArgs e) {
411      if (Content != null && !SuppressEvents) Content.RefreshAutomatically = refreshAutomaticallyCheckBox.Checked;
412    }
413
414    private void refreshButton_Click(object sender, EventArgs e) {
415      var invoker = new Action<RefreshableJob>(HiveClient.LoadJob);
416      invoker.BeginInvoke(Content, (ar) => {
417        try {
418          invoker.EndInvoke(ar);
419        }
420        catch (Exception ex) {
421          ThreadPool.QueueUserWorkItem(delegate(object exception) { ErrorHandling.ShowErrorDialog(this, (Exception)exception); }, ex);
422        }
423      }, null);
424    }
425
426    private void refreshPermissionsButton_Click(object sender, EventArgs e) {
427      if (this.Content.Job.Id == Guid.Empty) {
428        MessageBox.Show("You have to upload the Job first before you can share it.", "HeuristicLab Hive Job Manager", MessageBoxButtons.OK, MessageBoxIcon.Information);
429      } else {
430        hiveExperimentPermissionListView.Content = HiveClient.GetJobPermissions(this.Content.Job.Id);
431      }
432    }
433    #endregion
434
435    #region Helpers
436    private void SetEnabledStateOfExecutableButtons() {
437      if (Content == null) {
438        startButton.Enabled = pauseButton.Enabled = stopButton.Enabled = false;
439      } else {
440        startButton.Enabled = Content.IsControllable && Content.HiveTasks != null && Content.HiveTasks.Count > 0 && (Content.ExecutionState == ExecutionState.Prepared || Content.ExecutionState == ExecutionState.Paused) && !Content.IsProgressing;
441        pauseButton.Enabled = Content.IsControllable && Content.ExecutionState == ExecutionState.Started && !Content.IsProgressing;
442        stopButton.Enabled = Content.IsControllable && (Content.ExecutionState == ExecutionState.Started || Content.ExecutionState == ExecutionState.Paused) && !Content.IsProgressing;
443      }
444    }
445    #endregion
446
447    #region Drag & Drop
448    private void jobsTreeView_DragOver(object sender, DragEventArgs e) {
449      jobsTreeView_DragEnter(sender, e);
450    }
451
452    private void jobsTreeView_DragEnter(object sender, DragEventArgs e) {
453      e.Effect = DragDropEffects.None;
454      var obj = (IDeepCloneable)e.Data.GetData(Constants.DragDropDataFormat);
455
456      Type objType = obj.GetType();
457      if (ItemTask.IsTypeSupported(objType)) {
458        if (Content.Id != Guid.Empty) e.Effect = DragDropEffects.None;
459        else if ((e.KeyState & 32) == 32) e.Effect = DragDropEffects.Link;  // ALT key
460        else if (e.AllowedEffect.HasFlag(DragDropEffects.Copy)) e.Effect = DragDropEffects.Copy;
461      }
462    }
463
464    private void jobsTreeView_DragDrop(object sender, DragEventArgs e) {
465      if (e.Effect != DragDropEffects.None) {
466        var obj = (IItem)e.Data.GetData(Constants.DragDropDataFormat);
467
468        IItem newObj = null;
469        if (e.Effect.HasFlag(DragDropEffects.Copy)) {
470          newObj = (IItem)obj.Clone();
471        } else {
472          newObj = obj;
473        }
474
475        //IOptimizer and IExecutables need some special care
476        if (newObj is IOptimizer) {
477          ((IOptimizer)newObj).Runs.Clear();
478        }
479        if (newObj is IExecutable) {
480          IExecutable exec = (IExecutable)newObj;
481          if (exec.ExecutionState != ExecutionState.Prepared) {
482            exec.Prepare();
483          }
484        }
485
486        ItemTask hiveTask = ItemTask.GetItemTaskForItem(newObj);
487        Content.HiveTasks.Add(hiveTask.CreateHiveTask());
488      }
489    }
490    #endregion
491
492    private void tabControl_SelectedIndexChanged(object sender, EventArgs e) {
493      if (tabControl.SelectedTab == permissionTabPage) {
494        if (!Content.IsSharable) {
495          MessageBox.Show("Unable to load permissions. You have insufficient access privileges.", "HeuristicLab Hive Job Manager", MessageBoxButtons.OK, MessageBoxIcon.Information);
496          tabControl.SelectedTab = tasksTabPage;
497        }
498      }
499    }
500
501    private RunCollection GetAllRunsFromJob(RefreshableJob job) {
502      if (job != null) {
503        RunCollection runs = new RunCollection() { OptimizerName = job.ItemName };
504
505        foreach (HiveTask subTask in job.HiveTasks) {
506          if (subTask is OptimizerHiveTask) {
507            OptimizerHiveTask ohTask = subTask as OptimizerHiveTask;
508            ohTask.ExecuteReadActionOnItemTask(new Action(delegate() {
509              runs.AddRange(ohTask.ItemTask.Item.Runs);
510            }));
511          }
512        }
513        return runs;
514      } else {
515        return null;
516      }
517    }
518
519    private void UnloadButton_Click(object sender, EventArgs e) {
520      Content.Unload();
521      runCollectionViewHost.Content = null;
522      stateLogViewHost.Content = null;
523      hiveExperimentPermissionListView.Content = null;
524      jobsTreeView.Content = null;
525
526      SetEnabledStateOfControls();
527    }
528  }
529}
Note: See TracBrowser for help on using the repository browser.