Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
06/19/12 11:05:08 (12 years ago)
Author:
spimming
Message:

#1680:

  • replaced instanceCount textbox with NumericUpDown control
  • fixed label position
  • removed unnecessary validation code
File:
1 edited

Legend:

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

    r7661 r8048  
    200200          string certFile = certificateFile;
    201201          string certPw = certificatePassword;
    202           int instanceCount = Convert.ToInt32(tbInstanceCount.Text);
     202          //int instanceCount = Convert.ToInt32(tbInstanceCount.Text);
     203          int instanceCount = Convert.ToInt32(instancesNumericUpDown.Value);
    203204
    204205
     
    250251        Subscription item = (Subscription)e.Argument;
    251252        item = CloudManagerClient.Instance.AzureProvider.GetSubscriptionInfo(item.SubscriptionID, item.CertificateThumbprint);
    252         this.Invoke((MethodInvoker)delegate { lblCores.Text = item.CurrentCoreCount + " / " + item.MaxCoreCount; });
     253        this.Invoke((MethodInvoker)delegate {
     254          lblCores.Text = item.CurrentCoreCount + " / " + item.MaxCoreCount;
     255          instancesNumericUpDown.Maximum = item.MaxCoreCount;
     256        });
    253257
    254258        List<HostedService> services = CloudManagerClient.Instance.AzureProvider.ListHostedServices(item);
     
    447451    }
    448452
    449     private void tbInstanceCount_Validating(object sender, CancelEventArgs e) {
    450       if (!isValidInstanceCount(tbInstanceCount.Text)) {
    451         errorProvider.SetError(tbInstanceCount, "Instance count must be a number greater than 0 and " +
    452                                                  "less or equal than the difference between maximum and available cores.");
    453         e.Cancel = true;
    454       } else {
    455         int instanceCount = Convert.ToInt32(tbInstanceCount.Text);
    456         Subscription subscription = (Subscription)cmbChooseSubscription.SelectedItem;
    457         if (instanceCount > subscription.MaxCoreCount - subscription.CurrentCoreCount) {
    458           errorProvider.SetError(tbInstanceCount, "Instance count must be less or equal than the difference between maximum and available cores.");
    459           e.Cancel = true;
    460         } else {
    461           errorProvider.SetError(tbInstanceCount, "");
    462         }
    463       }
    464     }
    465 
    466     private bool isValidInstanceCount(string text) {
    467       string regexString = @"[1-9]+[0-9-]*";  //TODO
    468       Regex regex = new Regex(regexString);
    469       if (regex.IsMatch(text)) {
    470         return true;
    471       } else {
    472         return false;
    473       }
    474     }
    475 
    476453    private void tbBlobContainer_Validating(object sender, CancelEventArgs e) {
    477454      string name = tbBlobContainer.Text.Trim();
Note: See TracChangeset for help on using the changeset viewer.