Skip to content

Instantly share code, notes, and snippets.

@aetos382
Created September 16, 2015 02:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aetos382/356d870b6c41ff5f5a2e to your computer and use it in GitHub Desktop.
Save aetos382/356d870b6c41ff5f5a2e to your computer and use it in GitHub Desktop.
private void button_Click(object sender, RoutedEventArgs e)
{
// ここは UI スレッドで実行される
Debug.WriteLine("button_Click : {0}", Thread.CurrentThread.ManagedThreadId);
var client = new WebClient();
client.Encoding = Encoding.UTF8;
client.DownloadStringCompleted += this.OnDownloadStringCompleted;
client.DownloadStringAsync(new Uri("http://tech.blog.aerie.jp"));
}
private void OnDownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
{
// ここも UI スレッドで実行されている
Debug.WriteLine("OnGetResponseCompleted : {0}", Thread.CurrentThread.ManagedThreadId);
this.webBrowser.NavigateToString(e.Result);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment