File tree Expand file tree Collapse file tree 1 file changed +8
-8
lines changed
Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -37,14 +37,12 @@ CHECK_FAILURE(m_webView2->add_FaviconChanged(
3737 SendMessage(
3838 m_appWindow->GetMainWindow(), WM_SETICON,
3939 ICON_SMALL, (LPARAM)m_favicon.get());
40- m_statusBar.Show(strUrl);
4140 }
4241 else
4342 {
4443 SendMessage(
4544 m_appWindow->GetMainWindow(), WM_SETICON,
4645 ICON_SMALL, (LPARAM)IDC_NO);
47- m_statusBar.Show(L"No Icon");
4846 }
4947
5048 return S_OK;
@@ -57,13 +55,15 @@ CHECK_FAILURE(m_webView2->add_FaviconChanged(
5755```
5856## .NET / WinRT Registering a listener for favicon changes
5957```c#
60- webView.CoreWebView2.FaviconChanged += (CoreWebView2 sender, Object arg) =>
58+ webView.CoreWebView2.FaviconChanged += (object sender, Object arg) =>
6159{
62- IRandomAccessStream stream = await webView.CoreWebView2.GetFaviconAsync(
63- CoreWebView2FaviconImageFormat.Png);
64- // setting the window Icon to the bitmap
65- this.Icon = BitmapFrame.Create(stream);
66-
60+ string value = webView.CoreWebView2.FaviconUri;
61+ System.IO.Stream stream = await webView.CoreWebView2.GetFaviconAsync(
62+ CoreWebView2FaviconImageFormat.Png);
63+ if (stream == null || stream.Length == 0)
64+ this.Icon = null;
65+ else
66+ this.Icon = BitmapFrame.Create(stream);
6767};
6868```
6969# API Notes
You can’t perform that action at this time.
0 commit comments