private void SetFullFileName(String fullFileName)
{
if (this.fullFileName != fullFileName)
{
// File changed
this.textEditor.SyntaxHighlighting = HighlightingManager.Instance.GetDefinitionByExtension(System.IO.Path.GetExtension(fullFileName));
if (this.fileChangedWatcher != null)
{
this.fileChangedWatcher.EnableRaisingEvents = false;
this.fileChangedWatcher.Dispose();
this.fileChangedWatcher = null;
}
try
{
this.fileChangedWatcher = new System.IO.FileSystemWatcher(System.IO.Path.GetDirectoryName(fullFileName), System.IO.Path.GetFileName(fullFileName));
this.fileChangedWatcher.NotifyFilter = System.IO.NotifyFilters.LastWrite;
this.fileChangedWatcher.Changed += new System.IO.FileSystemEventHandler(fileChangedWatcher_Changed);
this.fileChangedWatcher.EnableRaisingEvents = true;
}
catch
{
// For some reason openeing files from temp folder hits this.
}
}
this.fullFileName = fullFileName;
this.titleText.Content = System.IO.Path.GetFileName(fullFileName);
this.title.ToolTip = fullFileName;
}