i'd say better than nothing

This commit is contained in:
iAmAsval
2021-09-22 15:59:23 +02:00
parent e81a081c5f
commit 16411edf9c
7 changed files with 37 additions and 5 deletions

View File

@@ -315,9 +315,19 @@ namespace FModel.ViewModels
public void AddTab(string header = null, string directory = null)
{
if (!CanAddTabs) return;
var h = header ?? "New Tab";
var d = directory ?? string.Empty;
if (SelectedTab is { Header : "New Tab" })
{
SelectedTab.Header = h;
SelectedTab.Directory = d;
return;
}
Application.Current.Dispatcher.Invoke(() =>
{
_tabItems.Add(new TabItem(header ?? "New Tab", directory ?? string.Empty));
_tabItems.Add(new TabItem(h, d));
SelectedTab = _tabItems.Last();
});
}