Пример #1
0
 /// <summary>
 /// Initializes the singleton application object.  This is the first line of authored code
 /// executed, and as such is the logical equivalent of main() or WinMain().
 /// </summary>
 public App()
 {
     this.InitializeComponent();
     this.Suspending         += OnSuspending;
     this.UnhandledException += App_UnhandledException;
     Microsoft.HockeyApp.HockeyClient.Current.Configure("836884b121284cbcbd6f1f0dbc787c6b");
     try
     {
         var English = new System.Globalization.CultureInfo("en-us");
         System.Globalization.CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator   = English.NumberFormat.NumberDecimalSeparator;
         System.Globalization.CultureInfo.CurrentCulture.NumberFormat.CurrencyDecimalSeparator = English.NumberFormat.CurrencyDecimalSeparator;
         System.Globalization.CultureInfo.CurrentCulture.NumberFormat.PercentDecimalSeparator  = English.NumberFormat.PercentDecimalSeparator;
     }
     catch { }
     try
     {
         var index = SettingsSetters.GetThemeIndex();
         if (index == 0)
         {
             this.RequestedTheme = ApplicationTheme.Dark;
         }
         if (index == 1)
         {
             this.RequestedTheme = ApplicationTheme.Light;
         }
     }
     catch
     {
         this.RequestedTheme = ApplicationTheme.Light;
     }
 }
Пример #2
0
        public MapView()
        {
            this.InitializeComponent();
            NetworkInformation.NetworkStatusChanged += NetworkInformation_NetworkStatusChanged;
            MapControl    = Map;
            StaticMapView = this;
            //Map.RotateInteractionMode = MapInteractionMode.GestureOnly;
            Map.RotateInteractionMode = SettingsSetters.GetRotationControlsVisible();
            var ZoomInteractionMode = SettingsSetters.GetZoomControlsVisible();

            if (ZoomInteractionMode == MapInteractionMode.Auto || ZoomInteractionMode == MapInteractionMode.ControlOnly || ZoomInteractionMode == MapInteractionMode.GestureAndControl || ZoomInteractionMode == MapInteractionMode.PointerKeyboardAndControl)
            {
                ZoomUserControl.Visibility = Visibility.Visible;
            }
            else
            {
                ZoomUserControl.Visibility = Visibility.Collapsed;
            }
            if (ZoomInteractionMode == MapInteractionMode.Auto || ZoomInteractionMode == MapInteractionMode.GestureAndControl || ZoomInteractionMode == MapInteractionMode.GestureOnly || ZoomInteractionMode == MapInteractionMode.PointerAndKeyboard || ZoomInteractionMode == MapInteractionMode.PointerKeyboardAndControl || ZoomInteractionMode == MapInteractionMode.PointerOnly)
            {
                Map.ZoomInteractionMode = MapInteractionMode.GestureOnly;
            }
            else
            {
                Map.ZoomInteractionMode = MapInteractionMode.Disabled;
            }

            //if (ClassInfo.DeviceType() == ClassInfo.DeviceTypeEnum.Phone)
            //{
            //    ChangeViewControl.Margin = new Thickness(28, 95, 28, 0);
            //    Searchbar.Margin = new Thickness(28, 40, 28, 0);
            //    DirectionsControl.Margin = new Thickness(28, 0, 28, 0);
            //    MyLocationControl.Margin = new Thickness(28, 28, 28, 28);
            //}
        }
Пример #3
0
        private void Flyout_Opened(object sender, object e)
        {
            if (Map == null)
            {
                Map = MapView.MapControl;
                ShowTraffic.IsOn = SettingsSetters.GetShowTrafficOnLaunch();
            }
            DefaultMapView.IsChecked   = false;
            RoadsOnlyView.IsChecked    = false;
            SatelliteMapView.IsChecked = false;
            HybridMapView.IsChecked    = false;
            switch (CurrentMapMode)
            {
            case MapMode.Standard:
                DefaultMapView.IsChecked = true;
                break;

            case MapMode.RoadsOnly:
                RoadsOnlyView.IsChecked = true;
                break;

            case MapMode.Satellite:
                SatelliteMapView.IsChecked = true;
                break;

            case MapMode.Hybrid:
                HybridMapView.IsChecked = true;
                break;

            default:
                break;
            }
        }
