private async void OnRemoveApplication(object sender, RoutedEventArgs e) { StorageAccountConnectionInfo connectionInfo = GetCurrentConnection(); string appId = GetSelectedAppId(); _deploymentConfig = _deploymentConfig.RemoveApplication(appId); SaveLocalDeploymentConfig(connectionInfo); await HandleConnectionSelection(); }
private void OnAddNewConnection(object sender, RoutedEventArgs e) { ConnectToStorageAccountDialog inputDialog = new ConnectToStorageAccountDialog(); if (inputDialog.ShowDialog() == true) { StorageAccountConnectionInfo connection = new StorageAccountConnectionInfo(inputDialog.AccountName, inputDialog.DataConnectionString); _storageAccountConnections.Add(connection); RefreshView(_storageAccountConnections); } }
public IDeploymentRepository GetRepository(StorageAccountConnectionInfo connectionInfo) { string connectionString = connectionInfo.ConnectionString; if (!_repos.ContainsKey(connectionString)) { IDeploymentRepository repository = _connectionFactory.CreateRepository(connectionInfo.ConnectionString); _repos.Add(connectionString, repository); } return _repos[connectionString]; }
private void OnDeleteConnection(object sender, RoutedEventArgs e) { StorageAccountConnectionInfo connectionInfo = (StorageAccountConnectionInfo)ConnectionsListView.SelectedItem; MessageBoxResult res = MessageBox.Show("The connection will be removed\n Do you want to continue", "Remove Connection", MessageBoxButton.YesNo); if (res == MessageBoxResult.Yes) { _storageAccountConnections.Remove(connectionInfo); RefreshView(_storageAccountConnections); } }
private async void OnAddApplication(object sender, RoutedEventArgs e) { StorageAccountConnectionInfo connectionInfo = GetCurrentConnection(); AddNewApplicationDialog dialog = new AddNewApplicationDialog(); if (dialog.ShowDialog() == true) { AppIdentity appIdentity = new AppIdentity(dialog.ApplicationName, new Version(dialog.Version)); await AddApplication(appIdentity, dialog.DeploymentId, dialog.BinariesPath); } }
public IDeploymentRepository GetRepository(StorageAccountConnectionInfo connectionInfo) { string connectionString = connectionInfo.ConnectionString; if (!_repos.ContainsKey(connectionString)) { IDeploymentRepository repository = _connectionFactory.CreateRepository(connectionInfo.ConnectionString); _repos.Add(connectionString, repository); } return(_repos[connectionString]); }
private void OnRemoveDeployment(object sender, RoutedEventArgs e) { StorageAccountConnectionInfo connectionInfo = GetCurrentConnection(); DeploymentInfo deploymendInfo = deploymentIdsListView.SelectedItem as DeploymentInfo; if (deploymendInfo == null) { return; } _deploymentConfig = _deploymentConfig.RemoveApplication(deploymendInfo.AppIdentity, deploymendInfo.DeploymentId); SaveLocalDeploymentConfig(connectionInfo); }
private async void OnPublishToBlob(object sender, RoutedEventArgs e) { BusyWindow busyWindow = new BusyWindow { Message = "Please wait..\n\n" + "The DeploymentConfig.json file is being uploaded to blob storage" }; busyWindow.Show(); StorageAccountConnectionInfo connectionInfo = GetCurrentConnection(); IDeploymentRepository connection = _deploymentRepositoryManager.GetRepository(connectionInfo); await connection.PublishDeploymentConfig(_deploymentConfig); busyWindow.Close(); }
private async Task <DeploymentConfig> FetchDeploymentConfig(StorageAccountConnectionInfo connectionInfo) { string path = GetDeploymentConfigLocalPath(connectionInfo.AccountName); if (File.Exists(path)) { return(new DeploymentConfig(File.ReadAllText(path))); } IDeploymentRepository connection = _deploymentRepositoryManager.GetRepository(connectionInfo); DeploymentConfig deploymentConfig = await connection.FetchDeploymentConfig(); SaveLocalDeploymentConfig(connectionInfo, deploymentConfig.RawData()); return(deploymentConfig); }
private async void OnSyncFromBlob(object sender, RoutedEventArgs e) { MessageBoxResult res = MessageBox.Show("This will ovewrite any local changes\n\n Are you sure you want to continue?", "Sync From Blob", MessageBoxButton.YesNo); if (res == MessageBoxResult.Yes) { StorageAccountConnectionInfo connectionInfo = GetCurrentConnection(); IDeploymentRepository connection = _deploymentRepositoryManager.GetRepository(connectionInfo); DeploymentConfig deploymentConfig = await connection.FetchDeploymentConfig(); SaveLocalDeploymentConfig(connectionInfo, deploymentConfig.RawData()); } }
private void OnVersionAddDeployment(object sender, RoutedEventArgs e) { StorageAccountConnectionInfo connectionInfo = GetCurrentConnection(); string appId = GetSelectedAppId(); string version = GetSelectedVersion(); AddNewDeploymentDialog dialog = new AddNewDeploymentDialog(appId, version); if (dialog.ShowDialog() == true) { AppIdentity appIdentity = new AppIdentity(appId, new Version(version)); _deploymentConfig = _deploymentConfig.AddApplication(appIdentity, dialog.DeploymentId); SaveLocalDeploymentConfig(connectionInfo); } }
private async Task AddApplication(AppIdentity appIdentity, string deploymentId, string binariesPath) { StorageAccountConnectionInfo connectionInfo = GetCurrentConnection(); IDeploymentRepository repository = _deploymentRepositoryManager.GetRepository(connectionInfo); BusyWindow busyWindow = new BusyWindow { Message = "Please wait..\n\n" + "The binaries are being uploaded to blob storage" }; busyWindow.Show(); await repository.UploadApplicationBinaries(appIdentity, binariesPath, ConflictResolutionMode.DoNothingIfBinariesExist); busyWindow.Close(); _deploymentConfig = _deploymentConfig.AddApplication(appIdentity, deploymentId); SaveLocalDeploymentConfig(connectionInfo); }
private async Task HandleConnectionSelection() { StorageAccountConnectionInfo connectionInfo = GetCurrentConnection(); IEnumerable <string> appIds = new List <string>(); try { _deploymentConfig = await FetchDeploymentConfig(connectionInfo); appIds = _deploymentConfig.ListApplications(); } catch (StorageException ex) { Debug.WriteLine("Failed to fetch the DeploymentConfig file from account " + connectionInfo.AccountName + " Exception: " + ex); } AppsListView.ItemsSource = appIds; RefreshView(appIds); }
private void OnRemoveVersion(object sender, RoutedEventArgs e) { StorageAccountConnectionInfo connectionInfo = GetCurrentConnection(); string appId = GetSelectedAppId(); if (appId == null) { return; } string version = GetSelectedVersion(); if (version == null) { return; } _deploymentConfig = _deploymentConfig.RemoveApplication(new AppIdentity(appId, version)); SaveLocalDeploymentConfig(connectionInfo); }
private async void OnUpdateVersion(object sender, RoutedEventArgs e) { StorageAccountConnectionInfo connectionInfo = GetCurrentConnection(); string appId = GetSelectedAppId(); string version = GetSelectedVersion(); AppIdentity appIdentity = new AppIdentity(appId, version); IEnumerable <string> availableDeploymentIds = _deploymentConfig.ListDeploymentIds(appIdentity); UpdateVersionDialog dialog = new UpdateVersionDialog(appId, version, availableDeploymentIds); if (dialog.ShowDialog() == true) { string newVersion = dialog.NewVersion; AppIdentity newAppIdentity = new AppIdentity(appIdentity.Id, newVersion); IEnumerable <string> selectedDeploymentIds = dialog.SelectedDeploymentIds; foreach (string deploymentId in selectedDeploymentIds) { await AddApplication(newAppIdentity, deploymentId, dialog.BinariesPath); _deploymentConfig = _deploymentConfig.RemoveApplication(appIdentity, deploymentId); } SaveLocalDeploymentConfig(connectionInfo); } }
private async Task<DeploymentConfig> FetchDeploymentConfig(StorageAccountConnectionInfo connectionInfo) { string path = GetDeploymentConfigLocalPath(connectionInfo.AccountName); if (File.Exists(path)) { return _deploymentConfigSerializer.Deserialize(File.ReadAllText(path)); } IDeploymentRepository connection = _deploymentRepositoryManager.GetRepository(connectionInfo); DeploymentConfig deploymentConfig = await connection.FetchDeploymentConfig(); SaveLocalDeploymentConfig(connectionInfo, _deploymentConfigSerializer.Serialize(deploymentConfig)); return deploymentConfig; }
private void SaveLocalDeploymentConfig(StorageAccountConnectionInfo connectionInfo, string json) { string localDeploymentConfigPath = GetDeploymentConfigLocalPath(connectionInfo.AccountName); File.WriteAllText(localDeploymentConfigPath, json); }
private void SaveLocalDeploymentConfig(StorageAccountConnectionInfo connectionInfo) { string json = _deploymentConfigSerializer.Serialize(_deploymentConfig); SaveLocalDeploymentConfig(connectionInfo, json); }
private void SaveLocalDeploymentConfig(StorageAccountConnectionInfo connectionInfo) { string json = _deploymentConfig.RawData(); SaveLocalDeploymentConfig(connectionInfo, json); }