private void GetCRMUser(ref ServiceObject so) { Method meth = so.Methods[0]; BingMapsHelper bmHelper = new BingMapsHelper(); RouteDirections SearchResults = new RouteDirections(); try { if (meth.Name.ToLower().Equals("getdirectionsbycoordinates")) { SearchResults = bmHelper.GetDirectionsByCoordinates(so.Properties["RouteCoordinates"].Value.ToString(), NotNull(so.Properties["RouteTravelMode"].Value), NotNull(so.Properties["RouteTrafficUsage"].Value), NotNull(so.Properties["RouteOptimisation"].Value), GetConfigPropertyValue("BingMapsKey")); } else { SearchResults = bmHelper.GetDirectionsByLocations(so.Properties["SearchLocation"].Value.ToString(), NotNull(so.Properties["RouteTravelMode"].Value), NotNull(so.Properties["RouteTrafficUsage"].Value), NotNull(so.Properties["RouteOptimisation"].Value), GetConfigPropertyValue("BingMapsKey")); } so.Properties.InitResultTable(); so.Properties["RouteDirections"].Value = SearchResults.Directions; so.Properties["RouteTotalDistance"].Value = SearchResults.TotalDistance; so.Properties.BindPropertiesToResultTable(); } catch (Exception ex) { throw; } }
private void GetEntities(ref ServiceObject so) { Method meth = so.Methods[0]; BingMapsHelper bmHelper = new BingMapsHelper(); BingResult SearchResult = new BingResult(); try { if (meth.Name.ToLower().Equals("generatemapfromcoordinates")) { SearchResult = bmHelper.GenerateCoordinatesImage(so.Properties["SearchLatitude"].Value.ToString(), so.Properties["SearchLongitude"].Value.ToString(), int.Parse(NotNull(so.Properties["ImageZoom"].Value)), NotNull(so.Properties["MapStyle"].Value), int.Parse(NotNull(so.Properties["MapWidth"].Value)), int.Parse(NotNull(so.Properties["MapHeight"].Value)), NotNull(so.Properties["ImageFormat"].Value), NotNull(so.Properties["FileSystemLocation"].Value), GetConfigPropertyValue("BingMapsKey")); } else { SearchResult = bmHelper.GenerateLocationImage(so.Properties["SearchLocation"].Value.ToString(), int.Parse(NotNull(so.Properties["ImageZoom"].Value)), NotNull(so.Properties["MapStyle"].Value), int.Parse(NotNull(so.Properties["MapWidth"].Value)), int.Parse(NotNull(so.Properties["MapHeight"].Value)), NotNull(so.Properties["ImageFormat"].Value), NotNull(so.Properties["FileSystemLocation"].Value), GetConfigPropertyValue("BingMapsKey")); } so.Properties.InitResultTable(); for (int c = 0; c < meth.ReturnProperties.Count; c += 1) { Property prop = so.Properties[meth.ReturnProperties[c]]; prop = SetResultListValue(prop, SearchResult); } so.Properties.BindPropertiesToResultTable(); } catch (Exception ex) { throw; } }
private void BulkActionTasks(ref ServiceObject so) { Method meth = so.Methods[0]; BingMapsHelper bmHelper = new BingMapsHelper(); List <BingResult> SearchResults = new List <BingResult>(); try { SearchResults = bmHelper.SearchLocation(so.Properties["SearchLocation"].Value.ToString(), so.Properties["SearchQuery"].Value.ToString(), NotNull(so.Properties["SearchCategory"].Value), NotNull(so.Properties["SortBy"].Value), int.Parse(so.Properties["ResultCount"].Value.ToString()), GetConfigPropertyValue("BingMapsKey")); so.Properties.InitResultTable(); foreach (BingResult br in SearchResults) { for (int c = 0; c < meth.ReturnProperties.Count; c += 1) { Property prop = so.Properties[meth.ReturnProperties[c]]; prop = SetResultListValue(prop, br); } so.Properties.BindPropertiesToResultTable(); } } catch (Exception ex) { throw; } }
private void SetStateStatus(ref ServiceObject so) { Method meth = so.Methods[0]; BingMapsHelper bmHelper = new BingMapsHelper(); BingResult SearchResult = new BingResult(); try { SearchResult = bmHelper.SearchByCoordinates(so.Properties["SearchLatitude"].Value.ToString(), so.Properties["SearchLongitude"].Value.ToString(), NotNull(so.Properties["ConfidenceFilter"].Value), GetConfigPropertyValue("BingMapsKey")); so.Properties.InitResultTable(); for (int c = 0; c < meth.ReturnProperties.Count; c += 1) { Property prop = so.Properties[meth.ReturnProperties[c]]; prop = SetResultListValue(prop, SearchResult); } so.Properties.BindPropertiesToResultTable(); } catch (Exception ex) { throw; } }
protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e) { base.OnNavigatedTo(e); LocationAssistant.Instance.WalkingPositionChanged += OnWalkingPositionChanged; IAppInfo iai = Application.Current as IAppInfo; if (iai != null) { _map.CredentialsProvider = new ApplicationIdCredentialsProvider(iai.BKey); } // TODO: TOMBSTONE NICE TO HAVE: Get the center point for tombing' string val; if (NavigationContext.QueryString.TryGetValue("name", out val)) { _placeName = val; } if (NavigationContext.QueryString.TryGetValue("address", out val)) { _placeAddress = val; } if (NavigationContext.QueryString.TryGetValue("localUri", out val)) { Uri uri; if (Uri.TryCreate(val, UriKind.Relative, out uri)) { _placeLocalUri = uri; } } string lat = string.Empty; string @long = string.Empty; if (NavigationContext.QueryString.TryGetValue("lat", out lat) && NavigationContext.QueryString.TryGetValue("long", out @long)) { var geoCoordinate = new System.Device.Location.GeoCoordinate(double.Parse(lat, CultureInfo.InvariantCulture), double.Parse(@long, CultureInfo.InvariantCulture)); _itemLocation = geoCoordinate; double zoomLevel = 14; // Default. // Try to get a zoom level so that we can show the user their // current location plus the place they are looking for. var point = LocationAssistant.Instance.LastKnownLiveLocation; if (point != null) { zoomLevel = BingMapsHelper.GetZoomLevelShowingPoints( geoCoordinate, LocationAssistant.Instance.LastKnownLiveLocation.AsGeoCoordinate(), 210 /* pixels */); } _map.SetView(geoCoordinate, zoomLevel); if (_placePushpin != null && _layer.Children.Contains(_placePushpin)) { _layer.Children.Remove(_placePushpin); _placePushpin = null; } _placePushpin = new Pushpin(); _placePushpin.Location = geoCoordinate; _placePushpin.Content = new MapPlaceInformation(_placeName, _placeAddress, _placeLocalUri); _placePushpin.ContentTemplate = LayoutRoot.Resources["PlaceInformationDataTemplate"] as DataTemplate; if (_gpsPushpin == null) { _gpsPushpin = new Pushpin(); _gpsPushpin.Location = LocationAssistant.Instance.LastKnownLocation.AsGeoCoordinate(); var cs = LayoutRoot.Resources["MePushpinStyle"] as Style; _gpsPushpin.Style = cs; _layer.Children.Add(_gpsPushpin); } _layer.Children.Add(_placePushpin); } if (State.ContainsKey(MapModeTombstoneKey)) { _isSatelliteViewOn = (bool)State[MapModeTombstoneKey]; } //SetupAppBar(); UpdateMode(); if (Environment.OSVersion.Version.Minor >= 1) { // mango hack var st = typeof(SystemTray); var opacity = st.GetProperty("Opacity"); if (opacity != null) { opacity.SetValue(null, 0.65, null); SystemTray.IsVisible = true; } } }
private void ChangeOwner(ref ServiceObject so) { Method meth = so.Methods[0]; BingMapsHelper bmHelper = new BingMapsHelper(); BingResult SearchResult = new BingResult(); try { SearchResult = bmHelper.SearchByLocation(so.Properties["SearchLocation"].Value.ToString(), NotNull(so.Properties["ConfidenceFilter"].Value), GetConfigPropertyValue("BingMapsKey")); so.Properties.InitResultTable(); for (int c = 0; c < meth.ReturnProperties.Count; c += 1) { Property prop = so.Properties[meth.ReturnProperties[c]]; prop = SetResultListValue(prop, SearchResult); } so.Properties.BindPropertiesToResultTable(); } catch (Exception ex) { throw; } }
private void BulkActionTasks(ref ServiceObject so) { Method meth = so.Methods[0]; BingMapsHelper bmHelper = new BingMapsHelper(); List<BingResult> SearchResults = new List<BingResult>(); try { SearchResults = bmHelper.SearchLocation(so.Properties["SearchLocation"].Value.ToString(), so.Properties["SearchQuery"].Value.ToString(), NotNull(so.Properties["SearchCategory"].Value), NotNull(so.Properties["SortBy"].Value), int.Parse(so.Properties["ResultCount"].Value.ToString()), GetConfigPropertyValue("BingMapsKey")); so.Properties.InitResultTable(); foreach (BingResult br in SearchResults) { for (int c = 0; c < meth.ReturnProperties.Count; c += 1) { Property prop = so.Properties[meth.ReturnProperties[c]]; prop = SetResultListValue(prop, br); } so.Properties.BindPropertiesToResultTable(); } } catch (Exception ex) { throw; } }