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; namespace SilverlightApplication1 { public partial class lugeja1 : UserControl { public lugeja1() { InitializeComponent(); } private void nupp1_Click(object sender, RoutedEventArgs e) { WebClient klient = new WebClient(); klient.DownloadStringCompleted += new DownloadStringCompletedEventHandler(klient_DownloadStringCompleted); klient.DownloadStringAsync(new Uri("http://localhost:1356/SilverlightApplication1.Web/teade.txt") // Uri("http://minitorn.tlu.ee/~jaagup/kool/java/kursused/09/dotnet/silverlight2.txt") ); } void klient_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e) { if (e.Error != null) { MessageBox.Show(e.Error.InnerException.Message); } tekst1.Text = e.Result; } } }