Guys,
I’m trying to create a plugin which basically just takes a screenshot using WP8. For whatever reason it always saves a black image and not my game image:
var ui = Application.Current.RootVisual;
WriteableBitmap bmp = new WriteableBitmap(ui, null);
bmp.Render(ui, new TranslateTransform());
using (var mediaLibrary = new MediaLibrary())
{
using (var stream = new MemoryStream())
{
var fileName = string.Format(“Gs{0}.jpg”, Guid.NewGuid());
bmp.SaveJpeg(stream, bmp.PixelWidth, bmp.PixelHeight, 0, 100);
stream.Seek(0, SeekOrigin.Begin);
var picture = mediaLibrary.SavePicture(fileName, stream);
Debug.WriteLine("Saved screenshot to " + fileName);
Debug.WriteLine(“Status " + " true”);
//if (picture.Name.Contains(fileName)) return true;
}
}
Debug.WriteLine(“Status " + " false”);
I think var ui = Application.Current.RootVisual may be the wrong UIElement to call, any ideas?