private void InitializeCommon() { if (!IsDesignTime) { SpaceEffect = UI.SpaceEffect.None; AtmosphereEffect = Esri.ArcGISRuntime.UI.AtmosphereEffect.None; _initialTransformation = Mapping.TransformationMatrix.Identity; _controller = new TransformationMatrixCameraController() { TranslationFactor = 1 }; _controller.OriginCameraChanged += Controller_OriginCameraChanged; LocationDataSource = new SystemLocationDataSource(); } }
/// <summary> /// Initializes a new instance of the <see cref="MapViewModel"/> class. /// </summary> public MapViewModel(Map map, ConnectivityMode connectivityMode, int defaultZoomScale) { ConnectivityMode = connectivityMode; _defaultZoomScale = defaultZoomScale; // Initialize the map Map = map; Map.LoadStatusChanged += Map_LoadStatusChanged; Map.LoadAsync(); // Initialize the location data source for device location LocationDataSource = new SystemLocationDataSource(); LocationDataSource.LocationChanged += (s, l) => { _lastLocation = l; IsLocationStarted = true; }; }
/// <summary> /// Initializes a new instance of the <see cref="MapViewModel"/> class. /// </summary> public MapViewModel() { LocationDataSource = new SystemLocationDataSource(); LocationDataSource.LocationChanged += (s, l) => { _lastLocation = l; }; // reset map if user is signed out AuthViewModel.Instance.PropertyChanged += (s, l) => { if (l.PropertyName == nameof(AuthViewModel.AuthenticatedUser) && AuthViewModel.Instance.AuthenticatedUser == null) { Map = new Map(Basemap.CreateTopographicVector()) { InitialViewpoint = AreaOfInterest }; } }; }