public virtual void StopObservingItem(string fileName)
{
#region Input validation
if(String.IsNullOrEmpty(fileName))
{
throw new ArgumentException(SR.GetString(SR.InvalidParameter, CultureInfo.CurrentUICulture), "fileName");
}
#endregion
string fullFileName = Utilities.CanonicalizeFileName(fileName);
if(this.observedItems.ContainsKey(fullFileName))
{
// Get the cookie that was used for this.observedItems to this file.
ObservedItemInfo itemInfo = this.observedItems[fullFileName];
// Remove the file from our observed list. It's important that this is done before the call to
// UnadviseFileChange, because for some reason, the call to UnadviseFileChange can trigger a
// FilesChanged event, and we want to be able to filter that event away.
this.observedItems.Remove(fullFileName);
// Stop observing the file
ErrorHandler.ThrowOnFailure(this.fileChangeService.UnadviseFileChange(itemInfo.FileChangeCookie));
}
}