コード例 #1
0
ファイル: MainWindow.xaml.cs プロジェクト: mortezasoft/Yams
        private async void OnRemoveApplication(object sender, RoutedEventArgs e)
        {
            StorageAccountConnectionInfo connectionInfo = GetCurrentConnection();
            string appId = GetSelectedAppId();

            _deploymentConfig = _deploymentConfig.RemoveApplication(appId);
            SaveLocalDeploymentConfig(connectionInfo);
            await HandleConnectionSelection();
        }
コード例 #2
0
ファイル: MainWindow.xaml.cs プロジェクト: Microsoft/Yams
 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);
     }
 }
コード例 #3
0
        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];
        }
コード例 #4
0
ファイル: MainWindow.xaml.cs プロジェクト: mortezasoft/Yams
        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);
            }
        }
コード例 #5
0
ファイル: MainWindow.xaml.cs プロジェクト: mortezasoft/Yams
        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);
            }
        }
コード例 #6
0
ファイル: MainWindow.xaml.cs プロジェクト: mortezasoft/Yams
        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);
            }
        }
コード例 #7
0
        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]);
        }
コード例 #8
0
ファイル: MainWindow.xaml.cs プロジェクト: mortezasoft/Yams
        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);
        }
コード例 #9
0
ファイル: MainWindow.xaml.cs プロジェクト: mortezasoft/Yams
        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();
        }
コード例 #10
0
ファイル: MainWindow.xaml.cs プロジェクト: mortezasoft/Yams
        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);
        }
コード例 #11
0
ファイル: MainWindow.xaml.cs プロジェクト: mortezasoft/Yams
        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());
            }
        }
コード例 #12
0
ファイル: MainWindow.xaml.cs プロジェクト: mortezasoft/Yams
        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);
            }
        }
コード例 #13
0
ファイル: MainWindow.xaml.cs プロジェクト: mortezasoft/Yams
        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);
        }
コード例 #14
0
ファイル: MainWindow.xaml.cs プロジェクト: mortezasoft/Yams
        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);
        }
コード例 #15
0
ファイル: MainWindow.xaml.cs プロジェクト: mortezasoft/Yams
        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);
        }
コード例 #16
0
ファイル: MainWindow.xaml.cs プロジェクト: mortezasoft/Yams
        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);
            }
        }
コード例 #17
0
ファイル: MainWindow.xaml.cs プロジェクト: Microsoft/Yams
        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;
        }
コード例 #18
0
ファイル: MainWindow.xaml.cs プロジェクト: Microsoft/Yams
 private void SaveLocalDeploymentConfig(StorageAccountConnectionInfo connectionInfo, string json)
 {
     string localDeploymentConfigPath = GetDeploymentConfigLocalPath(connectionInfo.AccountName);
     File.WriteAllText(localDeploymentConfigPath, json);
 }
コード例 #19
0
ファイル: MainWindow.xaml.cs プロジェクト: Microsoft/Yams
 private void SaveLocalDeploymentConfig(StorageAccountConnectionInfo connectionInfo)
 {
     string json = _deploymentConfigSerializer.Serialize(_deploymentConfig);
     SaveLocalDeploymentConfig(connectionInfo, json);
 }
コード例 #20
0
ファイル: MainWindow.xaml.cs プロジェクト: zhonli/Yams
        private void SaveLocalDeploymentConfig(StorageAccountConnectionInfo connectionInfo)
        {
            string json = _deploymentConfigSerializer.Serialize(_deploymentConfig);

            SaveLocalDeploymentConfig(connectionInfo, json);
        }
コード例 #21
0
ファイル: MainWindow.xaml.cs プロジェクト: ca-ta/Yams
 private void SaveLocalDeploymentConfig(StorageAccountConnectionInfo connectionInfo)
 {
     string json = _deploymentConfig.RawData();
     SaveLocalDeploymentConfig(connectionInfo, json);
 }
コード例 #22
0
ファイル: MainWindow.xaml.cs プロジェクト: mortezasoft/Yams
        private void SaveLocalDeploymentConfig(StorageAccountConnectionInfo connectionInfo)
        {
            string json = _deploymentConfig.RawData();

            SaveLocalDeploymentConfig(connectionInfo, json);
        }
コード例 #23
0
ファイル: MainWindow.xaml.cs プロジェクト: mortezasoft/Yams
        private void SaveLocalDeploymentConfig(StorageAccountConnectionInfo connectionInfo, string json)
        {
            string localDeploymentConfigPath = GetDeploymentConfigLocalPath(connectionInfo.AccountName);

            File.WriteAllText(localDeploymentConfigPath, json);
        }