private void OpenExecuted(object sender, ExecutedRoutedEventArgs e) { List <string> fileNames = g_TabManager.readFileNames(); if (fileNames != null) { //Check to see if the first tab is a new blank if ((string)g_files[0].Tab.Header == "new 1" && g_files[0].IsChanged == false && g_files.Count < 2) { g_files.RemoveAt(0); mainTabControl.Items.RemoveAt(0); } foreach (string name in fileNames) { //Check if file is already open, then change tab to that item File result = g_files.FirstOrDefault(t => t.Path == name); if (result != null) { setActiveTabObject(result.Tab); continue; } File temp = g_TabManager.createNewTab(name); mainTabControl.Items.Add(temp.Tab); mainTabControl.SelectedItem = temp.Tab; //Add the temporary file object to the list g_files.Add(temp); } //Set focus to newly opened tab, change title mainWindow.Title = GetActiveTabObject().Path + " - TextyEdit++"; } }//end openexecute