Exemple #1
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);
            //}
        }
Exemple #2
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);
            //}
        }