Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
02/18/13 10:34:23 (12 years ago)
Author:
ascheibe
Message:

#2005 merged Hive Job Unloading branch back into trunk

Location:
trunk/sources
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources

  • trunk/sources/HeuristicLab.Clients.Hive.JobManager/3.3/Views/HiveJobManagerView.cs

    r7259 r9219  
    5454      Content.Refreshing += new EventHandler(Content_Refreshing);
    5555      Content.Refreshed += new EventHandler(Content_Refreshed);
    56       Content.HiveExperimentsChanged += new EventHandler(Content_HiveExperimentsChanged);
    57 
     56      Content.HiveJobsChanged += new EventHandler(Content_HiveJobsChanged);
    5857    }
    5958
     
    6160      Content.Refreshing -= new EventHandler(Content_Refreshing);
    6261      Content.Refreshed -= new EventHandler(Content_Refreshed);
    63       Content.HiveExperimentsChanged -= new EventHandler(Content_HiveExperimentsChanged);
     62      Content.HiveJobsChanged -= new EventHandler(Content_HiveJobsChanged);
    6463      base.DeregisterContentEvents();
    6564    }
     
    123122
    124123    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           }
     124      if (Content.Jobs.Any(x => x.IsProgressing)) {
     125        MessageBox.Show("The Hive Job Manager can only be closed after all down/uploads are finished. ", "HeuristicLab Hive Job Manager", MessageBoxButtons.OK, MessageBoxIcon.Information);
     126        e.Cancel = true;
     127      } else {
     128        base.OnClosing(e);
     129        if (Content != null && Content.Jobs != null) {
     130          Content.Jobs.ItemsRemoved -= new CollectionItemsChangedEventHandler<RefreshableJob>(HiveExperiments_ItemsRemoved);
     131          Content.ClearHiveClient();
     132          Content = null;
    131133        }
    132134      }
     
    139141    }
    140142
    141     private void Content_HiveExperimentsChanged(object sender, EventArgs e) {
    142       Content.Jobs.ItemsRemoved += new CollectionItemsChangedEventHandler<RefreshableJob>(HiveExperiments_ItemsRemoved);
     143    private void Content_HiveJobsChanged(object sender, EventArgs e) {
     144      if (Content.Jobs != null) {
     145        Content.Jobs.ItemsRemoved += new CollectionItemsChangedEventHandler<RefreshableJob>(HiveExperiments_ItemsRemoved);
     146      }
    143147    }
    144148  }
  • trunk/sources/HeuristicLab.Clients.Hive.JobManager/3.3/Views/RefreshableHiveJobView.Designer.cs

    r9107 r9219  
    7171      this.refreshButton = new System.Windows.Forms.Button();
    7272      this.isPrivilegedCheckBox = new System.Windows.Forms.CheckBox();
     73      this.UnloadButton = new System.Windows.Forms.Button();
    7374      this.refreshAutomaticallyCheckBox = new System.Windows.Forms.CheckBox();
    7475      this.infoGroupBox = new System.Windows.Forms.GroupBox();
     
    9192      // tabControl
    9293      //
     94      this.tabControl.AllowDrop = true;
    9395      this.tabControl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    9496            | System.Windows.Forms.AnchorStyles.Left)
     
    377379      this.isPrivilegedCheckBox.CheckedChanged += new System.EventHandler(this.isPrivilegedCheckBox_CheckChanged);
    378380      //
     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);
     391      //
    379392      // refreshAutomaticallyCheckBox
    380393      //
    381394      this.refreshAutomaticallyCheckBox.AutoSize = true;
    382       this.refreshAutomaticallyCheckBox.Location = new System.Drawing.Point(30, 5);
     395      this.refreshAutomaticallyCheckBox.Location = new System.Drawing.Point(70, 3);
    383396      this.refreshAutomaticallyCheckBox.Name = "refreshAutomaticallyCheckBox";
    384397      this.refreshAutomaticallyCheckBox.Size = new System.Drawing.Size(127, 17);
     
    471484      // RefreshableHiveJobView
    472485      //
    473       this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    474486      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
     487      this.Controls.Add(this.UnloadButton);
    475488      this.Controls.Add(this.searchButton);
    476489      this.Controls.Add(this.isPrivilegedCheckBox);
     
    505518    #endregion
    506519
    507     private System.Windows.Forms.TabControl tabControl;
    508520    private System.Windows.Forms.Button startButton;
    509521    private System.Windows.Forms.Button stopButton;
     
    539551    private MainForm.WindowsForms.ViewHost runCollectionViewHost;
    540552    private System.Windows.Forms.Button searchButton;
     553    private MainForm.WindowsForms.DragOverTabControl tabControl;
     554    private System.Windows.Forms.Button UnloadButton;
    541555
    542556  }
  • trunk/sources/HeuristicLab.Clients.Hive.JobManager/3.3/Views/RefreshableHiveJobView.cs

    r9107 r9219  
    100100        progressView = null;
    101101      }
     102      DeregisterHiveExperimentEvents();
     103      DeregisterHiveTasksEvents();
    102104      base.DeregisterContentEvents();
    103105    }
     
    111113    }
    112114
    113     private void RegisterHiveJobEvents() {
     115    private void RegisterHiveTasksEvents() {
    114116      Content.HiveTasks.ItemsAdded += new CollectionItemsChangedEventHandler<HiveTask>(HiveTasks_ItemsAdded);
    115117      Content.HiveTasks.ItemsRemoved += new CollectionItemsChangedEventHandler<HiveTask>(HiveTasks_ItemsRemoved);
    116118      Content.HiveTasks.CollectionReset += new CollectionItemsChangedEventHandler<HiveTask>(HiveTasks_CollectionReset);
    117119    }
    118     private void DeregisterHiveJobEvents() {
     120    private void DeregisterHiveTasksEvents() {
    119121      Content.HiveTasks.ItemsAdded -= new CollectionItemsChangedEventHandler<HiveTask>(HiveTasks_ItemsAdded);
    120122      Content.HiveTasks.ItemsRemoved -= new CollectionItemsChangedEventHandler<HiveTask>(HiveTasks_ItemsRemoved);
     
    131133          resourceNamesTextBox.Text = string.Empty;
    132134          isPrivilegedCheckBox.Checked = false;
    133           logView.Content = null;
    134135          refreshAutomaticallyCheckBox.Checked = false;
    135136          lock (runCollectionViewLocker) {
    136137            runCollectionViewHost.Content = null;
    137138          }
     139          logView.Content = null;
     140          jobsTreeView.Content = null;
     141          hiveExperimentPermissionListView.Content = null;
     142          stateLogViewHost.Content = null;
    138143        } else {
    139144          nameTextBox.Text = Content.Job.Name;
     
    182187        this.refreshButton.Enabled = Content.IsDownloadable && alreadyUploaded && !Content.IsProgressing;
    183188        this.Locked = !Content.IsControllable || Content.ExecutionState == ExecutionState.Started || Content.IsProgressing;
     189
     190        this.UnloadButton.Enabled = Content.HiveTasks != null && Content.HiveTasks.Count > 0 && alreadyUploaded && !Content.IsProgressing;
    184191      }
    185192      SetEnabledStateOfExecutableButtons();
     
    286293        if (Content != null && Content.HiveTasks != null) {
    287294          jobsTreeView.Content = Content.HiveTasks;
    288           RegisterHiveJobEvents();
     295          RegisterHiveTasksEvents();
    289296        } else {
    290297          jobsTreeView.Content = null;
     
    435442
    436443    private void nameTextBox_Validated(object sender, EventArgs e) {
    437       if (!SuppressEvents && Content.Job.Name != nameTextBox.Text)
     444      if (!SuppressEvents && Content.Job != null && Content.Job.Name != nameTextBox.Text)
    438445        Content.Job.Name = nameTextBox.Text;
    439446    }
    440447
    441448    private void resourceNamesTextBox_Validated(object sender, EventArgs e) {
    442       if (!SuppressEvents && Content.Job.ResourceNames != resourceNamesTextBox.Text)
     449      if (!SuppressEvents && Content.Job != null && Content.Job.ResourceNames != resourceNamesTextBox.Text)
    443450        Content.Job.ResourceNames = resourceNamesTextBox.Text;
    444451    }
     
    564571      }
    565572    }
     573
     574    private void UnloadButton_Click(object sender, EventArgs e) {
     575      Content.Unload();
     576      runCollectionViewHost.Content = null;
     577      stateLogViewHost.Content = null;
     578      hiveExperimentPermissionListView.Content = null;
     579      jobsTreeView.Content = null;
     580
     581      SetEnabledStateOfControls();
     582    }
    566583  }
    567584}
Note: See TracChangeset for help on using the changeset viewer.