Skip to content

Commit 82afff9

Browse files
Fixes alerts (#1570)
1 parent 209c8c3 commit 82afff9

134 files changed

Lines changed: 284 additions & 284 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/MAUI/Maui.Samples/Samples/Analysis/LineOfSightGeoElement/LineOfSightGeoElement.xaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ private async Task Initialize()
138138
}
139139
catch (Exception e)
140140
{
141-
await DisplayAlert("Error", e.ToString(), "OK");
141+
await Application.Current.Windows[0].Page.DisplayAlert("Error", e.ToString(), "OK");
142142
}
143143
}
144144

src/MAUI/Maui.Samples/Samples/Analysis/QueryFeatureCountAndExtent/QueryFeatureCountAndExtent.xaml.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ private async Task Initialize()
7979
}
8080
catch (Exception e)
8181
{
82-
await DisplayAlert("Error", e.ToString(), "OK");
82+
await Application.Current.Windows[0].Page.DisplayAlert("Error", e.ToString(), "OK");
8383
}
8484
}
8585

@@ -107,7 +107,7 @@ private async void StatesPicker_SelectionChanged(object sender, EventArgs e)
107107
}
108108
catch (Exception ex)
109109
{
110-
await DisplayAlert("Error", ex.ToString(), "OK");
110+
await Application.Current.Windows[0].Page.DisplayAlert("Error", ex.ToString(), "OK");
111111
}
112112
}
113113

@@ -134,7 +134,7 @@ private async void CountFeaturesButton_Click(object sender, EventArgs e)
134134
}
135135
catch (Exception ex)
136136
{
137-
await DisplayAlert("Error", ex.ToString(), "OK");
137+
await Application.Current.Windows[0].Page.DisplayAlert("Error", ex.ToString(), "OK");
138138
}
139139
}
140140
}

src/MAUI/Maui.Samples/Samples/Analysis/ViewshedGeoElement/ViewshedGeoElement.xaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ private async Task Initialize()
135135
}
136136
catch (Exception e)
137137
{
138-
await DisplayAlert("Error", e.ToString(), "OK");
138+
await Application.Current.Windows[0].Page.DisplayAlert("Error", e.ToString(), "OK");
139139
}
140140
}
141141

src/MAUI/Maui.Samples/Samples/Data/AddFeaturesWithContingentValues/AddFeaturesWithContingentValues.xaml.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ private async Task QueryAndBufferFeatures()
135135
}
136136
catch (Exception e)
137137
{
138-
await DisplayAlert("Error", e.Message, "OK");
138+
await Application.Current.Windows[0].Page.DisplayAlert("Error", e.Message, "OK");
139139
}
140140
}
141141

@@ -163,7 +163,7 @@ private async Task CreateNewEmptyFeature(Esri.ArcGISRuntime.Maui.GeoViewInputEve
163163
}
164164
catch (Exception ex)
165165
{
166-
await DisplayAlert("Error", ex.Message, "OK");
166+
await Application.Current.Windows[0].Page.DisplayAlert("Error", ex.Message, "OK");
167167
}
168168
}
169169

@@ -197,7 +197,7 @@ private async Task<List<string>> GetContingentValues(string field, string fieldG
197197
}
198198
catch (Exception e)
199199
{
200-
await DisplayAlert("Error", e.Message, "OK");
200+
await Application.Current.Windows[0].Page.DisplayAlert("Error", e.Message, "OK");
201201
}
202202

203203
return contingentValuesNamesList;
@@ -250,7 +250,7 @@ private async Task DiscardFeature()
250250
}
251251
catch (Exception e)
252252
{
253-
await DisplayAlert("Error", e.Message, "OK");
253+
await Application.Current.Windows[0].Page.DisplayAlert("Error", e.Message, "OK");
254254
}
255255
}
256256

@@ -274,13 +274,13 @@ private async Task UpdateField(string field, object value)
274274
break;
275275

276276
default:
277-
await DisplayAlert("Error", $"{field} not found in any of the data dictionaries.", "OK");
277+
await Application.Current.Windows[0].Page.DisplayAlert("Error", $"{field} not found in any of the data dictionaries.", "OK");
278278
break;
279279
}
280280
}
281281
catch (Exception e)
282282
{
283-
await DisplayAlert("Error", e.Message, "OK");
283+
await Application.Current.Windows[0].Page.DisplayAlert("Error", e.Message, "OK");
284284
}
285285
}
286286

@@ -344,7 +344,7 @@ private async Task SaveFeature()
344344
}
345345
else
346346
{
347-
await DisplayAlert("Error", $"Error saving feature. {numberOfViolations} violation(s) in field group(s) {string.Join(", ", fieldGroupNames)}.", "OK");
347+
await Application.Current.Windows[0].Page.DisplayAlert("Error", $"Error saving feature. {numberOfViolations} violation(s) in field group(s) {string.Join(", ", fieldGroupNames)}.", "OK");
348348
}
349349
}
350350

src/MAUI/Maui.Samples/Samples/Data/CreateMobileGeodatabase/CreateMobileGeodatabase.xaml.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ private async Task CreateGeodatabase()
101101
}
102102
catch (Exception ex)
103103
{
104-
await DisplayAlert(ex.GetType().Name, ex.Message, "OK");
104+
await Application.Current.Windows[0].Page.DisplayAlert(ex.GetType().Name, ex.Message, "OK");
105105
}
106106
}
107107

@@ -131,7 +131,7 @@ private async Task AddFeature(MapPoint location)
131131
}
132132
catch (Exception ex)
133133
{
134-
await DisplayAlert(ex.GetType().Name, ex.Message, "OK");
134+
await Application.Current.Windows[0].Page.DisplayAlert(ex.GetType().Name, ex.Message, "OK");
135135
}
136136
}
137137

@@ -195,7 +195,7 @@ await Share.RequestAsync(new ShareFileRequest
195195
}
196196
catch (Exception ex)
197197
{
198-
await DisplayAlert(ex.GetType().Name, ex.Message, "OK");
198+
await Application.Current.Windows[0].Page.DisplayAlert(ex.GetType().Name, ex.Message, "OK");
199199
}
200200
}
201201

src/MAUI/Maui.Samples/Samples/Data/EditAndSyncFeatures/EditAndSyncFeatures.xaml.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ private async Task Initialize()
131131
}
132132
catch (Exception ex)
133133
{
134-
await DisplayAlert("Error", ex.ToString(), "OK");
134+
await Application.Current.Windows[0].Page.DisplayAlert("Error", ex.ToString(), "OK");
135135
}
136136
}
137137

@@ -227,7 +227,7 @@ private async void GeoViewTapped(object sender, GeoViewInputEventArgs e)
227227
}
228228
catch (Exception ex)
229229
{
230-
await DisplayAlert("Error", ex.ToString(), "OK");
230+
await Application.Current.Windows[0].Page.DisplayAlert("Error", ex.ToString(), "OK");
231231
}
232232
}
233233

@@ -373,7 +373,7 @@ private async Task HandleGenerationStatusChange(GenerateGeodatabaseJob job)
373373
}
374374

375375
// Show the message.
376-
await DisplayAlert("Error", message, "OK");
376+
await Application.Current.Windows[0].Page.DisplayAlert("Error", message, "OK");
377377
}
378378
}
379379

@@ -481,7 +481,7 @@ private async void GenerateButton_Clicked(object sender, EventArgs e)
481481
}
482482
catch (Exception ex)
483483
{
484-
await DisplayAlert("Error", ex.ToString(), "OK");
484+
await Application.Current.Windows[0].Page.DisplayAlert("Error", ex.ToString(), "OK");
485485
}
486486
}
487487

@@ -512,7 +512,7 @@ private async void SyncButton_Click(object sender, EventArgs e)
512512
}
513513
catch (Exception ex)
514514
{
515-
await DisplayAlert("Alert", ex.ToString(), "OK");
515+
await Application.Current.Windows[0].Page.DisplayAlert("Alert", ex.ToString(), "OK");
516516
}
517517
}
518518
}

src/MAUI/Maui.Samples/Samples/Data/EditFeatureAttachments/EditFeatureAttachments.xaml.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ private async Task Initialize()
6262
}
6363
catch (Exception ex)
6464
{
65-
await DisplayAlert("Error", ex.ToString(), "OK");
65+
await Application.Current.Windows[0].Page.DisplayAlert("Error", ex.ToString(), "OK");
6666
}
6767
}
6868

@@ -106,7 +106,7 @@ private async void MapView_Tapped(object sender, Esri.ArcGISRuntime.Maui.GeoView
106106
}
107107
catch (Exception ex)
108108
{
109-
await DisplayAlert("Error selecting feature", ex.ToString(), "OK");
109+
await Application.Current.Windows[0].Page.DisplayAlert("Error selecting feature", ex.ToString(), "OK");
110110
}
111111
}
112112

src/MAUI/Maui.Samples/Samples/Data/EditFeatureLinkedAnnotation/EditFeatureLinkedAnnotation.xaml.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ private async Task Initialize()
5858
}
5959
catch (Exception ex)
6060
{
61-
await DisplayAlert("Error", ex.Message, "OK");
61+
await Application.Current.Windows[0].Page.DisplayAlert("Error", ex.Message, "OK");
6262
}
6363
}
6464

@@ -113,7 +113,7 @@ private async Task SelectFeature(Point clickedPoint)
113113
}
114114
catch (Exception ex)
115115
{
116-
await DisplayAlert("Error", ex.Message, "OK");
116+
await Application.Current.Windows[0].Page.DisplayAlert("Error", ex.Message, "OK");
117117
}
118118
}
119119

@@ -170,7 +170,7 @@ private async void OkClick(object sender, System.EventArgs e)
170170
}
171171
catch (Exception ex)
172172
{
173-
await DisplayAlert("Error", ex.Message, "OK");
173+
await Application.Current.Windows[0].Page.DisplayAlert("Error", ex.Message, "OK");
174174
}
175175
finally
176176
{

src/MAUI/Maui.Samples/Samples/Data/EditFeaturesUsingFeatureForms/EditFeaturesUsingFeatureForms.xaml.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ private async Task Initialize()
4848
}
4949
catch (Exception ex)
5050
{
51-
await DisplayAlert("Error", ex.Message, "OK");
51+
await Application.Current.Windows[0].Page.DisplayAlert("Error", ex.Message, "OK");
5252
}
5353
}
5454

@@ -74,7 +74,7 @@ private async void MyMapView_GeoViewTapped(object sender, Esri.ArcGISRuntime.Mau
7474
}
7575
catch (Exception ex)
7676
{
77-
await DisplayAlert("Error", ex.Message, "OK");
77+
await Application.Current.Windows[0].Page.DisplayAlert("Error", ex.Message, "OK");
7878
}
7979
}
8080

@@ -115,7 +115,7 @@ private async void SaveButton_Clicked(object sender, EventArgs e)
115115
}
116116
catch (Exception ex)
117117
{
118-
await DisplayAlert("Error", ex.Message, "OK");
118+
await Application.Current.Windows[0].Page.DisplayAlert("Error", ex.Message, "OK");
119119
}
120120
}
121121

src/MAUI/Maui.Samples/Samples/Data/FeatureLayerQuery/FeatureLayerQuery.xaml.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,12 +128,12 @@ private async Task QueryStateFeature(string stateName)
128128
}
129129
else
130130
{
131-
await DisplayAlert("State Not Found!", "Add a valid state name.", "OK");
131+
await Application.Current.Windows[0].Page.DisplayAlert("State Not Found!", "Add a valid state name.", "OK");
132132
}
133133
}
134134
catch (Exception)
135135
{
136-
await DisplayAlert("Sample error", "An error occurred", "OK");
136+
await Application.Current.Windows[0].Page.DisplayAlert("Sample error", "An error occurred", "OK");
137137
}
138138
}
139139
}

0 commit comments

Comments
 (0)