private void ctxRichNotes_Opening(object sender, CancelEventArgs e)
{
if(richNotes.SelectedText.Count() > 4){
if (richNotes.SelectedText.Trim().Substring(3, richNotes.SelectedText.Trim().Count() - 3).Contains(':') == true)
{
string[] strBits = richNotes.SelectedText.Trim().Split(':');
if (strBits.Count() == 3)
{
try
{
int.Parse(strBits[2]); // check it is not over selected
if (File.Exists(strBits[0] + ":" + strBits[1]))
{
openFileToolStripMenuItem.Visible = true;
}
}
catch (Exception)
{
// Shrink the selection down to just the filename
richNotes.SelectionStart = richNotes.SelectionStart;
richNotes.SelectionLength = strBits[0].Length + 1 + strBits[1].Length;
openFileToolStripMenuItem.Visible = true;
}
}
}
else if (File.Exists(richNotes.SelectedText) == true)
{
openFileToolStripMenuItem.Visible = true;
}
}
}