What a cool feature!! Controling the Windows 8.1 lock screen slide show - Eternal Coding - HTML5 / Windows / Kinect / 3D development - Site Home - MSDN Blogs

What a cool feature!! Controling the Windows 8.1 lock screen slide show


 

What a cool feature!! Controling the Windows 8.1 lock screen slide show

  • Comments 9

Windows 8.1 introduced a really cool feature for users and developers: the control of the lock screen slide show.

Starting with Windows 8, we were already able to define the lock screen background image but now we can do more: we can transform the lock screen into a cool slide show Sourire:

I really love this feature and I can spend hours watching beautiful pictures (always from Magic the Gathering Sourire) sliding on my screens.

You will see that enabling this feature from your own application is pretty simple!

The LockScreen class

The LockScreen class was introduced with WinRT and Windows 8. Initially, It allowed you to control the lock screen background image with this simple piece of code:

var lockScreen = Windows.System.UserProfile.LockScreen;
lockScreen.setImageFileAsync(file);

Really simple, isn’t it ?

Controling the slide show

Starting with Windows 8.1, the LockScreen is now able to control the slide show feature. It can be activated from the PC Settings screen:

image

As you can see, your application can provide the content displayed by the lock screen. To do so the following code is used:

Windows.System.UserProfile.LockScreen.requestSetImageFeedAsync(
new Windows.Foundation.Uri("https://urzagatherer.azure-mobile.net/api/wallpapers")).then(function (result) if (result === Windows.System.UserProfile.SetImageFeedResult.success) { … } else { … } });

To control the slide show, Windows 8.1 will use a remote RSS feed provided to requestSetImageFeedAsync function.

Here is an example of the awaited structure of the RSS feed:

<?xml version="1.0" ?>
<rss version="2.0">
<channel>
	<title>UrzaGatherer's Wallpapers</title>
	<link>https://urzagatherer.azure-mobile.net/api/wallpapers</link>
	<description>List of wallpapers published on Magic the Gathering official site</description>
	<pubDate>Wed, 13 Nov 2013 13:48:57 GMT</pubDate>
	<lastBuildDate>Wed, 13 Nov 2013 13:48:57 GMT</lastBuildDate>
	<item>
		<title>Wallpaper Thassa God ofthe Sea 1920x1080</title>
		<link>http://media.wizards.com/images/magic/daily/wallpapers/Wallpaper_Thassa_God_ofthe_Sea_1920x1080.jpg</link>
		<description>Wallpaper Thassa God ofthe Sea 1920x1080</description>
		<enclosure url="http://media.wizards.com/images/magic/daily/wallpapers/Wallpaper_Thassa_God_ofthe_Sea_1920x1080.jpg" type="image/jpg" />
		<pubDate>Sun, 10 Nov 2013 22:00:05 GMT</pubDate>
	</item>
	<item>
		<title>Wallpaper Nylea God ofthe Hunt 1920x1080</title>
		<link>http://media.wizards.com/images/magic/daily/wallpapers/Wallpaper_Nylea_God_ofthe_Hunt_1920x1080.jpg</link>
		<description>Wallpaper Nylea God ofthe Hunt 1920x1080</description>
		<enclosure url="http://media.wizards.com/images/magic/daily/wallpapers/Wallpaper_Nylea_God_ofthe_Hunt_1920x1080.jpg" type="image/jpg" />
		<pubDate>Sun, 10 Nov 2013 22:00:05 GMT</pubDate>
	</item>
	<item>
		<title>Wallpaper Nykthos Shrine to Nyx 1920x1080</title>
		<link>http://media.wizards.com/images/magic/daily/wallpapers/Wallpaper_Nykthos_Shrine_to_Nyx_1920x1080.jpg</link>
		<description>Wallpaper Nykthos Shrine to Nyx 1920x1080</description>
		<enclosure url="http://media.wizards.com/images/magic/daily/wallpapers/Wallpaper_Nykthos_Shrine_to_Nyx_1920x1080.jpg" type="image/jpg" />
		<pubDate>Sun, 10 Nov 2013 22:00:05 GMT</pubDate>
	</item>
</channel> </rss>

Do not hesitate to add this feature to your application. It is simple to use and integrate and provide a very differentiating value.

Leave a Comment
  • Please add 3 and 6 and type the answer here:
  • Post
  • awesome

  • Waahou

  • Does this code work for a laptop with Windows 8.1? Where do you put the code?

  • You can use it into a windows8.1 store apps

    it works for win8.1 whatever hardware you have.

  • Any chance you can set the RequestSetImageFeedAsync to a xml inside your localStorage folder?

    I copied the xml from your example to the localFolder and created a valid Uri (at least I think it's valid) with:

    Uri.TryCreate(feedFile.Path, UriKind.RelativeOrAbsolute, out dataUri)

    But everytime I try to run the app, it's saying that there was an error while configuring the slideshow for the lockscreen (I got the german version, so I don't know the english error text).

    The same goes if I try it from the appBundle with ms-appx:/// and ms-appdata:/// and so on.

  • Alas this must be an external URL :(

  • This looks amazing so if i get this right you can set an RSS feed as the lock screen slideshow.

    Stupid Question time

    How do i execute the code on my test machines to see if it works, is it c# or Javascript. or is Visual Studio needed

    Thanks

    Windows.System.UserProfile.LockScreen.requestSetImageFeedAsync(

      new Windows.Foundation.Uri("urzagatherer.azure-mobile.net/.../wallpapers")).then(function (result)

       if (result === Windows.System.UserProfile.SetImageFeedResult.success) {

           …

       } else {

           …

       }

    });

  • This is JavaScript but the C# version will look like this one a lot :)

  • And BTW you will need Visual Studio in order to create a win8.1 app

Page 1 of 1 (9 items)