private async Task OnRefreshTemplatesAsync()
        {
            try
            {
                await GenContext.ToolBox.Repo.RefreshAsync();

                WizardStatus.TemplatesVersion = GenContext.ToolBox.TemplatesVersion;
                await OnNewTemplatesAvailableAsync();

                WizardStatus.NewVersionAvailable = false;
                WizardStatus.SetStatus(StatusViewModel.Information(StringRes.StatusUpdated, true, 5));
            }
            catch (Exception ex)
            {
                WizardStatus.SetStatus(StatusViewModel.Information(StringRes.ErrorSyncRefresh));

                await AppHealth.Current.Error.TrackAsync(ex.ToString());

                await AppHealth.Current.Exception.TrackAsync(ex);
            }
            finally
            {
                WizardStatus.IsLoading = GenContext.ToolBox.Repo.SyncInProgress;
            }
        }
        private async void SyncSyncStatusChanged(object sender, SyncStatusEventArgs status)
        {
            SafeThreading.JoinableTaskFactory.Run(async() =>
            {
                await SafeThreading.JoinableTaskFactory.SwitchToMainThreadAsync();
                WizardStatus.SetStatus(status.Status.GetStatusViewModel());
            });

            if (status.Status == SyncStatus.Updated)
            {
                WizardStatus.TemplatesVersion = GenContext.ToolBox.Repo.TemplatesVersion;
                CleanStatus();

                UpdateTemplatesAvailable(true);
                await OnTemplatesAvailableAsync();

                WizardStatus.IsLoading = false;
                UpdateCanCheckUpdates(true);
            }

            if (status.Status == SyncStatus.OverVersion)
            {
                SafeThreading.JoinableTaskFactory.Run(async() =>
                {
                    await SafeThreading.JoinableTaskFactory.SwitchToMainThreadAsync();
                    UpdateTemplatesAvailable(true);
                });
            }

            if (status.Status == SyncStatus.OverVersionNoContent)
            {
                SafeThreading.JoinableTaskFactory.Run(async() =>
                {
                    await SafeThreading.JoinableTaskFactory.SwitchToMainThreadAsync();
                    UpdateTemplatesAvailable(false);
                });
            }

            if (status.Status == SyncStatus.UnderVersion)
            {
                SafeThreading.JoinableTaskFactory.Run(async() =>
                {
                    await SafeThreading.JoinableTaskFactory.SwitchToMainThreadAsync();
                    UpdateTemplatesAvailable(false);
                });
            }

            if (status.Status == SyncStatus.NewVersionAvailable)
            {
                WizardStatus.NewVersionAvailable = true;
            }
        }
        private async Task OnCheckUpdatesAsync()
        {
            try
            {
                UpdateCanCheckUpdates(false);
                await GenContext.ToolBox.Repo.CheckForUpdatesAsync();
            }
            catch (Exception ex)
            {
                WizardStatus.SetStatus(StatusViewModel.Information(StringRes.ErrorSyncRefresh));
                await AppHealth.Current.Error.TrackAsync(ex.ToString());

                await AppHealth.Current.Exception.TrackAsync(ex);
            }
            finally
            {
                WizardStatus.IsLoading = GenContext.ToolBox.Repo.SyncInProgress;
                UpdateCanCheckUpdates(!GenContext.ToolBox.Repo.SyncInProgress);
            }
        }
        protected async Task BaseInitializeAsync()
        {
            GenContext.ToolBox.Repo.Sync.SyncStatusChanged += SyncSyncStatusChanged;
            try
            {
                await GenContext.ToolBox.Repo.SynchronizeAsync();

                WizardStatus.TemplatesVersion = GenContext.ToolBox.TemplatesVersion;
                WizardStatus.WizardVersion    = GenContext.ToolBox.WizardVersion;
            }
            catch (Exception ex)
            {
                WizardStatus.SetStatus(StatusViewModel.Information(StringRes.ErrorSync));

                await AppHealth.Current.Error.TrackAsync(ex.ToString());

                await AppHealth.Current.Exception.TrackAsync(ex);
            }
            finally
            {
                WizardStatus.IsLoading = GenContext.ToolBox.Repo.SyncInProgress;
                UpdateCanCheckUpdates(!GenContext.ToolBox.Repo.SyncInProgress);
            }
        }
 public void SetValidationErrors(string errorMessage, StatusType statusType = StatusType.Error)
 {
     WizardStatus.SetStatus(new StatusViewModel(statusType, errorMessage));
     UpdateHasValidationErrors(true);
 }