Example #1
0
        async Task UpdateServicesAsync()
        {
            if (_selectedAppRow == null)
            {
                return;
            }

            if (_isUpgrading)
            {
                AppViewModel.ServicesViewModel.UpgradeAppServiceTier(_selectedAppRow.Tier);
                await MainView.StackViewSkipBackAsync(new AppSummaryView(AppViewModel));
            }
            else
            {
                if (AppViewModel.EditApp.Status != "assigned")
                {
                    await AppViewModel.CreateAppAsync(_selectedAppRow.Tier);

                    await AppViewModel.InitAsync();

                    BaseViewModels.AppCollectionViewModel.AddModel(AppViewModel);
                }

                if (_selectedAppRow != null && (
                        AppViewModel.ServicesViewModel.SelectedAppServiceTableItem == null ||
                        AppViewModel.ServicesViewModel.SelectedAppServiceTableItem.Tier.Id != _selectedAppRow.Tier.Id))
                {
                    await AppViewModel.ServicesViewModel.SwitchAppServiceTierAsync(_selectedAppRow.Tier);
                }

                if (AppViewModel.ServicesViewModel.SelectedStorageServiceTableItem == null && MariaDBEnabled.IsToggled)
                {
                    await AppViewModel.ServicesViewModel.CreateDefaultStorageServiceAsync();
                }
                else if (AppViewModel.ServicesViewModel.SelectedStorageServiceTableItem != null && !MariaDBEnabled.IsToggled)
                {
                    await AppViewModel.ServicesViewModel.RemoveDefaultStorageServiceAsync();
                }
            }
        }