Index: /branches/HeuristicLab.Hive.Azure/HeuristicLab.Clients.Hive.CloudManager/3.3/Views/AddAzureServiceDialog.Designer.cs
===================================================================
--- /branches/HeuristicLab.Hive.Azure/HeuristicLab.Clients.Hive.CloudManager/3.3/Views/AddAzureServiceDialog.Designer.cs	(revision 8047)
+++ /branches/HeuristicLab.Hive.Azure/HeuristicLab.Clients.Hive.CloudManager/3.3/Views/AddAzureServiceDialog.Designer.cs	(revision 8048)
@@ -46,5 +46,4 @@
       this.btnAddCertificate = new System.Windows.Forms.Button();
       this.label9 = new System.Windows.Forms.Label();
-      this.tbInstanceCount = new System.Windows.Forms.TextBox();
       this.lblCores = new System.Windows.Forms.Label();
       this.label10 = new System.Windows.Forms.Label();
@@ -54,9 +53,10 @@
       this.lblCertificateFile = new System.Windows.Forms.Label();
       this.errorProvider = new System.Windows.Forms.ErrorProvider(this.components);
+      this.tbBlobContainer = new System.Windows.Forms.TextBox();
+      this.cmbStorageServices = new System.Windows.Forms.ComboBox();
       this.gbStorageService = new System.Windows.Forms.GroupBox();
+      this.label12 = new System.Windows.Forms.Label();
       this.cbCreateBlobIfNotExists = new System.Windows.Forms.CheckBox();
-      this.tbBlobContainer = new System.Windows.Forms.TextBox();
       this.label11 = new System.Windows.Forms.Label();
-      this.cmbStorageServices = new System.Windows.Forms.ComboBox();
       this.label8 = new System.Windows.Forms.Label();
       this.rbVMSizeMedium = new System.Windows.Forms.RadioButton();
@@ -65,14 +65,14 @@
       this.rbVMSizeExtraLarge = new System.Windows.Forms.RadioButton();
       this.toolTip = new System.Windows.Forms.ToolTip(this.components);
-      this.gbDeploymentOptions = new System.Windows.Forms.GroupBox();
-      this.gbVMSize = new System.Windows.Forms.GroupBox();
-      this.label7 = new System.Windows.Forms.Label();
-      this.label12 = new System.Windows.Forms.Label();
-      this.label13 = new System.Windows.Forms.Label();
-      this.label14 = new System.Windows.Forms.Label();
       this.label15 = new System.Windows.Forms.Label();
       this.label16 = new System.Windows.Forms.Label();
       this.label17 = new System.Windows.Forms.Label();
       this.label18 = new System.Windows.Forms.Label();
+      this.gbDeploymentOptions = new System.Windows.Forms.GroupBox();
+      this.label14 = new System.Windows.Forms.Label();
+      this.label13 = new System.Windows.Forms.Label();
+      this.gbVMSize = new System.Windows.Forms.GroupBox();
+      this.label7 = new System.Windows.Forms.Label();
+      this.instancesNumericUpDown = new System.Windows.Forms.NumericUpDown();
       this.gbNewHostedService.SuspendLayout();
       ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit();
@@ -80,4 +80,5 @@
       this.gbDeploymentOptions.SuspendLayout();
       this.gbVMSize.SuspendLayout();
+      ((System.ComponentModel.ISupportInitialize)(this.instancesNumericUpDown)).BeginInit();
       this.SuspendLayout();
       // 
@@ -280,13 +281,4 @@
       this.label9.Text = "How many instances should be used?";
       // 
-      // tbInstanceCount
-      // 
-      this.errorProvider.SetIconAlignment(this.tbInstanceCount, System.Windows.Forms.ErrorIconAlignment.MiddleLeft);
-      this.tbInstanceCount.Location = new System.Drawing.Point(204, 493);
-      this.tbInstanceCount.Name = "tbInstanceCount";
-      this.tbInstanceCount.Size = new System.Drawing.Size(230, 20);
-      this.tbInstanceCount.TabIndex = 12;
-      this.tbInstanceCount.Validating += new System.ComponentModel.CancelEventHandler(this.tbInstanceCount_Validating);
-      // 
       // lblCores
       // 
