private async Task LoadAppAsync()
        {
            // Setup listening for theme changes:
            ThemeUtils.SetupThemeListener();

            // Setup listener for window activated changes:
            UiUtils.SetupWindowActivatedListener();

            // Setup window:
            UiUtils.SetupWindow(Application.Current);

            // Perform app update tasks if necessary:
            await AppUpdateHelper.OnAppStartAsync();

            // Setup App Center crashes, push:
            AppCenterHelper.SetupAppCenter();
            await ShowReportCrashIfNeeded();

            // Register background tasks:
            Logger.Info("Registering background tasks...");
            // TODO: Add background tasks here
            Logger.Info("Finished registering background tasks.");

            // Show initial start dialog:

            /*if (!Settings.getSettingBoolean(SettingsConsts.HIDE_INITIAL_START_DIALOG_ALPHA))
             * {
             *  InitialStartDialog initialStartDialog = new InitialStartDialog();
             *  await UiUtils.ShowDialogAsync(initialStartDialog);
             * }
             *
             * // Show what's new dialog:
             * if (!Settings.getSettingBoolean(SettingsConsts.HIDE_WHATS_NEW_DIALOG))
             * {
             *  WhatsNewDialog whatsNewDialog = new WhatsNewDialog();
             *  await UiUtils.ShowDialogAsync(whatsNewDialog);
             * }*/

            EvaluateActivationArgs();
        }
        private async Task LoadAppAsync()
        {
            // Setup listening for theme changes:
            ThemeUtils.SetupThemeListener();

            // Setup listener for window activated changes:
            UiUtils.SetupWindowActivatedListener();

            // Setup window:
            UiUtils.SetupWindow(Application.Current);

            // Setup App Center crashes, push:
            AppCenterHelper.SetupAppCenter(APP_CENTER_PUSH_CALLBACK);

            // Perform app update tasks if necessary:
            await AppUpdateHelper.OnAppStartAsync();

            // Register background tasks:
            Logger.Info("Registering background tasks...");
            await BackgroundTaskHelper.RegisterBackgroundTasksAsync();

            Logger.Info("Finished registering background tasks.");

            // Init the chat background helper:
            ChatBackgroundHelper.INSTANCE.Init();

            // Load all chats:
            await DataCache.INSTANCE.InitAsync();

            // Connect to all clients:
            ConnectionHandler.INSTANCE.ConnectAll();

            // Remove the messages will be send later toast:
            ToastHelper.RemoveToastGroup(ToastHelper.WILL_BE_SEND_LATER_TOAST_GROUP);

            // Update badge notification count:
            ToastHelper.UpdateBadgeNumber();

            // Show initial start dialog:
            if (!Storage.Classes.Settings.GetSettingBoolean(SettingsConsts.HIDE_INITIAL_START_DIALOG_ALPHA))
            {
                InitialStartDialog initialStartDialog = new InitialStartDialog();
                await UiUtils.ShowDialogAsync(initialStartDialog);
            }

            // Show what's new dialog:
            if (!Storage.Classes.Settings.GetSettingBoolean(SettingsConsts.HIDE_WHATS_NEW_DIALOG))
            {
                WhatsNewDialog whatsNewDialog = new WhatsNewDialog();
                await UiUtils.ShowDialogAsync(whatsNewDialog);

                if (whatsNewDialog.VIEW_MODEL.MODEL.ToDonatePageNavigated)
                {
                    if (!Storage.Classes.Settings.GetSettingBoolean(SettingsConsts.INITIALLY_STARTED))
                    {
                        PerformInitialStartSetup();
                    }
                    return;
                }
            }

            EvaluateActivationArgs();
        }
Exemplo n.º 3
0
        private async Task LoadAppAsync()
        {
            // Setup listening for theme changes:
            ThemeUtils.SetupThemeListener();

            // Setup listener for window activated changes:
            UiUtils.SetupWindowActivatedListener();

            // Setup window:
            UiUtils.SetupWindow(Application.Current);

            // Setup App Center crashes, push:
            AppCenterHelper.SetupAppCenter();
            await ShowReportCrashIfNeeded();

            // Perform app update tasks if necessary:
            await AppUpdateHelper.OnAppStartAsync();

            // Register background tasks:
            Logger.Info("Registering background tasks...");
            await BackgroundTaskHelper.RegisterBackgroundTasksAsync();

            Logger.Info("Finished registering background tasks.");

            // Initialize the chat background helper:
            ChatBackgroundHelper.INSTANCE.Init();

            // Initialize the curated list of XMPP server providers:
            await XMPPProviders.INSTANCE.initAsync();

            // Load all chats:
            await DataCache.INSTANCE.InitAsync();

            // Connect to all clients:
            ConnectionHandler.INSTANCE.ConnectAll();

            // Initialize push:
            PushManager.INSTANCE.Init();

            // Remove toasts:
            ToastHelper.RemoveToastGroup(ToastHelper.WILL_BE_SEND_LATER_TOAST_GROUP);
            ToastHelper.RemoveChatToastGroups();

            // Update badge notification count:
            ToastHelper.ResetBadgeCount();

            // Show welcome dialog:
            if (!Storage.Classes.Settings.GetSettingBoolean(SettingsConsts.HIDE_WELCOME_DIALOG))
            {
                InitialStartDialog initialStartDialog = new InitialStartDialog();
                await UiUtils.ShowDialogAsync(initialStartDialog);
            }

            // Show what's new dialog:
            if (!Storage.Classes.Settings.GetSettingBoolean(SettingsConsts.HIDE_WHATS_NEW_DIALOG))
            {
                WhatsNewDialog whatsNewDialog = new WhatsNewDialog();
                await UiUtils.ShowDialogAsync(whatsNewDialog);

                if (whatsNewDialog.VIEW_MODEL.MODEL.ToDonatePageNavigated)
                {
                    if (!Storage.Classes.Settings.GetSettingBoolean(SettingsConsts.INITIALLY_STARTED))
                    {
                        PerformInitialStartSetup();
                    }
                    return;
                }
            }

            EvaluateActivationArgs();
        }