From d56c40262b91acd53e9a60d85df8505bc11093b7 Mon Sep 17 00:00:00 2001 From: Hamish Duff <99325835+duffh@users.noreply.github.com> Date: Mon, 14 Aug 2023 16:14:33 +0100 Subject: [PATCH] Fix issue with Geodatabase transactions sample when navigating away (#1283) --- .../GeodatabaseTransactions/GeodatabaseTransactions.xaml.cs | 2 +- .../GeodatabaseTransactions/GeodatabaseTransactions.xaml.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/WPF/WPF.Viewer/Samples/Data/GeodatabaseTransactions/GeodatabaseTransactions.xaml.cs b/src/WPF/WPF.Viewer/Samples/Data/GeodatabaseTransactions/GeodatabaseTransactions.xaml.cs index d8070856be..b4ac6c3ffb 100644 --- a/src/WPF/WPF.Viewer/Samples/Data/GeodatabaseTransactions/GeodatabaseTransactions.xaml.cs +++ b/src/WPF/WPF.Viewer/Samples/Data/GeodatabaseTransactions/GeodatabaseTransactions.xaml.cs @@ -158,7 +158,7 @@ private async Task LoadLocalGeodatabaseTables() // Create a new feature layer to show the table in the map. FeatureLayer layer = new FeatureLayer(table); - Dispatcher.Invoke(() => MyMapView.Map.OperationalLayers.Add(layer)); + Dispatcher.Invoke(() => MyMapView.Map?.OperationalLayers.Add(layer)); } catch (Exception e) { diff --git a/src/WinUI/ArcGIS.WinUI.Viewer/Samples/Data/GeodatabaseTransactions/GeodatabaseTransactions.xaml.cs b/src/WinUI/ArcGIS.WinUI.Viewer/Samples/Data/GeodatabaseTransactions/GeodatabaseTransactions.xaml.cs index 39fc33e77a..36723c6a2d 100644 --- a/src/WinUI/ArcGIS.WinUI.Viewer/Samples/Data/GeodatabaseTransactions/GeodatabaseTransactions.xaml.cs +++ b/src/WinUI/ArcGIS.WinUI.Viewer/Samples/Data/GeodatabaseTransactions/GeodatabaseTransactions.xaml.cs @@ -166,7 +166,7 @@ private async Task LoadLocalGeodatabaseTables() // Create a new feature layer to show the table in the map. FeatureLayer layer = new FeatureLayer(table); - DispatcherQueue.TryEnqueue(Microsoft.UI.Dispatching.DispatcherQueuePriority.Normal, () => MyMapView.Map.OperationalLayers.Add(layer)); + DispatcherQueue.TryEnqueue(Microsoft.UI.Dispatching.DispatcherQueuePriority.Normal, () => MyMapView.Map?.OperationalLayers.Add(layer)); } catch (Exception e) {