Created
December 19, 2013 18:12
-
-
Save mbmccormick/8043676 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
public void RenderLiveTileImage(string filename, string title, string content) | |
{ | |
this.txtTitle.Text = title; | |
this.txtContent.Text = content; | |
this.Measure(new Size(336, 336)); | |
this.Arrange(new Rect(0, 0, 336, 336)); | |
this.UpdateLayout(); | |
WriteableBitmap image = new WriteableBitmap(336, 336); | |
image.Render(this, null); | |
image.Invalidate(); | |
using (IsolatedStorageFile output = IsolatedStorageFile.GetUserStoreForApplication()) | |
{ | |
using (var stream = output.OpenFile(filename, System.IO.FileMode.OpenOrCreate)) | |
{ | |
image.WritePNG(stream); | |
} | |
output.Dispose(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment