Created
January 25, 2013 12:24
-
-
Save biac/4634046 to your computer and use it in GitHub Desktop.
WP8 で PictureAlbum の中の画像を取り出してみるテスト
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Microsoft.Xna.Framework.Media; | |
using System; | |
namespace PhoneApp1 | |
{ | |
public class PhotoAlbums | |
{ | |
public static Picture GetFirstPhoto() { | |
MediaLibrary mediaLib = new MediaLibrary(); | |
foreach (var album in mediaLib.RootPictureAlbum.Albums) | |
{ | |
if (album.Pictures == null || album.Pictures.Count == 0) | |
continue; | |
return album.Pictures[0]; | |
} | |
return null; | |
} | |
} | |
} |
ID_CAP_MEDIALIB_PHOTO を忘れる人も居るらしいw
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
WP8エミュは、起動後に一回「フォト」アプリを開いてからじゃないと、上のコードでは画像が取れない。
なじぇ~?