private void Open_Executed(object sender, RoutedEventArgs e) { var newEditor = new EditorTab(); var openFile = new OpenFileDialog { Filter = Properties.Resources.RubyFileFilter, CheckFileExists = true }; if (openFile.ShowDialog() != System.Windows.Forms.DialogResult.OK || openFile.FileName.Length <= 0) return; newEditor.FirstSave = false; newEditor.Saved = true; newEditor.Filepath = openFile.FileName; newEditor.MainWindow = this; newEditor.TextEditor.Text = File.ReadAllText(openFile.FileName); Settings.AddEditorToPane(EditorPane, newEditor, Path.GetFileNameWithoutExtension(openFile.FileName)); var oldEditor = Settings.GetCurrentEditor(EditorPane); if(EditorPane.SelectedContent != null && EditorPane.SelectedContent.Title == "Untitled" && !oldEditor.Saved) EditorPane.RemoveChildAt(EditorPane.SelectedContentIndex); }