Пример #4
0
 public ChangeViewUserControl()
 {
     CurrentMapMode       = MapMode.Standard;
     ShowTrafficIsOn      = SettingsSetters.GetShowTrafficOnLaunch();
     AllowOverstretch     = SettingsSetters.GetAllowOverstretch();
     FadeAnimationEnabled = SettingsSetters.GetFadeAnimationEnabled();
     this.InitializeComponent();
     Map = MapView.MapControl;
 }
Пример #5
0
 public ChangeViewUserControl()
 {
     AllowOverstretch     = SettingsSetters.GetAllowOverstretch();
     FadeAnimationEnabled = SettingsSetters.GetFadeAnimationEnabled();
     this.InitializeComponent();
     if (!InternalHelper.InternetConnection())
     {
         CVBTN.IsEnabled = false;
     }
 }
Пример #6
0
        /// <summary>
        /// Invoked when the application is launched normally by the end user.  Other entry points
        /// will be used such as when the application is launched to open a specific file.
        /// </summary>
        /// <param name="e">Details about the launch request and process.</param>
        protected override void OnLaunched(LaunchActivatedEventArgs e)
        {
            if (e != null)
            {
                if (e.PreviousExecutionState == ApplicationExecutionState.Running)
                {
                    Window.Current.Activate();
                    return;
                }
                if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    //TODO: Load state from previously suspended application
                }
                if (e.Kind == ActivationKind.VoiceCommand)
                {
                }
            }
            try
            {
                var index = SettingsSetters.GetThemeIndex();
                if (index == 1)
                {
                    StatusBar.GetForCurrentView().ForegroundColor = Colors.Black;
                }
                else
                {
                    StatusBar.GetForCurrentView().ForegroundColor = Colors.White;
                }
            }
            catch { }
            StartFluent();
            Resources["ToggleButtonBackgroundChecked"]            = Color.FromArgb(255, 96, 165, 255);
            Resources["SystemControlHighlightListAccentLowBrush"] = Color.FromArgb(255, 96, 165, 255);
            Resources["ToggleSwitchFillOn"]                 = Color.FromArgb(255, 96, 165, 255);
            Resources["HyperlinkButtonForeground"]          = Color.FromArgb(255, 96, 165, 255);
            Resources["SystemControlBackgroundAccentBrush"] = Color.FromArgb(255, 96, 165, 255);
            SplashScreen         splashScreen = e.SplashScreen;
            ExtendedSplashScreen eSplash      = null;

            if (e.Arguments != "")
            {
                var sp = e.Arguments.Split(',');
                eSplash = new ExtendedSplashScreen(splashScreen, new Uri($"https://google.com/maps/@?api=1&map_action=map&center={sp[0]},{sp[1]}&zoom=17", UriKind.RelativeOrAbsolute));
            }
            else
            {
                eSplash = new ExtendedSplashScreen(splashScreen);
            }
            // Register an event handler to be executed when the splash screen has been dismissed.
            Window.Current.Content = eSplash;
            Window.Current.Activate();
            App.Current.Suspending  += Current_Suspending;
            CoreApplication.Exiting += CoreApplication_Exiting;
        }
