Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@biac
Created January 25, 2013 12:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save biac/4634046 to your computer and use it in GitHub Desktop.
Save biac/4634046 to your computer and use it in GitHub Desktop.
WP8 で PictureAlbum の中の画像を取り出してみるテスト
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;
}
}
}
@biac
Copy link
Author

biac commented Jan 25, 2013

WP8エミュは、起動後に一回「フォト」アプリを開いてからじゃないと、上のコードでは画像が取れない。
なじぇ~?

@biac
Copy link
Author

biac commented Jan 25, 2013

ID_CAP_MEDIALIB_PHOTO を忘れる人も居るらしいw

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment