/// <summary> /// Event callback. Called when one of the nested project files is changed. /// </summary> /// <param name="sender">The FileChangeManager object.</param> /// <param name="e">Event args containing the file name that was updated.</param> private 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) == NativeMethods.IDYES); } 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); } }
/// <summary> /// Event callback. Called when one of the assembly file is changed. /// </summary> /// <param name="sender">The FileChangeManager object.</param> /// <param name="e">Event args containing the file name that was updated.</param> private void OnAssemblyReferenceChangedOnDisk(object sender, FileChangedOnDiskEventArgs e) { Debug.Assert(e != null, "No event args specified for the FileChangedOnDisk event"); // We only care about file deletes, so check for one before enumerating references. if((e.FileChangeFlag & _VSFILECHANGEFLAGS.VSFILECHG_Del) == 0) { return; } if(NativeMethods.IsSamePath(e.FileName, this.assemblyPath)) { this.OnInvalidateItems(this.Parent); } }