- Timestamp:
- 01/18/12 14:58:17 (13 years ago)
- Location:
- branches/HeuristicLab.Hive.Azure/HeuristicLab.Clients.Hive.CloudManager/3.3/Views
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Hive.Azure/HeuristicLab.Clients.Hive.CloudManager/3.3/Views/AddAzureServiceDialog.Designer.cs
r7354 r7362 52 52 this.btnOk = new System.Windows.Forms.Button(); 53 53 this.btnCancel = new System.Windows.Forms.Button(); 54 this.lblCertificateFile = new System.Windows.Forms.Label(); 54 55 this.gbNewHostedService.SuspendLayout(); 55 56 this.panelDeploymentOptions.SuspendLayout(); … … 321 322 this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click); 322 323 // 324 // lblCertificateFile 325 // 326 this.lblCertificateFile.AutoSize = true; 327 this.lblCertificateFile.Location = new System.Drawing.Point(118, 341); 328 this.lblCertificateFile.Name = "lblCertificateFile"; 329 this.lblCertificateFile.Size = new System.Drawing.Size(0, 13); 330 this.lblCertificateFile.TabIndex = 19; 331 // 323 332 // AddAzureServiceDialog 324 333 // … … 326 335 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 327 336 this.ClientSize = new System.Drawing.Size(496, 436); 337 this.Controls.Add(this.lblCertificateFile); 328 338 this.Controls.Add(this.lblCores); 329 339 this.Controls.Add(this.btnCancel); … … 383 393 private System.Windows.Forms.Button btnOk; 384 394 private System.Windows.Forms.Button btnCancel; 395 private System.Windows.Forms.Label lblCertificateFile; 385 396 } 386 397 } -
branches/HeuristicLab.Hive.Azure/HeuristicLab.Clients.Hive.CloudManager/3.3/Views/AddAzureServiceDialog.cs
r7357 r7362 18 18 private bool bwCompleted; 19 19 private bool closePending; 20 21 private string certificateFile; 22 private string certificatePassword; 20 23 21 24 public AddAzureServiceDialog(IItemList<Subscription> subs) { … … 124 127 using (var form = new AddCertificate()) { 125 128 form.ShowDialog(); 129 if (!form.ErrorOccured) { 130 certificateFile = form.CertificateFile; 131 certificatePassword = form.CertificatePassword; 132 lblCertificateFile.Text = certificateFile; 133 } 126 134 } 127 135 } -
branches/HeuristicLab.Hive.Azure/HeuristicLab.Clients.Hive.CloudManager/3.3/Views/AddCertificate.Designer.cs
r7339 r7362 24 24 /// </summary> 25 25 private void InitializeComponent() { 26 System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(AddCertificate)); 26 27 this.label1 = new System.Windows.Forms.Label(); 27 28 this.tbCertificateFile = new System.Windows.Forms.TextBox(); … … 121 122 this.Controls.Add(this.tbCertificateFile); 122 123 this.Controls.Add(this.label1); 124 this.Icon = HeuristicLab.Common.Resources.HeuristicLab.Icon; 123 125 this.Name = "AddCertificate"; 124 126 this.Text = "AddCertificate"; -
branches/HeuristicLab.Hive.Azure/HeuristicLab.Clients.Hive.CloudManager/3.3/Views/AddCertificate.cs
r7339 r7362 1 1 using System; 2 2 using System.ComponentModel; 3 using System. Threading;3 using System.Security.Cryptography.X509Certificates; 4 4 using System.Windows.Forms; 5 5 … … 8 8 private BackgroundWorker worker = new BackgroundWorker(); 9 9 public bool ErrorOccured { get; set; } 10 public string CertificateFile { get; set; } 11 public string CertificatePassword { get; set; } 10 12 11 13 public AddCertificate() { 12 14 InitializeComponent(); 15 ErrorOccured = true; 16 13 17 worker.DoWork += new DoWorkEventHandler(AddCertificateTask); 14 18 worker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(WorkerCompleted); … … 28 32 29 33 private void btnOk_Click(object sender, EventArgs e) { 30 if (tbCertificateFile.Text.Length == 0) { 34 CertificateFile = tbCertificateFile.Text; 35 CertificatePassword = tbCertificatePassword.Text; 36 37 if (CertificateFile.Length == 0) { 31 38 MessageBox.Show("Certificate file is required", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); 32 } else if ( tbCertificatePassword.Text.Length == 0) {39 } else if (CertificatePassword.Length == 0) { 33 40 MessageBox.Show("Password is required", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); 34 41 } else { 35 42 SetControlsEnabled(false); 36 43 progressBar.Visible = true; 37 worker.RunWorkerAsync(); 44 var parameters = Tuple.Create<string, string>(CertificateFile, CertificatePassword); 45 worker.RunWorkerAsync(parameters); 38 46 } 39 40 47 } 41 48 … … 48 55 49 56 private void AddCertificateTask(object sender, DoWorkEventArgs e) { 50 try { 51 // simulate service call 52 Thread.Sleep(3000); 53 } 54 catch (Exception ex) { 55 ErrorOccured = true; 56 MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); 57 } 57 Tuple<string, string> parameters = e.Argument as Tuple<string, string>; 58 string file = parameters.Item1; 59 string pw = parameters.Item2; 60 61 X509Certificate cert = new X509Certificate(file, pw); 58 62 } 59 63 60 64 private void WorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { 61 65 progressBar.Visible = false; 62 if (!ErrorOccured) { 66 67 if (e.Error == null) { 68 ErrorOccured = false; 63 69 this.Close(); 64 70 } else { 71 MessageBox.Show(e.Error.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); 72 CertificateFile = string.Empty; 73 CertificateFile = string.Empty; 74 ErrorOccured = true; 65 75 this.Show(); 66 76 SetControlsEnabled(true); -
branches/HeuristicLab.Hive.Azure/HeuristicLab.Clients.Hive.CloudManager/3.3/Views/AddSubscriptionDialog.Designer.cs
r7324 r7362 122 122 // 123 123 this.progressBar.Location = new System.Drawing.Point(15, 107); 124 this.progressBar.MarqueeAnimationSpeed = 10; 124 125 this.progressBar.Name = "progressBar"; 125 126 this.progressBar.Size = new System.Drawing.Size(340, 23); 127 this.progressBar.Style = System.Windows.Forms.ProgressBarStyle.Marquee; 126 128 this.progressBar.TabIndex = 29; 127 129 this.progressBar.Visible = false; -
branches/HeuristicLab.Hive.Azure/HeuristicLab.Clients.Hive.CloudManager/3.3/Views/AddSubscriptionDialog.cs
r7324 r7362 1 using System; 2 using System.ComponentModel; 3 using System.Threading; 1 using System.ComponentModel; 4 2 using System.Windows.Forms; 5 3 using HeuristicLab.Clients.Hive.CloudManager.Model; … … 20 18 cbDiscoverServices.Checked = true; 21 19 22 SetWorkerEvents(); 20 worker.DoWork += new DoWorkEventHandler(LoadSubscription); 21 worker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(WorkerCompleted); 22 23 23 ErrorOccured = true; 24 24 } … … 26 26 private void btnOk_Click(object sender, System.EventArgs e) { 27 27 this.progressBar.Visible = true; 28 //this.progressBar.Style = ProgressBarStyle.Continuous;29 28 worker.RunWorkerAsync(); 30 29 } … … 34 33 } 35 34 36 private void SetWorkerEvents() { 37 worker.WorkerReportsProgress = true; 38 worker.DoWork += new DoWorkEventHandler(LoadSubscription); 39 worker.ProgressChanged += new ProgressChangedEventHandler(ProgressChanged); 40 worker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(WorkerCompleted); 41 } 42 43 private void ProgressChanged(object sender, ProgressChangedEventArgs e) { 44 progressBar.Value = e.ProgressPercentage; 35 private void LoadSubscription(object sender, DoWorkEventArgs e) { 36 e.Result = CloudManagerClient.Instance.AzureProvider.GetSubscriptionInfo(txtSubscriptionId.Text, txtCertThumbprint.Text); 45 37 } 46 38 47 39 private void WorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { 48 40 progressBar.Visible = false; 49 if (!ErrorOccured) { 41 if (e.Error == null) { 42 ErrorOccured = false; 43 Subscription = (Subscription)e.Result; 44 Subscription.SaveToConfig = cbSaveSubscription.Checked; 45 Subscription.DiscoverServices = cbDiscoverServices.Checked; 50 46 this.Close(); 51 47 } else { 48 MessageBox.Show(e.Error.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); 49 ErrorOccured = true; 50 Subscription = null; 52 51 this.Show(); 53 }54 }55 56 private void LoadSubscription(object sender, DoWorkEventArgs e) {57 try {58 worker.ReportProgress(25, "Add Subscription");59 Subscription = CloudManagerClient.Instance.AzureProvider.GetSubscriptionInfo(txtSubscriptionId.Text, txtCertThumbprint.Text);60 Subscription.SaveToConfig = cbSaveSubscription.Checked;61 Subscription.DiscoverServices = cbDiscoverServices.Checked;62 ErrorOccured = false;63 }64 catch (SystemException ex) {65 ErrorOccured = true;66 MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);67 }68 try {69 70 if (!ErrorOccured) {71 worker.ReportProgress(50, "Get Subscription Info");72 //TODO: operation73 ErrorOccured = false;74 }75 }76 catch (SystemException ex) {77 ErrorOccured = true;78 MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);79 worker.ReportProgress(25, "Rollback: Remove hosted service");80 // Rollback operation81 }82 83 if (!ErrorOccured) {84 worker.ReportProgress(100, "");85 Thread.Sleep(1000);86 52 } 87 53 }
Note: See TracChangeset
for help on using the changeset viewer.