public static string GetConnectionString(StorageConnection connection)
 {
     if (connection.IsDevelopmentStorage)
         return "UseDevelopmentStorage=true";
     else
     {
         string pattern = "DefaultEndpointsProtocol={0};AccountName={1};AccountKey={2}";
         return String.Format(pattern, connection.IsHttps ? "https" : "http", connection.AccountName, connection.AccountKey);
     }
 }
 private void AddOrUpdateConnection()
 {
     StorageConnection newConnection = new StorageConnection();
     newConnection.AccountName = txtAccountName.Text;
     newConnection.AccountKey = txtAccountKey.Text;
     newConnection.SourceDataPostfix = txtPostfix.Text;
     newConnection.IsDevelopmentStorage = cbxDevelopmentStorage.IsChecked.Value;
     newConnection.IsHttps = cbxHttps.IsChecked.Value;
     AddOrUpdateConnection(newConnection);
 }
 private void AddOrUpdateConnection(StorageConnection editedConnection)
 {
     StorageConnection conn = FindConnection(editedConnection);
     Settings.Connections.ForEach(x => x.IsSelected = false);
     if (conn == null)
     {
         editedConnection.IsSelected = true;
         Settings.Connections.Add(editedConnection);
     }
     else
     {
         conn.IsDevelopmentStorage = editedConnection.IsDevelopmentStorage;
         conn.IsHttps = editedConnection.IsHttps;
         conn.AccountKey = editedConnection.AccountKey;
         conn.IsSelected = true;
     }
 }
 private void PresentConnection(StorageConnection conn)
 {
     txtAccountName.Text = conn.AccountName;
     txtAccountKey.Text = conn.AccountKey;
     txtPostfix.Text = conn.SourceDataPostfix;
     cbxDevelopmentStorage.IsChecked = conn.IsDevelopmentStorage;
     cbxHttps.IsChecked = conn.IsHttps;
 }
 private StorageConnection FindConnection(StorageConnection newConnection)
 {
     return FindConnection(newConnection.AccountName, newConnection.SourceDataPostfix);
 }