diff --git a/src/SampleApp.WinDesktop/View2D.xaml b/src/SampleApp.WinDesktop/View2D.xaml index 20ecbd3..f212fe4 100644 --- a/src/SampleApp.WinDesktop/View2D.xaml +++ b/src/SampleApp.WinDesktop/View2D.xaml @@ -10,7 +10,7 @@ - + diff --git a/src/SampleApp.WinDesktop/View2D.xaml.cs b/src/SampleApp.WinDesktop/View2D.xaml.cs index 05a05da..ab4a152 100644 --- a/src/SampleApp.WinDesktop/View2D.xaml.cs +++ b/src/SampleApp.WinDesktop/View2D.xaml.cs @@ -29,6 +29,12 @@ namespace SampleApp.WinDesktop mapView.LocationDisplay.InitialZoomScale = 5000; mapView.LocationDisplay.AutoPanMode = Esri.ArcGISRuntime.UI.LocationDisplayAutoPanMode.Recenter; + this.IsVisibleChanged += View2D_IsVisibleChanged; + } + + private void View2D_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e) + { + mapView.LocationDisplay.IsEnabled = IsVisible; } public NmeaDevice NmeaDevice @@ -51,8 +57,8 @@ namespace SampleApp.WinDesktop mapView.LocationDisplay.IsEnabled = false; if (newDevice != null) { - mapView.LocationDisplay.DataSource = new NmeaLocationDataSource(newDevice); - mapView.LocationDisplay.IsEnabled = true; + mapView.LocationDisplay.DataSource = new NmeaLocationDataSource(newDevice, false); + mapView.LocationDisplay.IsEnabled = IsLoaded; } } } diff --git a/src/SampleApp.WinDesktop/View3D.xaml.cs b/src/SampleApp.WinDesktop/View3D.xaml.cs index 42b91f3..2e21fec 100644 --- a/src/SampleApp.WinDesktop/View3D.xaml.cs +++ b/src/SampleApp.WinDesktop/View3D.xaml.cs @@ -67,15 +67,16 @@ namespace SampleApp.WinDesktop symb.Width = 3; symb.Depth = 5; symb.Height = 2; symb.AnchorPosition = SceneSymbolAnchorPosition.Bottom; graphic3D.Symbol = symb; sceneView.GraphicsOverlays["Position"].Graphics.Add(graphic3D); - sceneView.CameraController = new OrbitGeoElementCameraController(sceneView.GraphicsOverlays["Position"].Graphics[0], 200); } - + private int updateId = 0; private async void UpdateLocation(double latitude, double longitude, double newHeading) { // Handle 3D updates on 3D Scene var cid = ++updateId; + if (double.IsNaN(newHeading)) + newHeading = 0; var start = graphic3D.Geometry as MapPoint; if (start == null) {