private void MapStyleMenuFlyoutItem_OnTapped(object sender, TappedRoutedEventArgs e) { MenuFlyoutItem selectedItem = sender as MenuFlyoutItem; int selectedIndex = Convert.ToInt32(selectedItem.Tag); string key = ""; switch (selectedIndex) { case 1: //Drawing Map style key = "m"; break; case 2: //Hybrid Map style key = "y"; break; default: key = "m"; break; } StaticMethod.SetSettings("mapStyleKey", key); LoadMapStyle(); }
private void MapSourcesMenuFlyout_OnTap(object sender, TappedRoutedEventArgs e) { MenuFlyoutItem selectedItem = sender as MenuFlyoutItem; if (StaticMethod.GetSettings("mapIndex") == "not set") { StaticMethod.SetSettings("mapIndex", "0"); } if (StaticMethod.GetSettings("mapStyleKey") == "not set") { StaticMethod.SetSettings("mapStyleKey", "m"); } int selectedIndex = Convert.ToInt32(selectedItem.Tag); StaticMethod.SetSettings("mapIndex", selectedIndex.ToString()); switch (selectedIndex) { case 0: //Bing Map EnableMapStyleComboBox(false); map.TileLayers.Clear(); map.MapType = MapType.Road; break; case 1: //Google Map EnableMapStyleComboBox(true); map.MapType = MapType.Empty; MapTileLayer googleTileLayer = new MapTileLayer(); googleTileLayer.GetTileUri += GoogleTileLayerOnGetTileUri; map.TileLayers.Add(googleTileLayer); //AddGoogleMapStyle(); break; case 2: //Vietbando Map EnableMapStyleComboBox(false); map.MapType = MapType.Empty; MapTileLayer vietBanDoMapTileLayer = new MapTileLayer(); vietBanDoMapTileLayer.GetTileUri += VietBanDoMapTileLayerOnGetTileUri; map.TileLayers.Add(vietBanDoMapTileLayer); break; default: break; } }
private void LoadMapStyle() { if (StaticMethod.GetSettings("mapIndex") == "not set") { StaticMethod.SetSettings("mapIndex", "0"); } if (StaticMethod.GetSettings("mapStyleKey") == "not set") { StaticMethod.SetSettings("mapStyleKey", "m"); } int selectedIndex = Convert.ToInt32(StaticMethod.GetSettings("mapIndex")); switch (selectedIndex) { case 0: //Bing Map EnableMapStyleComboBox(false); map.TileLayers.Clear(); map.MapType = MapType.Road; break; case 1: //Google Map EnableMapStyleComboBox(true); map.MapType = MapType.Empty; MapTileLayer googleTileLayer = new MapTileLayer(); googleTileLayer.GetTileUri += GoogleTileLayerOnGetTileUri; map.TileLayers.Add(googleTileLayer); //AddGoogleMapStyle(); break; case 2: //Vietbando Map EnableMapStyleComboBox(false); map.MapType = MapType.Empty; MapTileLayer vietBanDoMapTileLayer = new MapTileLayer(); vietBanDoMapTileLayer.GetTileUri += VietBanDoMapTileLayerOnGetTileUri; map.TileLayers.Add(vietBanDoMapTileLayer); break; default: break; } }