Skip to content

Commit a7f6c7f

Browse files
author
Tiago Brenck
committed
Fixed WPF thread error
1 parent 7822cb0 commit a7f6c7f

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

TodoListClient/MainWindow.xaml.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ private async void GetTodoList(bool isAppStarting)
139139
return;
140140
}
141141

142-
// Once the token has been returned by ADAL, add it to the http authorization header, before making the call to access the To Do list service.
142+
// Once the token has been returned by MSAL, add it to the http authorization header, before making the call to access the To Do list service.
143143
httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", result.AccessToken);
144144

145145
// Call the To Do list service.
@@ -152,7 +152,10 @@ private async void GetTodoList(bool isAppStarting)
152152
JavaScriptSerializer serializer = new JavaScriptSerializer();
153153
List<TodoItem> toDoArray = serializer.Deserialize<List<TodoItem>>(s);
154154

155-
TodoList.ItemsSource = toDoArray.Select(t => new { t.Title });
155+
Dispatcher.Invoke(() =>
156+
{
157+
TodoList.ItemsSource = toDoArray.Select(t => new { t.Title });
158+
});
156159
}
157160
else
158161
{

0 commit comments

Comments
 (0)