void client_getAllUserCompleted(object sender, getAllUserCompletedEventArgs e) { //MapLayer layer = new MapLayer(); //map.Children.Add(layer); foreach (User item in e.Result) { //Pushpin pin = new Pushpin(); //pin.Location = new GeoCoordinate(item.Latitude,item.Longitude); //pin.Content = item.UserName; //pin.Tag = item.Id; //pin.DataContext = item; //layer.AddChild(pin, pin.Location); //pin.MouseLeftButtonDown += new MouseButtonEventHandler(pin_MouseLeftButtonDown); Image pin = new Image() { Source = new BitmapImage(new Uri("Images/pin.png", UriKind.Relative)) }; pin.Width = 35; pin.Height = 35; pin.Tag = item.Id; pin.DataContext = item; layer.AddChild(pin, new GeoCoordinate(item.Latitude, item.Longitude)); pin.MouseLeftButtonDown += new MouseButtonEventHandler(pin_MouseLeftButtonDown); pin.DoubleTap += new EventHandler <System.Windows.Input.GestureEventArgs>(pin_DoubleTap); pushpinList.Add(pin); } map.SetView(new GeoCoordinate(e.Result[0].Latitude, e.Result[0].Longitude), 10); userList = e.Result.ToList <User>(); }
void client_getAllUserCompleted(object sender, getAllUserCompletedEventArgs e) { //MapLayer layer = new MapLayer(); //map.Children.Add(layer); foreach(User item in e.Result) { //Pushpin pin = new Pushpin(); //pin.Location = new GeoCoordinate(item.Latitude,item.Longitude); //pin.Content = item.UserName; //pin.Tag = item.Id; //pin.DataContext = item; //layer.AddChild(pin, pin.Location); //pin.MouseLeftButtonDown += new MouseButtonEventHandler(pin_MouseLeftButtonDown); Image pin = new Image(){Source=new BitmapImage(new Uri("Images/pin.png", UriKind.Relative))}; pin.Width = 35; pin.Height = 35; pin.Tag = item.Id; pin.DataContext = item; layer.AddChild(pin, new GeoCoordinate(item.Latitude, item.Longitude)); pin.MouseLeftButtonDown += new MouseButtonEventHandler(pin_MouseLeftButtonDown); pin.DoubleTap += new EventHandler<System.Windows.Input.GestureEventArgs>(pin_DoubleTap); pushpinList.Add(pin); } map.SetView(new GeoCoordinate(e.Result[0].Latitude, e.Result[0].Longitude), 10); userList = e.Result.ToList<User>(); }