Changeset 7655


Ignore:
Timestamp:
03/22/12 16:08:20 (8 years ago)
Author:
spimming
Message:

#1680:

  • User setting to store azure subscriptions
  • Method to get subscription as string for user settings
  • Methods to persist and restore subscriptions from user config
Location:
branches/HeuristicLab.Hive.Azure/HeuristicLab.Clients.Hive.CloudManager/3.3
Files:
4 added
4 edited

Legend:

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

    r7577 r7655  
    2222using System;
    2323using System.Collections.Generic;
     24using System.Collections.Specialized;
    2425using HeuristicLab.Clients.Hive.CloudManager.Azure;
    2526using HeuristicLab.Clients.Hive.CloudManager.Model;
     27using HeuristicLab.Clients.Hive.CloudManager.Properties;
    2628using HeuristicLab.Common;
    2729using HeuristicLab.Core;
     
    211213    }
    212214
    213 
     215    public void PersistSubscriptionsToUserConfig() {
     216      StringCollection strCol = new StringCollection();
     217      foreach (Subscription sub in Subscriptions) {
     218        if (sub.SaveToConfig) {
     219          string setting = sub.GetSettingString();
     220          Settings.Default.AzureSubscriptions.Add(setting);
     221        }
     222      }
     223      //TODO:
     224      //Settings.Default.Upgrade();
     225      //Settings.Default.Save();
     226
     227    }
     228
     229    public void RestoreSubscriptionsFromUserConfig() {
     230      StringCollection strCol = new StringCollection();
     231      foreach (string azureSub in strCol) {
     232        Subscription s = Subscription.ParseSettingString(azureSub);
     233        s.SaveToConfig = true;
     234        Add(s);
     235      }
     236    }
    214237  }
    215238}
  • branches/HeuristicLab.Hive.Azure/HeuristicLab.Clients.Hive.CloudManager/3.3/HeuristicLab.Clients.Hive.CloudManager-3.3.csproj

    r7608 r7655  
    8080      <DependentUpon>Resources.resx</DependentUpon>
    8181    </Compile>
     82    <Compile Include="Properties\Settings.Designer.cs">
     83      <AutoGen>True</AutoGen>
     84      <DesignTimeSharedInput>True</DesignTimeSharedInput>
     85      <DependentUpon>Settings.settings</DependentUpon>
     86    </Compile>
     87    <Compile Include="Settings.cs" />
    8288    <Compile Include="Validation.cs" />
    8389    <Compile Include="Views\AddAzureServiceDialog.cs">
     
    143149  </ItemGroup>
    144150  <ItemGroup>
     151    <None Include="app.config" />
    145152    <None Include="HeuristicLab.snk" />
    146153    <None Include="PackageFiles\HeuristicLab.Clients.Hive.Slave.Azure.ExtraLarge.cspkg">
     
    161168    <None Include="Plugin.cs.frame" />
    162169    <None Include="Properties\AssemblyInfo.cs.frame" />
     170    <None Include="Properties\Settings.settings">
     171      <Generator>SettingsSingleFileGenerator</Generator>
     172      <LastGenOutput>Settings.Designer.cs</LastGenOutput>
     173    </None>
    163174  </ItemGroup>
    164175  <ItemGroup>
  • branches/HeuristicLab.Hive.Azure/HeuristicLab.Clients.Hive.CloudManager/3.3/Model/Subscription.cs

    r7326 r7655  
    101101      this.DiscoverServices = subscription.DiscoverServices;
    102102    }
     103
     104    public string GetSettingString() {
     105      return SubscriptionID + ";" + CertificateThumbprint;
     106    }
     107
     108    public static Subscription ParseSettingString(string settingString) {
     109      int idxSeparator = settingString.IndexOf(';');
     110      string subId = settingString.Substring(0, idxSeparator);
     111      string certThumbprint = settingString.Substring(idxSeparator, settingString.Length);
     112      Subscription sub = new Subscription();
     113      sub.SubscriptionID = subId;
     114      sub.CertificateThumbprint = certThumbprint;
     115      return sub;
     116    }
    103117  }
    104118}
  • branches/HeuristicLab.Hive.Azure/HeuristicLab.Clients.Hive.CloudManager/3.3/Views/CloudResourcesView.cs

    r7608 r7655  
    7979        timer = null;
    8080      }
     81      CloudManagerClient.Instance.PersistSubscriptionsToUserConfig();
    8182      base.Dispose(disposing);
    8283    }
Note: See TracChangeset for help on using the changeset viewer.