private void OpenExistingFile(string pathToFile)
{
// Is this file already open?
//
foreach (FileEditorTab page in TabPages)
{
if (page.FileLocation == pathToFile)
return;
}
// Read file & Open a new Tab
//
try
{
String txt = File.ReadAllText(pathToFile);
FileEditorTab newPage = new FileEditorTab();
newPage.FileLocation = pathToFile;
newPage.Content = txt;
this.TabPages.Add(newPage);
SelectedIndex = TabCount - 1;
}
catch (IOException ex)
{
Console.WriteLine("Unable to open file: {0}", ex.Message);
}
}