private void InitializeInitialTabs()
{
var InitialTabs = Utilities.GetRegistryValue("OpenedTabs", "").ToString().Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
if (InitialTabs.Length == 0 || !_IsrestoreTabs)
{
var sho = FileSystemListItem.ToFileSystemItem(this._ShellListView.LVHandle, tcMain.StartUpLocation.ToShellParsingName());
if (tcMain.Items.OfType <Wpf.Controls.TabItem>().Any())
{
NavigationController(sho);
}
else
{
var tab = tcMain.NewTab(sho, true);
this.SelectTab(tab);
}
}
if (_IsrestoreTabs)
{
isOnLoad = true;
int i = 0;
foreach (string str in InitialTabs)
{
try {
i++;
if (str.ToLowerInvariant() == "::{22877a6d-37a1-461a-91b0-dbda5aaebc99}")
{
continue;
}
var tab = tcMain.NewTab(FileSystemListItem.ToFileSystemItem(this._ShellListView.LVHandle, str.ToShellParsingName()), i == InitialTabs.Length);
if (i == InitialTabs.Length)
{
this.SelectTab(tab);
bcbc.SetPathWithoutNavigate(str);
}
} catch {
//AddToLog(String.Format("Unable to load {0} into a tab!", str));
MessageBox.Show("BetterExplorer is unable to load one of the tabs from your last session. Your other tabs are perfectly okay though! \r\n\r\nThis location was unable to be loaded: " + str, "Unable to Create New Tab", MessageBoxButton.OK, MessageBoxImage.Error);
}
}
if (tcMain.Items.Count == 0)
{
tcMain.NewTab();
string idk = tcMain.StartUpLocation.StartsWith("::") ? tcMain.StartUpLocation.ToShellParsingName() : tcMain.StartUpLocation.Replace("\"", "");
NavigationController(FileSystemListItem.ToFileSystemItem(this._ShellListView.LVHandle, idk));
(tcMain.SelectedItem as Wpf.Controls.TabItem).ShellObject = _ShellListView.CurrentFolder;
(tcMain.SelectedItem as Wpf.Controls.TabItem).ToolTip = _ShellListView.CurrentFolder.ParsingName.Replace("%20", " ").Replace("%3A", ":").Replace("%5C", @"\");
}
isOnLoad = false;
}
}