Created
December 8, 2012 08:58
-
-
Save biac/4239370 to your computer and use it in GitHub Desktop.
WP8 の C# から Windows Phone ランタイム コンポーネントを使う
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
private async void ReadFile() | |
{ | |
// バイト配列に読み込んでから、MultiByteToWideChar()を通す | |
const string FileUrl = "ms-appx:///TextFile1.txt"; | |
var storage = await StorageFile.GetFileFromApplicationUriAsync(new Uri(FileUrl)); | |
using (var stream = await storage.OpenReadAsync()) | |
{ | |
byte[] buff = new byte[stream.Size]; | |
await stream.AsStreamForRead().ReadAsync(buff, 0, buff.Length); | |
this.textBox2.Text = WindowsPhoneRuntimeComponent.MultiByteToWideCharWP8(buff); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment