모다의 윈도우폰7 뚝딱 팩토리(4)-윈도우폰과 인터넷 연결하기
모다의 윈도우폰7 뚝딱 팩토리(4)-윈도우폰과 인터넷 연결하기
한국마이크로소프트에서 초급 스마트폰 개발자 분들을 위해 공개하는 모다의 윈도우폰7 뚝딱 팩토리 네번째 영상!
인터넷과 연결해서 웹에 있는 데이터를 활용하는 법에 대해 알려드리는 시간입니다.
이번 예제에서 사용된 예제 소스코드는 아래를 참고해주시고 인터넷과 연결할때 사용되는 클래스인 WebClient 클래스에 대한 자세한 정보는 MSDN 라이브러리를 방문해 주시기 바랍니다.
using System; using System.Collections.Generic; using System.Linq; using System.Net; using System.Windows; using System.Windows.Controls; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Animation; using System.Windows.Shapes; using Microsoft.Phone.Controls; using System.Text.RegularExpressions; namespace blogView { public partial class MainPage : PhoneApplicationPage { // Constructor public MainPage() { InitializeComponent(); } private void button1_Click(object sender, RoutedEventArgs e) { WebClient rssReader = new WebClient(); rssReader.DownloadStringAsync(new Uri("https://blogs.msdn.com/b/jinhoseo/rss.aspx")); rssReader.DownloadStringCompleted += new DownloadStringCompletedEventHandler(rssReader_DownloadStringCompleted); } void rssReader_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e) { // throw new NotImplementedException(); //rssView.Text = e.Result; MessageBox.Show("Download Completed"); rssView.Text = Regex.Replace(e.Result, @"<(.|\n)*?>", string.Empty); } } } |