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 SwitchTab(TabGroup tabToSwitchTo) { if (FocusedTab == tabToSwitchTo) { return; } //AB_searchBox.PlaceholderText = $"Search with {Settings.UserSettings.SearchEngine} or enter address"; // Hides all tabs. foreach (var tab in tabs) { tab.TabButton.Active = false; tab.TabRenderer.Frame.Visibility = Visibility.Collapsed; } // Shows the chosen tab. FocusedTab = tabToSwitchTo; FocusedTab.TabButton.Active = true; FocusedTab.TabRenderer.Frame.Visibility = Visibility.Visible; FocusedTab.TabRenderer.Focus(FocusState.Keyboard); // Simple hack to update the top bar buttons when switching between existing tabs. OnNavigationComplete?.Invoke(tabToSwitchTo, true); }