private DiyPushpin addNewPushpinLocatePushpin(Location loc)
 {
     DiyPushpin diyPushpin = new DiyPushpin();
     diyPushpin.latitude = loc.Latitude;
     diyPushpin.longitude = loc.Longitude;
     map.Children.Add(diyPushpin);
     MapLayer.SetPosition(diyPushpin, loc);
     return diyPushpin;
 }
 private DataModel.PushpinDataStructure addNewPushpinConfigureDataOfNewPushpin(DiyPushpin diyPushpin)
 {
     diyPushpin.Tapped += diyPushpin_Tapped;
     DataModel.PushpinDataStructure pds = new DataModel.PushpinDataStructure()
     {
         Latitude = diyPushpin.latitude,
         Longitude = diyPushpin.longitude,
         Id = DateTime.Now.ToString() + diyPushpin.latitude.ToString()
         //PushpinType = _tapStateEnum
     };
     return pds;
 }
 private void addNewPushpinSetCurrentSelectedPushpin(DiyPushpin diyPushpin)
 {
     if (currentSelectedPushpin != null && map.Children.Contains(currentSelectedPushpin))
     {
         currentSelectedPushpin.toLargePushpin(false);
     }
     currentSelectedPushpin = diyPushpin;
     currentSelectedPushpin.toLargePushpin(true);
 }
 private void changeCurrentSelectedPushpin(object sender)
 {
     zoominCurrentSelectedPushpinSize();
     currentSelectedPushpin = ((DiyPushpin)sender);
     zoomoutCurrentSelectedPushpinSize();
     //BottomAppBar.IsOpen = true;
     map.Children.Remove(currentSelectedPushpin);
     map.Children.Add(currentSelectedPushpin);
     Location loc = new Location(currentSelectedPushpin.latitude, currentSelectedPushpin.longitude);
     MapLayer.SetPosition(currentSelectedPushpin, loc);
     ((DiyPushpin)sender).setPushpinTextOpacity(1);
 }
 void diyPushpin_Tapped(object sender, TappedRoutedEventArgs e)
 {
     try
     {
         if (((DiyPushpin)sender) == null) return;
         if (currentSelectedPushpin == ((DiyPushpin)sender) && currentSelectedPushpin.getPushpinTextBlock_TitleHeight() != 0)
         {
             zoominCurrentSelectedPushpinSize();
             currentSelectedPushpin = null;
         }
         else
         {
             changeCurrentSelectedPushpin(sender);
         }
     }
     catch (Exception excep) { Utils.Constants.ShowErrorDialog(excep, "MapView - diyPushpin_Tapped"); }
 }
 /// <summary>
 /// 初始化页面,加载地图中的Pushpin.这个函数被异步的线程调用。每次被调用,有一个pushpin会加载到地图上
 /// </summary>
 /// <param name="pushpinItem"></param>
 public void UpdateWorkItem(DataModel.PushpinDataStructure pushpinItem)
 {
     DiyPushpin diyPushpin = new DiyPushpin();
     diyPushpin.latitude = pushpinItem.Latitude;
     diyPushpin.longitude = pushpinItem.Longitude;
     diyPushpin.map = this.map;
     map.Children.Add(diyPushpin);
     MapLayer.SetPosition(diyPushpin, new Location(diyPushpin.latitude,
                                                   diyPushpin.longitude));
     diyPushpin.Tapped += diyPushpin_Tapped;
     diyPushpin.SetPushpinDataSource(pushpinItem);
 }