Changeset 7424 for branches/HeuristicLab.Hive.Azure/HeuristicLab.Clients.Hive.CloudManager/3.3/Views
- Timestamp:
- 01/27/12 16:58:29 (13 years ago)
- Location:
- branches/HeuristicLab.Hive.Azure/HeuristicLab.Clients.Hive.CloudManager/3.3/Views
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Hive.Azure/HeuristicLab.Clients.Hive.CloudManager/3.3/Views/AddAzureServiceDialog.Designer.cs
r7362 r7424 24 24 /// </summary> 25 25 private void InitializeComponent() { 26 this.components = new System.ComponentModel.Container(); 26 27 this.label1 = new System.Windows.Forms.Label(); 27 28 this.cmbChooseSubscription = new System.Windows.Forms.ComboBox(); … … 53 54 this.btnCancel = new System.Windows.Forms.Button(); 54 55 this.lblCertificateFile = new System.Windows.Forms.Label(); 56 this.errorProvider = new System.Windows.Forms.ErrorProvider(this.components); 55 57 this.gbNewHostedService.SuspendLayout(); 56 58 this.panelDeploymentOptions.SuspendLayout(); 59 ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit(); 57 60 this.SuspendLayout(); 58 61 // … … 171 174 this.tbServiceName.Size = new System.Drawing.Size(377, 20); 172 175 this.tbServiceName.TabIndex = 3; 176 this.tbServiceName.Validating += new System.ComponentModel.CancelEventHandler(this.tbServiceName_Validating); 173 177 // 174 178 // label4 … … 187 191 this.tbLabel.Size = new System.Drawing.Size(453, 20); 188 192 this.tbLabel.TabIndex = 1; 193 this.tbLabel.Validating += new System.ComponentModel.CancelEventHandler(this.tbLabel_Validating); 189 194 // 190 195 // label3 … … 330 335 this.lblCertificateFile.TabIndex = 19; 331 336 // 337 // errorProvider 338 // 339 this.errorProvider.ContainerControl = this; 340 // 332 341 // AddAzureServiceDialog 333 342 // 334 343 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 335 344 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 345 this.AutoValidate = System.Windows.Forms.AutoValidate.EnableAllowFocusChange; 336 346 this.ClientSize = new System.Drawing.Size(496, 436); 337 347 this.Controls.Add(this.lblCertificateFile); … … 358 368 this.panelDeploymentOptions.ResumeLayout(false); 359 369 this.panelDeploymentOptions.PerformLayout(); 370 ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit(); 360 371 this.ResumeLayout(false); 361 372 this.PerformLayout(); … … 394 405 private System.Windows.Forms.Button btnCancel; 395 406 private System.Windows.Forms.Label lblCertificateFile; 407 private System.Windows.Forms.ErrorProvider errorProvider; 396 408 } 397 409 } -
branches/HeuristicLab.Hive.Azure/HeuristicLab.Clients.Hive.CloudManager/3.3/Views/AddAzureServiceDialog.cs
r7421 r7424 2 2 using System.Collections.Generic; 3 3 using System.ComponentModel; 4 using System.Text.RegularExpressions; 4 5 using System.Windows.Forms; 5 6 using HeuristicLab.Clients.Hive.CloudManager.Azure; … … 108 109 } 109 110 } 110 }111 112 private bool ValidateInput() {113 bool valid = true;114 // TODO: input validation115 // see http://stackoverflow.com/questions/769184/winform-ui-validation116 return valid;117 111 } 118 112 … … 166 160 if (cmbChooseSubscription.SelectedItem != null) { 167 161 Subscription sub = (Subscription)cmbChooseSubscription.SelectedItem; 168 if (ValidateInput()) { 162 // the controls collection can be the whole form or just a panel or group 163 if (Validation.hasValidationErrors(this.Controls)) { 164 return; 165 } else { 169 166 bool newHostedServiceChecked = cbNewHostedService.Checked; 170 167 bool regionChecked = rbRegion.Checked; … … 301 298 } 302 299 } 300 301 private void tbServiceName_Validating(object sender, CancelEventArgs e) { 302 if (cbNewHostedService.Checked) { 303 string url = tbServiceName.Text.Trim(); 304 if (url == String.Empty) { 305 errorProvider.SetError(tbServiceName, "A URL is required for the hosted service."); 306 e.Cancel = true; 307 } 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."); 311 e.Cancel = true; 312 } else { 313 errorProvider.SetError(tbServiceName, ""); 314 } 315 } 316 } 317 318 private void tbLabel_Validating(object sender, CancelEventArgs e) { 319 if (cbNewHostedService.Checked) { 320 if (tbLabel.Text.Trim() == String.Empty) { 321 errorProvider.SetError(tbLabel, "A name is required for the hosted service."); 322 e.Cancel = true; 323 } else { 324 errorProvider.SetError(tbLabel, ""); 325 } 326 } 327 } 328 329 private bool isValidHostedServiceUrl(string url) { 330 string regexString = @"[a-zA-Z0-9]+[a-zA-Z0-9-]{0,61}[a-zA-Z0-9]+"; //TODO 331 Regex regex = new Regex(regexString); 332 if (regex.IsMatch(url)) { 333 return true; 334 } else { 335 return false; 336 } 337 } 303 338 } 304 339 }
Note: See TracChangeset
for help on using the changeset viewer.