private async void OnDoneButtonClickedAsync(object sender, EventArgs e)
        {
            IsServiceActive = true;

            try
            {
                if (AppViewModel.ServicesViewModel.UpgradableAppTiers.Any())
                {
                    await UpgradeAsync();

                    await AppViewModel
                    .ServicesViewModel
                    .SetAppUpgradingAsync(false);
                }
                else
                {
                    foreach (var version in AppViewModel.DeploymentViewModel
                             .DotnetVersions)
                    {
                        if (version.Name == SoftwareVersion.SelectedItem as string)
                        {
                            _selVersion = version;
                            break;
                        }
                    }

                    if (AppViewModel
                        .DeploymentViewModel
                        .Deployments.Any())
                    {
                        await UpdateAsync();
                    }
                    else
                    {
                        await InstallAsync();
                    }
                }

                await AppViewModel.QueryStatusAsync();

                AppView appView = await MainView.GetAppViewAsync(AppViewModel);

                if (appView != null)
                {
                    appView.UpdateStatus();
                }

                await MainView.UnstackViewAsync();
            }
            catch (Exception ex)
            {
                await ErrorHandler.ExceptionAsync(this, ex);
            }

            IsServiceActive = false;
        }
Esempio n. 2
0
        private async void ButtonRestore_ClickedAsync(object sender, EventArgs e)
        {
            IsServiceActive = true;

            try
            {
                if (AppBackups.SelectedItem != null)
                {
                    bool proceed = await DisplayAlert("Nester",
                                                      "This will restore from a backup and replace the current App. Proceed?", "Yes", "No");

                    if (!proceed)
                    {
                        IsServiceActive = false;
                        return;
                    }

                    await AppViewModel.DeploymentViewModel.RestoreAppAsync(
                        AppBackups.SelectedItem as Nest.Model.AppBackup);

                    // Reload everything
                    await AppViewModel.InitAsync();

                    AppView appView = await MainView.GetAppViewAsync(AppViewModel);

                    if (appView != null)
                    {
                        appView.UpdateStatus();
                    }
                }

                await MainView.UnstackViewAsync();
            }
            catch (Exception ex)
            {
                await ErrorHandler.ExceptionAsync(this, ex);
            }

            IsServiceActive = false;
        }