Update ChannelTabControl in line with TabControl changes

This commit is contained in:
Dean Herbert 2020-06-16 00:12:32 +09:00
parent 1ce374ae2f
commit c79d8a4251
1 changed files with 3 additions and 12 deletions

View File

@ -78,19 +78,10 @@ public void AddChannel(Channel channel)
/// <param name="channel">The channel that is going to be removed.</param>
public void RemoveChannel(Channel channel)
{
if (Current.Value == channel)
{
var allChannels = TabContainer.AllTabItems.Select(tab => tab.Value).ToList();
var isNextTabSelector = allChannels[allChannels.IndexOf(channel) + 1] == selectorTab.Value;
// selectorTab is not switchable, so we have to explicitly select it if it's the only tab left
if (isNextTabSelector && allChannels.Count == 2)
SelectTab(selectorTab);
else
SwitchTab(isNextTabSelector ? -1 : 1);
}
RemoveItem(channel);
if (SelectedTab == null)
SelectTab(selectorTab);
}
protected override void SelectTab(TabItem<Channel> tab)