@@ -339,5 +331,5 @@
       // 
       this.lblCertificateFile.AutoSize = true;
-      this.lblCertificateFile.Location = new System.Drawing.Point(120, 605);
+      this.lblCertificateFile.Location = new System.Drawing.Point(120, 476);
       this.lblCertificateFile.Name = "lblCertificateFile";
       this.lblCertificateFile.Size = new System.Drawing.Size(0, 13);
@@ -348,4 +340,23 @@
       this.errorProvider.BlinkStyle = System.Windows.Forms.ErrorBlinkStyle.NeverBlink;
       this.errorProvider.ContainerControl = this;
+      // 
+      // tbBlobContainer
+      // 
+      this.errorProvider.SetIconAlignment(this.tbBlobContainer, System.Windows.Forms.ErrorIconAlignment.MiddleLeft);
+      this.tbBlobContainer.Location = new System.Drawing.Point(184, 40);
+      this.tbBlobContainer.Name = "tbBlobContainer";
+      this.tbBlobContainer.Size = new System.Drawing.Size(296, 20);
+      this.tbBlobContainer.TabIndex = 3;
+      this.tbBlobContainer.Validating += new System.ComponentModel.CancelEventHandler(this.tbBlobContainer_Validating);
+      // 
+      // cmbStorageServices
+      // 
+      this.cmbStorageServices.FormattingEnabled = true;
+      this.errorProvider.SetIconAlignment(this.cmbStorageServices, System.Windows.Forms.ErrorIconAlignment.MiddleLeft);
+      this.cmbStorageServices.Location = new System.Drawing.Point(184, 13);
+      this.cmbStorageServices.Name = "cmbStorageServices";
+      this.cmbStorageServices.Size = new System.Drawing.Size(296, 21);
+      this.cmbStorageServices.TabIndex = 1;
+      this.cmbStorageServices.Validating += new System.ComponentModel.CancelEventHandler(this.cmbStorageServices_Validating);
       // 
       // gbStorageService
@@ -364,4 +375,13 @@
       this.gbStorageService.Text = "Set storage service";
       // 
+      // label12
+      // 
+      this.label12.AutoSize = true;
+      this.label12.Location = new System.Drawing.Point(6, 66);
+      this.label12.Name = "label12";
+      this.label12.Size = new System.Drawing.Size(166, 13);
+      this.label12.TabIndex = 5;
+      this.label12.Text = "Create blob container if not exists:";
+      // 
       // cbCreateBlobIfNotExists
       // 
@@ -375,13 +395,4 @@
       this.cbCreateBlobIfNotExists.UseVisualStyleBackColor = true;
       // 
-      // tbBlobContainer
-      // 
-      this.errorProvider.SetIconAlignment(this.tbBlobContainer, System.Windows.Forms.ErrorIconAlignment.MiddleLeft);
-      this.tbBlobContainer.Location = new System.Drawing.Point(184, 40);
-      this.tbBlobContainer.Name = "tbBlobContainer";
-      this.tbBlobContainer.Size = new System.Drawing.Size(296, 20);
-      this.tbBlobContainer.TabIndex = 3;
-      this.tbBlobContainer.Validating += new System.ComponentModel.CancelEventHandler(this.tbBlobContainer_Validating);
-      // 
       // label11
       // 
@@ -392,14 +403,4 @@
       this.label11.TabIndex = 2;
       this.label11.Text = "Set blob container:";
-      // 
-      // cmbStorageServices
-      // 
-      this.cmbStorageServices.FormattingEnabled = true;
-      this.errorProvider.SetIconAlignment(this.cmbStorageServices, System.Windows.Forms.ErrorIconAlignment.MiddleLeft);
-      this.cmbStorageServices.Location = new System.Drawing.Point(184, 13);
-      this.cmbStorageServices.Name = "cmbStorageServices";
-      this.cmbStorageServices.Size = new System.Drawing.Size(296, 21);
-      this.cmbStorageServices.TabIndex = 1;
-      this.cmbStorageServices.Validating += new System.ComponentModel.CancelEventHandler(this.cmbStorageServices_Validating);
       // 
       // label8
