Changeset 7366
- Timestamp:
- 01/18/12 17:06:12 (13 years ago)
- Location:
- branches/HeuristicLab.Hive.Azure/HeuristicLab.Clients.Hive.CloudManager/3.3
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Hive.Azure/HeuristicLab.Clients.Hive.CloudManager/3.3/Azure/Constants.cs
r7299 r7366 74 74 75 75 #endregion 76 77 #region Deployment 78 79 public const string DeploymentSlotStaging = "staging"; 80 public const string DeploymentSlotProduction = "production"; 81 public const string DeploymentPackageUrl = "https://hivestorage.blob.core.windows.net/hiveslave/HeuristicLab.Clients.Hive.Slave.Azure.cspkg"; 82 public const string DeploymentConfigurationUrl = "files/ServiceConfiguration.Cloud.cscfg"; 83 public const string DeploymentLabel = "HeuristicLab.Hive.Slave"; 84 85 #endregion 76 86 } 77 87 } -
branches/HeuristicLab.Hive.Azure/HeuristicLab.Clients.Hive.CloudManager/3.3/Views/AddAzureServiceDialog.cs
r7362 r7366 13 13 private BindingList<AffinityGroup> affinityGroups; 14 14 15 private BackgroundWorker worker; 15 private BackgroundWorker workerUpdate; 16 private BackgroundWorker workerCreate; 16 17 17 18 private bool isInitializing; … … 41 42 } 42 43 43 worker = new BackgroundWorker(); 44 worker.DoWork += new DoWorkEventHandler(UpdateTask); 45 worker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(WorkerCompleted); 46 44 workerUpdate = new BackgroundWorker(); 45 workerUpdate.DoWork += new DoWorkEventHandler(UpdateTask); 46 workerUpdate.RunWorkerCompleted += new RunWorkerCompletedEventHandler(WorkerCompleted); 47 48 workerCreate = new BackgroundWorker(); 49 workerCreate.DoWork += new DoWorkEventHandler(CreateDoploymentTask); 50 workerCreate.RunWorkerCompleted += new RunWorkerCompletedEventHandler(CreateDeploymentCompleted); 47 51 48 52 isInitializing = false; … … 90 94 foreach (T item in list) 91 95 bindinglist.Add(item); 96 } 97 } 98 99 private void UpdateSubscriptionItem(BindingList<Subscription> bindinglist, Subscription item) { 100 if (item != null) { 101 foreach (Subscription blItem in bindinglist) 102 if (blItem.Equals(item)) { 103 blItem.Merge(item); 104 } 92 105 } 93 106 } … … 119 132 progressBar.Visible = true; 120 133 SetAllControlsEnabled(this, false); 121 worker .RunWorkerAsync(item);134 workerUpdate.RunWorkerAsync(item); 122 135 } 123 136 } … … 141 154 private void btnOk_Click(object sender, EventArgs e) { 142 155 if (cmbChooseSubscription.SelectedItem != null) { 143 if (cbNewHostedService.Checked) { 144 if (rbRegion.Checked) { 145 string serviceName = tbServiceName.Text; 146 string label = tbLabel.Text; 147 string location = (string)cmbLocation.SelectedItem; 148 Subscription sub = (Subscription)cmbChooseSubscription.SelectedItem; 149 CloudManagerClient.Instance.AzureProvider.CreateHostedService(sub, serviceName, label, "Hosted service for hive slave", location); 150 } else { 151 // rbAffinitGroup.Checked 152 } 153 } 156 Subscription sub = (Subscription)cmbChooseSubscription.SelectedItem; 157 bool newHostedServiceChecked = cbNewHostedService.Checked; 158 bool regionChecked = rbRegion.Checked; 159 string certFile = certificateFile; 160 string certPw = certificatePassword; 161 int instanceCount = Convert.ToInt32(tbInstanceCount.Text); 162 HostedService hostedService = new HostedService(); 163 hostedService.ServiceName = tbServiceName.Text; 164 HostedServiceProperties properties = new HostedServiceProperties(); 165 if (regionChecked) { 166 properties.AffinityGroup = string.Empty; 167 properties.Location = (string)cmbLocation.SelectedItem; 168 } else { 169 properties.AffinityGroup = ((AffinityGroup)cmbAffinityGroup.SelectedItem).Name; 170 properties.Location = string.Empty; 171 } 172 properties.AffinityGroup = ((AffinityGroup)cmbAffinityGroup.SelectedItem).Name; 173 properties.Label = tbLabel.Text; 174 properties.Location = (string)cmbLocation.SelectedItem; 175 hostedService.HostedServiceProperties = properties; 176 177 var parameters = Tuple.Create<Subscription, bool, bool, string, string, HostedService, int>(sub, newHostedServiceChecked, regionChecked, certificateFile, certificatePassword, hostedService, instanceCount); 178 179 bwCompleted = false; 180 progressBar.Visible = true; 181 SetAllControlsEnabled(this, false); 182 workerCreate.RunWorkerAsync(parameters); 154 183 } 155 184 } … … 165 194 List<AffinityGroup> groups = CloudManagerClient.Instance.AzureProvider.ListAffinityGroups(item); 166 195 196 this.Invoke((MethodInvoker)delegate { UpdateSubscriptionItem(subscriptions, item); }); 167 197 this.Invoke((MethodInvoker)delegate { UpdateBindingList<HostedService>(hostedServices, services); }); 168 198 this.Invoke((MethodInvoker)delegate { UpdateBindingList<string>(locations, locs); }); … … 182 212 } 183 213 } 214 215 private void CreateDoploymentTask(object sender, DoWorkEventArgs e) { 216 Tuple<Subscription, bool, bool, string, string, HostedService, int> parameters = (Tuple<Subscription, bool, bool, string, string, HostedService, int>)e.Argument; 217 218 Subscription sub = parameters.Item1; 219 bool newHostedServiceChecked = parameters.Item2; 220 bool regionChecked = parameters.Item3; 221 string certFile = parameters.Item4; 222 string certPw = parameters.Item5; 223 HostedService hostedService = parameters.Item6; 224 int instanceCount = parameters.Item7; 225 226 //STEP 1 - Create Hosted Service 227 if (newHostedServiceChecked) { 228 if (regionChecked) { 229 CloudManagerClient.Instance.AzureProvider.CreateHostedService(sub, hostedService.ServiceName, hostedService.HostedServiceProperties.Label, hostedService.HostedServiceProperties.Description, hostedService.HostedServiceProperties.Location); 230 } else { 231 CloudManagerClient.Instance.AzureProvider.CreateHostedService(sub, hostedService.ServiceName, hostedService.HostedServiceProperties.Label, hostedService.HostedServiceProperties.Description, new AffinityGroup() { Name = hostedService.HostedServiceProperties.AffinityGroup }); 232 } 233 } 234 235 } 236 237 private void CreateDeploymentCompleted(object sender, RunWorkerCompletedEventArgs e) { 238 SetAllControlsEnabled(this, true); 239 progressBar.Visible = false; 240 bwCompleted = true; 241 if (closePending) { 242 this.Close(); 243 } 244 } 184 245 } 185 246 }
Note: See TracChangeset
for help on using the changeset viewer.