Пример #1
0
        private void InitApp(string countdownGuid, string arguments, bool prelaunchActivated)
        {
            var applicationView = ApplicationView.GetForCurrentView();

            applicationView.SetPreferredMinSize(new Size(320, 320));

            var shell = Window.Current.Content as AppShell;

            if (shell == null)
            {
                BackgroundActivity.RegisterBackgroundTask();

                shell = new AppShell
                {
                    Language = ApplicationLanguages.Languages[0]
                };

                shell.CustomizeTitleBar(applicationView);

                shell.AppFrame.NavigationFailed += OnNavigationFailed;

                Window.Current.Content = shell;
            }

            if (!string.IsNullOrEmpty(countdownGuid))
            {
                shell.SelectCountdown(countdownGuid);
            }

            if (!prelaunchActivated)
            {
                if (shell.AppFrame.Content == null)
                {
                    // Navigate to the first page
                    shell.AppFrame.Navigate(typeof(MainPage), arguments);
                }

                Window.Current.Activate();
            }
        }
Пример #2
0
        public static void Start(IBackgroundTaskInstance taskInstance)
        {
            var task = new BackgroundActivity();

            task.Run(taskInstance);
        }
Пример #3
0
 protected override void OnBackgroundActivated(BackgroundActivatedEventArgs args)
 {
     BackgroundActivity.Start(args.TaskInstance);
 }