private SourceFileEditor OpenTextEditor(string Path)
{
bool exist = false;
foreach (DockContent item in DockPanel.Contents)
{
if (item.GetType() == typeof(PKStudio.Forms.Editors.SourceFileEditor))
{
PKStudio.Forms.Editors.SourceFileEditor editor = (PKStudio.Forms.Editors.SourceFileEditor)item;
if (editor.EditingFilePath == Path)
{
editor.Show();
return editor;
}
}
}
if (!exist)
{
SFE = new Forms.Editors.SourceFileEditor();
SFE.OpenContainingFolderEvent += new EventHandler<Forms.BaseForms.PathEventArgs>(OpenContainingFolderEvent);
if (SFE.SetFile(Path))
SFE.Show(DockPanel, DockState.Document);
return SFE;
}
return null;
}