Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
01/30/12 17:39:27 (13 years ago)
Author:
spimming
Message:

#1680:

  • ChangeInstanceCount method added
  • Deployment: added properties to indicate modification and the new instance count
  • Textbox validation
  • Form resized
File:
1 edited

Legend:

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

    r7424 r7429  
    306306          e.Cancel = true;
    307307        } else if (!isValidHostedServiceUrl(url)) {
    308           errorProvider.SetError(tbLabel, "A hosted service name must be between 1 and 63 " +
    309                                           "characters long, and be composed of letters, numbers " +
    310                                           "and hyphens. Hyphens shouldn't be first or last letter.");
     308          errorProvider.SetError(tbServiceName, "A hosted service name must be between 1 and 63 " +
     309                                                "characters long, and be composed of letters, numbers " +
     310                                                "and hyphens. Hyphens shouldn't be first or last letter.");
    311311          e.Cancel = true;
    312312        } else {
     
    336336      }
    337337    }
     338
     339    private void tbInstanceCount_Validating(object sender, CancelEventArgs e) {
     340      if (!isValidInstanceCount(tbInstanceCount.Text)) {
     341        errorProvider.SetError(tbInstanceCount, "Instance count must be a number greater than 0 and " +
     342                                                 "less or equal than the difference between maximum and available cores.");
     343        e.Cancel = true;
     344      } else {
     345        int instanceCount = Convert.ToInt32(tbInstanceCount.Text);
     346        Subscription subscription = (Subscription)cmbChooseSubscription.SelectedItem;
     347        if (instanceCount > subscription.MaxCoreCount - subscription.CurrentCoreCount) {
     348          errorProvider.SetError(tbInstanceCount, "Instance count must be less or equal than the difference between maximum and available cores.");
     349        } else {
     350          e.Cancel = true;
     351          errorProvider.SetError(tbInstanceCount, "");
     352        }
     353      }
     354    }
     355
     356    private bool isValidInstanceCount(string text) {
     357      string regexString = @"[1-9]+[0-9-]*";  //TODO
     358      Regex regex = new Regex(regexString);
     359      if (regex.IsMatch(text)) {
     360        return true;
     361      } else {
     362        return false;
     363      }
     364    }
    338365  }
    339366}
Note: See TracChangeset for help on using the changeset viewer.