protected virtual void OnNestedProjectFileChangedOnDisk(object sender, FileChangedOnDiskEventArgs e)
{
#region Pre-condition validation
Debug.Assert(e != null, "No event args specified for the FileChangedOnDisk event");
// We care only about time change for reload.
if((e.FileChangeFlag & _VSFILECHANGEFLAGS.VSFILECHG_Time) == 0)
{
return;
}
// test if we actually have a document for this id.
string moniker;
this.GetMkDocument(e.ItemID, out moniker);
Debug.Assert(NativeMethods.IsSamePath(moniker, e.FileName), " The file + " + e.FileName + " has changed but we could not retrieve the path for the item id associated to the path.");
#endregion
bool reload = true;
if(!Utilities.IsInAutomationFunction(this.Site))
{
// Prompt to reload the nested project file. We use the moniker here since the filename from the event arg is canonicalized.
string message = String.Format(CultureInfo.CurrentCulture, SR.GetString(SR.QueryReloadNestedProject, CultureInfo.CurrentUICulture), moniker);
string title = string.Empty;
OLEMSGICON icon = OLEMSGICON.OLEMSGICON_INFO;
OLEMSGBUTTON buttons = OLEMSGBUTTON.OLEMSGBUTTON_YESNO;
OLEMSGDEFBUTTON defaultButton = OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST;
reload = (VsShellUtilities.ShowMessageBox(this.Site, message, title, icon, buttons, defaultButton) == DialogResult.Yes);
}
if(reload)
{
// We have to use here the interface method call, since it might be that specialized project nodes like the project container item
// is owerwriting the default functionality.
this.ReloadItem(e.ItemID, 0);
}
}