Skip to content

Commit 5aec554

Browse files
authored
Clean up MAUI .NET 10 warnings (#1805)
1 parent 014ad02 commit 5aec554

169 files changed

Lines changed: 712 additions & 667 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/Helpers/ArcGISLoginPrompt.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public static async Task<bool> EnsureAGOLCredentialAsync()
5353
}
5454
catch (Exception ex)
5555
{
56-
await Application.Current.Windows[0].Page.DisplayAlert("Login failed", ex.Message, "OK");
56+
await Application.Current.Windows[0].Page.DisplayAlertAsync("Login failed", ex.Message, "OK");
5757
}
5858
return false;
5959
}

src/MAUI/Maui.Samples/Helpers/FeedbackPrompt.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ internal static class FeedbackPrompt
2020

2121
public async static Task ShowFeedbackPromptAsync()
2222
{
23-
await Application.Current.Windows[0].Page.DisplayActionSheet("Open an issue on GitHub:", "Cancel", null, [BugReport, FeatureRequest]).ContinueWith((result) =>
23+
await Application.Current.Windows[0].Page.DisplayActionSheetAsync("Open an issue on GitHub:", "Cancel", null, [BugReport, FeatureRequest]).ContinueWith((result) =>
2424
{
2525
switch (result.Result)
2626
{

src/MAUI/Maui.Samples/Helpers/SampleLoader.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public static async Task LoadSample(SampleInfo sampleInfo)
5353
if (sampleInfo.OfflineDataItems != null && !await DataManager.HasSampleDataPresent(sampleInfo))
5454
{
5555
// Ask the user for permission before downloading.
56-
bool download = await Application.Current.Windows[0].Page.DisplayAlert(
56+
bool download = await Application.Current.Windows[0].Page.DisplayAlertAsync(
5757
"Download Required",
5858
"This sample requires data to be downloaded. Would you like to download it now?",
5959
"Download", "Cancel");
@@ -91,7 +91,7 @@ await DataManager.EnsureSampleDataPresent(sampleInfo, cancellationSource.Token,
9191
await Shell.Current.Navigation.PopModalAsync(false);
9292
}
9393

94-
await Application.Current.Windows[0].Page.DisplayAlert("", "Download cancelled", "OK");
94+
await Application.Current.Windows[0].Page.DisplayAlertAsync("", "Download cancelled", "OK");
9595
}
9696
catch (Exception ex)
9797
{

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

Lines changed: 4 additions & 4 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 Application.Current.Windows[0].Page.DisplayAlert("Error", ex.Message, "OK");
65+
await Application.Current.Windows[0].Page.DisplayAlertAsync("Error", ex.Message, "OK");
6666
}
6767
}
6868

@@ -127,7 +127,7 @@ private async void OnCategorizeClicked(object sender, EventArgs e)
127127
}
128128
catch (Exception ex)
129129
{
130-
await Application.Current.Windows[0].Page.DisplayAlert("Error creating geomorphic category field", ex.Message, "OK");
130+
await Application.Current.Windows[0].Page.DisplayAlertAsync("Error creating geomorphic category field", ex.Message, "OK");
131131
CategorizeButton.IsEnabled = true;
132132
CategorizeButton.Text = "Categorize";
133133
return;
@@ -149,7 +149,7 @@ private async void OnCategorizeClicked(object sender, EventArgs e)
149149

150150
if (exportedFiles.Count == 0 || !File.Exists(exportedFiles[0]))
151151
{
152-
await Application.Current.Windows[0].Page.DisplayAlert("Export Error", "Exported geomorphic categorization file does not exist.", "OK");
152+
await Application.Current.Windows[0].Page.DisplayAlertAsync("Export Error", "Exported geomorphic categorization file does not exist.", "OK");
153153
CategorizeButton.IsEnabled = true;
154154
CategorizeButton.Text = "Categorize";
155155
return;
@@ -166,7 +166,7 @@ private async void OnCategorizeClicked(object sender, EventArgs e)
166166
}
167167
catch (Exception ex)
168168
{
169-
await Application.Current.Windows[0].Page.DisplayAlert("Error exporting geomorphic categorization", ex.Message, "OK");
169+
await Application.Current.Windows[0].Page.DisplayAlertAsync("Error exporting geomorphic categorization", ex.Message, "OK");
170170
CategorizeButton.IsEnabled = true;
171171
CategorizeButton.Text = "Categorize";
172172
}

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 Application.Current.Windows[0].Page.DisplayAlert("Error", e.ToString(), "OK");
82+
await Application.Current.Windows[0].Page.DisplayAlertAsync("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 Application.Current.Windows[0].Page.DisplayAlert("Error", ex.ToString(), "OK");
110+
await Application.Current.Windows[0].Page.DisplayAlertAsync("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 Application.Current.Windows[0].Page.DisplayAlert("Error", ex.ToString(), "OK");
137+
await Application.Current.Windows[0].Page.DisplayAlertAsync("Error", ex.ToString(), "OK");
138138
}
139139
}
140140
}

src/MAUI/Maui.Samples/Samples/Analysis/ShowExploratoryLineOfSightBetweenGeoelements/ShowExploratoryLineOfSightBetweenGeoelements.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 Application.Current.Windows[0].Page.DisplayAlert("Error", e.ToString(), "OK");
141+
await Application.Current.Windows[0].Page.DisplayAlertAsync("Error", e.ToString(), "OK");
142142
}
143143
}
144144

src/MAUI/Maui.Samples/Samples/Analysis/ShowExploratoryViewshedFromGeoelementInScene/ShowExploratoryViewshedFromGeoelementInScene.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 Application.Current.Windows[0].Page.DisplayAlert("Error", e.ToString(), "OK");
138+
await Application.Current.Windows[0].Page.DisplayAlertAsync("Error", e.ToString(), "OK");
139139
}
140140
}
141141

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ private async Task Initialize()
133133
}
134134
catch (Exception ex)
135135
{
136-
await Application.Current.Windows[0].Page.DisplayAlert("Error initializing viewshed", ex.Message, "OK");
136+
await Application.Current.Windows[0].Page.DisplayAlertAsync("Error initializing viewshed", ex.Message, "OK");
137137
}
138138
}
139139

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 Application.Current.Windows[0].Page.DisplayAlert("Error", e.Message, "OK");
138+
await Application.Current.Windows[0].Page.DisplayAlertAsync("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 Application.Current.Windows[0].Page.DisplayAlert("Error", ex.Message, "OK");
166+
await Application.Current.Windows[0].Page.DisplayAlertAsync("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 Application.Current.Windows[0].Page.DisplayAlert("Error", e.Message, "OK");
200+
await Application.Current.Windows[0].Page.DisplayAlertAsync("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 Application.Current.Windows[0].Page.DisplayAlert("Error", e.Message, "OK");
253+
await Application.Current.Windows[0].Page.DisplayAlertAsync("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 Application.Current.Windows[0].Page.DisplayAlert("Error", $"{field} not found in any of the data dictionaries.", "OK");
277+
await Application.Current.Windows[0].Page.DisplayAlertAsync("Error", $"{field} not found in any of the data dictionaries.", "OK");
278278
break;
279279
}
280280
}
281281
catch (Exception e)
282282
{
283-
await Application.Current.Windows[0].Page.DisplayAlert("Error", e.Message, "OK");
283+
await Application.Current.Windows[0].Page.DisplayAlertAsync("Error", e.Message, "OK");
284284
}
285285
}
286286

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

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ private async Task Initialize()
7575
}
7676
catch (Exception e)
7777
{
78-
await Application.Current.Windows[0].Page.DisplayAlert("Error", e.ToString(), "OK");
78+
await Application.Current.Windows[0].Page.DisplayAlertAsync("Error", e.ToString(), "OK");
7979
}
8080
}
8181

0 commit comments

Comments
 (0)