@@ -453,10 +454,50 @@
       this.rbVMSizeExtraLarge.UseVisualStyleBackColor = true;
       // 
+      // label15
+      // 
+      this.label15.AutoSize = true;
+      this.label15.Location = new System.Drawing.Point(9, 19);
+      this.label15.Name = "label15";
+      this.label15.Size = new System.Drawing.Size(32, 13);
+      this.label15.TabIndex = 4;
+      this.label15.Text = "Small";
+      this.toolTip.SetToolTip(this.label15, "1 CPU Core; 1.75 GB Memory; $0.12");
+      // 
+      // label16
+      // 
+      this.label16.AutoSize = true;
+      this.label16.Location = new System.Drawing.Point(9, 38);
+      this.label16.Name = "label16";
+      this.label16.Size = new System.Drawing.Size(44, 13);
+      this.label16.TabIndex = 5;
+      this.label16.Text = "Medium";
+      this.toolTip.SetToolTip(this.label16, "1 CPU Core; 1.75 GB Memory; $0.12");
+      // 
+      // label17
+      // 
+      this.label17.AutoSize = true;
+      this.label17.Location = new System.Drawing.Point(9, 57);
+      this.label17.Name = "label17";
+      this.label17.Size = new System.Drawing.Size(34, 13);
+      this.label17.TabIndex = 6;
+      this.label17.Text = "Large";
+      this.toolTip.SetToolTip(this.label17, "4 CPU Cores; 7 GB Memory; $0.48");
+      // 
+      // label18
+      // 
+      this.label18.AutoSize = true;
+      this.label18.Location = new System.Drawing.Point(9, 76);
+      this.label18.Name = "label18";
+      this.label18.Size = new System.Drawing.Size(61, 13);
+      this.label18.TabIndex = 7;
+      this.label18.Text = "Extra Large";
+      this.toolTip.SetToolTip(this.label18, "8 CPU Cores; 14 GB Memory; $0.96");
+      // 
       // gbDeploymentOptions
       // 
+      this.gbDeploymentOptions.Controls.Add(this.rbDeployToProduction);
+      this.gbDeploymentOptions.Controls.Add(this.rbDeployToStaging);
       this.gbDeploymentOptions.Controls.Add(this.label14);
       this.gbDeploymentOptions.Controls.Add(this.label13);
-      this.gbDeploymentOptions.Controls.Add(this.rbDeployToProduction);
-      this.gbDeploymentOptions.Controls.Add(this.rbDeployToStaging);
       this.gbDeploymentOptions.Location = new System.Drawing.Point(15, 302);
       this.gbDeploymentOptions.Name = "gbDeploymentOptions";
@@ -465,4 +506,22 @@
       this.gbDeploymentOptions.TabStop = false;
       this.gbDeploymentOptions.Text = "Deployment options";
+      // 
+      // label14
+      // 
+      this.label14.AutoSize = true;
+      this.label14.Location = new System.Drawing.Point(9, 38);
+      this.label14.Name = "label14";
+      this.label14.Size = new System.Drawing.Size(174, 13);
+      this.label14.TabIndex = 3;
+      this.label14.Text = "Deyploy to production environment:";
+      // 
+      // label13
+      // 
+      this.label13.AutoSize = true;
+      this.label13.Location = new System.Drawing.Point(9, 19);
+      this.label13.Name = "label13";
+      this.label13.Size = new System.Drawing.Size(153, 13);
+      this.label13.TabIndex = 2;
+      this.label13.Text = "Deploy to staging environment:";
       // 
       // gbVMSize
@@ -492,70 +551,20 @@
       this.label7.Text = "Create new hosted service:";
       // 
