public DigiTransitMap() { this.InitializeComponent(); //Default location of Helsinki's Rautatientori DigiTransitMapControl.Center = new Geopoint(new BasicGeoposition { Altitude = 0.0, Latitude = 60.1709, Longitude = 24.9413 }); if (Windows.ApplicationModel.DesignMode.DesignModeEnabled) { return; } this.Unloaded += DigiTransitMap_Unloaded; this.DigiTransitMapControl.CenterChanged += DigiTransitMapControl_CenterChanged; this.DigiTransitMapControl.MapTapped += DigiTransitMapControl_MapTapped; this.DigiTransitMapControl.MapRightTapped += DigiTransitMapControl_MapRightTapped; _geolocationService = SimpleIoc.Default.GetInstance <IGeolocationService>(); MapServiceToken = MapHelper.MapApiToken.Value; if (_themeIconSource == null) { _themeIconSource = CircleMapIconSource.GenerateIconAsync(CircleMapIconSource.IconType.ThemeColor); } if (_greyIconSource == null) { _greyIconSource = CircleMapIconSource.GenerateIconAsync(CircleMapIconSource.IconType.GreyedOut); } if (_themeIconPointerOverSource == null) { _themeIconPointerOverSource = CircleMapIconSource.GenerateIconAsync(CircleMapIconSource.IconType.ThemeColorPointerOver); } if (_themeIconSelectedSource == null) { _themeIconSelectedSource = CircleMapIconSource.GenerateIconAsync(CircleMapIconSource.IconType.ThemeColorSelected); } }
private static void Initialize() { _topmostGrid = Window.Current.Content.FirstChild <Grid>(); _source = new CircleMapIconSource(); _source.RenderTransform = new CompositeTransform { TranslateX = -500, TranslateY = -500 }; // Make sure to add any new IconTypes here. TypeToXamlMappings.Add(IconType.GreyedOut, _source.GreyedOutCircle); TypeToXamlMappings.Add(IconType.ThemeColor, _source.ThemeColoredCircle); TypeToXamlMappings.Add(IconType.ThemeColorPointerOver, _source.ThemeColoredPointerOverCircle); TypeToXamlMappings.Add(IconType.ThemeColorSelected, _source.ThemeColoredSelectedCircle); DispatcherHelper.CheckBeginInvokeOnUI(() => { _topmostGrid.Children.Add(_source); _topmostGrid.UpdateLayout(); _initialized = true; }); }