Skip to content

Commit 722f1af

Browse files
Update to Visual Studio 2026 and replace deprecated DisplayAlert with DisplayAlertAsync
Co-authored-by: jamesmontemagno <[email protected]>
1 parent 99c2dc1 commit 722f1af

File tree

19 files changed

+43
-43
lines changed

19 files changed

+43
-43
lines changed

Community Modules/XAML/Part 1 - Fundamentals/Finish/MonkeyFinder/ViewModel/MonkeyDetailsViewModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ async Task OpenMap()
2626
catch (Exception ex)
2727
{
2828
Debug.WriteLine($"Unable to launch maps: {ex.Message}");
29-
await Shell.Current.DisplayAlert("Error, no Maps app!", ex.Message, "OK");
29+
await Shell.Current.DisplayAlertAsync("Error, no Maps app!", ex.Message, "OK");
3030
}
3131
}
3232
}

Community Modules/XAML/Part 1 - Fundamentals/Finish/MonkeyFinder/ViewModel/MonkeysViewModel.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ async Task GetMonkeysAsync()
4141
{
4242
if (connectivity.NetworkAccess != NetworkAccess.Internet)
4343
{
44-
await Shell.Current.DisplayAlert("No connectivity!",
44+
await Shell.Current.DisplayAlertAsync("No connectivity!",
4545
$"Please check internet and try again.", "OK");
4646
return;
4747
}
@@ -59,7 +59,7 @@ await Shell.Current.DisplayAlert("No connectivity!",
5959
catch (Exception ex)
6060
{
6161
Debug.WriteLine($"Unable to get monkeys: {ex.Message}");
62-
await Shell.Current.DisplayAlert("Error!", ex.Message, "OK");
62+
await Shell.Current.DisplayAlertAsync("Error!", ex.Message, "OK");
6363
}
6464
finally
6565
{
@@ -93,14 +93,14 @@ async Task GetClosestMonkey()
9393
new Location(m.Latitude, m.Longitude), DistanceUnits.Miles))
9494
.FirstOrDefault();
9595

96-
await Shell.Current.DisplayAlert("", first.Name + " " +
96+
await Shell.Current.DisplayAlertAsync("", first.Name + " " +
9797
first.Location, "OK");
9898

9999
}
100100
catch (Exception ex)
101101
{
102102
Debug.WriteLine($"Unable to query location: {ex.Message}");
103-
await Shell.Current.DisplayAlert("Error!", ex.Message, "OK");
103+
await Shell.Current.DisplayAlertAsync("Error!", ex.Message, "OK");
104104
}
105105
}
106106
}

Community Modules/XAML/Part 2 - Responsibility/Finish/MonkeyFinder/ViewModel/MonkeyDetailsViewModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ async Task OpenMap()
2626
catch (Exception ex)
2727
{
2828
Debug.WriteLine($"Unable to launch maps: {ex.Message}");
29-
await Shell.Current.DisplayAlert("Error, no Maps app!", ex.Message, "OK");
29+
await Shell.Current.DisplayAlertAsync("Error, no Maps app!", ex.Message, "OK");
3030
}
3131
}
3232
}

Community Modules/XAML/Part 2 - Responsibility/Finish/MonkeyFinder/ViewModel/MonkeysViewModel.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ async Task GetMonkeysAsync()
4141
{
4242
if (connectivity.NetworkAccess != NetworkAccess.Internet)
4343
{
44-
await Shell.Current.DisplayAlert("No connectivity!",
44+
await Shell.Current.DisplayAlertAsync("No connectivity!",
4545
$"Please check internet and try again.", "OK");
4646
return;
4747
}
@@ -59,7 +59,7 @@ await Shell.Current.DisplayAlert("No connectivity!",
5959
catch (Exception ex)
6060
{
6161
Debug.WriteLine($"Unable to get monkeys: {ex.Message}");
62-
await Shell.Current.DisplayAlert("Error!", ex.Message, "OK");
62+
await Shell.Current.DisplayAlertAsync("Error!", ex.Message, "OK");
6363
}
6464
finally
6565
{
@@ -93,14 +93,14 @@ async Task GetClosestMonkey()
9393
new Location(m.Latitude, m.Longitude), DistanceUnits.Miles))
9494
.FirstOrDefault();
9595

96-
await Shell.Current.DisplayAlert("", first.Name + " " +
96+
await Shell.Current.DisplayAlertAsync("", first.Name + " " +
9797
first.Location, "OK");
9898

9999
}
100100
catch (Exception ex)
101101
{
102102
Debug.WriteLine($"Unable to query location: {ex.Message}");
103-
await Shell.Current.DisplayAlert("Error!", ex.Message, "OK");
103+
await Shell.Current.DisplayAlertAsync("Error!", ex.Message, "OK");
104104
}
105105
}
106106
}

Community Modules/XAML/Part 3 - Magic Values/Finish/MonkeyFinder/ViewModel/MonkeyDetailsViewModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ async Task OpenMap()
2626
catch (Exception ex)
2727
{
2828
Debug.WriteLine($"Unable to launch maps: {ex.Message}");
29-
await Shell.Current.DisplayAlert("Error, no Maps app!", ex.Message, "OK");
29+
await Shell.Current.DisplayAlertAsync("Error, no Maps app!", ex.Message, "OK");
3030
}
3131
}
3232
}

