Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
02/01/12 15:14:22 (12 years ago)
Author:
spimming
Message:

#1680: Implemented Save and Delete in CloudResourcesView and CloudManagerClient

Location:
branches/HeuristicLab.Hive.Azure/HeuristicLab.Clients.Hive.CloudManager/3.3
Files:
5 edited

Legend:

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

    r7421 r7441  
    8585    public const string DeploymentConfigurationPath = "files/ServiceConfiguration.Cloud.cscfg";
    8686    public const string DeploymentLabel = "HeuristicLab.Hive.Slave";
     87    public const string DeploymentRoleName = "HeuristicLab.Clients.Hive.Slave.AzureClient";
    8788
    8889    #endregion
  • branches/HeuristicLab.Hive.Azure/HeuristicLab.Clients.Hive.CloudManager/3.3/CloudManagerClient.cs

    r7433 r7441  
    148148    }
    149149
     150    public void ChangeIntances(Deployment deployment, HostedService hostedService) {
     151      if (deployment == null) {
     152        throw new ArgumentNullException("Deployment", "Deployment must not be null.");
     153      }
     154      if (hostedService == null) {
     155        throw new ArgumentNullException("HostedService", "HostedService must not be null.");
     156      }
     157      if (deployment.Modified) {
     158        AzureProvider.ChangeInstanceCount(deployment.Subscription,
     159                                          hostedService.ServiceName,
     160                                          deployment.DeploymentSlot,
     161                                          HeuristicLab.Clients.Hive.CloudManager.Azure.Constants.DeploymentRoleName,
     162                                          deployment.NewInstanceCount);
     163        deployment.Modified = false;
     164      }
     165    }
     166
     167    public void Delete(Deployment deployment, HostedService hostedService) {
     168      if (deployment == null) {
     169        throw new ArgumentNullException("Deployment", "Deployment must not be null.");
     170      }
     171      if (hostedService == null) {
     172        throw new ArgumentNullException("HostedService", "HostedService must not be null.");
     173      }
     174      //AzureProvider.DeleteDeployment();
     175    }
     176
     177    public void Delete(HostedService hostedService) {
     178      if (hostedService == null) {
     179        throw new ArgumentNullException("HostedService", "HostedService must not be null.");
     180      }
     181      AzureProvider.DeleteHostedService(hostedService.Subscription, hostedService.ServiceName);
     182    }
     183
     184    public void Delete(Subscription subscription) {
     185      if (subscription == null) {
     186        throw new ArgumentNullException("subscription", "Subscription must not be null.");
     187      }
     188      if (Subscriptions.Contains(subscription)) {
     189        Subscriptions.Remove(subscription);
     190      }
     191    }
     192
    150193
    151194  }
  • branches/HeuristicLab.Hive.Azure/HeuristicLab.Clients.Hive.CloudManager/3.3/Views/CloudResourcesView.Designer.cs

    r7403 r7441  
    7171      this.btnSave.TabIndex = 4;
    7272      this.btnSave.UseVisualStyleBackColor = true;
     73      this.btnSave.Click += new System.EventHandler(this.btnSave_Click);
    7374      //
    7475      // btnDelete
     
    8081      this.btnDelete.TabIndex = 3;
    8182      this.btnDelete.UseVisualStyleBackColor = true;
     83      this.btnDelete.Click += new System.EventHandler(this.btnDelete_Click);
    8284      //
    8385      // btnAddSlaveService
  • branches/HeuristicLab.Hive.Azure/HeuristicLab.Clients.Hive.CloudManager/3.3/Views/CloudResourcesView.cs

    r7433 r7441  
    292292      viewHost.Content = (IContent)e.Node.Tag;
    293293    }
     294
     295    private void btnSave_Click(object sender, EventArgs e) {
     296      if (treeCloudResources.SelectedNode != null) {
     297        TreeNode tn = treeCloudResources.SelectedNode;
     298        TreeNode tnParent = tn.Parent;
     299        Object obj = tn.Tag;
     300        Object objParent = tnParent.Tag;
     301        if (obj is Subscription) {
     302          // CloudManagerClient.Instance.Save((Subscription)obj);
     303        } else if (obj is HostedService) {
     304          // nothing to do so far
     305        } else if (obj is Deployment && objParent is HostedService) {
     306          HostedService hs = (HostedService)objParent;
     307          Deployment dep = (Deployment)obj;
     308          //call async
     309          CloudManagerClient.Instance.ChangeIntances(dep, hs);
     310        }
     311      }
     312    }
     313
     314    private void btnDelete_Click(object sender, EventArgs e) {
     315      if (treeCloudResources.SelectedNode != null) {
     316        TreeNode tn = treeCloudResources.SelectedNode;
     317        TreeNode tnParent = tn.Parent;
     318        Object obj = tn.Tag;
     319        Object objParent = null;
     320        if (tnParent != null) {
     321          objParent = tnParent.Tag;
     322        }
     323        viewHost.Content = null;
     324        if (obj is Subscription) {
     325          CloudManagerClient.Instance.Delete((Subscription)obj);
     326        } else if (obj is HostedService) {
     327          // nothing to do so far
     328        } else if (obj is Deployment && objParent is HostedService) {
     329          HostedService hs = (HostedService)objParent;
     330          Deployment dep = (Deployment)obj;
     331          //call async
     332          CloudManagerClient.Instance.Delete(dep, hs);
     333        }
     334      }
     335    }
    294336  }
    295337}
  • branches/HeuristicLab.Hive.Azure/HeuristicLab.Clients.Hive.CloudManager/3.3/Views/DeploymentView.cs

    r7433 r7441  
    4848        } else {
    4949          tbChangeCores.Value = Content.RoleInstanceList.Count;
     50          lblChanges.Text = "";
    5051        }
    5152
Note: See TracChangeset for help on using the changeset viewer.