-      // label12
-      // 
-      this.label12.AutoSize = true;
-      this.label12.Location = new System.Drawing.Point(6, 66);
-      this.label12.Name = "label12";
-      this.label12.Size = new System.Drawing.Size(166, 13);
-      this.label12.TabIndex = 5;
-      this.label12.Text = "Create blob container if not exists:";
-      // 
-      // label13
-      // 
-      this.label13.AutoSize = true;
-      this.label13.Location = new System.Drawing.Point(9, 19);
-      this.label13.Name = "label13";
-      this.label13.Size = new System.Drawing.Size(153, 13);
-      this.label13.TabIndex = 2;
-      this.label13.Text = "Deploy to staging environment:";
-      // 
-      // label14
-      // 
-      this.label14.AutoSize = true;
-      this.label14.Location = new System.Drawing.Point(9, 38);
-      this.label14.Name = "label14";
-      this.label14.Size = new System.Drawing.Size(174, 13);
-      this.label14.TabIndex = 3;
-      this.label14.Text = "Deyploy to production environment:";
-      // 
-      // label15
-      // 
-      this.label15.AutoSize = true;
-      this.label15.Location = new System.Drawing.Point(9, 19);
-      this.label15.Name = "label15";
-      this.label15.Size = new System.Drawing.Size(32, 13);
-      this.label15.TabIndex = 4;
-      this.label15.Text = "Small";
-      this.toolTip.SetToolTip(this.label15, "1 CPU Core; 1.75 GB Memory; $0.12");
-      // 
-      // label16
-      // 
-      this.label16.AutoSize = true;
-      this.label16.Location = new System.Drawing.Point(9, 38);
-      this.label16.Name = "label16";
-      this.label16.Size = new System.Drawing.Size(44, 13);
-      this.label16.TabIndex = 5;
-      this.label16.Text = "Medium";
-      this.toolTip.SetToolTip(this.label16, "1 CPU Core; 1.75 GB Memory; $0.12");
-      // 
-      // label17
-      // 
-      this.label17.AutoSize = true;
-      this.label17.Location = new System.Drawing.Point(9, 57);
-      this.label17.Name = "label17";
-      this.label17.Size = new System.Drawing.Size(34, 13);
-      this.label17.TabIndex = 6;
-      this.label17.Text = "Large";
-      this.toolTip.SetToolTip(this.label17, "4 CPU Cores; 7 GB Memory; $0.48");
-      // 
-      // label18
-      // 
-      this.label18.AutoSize = true;
-      this.label18.Location = new System.Drawing.Point(9, 76);
-      this.label18.Name = "label18";
-      this.label18.Size = new System.Drawing.Size(61, 13);
-      this.label18.TabIndex = 7;
-      this.label18.Text = "Extra Large";
-      this.toolTip.SetToolTip(this.label18, "8 CPU Cores; 14 GB Memory; $0.96");
+      // instancesNumericUpDown
+      // 
+      this.instancesNumericUpDown.Location = new System.Drawing.Point(204, 494);
+      this.instancesNumericUpDown.Minimum = new decimal(new int[] {
+            1,
+            0,
+            0,
+            0});
+      this.instancesNumericUpDown.Name = "instancesNumericUpDown";
+      this.instancesNumericUpDown.Size = new System.Drawing.Size(230, 20);
+      this.instancesNumericUpDown.TabIndex = 18;
+      this.instancesNumericUpDown.Value = new decimal(new int[] {
+            1,
+            0,
+            0,
+            0});
       // 
       // AddAzureServiceDialog
@@ -564,5 +573,6 @@
       this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
       this.AutoValidate = System.Windows.Forms.AutoValidate.EnableAllowFocusChange;
-      this.ClientSize = new System.Drawing.Size(516, 557);
+      this.ClientSize = new System.Drawing.Size(516, 552);
+      this.Controls.Add(this.instancesNumericUpDown);
       this.Controls.Add(this.label7);
       this.Controls.Add(this.gbVMSize);
@@ -575,5 +585,4 @@
       this.Controls.Add(this.progressBar);
       this.Controls.Add(this.label10);
