Free cookie consent management tool by TermsFeed Policy Generator

Changeset 7357


Ignore:
Timestamp:
01/18/12 11:51:08 (13 years ago)
Author:
spimming
Message:

#1680:

  • removed unnecessary invoke-calls
  • moved method call to disable controls out of the worker
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Hive.Azure/HeuristicLab.Clients.Hive.CloudManager/3.3/Views/AddAzureServiceDialog.cs

    r7354 r7357  
    22using System.Collections.Generic;
    33using System.ComponentModel;
    4 using System.Diagnostics;
    54using System.Windows.Forms;
    65using HeuristicLab.Clients.Hive.CloudManager.Model;
     
    2322      InitializeComponent();
    2423      isInitializing = true;
     24      bwCompleted = true;
    2525
    2626      this.subscriptions = new BindingList<Subscription>(subs);
     
    4949    protected override void OnFormClosing(FormClosingEventArgs e) {
    5050      if (!bwCompleted) {
    51         worker.CancelAsync();
    52         this.Enabled = false;
     51        SetAllControlsEnabled(this, false);
    5352        e.Cancel = true;
    5453        closePending = true;
     
    7170      foreach (Control ctrl in frm.Controls) {
    7271        if (!(ctrl is ProgressBar)) {
    73           this.Invoke((MethodInvoker)delegate { ctrl.Enabled = isEnabled; });
     72          ctrl.Enabled = isEnabled;
    7473        }
    7574      }
     
    104103        // checked == false
    105104        SetGroupBoxControlsEnabled(gbNewHostedService, false);
    106         if (hostedServices == null) {
     105        if (hostedServices.Count == 0) {
    107106          cbNewHostedService.Checked = true;
    108107        }
     
    114113        Subscription item = (Subscription)cmbChooseSubscription.SelectedItem;
    115114        if (item != null) {
     115          bwCompleted = false;
    116116          progressBar.Visible = true;
     117          SetAllControlsEnabled(this, false);
    117118          worker.RunWorkerAsync(item);
    118119        }
     
    123124      using (var form = new AddCertificate()) {
    124125        form.ShowDialog();
    125         Debug.WriteLine("End - AddCertificateDialog");
    126126      }
    127127    }
     
    144144          }
    145145        }
    146 
    147146      }
    148147    }
     
    150149    private void UpdateTask(object sender, DoWorkEventArgs e) {
    151150      try {
    152         SetAllControlsEnabled(this, false);
    153 
    154151        Subscription item = (Subscription)e.Argument;
    155152        item = CloudManagerClient.Instance.AzureProvider.GetSubscriptionInfo(item.SubscriptionID, item.CertificateThumbprint);
     
    163160        this.Invoke((MethodInvoker)delegate { UpdateBindingList<string>(locations, locs); });
    164161        this.Invoke((MethodInvoker)delegate { UpdateBindingList<AffinityGroup>(affinityGroups, groups); });
    165 
    166         SetAllControlsEnabled(this, true);
    167162      }
    168163      catch (Exception ex) {
     
    172167
    173168    private void WorkerCompleted(object sender, RunWorkerCompletedEventArgs e) {
    174       this.Invoke((MethodInvoker)delegate { progressBar.Visible = false; });
     169      SetAllControlsEnabled(this, true);
     170      progressBar.Visible = false;
    175171      bwCompleted = true;
    176172      if (closePending) {
Note: See TracChangeset for help on using the changeset viewer.