samsungsamsung 发表于 2015-5-24 03:30:40

windows phone 8 更换锁屏界面图片

  1,打开WMAppManifest.xml.添加
  
      

  
  
2,添加事件


private async void buttonSet_Click(object sender, RoutedEventArgs e)
{
      Uri nextImageUri;
      nextImageUri = new Uri("file:///" + Windows.ApplicationModel.Package.Current.InstalledLocation.Path + "/DefaultWallpaper.jpg", UriKind.RelativeOrAbsolute);
      try
      {
            bool isProvider = Windows.Phone.System.UserProfile.LockScreenWallpaperManager.IsProvidedByCurrentApplication;
            if (isProvider)
            {
                  Windows.Phone.System.UserProfile.LockScreenWallpaper.SetImageUri(nextImageUri);
            }
            else
            {
                  var op = await LockScreenWallpaperManager.RequestAccessAsync();
            }
      }
      catch (System.Exception ex)
      {
            MessageBox.Show(ex.ToString());
      }
}

From SDK:
Lock screen background for Windows Phone  

  
页: [1]
查看完整版本: windows phone 8 更换锁屏界面图片