Пример #7
0
 public async void SuggestForSearch(string searchExpression)
 {
     await AppCore.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, async delegate
     {
         if (SearchResults == null)
         {
             SearchResults = new ObservableCollection <PlaceAutoComplete.Prediction>();
         }
         SearchResults.Clear();
         var saved = SavedPlacesVM.GetSavedPlaces();
         saved     = saved.Where(x => x.PlaceName.Contains(searchExpression)).ToList();
         foreach (var item in saved)
         {
             SearchResults.Add(new PlaceAutoComplete.Prediction()
             {
                 place_id = $"{item.Latitude},{item.Longitude}", description = "Saved:" + item.PlaceName
             });
         }
         if (await SettingsSetters.GetAccessToContcts())
         {
             var contacts = await ContactManager.RequestStoreAsync(ContactStoreAccessType.AllContactsReadOnly);
             if (contacts != null)
             {
                 var search = await contacts.FindContactsAsync(searchExpression);
                 var res    = search.Where(x => x.Addresses.Count > 0);
                 foreach (var item in res)
                 {
                     var cadd = item.Addresses.FirstOrDefault();
                     SearchResults.Add(new PlaceAutoComplete.Prediction()
                     {
                         description = "Contacts:" + item.Name, place_id = $"{cadd.StreetAddress}, {cadd.Locality}"
                     });
                 }
             }
         }
         if (searchExpression.Length >= 3)
         {
             var s = await PlaceAutoComplete.GetAutoCompleteResults(searchExpression, location: MapView.MapControl.Center, radius: 50000);
             if (s == null)
             {
                 return;
             }
             foreach (var item in s.predictions)
             {
                 SearchResults.Add(item);
             }
         }
     });
 }
Пример #8
0
 private async void NetworkInformation_NetworkStatusChanged(object sender)
 {
     await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, delegate
     {
         if (!InternalHelper.InternetConnection())
         {
             Map.TileSources.Clear();
             Map.TileSources.Add(new MapTileSource(new LocalMapTileDataSource("ms-appdata:///local/MahMaps/mah_x_{x}-y_{y}-z_{zoomlevel}.jpeg"))
             {
                 AllowOverstretch = false, IsFadingEnabled = SettingsSetters.GetFadeAnimationEnabled()
             });
         }
         else
         {
             ChangeViewControl.UseGoogleMaps(ChangeViewControl.CurrentMapMode, ChangeViewControl.ShowTrafficIsOn, true, ChangeViewControl.AllowOverstretch, ChangeViewControl.FadeAnimationEnabled);
         }
     });
 }
Пример #9
0
        public MapView()
        {
            this.InitializeComponent();
            MapControl = Map;
            Map.Style  = MapStyle.None;
            Map.TileSources.Clear();
            var AllowOverstretch     = SettingsSetters.GetAllowOverstretch();
            var FadeAnimationEnabled = SettingsSetters.GetFadeAnimationEnabled();

            if (InternalHelper.InternetConnection())
            {
                //var hm = new HttpMapTileDataSource() { AllowCaching = true };
                //var md = new MapTileSource(hm) { AllowOverstretch = false };
                //Map.TileSources.Add(md);
                //hm.UriRequested += Hm_UriRequested;
                //New
                //Map.TileSources.Add(new MapTileSource(new HttpMapTileDataSource("https://www.googleapis.com/tile/v1/tiles/{x}/{y}/{zoomlevel}?session=sessiontoken&key=AIzaSyCFQ-I2-SPtdtVR4TCa6665mLMX5n_I5Sc")
                //{ AllowCaching = true })
                //{ AllowOverstretch = false, IsFadingEnabled = false, ZoomLevelRange = new MapZoomLevelRange() { Max = 22, Min = 1 } });
                //OLD
                Map.TileSources.Add(new MapTileSource(new HttpMapTileDataSource("http://mt1.google.com/vt/lyrs=r@221097413,traffic&hl=x-local&z={zoomlevel}&x={x}&y={y}")
                {
                    AllowCaching = true
                })
                {
                    AllowOverstretch = AllowOverstretch, IsFadingEnabled = FadeAnimationEnabled, ZoomLevelRange = new MapZoomLevelRange()
                    {
                        Max = 22, Min = 0
                    }
                });
            }
            else
            {
                Map.TileSources.Add(new MapTileSource(new LocalMapTileDataSource("ms-appdata:///local/MahMaps/mah_x_{x}-y_{y}-z_{zoomlevel}.jpeg"))
                {
                    AllowOverstretch = AllowOverstretch, IsFadingEnabled = FadeAnimationEnabled
                });
            }
        }