-      this.Controls.Add(this.tbInstanceCount);
       this.Controls.Add(this.label9);
       this.Controls.Add(this.btnAddCertificate);
@@ -599,4 +608,5 @@
       this.gbVMSize.ResumeLayout(false);
       this.gbVMSize.PerformLayout();
+      ((System.ComponentModel.ISupportInitialize)(this.instancesNumericUpDown)).EndInit();
       this.ResumeLayout(false);
       this.PerformLayout();
@@ -626,5 +636,4 @@
     private System.Windows.Forms.Button btnAddCertificate;
     private System.Windows.Forms.Label label9;
-    private System.Windows.Forms.TextBox tbInstanceCount;
     private System.Windows.Forms.Label lblCores;
     private System.Windows.Forms.Label label10;
@@ -655,4 +664,5 @@
     private System.Windows.Forms.Label label14;
     private System.Windows.Forms.Label label13;
+    private System.Windows.Forms.NumericUpDown instancesNumericUpDown;
   }
 }
Index: /branches/HeuristicLab.Hive.Azure/HeuristicLab.Clients.Hive.CloudManager/3.3/Views/AddAzureServiceDialog.cs
===================================================================
--- /branches/HeuristicLab.Hive.Azure/HeuristicLab.Clients.Hive.CloudManager/3.3/Views/AddAzureServiceDialog.cs	(revision 8047)
+++ /branches/HeuristicLab.Hive.Azure/HeuristicLab.Clients.Hive.CloudManager/3.3/Views/AddAzureServiceDialog.cs	(revision 8048)
@@ -200,5 +200,6 @@
           string certFile = certificateFile;
           string certPw = certificatePassword;
-          int instanceCount = Convert.ToInt32(tbInstanceCount.Text);
+          //int instanceCount = Convert.ToInt32(tbInstanceCount.Text);
+          int instanceCount = Convert.ToInt32(instancesNumericUpDown.Value);
 
 
@@ -250,5 +251,8 @@
         Subscription item = (Subscription)e.Argument;
         item = CloudManagerClient.Instance.AzureProvider.GetSubscriptionInfo(item.SubscriptionID, item.CertificateThumbprint);
-        this.Invoke((MethodInvoker)delegate { lblCores.Text = item.CurrentCoreCount + " / " + item.MaxCoreCount; });
+        this.Invoke((MethodInvoker)delegate {
+          lblCores.Text = item.CurrentCoreCount + " / " + item.MaxCoreCount;
+          instancesNumericUpDown.Maximum = item.MaxCoreCount;
+        });
 
         List<HostedService> services = CloudManagerClient.Instance.AzureProvider.ListHostedServices(item);
@@ -447,31 +451,4 @@
     }
 
-    private void tbInstanceCount_Validating(object sender, CancelEventArgs e) {
-      if (!isValidInstanceCount(tbInstanceCount.Text)) {
-        errorProvider.SetError(tbInstanceCount, "Instance count must be a number greater than 0 and " +
-                                                 "less or equal than the difference between maximum and available cores.");
-        e.Cancel = true;
-      } else {
-        int instanceCount = Convert.ToInt32(tbInstanceCount.Text);
-        Subscription subscription = (Subscription)cmbChooseSubscription.SelectedItem;
-        if (instanceCount > subscription.MaxCoreCount - subscription.CurrentCoreCount) {
-          errorProvider.SetError(tbInstanceCount, "Instance count must be less or equal than the difference between maximum and available cores.");
-          e.Cancel = true;
-        } else {
-          errorProvider.SetError(tbInstanceCount, "");
-        }
-      }
-    }
-
-    private bool isValidInstanceCount(string text) {
-      string regexString = @"[1-9]+[0-9-]*";  //TODO
-      Regex regex = new Regex(regexString);
-      if (regex.IsMatch(text)) {
-        return true;
-      } else {
-        return false;
-      }
-    }
-
     private void tbBlobContainer_Validating(object sender, CancelEventArgs e) {
       string name = tbBlobContainer.Text.Trim();
