Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
WP8 の C# から Windows Phone ランタイム コンポーネントを使う
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