Пример #10
0
        protected override async void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);
            MapControl = Map;
            if (e.NavigationMode == NavigationMode.Back)
            {
                ChangeViewControl.Map = Map;
            }
            var AllowOverstretch     = SettingsSetters.GetAllowOverstretch();
            var FadeAnimationEnabled = SettingsSetters.GetFadeAnimationEnabled();

            if (InternalHelper.InternetConnection())
            {
                ChangeViewControl.UseGoogleMaps(OnMapControls.ChangeViewUserControl.MapMode.Standard, AllowOverstretch: AllowOverstretch, IsFadingEnabled: FadeAnimationEnabled, ShowTraffic: SettingsSetters.GetShowTrafficOnLaunch());
            }
            else
            {
                Map.TileSources.Add(new MapTileSource(new LocalMapTileDataSource("ms-appdata:///local/MahMaps/mah_x_{x}-y_{y}-z_{zoomlevel}.jpeg"))
                {
                    AllowOverstretch = false, IsFadingEnabled = FadeAnimationEnabled
                });
            }
            inkCanvas.InkPresenter.InputDeviceTypes = CoreInputDeviceTypes.Mouse | CoreInputDeviceTypes.Pen | CoreInputDeviceTypes.Touch;
            var drawingAttr = this.inkCanvas.InkPresenter.CopyDefaultDrawingAttributes();

            drawingAttr.PenTip         = PenTipShape.Rectangle;
            drawingAttr.Size           = new Size(4, 4);
            drawingAttr.IgnorePressure = true;
            drawingAttr.Color          = (Color)Resources["SystemControlBackgroundAccentBrush"];
            this.inkCanvas.InkPresenter.UpdateDefaultDrawingAttributes(drawingAttr);
            if (e.Parameter != null)
            {
                //Google Maps Override
                if (e.Parameter.ToString().StartsWith("http"))
                {
                    //Search Uri association handler
                    if (((Uri)e.Parameter).Segments[2].ToLower() == "search/")
                    {
                        //Searchgrid.PopUP = true;
                        //Searchgrid.SearchText = ((Uri)e.Parameter).DecodeQueryParameters().Where(x => x.Key == "query").FirstOrDefault().Value;
                    }
                    //Directions Uri association handler
                    if (((Uri)e.Parameter).Segments[2].ToLower() == "dir/")
                    {
                        var parameters  = ((Uri)e.Parameter).DecodeQueryParameters();
                        var origin      = parameters.Where(x => x.Key == "origin").FirstOrDefault();
                        var destination = parameters.Where(x => x.Key == "destination").FirstOrDefault();
                        var travelmode  = parameters.Where(x => x.Key == "travelmode").FirstOrDefault();
                        var waypoints   = parameters.Where(x => x.Key == "waypoints").FirstOrDefault();
                        ViewModel.DirectionsControls.DirectionsHelper.DirectionModes Mode = ViewModel.DirectionsControls.DirectionsHelper.DirectionModes.walking;
                        Geopoint OriginPoint        = null;
                        Geopoint DestinationPoint   = null;
                        List <BasicGeoposition> lst = null;
                        if (travelmode.Value != null)
                        {
                            if (travelmode.Value.ToString() == "driving")
                            {
                                Mode = ViewModel.DirectionsControls.DirectionsHelper.DirectionModes.driving;
                            }
                            else if (travelmode.Value.ToString() == "bicycling ")
                            {
                                Mode = ViewModel.DirectionsControls.DirectionsHelper.DirectionModes.bicycling;
                            }
                            else if (travelmode.Value.ToString() == "transit")
                            {
                                Mode = ViewModel.DirectionsControls.DirectionsHelper.DirectionModes.transit;
                            }
                        }
                        if (origin.Value != null)
                        {
                            var latlng    = origin.Value.Split(',');
                            var Latitude  = Convert.ToDouble(latlng[0]);
                            var Longitude = Convert.ToDouble(latlng[1]);
                            OriginPoint = new Geopoint(new BasicGeoposition()
                            {
                                Latitude  = Latitude,
                                Longitude = Longitude
                            });
                        }
                        if (destination.Value != null)
                        {
                            var latlng    = destination.Value.Split(',');
                            var Latitude  = Convert.ToDouble(latlng[0]);
                            var Longitude = Convert.ToDouble(latlng[1]);
                            DestinationPoint = new Geopoint(new BasicGeoposition()
                            {
                                Latitude  = Latitude,
                                Longitude = Longitude
                            });
                        }
                        if (waypoints.Value != null)
                        {
                            lst = new List <BasicGeoposition>();
                            var latlngs = destination.Value.Split('|');
                            foreach (var item in latlngs)
                            {
                                var latlng             = item.Split(',');
                                BasicGeoposition point = new BasicGeoposition();
                                point.Latitude  = Convert.ToDouble(latlng[0]);
                                point.Longitude = Convert.ToDouble(latlng[1]);
                                lst.Add(point);
                            }
                        }
                        if (OriginPoint != null && DestinationPoint != null)
                        {
                            ViewModel.DirectionsControls.DirectionsHelper.Rootobject Result = null;
                            if (lst == null)
                            {
                                Result = await ViewModel.DirectionsControls.DirectionsHelper.GetDirections(OriginPoint.Position, DestinationPoint.Position, Mode);
                            }
                            else
                            {
                                Result = await ViewModel.DirectionsControls.DirectionsHelper.GetDirections(OriginPoint.Position, DestinationPoint.Position, Mode, lst);
                            }
                            if (Result != null)
                            {
                                Map.MapElements.Add(ViewModel.DirectionsControls.DirectionsHelper.GetDirectionAsRoute(Result, (Color)Resources["SystemControlBackgroundAccentBrush"]));
                            }
                        }
                    }
                    //Display a map
                    if (((Uri)e.Parameter).Segments[2].ToLower().StartsWith("@"))
                    {
                        await Task.Delay(1500);

                        try
                        {
                            if (!e.Parameter.ToString().Contains("searchplace"))
                            {
                                var parameters = ((Uri)e.Parameter).DecodeQueryParameters();
                                var mapaction  = parameters.Where(x => x.Key == "map_action").FirstOrDefault();
                                if (mapaction.Value != null && mapaction.Value == "pano")
                                {
                                    await new MessageDialog("StreetView Not Supported yet").ShowAsync();
                                }
                                var center = parameters.Where(x => x.Key == "center").FirstOrDefault();
                                var zoom   = parameters.Where(x => x.Key == "zoom").FirstOrDefault();
                                var cp     = center.Value.Split(',');
                                BasicGeoposition pointer = new BasicGeoposition()
                                {
                                    Latitude = Convert.ToDouble(cp[0]), Longitude = Convert.ToDouble(cp[1])
                                };
                                Map.Center = new Geopoint(pointer);
                                if (zoom.Value != null)
                                {
                                    await Map.TryZoomToAsync(Convert.ToDouble(zoom.Value));
                                }
                                RunMapRightTapped(Map, new Geopoint(pointer));
                            }
                            else
                            {
                                var search = ((Uri)e.Parameter).ToString().Replace("https://google.com/maps/@searchplace=", "");
                                //var search = parameters.Where(x => x.Key == "searchplace").FirstOrDefault();
                                var res = await ViewModel.PlaceControls.SearchHelper.TextSearch(search, Location : Map.Center, Radius : 15000);

                                if (res == null || res.results.Length == 0)
                                {
                                    await new MessageDialog("No search results found").ShowAsync();
                                    return;
                                }
                                var ploc     = res.results.FirstOrDefault().geometry.location;
                                var geopoint = new Geopoint(new BasicGeoposition()
                                {
                                    Latitude = ploc.lat, Longitude = ploc.lng
                                });
                                Map.Center = geopoint;
                                await MapView.MapControl.TryZoomToAsync(16);

                                SearchResultPoint = geopoint;
                            }
                        }
                        catch
                        {
                        }
                    }
                }

                //Windows Maps Override
                else
                {
                    var    parameters = ((Uri)e.Parameter).DecodeQueryParameters();
                    string cp         = "";
                    int    zoomlevel  = 0;
                    string Querry     = "";
                    string Where      = "";
                    //{bingmaps:?where=Tabarsi Square%2C north side of the Shrine%2C Mashhad%2C 2399%2C Īrān}
                    if (parameters.Where(x => x.Key == "where").Any())
                    {
                        Where = Uri.UnescapeDataString(parameters.Where(x => x.Key == "where").FirstOrDefault().Value.NoHTMLString());
                    }
                    if (parameters.Where(x => x.Key == "cp").Any())
                    {
                        cp = parameters.Where(x => x.Key == "cp").FirstOrDefault().Value;
                    }
                    if (parameters.Where(x => x.Key == "lvl").Any())
                    {
                        zoomlevel = Convert.ToInt32(parameters.Where(x => x.Key == "lvl").FirstOrDefault().Value);
                    }
                    if (parameters.Where(x => x.Key == "q").Any())
                    {
                        Querry = parameters.Where(x => x.Key == "q").FirstOrDefault().Value;
                    }
                    if (parameters.Where(x => x.Key == "collection").Any())
                    {
                        var point     = parameters.Where(x => x.Key == "collection").FirstOrDefault().Value;
                        var pointargs = point.Split('_');
                        var latitude  = pointargs[0].Split('.')[1] + "." + pointargs[0].Split('.')[2];
                        var longitude = pointargs[1];
                        cp = $"{latitude}~{longitude}";
                        if (parameters.Count >= 3)
                        {
                            Map.MapElements.Add(new MapIcon()
                            {
                                Location = new Geopoint(new BasicGeoposition()
                                {
                                    Latitude = Convert.ToDouble(latitude), Longitude = Convert.ToDouble(longitude)
                                }), Title = pointargs[2].Replace("+", " ")
                            });
                        }
                        else
                        {
                            Map.MapElements.Add(new MapIcon()
                            {
                                Location = new Geopoint(new BasicGeoposition()
                                {
                                    Latitude = Convert.ToDouble(latitude), Longitude = Convert.ToDouble(longitude)
                                }), Title = "Point"
                            });
                        }
                    }
                    if (Where != "")
                    {
                        await Task.Delay(500);

                        var res = await SearchHelper.TextSearch(Where);

                        if (res != null)
                        {
                            if (res.results != null && res.results.Any())
                            {
                                var loc = res.results.FirstOrDefault().geometry.location;
                                //var rgc = await ReverseGeoCode.GetLocation(Where);
                                Map.Center = new Geopoint(new BasicGeoposition()
                                {
                                    Latitude = loc.lat, Longitude = loc.lng
                                });
                            }
                            else
                            {
                                var rgc = await ReverseGeoCode.GetLocation(Where);

                                Map.Center = rgc;
                            }
                        }
                        else
                        {
                            var rgc = await ReverseGeoCode.GetLocation(Where);

                            Map.Center = rgc;
                        }
                    }
                    if (cp != "")
                    {
                        await Task.Delay(500);

                        var bgp = new BasicGeoposition();
                        bgp.Latitude  = Convert.ToDouble(cp.Split('~')[0]);
                        bgp.Longitude = Convert.ToDouble(cp.Split('~')[1]);
                        Map.Center    = new Geopoint(bgp);
                        Map.MapElements.Add(new MapIcon()
                        {
                            Location = new Geopoint(bgp), Title = "Point"
                        });
                    }
                    if (zoomlevel != 0)
                    {
                        await Map.TryZoomToAsync(zoomlevel);
                    }
                    else
                    {
                        await MapView.MapControl.TryZoomToAsync(16);
                    }
                    if (Querry != "")
                    {
                        await Task.Delay(1500);

                        Searchbar.SearchQuerry = Querry;
                    }
                }
            }

            if (ApiInformation.IsTypePresent("Windows.UI.Xaml.Media.AcrylicBrush"))
            {
                var ac    = new Windows.UI.Xaml.Media.AcrylicBrush();
                var brush = Resources["SystemControlChromeLowAcrylicWindowBrush"] as Windows.UI.Xaml.Media.AcrylicBrush;
                ac                      = brush;
                ac.TintOpacity          = 0.8;
                ac.BackgroundSource     = Windows.UI.Xaml.Media.AcrylicBackgroundSource.HostBackdrop;
                InfoPane.PaneBackground = ac;
            }

            //MapViewVM.LoadPage();
        }
