From c633b7f8ac12b8d9b2781bda351a13a5cb12ac21 Mon Sep 17 00:00:00 2001 From: William Bohrmann Date: Fri, 28 Mar 2025 15:18:06 -0700 Subject: [PATCH] show alerts find & replace "await DisplayAlert" w/ "Application.Current.Windows[0].Page.DisplayAlert" --- .../LineOfSightGeoElement.xaml.cs | 2 +- .../QueryFeatureCountAndExtent.xaml.cs | 6 ++--- .../ViewshedGeoElement.xaml.cs | 2 +- .../AddFeaturesWithContingentValues.xaml.cs | 14 +++++------ .../CreateMobileGeodatabase.xaml.cs | 6 ++--- .../EditAndSyncFeatures.xaml.cs | 10 ++++---- .../EditFeatureAttachments.xaml.cs | 4 ++-- .../EditFeatureLinkedAnnotation.xaml.cs | 6 ++--- .../EditFeaturesUsingFeatureForms.xaml.cs | 6 ++--- .../FeatureLayerQuery.xaml.cs | 4 ++-- .../GenerateGeodatabaseReplica.xaml.cs | 8 +++---- .../GeodatabaseTransactions.xaml.cs | 2 +- .../ListRelatedFeatures.xaml.cs | 4 ++-- .../ManageFeatures/ManageFeatures.xaml.cs | 24 +++++++++---------- .../QueryFeaturesWithArcadeExpression.xaml.cs | 4 ++-- .../RasterLayerGeoPackage.xaml.cs | 2 +- .../ReadGeoPackage/ReadGeoPackage.xaml.cs | 2 +- .../ReadShapefileMetadata.xaml.cs | 2 +- .../StatisticalQuery/StatisticalQuery.xaml.cs | 2 +- .../StatsQueryGroupAndSort.xaml.cs | 4 ++-- .../SymbolizeShapefile.xaml.cs | 2 +- .../ToggleBetweenFeatureRequestModes.xaml.cs | 4 ++-- .../Samples/Geometry/Buffer/Buffer.xaml.cs | 2 +- .../CreateAndEditGeometries.xaml.cs | 2 +- .../ListTransformations.xaml.cs | 2 +- .../SnapGeometryEdits.xaml.cs | 2 +- .../SpatialRelationships.xaml.cs | 2 +- .../AnalyzeHotspots/AnalyzeHotspots.xaml.cs | 6 ++--- .../AnalyzeViewshed/AnalyzeViewshed.xaml.cs | 6 ++--- .../ListGeodatabaseVersions.xaml.cs | 6 ++--- .../Animate3DGraphic/Animate3DGraphic.xaml.cs | 2 +- .../DictionaryRendererGraphicsOverlay.xaml.cs | 2 +- .../IdentifyGraphics/IdentifyGraphics.xaml.cs | 4 ++-- .../AddCustomDynamicEntityDataSource.xaml.cs | 2 +- ...AddVectorTiledLayerFromCustomStyle.xaml.cs | 6 ++--- .../BrowseOAFeatureService.xaml.cs | 4 ++-- .../BrowseWfsLayers/BrowseWfsLayers.xaml.cs | 4 ++-- .../ChangeBlendRenderer.xaml.cs | 2 +- .../ChangeStretchRenderer.xaml.cs | 2 +- .../ChangeSublayerVisibility.xaml.cs | 2 +- ...figureElectronicNavigationalCharts.xaml.cs | 4 ++-- .../CreateAndSaveKmlFile.xaml.cs | 6 ++--- .../CreateFeatureCollectionLayer.xaml.cs | 2 +- .../DisplayDimensions.xaml.cs | 2 +- .../DisplayFeatureLayers.xaml.cs | 2 +- .../Layers/DisplayKml/DisplayKml.xaml.cs | 2 +- .../DisplayKmlNetworkLinks.xaml.cs | 2 +- .../DisplayOACollection.xaml.cs | 4 ++-- .../DisplayRouteLayer.xaml.cs | 2 +- .../DisplaySubtypeFeatureLayer.xaml.cs | 2 +- .../Layers/DisplayWfs/DisplayWfs.xaml.cs | 4 ++-- .../Layers/ExportTiles/ExportTiles.xaml.cs | 8 +++---- .../ExportVectorTiles.xaml.cs | 4 ++-- .../FeatureCollectionLayerFromPortal.xaml.cs | 4 ++-- .../FeatureCollectionLayerFromQuery.xaml.cs | 2 +- .../FeatureLayerDefinitionExpression.xaml.cs | 2 +- .../FeatureLayerDictionaryRenderer.xaml.cs | 2 +- .../FeatureLayerRenderingModeMap.xaml.cs | 2 +- .../FeatureLayerSelection.xaml.cs | 4 ++-- .../Layers/GroupLayers/GroupLayers.xaml.cs | 2 +- .../IdentifyKmlFeatures.xaml.cs | 2 +- .../IdentifyRasterCell.xaml.cs | 4 ++-- .../ListKmlContents/ListKmlContents.xaml.cs | 4 ++-- .../MapImageLayerTables.xaml.cs | 6 ++--- .../MapImageSublayerQuery.xaml.cs | 2 +- .../Layers/PlayKmlTours/PlayKmlTours.xaml.cs | 2 +- .../QueryCQLFilters/QueryCQLFilters.xaml.cs | 4 ++-- .../RasterColormapRenderer.xaml.cs | 2 +- .../RasterHillshade/RasterHillshade.xaml.cs | 2 +- .../RasterLayerFile/RasterLayerFile.xaml.cs | 2 +- .../RasterLayerRasterFunction.xaml.cs | 2 +- .../RasterRenderingRule.xaml.cs | 4 ++-- .../RasterRgbRenderer.xaml.cs | 2 +- .../SceneLayerSelection.xaml.cs | 4 ++-- .../SceneLayerUrl/SceneLayerUrl.xaml.cs | 2 +- .../ShowLabelsOnLayer.xaml.cs | 2 +- .../StyleWmsLayer/StyleWmsLayer.xaml.cs | 2 +- .../TimeBasedQuery/TimeBasedQuery.xaml.cs | 2 +- .../Layers/WMTSLayer/WMTSLayer.xaml.cs | 2 +- .../Layers/WfsXmlQuery/WfsXmlQuery.xaml.cs | 2 +- .../Layers/WmsIdentify/WmsIdentify.xaml.cs | 4 ++-- .../WmsServiceCatalog.xaml.cs | 4 ++-- .../DisplayDeviceLocation.xaml.cs | 2 +- .../IndoorPositioning.xaml.cs | 2 +- .../LocationDrivenGeotriggers.xaml.cs | 2 +- .../LocationWithNMEA/LocationWithNMEA.xaml.cs | 2 +- .../ShowLocationHistory.xaml.cs | 2 +- .../ApplyScheduledUpdates.xaml.cs | 10 ++++---- .../Samples/Map/AuthorMap/AuthorMap.xaml.cs | 6 ++--- .../BrowseBuildingFloors.xaml.cs | 4 ++-- .../DownloadPreplannedMap.xaml.cs | 10 ++++---- .../GenerateOfflineMap.xaml.cs | 10 ++++---- .../GenerateOfflineMapWithOverrides.xaml.cs | 14 +++++------ .../HonorMobileMapPackageExpiration.xaml.cs | 4 ++-- .../MobileMapSearchAndRoute.xaml.cs | 4 ++-- .../OfflineBasemapByReference.xaml.cs | 14 +++++------ .../Samples/Map/OpenMapURL/OpenMapURL.xaml.cs | 2 +- .../Map/OpenMobileMap/OpenMobileMap.xaml.cs | 2 +- .../SearchPortalMaps/SearchPortalMaps.xaml.cs | 4 ++-- .../ChangeViewpoint/ChangeViewpoint.xaml.cs | 2 +- .../FeatureLayerTimeOffset.xaml.cs | 2 +- .../IdentifyLayers/IdentifyLayers.xaml.cs | 6 ++--- .../TakeScreenshot/TakeScreenshot.xaml.cs | 2 +- .../ClosestFacility/ClosestFacility.xaml.cs | 6 ++--- .../ClosestFacilityStatic.xaml.cs | 4 ++-- .../FindRoute/FindRoute.xaml.cs | 2 +- .../FindServiceArea/FindServiceArea.xaml.cs | 10 ++++---- .../NavigateRoute/NavigateRoute.xaml.cs | 2 +- .../NavigateRouteRerouting.xaml.cs | 4 ++-- .../GetElevationAtPoint.xaml.cs | 2 +- .../OpenMobileScenePackage.xaml.cs | 2 +- .../OpenScenePortalItem.xaml.cs | 2 +- .../ShowLabelsOnLayer3D.xaml.cs | 2 +- .../AnimateImageOverlay.xaml.cs | 2 +- .../ChooseCameraController.xaml.cs | 4 ++-- .../Search/FindAddress/FindAddress.xaml.cs | 8 +++---- .../Search/FindPlace/FindPlace.xaml.cs | 6 ++--- .../OfflineGeocode/OfflineGeocode.xaml.cs | 12 +++++----- .../ReverseGeocode/ReverseGeocode.xaml.cs | 4 ++-- .../Samples/Security/OAuth/OAuth.xaml.cs | 2 +- .../CustomDictionaryStyle.xaml.cs | 2 +- .../FeatureLayerExtrusion.xaml.cs | 2 +- .../SymbolStylesFromWebStyles.xaml.cs | 2 +- .../SymbolsFromMobileStyle.xaml.cs | 8 +++---- .../UseDistanceCompositeSym.xaml.cs | 2 +- .../ConfigureSubnetworkTrace.xaml.cs | 8 +++---- .../CreateLoadReport/CreateLoadReport.xaml.cs | 8 +++---- .../DisplayUtilityAssociations.xaml.cs | 4 ++-- .../DisplayUtilityNetworkContainer.xaml.cs | 4 ++-- .../PerformValveIsolationTrace.xaml.cs | 6 ++--- ...ometryEditsWithUtilityNetworkRules.xaml.cs | 2 +- .../TraceUtilityNetwork.xaml.cs | 8 +++---- .../ValidateUtilityNetworkTopology.xaml.cs | 12 +++++----- .../Maui.Samples/Views/SettingsPage.xaml.cs | 18 +++++++------- 134 files changed, 284 insertions(+), 284 deletions(-) diff --git a/src/MAUI/Maui.Samples/Samples/Analysis/LineOfSightGeoElement/LineOfSightGeoElement.xaml.cs b/src/MAUI/Maui.Samples/Samples/Analysis/LineOfSightGeoElement/LineOfSightGeoElement.xaml.cs index 03ad5380d5..bd3fe608be 100644 --- a/src/MAUI/Maui.Samples/Samples/Analysis/LineOfSightGeoElement/LineOfSightGeoElement.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/Analysis/LineOfSightGeoElement/LineOfSightGeoElement.xaml.cs @@ -138,7 +138,7 @@ private async Task Initialize() } catch (Exception e) { - await DisplayAlert("Error", e.ToString(), "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", e.ToString(), "OK"); } } diff --git a/src/MAUI/Maui.Samples/Samples/Analysis/QueryFeatureCountAndExtent/QueryFeatureCountAndExtent.xaml.cs b/src/MAUI/Maui.Samples/Samples/Analysis/QueryFeatureCountAndExtent/QueryFeatureCountAndExtent.xaml.cs index 71332ae0cb..511e8667bd 100644 --- a/src/MAUI/Maui.Samples/Samples/Analysis/QueryFeatureCountAndExtent/QueryFeatureCountAndExtent.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/Analysis/QueryFeatureCountAndExtent/QueryFeatureCountAndExtent.xaml.cs @@ -79,7 +79,7 @@ private async Task Initialize() } catch (Exception e) { - await DisplayAlert("Error", e.ToString(), "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", e.ToString(), "OK"); } } @@ -107,7 +107,7 @@ private async void StatesPicker_SelectionChanged(object sender, EventArgs e) } catch (Exception ex) { - await DisplayAlert("Error", ex.ToString(), "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", ex.ToString(), "OK"); } } @@ -134,7 +134,7 @@ private async void CountFeaturesButton_Click(object sender, EventArgs e) } catch (Exception ex) { - await DisplayAlert("Error", ex.ToString(), "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", ex.ToString(), "OK"); } } } diff --git a/src/MAUI/Maui.Samples/Samples/Analysis/ViewshedGeoElement/ViewshedGeoElement.xaml.cs b/src/MAUI/Maui.Samples/Samples/Analysis/ViewshedGeoElement/ViewshedGeoElement.xaml.cs index 2db710a619..4924b9f524 100644 --- a/src/MAUI/Maui.Samples/Samples/Analysis/ViewshedGeoElement/ViewshedGeoElement.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/Analysis/ViewshedGeoElement/ViewshedGeoElement.xaml.cs @@ -135,7 +135,7 @@ private async Task Initialize() } catch (Exception e) { - await DisplayAlert("Error", e.ToString(), "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", e.ToString(), "OK"); } } diff --git a/src/MAUI/Maui.Samples/Samples/Data/AddFeaturesWithContingentValues/AddFeaturesWithContingentValues.xaml.cs b/src/MAUI/Maui.Samples/Samples/Data/AddFeaturesWithContingentValues/AddFeaturesWithContingentValues.xaml.cs index 0163e907e5..0f7c47fa4c 100644 --- a/src/MAUI/Maui.Samples/Samples/Data/AddFeaturesWithContingentValues/AddFeaturesWithContingentValues.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/Data/AddFeaturesWithContingentValues/AddFeaturesWithContingentValues.xaml.cs @@ -135,7 +135,7 @@ private async Task QueryAndBufferFeatures() } catch (Exception e) { - await DisplayAlert("Error", e.Message, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", e.Message, "OK"); } } @@ -163,7 +163,7 @@ private async Task CreateNewEmptyFeature(Esri.ArcGISRuntime.Maui.GeoViewInputEve } catch (Exception ex) { - await DisplayAlert("Error", ex.Message, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", ex.Message, "OK"); } } @@ -197,7 +197,7 @@ private async Task> GetContingentValues(string field, string fieldG } catch (Exception e) { - await DisplayAlert("Error", e.Message, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", e.Message, "OK"); } return contingentValuesNamesList; @@ -250,7 +250,7 @@ private async Task DiscardFeature() } catch (Exception e) { - await DisplayAlert("Error", e.Message, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", e.Message, "OK"); } } @@ -274,13 +274,13 @@ private async Task UpdateField(string field, object value) break; default: - await DisplayAlert("Error", $"{field} not found in any of the data dictionaries.", "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", $"{field} not found in any of the data dictionaries.", "OK"); break; } } catch (Exception e) { - await DisplayAlert("Error", e.Message, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", e.Message, "OK"); } } @@ -344,7 +344,7 @@ private async Task SaveFeature() } else { - await DisplayAlert("Error", $"Error saving feature. {numberOfViolations} violation(s) in field group(s) {string.Join(", ", fieldGroupNames)}.", "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", $"Error saving feature. {numberOfViolations} violation(s) in field group(s) {string.Join(", ", fieldGroupNames)}.", "OK"); } } diff --git a/src/MAUI/Maui.Samples/Samples/Data/CreateMobileGeodatabase/CreateMobileGeodatabase.xaml.cs b/src/MAUI/Maui.Samples/Samples/Data/CreateMobileGeodatabase/CreateMobileGeodatabase.xaml.cs index 77dbb03a73..418ce761f3 100644 --- a/src/MAUI/Maui.Samples/Samples/Data/CreateMobileGeodatabase/CreateMobileGeodatabase.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/Data/CreateMobileGeodatabase/CreateMobileGeodatabase.xaml.cs @@ -101,7 +101,7 @@ private async Task CreateGeodatabase() } catch (Exception ex) { - await DisplayAlert(ex.GetType().Name, ex.Message, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert(ex.GetType().Name, ex.Message, "OK"); } } @@ -131,7 +131,7 @@ private async Task AddFeature(MapPoint location) } catch (Exception ex) { - await DisplayAlert(ex.GetType().Name, ex.Message, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert(ex.GetType().Name, ex.Message, "OK"); } } @@ -195,7 +195,7 @@ await Share.RequestAsync(new ShareFileRequest } catch (Exception ex) { - await DisplayAlert(ex.GetType().Name, ex.Message, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert(ex.GetType().Name, ex.Message, "OK"); } } diff --git a/src/MAUI/Maui.Samples/Samples/Data/EditAndSyncFeatures/EditAndSyncFeatures.xaml.cs b/src/MAUI/Maui.Samples/Samples/Data/EditAndSyncFeatures/EditAndSyncFeatures.xaml.cs index ed6b844688..def0a4836e 100644 --- a/src/MAUI/Maui.Samples/Samples/Data/EditAndSyncFeatures/EditAndSyncFeatures.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/Data/EditAndSyncFeatures/EditAndSyncFeatures.xaml.cs @@ -131,7 +131,7 @@ private async Task Initialize() } catch (Exception ex) { - await DisplayAlert("Error", ex.ToString(), "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", ex.ToString(), "OK"); } } @@ -227,7 +227,7 @@ private async void GeoViewTapped(object sender, GeoViewInputEventArgs e) } catch (Exception ex) { - await DisplayAlert("Error", ex.ToString(), "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", ex.ToString(), "OK"); } } @@ -373,7 +373,7 @@ private async Task HandleGenerationStatusChange(GenerateGeodatabaseJob job) } // Show the message. - await DisplayAlert("Error", message, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", message, "OK"); } } @@ -481,7 +481,7 @@ private async void GenerateButton_Clicked(object sender, EventArgs e) } catch (Exception ex) { - await DisplayAlert("Error", ex.ToString(), "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", ex.ToString(), "OK"); } } @@ -512,7 +512,7 @@ private async void SyncButton_Click(object sender, EventArgs e) } catch (Exception ex) { - await DisplayAlert("Alert", ex.ToString(), "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Alert", ex.ToString(), "OK"); } } } diff --git a/src/MAUI/Maui.Samples/Samples/Data/EditFeatureAttachments/EditFeatureAttachments.xaml.cs b/src/MAUI/Maui.Samples/Samples/Data/EditFeatureAttachments/EditFeatureAttachments.xaml.cs index 644f15ad6f..580f117c86 100644 --- a/src/MAUI/Maui.Samples/Samples/Data/EditFeatureAttachments/EditFeatureAttachments.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/Data/EditFeatureAttachments/EditFeatureAttachments.xaml.cs @@ -62,7 +62,7 @@ private async Task Initialize() } catch (Exception ex) { - await DisplayAlert("Error", ex.ToString(), "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", ex.ToString(), "OK"); } } @@ -106,7 +106,7 @@ private async void MapView_Tapped(object sender, Esri.ArcGISRuntime.Maui.GeoView } catch (Exception ex) { - await DisplayAlert("Error selecting feature", ex.ToString(), "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error selecting feature", ex.ToString(), "OK"); } } diff --git a/src/MAUI/Maui.Samples/Samples/Data/EditFeatureLinkedAnnotation/EditFeatureLinkedAnnotation.xaml.cs b/src/MAUI/Maui.Samples/Samples/Data/EditFeatureLinkedAnnotation/EditFeatureLinkedAnnotation.xaml.cs index 3d45d5a05d..94a9f68129 100644 --- a/src/MAUI/Maui.Samples/Samples/Data/EditFeatureLinkedAnnotation/EditFeatureLinkedAnnotation.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/Data/EditFeatureLinkedAnnotation/EditFeatureLinkedAnnotation.xaml.cs @@ -58,7 +58,7 @@ private async Task Initialize() } catch (Exception ex) { - await DisplayAlert("Error", ex.Message, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", ex.Message, "OK"); } } @@ -113,7 +113,7 @@ private async Task SelectFeature(Point clickedPoint) } catch (Exception ex) { - await DisplayAlert("Error", ex.Message, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", ex.Message, "OK"); } } @@ -170,7 +170,7 @@ private async void OkClick(object sender, System.EventArgs e) } catch (Exception ex) { - await DisplayAlert("Error", ex.Message, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", ex.Message, "OK"); } finally { diff --git a/src/MAUI/Maui.Samples/Samples/Data/EditFeaturesUsingFeatureForms/EditFeaturesUsingFeatureForms.xaml.cs b/src/MAUI/Maui.Samples/Samples/Data/EditFeaturesUsingFeatureForms/EditFeaturesUsingFeatureForms.xaml.cs index afc3921e2a..03075e632e 100644 --- a/src/MAUI/Maui.Samples/Samples/Data/EditFeaturesUsingFeatureForms/EditFeaturesUsingFeatureForms.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/Data/EditFeaturesUsingFeatureForms/EditFeaturesUsingFeatureForms.xaml.cs @@ -48,7 +48,7 @@ private async Task Initialize() } catch (Exception ex) { - await DisplayAlert("Error", ex.Message, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", ex.Message, "OK"); } } @@ -74,7 +74,7 @@ private async void MyMapView_GeoViewTapped(object sender, Esri.ArcGISRuntime.Mau } catch (Exception ex) { - await DisplayAlert("Error", ex.Message, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", ex.Message, "OK"); } } @@ -115,7 +115,7 @@ private async void SaveButton_Clicked(object sender, EventArgs e) } catch (Exception ex) { - await DisplayAlert("Error", ex.Message, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", ex.Message, "OK"); } } diff --git a/src/MAUI/Maui.Samples/Samples/Data/FeatureLayerQuery/FeatureLayerQuery.xaml.cs b/src/MAUI/Maui.Samples/Samples/Data/FeatureLayerQuery/FeatureLayerQuery.xaml.cs index 3ba5a9698e..349f888ba4 100644 --- a/src/MAUI/Maui.Samples/Samples/Data/FeatureLayerQuery/FeatureLayerQuery.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/Data/FeatureLayerQuery/FeatureLayerQuery.xaml.cs @@ -128,12 +128,12 @@ private async Task QueryStateFeature(string stateName) } else { - await DisplayAlert("State Not Found!", "Add a valid state name.", "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("State Not Found!", "Add a valid state name.", "OK"); } } catch (Exception) { - await DisplayAlert("Sample error", "An error occurred", "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Sample error", "An error occurred", "OK"); } } } diff --git a/src/MAUI/Maui.Samples/Samples/Data/GenerateGeodatabaseReplica/GenerateGeodatabaseReplica.xaml.cs b/src/MAUI/Maui.Samples/Samples/Data/GenerateGeodatabaseReplica/GenerateGeodatabaseReplica.xaml.cs index 053a33f13e..86b892262d 100644 --- a/src/MAUI/Maui.Samples/Samples/Data/GenerateGeodatabaseReplica/GenerateGeodatabaseReplica.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/Data/GenerateGeodatabaseReplica/GenerateGeodatabaseReplica.xaml.cs @@ -111,7 +111,7 @@ private async Task Initialize() } catch (Exception ex) { - await DisplayAlert("Error", ex.ToString(), "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", ex.ToString(), "OK"); } } @@ -218,7 +218,7 @@ private async Task HandleGenerationStatusChange(GenerateGeodatabaseJob job, Geod await _gdbSyncTask.UnregisterGeodatabaseAsync(resultGdb); // Tell the user that the geodatabase was unregistered. - await DisplayAlert("Alert", "Since no edits will be made, the local geodatabase has been unregistered per best practice.", "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Alert", "Since no edits will be made, the local geodatabase has been unregistered per best practice.", "OK"); // Re-enable generate button. MyGenerateButton.IsEnabled = true; @@ -241,7 +241,7 @@ private async Task HandleGenerationStatusChange(GenerateGeodatabaseJob job, Geod message += ": " + String.Join("\n", job.Messages.Select(m => m.Message)); } - await DisplayAlert("Alert", message, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Alert", message, "OK"); } } @@ -260,7 +260,7 @@ private async void GenerateButton_Clicked(object sender, EventArgs e) } catch (Exception ex) { - await DisplayAlert("Error", ex.ToString(), "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", ex.ToString(), "OK"); } } diff --git a/src/MAUI/Maui.Samples/Samples/Data/GeodatabaseTransactions/GeodatabaseTransactions.xaml.cs b/src/MAUI/Maui.Samples/Samples/Data/GeodatabaseTransactions/GeodatabaseTransactions.xaml.cs index 89606ff7ef..0c8e50b35d 100644 --- a/src/MAUI/Maui.Samples/Samples/Data/GeodatabaseTransactions/GeodatabaseTransactions.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/Data/GeodatabaseTransactions/GeodatabaseTransactions.xaml.cs @@ -299,7 +299,7 @@ private async void StopEditTransaction(object sender, EventArgs e) } catch (Exception ex) { - await DisplayAlert("Error", ex.Message, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", ex.Message, "OK"); } } diff --git a/src/MAUI/Maui.Samples/Samples/Data/ListRelatedFeatures/ListRelatedFeatures.xaml.cs b/src/MAUI/Maui.Samples/Samples/Data/ListRelatedFeatures/ListRelatedFeatures.xaml.cs index a2876aefb8..dfdd2df7de 100644 --- a/src/MAUI/Maui.Samples/Samples/Data/ListRelatedFeatures/ListRelatedFeatures.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/Data/ListRelatedFeatures/ListRelatedFeatures.xaml.cs @@ -65,7 +65,7 @@ private async Task Initialize() } catch (Exception e) { - await DisplayAlert("Error", e.ToString(), "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", e.ToString(), "OK"); } } @@ -132,7 +132,7 @@ private async void MyMapViewOnGeoViewTapped(object sender, GeoViewInputEventArgs } catch (Exception ex) { - await DisplayAlert("Error", ex.ToString(), "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", ex.ToString(), "OK"); } } } diff --git a/src/MAUI/Maui.Samples/Samples/Data/ManageFeatures/ManageFeatures.xaml.cs b/src/MAUI/Maui.Samples/Samples/Data/ManageFeatures/ManageFeatures.xaml.cs index a3084b3adf..004c4045fe 100644 --- a/src/MAUI/Maui.Samples/Samples/Data/ManageFeatures/ManageFeatures.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/Data/ManageFeatures/ManageFeatures.xaml.cs @@ -93,7 +93,7 @@ public async Task Initialize() } catch (Exception ex) { - await DisplayAlert("Error", ex.ToString(), "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", ex.ToString(), "OK"); } } @@ -122,11 +122,11 @@ private async void MapView_Tapped_CreateFeature(object sender, GeoViewInputEvent feature.Refresh(); // Confirm feature addition. - await DisplayAlert("Success", $"Created feature {feature.Attributes["objectid"]}", "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Success", $"Created feature {feature.Attributes["objectid"]}", "OK"); } catch (Exception ex) { - await DisplayAlert("Error", ex.ToString(), "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", ex.ToString(), "OK"); } } @@ -163,7 +163,7 @@ private async void MapView_Tapped_DeleteFeature(object sender, GeoViewInputEvent } catch (Exception ex) { - await DisplayAlert("Error", ex.ToString(), "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", ex.ToString(), "OK"); } } @@ -179,11 +179,11 @@ private async void DeleteButton_Clicked(object sender, EventArgs e) await serviceTable.ServiceGeodatabase.ApplyEditsAsync(); // Show a message confirming the deletion. - await DisplayAlert("Success", $"Deleted feature with ID {_selectedFeature.Attributes["objectid"]}", "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Success", $"Deleted feature with ID {_selectedFeature.Attributes["objectid"]}", "OK"); } catch (Exception ex) { - await DisplayAlert("Error", ex.ToString(), "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", ex.ToString(), "OK"); } finally { @@ -229,7 +229,7 @@ private async void MapView_Tapped_UpdateAttribute(object sender, GeoViewInputEve } catch (Exception ex) { - await DisplayAlert("Error", ex.ToString(), "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", ex.ToString(), "OK"); } } @@ -260,11 +260,11 @@ private async void DamageType_Changed(object sender, EventArgs e) Instructions.Text = _instructions[2]; DamageTypePicker.IsVisible = false; - await DisplayAlert("Success", $"Edited feature {_selectedFeature.Attributes["objectid"]}", "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Success", $"Edited feature {_selectedFeature.Attributes["objectid"]}", "OK"); } catch (Exception ex) { - await DisplayAlert("Error", ex.ToString(), "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", ex.ToString(), "OK"); } finally { @@ -312,11 +312,11 @@ private async Task MoveSelectedFeature(MapPoint destinationPoint) // Push the update to the service with the service geodatabase. var serviceTable = (ServiceFeatureTable)_selectedFeature.FeatureTable; await serviceTable.ServiceGeodatabase.ApplyEditsAsync(); - await DisplayAlert("Success", $"Moved feature {_selectedFeature.Attributes["objectid"]}", "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Success", $"Moved feature {_selectedFeature.Attributes["objectid"]}", "OK"); } catch (Exception ex) { - await DisplayAlert("Error", ex.ToString(), "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", ex.ToString(), "OK"); } finally { @@ -406,7 +406,7 @@ private async Task TrySelectFeature(Point point) } catch (Exception ex) { - await DisplayAlert("Error", ex.ToString(), "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", ex.ToString(), "OK"); return null; } } diff --git a/src/MAUI/Maui.Samples/Samples/Data/QueryFeaturesWithArcadeExpression/QueryFeaturesWithArcadeExpression.xaml.cs b/src/MAUI/Maui.Samples/Samples/Data/QueryFeaturesWithArcadeExpression/QueryFeaturesWithArcadeExpression.xaml.cs index 7b66c91116..06dfb7fb3e 100644 --- a/src/MAUI/Maui.Samples/Samples/Data/QueryFeaturesWithArcadeExpression/QueryFeaturesWithArcadeExpression.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/Data/QueryFeaturesWithArcadeExpression/QueryFeaturesWithArcadeExpression.xaml.cs @@ -55,7 +55,7 @@ private async Task Initialize() } catch (Exception e) { - await DisplayAlert("Error", e.Message, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", e.Message, "OK"); } // Load the map. @@ -128,7 +128,7 @@ private async Task GeoViewTappedTask(Esri.ArcGISRuntime.Maui.GeoViewInputEventAr } catch (Exception ex) { - await DisplayAlert("Error", ex.Message, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", ex.Message, "OK"); } } diff --git a/src/MAUI/Maui.Samples/Samples/Data/RasterLayerGeoPackage/RasterLayerGeoPackage.xaml.cs b/src/MAUI/Maui.Samples/Samples/Data/RasterLayerGeoPackage/RasterLayerGeoPackage.xaml.cs index 1e4ec272f8..56a7adbfff 100644 --- a/src/MAUI/Maui.Samples/Samples/Data/RasterLayerGeoPackage/RasterLayerGeoPackage.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/Data/RasterLayerGeoPackage/RasterLayerGeoPackage.xaml.cs @@ -62,7 +62,7 @@ private async Task Initialize() } catch (Exception e) { - await DisplayAlert("Error", e.ToString(), "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", e.ToString(), "OK"); } } diff --git a/src/MAUI/Maui.Samples/Samples/Data/ReadGeoPackage/ReadGeoPackage.xaml.cs b/src/MAUI/Maui.Samples/Samples/Data/ReadGeoPackage/ReadGeoPackage.xaml.cs index 4c3a48aa5f..2e029221f6 100644 --- a/src/MAUI/Maui.Samples/Samples/Data/ReadGeoPackage/ReadGeoPackage.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/Data/ReadGeoPackage/ReadGeoPackage.xaml.cs @@ -75,7 +75,7 @@ private async Task Initialize() } catch (Exception e) { - await DisplayAlert("Error", e.ToString(), "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", e.ToString(), "OK"); } } diff --git a/src/MAUI/Maui.Samples/Samples/Data/ReadShapefileMetadata/ReadShapefileMetadata.xaml.cs b/src/MAUI/Maui.Samples/Samples/Data/ReadShapefileMetadata/ReadShapefileMetadata.xaml.cs index a9a7c8c769..74e5f35c4b 100644 --- a/src/MAUI/Maui.Samples/Samples/Data/ReadShapefileMetadata/ReadShapefileMetadata.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/Data/ReadShapefileMetadata/ReadShapefileMetadata.xaml.cs @@ -83,7 +83,7 @@ private async Task Initialize() } catch (Exception e) { - await DisplayAlert("Error", e.ToString(), "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", e.ToString(), "OK"); } } diff --git a/src/MAUI/Maui.Samples/Samples/Data/StatisticalQuery/StatisticalQuery.xaml.cs b/src/MAUI/Maui.Samples/Samples/Data/StatisticalQuery/StatisticalQuery.xaml.cs index 8874ac06a7..f83e23ded3 100644 --- a/src/MAUI/Maui.Samples/Samples/Data/StatisticalQuery/StatisticalQuery.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/Data/StatisticalQuery/StatisticalQuery.xaml.cs @@ -138,7 +138,7 @@ private async void OnExecuteStatisticsQuery_Clicked(object sender, EventArgs e) } catch (Exception ex) { - await DisplayAlert("Error", ex.Message, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", ex.Message, "OK"); } } diff --git a/src/MAUI/Maui.Samples/Samples/Data/StatsQueryGroupAndSort/StatsQueryGroupAndSort.xaml.cs b/src/MAUI/Maui.Samples/Samples/Data/StatsQueryGroupAndSort/StatsQueryGroupAndSort.xaml.cs index 2355e9e7ef..b8e0ab27c7 100644 --- a/src/MAUI/Maui.Samples/Samples/Data/StatsQueryGroupAndSort/StatsQueryGroupAndSort.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/Data/StatsQueryGroupAndSort/StatsQueryGroupAndSort.xaml.cs @@ -69,7 +69,7 @@ private async Task Initialize() } catch (Exception e) { - await DisplayAlert("Error", e.ToString(), "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", e.ToString(), "OK"); } } @@ -138,7 +138,7 @@ private async void GetStatisticsButton_Clicked(object sender, EventArgs e) } catch (Exception ex) { - await DisplayAlert("Error", ex.ToString(), "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", ex.ToString(), "OK"); } } diff --git a/src/MAUI/Maui.Samples/Samples/Data/SymbolizeShapefile/SymbolizeShapefile.xaml.cs b/src/MAUI/Maui.Samples/Samples/Data/SymbolizeShapefile/SymbolizeShapefile.xaml.cs index 20a6a52c25..053767f16c 100644 --- a/src/MAUI/Maui.Samples/Samples/Data/SymbolizeShapefile/SymbolizeShapefile.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/Data/SymbolizeShapefile/SymbolizeShapefile.xaml.cs @@ -89,7 +89,7 @@ private async Task Initialize() } catch (Exception e) { - await DisplayAlert("Error", e.ToString(), "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", e.ToString(), "OK"); } } diff --git a/src/MAUI/Maui.Samples/Samples/Data/ToggleBetweenFeatureRequestModes/ToggleBetweenFeatureRequestModes.xaml.cs b/src/MAUI/Maui.Samples/Samples/Data/ToggleBetweenFeatureRequestModes/ToggleBetweenFeatureRequestModes.xaml.cs index db10ca8e71..03b45c6fae 100644 --- a/src/MAUI/Maui.Samples/Samples/Data/ToggleBetweenFeatureRequestModes/ToggleBetweenFeatureRequestModes.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/Data/ToggleBetweenFeatureRequestModes/ToggleBetweenFeatureRequestModes.xaml.cs @@ -68,7 +68,7 @@ private async Task Initialize() } catch (Exception ex) { - await DisplayAlert("Error", ex.Message, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", ex.Message, "OK"); } } @@ -129,7 +129,7 @@ private async Task FetchCacheManually() } catch (Exception ex) { - await DisplayAlert("Error", ex.Message, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", ex.Message, "OK"); } } diff --git a/src/MAUI/Maui.Samples/Samples/Geometry/Buffer/Buffer.xaml.cs b/src/MAUI/Maui.Samples/Samples/Geometry/Buffer/Buffer.xaml.cs index 67f25b758d..3d035ea3f3 100644 --- a/src/MAUI/Maui.Samples/Samples/Geometry/Buffer/Buffer.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/Geometry/Buffer/Buffer.xaml.cs @@ -118,7 +118,7 @@ private async void MyMapView_GeoViewTapped(object sender, Esri.ArcGISRuntime.Mau catch (System.Exception ex) { // Display an error message if there is a problem generating the buffers. - await DisplayAlert("Error creating buffers", ex.Message, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error creating buffers", ex.Message, "OK"); } } diff --git a/src/MAUI/Maui.Samples/Samples/Geometry/CreateAndEditGeometries/CreateAndEditGeometries.xaml.cs b/src/MAUI/Maui.Samples/Samples/Geometry/CreateAndEditGeometries/CreateAndEditGeometries.xaml.cs index 7d9610baa3..19783823d5 100644 --- a/src/MAUI/Maui.Samples/Samples/Geometry/CreateAndEditGeometries/CreateAndEditGeometries.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/Geometry/CreateAndEditGeometries/CreateAndEditGeometries.xaml.cs @@ -293,7 +293,7 @@ private async void MyMapView_GeoViewTapped(object sender, Esri.ArcGISRuntime.Mau catch (Exception ex) { // Report exceptions. - await DisplayAlert("Error editing", ex.Message, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error editing", ex.Message, "OK"); ResetFromEditingSession(); return; diff --git a/src/MAUI/Maui.Samples/Samples/Geometry/ListTransformations/ListTransformations.xaml.cs b/src/MAUI/Maui.Samples/Samples/Geometry/ListTransformations/ListTransformations.xaml.cs index c7847559a2..42e70c83d1 100644 --- a/src/MAUI/Maui.Samples/Samples/Geometry/ListTransformations/ListTransformations.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/Geometry/ListTransformations/ListTransformations.xaml.cs @@ -95,7 +95,7 @@ private async Task Initialize() } catch (Exception e) { - await DisplayAlert("Error", e.ToString(), "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", e.ToString(), "OK"); } } diff --git a/src/MAUI/Maui.Samples/Samples/Geometry/SnapGeometryEdits/SnapGeometryEdits.xaml.cs b/src/MAUI/Maui.Samples/Samples/Geometry/SnapGeometryEdits/SnapGeometryEdits.xaml.cs index 090a1098fe..af76992187 100644 --- a/src/MAUI/Maui.Samples/Samples/Geometry/SnapGeometryEdits/SnapGeometryEdits.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/Geometry/SnapGeometryEdits/SnapGeometryEdits.xaml.cs @@ -180,7 +180,7 @@ private async void MyMapView_GeoViewTapped(object sender, GeoViewInputEventArgs } catch (Exception ex) { - await DisplayAlert("Error editing", ex.Message, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error editing", ex.Message, "OK"); // Reset the UI. ResetFromEditingSession(); diff --git a/src/MAUI/Maui.Samples/Samples/Geometry/SpatialRelationships/SpatialRelationships.xaml.cs b/src/MAUI/Maui.Samples/Samples/Geometry/SpatialRelationships/SpatialRelationships.xaml.cs index 7a70822660..d8ce064cca 100644 --- a/src/MAUI/Maui.Samples/Samples/Geometry/SpatialRelationships/SpatialRelationships.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/Geometry/SpatialRelationships/SpatialRelationships.xaml.cs @@ -118,7 +118,7 @@ private async void MyMapView_GeoViewTapped(object sender, Esri.ArcGISRuntime.Mau } catch (Exception ex) { - await DisplayAlert("Error", ex.ToString(), "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", ex.ToString(), "OK"); } // Return if there are no results diff --git a/src/MAUI/Maui.Samples/Samples/Geoprocessing/AnalyzeHotspots/AnalyzeHotspots.xaml.cs b/src/MAUI/Maui.Samples/Samples/Geoprocessing/AnalyzeHotspots/AnalyzeHotspots.xaml.cs index 1544b3477d..ed7874250d 100644 --- a/src/MAUI/Maui.Samples/Samples/Geoprocessing/AnalyzeHotspots/AnalyzeHotspots.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/Geoprocessing/AnalyzeHotspots/AnalyzeHotspots.xaml.cs @@ -51,7 +51,7 @@ private async Task Initialize() } catch (Exception e) { - await DisplayAlert("Error", e.ToString(), "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", e.ToString(), "OK"); } } @@ -111,11 +111,11 @@ private async void OnRunAnalysisClicked(object sender, EventArgs e) // Display error messages if the geoprocessing task fails if (_hotspotJob.Status == JobStatus.Failed && _hotspotJob.Error != null) { - await DisplayAlert("Geoprocessing error", "Executing geoprocessing failed. " + _hotspotJob.Error.Message, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Geoprocessing error", "Executing geoprocessing failed. " + _hotspotJob.Error.Message, "OK"); } else { - await DisplayAlert("Sample error", "An error occurred. " + ex.ToString(), "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Sample error", "An error occurred. " + ex.ToString(), "OK"); } } finally diff --git a/src/MAUI/Maui.Samples/Samples/Geoprocessing/AnalyzeViewshed/AnalyzeViewshed.xaml.cs b/src/MAUI/Maui.Samples/Samples/Geoprocessing/AnalyzeViewshed/AnalyzeViewshed.xaml.cs index f8086e80bb..1a39cb1cd7 100644 --- a/src/MAUI/Maui.Samples/Samples/Geoprocessing/AnalyzeViewshed/AnalyzeViewshed.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/Geoprocessing/AnalyzeViewshed/AnalyzeViewshed.xaml.cs @@ -87,7 +87,7 @@ private async void MyMapView_GeoViewTapped(object sender, Esri.ArcGISRuntime.Mau } catch (Exception ex) { - await DisplayAlert("Error", ex.ToString(), "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", ex.ToString(), "OK"); } } @@ -146,11 +146,11 @@ private async Task CalculateViewshed(MapPoint location) // Display an error message if there is a problem. if (myViewshedJob.Status == JobStatus.Failed && myViewshedJob.Error != null) { - await DisplayAlert("Geoprocessing error", "Executing geoprocessing failed. " + myViewshedJob.Error.Message, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Geoprocessing error", "Executing geoprocessing failed. " + myViewshedJob.Error.Message, "OK"); } else { - await DisplayAlert("Sample error", "An error occurred. " + ex.ToString(), "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Sample error", "An error occurred. " + ex.ToString(), "OK"); } } finally diff --git a/src/MAUI/Maui.Samples/Samples/Geoprocessing/ListGeodatabaseVersions/ListGeodatabaseVersions.xaml.cs b/src/MAUI/Maui.Samples/Samples/Geoprocessing/ListGeodatabaseVersions/ListGeodatabaseVersions.xaml.cs index b05a40647b..8d599b01b8 100644 --- a/src/MAUI/Maui.Samples/Samples/Geoprocessing/ListGeodatabaseVersions/ListGeodatabaseVersions.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/Geoprocessing/ListGeodatabaseVersions/ListGeodatabaseVersions.xaml.cs @@ -74,7 +74,7 @@ private async Task Initialize() } catch (Exception e) { - await DisplayAlert("Error", e.ToString(), "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", e.ToString(), "OK"); } // Set the UI to indicate that the geoprocessing is not running @@ -110,11 +110,11 @@ private async Task GetGeodatabaseVersionsAsync() // Error handling if something goes wrong if (listVersionsJob.Status == JobStatus.Failed && listVersionsJob.Error != null) { - await DisplayAlert("Geoprocessing error", "Executing geoprocessing failed. " + listVersionsJob.Error.Message, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Geoprocessing error", "Executing geoprocessing failed. " + listVersionsJob.Error.Message, "OK"); } else { - await DisplayAlert("Sample error", "An error occurred. " + ex.ToString(), "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Sample error", "An error occurred. " + ex.ToString(), "OK"); } } finally diff --git a/src/MAUI/Maui.Samples/Samples/GraphicsOverlay/Animate3DGraphic/Animate3DGraphic.xaml.cs b/src/MAUI/Maui.Samples/Samples/GraphicsOverlay/Animate3DGraphic/Animate3DGraphic.xaml.cs index 2c3358c729..f0471a5609 100644 --- a/src/MAUI/Maui.Samples/Samples/GraphicsOverlay/Animate3DGraphic/Animate3DGraphic.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/GraphicsOverlay/Animate3DGraphic/Animate3DGraphic.xaml.cs @@ -175,7 +175,7 @@ private async Task Initialize() } catch (Exception e) { - await DisplayAlert("Error", e.ToString(), "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", e.ToString(), "OK"); } } diff --git a/src/MAUI/Maui.Samples/Samples/GraphicsOverlay/DictionaryRendererGraphicsOverlay/DictionaryRendererGraphicsOverlay.xaml.cs b/src/MAUI/Maui.Samples/Samples/GraphicsOverlay/DictionaryRendererGraphicsOverlay/DictionaryRendererGraphicsOverlay.xaml.cs index 5282e604d1..609d548695 100644 --- a/src/MAUI/Maui.Samples/Samples/GraphicsOverlay/DictionaryRendererGraphicsOverlay/DictionaryRendererGraphicsOverlay.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/GraphicsOverlay/DictionaryRendererGraphicsOverlay/DictionaryRendererGraphicsOverlay.xaml.cs @@ -74,7 +74,7 @@ private async Task Initialize() } catch (Exception ex) { - await DisplayAlert(ex.GetType().Name, ex.Message, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert(ex.GetType().Name, ex.Message, "OK"); } } diff --git a/src/MAUI/Maui.Samples/Samples/GraphicsOverlay/IdentifyGraphics/IdentifyGraphics.xaml.cs b/src/MAUI/Maui.Samples/Samples/GraphicsOverlay/IdentifyGraphics/IdentifyGraphics.xaml.cs index e341e9307f..38ed708d08 100644 --- a/src/MAUI/Maui.Samples/Samples/GraphicsOverlay/IdentifyGraphics/IdentifyGraphics.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/GraphicsOverlay/IdentifyGraphics/IdentifyGraphics.xaml.cs @@ -102,13 +102,13 @@ private async void OnMapViewTapped(object sender, Esri.ArcGISRuntime.Maui.GeoVie // Make sure that the UI changes are done in the UI thread Microsoft.Maui.ApplicationModel.MainThread.BeginInvokeOnMainThread(async () => { - await DisplayAlert("", "Tapped on graphic", "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("", "Tapped on graphic", "OK"); }); } } catch (Exception ex) { - await DisplayAlert("Error", ex.ToString(), "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", ex.ToString(), "OK"); } } } diff --git a/src/MAUI/Maui.Samples/Samples/Layers/AddCustomDynamicEntityDataSource/AddCustomDynamicEntityDataSource.xaml.cs b/src/MAUI/Maui.Samples/Samples/Layers/AddCustomDynamicEntityDataSource/AddCustomDynamicEntityDataSource.xaml.cs index 0a44ec5ee0..8d24132ce2 100644 --- a/src/MAUI/Maui.Samples/Samples/Layers/AddCustomDynamicEntityDataSource/AddCustomDynamicEntityDataSource.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/Layers/AddCustomDynamicEntityDataSource/AddCustomDynamicEntityDataSource.xaml.cs @@ -140,7 +140,7 @@ private async void GeoViewTapped(object sender, Esri.ArcGISRuntime.Maui.GeoViewI } catch (Exception ex) { - await DisplayAlert("Error identifying dynamic entity.", ex.ToString(), "Ok"); + await Application.Current.Windows[0].Page.DisplayAlert("Error identifying dynamic entity.", ex.ToString(), "Ok"); } } } diff --git a/src/MAUI/Maui.Samples/Samples/Layers/AddVectorTiledLayerFromCustomStyle/AddVectorTiledLayerFromCustomStyle.xaml.cs b/src/MAUI/Maui.Samples/Samples/Layers/AddVectorTiledLayerFromCustomStyle/AddVectorTiledLayerFromCustomStyle.xaml.cs index 242098a6b3..88fdfd3edd 100644 --- a/src/MAUI/Maui.Samples/Samples/Layers/AddVectorTiledLayerFromCustomStyle/AddVectorTiledLayerFromCustomStyle.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/Layers/AddVectorTiledLayerFromCustomStyle/AddVectorTiledLayerFromCustomStyle.xaml.cs @@ -91,7 +91,7 @@ private async Task Initialize() catch (Exception ex) { // Report exceptions. - await DisplayAlert("Error", ex.Message, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", ex.Message, "OK"); } } @@ -105,7 +105,7 @@ private async void StyleChooser_SelectedIndexChanged(object sender, EventArgs e) catch (Exception ex) { // Report exceptions. - await DisplayAlert("Error", ex.Message, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", ex.Message, "OK"); } } @@ -157,7 +157,7 @@ private async Task ExportStyle(PortalItem vectorTiledLayer) catch (Exception ex) { // Report exceptions. - await DisplayAlert("Error", ex.Message, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", ex.Message, "OK"); return null; } } diff --git a/src/MAUI/Maui.Samples/Samples/Layers/BrowseOAFeatureService/BrowseOAFeatureService.xaml.cs b/src/MAUI/Maui.Samples/Samples/Layers/BrowseOAFeatureService/BrowseOAFeatureService.xaml.cs index e01d0b73a2..e1f4506632 100644 --- a/src/MAUI/Maui.Samples/Samples/Layers/BrowseOAFeatureService/BrowseOAFeatureService.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/Layers/BrowseOAFeatureService/BrowseOAFeatureService.xaml.cs @@ -70,7 +70,7 @@ private async Task LoadService() catch (Exception ex) { Debug.WriteLine(ex); - await DisplayAlert(ex.Message, "Error loading service", "OK"); + await Application.Current.Windows[0].Page.DisplayAlert(ex.Message, "Error loading service", "OK"); } finally { @@ -124,7 +124,7 @@ private async void LoadLayers_Clicked(object sender, EventArgs e) catch (Exception ex) { Debug.WriteLine(ex); - await DisplayAlert(ex.Message, "Error loading service", "OK"); + await Application.Current.Windows[0].Page.DisplayAlert(ex.Message, "Error loading service", "OK"); } finally { diff --git a/src/MAUI/Maui.Samples/Samples/Layers/BrowseWfsLayers/BrowseWfsLayers.xaml.cs b/src/MAUI/Maui.Samples/Samples/Layers/BrowseWfsLayers/BrowseWfsLayers.xaml.cs index 164916cb5d..fa524f5c1b 100644 --- a/src/MAUI/Maui.Samples/Samples/Layers/BrowseWfsLayers/BrowseWfsLayers.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/Layers/BrowseWfsLayers/BrowseWfsLayers.xaml.cs @@ -72,7 +72,7 @@ private async Task LoadService() catch (Exception ex) { Debug.WriteLine(ex); - await DisplayAlert(ex.Message, "Error loading service", "OK"); + await Application.Current.Windows[0].Page.DisplayAlert(ex.Message, "Error loading service", "OK"); } finally { @@ -131,7 +131,7 @@ private async void LoadLayers_Clicked(object sender, EventArgs e) catch (Exception ex) { Debug.WriteLine(ex); - await DisplayAlert(ex.Message, "Error loading service", "OK"); + await Application.Current.Windows[0].Page.DisplayAlert(ex.Message, "Error loading service", "OK"); } finally { diff --git a/src/MAUI/Maui.Samples/Samples/Layers/ChangeBlendRenderer/ChangeBlendRenderer.xaml.cs b/src/MAUI/Maui.Samples/Samples/Layers/ChangeBlendRenderer/ChangeBlendRenderer.xaml.cs index 754056bcda..74dbd4f927 100644 --- a/src/MAUI/Maui.Samples/Samples/Layers/ChangeBlendRenderer/ChangeBlendRenderer.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/Layers/ChangeBlendRenderer/ChangeBlendRenderer.xaml.cs @@ -92,7 +92,7 @@ private async Task Initialize() } catch (Exception e) { - await DisplayAlert("Error", e.ToString(), "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", e.ToString(), "OK"); } } diff --git a/src/MAUI/Maui.Samples/Samples/Layers/ChangeStretchRenderer/ChangeStretchRenderer.xaml.cs b/src/MAUI/Maui.Samples/Samples/Layers/ChangeStretchRenderer/ChangeStretchRenderer.xaml.cs index e3b1293d59..f1c3f95413 100644 --- a/src/MAUI/Maui.Samples/Samples/Layers/ChangeStretchRenderer/ChangeStretchRenderer.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/Layers/ChangeStretchRenderer/ChangeStretchRenderer.xaml.cs @@ -66,7 +66,7 @@ private async Task Initialize() } catch (Exception e) { - await DisplayAlert("Error", e.ToString(), "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", e.ToString(), "OK"); } } diff --git a/src/MAUI/Maui.Samples/Samples/Layers/ChangeSublayerVisibility/ChangeSublayerVisibility.xaml.cs b/src/MAUI/Maui.Samples/Samples/Layers/ChangeSublayerVisibility/ChangeSublayerVisibility.xaml.cs index b91c7f63f7..aaf852f8ac 100644 --- a/src/MAUI/Maui.Samples/Samples/Layers/ChangeSublayerVisibility/ChangeSublayerVisibility.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/Layers/ChangeSublayerVisibility/ChangeSublayerVisibility.xaml.cs @@ -102,7 +102,7 @@ private async void OnSublayersClicked(object sender, EventArgs e) } catch (Exception ex) { - await DisplayAlert("Error", ex.ToString(), "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", ex.ToString(), "OK"); } } diff --git a/src/MAUI/Maui.Samples/Samples/Layers/ConfigureElectronicNavigationalCharts/ConfigureElectronicNavigationalCharts.xaml.cs b/src/MAUI/Maui.Samples/Samples/Layers/ConfigureElectronicNavigationalCharts/ConfigureElectronicNavigationalCharts.xaml.cs index 1ace83588a..273e0a5446 100644 --- a/src/MAUI/Maui.Samples/Samples/Layers/ConfigureElectronicNavigationalCharts/ConfigureElectronicNavigationalCharts.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/Layers/ConfigureElectronicNavigationalCharts/ConfigureElectronicNavigationalCharts.xaml.cs @@ -88,7 +88,7 @@ private async Task Initialize() } catch (Exception e) { - await DisplayAlert("Error", e.ToString(), "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", e.ToString(), "OK"); } } @@ -180,7 +180,7 @@ private async void MyMapView_GeoViewTapped(object sender, Esri.ArcGISRuntime.Mau } catch (Exception ex) { - await DisplayAlert("Error", ex.ToString(), "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", ex.ToString(), "OK"); } } diff --git a/src/MAUI/Maui.Samples/Samples/Layers/CreateAndSaveKmlFile/CreateAndSaveKmlFile.xaml.cs b/src/MAUI/Maui.Samples/Samples/Layers/CreateAndSaveKmlFile/CreateAndSaveKmlFile.xaml.cs index bd9c4c077d..5e81b2757a 100644 --- a/src/MAUI/Maui.Samples/Samples/Layers/CreateAndSaveKmlFile/CreateAndSaveKmlFile.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/Layers/CreateAndSaveKmlFile/CreateAndSaveKmlFile.xaml.cs @@ -131,7 +131,7 @@ private async void Edit_Click(object sender, EventArgs e) } catch (ArgumentException) { - await DisplayAlert("Error", "Unsupported Geometry", "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", "Unsupported Geometry", "OK"); } } @@ -310,7 +310,7 @@ private async void Save_Click(object sender, EventArgs e) catch (Exception ex) { Debug.Write(ex.Message); - await DisplayAlert("Error", ex.Message, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", ex.Message, "OK"); } } @@ -327,7 +327,7 @@ await Share.RequestAsync(new ShareFileRequest } catch (Exception ex) { - await DisplayAlert(ex.GetType().Name, ex.Message, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert(ex.GetType().Name, ex.Message, "OK"); } } diff --git a/src/MAUI/Maui.Samples/Samples/Layers/CreateFeatureCollectionLayer/CreateFeatureCollectionLayer.xaml.cs b/src/MAUI/Maui.Samples/Samples/Layers/CreateFeatureCollectionLayer/CreateFeatureCollectionLayer.xaml.cs index 73820b497c..2499714504 100644 --- a/src/MAUI/Maui.Samples/Samples/Layers/CreateFeatureCollectionLayer/CreateFeatureCollectionLayer.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/Layers/CreateFeatureCollectionLayer/CreateFeatureCollectionLayer.xaml.cs @@ -115,7 +115,7 @@ private async Task CreateNewFeatureCollection() } catch (Exception e) { - await DisplayAlert("Error", e.ToString(), "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", e.ToString(), "OK"); } } diff --git a/src/MAUI/Maui.Samples/Samples/Layers/DisplayDimensions/DisplayDimensions.xaml.cs b/src/MAUI/Maui.Samples/Samples/Layers/DisplayDimensions/DisplayDimensions.xaml.cs index 28a0abca00..70829268bf 100644 --- a/src/MAUI/Maui.Samples/Samples/Layers/DisplayDimensions/DisplayDimensions.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/Layers/DisplayDimensions/DisplayDimensions.xaml.cs @@ -59,7 +59,7 @@ private async Task Initialize() } catch (Exception ex) { - await DisplayAlert("Error", ex.Message, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", ex.Message, "OK"); } } diff --git a/src/MAUI/Maui.Samples/Samples/Layers/DisplayFeatureLayers/DisplayFeatureLayers.xaml.cs b/src/MAUI/Maui.Samples/Samples/Layers/DisplayFeatureLayers/DisplayFeatureLayers.xaml.cs index 0724bc70dd..dbe23e1989 100644 --- a/src/MAUI/Maui.Samples/Samples/Layers/DisplayFeatureLayers/DisplayFeatureLayers.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/Layers/DisplayFeatureLayers/DisplayFeatureLayers.xaml.cs @@ -87,7 +87,7 @@ private async Task SetFeatureLayerSource() } catch (Exception e) { - await DisplayAlert("Error", e.Message, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", e.Message, "OK"); } } diff --git a/src/MAUI/Maui.Samples/Samples/Layers/DisplayKml/DisplayKml.xaml.cs b/src/MAUI/Maui.Samples/Samples/Layers/DisplayKml/DisplayKml.xaml.cs index 2970c84e52..4db37a9b0c 100644 --- a/src/MAUI/Maui.Samples/Samples/Layers/DisplayKml/DisplayKml.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/Layers/DisplayKml/DisplayKml.xaml.cs @@ -83,7 +83,7 @@ private async void LayerPicker_SelectionChanged(object sender, EventArgs e) } catch (Exception ex) { - await DisplayAlert("Error", ex.ToString(), "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", ex.ToString(), "OK"); } } } diff --git a/src/MAUI/Maui.Samples/Samples/Layers/DisplayKmlNetworkLinks/DisplayKmlNetworkLinks.xaml.cs b/src/MAUI/Maui.Samples/Samples/Layers/DisplayKmlNetworkLinks/DisplayKmlNetworkLinks.xaml.cs index 712a9d072d..4b2740a362 100644 --- a/src/MAUI/Maui.Samples/Samples/Layers/DisplayKmlNetworkLinks/DisplayKmlNetworkLinks.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/Layers/DisplayKmlNetworkLinks/DisplayKmlNetworkLinks.xaml.cs @@ -56,7 +56,7 @@ private void Dataset_NetworkLinkControlMessage(object sender, KmlNetworkLinkCont // The dispatcher takes an Action, provided here as a lambda function. Microsoft.Maui.ApplicationModel.MainThread.BeginInvokeOnMainThread(async () => { - await DisplayAlert("KML layer message", e.Message, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("KML layer message", e.Message, "OK"); }); } } diff --git a/src/MAUI/Maui.Samples/Samples/Layers/DisplayOACollection/DisplayOACollection.xaml.cs b/src/MAUI/Maui.Samples/Samples/Layers/DisplayOACollection/DisplayOACollection.xaml.cs index c1823ef47a..7e8c6620b1 100644 --- a/src/MAUI/Maui.Samples/Samples/Layers/DisplayOACollection/DisplayOACollection.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/Layers/DisplayOACollection/DisplayOACollection.xaml.cs @@ -77,7 +77,7 @@ private async Task Initialize() } catch (Exception ex) { - await DisplayAlert("Error", ex.Message, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", ex.Message, "OK"); } } @@ -106,7 +106,7 @@ private async void MapView_NavigationCompleted(object sender, EventArgs e) } catch (Exception ex) { - await DisplayAlert("Couldn't populate table.", ex.Message, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Couldn't populate table.", ex.Message, "OK"); } finally { diff --git a/src/MAUI/Maui.Samples/Samples/Layers/DisplayRouteLayer/DisplayRouteLayer.xaml.cs b/src/MAUI/Maui.Samples/Samples/Layers/DisplayRouteLayer/DisplayRouteLayer.xaml.cs index 1d1ee96834..ed851aed74 100644 --- a/src/MAUI/Maui.Samples/Samples/Layers/DisplayRouteLayer/DisplayRouteLayer.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/Layers/DisplayRouteLayer/DisplayRouteLayer.xaml.cs @@ -68,7 +68,7 @@ private async Task Initialize() } catch (Exception e) { - await DisplayAlert("Error", e.ToString(), "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", e.ToString(), "OK"); } } } diff --git a/src/MAUI/Maui.Samples/Samples/Layers/DisplaySubtypeFeatureLayer/DisplaySubtypeFeatureLayer.xaml.cs b/src/MAUI/Maui.Samples/Samples/Layers/DisplaySubtypeFeatureLayer/DisplaySubtypeFeatureLayer.xaml.cs index 6027b67fb1..70dc762c17 100644 --- a/src/MAUI/Maui.Samples/Samples/Layers/DisplaySubtypeFeatureLayer/DisplaySubtypeFeatureLayer.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/Layers/DisplaySubtypeFeatureLayer/DisplaySubtypeFeatureLayer.xaml.cs @@ -121,7 +121,7 @@ private async Task Initialize() } catch (Exception ex) { - await DisplayAlert(ex.GetType().Name, ex.Message, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert(ex.GetType().Name, ex.Message, "OK"); } } diff --git a/src/MAUI/Maui.Samples/Samples/Layers/DisplayWfs/DisplayWfs.xaml.cs b/src/MAUI/Maui.Samples/Samples/Layers/DisplayWfs/DisplayWfs.xaml.cs index dc5107ae74..45a99a01bd 100644 --- a/src/MAUI/Maui.Samples/Samples/Layers/DisplayWfs/DisplayWfs.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/Layers/DisplayWfs/DisplayWfs.xaml.cs @@ -76,7 +76,7 @@ private async Task Initialize() } catch (Exception e) { - await DisplayAlert("Error", e.ToString(), "Couldn't load sample."); + await Application.Current.Windows[0].Page.DisplayAlert("Error", e.ToString(), "Couldn't load sample."); Debug.WriteLine(e); } } @@ -102,7 +102,7 @@ private async void MapView_NavigationCompleted(object sender, EventArgs e) } catch (Exception exception) { - await DisplayAlert("Error", exception.ToString(), "Couldn't populate table."); + await Application.Current.Windows[0].Page.DisplayAlert("Error", exception.ToString(), "Couldn't populate table."); Debug.WriteLine(exception); } finally diff --git a/src/MAUI/Maui.Samples/Samples/Layers/ExportTiles/ExportTiles.xaml.cs b/src/MAUI/Maui.Samples/Samples/Layers/ExportTiles/ExportTiles.xaml.cs index fb866034f7..9f8e9b99d3 100644 --- a/src/MAUI/Maui.Samples/Samples/Layers/ExportTiles/ExportTiles.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/Layers/ExportTiles/ExportTiles.xaml.cs @@ -102,7 +102,7 @@ private async Task Initialize() } catch (Exception ex) { - await DisplayAlert("Error", ex.Message, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", ex.Message, "OK"); } } @@ -199,7 +199,7 @@ private async Task StartExport() } catch (Exception ex) { - await DisplayAlert("Error", ex.Message, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", ex.Message, "OK"); } } @@ -266,7 +266,7 @@ private async Task HandleJobCompletion(TileCache cache) else if (_job.Status == Esri.ArcGISRuntime.Tasks.JobStatus.Failed) { // Notify the user. - await DisplayAlert("Error", "Job Failed", "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", "Job Failed", "OK"); // Update the UI. MyExportPreviewButton.Text = "Export Tiles"; @@ -335,7 +335,7 @@ private async Task ExportPreviewTask() } catch (Exception ex) { - await DisplayAlert("Error", ex.Message, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", ex.Message, "OK"); } } diff --git a/src/MAUI/Maui.Samples/Samples/Layers/ExportVectorTiles/ExportVectorTiles.xaml.cs b/src/MAUI/Maui.Samples/Samples/Layers/ExportVectorTiles/ExportVectorTiles.xaml.cs index 95ad8830e2..bff4597c4b 100644 --- a/src/MAUI/Maui.Samples/Samples/Layers/ExportVectorTiles/ExportVectorTiles.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/Layers/ExportVectorTiles/ExportVectorTiles.xaml.cs @@ -155,7 +155,7 @@ private async Task HandleExportCompleted(ExportVectorTilesResult vectorTilesResu else if (_job.Status == Esri.ArcGISRuntime.Tasks.JobStatus.Failed) { // Notify the user. - await DisplayAlert("Error", "Job failed", "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", "Job failed", "OK"); // Update the UI. MyExportPreviewButton.Text = "Export Tiles"; @@ -272,7 +272,7 @@ private async Task ExportPreviewButtonTask() } catch (Exception ex) { - await DisplayAlert("Error", ex.Message, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", ex.Message, "OK"); } } diff --git a/src/MAUI/Maui.Samples/Samples/Layers/FeatureCollectionLayerFromPortal/FeatureCollectionLayerFromPortal.xaml.cs b/src/MAUI/Maui.Samples/Samples/Layers/FeatureCollectionLayerFromPortal/FeatureCollectionLayerFromPortal.xaml.cs index 123eaeb692..14f46287bf 100644 --- a/src/MAUI/Maui.Samples/Samples/Layers/FeatureCollectionLayerFromPortal/FeatureCollectionLayerFromPortal.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/Layers/FeatureCollectionLayerFromPortal/FeatureCollectionLayerFromPortal.xaml.cs @@ -66,12 +66,12 @@ private async Task OpenFeaturesFromArcGISOnline(string itemId) } else { - await DisplayAlert("Feature Collection", "Portal item with ID '" + itemId + "' is not a feature collection.", "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Feature Collection", "Portal item with ID '" + itemId + "' is not a feature collection.", "OK"); } } catch (Exception ex) { - await DisplayAlert("Error", "Unable to open item with ID '" + itemId + "': " + ex.Message, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", "Unable to open item with ID '" + itemId + "': " + ex.Message, "OK"); } } diff --git a/src/MAUI/Maui.Samples/Samples/Layers/FeatureCollectionLayerFromQuery/FeatureCollectionLayerFromQuery.xaml.cs b/src/MAUI/Maui.Samples/Samples/Layers/FeatureCollectionLayerFromQuery/FeatureCollectionLayerFromQuery.xaml.cs index ddbc522aec..9b307a7412 100644 --- a/src/MAUI/Maui.Samples/Samples/Layers/FeatureCollectionLayerFromQuery/FeatureCollectionLayerFromQuery.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/Layers/FeatureCollectionLayerFromQuery/FeatureCollectionLayerFromQuery.xaml.cs @@ -70,7 +70,7 @@ private async Task GetFeaturesFromQuery() } catch (Exception e) { - await DisplayAlert("Error", e.ToString(), "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", e.ToString(), "OK"); } } } diff --git a/src/MAUI/Maui.Samples/Samples/Layers/FeatureLayerDefinitionExpression/FeatureLayerDefinitionExpression.xaml.cs b/src/MAUI/Maui.Samples/Samples/Layers/FeatureLayerDefinitionExpression/FeatureLayerDefinitionExpression.xaml.cs index db3b811484..2c136d5cf6 100644 --- a/src/MAUI/Maui.Samples/Samples/Layers/FeatureLayerDefinitionExpression/FeatureLayerDefinitionExpression.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/Layers/FeatureLayerDefinitionExpression/FeatureLayerDefinitionExpression.xaml.cs @@ -100,7 +100,7 @@ private async Task CountFeatures() } catch (Exception ex) { - await DisplayAlert("Error", ex.Message, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", ex.Message, "OK"); } } } diff --git a/src/MAUI/Maui.Samples/Samples/Layers/FeatureLayerDictionaryRenderer/FeatureLayerDictionaryRenderer.xaml.cs b/src/MAUI/Maui.Samples/Samples/Layers/FeatureLayerDictionaryRenderer/FeatureLayerDictionaryRenderer.xaml.cs index d27a9662de..98c07f77ec 100644 --- a/src/MAUI/Maui.Samples/Samples/Layers/FeatureLayerDictionaryRenderer/FeatureLayerDictionaryRenderer.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/Layers/FeatureLayerDictionaryRenderer/FeatureLayerDictionaryRenderer.xaml.cs @@ -84,7 +84,7 @@ private async Task Initialize() } catch (Exception e) { - await DisplayAlert("Error", e.ToString(), "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", e.ToString(), "OK"); } } diff --git a/src/MAUI/Maui.Samples/Samples/Layers/FeatureLayerRenderingModeMap/FeatureLayerRenderingModeMap.xaml.cs b/src/MAUI/Maui.Samples/Samples/Layers/FeatureLayerRenderingModeMap/FeatureLayerRenderingModeMap.xaml.cs index 9239d77a34..af9984351e 100644 --- a/src/MAUI/Maui.Samples/Samples/Layers/FeatureLayerRenderingModeMap/FeatureLayerRenderingModeMap.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/Layers/FeatureLayerRenderingModeMap/FeatureLayerRenderingModeMap.xaml.cs @@ -92,7 +92,7 @@ private async void OnZoomClick(object sender, EventArgs e) } catch (Exception ex) { - await DisplayAlert("Error", ex.ToString(), "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", ex.ToString(), "OK"); } } } diff --git a/src/MAUI/Maui.Samples/Samples/Layers/FeatureLayerSelection/FeatureLayerSelection.xaml.cs b/src/MAUI/Maui.Samples/Samples/Layers/FeatureLayerSelection/FeatureLayerSelection.xaml.cs index 4db107319b..336a66d061 100644 --- a/src/MAUI/Maui.Samples/Samples/Layers/FeatureLayerSelection/FeatureLayerSelection.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/Layers/FeatureLayerSelection/FeatureLayerSelection.xaml.cs @@ -80,7 +80,7 @@ private async Task Initialize() } catch (Exception e) { - await DisplayAlert("Error", e.ToString(), "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", e.ToString(), "OK"); } } @@ -121,7 +121,7 @@ private async void OnMapViewTapped(object sender, GeoViewInputEventArgs e) } catch (Exception ex) { - await DisplayAlert("Error", ex.ToString(), "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", ex.ToString(), "OK"); } } } diff --git a/src/MAUI/Maui.Samples/Samples/Layers/GroupLayers/GroupLayers.xaml.cs b/src/MAUI/Maui.Samples/Samples/Layers/GroupLayers/GroupLayers.xaml.cs index 433e42d3ed..8c7d27a4f0 100644 --- a/src/MAUI/Maui.Samples/Samples/Layers/GroupLayers/GroupLayers.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/Layers/GroupLayers/GroupLayers.xaml.cs @@ -74,7 +74,7 @@ private async Task AddLayersToUI(Layer layer, int nestLevel = 0) } catch (Exception ex) { - await DisplayAlert("Error", ex.Message, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", ex.Message, "OK"); } // Add rows for any children of this layer if it is a group layer. diff --git a/src/MAUI/Maui.Samples/Samples/Layers/IdentifyKmlFeatures/IdentifyKmlFeatures.xaml.cs b/src/MAUI/Maui.Samples/Samples/Layers/IdentifyKmlFeatures/IdentifyKmlFeatures.xaml.cs index e677310296..f288108f6b 100644 --- a/src/MAUI/Maui.Samples/Samples/Layers/IdentifyKmlFeatures/IdentifyKmlFeatures.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/Layers/IdentifyKmlFeatures/IdentifyKmlFeatures.xaml.cs @@ -84,7 +84,7 @@ private async void MyMapView_GeoViewTapped(object sender, Esri.ArcGISRuntime.Mau } catch (Exception ex) { - await DisplayAlert("Error", ex.ToString(), "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", ex.ToString(), "OK"); } } } diff --git a/src/MAUI/Maui.Samples/Samples/Layers/IdentifyRasterCell/IdentifyRasterCell.xaml.cs b/src/MAUI/Maui.Samples/Samples/Layers/IdentifyRasterCell/IdentifyRasterCell.xaml.cs index 0e53825b08..2c6d3cd41f 100644 --- a/src/MAUI/Maui.Samples/Samples/Layers/IdentifyRasterCell/IdentifyRasterCell.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/Layers/IdentifyRasterCell/IdentifyRasterCell.xaml.cs @@ -65,7 +65,7 @@ private async Task Initialize() } catch (Exception ex) { - await DisplayAlert(ex.GetType().Name, ex.Message, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert(ex.GetType().Name, ex.Message, "OK"); } // Listen for mouse movement to start the identify operation. @@ -118,7 +118,7 @@ private async void MapTapped(object sender, Esri.ArcGISRuntime.Maui.GeoViewInput } catch (Exception ex) { - await DisplayAlert(ex.GetType().Name, ex.Message, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert(ex.GetType().Name, ex.Message, "OK"); } } diff --git a/src/MAUI/Maui.Samples/Samples/Layers/ListKmlContents/ListKmlContents.xaml.cs b/src/MAUI/Maui.Samples/Samples/Layers/ListKmlContents/ListKmlContents.xaml.cs index 82e0016aaa..b541121fd3 100644 --- a/src/MAUI/Maui.Samples/Samples/Layers/ListKmlContents/ListKmlContents.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/Layers/ListKmlContents/ListKmlContents.xaml.cs @@ -67,7 +67,7 @@ private async Task Initialize() } catch (Exception e) { - await DisplayAlert("Error", e.ToString(), "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", e.ToString(), "OK"); } } @@ -101,7 +101,7 @@ private async Task NavigateToNode(KmlNode node) } catch (Exception e) { - await DisplayAlert("Error", e.ToString(), "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", e.ToString(), "OK"); } } diff --git a/src/MAUI/Maui.Samples/Samples/Layers/MapImageLayerTables/MapImageLayerTables.xaml.cs b/src/MAUI/Maui.Samples/Samples/Layers/MapImageLayerTables/MapImageLayerTables.xaml.cs index 78bae51c5f..2c4a78242a 100644 --- a/src/MAUI/Maui.Samples/Samples/Layers/MapImageLayerTables/MapImageLayerTables.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/Layers/MapImageLayerTables/MapImageLayerTables.xaml.cs @@ -84,7 +84,7 @@ private async Task Initialize() } catch (Exception e) { - await DisplayAlert("Error", e.ToString(), "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", e.ToString(), "OK"); } } @@ -125,7 +125,7 @@ private async void CommentsListBox_SelectionChanged(object sender, SelectedItemC ArcGISFeature serviceRequestFeature = result.FirstOrDefault() as ArcGISFeature; if (serviceRequestFeature == null) { - await DisplayAlert("No Feature", "Related feature not found.", "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("No Feature", "Related feature not found.", "OK"); return; } @@ -147,7 +147,7 @@ private async void CommentsListBox_SelectionChanged(object sender, SelectedItemC } catch (Exception ex) { - await DisplayAlert("Error", ex.ToString(), "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", ex.ToString(), "OK"); } } } diff --git a/src/MAUI/Maui.Samples/Samples/Layers/MapImageSublayerQuery/MapImageSublayerQuery.xaml.cs b/src/MAUI/Maui.Samples/Samples/Layers/MapImageSublayerQuery/MapImageSublayerQuery.xaml.cs index 067fe90a3d..71ea469a4f 100644 --- a/src/MAUI/Maui.Samples/Samples/Layers/MapImageSublayerQuery/MapImageSublayerQuery.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/Layers/MapImageSublayerQuery/MapImageSublayerQuery.xaml.cs @@ -136,7 +136,7 @@ private async void QuerySublayers_Click(object sender, EventArgs e) } catch (Exception ex) { - await DisplayAlert("Error", ex.ToString(), "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", ex.ToString(), "OK"); } } } diff --git a/src/MAUI/Maui.Samples/Samples/Layers/PlayKmlTours/PlayKmlTours.xaml.cs b/src/MAUI/Maui.Samples/Samples/Layers/PlayKmlTours/PlayKmlTours.xaml.cs index 81ba3ad6a2..1a4340b1c1 100644 --- a/src/MAUI/Maui.Samples/Samples/Layers/PlayKmlTours/PlayKmlTours.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/Layers/PlayKmlTours/PlayKmlTours.xaml.cs @@ -86,7 +86,7 @@ private async Task Initialize() catch (Exception e) { Debug.WriteLine(e.ToString()); - await DisplayAlert("Error", e.ToString(), "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", e.ToString(), "OK"); } } diff --git a/src/MAUI/Maui.Samples/Samples/Layers/QueryCQLFilters/QueryCQLFilters.xaml.cs b/src/MAUI/Maui.Samples/Samples/Layers/QueryCQLFilters/QueryCQLFilters.xaml.cs index 253535e1c1..f0c03e706e 100644 --- a/src/MAUI/Maui.Samples/Samples/Layers/QueryCQLFilters/QueryCQLFilters.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/Layers/QueryCQLFilters/QueryCQLFilters.xaml.cs @@ -100,7 +100,7 @@ private async Task Initialize() } catch (Exception ex) { - await DisplayAlert("Error", ex.Message, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", ex.Message, "OK"); } finally { @@ -164,7 +164,7 @@ private async void ApplyQuery_Pressed(object sender, EventArgs e) } catch (Exception ex) { - await DisplayAlert("Error", ex.Message, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", ex.Message, "OK"); } finally { diff --git a/src/MAUI/Maui.Samples/Samples/Layers/RasterColormapRenderer/RasterColormapRenderer.xaml.cs b/src/MAUI/Maui.Samples/Samples/Layers/RasterColormapRenderer/RasterColormapRenderer.xaml.cs index d99bc815d7..51dcda0dab 100644 --- a/src/MAUI/Maui.Samples/Samples/Layers/RasterColormapRenderer/RasterColormapRenderer.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/Layers/RasterColormapRenderer/RasterColormapRenderer.xaml.cs @@ -72,7 +72,7 @@ private async Task Initialize() catch (Exception e) { Debug.WriteLine(e.Message); - await DisplayAlert("Error", e.Message, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", e.Message, "OK"); } } } diff --git a/src/MAUI/Maui.Samples/Samples/Layers/RasterHillshade/RasterHillshade.xaml.cs b/src/MAUI/Maui.Samples/Samples/Layers/RasterHillshade/RasterHillshade.xaml.cs index 33c34788e5..7cbe4b51e9 100644 --- a/src/MAUI/Maui.Samples/Samples/Layers/RasterHillshade/RasterHillshade.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/Layers/RasterHillshade/RasterHillshade.xaml.cs @@ -92,7 +92,7 @@ private async Task Initialize() } catch (Exception e) { - await DisplayAlert("Error", e.ToString(), "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", e.ToString(), "OK"); } } diff --git a/src/MAUI/Maui.Samples/Samples/Layers/RasterLayerFile/RasterLayerFile.xaml.cs b/src/MAUI/Maui.Samples/Samples/Layers/RasterLayerFile/RasterLayerFile.xaml.cs index d1ebdfbf14..d6a9896e7d 100644 --- a/src/MAUI/Maui.Samples/Samples/Layers/RasterLayerFile/RasterLayerFile.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/Layers/RasterLayerFile/RasterLayerFile.xaml.cs @@ -60,7 +60,7 @@ private async Task Initialize() } catch (Exception e) { - await DisplayAlert("Error", e.ToString(), "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", e.ToString(), "OK"); } } diff --git a/src/MAUI/Maui.Samples/Samples/Layers/RasterLayerRasterFunction/RasterLayerRasterFunction.xaml.cs b/src/MAUI/Maui.Samples/Samples/Layers/RasterLayerRasterFunction/RasterLayerRasterFunction.xaml.cs index 11dcfd1030..e375c85123 100644 --- a/src/MAUI/Maui.Samples/Samples/Layers/RasterLayerRasterFunction/RasterLayerRasterFunction.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/Layers/RasterLayerRasterFunction/RasterLayerRasterFunction.xaml.cs @@ -114,7 +114,7 @@ private async Task Initialize() } catch (Exception e) { - await DisplayAlert("Error", e.ToString(), "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", e.ToString(), "OK"); } } } diff --git a/src/MAUI/Maui.Samples/Samples/Layers/RasterRenderingRule/RasterRenderingRule.xaml.cs b/src/MAUI/Maui.Samples/Samples/Layers/RasterRenderingRule/RasterRenderingRule.xaml.cs index 127097f6a2..bf0675623e 100644 --- a/src/MAUI/Maui.Samples/Samples/Layers/RasterRenderingRule/RasterRenderingRule.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/Layers/RasterRenderingRule/RasterRenderingRule.xaml.cs @@ -86,7 +86,7 @@ private async Task Initialize() } catch (Exception e) { - await DisplayAlert("Error", e.ToString(), "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", e.ToString(), "OK"); } } @@ -126,7 +126,7 @@ private async Task ChangeRenderingRuleAsync() } catch (Exception ex) { - await DisplayAlert("Error", ex.Message, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", ex.Message, "OK"); } } diff --git a/src/MAUI/Maui.Samples/Samples/Layers/RasterRgbRenderer/RasterRgbRenderer.xaml.cs b/src/MAUI/Maui.Samples/Samples/Layers/RasterRgbRenderer/RasterRgbRenderer.xaml.cs index b27d89e3f0..46d330204b 100644 --- a/src/MAUI/Maui.Samples/Samples/Layers/RasterRgbRenderer/RasterRgbRenderer.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/Layers/RasterRgbRenderer/RasterRgbRenderer.xaml.cs @@ -101,7 +101,7 @@ private async Task Initialize() } catch (Exception e) { - await DisplayAlert("Error", e.ToString(), "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", e.ToString(), "OK"); } } diff --git a/src/MAUI/Maui.Samples/Samples/Layers/SceneLayerSelection/SceneLayerSelection.xaml.cs b/src/MAUI/Maui.Samples/Samples/Layers/SceneLayerSelection/SceneLayerSelection.xaml.cs index e8d8f6747e..c66dfa27de 100644 --- a/src/MAUI/Maui.Samples/Samples/Layers/SceneLayerSelection/SceneLayerSelection.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/Layers/SceneLayerSelection/SceneLayerSelection.xaml.cs @@ -55,7 +55,7 @@ private async Task Initialize() } catch (Exception e) { - await DisplayAlert("Error", e.ToString(), "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", e.ToString(), "OK"); } } @@ -90,7 +90,7 @@ private async void SceneViewTapped(object sender, Esri.ArcGISRuntime.Maui.GeoVie } catch (Exception ex) { - await DisplayAlert("Error", ex.ToString(), "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", ex.ToString(), "OK"); } } } diff --git a/src/MAUI/Maui.Samples/Samples/Layers/SceneLayerUrl/SceneLayerUrl.xaml.cs b/src/MAUI/Maui.Samples/Samples/Layers/SceneLayerUrl/SceneLayerUrl.xaml.cs index 1e376a57a0..379765bba3 100644 --- a/src/MAUI/Maui.Samples/Samples/Layers/SceneLayerUrl/SceneLayerUrl.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/Layers/SceneLayerUrl/SceneLayerUrl.xaml.cs @@ -68,7 +68,7 @@ private async Task Initialize() } catch (Exception e) { - await DisplayAlert("Error", e.ToString(), "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", e.ToString(), "OK"); } } } diff --git a/src/MAUI/Maui.Samples/Samples/Layers/ShowLabelsOnLayer/ShowLabelsOnLayer.xaml.cs b/src/MAUI/Maui.Samples/Samples/Layers/ShowLabelsOnLayer/ShowLabelsOnLayer.xaml.cs index 15c1ddd156..90289e9fad 100644 --- a/src/MAUI/Maui.Samples/Samples/Layers/ShowLabelsOnLayer/ShowLabelsOnLayer.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/Layers/ShowLabelsOnLayer/ShowLabelsOnLayer.xaml.cs @@ -73,7 +73,7 @@ private async Task Initialize() } catch (Exception ex) { - await DisplayAlert("Error", ex.Message, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", ex.Message, "OK"); } } diff --git a/src/MAUI/Maui.Samples/Samples/Layers/StyleWmsLayer/StyleWmsLayer.xaml.cs b/src/MAUI/Maui.Samples/Samples/Layers/StyleWmsLayer/StyleWmsLayer.xaml.cs index d008d9b22c..6570f6cfdc 100644 --- a/src/MAUI/Maui.Samples/Samples/Layers/StyleWmsLayer/StyleWmsLayer.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/Layers/StyleWmsLayer/StyleWmsLayer.xaml.cs @@ -64,7 +64,7 @@ private async Task Initialize() } catch (Exception ex) { - await DisplayAlert("Error", ex.ToString(), "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", ex.ToString(), "OK"); } } diff --git a/src/MAUI/Maui.Samples/Samples/Layers/TimeBasedQuery/TimeBasedQuery.xaml.cs b/src/MAUI/Maui.Samples/Samples/Layers/TimeBasedQuery/TimeBasedQuery.xaml.cs index 93d9a8c419..d81bc003ae 100644 --- a/src/MAUI/Maui.Samples/Samples/Layers/TimeBasedQuery/TimeBasedQuery.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/Layers/TimeBasedQuery/TimeBasedQuery.xaml.cs @@ -86,7 +86,7 @@ private async void OnLoadedPopulateData(object sender, LoadStatusEventArgs e) } catch (Exception ex) { - await DisplayAlert("Error", ex.ToString(), "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", ex.ToString(), "OK"); } } } diff --git a/src/MAUI/Maui.Samples/Samples/Layers/WMTSLayer/WMTSLayer.xaml.cs b/src/MAUI/Maui.Samples/Samples/Layers/WMTSLayer/WMTSLayer.xaml.cs index 05dd1c776d..dcda91fb1e 100644 --- a/src/MAUI/Maui.Samples/Samples/Layers/WMTSLayer/WMTSLayer.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/Layers/WMTSLayer/WMTSLayer.xaml.cs @@ -96,7 +96,7 @@ private async Task LoadWMTSLayer(bool uriMode) } catch (Exception ex) { - await DisplayAlert("Sample error", ex.ToString(), "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Sample error", ex.ToString(), "OK"); } } } diff --git a/src/MAUI/Maui.Samples/Samples/Layers/WfsXmlQuery/WfsXmlQuery.xaml.cs b/src/MAUI/Maui.Samples/Samples/Layers/WfsXmlQuery/WfsXmlQuery.xaml.cs index b98cf43265..a422e21c6a 100644 --- a/src/MAUI/Maui.Samples/Samples/Layers/WfsXmlQuery/WfsXmlQuery.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/Layers/WfsXmlQuery/WfsXmlQuery.xaml.cs @@ -83,7 +83,7 @@ private async Task Initialize() catch (Exception e) { Debug.WriteLine(e.ToString()); - await DisplayAlert("Error", e.ToString(), "Couldn't populate table with XML query."); + await Application.Current.Windows[0].Page.DisplayAlert("Error", e.ToString(), "Couldn't populate table with XML query."); } } } diff --git a/src/MAUI/Maui.Samples/Samples/Layers/WmsIdentify/WmsIdentify.xaml.cs b/src/MAUI/Maui.Samples/Samples/Layers/WmsIdentify/WmsIdentify.xaml.cs index 036b09cc08..d44635abb5 100644 --- a/src/MAUI/Maui.Samples/Samples/Layers/WmsIdentify/WmsIdentify.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/Layers/WmsIdentify/WmsIdentify.xaml.cs @@ -69,7 +69,7 @@ private async Task Initialize() } catch (Exception e) { - await DisplayAlert("Error", e.ToString(), "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", e.ToString(), "OK"); } } @@ -105,7 +105,7 @@ private async void MyMapView_GeoViewTapped(object sender, Esri.ArcGISRuntime.Mau } catch (Exception ex) { - await DisplayAlert("Error", ex.ToString(), "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", ex.ToString(), "OK"); } } } diff --git a/src/MAUI/Maui.Samples/Samples/Layers/WmsServiceCatalog/WmsServiceCatalog.xaml.cs b/src/MAUI/Maui.Samples/Samples/Layers/WmsServiceCatalog/WmsServiceCatalog.xaml.cs index 680efca69d..75425656e7 100644 --- a/src/MAUI/Maui.Samples/Samples/Layers/WmsServiceCatalog/WmsServiceCatalog.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/Layers/WmsServiceCatalog/WmsServiceCatalog.xaml.cs @@ -66,7 +66,7 @@ private async Task Initialize() } catch (Exception e) { - await DisplayAlert("Error", e.ToString(), "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", e.ToString(), "OK"); } } @@ -107,7 +107,7 @@ private async Task UpdateMapDisplay(ObservableCollection display } catch (Exception e) { - await DisplayAlert("Error", e.ToString(), "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", e.ToString(), "OK"); } } diff --git a/src/MAUI/Maui.Samples/Samples/Location/DisplayDeviceLocation/DisplayDeviceLocation.xaml.cs b/src/MAUI/Maui.Samples/Samples/Location/DisplayDeviceLocation/DisplayDeviceLocation.xaml.cs index c1c0baeb15..7f887c0eb9 100644 --- a/src/MAUI/Maui.Samples/Samples/Location/DisplayDeviceLocation/DisplayDeviceLocation.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/Location/DisplayDeviceLocation/DisplayDeviceLocation.xaml.cs @@ -111,7 +111,7 @@ private async void StartStopButton_Clicked(object sender, EventArgs e) // Note for MacCatalyst: while on ethernet, without an external GPS device connected, // location will be unknown. Debug.WriteLine(ex); - await DisplayAlert("Error", ex.Message, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", ex.Message, "OK"); } finally { diff --git a/src/MAUI/Maui.Samples/Samples/Location/IndoorPositioning/IndoorPositioning.xaml.cs b/src/MAUI/Maui.Samples/Samples/Location/IndoorPositioning/IndoorPositioning.xaml.cs index ddc133eb64..cc699c058c 100644 --- a/src/MAUI/Maui.Samples/Samples/Location/IndoorPositioning/IndoorPositioning.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/Location/IndoorPositioning/IndoorPositioning.xaml.cs @@ -92,7 +92,7 @@ private async Task Initialize() } catch (Exception ex) { - await DisplayAlert(ex.GetType().Name, ex.Message, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert(ex.GetType().Name, ex.Message, "OK"); } } diff --git a/src/MAUI/Maui.Samples/Samples/Location/LocationDrivenGeotriggers/LocationDrivenGeotriggers.xaml.cs b/src/MAUI/Maui.Samples/Samples/Location/LocationDrivenGeotriggers/LocationDrivenGeotriggers.xaml.cs index cfadf49e50..f0246003fa 100644 --- a/src/MAUI/Maui.Samples/Samples/Location/LocationDrivenGeotriggers/LocationDrivenGeotriggers.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/Location/LocationDrivenGeotriggers/LocationDrivenGeotriggers.xaml.cs @@ -87,7 +87,7 @@ private async Task Initialize() } catch (Exception ex) { - await DisplayAlert(ex.GetType().Name, ex.Message, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert(ex.GetType().Name, ex.Message, "OK"); } } diff --git a/src/MAUI/Maui.Samples/Samples/Location/LocationWithNMEA/LocationWithNMEA.xaml.cs b/src/MAUI/Maui.Samples/Samples/Location/LocationWithNMEA/LocationWithNMEA.xaml.cs index f9f4f660e4..bd19a00fae 100644 --- a/src/MAUI/Maui.Samples/Samples/Location/LocationWithNMEA/LocationWithNMEA.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/Location/LocationWithNMEA/LocationWithNMEA.xaml.cs @@ -74,7 +74,7 @@ private async Task Initialize() } catch (Exception ex) { - await DisplayAlert(ex.Message.GetType().Name, ex.Message, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert(ex.Message.GetType().Name, ex.Message, "OK"); } } diff --git a/src/MAUI/Maui.Samples/Samples/Location/ShowLocationHistory/ShowLocationHistory.xaml.cs b/src/MAUI/Maui.Samples/Samples/Location/ShowLocationHistory/ShowLocationHistory.xaml.cs index 99ebff6777..b3c2ea8e7f 100644 --- a/src/MAUI/Maui.Samples/Samples/Location/ShowLocationHistory/ShowLocationHistory.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/Location/ShowLocationHistory/ShowLocationHistory.xaml.cs @@ -175,7 +175,7 @@ private void LocationDataSourceOnLocationChanged(object sender, Location e) private async Task ShowMessage(string title, string detail) { - await DisplayAlert(title, detail, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert(title, detail, "OK"); } public void Dispose() diff --git a/src/MAUI/Maui.Samples/Samples/Map/ApplyScheduledUpdates/ApplyScheduledUpdates.xaml.cs b/src/MAUI/Maui.Samples/Samples/Map/ApplyScheduledUpdates/ApplyScheduledUpdates.xaml.cs index 23d78996bf..e8ebf37962 100644 --- a/src/MAUI/Maui.Samples/Samples/Map/ApplyScheduledUpdates/ApplyScheduledUpdates.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/Map/ApplyScheduledUpdates/ApplyScheduledUpdates.xaml.cs @@ -82,7 +82,7 @@ private async Task Initialize() } catch (Exception ex) { - await DisplayAlert("Error", ex.Message, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", ex.Message, "OK"); } } @@ -112,7 +112,7 @@ private async Task CheckForScheduledUpdates() } catch (Exception ex) { - await DisplayAlert("Error", ex.Message, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", ex.Message, "OK"); } } @@ -161,7 +161,7 @@ private async Task ApplyUpdates() } else { - await DisplayAlert("Error", "Failed to load the mobile map package.", "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", "Failed to load the mobile map package.", "OK"); } } @@ -170,12 +170,12 @@ private async Task ApplyUpdates() } else { - await DisplayAlert("Error", "Error syncing the offline map.", "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", "Error syncing the offline map.", "OK"); } } catch (Exception ex) { - await DisplayAlert("Error", ex.Message, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", ex.Message, "OK"); } } } diff --git a/src/MAUI/Maui.Samples/Samples/Map/AuthorMap/AuthorMap.xaml.cs b/src/MAUI/Maui.Samples/Samples/Map/AuthorMap/AuthorMap.xaml.cs index 584688028d..3bd95c2851 100644 --- a/src/MAUI/Maui.Samples/Samples/Map/AuthorMap/AuthorMap.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/Map/AuthorMap/AuthorMap.xaml.cs @@ -121,7 +121,7 @@ private async void SaveMapAsync(object sender, SaveMapEventArgs e) await myMap.SaveAsAsync(agsOnline, null, title, description, tags, thumbnailImage); // Report a successful save. - await DisplayAlert("Map Saved", "Saved '" + title + "' to ArcGIS Online!", "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Map Saved", "Saved '" + title + "' to ArcGIS Online!", "OK"); } else { @@ -136,13 +136,13 @@ private async void SaveMapAsync(object sender, SaveMapEventArgs e) await myMap.SaveAsync(); // Report update was successful. - await DisplayAlert("Updates Saved", "Saved changes to '" + myMap.Item.Title + "'", "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Updates Saved", "Saved changes to '" + myMap.Item.Title + "'", "OK"); } } catch (Exception ex) { // Show the exception message. - await DisplayAlert("Unable to save map", ex.Message, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Unable to save map", ex.Message, "OK"); } finally { diff --git a/src/MAUI/Maui.Samples/Samples/Map/BrowseBuildingFloors/BrowseBuildingFloors.xaml.cs b/src/MAUI/Maui.Samples/Samples/Map/BrowseBuildingFloors/BrowseBuildingFloors.xaml.cs index 7fda40b1ea..87b29b59c1 100644 --- a/src/MAUI/Maui.Samples/Samples/Map/BrowseBuildingFloors/BrowseBuildingFloors.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/Map/BrowseBuildingFloors/BrowseBuildingFloors.xaml.cs @@ -47,7 +47,7 @@ private async Task Initialize() // Checks to see if the layer is floor aware. if (MyMapView.Map.FloorDefinition == null) { - await DisplayAlert("Alert", "The layer is not floor aware.", "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Alert", "The layer is not floor aware.", "OK"); return; } @@ -65,7 +65,7 @@ private async Task Initialize() } catch (Exception ex) { - await DisplayAlert("Alert", ex.Message, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Alert", ex.Message, "OK"); } } diff --git a/src/MAUI/Maui.Samples/Samples/Map/DownloadPreplannedMap/DownloadPreplannedMap.xaml.cs b/src/MAUI/Maui.Samples/Samples/Map/DownloadPreplannedMap/DownloadPreplannedMap.xaml.cs index ab3cc8d2c5..19aad230ca 100644 --- a/src/MAUI/Maui.Samples/Samples/Map/DownloadPreplannedMap/DownloadPreplannedMap.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/Map/DownloadPreplannedMap/DownloadPreplannedMap.xaml.cs @@ -94,7 +94,7 @@ private async Task Initialize() { // Something unexpected happened, show the error message. Debug.WriteLine(ex); - await DisplayAlert("There was an error.", ex.Message, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("There was an error.", ex.Message, "OK"); } } @@ -140,7 +140,7 @@ private async Task DownloadMapAreaAsync(PreplannedMapArea mapArea) catch (Exception e) { Debug.WriteLine(e); - await DisplayAlert("Couldn't open offline area. Proceeding to take area offline.", e.Message, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Couldn't open offline area. Proceeding to take area offline.", e.Message, "OK"); } } @@ -181,7 +181,7 @@ private async Task DownloadMapAreaAsync(PreplannedMapArea mapArea) } // Show the message. - await DisplayAlert("Warning!", errors, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Warning!", errors, "OK"); } // Show the downloaded map. @@ -196,7 +196,7 @@ private async Task DownloadMapAreaAsync(PreplannedMapArea mapArea) { // Report any errors. Debug.WriteLine(ex); - await DisplayAlert("Downloading map area failed.", ex.Message, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Downloading map area failed.", ex.Message, "OK"); } finally { @@ -253,7 +253,7 @@ private async void OnDeleteAllMapAreasClicked(object sender, EventArgs e) catch (Exception ex) { // Report the error. - await DisplayAlert("Deleting map areas failed.", ex.Message, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Deleting map areas failed.", ex.Message, "OK"); } finally { diff --git a/src/MAUI/Maui.Samples/Samples/Map/GenerateOfflineMap/GenerateOfflineMap.xaml.cs b/src/MAUI/Maui.Samples/Samples/Map/GenerateOfflineMap/GenerateOfflineMap.xaml.cs index 68952f5f14..072ff328ee 100644 --- a/src/MAUI/Maui.Samples/Samples/Map/GenerateOfflineMap/GenerateOfflineMap.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/Map/GenerateOfflineMap/GenerateOfflineMap.xaml.cs @@ -81,7 +81,7 @@ private async Task Initialize() } catch (Exception ex) { - await DisplayAlert("Alert", ex.ToString(), "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Alert", ex.ToString(), "OK"); } } @@ -140,7 +140,7 @@ private async void TakeMapOfflineButton_Click(object sender, EventArgs e) // Check for job failure (writing the output was denied, e.g.). if (_generateOfflineMapJob.Status != JobStatus.Succeeded) { - await DisplayAlert("Alert", "Generate offline map package failed.", "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Alert", "Generate offline map package failed.", "OK"); busyIndicator.IsVisible = false; } @@ -156,7 +156,7 @@ private async void TakeMapOfflineButton_Click(object sender, EventArgs e) // Show layer errors. string errorText = errorBuilder.ToString(); - await DisplayAlert("Alert", errorText, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Alert", errorText, "OK"); } // Display the offline map. @@ -177,12 +177,12 @@ private async void TakeMapOfflineButton_Click(object sender, EventArgs e) catch (TaskCanceledException) { // Generate offline map task was canceled. - await DisplayAlert("Alert", "Taking map offline was canceled", "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Alert", "Taking map offline was canceled", "OK"); } catch (Exception ex) { // Exception while taking the map offline. - await DisplayAlert("Alert", ex.Message, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Alert", ex.Message, "OK"); } finally { diff --git a/src/MAUI/Maui.Samples/Samples/Map/GenerateOfflineMapWithOverrides/GenerateOfflineMapWithOverrides.xaml.cs b/src/MAUI/Maui.Samples/Samples/Map/GenerateOfflineMapWithOverrides/GenerateOfflineMapWithOverrides.xaml.cs index d738a5bbeb..c656efc20f 100644 --- a/src/MAUI/Maui.Samples/Samples/Map/GenerateOfflineMapWithOverrides/GenerateOfflineMapWithOverrides.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/Map/GenerateOfflineMapWithOverrides/GenerateOfflineMapWithOverrides.xaml.cs @@ -88,7 +88,7 @@ private async Task Initialize() } catch (Exception ex) { - await DisplayAlert("Alert", ex.ToString(), "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Alert", ex.ToString(), "OK"); } } @@ -158,7 +158,7 @@ private async void TakeMapOfflineButton_Click(object sender, EventArgs e) // Check for job failure (writing the output was denied, e.g.). if (_generateOfflineMapJob.Status != JobStatus.Succeeded) { - await DisplayAlert("Alert", "Generate offline map package failed.", "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Alert", "Generate offline map package failed.", "OK"); BusyIndicator.IsVisible = false; } @@ -174,7 +174,7 @@ private async void TakeMapOfflineButton_Click(object sender, EventArgs e) // Show layer errors. string errorText = errorBuilder.ToString(); - await DisplayAlert("Alert", errorText, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Alert", errorText, "OK"); } // Display the offline map. @@ -187,19 +187,19 @@ private async void TakeMapOfflineButton_Click(object sender, EventArgs e) MyMapView.InteractionOptions.IsEnabled = true; // Show a message that the map is offline. - await DisplayAlert("Alert", "Map is offline.", "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Alert", "Map is offline.", "OK"); TakeMapOfflineButton.IsEnabled = false; } catch (TaskCanceledException) { // Generate offline map task was canceled. - await DisplayAlert("Alert", "Taking map offline was canceled.", "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Alert", "Taking map offline was canceled.", "OK"); } catch (Exception ex) { // Exception while taking the map offline. - await DisplayAlert("Alert", ex.ToString(), "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Alert", ex.ToString(), "OK"); } finally { @@ -213,7 +213,7 @@ private async void TakeMapOfflineButton_Click(object sender, EventArgs e) } catch (Exception ex) { - await DisplayAlert("Alert", ex.ToString(), "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Alert", ex.ToString(), "OK"); } } diff --git a/src/MAUI/Maui.Samples/Samples/Map/HonorMobileMapPackageExpiration/HonorMobileMapPackageExpiration.xaml.cs b/src/MAUI/Maui.Samples/Samples/Map/HonorMobileMapPackageExpiration/HonorMobileMapPackageExpiration.xaml.cs index 94d0a2d90b..b915886b72 100644 --- a/src/MAUI/Maui.Samples/Samples/Map/HonorMobileMapPackageExpiration/HonorMobileMapPackageExpiration.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/Map/HonorMobileMapPackageExpiration/HonorMobileMapPackageExpiration.xaml.cs @@ -63,7 +63,7 @@ private async Task Initialize() } else if (expiration.Type == ExpirationType.PreventExpiredAccess) { - await DisplayAlert("Error", "The author of this mobile map package has disallowed access after the expiration date.", "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", "The author of this mobile map package has disallowed access after the expiration date.", "OK"); } } else if (mobileMapPackage.Maps.Any()) @@ -73,7 +73,7 @@ private async Task Initialize() } else { - await DisplayAlert("Error", "Failed to load the mobile map package.", "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", "Failed to load the mobile map package.", "OK"); } } catch (Exception e) diff --git a/src/MAUI/Maui.Samples/Samples/Map/MobileMapSearchAndRoute/MobileMapSearchAndRoute.xaml.cs b/src/MAUI/Maui.Samples/Samples/Map/MobileMapSearchAndRoute/MobileMapSearchAndRoute.xaml.cs index 09caa05239..6c8c4c3d5f 100644 --- a/src/MAUI/Maui.Samples/Samples/Map/MobileMapSearchAndRoute/MobileMapSearchAndRoute.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/Map/MobileMapSearchAndRoute/MobileMapSearchAndRoute.xaml.cs @@ -113,7 +113,7 @@ private async void MapView_Tapped(object sender, Esri.ArcGISRuntime.Maui.GeoView catch (Exception exception) { Console.WriteLine(exception); - await DisplayAlert("Error", "Couldn't geocode or route.", "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", "Couldn't geocode or route.", "OK"); } } @@ -211,7 +211,7 @@ private async void Map_Selected(object sender, EventArgs e) catch (Exception exception) { Debug.WriteLine(exception); - await DisplayAlert("Error", e.ToString(), "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", e.ToString(), "OK"); } } } diff --git a/src/MAUI/Maui.Samples/Samples/Map/OfflineBasemapByReference/OfflineBasemapByReference.xaml.cs b/src/MAUI/Maui.Samples/Samples/Map/OfflineBasemapByReference/OfflineBasemapByReference.xaml.cs index a0a4db441a..0ef8caf3d4 100644 --- a/src/MAUI/Maui.Samples/Samples/Map/OfflineBasemapByReference/OfflineBasemapByReference.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/Map/OfflineBasemapByReference/OfflineBasemapByReference.xaml.cs @@ -70,7 +70,7 @@ private async Task ConfigureOfflineJobForBasemap(GenerateOfflineMapParameters pa } // Wait for the user to choose whether to use the offline basemap. - bool useBasemap = await DisplayAlert("Basemap choice", "Use the offline basemap?", "Yes", "No"); + bool useBasemap = await Application.Current.Windows[0].Page.DisplayAlert("Basemap choice", "Use the offline basemap?", "Yes", "No"); if (useBasemap) { @@ -122,7 +122,7 @@ private async Task Initialize() } catch (Exception ex) { - await DisplayAlert("Alert", ex.ToString(), "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Alert", ex.ToString(), "OK"); } } @@ -184,7 +184,7 @@ private async void TakeMapOfflineButton_Click(object sender, EventArgs e) // Check for job failure (writing the output was denied, e.g.). if (_generateOfflineMapJob.Status != JobStatus.Succeeded) { - await DisplayAlert("Alert", "Generate offline map package failed.", "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Alert", "Generate offline map package failed.", "OK"); BusyIndicator.IsVisible = false; } @@ -200,7 +200,7 @@ private async void TakeMapOfflineButton_Click(object sender, EventArgs e) // Show layer errors. string errorText = errorBuilder.ToString(); - await DisplayAlert("Alert", errorText, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Alert", errorText, "OK"); } // Display the offline map. @@ -216,17 +216,17 @@ private async void TakeMapOfflineButton_Click(object sender, EventArgs e) TakeMapOfflineButton.IsEnabled = false; // Show a message that the map is offline. - await DisplayAlert("Alert", "Map is offline.", "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Alert", "Map is offline.", "OK"); } catch (TaskCanceledException) { // Generate offline map task was canceled. - await DisplayAlert("Alert", "Taking map offline was canceled", "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Alert", "Taking map offline was canceled", "OK"); } catch (Exception ex) { // Exception while taking the map offline. - await DisplayAlert("Alert", ex.Message, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Alert", ex.Message, "OK"); } finally { diff --git a/src/MAUI/Maui.Samples/Samples/Map/OpenMapURL/OpenMapURL.xaml.cs b/src/MAUI/Maui.Samples/Samples/Map/OpenMapURL/OpenMapURL.xaml.cs index df85d050b3..91330ee743 100644 --- a/src/MAUI/Maui.Samples/Samples/Map/OpenMapURL/OpenMapURL.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/Map/OpenMapURL/OpenMapURL.xaml.cs @@ -61,7 +61,7 @@ private async void OnMapsClicked(object sender, EventArgs e) } catch (Exception ex) { - await DisplayAlert("Error", ex.Message, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", ex.Message, "OK"); } } } diff --git a/src/MAUI/Maui.Samples/Samples/Map/OpenMobileMap/OpenMobileMap.xaml.cs b/src/MAUI/Maui.Samples/Samples/Map/OpenMobileMap/OpenMobileMap.xaml.cs index 68baf35360..283c624ff8 100644 --- a/src/MAUI/Maui.Samples/Samples/Map/OpenMobileMap/OpenMobileMap.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/Map/OpenMobileMap/OpenMobileMap.xaml.cs @@ -45,7 +45,7 @@ private async Task Initialize() } catch (Exception e) { - await DisplayAlert("Error", e.ToString(), "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", e.ToString(), "OK"); } } } diff --git a/src/MAUI/Maui.Samples/Samples/Map/SearchPortalMaps/SearchPortalMaps.xaml.cs b/src/MAUI/Maui.Samples/Samples/Map/SearchPortalMaps/SearchPortalMaps.xaml.cs index 05f97fbe83..b81a8eea36 100644 --- a/src/MAUI/Maui.Samples/Samples/Map/SearchPortalMaps/SearchPortalMaps.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/Map/SearchPortalMaps/SearchPortalMaps.xaml.cs @@ -75,7 +75,7 @@ private async Task SearchPublicMaps(string searchText) } catch (Exception ex) { - await DisplayAlert("Error", ex.Message, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", ex.Message, "OK"); } } @@ -116,7 +116,7 @@ private async void GetMyMaps(object sender, EventArgs e) } catch (Exception ex) { - await DisplayAlert("Error", ex.Message, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", ex.Message, "OK"); } } diff --git a/src/MAUI/Maui.Samples/Samples/MapView/ChangeViewpoint/ChangeViewpoint.xaml.cs b/src/MAUI/Maui.Samples/Samples/MapView/ChangeViewpoint/ChangeViewpoint.xaml.cs index 2dbdedf132..286d8e678d 100644 --- a/src/MAUI/Maui.Samples/Samples/MapView/ChangeViewpoint/ChangeViewpoint.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/MapView/ChangeViewpoint/ChangeViewpoint.xaml.cs @@ -117,7 +117,7 @@ await MyMapView.SetViewpointAsync( } catch (Exception ex) { - await DisplayAlert("Error", ex.ToString(), "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", ex.ToString(), "OK"); } } } diff --git a/src/MAUI/Maui.Samples/Samples/MapView/FeatureLayerTimeOffset/FeatureLayerTimeOffset.xaml.cs b/src/MAUI/Maui.Samples/Samples/MapView/FeatureLayerTimeOffset/FeatureLayerTimeOffset.xaml.cs index 62ade97bab..9f1d1e077b 100644 --- a/src/MAUI/Maui.Samples/Samples/MapView/FeatureLayerTimeOffset/FeatureLayerTimeOffset.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/MapView/FeatureLayerTimeOffset/FeatureLayerTimeOffset.xaml.cs @@ -80,7 +80,7 @@ private async Task Initialize() } catch (Exception e) { - await DisplayAlert("Error", e.ToString(), "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", e.ToString(), "OK"); } } diff --git a/src/MAUI/Maui.Samples/Samples/MapView/IdentifyLayers/IdentifyLayers.xaml.cs b/src/MAUI/Maui.Samples/Samples/MapView/IdentifyLayers/IdentifyLayers.xaml.cs index de7bb827be..63c277ae12 100644 --- a/src/MAUI/Maui.Samples/Samples/MapView/IdentifyLayers/IdentifyLayers.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/MapView/IdentifyLayers/IdentifyLayers.xaml.cs @@ -53,7 +53,7 @@ private async Task Initialize() } catch (Exception e) { - await DisplayAlert("Error", e.ToString(), "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", e.ToString(), "OK"); } } @@ -74,12 +74,12 @@ private async void MyMapView_GeoViewTapped(object sender, GeoViewInputEventArgs if (!String.IsNullOrEmpty(result)) { - await DisplayAlert("Identify result", result, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Identify result", result, "OK"); } } catch (Exception ex) { - await DisplayAlert("Error", ex.ToString(), "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", ex.ToString(), "OK"); } } diff --git a/src/MAUI/Maui.Samples/Samples/MapView/TakeScreenshot/TakeScreenshot.xaml.cs b/src/MAUI/Maui.Samples/Samples/MapView/TakeScreenshot/TakeScreenshot.xaml.cs index e88437046a..e5b13dcc3e 100644 --- a/src/MAUI/Maui.Samples/Samples/MapView/TakeScreenshot/TakeScreenshot.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/MapView/TakeScreenshot/TakeScreenshot.xaml.cs @@ -57,7 +57,7 @@ private async void OnTakeScreenshotClicked(object sender, EventArgs e) } catch (Exception ex) { - await DisplayAlert("Error", ex.ToString(), "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", ex.ToString(), "OK"); } } diff --git a/src/MAUI/Maui.Samples/Samples/NetworkAnalysis/ClosestFacility/ClosestFacility.xaml.cs b/src/MAUI/Maui.Samples/Samples/NetworkAnalysis/ClosestFacility/ClosestFacility.xaml.cs index 3ab0f29f0e..a9699039d9 100644 --- a/src/MAUI/Maui.Samples/Samples/NetworkAnalysis/ClosestFacility/ClosestFacility.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/NetworkAnalysis/ClosestFacility/ClosestFacility.xaml.cs @@ -115,7 +115,7 @@ private async Task Initialize() } catch (Exception e) { - await DisplayAlert("Error", e.ToString(), "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", e.ToString(), "OK"); } } @@ -169,11 +169,11 @@ private async Task PopulateParametersAndSolveRouteAsync() { if (exception.Message.Equals("Unable to complete operation.")) { - await DisplayAlert("Error", "Incident not within San Diego area!", "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", "Incident not within San Diego area!", "OK"); } else { - await DisplayAlert("Error", "An ArcGIS web exception occurred. \n" + exception.Message, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", "An ArcGIS web exception occurred. \n" + exception.Message, "OK"); } } } diff --git a/src/MAUI/Maui.Samples/Samples/NetworkAnalysis/ClosestFacilityStatic/ClosestFacilityStatic.xaml.cs b/src/MAUI/Maui.Samples/Samples/NetworkAnalysis/ClosestFacilityStatic/ClosestFacilityStatic.xaml.cs index 08e2bf07c4..c4d14c827b 100644 --- a/src/MAUI/Maui.Samples/Samples/NetworkAnalysis/ClosestFacilityStatic/ClosestFacilityStatic.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/NetworkAnalysis/ClosestFacilityStatic/ClosestFacilityStatic.xaml.cs @@ -130,7 +130,7 @@ private async Task Initialize() } catch (Exception exception) { - await DisplayAlert("Error", "An exception has occurred.\n" + exception.Message, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", "An exception has occurred.\n" + exception.Message, "OK"); } } @@ -189,7 +189,7 @@ private async void SolveRoutesClick(object sender, EventArgs e) } catch (Esri.ArcGISRuntime.Http.ArcGISWebException exception) { - await DisplayAlert("Error", "An ArcGIS web exception occurred.\n" + exception.Message, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", "An ArcGIS web exception occurred.\n" + exception.Message, "OK"); } } diff --git a/src/MAUI/Maui.Samples/Samples/NetworkAnalysis/FindRoute/FindRoute.xaml.cs b/src/MAUI/Maui.Samples/Samples/NetworkAnalysis/FindRoute/FindRoute.xaml.cs index b0911a4666..5967a0e4b3 100644 --- a/src/MAUI/Maui.Samples/Samples/NetworkAnalysis/FindRoute/FindRoute.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/NetworkAnalysis/FindRoute/FindRoute.xaml.cs @@ -135,7 +135,7 @@ private async void SolveRouteClick(object sender, EventArgs e) } catch (Exception ex) { - await DisplayAlert("Error", ex.ToString(), "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", ex.ToString(), "OK"); } } diff --git a/src/MAUI/Maui.Samples/Samples/NetworkAnalysis/FindServiceArea/FindServiceArea.xaml.cs b/src/MAUI/Maui.Samples/Samples/NetworkAnalysis/FindServiceArea/FindServiceArea.xaml.cs index 5c1e0703f4..766990026d 100644 --- a/src/MAUI/Maui.Samples/Samples/NetworkAnalysis/FindServiceArea/FindServiceArea.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/NetworkAnalysis/FindServiceArea/FindServiceArea.xaml.cs @@ -74,7 +74,7 @@ private async void PlaceFacilityButton_Click(object sender, EventArgs e) catch (Exception ex) { // Report exceptions. - await DisplayAlert("Error", "Error drawing facility:\n" + ex.Message, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", "Error drawing facility:\n" + ex.Message, "OK"); } } @@ -136,7 +136,7 @@ private async void DrawBarrierButton_Click(object sender, EventArgs e) catch (Exception ex) { // Report exceptions. - await DisplayAlert("Error", "Error drawing barrier:\n" + ex.Message, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", "Error drawing barrier:\n" + ex.Message, "OK"); } } @@ -182,7 +182,7 @@ private async void ShowServiceAreasButton_Click(object sender, EventArgs e) // Check that there is at least 1 facility to find a service area for. if (!serviceAreaFacilities.Any()) { - await DisplayAlert("Error", "Must have at least one Facility!", "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", "Must have at least one Facility!", "OK"); return; } @@ -257,11 +257,11 @@ private async void ShowServiceAreasButton_Click(object sender, EventArgs e) { if (exception.Message.ToString().Equals("Unable to complete operation.")) { - await DisplayAlert("Error", "Facility not within San Diego area!", "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", "Facility not within San Diego area!", "OK"); } else { - await DisplayAlert("Error", "An ArcGIS web exception occurred. \n" + exception.Message, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", "An ArcGIS web exception occurred. \n" + exception.Message, "OK"); } } } diff --git a/src/MAUI/Maui.Samples/Samples/NetworkAnalysis/NavigateRoute/NavigateRoute.xaml.cs b/src/MAUI/Maui.Samples/Samples/NetworkAnalysis/NavigateRoute/NavigateRoute.xaml.cs index 3470bc55c6..7e20309a5b 100644 --- a/src/MAUI/Maui.Samples/Samples/NetworkAnalysis/NavigateRoute/NavigateRoute.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/NetworkAnalysis/NavigateRoute/NavigateRoute.xaml.cs @@ -120,7 +120,7 @@ private async Task Initialize() } catch (Exception e) { - await DisplayAlert("Error", e.Message, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", e.Message, "OK"); } } diff --git a/src/MAUI/Maui.Samples/Samples/NetworkAnalysis/NavigateRouteRerouting/NavigateRouteRerouting.xaml.cs b/src/MAUI/Maui.Samples/Samples/NetworkAnalysis/NavigateRouteRerouting/NavigateRouteRerouting.xaml.cs index e769e20195..785733737f 100644 --- a/src/MAUI/Maui.Samples/Samples/NetworkAnalysis/NavigateRouteRerouting/NavigateRouteRerouting.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/NetworkAnalysis/NavigateRouteRerouting/NavigateRouteRerouting.xaml.cs @@ -122,7 +122,7 @@ private async Task Initialize() } catch (Exception e) { - await DisplayAlert("Error", e.Message, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", e.Message, "OK"); } } @@ -155,7 +155,7 @@ private async void StartNavigation(object sender, EventArgs e) } catch (Exception ex) { - await DisplayAlert("Error", ex.Message, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", ex.Message, "OK"); } } diff --git a/src/MAUI/Maui.Samples/Samples/Scene/GetElevationAtPoint/GetElevationAtPoint.xaml.cs b/src/MAUI/Maui.Samples/Samples/Scene/GetElevationAtPoint/GetElevationAtPoint.xaml.cs index 06bdfefc37..9189fa9b45 100644 --- a/src/MAUI/Maui.Samples/Samples/Scene/GetElevationAtPoint/GetElevationAtPoint.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/Scene/GetElevationAtPoint/GetElevationAtPoint.xaml.cs @@ -118,7 +118,7 @@ private async void SceneViewTapped(object sender, Esri.ArcGISRuntime.Maui.GeoVie catch (Exception ex) { Debug.WriteLine(ex.Message); - await DisplayAlert("Error", ex.Message, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", ex.Message, "OK"); } finally { diff --git a/src/MAUI/Maui.Samples/Samples/Scene/OpenMobileScenePackage/OpenMobileScenePackage.xaml.cs b/src/MAUI/Maui.Samples/Samples/Scene/OpenMobileScenePackage/OpenMobileScenePackage.xaml.cs index e5989adf45..3b4621b9d9 100644 --- a/src/MAUI/Maui.Samples/Samples/Scene/OpenMobileScenePackage/OpenMobileScenePackage.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/Scene/OpenMobileScenePackage/OpenMobileScenePackage.xaml.cs @@ -46,7 +46,7 @@ private async Task Initialize() } catch (Exception e) { - await DisplayAlert("Couldn't open scene", e.Message, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Couldn't open scene", e.Message, "OK"); Debug.WriteLine(e); } } diff --git a/src/MAUI/Maui.Samples/Samples/Scene/OpenScenePortalItem/OpenScenePortalItem.xaml.cs b/src/MAUI/Maui.Samples/Samples/Scene/OpenScenePortalItem/OpenScenePortalItem.xaml.cs index e61ae8e17b..571352c5a4 100644 --- a/src/MAUI/Maui.Samples/Samples/Scene/OpenScenePortalItem/OpenScenePortalItem.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/Scene/OpenScenePortalItem/OpenScenePortalItem.xaml.cs @@ -46,7 +46,7 @@ private async Task Initialize() } catch (Exception e) { - await DisplayAlert("Error", e.ToString(), "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", e.ToString(), "OK"); } } } diff --git a/src/MAUI/Maui.Samples/Samples/Scene/ShowLabelsOnLayer3D/ShowLabelsOnLayer3D.xaml.cs b/src/MAUI/Maui.Samples/Samples/Scene/ShowLabelsOnLayer3D/ShowLabelsOnLayer3D.xaml.cs index 3c82a363c4..f4d35dc20f 100644 --- a/src/MAUI/Maui.Samples/Samples/Scene/ShowLabelsOnLayer3D/ShowLabelsOnLayer3D.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/Scene/ShowLabelsOnLayer3D/ShowLabelsOnLayer3D.xaml.cs @@ -65,7 +65,7 @@ private async Task Initialize() } catch (Exception e) { - await DisplayAlert("Error", e.Message, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", e.Message, "OK"); } } } diff --git a/src/MAUI/Maui.Samples/Samples/SceneView/AnimateImageOverlay/AnimateImageOverlay.xaml.cs b/src/MAUI/Maui.Samples/Samples/SceneView/AnimateImageOverlay/AnimateImageOverlay.xaml.cs index 76dfc43287..52c9bd6e1f 100644 --- a/src/MAUI/Maui.Samples/Samples/SceneView/AnimateImageOverlay/AnimateImageOverlay.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/SceneView/AnimateImageOverlay/AnimateImageOverlay.xaml.cs @@ -49,7 +49,7 @@ private async Task Initialize() // This sample is only supported in x64 on .NET MAUI. if (!Environment.Is64BitProcess) { - await DisplayAlert("Error", "This sample is only supported for .NET MAUI in x64. Run the sample viewer in x64 to use this sample.", "Exit"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", "This sample is only supported for .NET MAUI in x64. Run the sample viewer in x64 to use this sample.", "Exit"); return; } diff --git a/src/MAUI/Maui.Samples/Samples/SceneView/ChooseCameraController/ChooseCameraController.xaml.cs b/src/MAUI/Maui.Samples/Samples/SceneView/ChooseCameraController/ChooseCameraController.xaml.cs index c09c581758..552a9d670b 100644 --- a/src/MAUI/Maui.Samples/Samples/SceneView/ChooseCameraController/ChooseCameraController.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/SceneView/ChooseCameraController/ChooseCameraController.xaml.cs @@ -79,7 +79,7 @@ private async Task Initialize() catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.Message); - await DisplayAlert("Error", "Loading plane model failed. Sample failed to initialize.", "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", "Loading plane model failed. Sample failed to initialize.", "OK"); return; } @@ -145,7 +145,7 @@ private async void OnButtonClicked(object sender, EventArgs e) } catch (Exception ex) { - await DisplayAlert("Error", ex.ToString(), "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", ex.ToString(), "OK"); } } } diff --git a/src/MAUI/Maui.Samples/Samples/Search/FindAddress/FindAddress.xaml.cs b/src/MAUI/Maui.Samples/Samples/Search/FindAddress/FindAddress.xaml.cs index 92a3f8d0c4..98b823bca0 100644 --- a/src/MAUI/Maui.Samples/Samples/Search/FindAddress/FindAddress.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/Search/FindAddress/FindAddress.xaml.cs @@ -70,7 +70,7 @@ private async Task Initialize() } catch (Exception e) { - await DisplayAlert("Error", e.ToString(), "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", e.ToString(), "OK"); } } @@ -119,7 +119,7 @@ private async void updateSearch() } catch (Exception e) { - await DisplayAlert("Error", e.ToString(), "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", e.ToString(), "OK"); } } @@ -165,7 +165,7 @@ private async void SuggestionButtonTapped(object sender, System.EventArgs e) } catch (Exception ex) { - await DisplayAlert("Error", ex.Message, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", ex.Message, "OK"); } } @@ -200,7 +200,7 @@ private async void MyMapView_GeoViewTapped(object sender, Esri.ArcGISRuntime.Mau } catch (Exception ex) { - await DisplayAlert("Error", ex.ToString(), "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", ex.ToString(), "OK"); } } } diff --git a/src/MAUI/Maui.Samples/Samples/Search/FindPlace/FindPlace.xaml.cs b/src/MAUI/Maui.Samples/Samples/Search/FindPlace/FindPlace.xaml.cs index 338d7bada7..01e2431f47 100644 --- a/src/MAUI/Maui.Samples/Samples/Search/FindPlace/FindPlace.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/Search/FindPlace/FindPlace.xaml.cs @@ -77,7 +77,7 @@ private async Task Initialize() catch (Exception ex) { Debug.WriteLine(ex); - await DisplayAlert("Couldn't start location", ex.Message, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Couldn't start location", ex.Message, "OK"); } @@ -209,7 +209,7 @@ private async Task UpdateSearch(string enteredText, string locationText, bool re } catch (Exception ex) { - await DisplayAlert("Error", ex.Message, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", ex.Message, "OK"); } } @@ -264,7 +264,7 @@ private async void MyMapView_GeoViewTapped(object sender, Esri.ArcGISRuntime.Mau } catch (Exception ex) { - await DisplayAlert("Error", ex.Message, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", ex.Message, "OK"); } } diff --git a/src/MAUI/Maui.Samples/Samples/Search/OfflineGeocode/OfflineGeocode.xaml.cs b/src/MAUI/Maui.Samples/Samples/Search/OfflineGeocode/OfflineGeocode.xaml.cs index 8dd2e476d9..d99c93eafe 100644 --- a/src/MAUI/Maui.Samples/Samples/Search/OfflineGeocode/OfflineGeocode.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/Search/OfflineGeocode/OfflineGeocode.xaml.cs @@ -78,7 +78,7 @@ private async Task Initialize() } catch (Exception e) { - await DisplayAlert("Error", e.ToString(), "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", e.ToString(), "OK"); } } @@ -110,7 +110,7 @@ private async Task UpdateSearchAsync() // Stop if there are no suggestions. if (!geocodeResults.Any()) { - await DisplayAlert("No results", "No results found.", "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("No results", "No results found.", "OK"); return; } @@ -133,7 +133,7 @@ private async Task UpdateSearchAsync() } catch (Exception e) { - await DisplayAlert("Error", e.ToString(), "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", e.ToString(), "OK"); } } @@ -170,7 +170,7 @@ private async void SuggestionButtonTapped(object sender, System.EventArgs e) } catch (Exception ex) { - await DisplayAlert("Error", ex.Message, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", ex.Message, "OK"); } } @@ -195,7 +195,7 @@ private async void MyMapView_GeoViewTapped(object sender, Esri.ArcGISRuntime.Mau // Skip if there are no results. if (!addresses.Any()) { - await DisplayAlert("No results", "No results found.", "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("No results", "No results found.", "OK"); return; } @@ -214,7 +214,7 @@ private async void MyMapView_GeoViewTapped(object sender, Esri.ArcGISRuntime.Mau } catch (Exception ex) { - await DisplayAlert("Error", ex.ToString(), "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", ex.ToString(), "OK"); } } } diff --git a/src/MAUI/Maui.Samples/Samples/Search/ReverseGeocode/ReverseGeocode.xaml.cs b/src/MAUI/Maui.Samples/Samples/Search/ReverseGeocode/ReverseGeocode.xaml.cs index 75b3c857aa..34979f6065 100644 --- a/src/MAUI/Maui.Samples/Samples/Search/ReverseGeocode/ReverseGeocode.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/Search/ReverseGeocode/ReverseGeocode.xaml.cs @@ -58,7 +58,7 @@ private async Task Initialize() } catch (Exception e) { - await DisplayAlert("Error", e.ToString(), "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", e.ToString(), "OK"); } // Set the initial viewpoint. @@ -103,7 +103,7 @@ private async void MyMapView_GeoViewTapped(object sender, Esri.ArcGISRuntime.Mau catch (Exception ex) { Debug.WriteLine(ex); - await DisplayAlert("No results", "No results found", "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("No results", "No results found", "OK"); } } diff --git a/src/MAUI/Maui.Samples/Samples/Security/OAuth/OAuth.xaml.cs b/src/MAUI/Maui.Samples/Samples/Security/OAuth/OAuth.xaml.cs index e43ecd4a00..c2d955a367 100644 --- a/src/MAUI/Maui.Samples/Samples/Security/OAuth/OAuth.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/Security/OAuth/OAuth.xaml.cs @@ -57,7 +57,7 @@ private async Task Initialize() } catch (Exception e) { - await DisplayAlert("Error", e.ToString(), "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", e.ToString(), "OK"); } } } diff --git a/src/MAUI/Maui.Samples/Samples/Symbology/CustomDictionaryStyle/CustomDictionaryStyle.xaml.cs b/src/MAUI/Maui.Samples/Samples/Symbology/CustomDictionaryStyle/CustomDictionaryStyle.xaml.cs index ed3d09c3ab..c6ec96d009 100644 --- a/src/MAUI/Maui.Samples/Samples/Symbology/CustomDictionaryStyle/CustomDictionaryStyle.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/Symbology/CustomDictionaryStyle/CustomDictionaryStyle.xaml.cs @@ -73,7 +73,7 @@ private async Task Initialize() } catch (Exception ex) { - await DisplayAlert("Error", ex.Message, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", ex.Message, "OK"); } } diff --git a/src/MAUI/Maui.Samples/Samples/Symbology/FeatureLayerExtrusion/FeatureLayerExtrusion.xaml.cs b/src/MAUI/Maui.Samples/Samples/Symbology/FeatureLayerExtrusion/FeatureLayerExtrusion.xaml.cs index de943c1a3b..0ce0570257 100644 --- a/src/MAUI/Maui.Samples/Samples/Symbology/FeatureLayerExtrusion/FeatureLayerExtrusion.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/Symbology/FeatureLayerExtrusion/FeatureLayerExtrusion.xaml.cs @@ -92,7 +92,7 @@ private async Task Initialize() catch (Exception ex) { // Something went wrong, display the error. - await DisplayAlert("Error", ex.ToString(), "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", ex.ToString(), "OK"); } } diff --git a/src/MAUI/Maui.Samples/Samples/Symbology/SymbolStylesFromWebStyles/SymbolStylesFromWebStyles.xaml.cs b/src/MAUI/Maui.Samples/Samples/Symbology/SymbolStylesFromWebStyles/SymbolStylesFromWebStyles.xaml.cs index 15f229f092..ef74e4fc70 100644 --- a/src/MAUI/Maui.Samples/Samples/Symbology/SymbolStylesFromWebStyles/SymbolStylesFromWebStyles.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/Symbology/SymbolStylesFromWebStyles/SymbolStylesFromWebStyles.xaml.cs @@ -81,7 +81,7 @@ private async Task Initialize() } catch (Exception ex) { - await DisplayAlert("Error", ex.Message, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", ex.Message, "OK"); } } diff --git a/src/MAUI/Maui.Samples/Samples/Symbology/SymbolsFromMobileStyle/SymbolsFromMobileStyle.xaml.cs b/src/MAUI/Maui.Samples/Samples/Symbology/SymbolsFromMobileStyle/SymbolsFromMobileStyle.xaml.cs index 8a374d157b..86c88ec097 100644 --- a/src/MAUI/Maui.Samples/Samples/Symbology/SymbolsFromMobileStyle/SymbolsFromMobileStyle.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/Symbology/SymbolsFromMobileStyle/SymbolsFromMobileStyle.xaml.cs @@ -139,7 +139,7 @@ private async Task ReadMobileStyle(string stylePath) catch (Exception ex) { // Report the exception. - await DisplayAlert("Error reading style", ex.Message, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error reading style", ex.Message, "OK"); } } @@ -157,7 +157,7 @@ private async void GeoViewTapped(object sender, GeoViewInputEventArgs e) } catch (Exception ex) { - await DisplayAlert("Error", ex.Message, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", ex.Message, "OK"); } } @@ -174,7 +174,7 @@ private async void SymbolLayerSelected(object sender, SelectedItemChangedEventAr } catch (Exception ex) { - await DisplayAlert("Error", ex.Message, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", ex.Message, "OK"); } } @@ -229,7 +229,7 @@ private async Task GetCurrentSymbol() catch (Exception ex) { // Report the exception. - await DisplayAlert("Error creating symbol", ex.Message, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error creating symbol", ex.Message, "OK"); } // Return the multilayer point symbol. diff --git a/src/MAUI/Maui.Samples/Samples/Symbology/UseDistanceCompositeSym/UseDistanceCompositeSym.xaml.cs b/src/MAUI/Maui.Samples/Samples/Symbology/UseDistanceCompositeSym/UseDistanceCompositeSym.xaml.cs index a7cf02fb56..3bd075ee1d 100644 --- a/src/MAUI/Maui.Samples/Samples/Symbology/UseDistanceCompositeSym/UseDistanceCompositeSym.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/Symbology/UseDistanceCompositeSym/UseDistanceCompositeSym.xaml.cs @@ -67,7 +67,7 @@ private async Task Initialize() } catch (Exception e) { - await DisplayAlert("Error", e.ToString(), "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", e.ToString(), "OK"); } } diff --git a/src/MAUI/Maui.Samples/Samples/UtilityNetwork/ConfigureSubnetworkTrace/ConfigureSubnetworkTrace.xaml.cs b/src/MAUI/Maui.Samples/Samples/UtilityNetwork/ConfigureSubnetworkTrace/ConfigureSubnetworkTrace.xaml.cs index dfbd61ca24..d60f798dc4 100644 --- a/src/MAUI/Maui.Samples/Samples/UtilityNetwork/ConfigureSubnetworkTrace/ConfigureSubnetworkTrace.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/UtilityNetwork/ConfigureSubnetworkTrace/ConfigureSubnetworkTrace.xaml.cs @@ -100,7 +100,7 @@ private async Task Initialize() } catch (Exception ex) { - await DisplayAlert("Error", ex.Message, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", ex.Message, "OK"); } } @@ -199,11 +199,11 @@ private async void OnTrace(object sender, System.EventArgs e) UtilityElementTraceResult elementResult = results?.FirstOrDefault() as UtilityElementTraceResult; // Display the number of elements found by the trace. - await DisplayAlert("Trace Result", $"`{elementResult?.Elements?.Count ?? 0}` elements found.", "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Trace Result", $"`{elementResult?.Elements?.Count ?? 0}` elements found.", "OK"); } catch (Exception ex) { - await DisplayAlert("Error", $"{ex.Message}\nFor a working barrier condition, try \"Transformer Load\" Equal \"15\".", "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", $"{ex.Message}\nFor a working barrier condition, try \"Transformer Load\" Equal \"15\".", "OK"); } } @@ -257,7 +257,7 @@ private async void OnAddCondition(object sender, EventArgs e) } catch (Exception ex) { - await DisplayAlert("Error", ex.Message, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", ex.Message, "OK"); } } diff --git a/src/MAUI/Maui.Samples/Samples/UtilityNetwork/CreateLoadReport/CreateLoadReport.xaml.cs b/src/MAUI/Maui.Samples/Samples/UtilityNetwork/CreateLoadReport/CreateLoadReport.xaml.cs index a3e0509754..b863867a35 100644 --- a/src/MAUI/Maui.Samples/Samples/UtilityNetwork/CreateLoadReport/CreateLoadReport.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/UtilityNetwork/CreateLoadReport/CreateLoadReport.xaml.cs @@ -83,7 +83,7 @@ private async Task Initialize() } catch (Exception ex) { - await DisplayAlert(ex.GetType().Name, ex.Message, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert(ex.GetType().Name, ex.Message, "OK"); return null; } }); @@ -136,7 +136,7 @@ private async Task Initialize() } catch (Exception ex) { - await DisplayAlert(ex.GetType().Name, ex.Message, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert(ex.GetType().Name, ex.Message, "OK"); } } @@ -178,7 +178,7 @@ private async void RunReportButton_Clicked(object sender, EventArgs e) { if (result.Warnings.Count > 0) { - await DisplayAlert("Trace Result Warnings", string.Join("\n", result.Warnings), "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Trace Result Warnings", string.Join("\n", result.Warnings), "OK"); } if (result is UtilityElementTraceResult elementResult) { @@ -196,7 +196,7 @@ private async void RunReportButton_Clicked(object sender, EventArgs e) } catch (Exception ex) { - await DisplayAlert(ex.GetType().Name, ex.Message, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert(ex.GetType().Name, ex.Message, "OK"); } } } diff --git a/src/MAUI/Maui.Samples/Samples/UtilityNetwork/DisplayUtilityAssociations/DisplayUtilityAssociations.xaml.cs b/src/MAUI/Maui.Samples/Samples/UtilityNetwork/DisplayUtilityAssociations/DisplayUtilityAssociations.xaml.cs index 08228095f0..39901296ee 100644 --- a/src/MAUI/Maui.Samples/Samples/UtilityNetwork/DisplayUtilityAssociations/DisplayUtilityAssociations.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/UtilityNetwork/DisplayUtilityAssociations/DisplayUtilityAssociations.xaml.cs @@ -127,7 +127,7 @@ private async Task Initialize() } catch (Exception ex) { - await DisplayAlert(ex.GetType().Name, ex.Message, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert(ex.GetType().Name, ex.Message, "OK"); } } @@ -177,7 +177,7 @@ private async Task AddAssociations() } catch (Exception ex) { - await DisplayAlert(ex.GetType().Name, ex.Message, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert(ex.GetType().Name, ex.Message, "OK"); } } } diff --git a/src/MAUI/Maui.Samples/Samples/UtilityNetwork/DisplayUtilityNetworkContainer/DisplayUtilityNetworkContainer.xaml.cs b/src/MAUI/Maui.Samples/Samples/UtilityNetwork/DisplayUtilityNetworkContainer/DisplayUtilityNetworkContainer.xaml.cs index e5306d6a6a..ffe416f7f7 100644 --- a/src/MAUI/Maui.Samples/Samples/UtilityNetwork/DisplayUtilityNetworkContainer/DisplayUtilityNetworkContainer.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/UtilityNetwork/DisplayUtilityNetworkContainer/DisplayUtilityNetworkContainer.xaml.cs @@ -105,7 +105,7 @@ private async Task Initialize() } catch (Exception ex) { - await DisplayAlert("Error", ex.Message, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", ex.Message, "OK"); } finally { @@ -201,7 +201,7 @@ private async Task IdentifyContainer(Point position) } catch (Exception ex) { - await DisplayAlert("Error", ex.Message, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", ex.Message, "OK"); } } diff --git a/src/MAUI/Maui.Samples/Samples/UtilityNetwork/PerformValveIsolationTrace/PerformValveIsolationTrace.xaml.cs b/src/MAUI/Maui.Samples/Samples/UtilityNetwork/PerformValveIsolationTrace/PerformValveIsolationTrace.xaml.cs index dee740f9dd..5cab8330f8 100644 --- a/src/MAUI/Maui.Samples/Samples/UtilityNetwork/PerformValveIsolationTrace/PerformValveIsolationTrace.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/UtilityNetwork/PerformValveIsolationTrace/PerformValveIsolationTrace.xaml.cs @@ -136,7 +136,7 @@ private async Task Initialize() } catch (Exception ex) { - await DisplayAlert(ex.GetType().Name, ex.Message, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert(ex.GetType().Name, ex.Message, "OK"); } finally { @@ -187,7 +187,7 @@ private async void OnTrace(object sender, EventArgs e) } catch (Exception ex) { - await DisplayAlert(ex.GetType().Name, ex.Message, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert(ex.GetType().Name, ex.Message, "OK"); } finally { @@ -279,7 +279,7 @@ private async void OnGeoViewTapped(object sender, Esri.ArcGISRuntime.Maui.GeoVie } catch (Exception ex) { - await DisplayAlert(ex.GetType().Name, ex.Message, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert(ex.GetType().Name, ex.Message, "OK"); } finally { diff --git a/src/MAUI/Maui.Samples/Samples/UtilityNetwork/SnapGeometryEditsWithUtilityNetworkRules/SnapGeometryEditsWithUtilityNetworkRules.xaml.cs b/src/MAUI/Maui.Samples/Samples/UtilityNetwork/SnapGeometryEditsWithUtilityNetworkRules/SnapGeometryEditsWithUtilityNetworkRules.xaml.cs index 69da710062..386695d0a1 100644 --- a/src/MAUI/Maui.Samples/Samples/UtilityNetwork/SnapGeometryEditsWithUtilityNetworkRules/SnapGeometryEditsWithUtilityNetworkRules.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/UtilityNetwork/SnapGeometryEditsWithUtilityNetworkRules/SnapGeometryEditsWithUtilityNetworkRules.xaml.cs @@ -101,7 +101,7 @@ private async Task InitializeAsync() catch (Exception ex) { // Show an error message. - await DisplayAlert("Error", ex.Message, "Ok"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", ex.Message, "Ok"); } } diff --git a/src/MAUI/Maui.Samples/Samples/UtilityNetwork/TraceUtilityNetwork/TraceUtilityNetwork.xaml.cs b/src/MAUI/Maui.Samples/Samples/UtilityNetwork/TraceUtilityNetwork/TraceUtilityNetwork.xaml.cs index 7ea0ff9a33..3762f2a9ae 100644 --- a/src/MAUI/Maui.Samples/Samples/UtilityNetwork/TraceUtilityNetwork/TraceUtilityNetwork.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/UtilityNetwork/TraceUtilityNetwork/TraceUtilityNetwork.xaml.cs @@ -125,7 +125,7 @@ private async Task Initialize() catch (Exception ex) { Status.Text = "Loading Utility Network failed..."; - await DisplayAlert(ex.GetType().Name, ex.Message, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert(ex.GetType().Name, ex.Message, "OK"); } finally { @@ -209,7 +209,7 @@ private async void OnGeoViewTapped(object sender, Esri.ArcGISRuntime.Maui.GeoVie catch (Exception ex) { Status.Text = "Identifying locations failed."; - await DisplayAlert(ex.GetType().Name, ex.Message, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert(ex.GetType().Name, ex.Message, "OK"); } finally { @@ -294,11 +294,11 @@ private async void OnTrace(object sender, EventArgs e) Status.Text = "Trace failed..."; if (ex is ArcGISWebException && ex.Message == null) { - await DisplayAlert(ex.GetType().Name, "Trace failed.", "OK"); + await Application.Current.Windows[0].Page.DisplayAlert(ex.GetType().Name, "Trace failed.", "OK"); } else { - await DisplayAlert(ex.GetType().Name, ex.Message, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert(ex.GetType().Name, ex.Message, "OK"); } } finally diff --git a/src/MAUI/Maui.Samples/Samples/UtilityNetwork/ValidateUtilityNetworkTopology/ValidateUtilityNetworkTopology.xaml.cs b/src/MAUI/Maui.Samples/Samples/UtilityNetwork/ValidateUtilityNetworkTopology/ValidateUtilityNetworkTopology.xaml.cs index 7329e35d7e..771fda31ed 100644 --- a/src/MAUI/Maui.Samples/Samples/UtilityNetwork/ValidateUtilityNetworkTopology/ValidateUtilityNetworkTopology.xaml.cs +++ b/src/MAUI/Maui.Samples/Samples/UtilityNetwork/ValidateUtilityNetworkTopology/ValidateUtilityNetworkTopology.xaml.cs @@ -233,7 +233,7 @@ private async Task Initialize() catch (Exception ex) { Status.Text = "Initialization failed."; - await DisplayAlert(ex.Message, ex.GetType().Name, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert(ex.Message, ex.GetType().Name, "OK"); } finally { @@ -283,7 +283,7 @@ private async void OnGetState(object sender, EventArgs e) } catch (Exception ex) { - await DisplayAlert(ex.GetType().Name, ex.Message, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert(ex.GetType().Name, ex.Message, "OK"); } finally { @@ -324,7 +324,7 @@ private async void OnValidate(object sender, EventArgs e) catch (Exception ex) { Status.Text = "Validate network topology failed."; - await DisplayAlert(ex.GetType().Name, ex.Message, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert(ex.GetType().Name, ex.Message, "OK"); } finally { @@ -404,7 +404,7 @@ private async void OnGeoViewTapped(object sender, GeoViewInputEventArgs e) catch (Exception ex) { Status.Text = "Identifying feature to edit failed."; - await DisplayAlert(ex.GetType().Name, ex.Message, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert(ex.GetType().Name, ex.Message, "OK"); } finally { @@ -458,7 +458,7 @@ _featureToEdit is null catch (Exception ex) { Status.Text = "Apply edits failed."; - await DisplayAlert(ex.GetType().Name, ex.Message, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert(ex.GetType().Name, ex.Message, "OK"); } finally { @@ -524,7 +524,7 @@ private async void OnTrace(object sender, EventArgs e) { Status.Text = "Trace failed.\n" + "Click 'Get State' to check the updated network state."; - await DisplayAlert(ex.GetType().Name, ex.Message, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert(ex.GetType().Name, ex.Message, "OK"); } finally { diff --git a/src/MAUI/Maui.Samples/Views/SettingsPage.xaml.cs b/src/MAUI/Maui.Samples/Views/SettingsPage.xaml.cs index 98f9c70f79..080bbc84d2 100644 --- a/src/MAUI/Maui.Samples/Views/SettingsPage.xaml.cs +++ b/src/MAUI/Maui.Samples/Views/SettingsPage.xaml.cs @@ -152,12 +152,12 @@ await DataManager.EnsureSampleDataPresent(sampleInfo, _cancellationTokenSource.T } catch (OperationCanceledException) { - await DisplayAlert(string.Empty, "Download canceled", "OK"); + await Application.Current.Windows[0].Page.DisplayAlert(string.Empty, "Download canceled", "OK"); } catch (Exception exception) { Debug.WriteLine(exception); - await DisplayAlert("Error", "Couldn't download data for that sample", "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", "Couldn't download data for that sample", "OK"); } finally { @@ -207,12 +207,12 @@ private async void DeleteClicked(object sender, EventArgs e) Debug.WriteLine(ex.Message); } } - await DisplayAlert("Success", $"Offline data deleted for {sampleInfo.SampleName}", "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Success", $"Offline data deleted for {sampleInfo.SampleName}", "OK"); } catch (Exception exception) { Debug.WriteLine(exception); - await DisplayAlert("Error", $"Couldn't delete offline data.", "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", $"Couldn't delete offline data.", "OK"); } finally { @@ -248,7 +248,7 @@ await DataManager.DownloadDataItem(itemId, _cancellationTokenSource.Token, } catch (OperationCanceledException) { - await DisplayAlert(string.Empty, "Download canceled", "OK"); + await Application.Current.Windows[0].Page.DisplayAlert(string.Empty, "Download canceled", "OK"); return; } catch (Exception ex) @@ -259,12 +259,12 @@ await DataManager.DownloadDataItem(itemId, _cancellationTokenSource.Token, } } } - await DisplayAlert(string.Empty, "All data downloaded", "OK"); + await Application.Current.Windows[0].Page.DisplayAlert(string.Empty, "All data downloaded", "OK"); } catch (Exception exception) { Debug.WriteLine(exception); - await DisplayAlert("Error", exception.Message, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", exception.Message, "OK"); } finally { @@ -293,12 +293,12 @@ private async void DeleteAllClicked(object sender, EventArgs e) } } - await DisplayAlert("Success", "All data deleted", "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Success", "All data deleted", "OK"); } catch (Exception exception) { Debug.WriteLine(exception); - await DisplayAlert("Error", exception.Message, "OK"); + await Application.Current.Windows[0].Page.DisplayAlert("Error", exception.Message, "OK"); } finally {