public static void SetCurrent(Type type) { var tab = Tabs.Find(t => t.ControllerType == type); if (tab != null) { CurrentTab = tab.Name; } }
private void HandleClickEvent(string eventArgument) { ArgumentUtility.CheckNotNullOrEmpty("eventArgument", eventArgument); WebTab tab = Tabs.Find(eventArgument); if (tab != null) { OnClick(tab); } }
private void SetSelectedTab(string itemID) { ArgumentUtility.CheckNotNullOrEmpty("itemID", itemID); if (_selectedTab == null || _selectedTab.ItemID != itemID) { WebTab tab = Tabs.Find(itemID); if (tab != _selectedTab) { SetSelectedTabInternal(tab); } } }
/// <summary> /// Select the tab - it will set one selected tab to the Selected=true and others will set false /// </summary> /// <param name="address"></param> /// <returns></returns> public async Task SelectTab(string address) { foreach (var t in Tabs) { t.Selected = false; } var tab = Tabs.Find(t => t.Address == address); if (tab != null) { tab.Selected = true; } if (tab.NFTs.Count == 0) { await tab.Reload(); } }
/// <summary> /// <inheritdoc/> and remove it from the <see cref="TabCollection"/>. If there's other tabs in the <see cref="TabCollection"/> this will switch tab to the latest tab added to the <see cref="TabCollection"/> /// </summary> /// <param name="_tab">The tab to close</param> /// <returns><inheritdoc/></returns> public override bool CloseTab(ITabItem _tab) { ITabItem item = Tabs.Find(item => item.ID == _tab.ID); if (item != null) { item.Close(); if (Tabs.Remove(item) && FindTab(item => item.IsVisible == true) == null) { if (Tabs.Count > 0 && Tabs[((Tabs.Count - 1 >= 0) ? (Tabs.Count - 1) : (Tabs.Count))] != null) { return(OpenTab(Tabs[((Tabs.Count - 1 >= 0) ? (Tabs.Count - 1) : (Tabs.Count))])); } } } return(false); }
/// <summary> /// Remove tab by Neblio address if exists in the tabs /// </summary> /// <param name="address">Neblio Address which tab should be removed</param> /// <returns>true and string with serialized tabs list as json string</returns> public async Task <(bool, string)> RemoveTab(string address) { var tab = Tabs.Find(t => t.Address == address); if (tab != null) { Tabs.Remove(tab); } else { return(false, "Tab not found"); } foreach (var t in Tabs) { t.Selected = false; } Tabs.FirstOrDefault().Selected = true; return(true, JsonConvert.SerializeObject(Tabs)); }
} //Default key is KeyCode.LeftShift. All added keys will need to be clicked in addition to this. public SizedTab Get(TabSize tab) { return(Tabs.Find(x => x.Size == tab)); }