Free cookie consent management tool by TermsFeed Policy Generator

source: branches/3.3-Hive/sources/HeuristicLab.Hive/HeuristicLab.Hive.Experiment.Views/3.3/JobConfigView.cs @ 4368

Last change on this file since 4368 was 4368, checked in by cneumuel, 14 years ago
  • created HiveClient which shows an overview over all submitted HiveExperiments
  • its possible to download all submitted HiveExperiments including results
  • Experiments are now sent as a whole to the Hive and the Hive-Slaves take care of creating child-jobs (if necessary). The parent job is then paused and will be reactivated when all child-jobs are finished
  • WcfService-Clients are now consistently managed by WcfServicePool which allows to use IDisposable-Pattern and always keeps exactly one proxy-object until all callers disposed them.
  • created ProgressView which is able to lock a View and display progress of an action. It also allows to simulate progress if no progress-information is available so that users don't get too nervous while waiting.
File size: 3.7 KB
Line 
1using System;
2using System.Collections.Generic;
3using System.ComponentModel;
4using System.Drawing;
5using System.Data;
6using System.Linq;
7using System.Text;
8using System.Windows.Forms;
9using HeuristicLab.Core.Views;
10using HeuristicLab.MainForm;
11using HeuristicLab.Hive.JobBase;
12using HeuristicLab.Persistence.Default.Xml;
13using System.IO;
14using HeuristicLab.Hive.Experiment.Jobs;
15
16namespace HeuristicLab.Hive.Experiment.Views {
17  [View("JobConfigView")]
18  [Content(typeof(IJob), true)]
19  public partial class JobConfigView : ItemView {
20    public new IJob Content {
21      get { return (IJob)base.Content; }
22      set {
23        if (base.Content != value) {
24          base.Content = value;
25        }
26      }
27    }
28
29    public JobConfigView() {
30      InitializeComponent();
31    }
32
33    protected override void OnContentChanged() {
34      base.OnContentChanged();
35      if (Content != null) {
36        this.optimizerTypeTextBox.Text = Content.Name;
37        this.memoryNeededTextBox.Text = Content.MemoryNeeded.ToString();
38        this.coresNeededTextBox.Text = Content.CoresNeeded.ToString();
39        this.computeInParallelCheckBox.Checked = Content.ComputeInParallel;
40        this.jobConfigListView.Content = new JobList(Content.ChildJobs);
41        SetEnabledStateOfControls();
42      }
43    }
44
45    protected override void RegisterContentEvents() {
46      base.RegisterContentEvents();
47    }
48
49    protected override void DeregisterContentEvents() {
50      base.DeregisterContentEvents();
51    }
52
53    protected override void SetEnabledStateOfControls() {
54      if (InvokeRequired) {
55        this.InvokeIfRequired(c => { SetEnabledStateOfControls(); });
56      } else {
57        base.SetEnabledStateOfControls();
58        this.optimizerTypeTextBox.ReadOnly = true;
59        this.computeInParallelCheckBox.Enabled = this.ReadOnly;
60        this.coresNeededTextBox.ReadOnly = this.ReadOnly;
61        this.memoryNeededTextBox.ReadOnly = this.ReadOnly;
62
63        if (Content != null) {
64          if (Content.IsParallelizable) {
65            this.computeInParallelCheckBox.Enabled = true;
66          } else {
67            this.computeInParallelCheckBox.Enabled = false;
68            this.computeInParallelCheckBox.Checked = false;
69          }
70        }
71
72        if (this.computeInParallelCheckBox.Checked) {
73          if (!tabControl.TabPages.ContainsKey(childJobsTabPage.Name)) {
74            tabControl.TabPages.Add(childJobsTabPage);
75          }
76        } else {
77          if (tabControl.TabPages.ContainsKey(childJobsTabPage.Name)) {
78            tabControl.TabPages.Remove(childJobsTabPage);
79          }
80        }
81      }
82    }
83
84    private void UpdateContent(object sender, EventArgs e) {
85      if (InvokeRequired)
86        Invoke(new EventHandler(UpdateContent), sender, e);
87      else {
88        if (Content != null) {
89          Content.CoresNeeded = int.Parse(this.coresNeededTextBox.Text);
90          Content.MemoryNeeded = int.Parse(this.memoryNeededTextBox.Text);
91          Content.ComputeInParallel = computeInParallelCheckBox.Checked;
92        }
93      }
94    }
95   
96    private void coresNeededTextBox_Validated(object sender, EventArgs e) {
97      UpdateContent(sender, e);
98    }
99
100    private void coresNeededTextBox_Validating(object sender, CancelEventArgs e) {
101    }
102
103    private void memoryNeededTextBox_Validated(object sender, EventArgs e) {
104      UpdateContent(sender, e);
105    }
106
107    private void memoryNeededTextBox_Validating(object sender, CancelEventArgs e) {
108    }
109
110    void computeInParallelCheckBox_CheckedChanged(object sender, System.EventArgs e) {
111      UpdateContent(sender, e);
112      SetEnabledStateOfControls();
113    }
114
115  }
116}
Note: See TracBrowser for help on using the repository browser.