public ServiceController(string baseURL) { BaseURL = baseURL; Summaries = new SummariesController(); Summaries.baseController = this; Summaries.BaseURL = BaseURL; User = new UserController(); User.BaseURL = BaseURL; Feeds = new FeedController(); Feeds.baseController = this; Feeds.BaseURL = BaseURL; Feeds.GetFeedList(); }
void Summaries_UserSummaryUpdate(SummariesController sender) { ImageBrush brush = new ImageBrush(); brush.ImageSource = new BitmapImage(new Uri(Service.User.currentUser.profile_image_url)); foreach(string key in sender.UserSummaries.Keys) { PointDataSummary pds = sender.UserSummaries[key]; PlaceMark pm = new PlaceMark(); pm.Location = new Location(pds.Latitude,pds.Longitude); pm.Summary = pds; pm.Id = pds.Guid; Pushpin oldElem = (Pushpin)communityMapLayer.FindName(pds.Guid); if (oldElem != null) { communityMapLayer.Children.Remove(oldElem); oldElem = null; } Pushpin pin = new Pushpin(); pin.Background = brush; pin.Name = pds.Guid; pin.Tag = pm; ToolTipService.SetToolTip(pin, pds.Name); pin.MouseLeftButtonUp += pin_MouseLeftButtonUp; currentUserMapLayer.AddChild(pin, pm.Location,PositionOrigin.BottomCenter); } }
void Summaries_CommunityUpdate(SummariesController sender) { foreach (string key in sender.CommunitySummaries.Keys) { PointDataSummary pds = sender.CommunitySummaries[key]; ImageBrush brush = new ImageBrush(); brush.ImageSource = new BitmapImage(new Uri(pds.CreatorProfileImageUrl)); Pushpin elem = (Pushpin)this.communityMapLayer.FindName(pds.Guid); // only create a new item if it is not already on the map if(elem == null) { PlaceMark pm = new PlaceMark(); pm.Location = new Location(pds.Latitude, pds.Longitude); pm.Summary = pds; pm.Id = pds.Guid; Pushpin pin = new Pushpin(); //pin.Template = (ControlTemplate)Application.Current.Resources["PushPinTemplate"]; pin.Background = brush; // pin.BorderBrush = borderBrush; pin.Tag = pm; pin.Name = pm.Id; // use name/guid so we can find it later if need be ToolTipService.SetToolTip(pin, pds.Name); pin.MouseLeftButtonUp += pin_MouseLeftButtonUp; this.communityMapLayer.AddChild(pin, pm.Location,PositionOrigin.BottomCenter); } } }