示例#1
0
        private async void Page_Loaded(object sender, Windows.UI.Xaml.RoutedEventArgs e)
        {
            var pickedFile = await PickFile();

            ApplicationDataContainer localSettings = ApplicationData.Current.LocalSettings;

            localSettings.Values["BackgroundVideoPath"] = pickedFile.Path;

            // TODO: Make configurable with popups or something
            const int speed       = 4;
            const int delay       = 15;
            var       offsetStart = TimeSpan.FromMinutes(2);
            var       offsetEnd   = TimeSpan.FromMinutes(0);

            localSettings.Values["BackgroundVideoSpeed"]                 = speed;
            localSettings.Values["BackgroundVideoOffsetStart"]           = offsetStart.TotalSeconds;
            localSettings.Values["BackgroundVideoOffsetEnd"]             = offsetEnd.TotalSeconds;
            localSettings.Values["BackgroundVideoOffsetCurrentLocation"] = offsetStart.TotalSeconds;

            //var btc = new BackgroundTaskRegistrar();
            // btc.RegisterBackgroundChangerTask(15);

            for (int i = 0; i < 100; i++)
            {
                var bc = new WallpaperChanger();
                await bc.Update();

                await Task.Delay(TimeSpan.FromSeconds(5));
            }
        }
示例#2
0
        public async void Run(IBackgroundTaskInstance taskInstance)
        {
            // We need to use a deferral to make sure all awaits are done synchronous
            _deferral = taskInstance.GetDeferral();

            var bc = new WallpaperChanger();
            await bc.Update();

            _deferral.Complete();
        }