private void HandleNavigationComplete(TabRenderer sender)
        {
            var tab = GetTabGroup(sender);

            tab.TabButton.PageName = tab.TabRenderer.DocumentTitle;

            if (tab.TabRenderer.PageType == PageType.Web)
            {
                tab.TabButton.SetFaviconSource(new BitmapImage(new Uri($"https://www.google.com/s2/favicons?sz=24&domain={tab.TabRenderer.Uri}")));
            }
            else if (tab.TabRenderer.PageType == PageType.Native)
            {
                string uri = tab.TabRenderer.Uri.Remove(0, NativeView.UriPrefix.Length);

                if (NativePages.ContainsKey(uri))
                {
                    tab.TabButton.SetNativeFaviconSource(NativePages.Get(uri).Icon);
                }
                else
                {
                    tab.TabButton.SetNativeFaviconSource(new FontIcon {
                        FontFamily = new FontFamily("Segoe MDL2 Assets"), Glyph = "\xE9CE"
                    });
                }
            }

            if (FocusedTab == tab)
            {
                OnNavigationComplete?.Invoke(tab, true);
                return;
            }

            OnNavigationComplete?.Invoke(tab, false);
        }
        private void HandleNavigationStart(TabRenderer sender)
        {
            var tab = GetTabGroup(sender);

            tab.TabButton.PageName = "Loading...";
            Library.LibraryHandler.History.Add(new Library.Artifact(sender.DocumentTitle, sender.Uri, DateTime.UtcNow));

            OnNavigationStart?.Invoke(tab, FocusedTab == tab);
        }
Beispiel #3
0
        private void UpdateRefreshButton(bool isLoading, TabRenderer tabRenderer)
        {
            if (isLoading)
            {
                AB_refreshButton.Content = "Stop";
                var symbol = new SymbolIcon {
                    Symbol = Symbol.Cancel
                };
                AB_refreshButton.Icon = symbol;
            }
            else
            {
                AB_refreshButton.Content = "Refresh";
                var symbol = new SymbolIcon {
                    Symbol = Symbol.Refresh
                };
                AB_refreshButton.Icon = symbol;
            }

            // Disable the refresh button if it's a Native page.
            AB_refreshButton.IsEnabled = tabRenderer.PageType != PageType.Native;
        }
 // Gets the tab group with the tab renderer.
 private TabGroup GetTabGroup(TabRenderer tabRenderer)
 {
     return(tabs.First(tab => tab.TabRenderer == tabRenderer));
 }