Exemplo n.º 1
0
        public EditorTab OpenFile(string fileName)
        {
            bool      result    = false;
            EditorTab editorTab = null;

            foreach (var item in dockPanel.Documents)
            {
                EditorTab edit = item as EditorTab;
                if (edit != null)
                {
                    if (edit.Title == Path.GetFileName(fileName))
                    {
                        editorTab = edit;
                        result    = true;
                    }
                }
            }

            if (File.Exists(fileName))
            {
                if (!result)
                {
                    editorTab = new EditorTab(this);
                    editorTab.OpenFile(fileName);
                    ConfigClass.Config.AddHistoryItem(fileName);
                }
                editorTab.Show(dockPanel);
                return(editorTab);
            }
            else
            {
                MessageBox.Show(String.Format(MainForm.rm.GetString("fileDontExist"), Path.GetFileName(fileName)));
            }
            return(null);
        }