0
누군가 스크린 샷을 캡처하고 폴더 폰에 프로그래밍 방식으로 윈도우 폰 7에 저장하는 방법을 알려주십시오. MediaLibrary()에 이미지를 저장하고 싶지 않지만 저장하고 싶습니다. 응용 프로그램의 루트 디렉토리에있는 폴더스크린 샷 윈도우 폰 7
누군가 스크린 샷을 캡처하고 폴더 폰에 프로그래밍 방식으로 윈도우 폰 7에 저장하는 방법을 알려주십시오. MediaLibrary()에 이미지를 저장하고 싶지 않지만 저장하고 싶습니다. 응용 프로그램의 루트 디렉토리에있는 폴더스크린 샷 윈도우 폰 7
이 코드는 AppBar 버튼 클릭 동작에 대한 스크린 샷을 만드는 데 도움이됩니다. 그러나 스크린 샷을 응용 프로그램의 루트 폴더에 저장하도록 코드를 수정해야합니다. 다음 링크는 도움이 될 것입니다.
Save into local storage Data for Windows Phone
private void ApplicationBarScreenshotButton_Click(object sender, EventArgs e)
{
var fileName = String.Format("MyImage_{0:}.jpg", DateTime.Now.Ticks);
WriteableBitmap bmpCurrentScreenImage = new WriteableBitmap((int)this.ActualWidth, (int)this.ActualHeight);
bmpCurrentScreenImage.Render(LayoutRoot, new MatrixTransform());
bmpCurrentScreenImage.Invalidate();
SaveToMediaLibrary(bmpCurrentScreenImage, fileName, 100);
MessageBox.Show("Captured image " + fileName + " Saved Sucessfully", "WP Capture Screen", MessageBoxButton.OK);
currentFileName = fileName;
}
public void SaveToMediaLibrary(WriteableBitmap bitmap, string name, int quality)
{
using (var stream = new MemoryStream())
{
// Save the picture to the Windows Phone media library.
bitmap.SaveJpeg(stream, bitmap.PixelWidth, bitmap.PixelHeight, 0, quality);
stream.Seek(0, SeekOrigin.Begin);
// Use Above link to store file into Root folder.
//new MediaLibrary().SavePicture(name, stream);
}
}