Lock screen image change

-1

Here is my code:

Uri u = new Uri(@"C:\roomieUser\w3.tif");
Windows.System.UserProfile.LockScreen.RequestSetImageFeedAsync(u);

I am trying to change the lock screen in a Windows forms application. I have managed to use WinRT libraries in Windows forms application and there are two methods to change picture one is written above and other is as below

LockScreen.SetImageFileAsync(); //But it requires IStorageFile passed in method

I have pictures stored in "resources" folder, is there any method to convert/use these pictures as IStorageFile?

File path is correct but when I tries to run it shows an error message that

Element not found. (Exception from HRESULT: 0x80070490)

c#
windows-runtime
lockscreen
asked on Stack Overflow Aug 6, 2016 by Asim Mehmood • edited Aug 6, 2016 by marc_s

1 Answer

0

LockScreen.RequestSetImageFeedAsync is supposed to be called with a Uri pointing to an RSS feed, not an image. This method is deprecated in Windows 10.

You can use StorageFile.GetFileFromApplicationUriAsync to get files from the application's resources folder.

answered on Stack Overflow Aug 11, 2016 by 0xcaff

User contributions licensed under CC BY-SA 3.0