Пример #11
0
        public MapView()
        {
            this.InitializeComponent();
            MapControl    = Map;
            StaticMapView = this;
            Map.Style     = MapStyle.None;
            Map.TileSources.Clear();
            var AllowOverstretch     = SettingsSetters.GetAllowOverstretch();
            var FadeAnimationEnabled = SettingsSetters.GetFadeAnimationEnabled();

            Map.RotateInteractionMode = MapInteractionMode.GestureOnly;
            //Map.RotateInteractionMode = SettingsSetters.GetRotationControlsVisible();
            var ZoomInteractionMode = SettingsSetters.GetZoomControlsVisible();

            if (ZoomInteractionMode == MapInteractionMode.Auto || ZoomInteractionMode == MapInteractionMode.ControlOnly || ZoomInteractionMode == MapInteractionMode.GestureAndControl || ZoomInteractionMode == MapInteractionMode.PointerKeyboardAndControl)
            {
                ZoomUserControl.Visibility = Visibility.Visible;
            }
            else
            {
                ZoomUserControl.Visibility = Visibility.Collapsed;
            }
            if (ZoomInteractionMode == MapInteractionMode.Auto || ZoomInteractionMode == MapInteractionMode.GestureAndControl || ZoomInteractionMode == MapInteractionMode.GestureOnly || ZoomInteractionMode == MapInteractionMode.PointerAndKeyboard || ZoomInteractionMode == MapInteractionMode.PointerKeyboardAndControl || ZoomInteractionMode == MapInteractionMode.PointerOnly)
            {
                Map.ZoomInteractionMode = MapInteractionMode.GestureOnly;
            }
            else
            {
                Map.ZoomInteractionMode = MapInteractionMode.Disabled;
            }
            if (InternalHelper.InternetConnection())
            {
                //var hm = new HttpMapTileDataSource() { AllowCaching = true };
                //var md = new MapTileSource(hm) { AllowOverstretch = false };
                //Map.TileSources.Add(md);
                //hm.UriRequested += Hm_UriRequested;
                //New
                //Map.TileSources.Add(new MapTileSource(new HttpMapTileDataSource("https://www.googleapis.com/tile/v1/tiles/{x}/{y}/{zoomlevel}?session=sessiontoken&key=AIzaSyCFQ-I2-SPtdtVR4TCa6665mLMX5n_I5Sc")
                //{ AllowCaching = true })
                //{ AllowOverstretch = false, IsFadingEnabled = false, ZoomLevelRange = new MapZoomLevelRange() { Max = 22, Min = 1 } });
                //OLD
                //lyrs parameter h = dark, y = hybrid
                string mapuri = "http://mt1.google.com/vt/lyrs=r&hl=" + AppCore.OnMapLanguage + "&z={zoomlevel}&x={x}&y={y}";
                Map.TileSources.Add(new MapTileSource(new HttpMapTileDataSource(mapuri)
                {
                    AllowCaching = true
                })
                {
                    AllowOverstretch = AllowOverstretch, IsFadingEnabled = FadeAnimationEnabled, ZoomLevelRange = new MapZoomLevelRange()
                    {
                        Max = 22, Min = 0
                    }
                });
            }
            else
            {
                Map.TileSources.Add(new MapTileSource(new LocalMapTileDataSource("ms-appdata:///local/MahMaps/mah_x_{x}-y_{y}-z_{zoomlevel}.jpeg"))
                {
                    AllowOverstretch = AllowOverstretch, IsFadingEnabled = FadeAnimationEnabled
                });
            }
            //if (ClassInfo.DeviceType() == ClassInfo.DeviceTypeEnum.Phone)
            //{
            //    ChangeViewControl.Margin = new Thickness(28, 95, 28, 0);
            //    Searchbar.Margin = new Thickness(28, 40, 28, 0);
            //    DirectionsControl.Margin = new Thickness(28, 0, 28, 0);
            //    MyLocationControl.Margin = new Thickness(28, 28, 28, 28);
            //}
        }
Пример #12
0
 public ChangeViewUserControl()
 {
     AllowOverstretch     = SettingsSetters.GetAllowOverstretch();
     FadeAnimationEnabled = SettingsSetters.GetFadeAnimationEnabled();
     this.InitializeComponent();
 }