private void client_GetSitesCompleted(object sender, GetSitesCompletedEventArgs e) { if (e.Error != null) { CurrentAction = UserAction.Idle; GeneralInfo.Content = "Failed to search sites"; return; } if (e.Result != null) { _GeneralStationLayer.Graphics.Clear(); foreach (var s in e.Result) { Graphic graphic = new Graphic(); double[] lonlat = SpatialReferenceSystem.ToWebMercator(s.Longitude, s.Latitude); graphic.Geometry = new MapPoint(lonlat[0], lonlat[1]); graphic.Symbol = _MarkerSymbols["Hydrology"]; graphic.Attributes.Add("Name", s.Name); graphic.Attributes.Add("Site", s); _GeneralStationLayer.Graphics.Add(graphic); } CurrentAction = UserAction.Idle; GeneralInfo.Content = e.Result.Count + " sites found"; } else { CurrentAction = UserAction.Idle; GeneralInfo.Content = "No sites found"; } }
void client_GetSitesCompleted(object sender, GetSitesCompletedEventArgs e) { stopProgressIndicator(); if (e.Cancelled || e.Error != null || e.Sites == null) { return; } BuilderApplication.Instance.Sites = e.Sites; BuilderApplication.Instance.Sites.CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(BuilderApplication.Instance.Sites_CollectionChanged); SitesList.ItemsSource = CurrentSites = e.Sites; BuilderApplication.Instance.RefreshCatalogVisibility(); }