Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge main into live #6432

Merged
merged 1 commit into from
Nov 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified wpf/Threading/Weather/net48/csharp/Code.zip
Binary file not shown.
2 changes: 1 addition & 1 deletion wpf/Threading/Weather/net48/csharp/Weather.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ private async void FetchButton_Click(object sender, RoutedEventArgs e)
((Storyboard)Resources["HideWeatherImageStoryboard"]).Begin(this);

// Asynchronously fetch the weather forecast on a different thread and pause this code.
string weather = await FetchWeatherFromServerAsync();
string weather = await Task.Run(FetchWeatherFromServerAsync);

// After async data returns, process it...
// Set the weather image
Expand Down
Binary file modified wpf/Threading/Weather/net48/vb/Code.zip
Binary file not shown.
8 changes: 4 additions & 4 deletions wpf/Threading/Weather/net48/vb/Weather.xaml.vb
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ Public Class Weather
DirectCast(Resources("HideWeatherImageStoryboard"), Storyboard).Begin(Me)

' Asynchronously fetch the weather forecast on a different thread and pause this code.
Dim Weather As String = Await FetchWeatherFromServerAsync()
Dim weatherType As String = Await Task.Run(AddressOf FetchWeatherFromServerAsync)

' After async data returns, process it...
' Set the weather image
If Weather = "sunny" Then
If weatherType = "sunny" Then
weatherIndicatorImage.Source = DirectCast(Resources("SunnyImageSource"), ImageSource)

ElseIf Weather = "rainy" Then
ElseIf weatherType = "rainy" Then
weatherIndicatorImage.Source = DirectCast(Resources("RainingImageSource"), ImageSource)

End If
Expand All @@ -30,7 +30,7 @@ Public Class Weather
' Update UI text
fetchButton.IsEnabled = True
fetchButton.Content = "Fetch Forecast"
weatherText.Text = Weather
weatherText.Text = weatherType
End Sub

Private Async Function FetchWeatherFromServerAsync() As Task(Of String)
Expand Down