mirror of https://github.com/ppy/osu
Update ChannelTabControl in line with TabControl changes
This commit is contained in:
parent
1ce374ae2f
commit
c79d8a4251
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue