Example #1
0
        public void Run(IBackgroundTaskInstance taskInstance)
        {
            // Get the background task details
            string taskName = taskInstance.Task.Name;

            Debug.WriteLine("Background " + taskName + " starting...");

            ApproxTileUpdater.ScheduleLiveTileUpdates();
            ApproxTileUpdater.UpdateLiveTiles();

            Debug.WriteLine("Background " + taskName + " completed!");
        }
Example #2
0
        async void MainPage_Loaded(object sender, RoutedEventArgs e)
        {
            if (!BackgroundTaskHelper.CheckBackgroundTaskActive())
            {
                //
                // Seek permission for registering the task
                //
                var accessResult = await BackgroundExecutionManager.RequestAccessAsync();

                if (accessResult == BackgroundAccessStatus.AllowedWithAlwaysOnRealTimeConnectivity ||
                    accessResult == BackgroundAccessStatus.AllowedMayUseActiveRealTimeConnectivity)
                {
                    BackgroundTaskHelper.ActivateTimeTrigger();
                }
            }

            // tile notifications
            await Task.Run(() =>
            {
                ApproxTileUpdater.ScheduleLiveTileUpdates();
                ApproxTileUpdater.UpdateLiveTiles();
            });
        }
Example #3
0
        private async void appBarPin_Click(object sender, RoutedEventArgs e)
        {
            // save time settings
            Settings settings = new Settings();

            settings.AppLanguage      = Frame.Language;
            settings.TileTier         = tvm.CurrentTier <= Tier.SystemClock ? tvm.CurrentTier : Tier.SystemClock;
            settings.LastTileSchedule = DateTimeOffset.MinValue;

            SecondaryTile st = new SecondaryTile(ApproxTileUpdater.SecondaryAppTileId, "Approx Time", "Approx Time", ApproxTileUpdater.SecondaryAppTileId, TileOptions.None,
                                                 new Uri("ms-appx:///Assets/Square150x150Logo.png"), new Uri("ms-appx:///Assets/Wide310x150Logo.png"));

            if (await st.RequestCreateAsync())
            {
                tvm.IsPinningToStart = true;
                await Task.Run(() =>
                {
                    ApproxTileUpdater.ScheduleLiveTileUpdates();
                    ApproxTileUpdater.UpdateLiveTiles();
                });

                tvm.IsPinningToStart = false;
            }
        }