Exemplo n.º 1
0
 protected LockScreen()
 {
     GoToLockScreenSettings  = new AsyncUnitCommand(async() => await Launcher.LaunchUriAsync(new Uri("ms-settings-lock:")));
     RequestLockScreenAccess = new AsyncUnitCommand(async() => {
         await LockScreenRequest.RequestThenSetLockScreen();
         CheckIsAppProvider();
     });
 }
Exemplo n.º 2
0
        /// <summary>
        /// The query string contains "WallpaperSettings" if the app is launched from the
        /// phone's lock screen settings. In that case, this method sets a new lock screen
        /// image. Note that the query string will be empty if the app is resumed from a
        /// suspended state, even if it's opened from the lock screen settings. So there's
        /// no guarantee that this will actually set the lock screen image immediately,
        /// however if the user sets the app as the lock screen background provider, the
        /// background agent will eventually set an image the next time it's scheduled to
        /// run.
        /// </summary>
        /// <returns></returns>
        private async Task HandleOpenAppFromLockScreenSettings()
        {
            var    lockscreenKey         = "WallpaperSettings";
            string lockscreenValue       = "";
            bool   lockscreenValueExists = NavigationContext.QueryString.TryGetValue(lockscreenKey, out lockscreenValue);

            if (lockscreenValueExists)
            {
                await LockScreenRequest.RequestThenSetLockScreen();
            }
        }