Exemplo n.º 1
0
        private async void Initialize()
        {
            try
            {
                await BackgroundTaskHelper.RegisterTimeTriggerBackgroundTaskAsync();
            }

            catch (Exception ex)
            {
                Status = "Failed registering background task: " + ex.ToString();
                return;
            }

            try
            {
                ToastHelper.EnsureToastsAreScheduled();
            }

            catch (Exception ex)
            {
                Status = "Failed scheduling toasts: " + ex.ToString();
                return;
            }

            IsEnabled = true;
            Status    = "Everything's good! Close the app and go on with life. You'll get reminders every hour from 9-5. Make sure you've installed the app on another device too, so that you can actually test Universal Dismiss.";

            UpdateScheduledNotificationsList();

            DispatcherTimer timer = new DispatcherTimer()
            {
                Interval = TimeSpan.FromSeconds(15)
            };

            timer.Tick += Timer_Tick;
            timer.Start();
        }