Okay, so then the FileSystemWatcher is definitely not what you want at all. It can't see anything past the file which is on your filesystem, so for it to see any change, the file would have already had to have been saved, and in which case it wouldn't make sense to show whether modifications are pending a save, because they are already shown within the file. What you want to do is check to see whether the text in the control, is different from what is in the file.
You can do this with the Control's
Modified event. In the event method, you can change a public boolean property that keeps track of whether modifications to the text, are pending a save, to update the file on disk.
Some psuedocode of what I'm talking about:
Code:
#Property/Boolean -> keeps track of whether modifications are pending to be saved to disk.
Modified event method:
{
- If modified, change boolean for pending save.
}
Save method:
{
- Update the boolean to false after saving data to file, because changes are saved.
}
And after loading a file into the control, I haven't tested, but the Modified property may fire, so you could have some sort of mechanism that prohibits the boolean from changing to True (for modifications that are pending a save to disk), when you load a new file into the Text.