using System; using System.Collections.Generic; using System.Linq; using System.Xml.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 lugeja3 : UserControl { WebClient klient = new WebClient(); public lugeja3() { InitializeComponent(); klient.DownloadStringCompleted += new DownloadStringCompletedEventHandler(klient_DownloadStringCompleted); klient.DownloadStringAsync(new Uri("http://localhost:1356/SilverlightApplication1.Web/inimloetelu5.aspx")); } void klient_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e) { XDocument doc = XDocument.Parse(e.Result); foreach (XElement isik in doc.Descendants("isik")) { //MessageBox.Show(isik.Element("x").FirstNode.ToString()); inimesitaja r = new inimesitaja(); r.Width = 20; r.Height = 20; //r.Fill = new SolidColorBrush(Colors.Green); Canvas.SetLeft(r, Convert.ToInt32(isik.Element("x").FirstNode.ToString())); Canvas.SetTop(r, Convert.ToInt32(isik.Element("y").FirstNode.ToString())); r.eesnimi = isik.Element("eesnimi").FirstNode.ToString(); juur.Children.Add(r); } //Joonista iga inimese koordinaatidele ring //throw new NotImplementedException(); } } }