Community Modules/XAML/Part 3 - Magic Values/Finish/MonkeyFinder/ViewModel/MonkeysViewModel.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ async Task GetMonkeysAsync()
4141
{
4242
if (connectivity.NetworkAccess != NetworkAccess.Internet)
4343
{
44-
await Shell.Current.DisplayAlert("No connectivity!",
44+
await Shell.Current.DisplayAlertAsync("No connectivity!",
4545
$"Please check internet and try again.", "OK");
4646
return;
4747
}
@@ -59,7 +59,7 @@ await Shell.Current.DisplayAlert("No connectivity!",
5959
catch (Exception ex)
6060
{
6161
Debug.WriteLine($"Unable to get monkeys: {ex.Message}");
62-
await Shell.Current.DisplayAlert("Error!", ex.Message, "OK");
62+
await Shell.Current.DisplayAlertAsync("Error!", ex.Message, "OK");
6363
}
6464
finally
6565
{
@@ -93,14 +93,14 @@ async Task GetClosestMonkey()
9393
new Location(m.Latitude, m.Longitude), DistanceUnits.Miles))
9494
.FirstOrDefault();
9595

96-
await Shell.Current.DisplayAlert("", first.Name + " " +
96+
await Shell.Current.DisplayAlertAsync("", first.Name + " " +
9797
first.Location, "OK");
9898

9999
}
100100
catch (Exception ex)
101101
{
102102
Debug.WriteLine($"Unable to query location: {ex.Message}");
103-
await Shell.Current.DisplayAlert("Error!", ex.Message, "OK");
103+
await Shell.Current.DisplayAlertAsync("Error!", ex.Message, "OK");
104104
}
105105
}
106106
}

Community Modules/XAML/Part 4 - Naming/Finish/MonkeyFinder/ViewModel/MonkeyDetailsViewModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ async Task OpenMap()
2626
catch (Exception ex)
2727
{
2828
Debug.WriteLine($"Unable to launch maps: {ex.Message}");
29-
await Shell.Current.DisplayAlert("Error, no Maps app!", ex.Message, "OK");
29+
await Shell.Current.DisplayAlertAsync("Error, no Maps app!", ex.Message, "OK");
3030
}
3131
}
3232
}

Community Modules/XAML/Part 4 - Naming/Finish/MonkeyFinder/ViewModel/MonkeysViewModel.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ async Task GetMonkeysAsync()
4141
{
4242
if (connectivity.NetworkAccess != NetworkAccess.Internet)
4343
{
44-
await Shell.Current.DisplayAlert("No connectivity!",
44+
await Shell.Current.DisplayAlertAsync("No connectivity!",
4545
$"Please check internet and try again.", "OK");
4646
return;
4747
}
@@ -59,7 +59,7 @@ await Shell.Current.DisplayAlert("No connectivity!",
5959
catch (Exception ex)
6060
{
6161
Debug.WriteLine($"Unable to get monkeys: {ex.Message}");
62-
await Shell.Current.DisplayAlert("Error!", ex.Message, "OK");
62+
await Shell.Current.DisplayAlertAsync("Error!", ex.Message, "OK");
6363
}
6464
finally
6565
{
@@ -93,14 +93,14 @@ async Task GetClosestMonkey()
9393
new Location(m.Latitude, m.Longitude), DistanceUnits.Miles))
9494
.FirstOrDefault();
9595

96-
await Shell.Current.DisplayAlert("", first.Name + " " +
96+
await Shell.Current.DisplayAlertAsync("", first.Name + " " +
9797
first.Location, "OK");
9898

9999
}
100100
catch (Exception ex)
101101
{
102102
Debug.WriteLine($"Unable to query location: {ex.Message}");
103-
await Shell.Current.DisplayAlert("Error!", ex.Message, "OK");
103+
await Shell.Current.DisplayAlertAsync("Error!", ex.Message, "OK");
104104
}
105105
}
106106
}

Community Modules/XAML/Part 5 - Custom Types/Finish/MonkeyFinder/ViewModel/MonkeyDetailsViewModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ async Task OpenMap()
2626
catch (Exception ex)
2727
{
2828
Debug.WriteLine($"Unable to launch maps: {ex.Message}");
29-
await Shell.Current.DisplayAlert("Error, no Maps app!", ex.Message, "OK");
29+
await Shell.Current.DisplayAlertAsync("Error, no Maps app!", ex.Message, "OK");
3030
}
3131
}
3232
}

Community Modules/XAML/Part 5 - Custom Types/Finish/MonkeyFinder/ViewModel/MonkeysViewModel.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ async Task GetMonkeysAsync()
4141
{
4242
if (connectivity.NetworkAccess != NetworkAccess.Internet)
4343
{
44-
await Shell.Current.DisplayAlert("No connectivity!",
44+
await Shell.Current.DisplayAlertAsync("No connectivity!",
4545
$"Please check internet and try again.", "OK");
4646
return;
4747
}
@@ -59,7 +59,7 @@ await Shell.Current.DisplayAlert("No connectivity!",
5959
catch (Exception ex)
6060
{
6161
Debug.WriteLine($"Unable to get monkeys: {ex.Message}");
62-
await Shell.Current.DisplayAlert("Error!", ex.Message, "OK");
62+
await Shell.Current.DisplayAlertAsync("Error!", ex.Message, "OK");
6363
}
6464
finally
6565
{
@@ -93,14 +93,14 @@ async Task GetClosestMonkey()
9393
new Location(m.Latitude, m.Longitude), DistanceUnits.Miles))
9494
.FirstOrDefault();
9595

96-
await Shell.Current.DisplayAlert("", first.Name + " " +
96+
await Shell.Current.DisplayAlertAsync("", first.Name + " " +
9797
first.Location, "OK");
9898

9999
}
100100
catch (Exception ex)
101101
{
102102
Debug.WriteLine($"Unable to query location: {ex.Message}");
103-
await Shell.Current.DisplayAlert("Error!", ex.Message, "OK");
103+
await Shell.Current.DisplayAlertAsync("Error!", ex.Message, "OK");
104104
}
105105
}
106106
}

0 commit comments

Comments
 (0)