private async void LoadImages(MapSource mapSource) { mapImage = await mapSource.GetMapImage(); xrayMapImage = await mapSource.GetXRayMapImage(); Dispatcher.Invoke(() => imageControl.Source = mapImage); }
public void Initialize(MapViewModel mapViewModel, MapSource mapSource) { this.mapViewModel = mapViewModel; canvas = new Canvas(); imageControl = new Image(); if (!DesignerProperties.GetIsInDesignMode(this)) { Task.Run(() => LoadImages(mapSource)); } canvas.Children.Add(imageControl); mapViewModel.PropertyChanged += OnMapViewModelPropertyChanged; mapViewModel.Places.CollectionChanged += OnMarkersCollectionChanged; mapViewModel.Players.CollectionChanged += OnMarkersCollectionChanged; CreateSelectedPoisitionControl(); Child = canvas; Initialize(canvas); }