Introduced
Re-imagine the Windows 8 Store Apps lock screen
Login lock screen, get the current program's lock screen permission, remove from the lock screen
Send badge or text to lock screen
Bind multiple tile of an app to a lock screen
Custom lock Screen Picture
Example
1. Demonstrates how to login to the lock screen, get the current program's lock screen permission, remove from the lock screen
Lockscreen/accesslockscreen.xaml
<page x:class= "XamlDemo.LockScreen.AccessLockScreen" xmlns= "http://schemas.microsoft.com/winfx/2006/xaml/pres Entation "xmlns:x=" Http://schemas.microsoft.com/winfx/2006/xaml "xmlns:local=" Using:XamlDemo.LockScreen "xmlns :d = "http://schemas.microsoft.com/expression/blend/2008" xmlns:mc= "http://schemas.openxmlformats.org/" markup-compatibility/2006 "mc:ignorable=" D "> <grid background=" Transparent "> <stackpanel margin= "0 0 0" > <textblock name= "lblmsg" fontsize= "14.667"/> & Lt Button Name= "btnrequestaccess" content= "Request Login lock Screen" margin= "0 0 0" click= "Btnrequestaccess_click"/> &L T
Button Name= "Btngetaccessstatus" content= "get lock screen permission for current program" margin= "0 0 0" click= "Btngetaccessstatus_click"/>
<button name= "btnremoveaccess" content= "removed from the lock screen" margin= "0 0 0" click= "Btnremoveaccess_click"/> </StackPanel> </GRID> </Page>
Lockscreen/accesslockscreen.xaml.cs
* * Demonstrates how to log in to the lock screen, get the current program's lock screen permission, remove * * NOTE: * In order to request the lock screen permission, need background task support "push notice" or "Control channel" * * using System;
Using Windows.ApplicationModel.Background;
Using Windows.UI.Xaml;
Using Windows.UI.Xaml.Controls; Namespace Xamldemo.lockscreen {public sealed partial class Accesslockscreen:page {public ACCESSLOCKSCR Een () {this.
InitializeComponent ();
Private async void Btnrequestaccess_click (object sender, RoutedEventArgs e) {try {//request to the System login lock screen, pop-up confirmation dialog box//Require background task support "push notification" or "control channel", or throw an exception// Cannot run in emulator//if Backgroundaccessstatus is not equal to Unspecified, the dialog box will not appear even if Requestaccessasync () is called, requiring the user to go to "settings"
To add or remove the lock screen application backgroundaccessstatus status = await Backgroundexecutionmanager.requestaccessasync ();
* * Backgroundaccessstatus-lock screen permission for current app * Unspecified-User not selected * Denied-Rejected by the user * allowedwithalwaysonrealtimeconnectivity-for allow, and support real-time connection, even if the low battery
* Allowedmayuseactiverealtimeconnectivity-for allow, and support real-time connection, but if the low power can not be connected in real time * * Lblmsg.text = "Requestaccessasync ():" + status.
ToString (); The catch (Exception ex) {lblmsg.text = ex.
ToString ();
}} private void Btngetaccessstatus_click (object sender, RoutedEventArgs e) {try {//Get the current application's lock-screen permission backgroundaccessstatus status = Backgroundexecutionmanager .
Getaccessstatus (); Lblmsg.text = "Getaccessstatus ():" + status.
ToString (); The catch (Exception ex) {lblmsg.text = ex.
ToString ();
} private void Btnremoveaccess_click (object sender, RoutedEventArgs e) { try {//Remove the current application from the lock screen backgroundexecutionmanager.removeaccess ();
Lblmsg.text = "removeaccess ()"; The catch (Exception ex) {lblmsg.text = ex.
ToString (); }
}
}
}