SEBWIN-408: Made favicon loading asynchronous.
This commit is contained in:
parent
bcb8abdeaa
commit
eb8ac889a4
1 changed files with 10 additions and 7 deletions
|
@ -281,16 +281,19 @@ namespace SafeExamBrowser.Browser
|
|||
|
||||
private void DisplayHandler_FaviconChanged(string uri)
|
||||
{
|
||||
var request = new HttpRequestMessage(HttpMethod.Head, uri);
|
||||
var response = httpClient.SendAsync(request).ContinueWith(task =>
|
||||
Task.Run(() =>
|
||||
{
|
||||
if (task.IsCompleted && task.Result.IsSuccessStatusCode)
|
||||
var request = new HttpRequestMessage(HttpMethod.Head, uri);
|
||||
var response = httpClient.SendAsync(request).ContinueWith(task =>
|
||||
{
|
||||
Icon = new BrowserIconResource(uri);
|
||||
if (task.IsCompleted && task.Result.IsSuccessStatusCode)
|
||||
{
|
||||
Icon = new BrowserIconResource(uri);
|
||||
|
||||
IconChanged?.Invoke(Icon);
|
||||
window.UpdateIcon(Icon);
|
||||
}
|
||||
IconChanged?.Invoke(Icon);
|
||||
window.UpdateIcon(Icon);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue