Event args class for triggering file change event arguments.
상속: System.EventArgs
예제 #1
0
        /// <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;
            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

            var reload = true;
            if (!Utilities.IsInAutomationFunction(Site))
            {
                // Prompt to reload the nested project file. We use the moniker here since the filename from the event arg is canonicalized.
                var message = string.Format(CultureInfo.CurrentCulture,
                    SR.GetString(SR.QueryReloadNestedProject, CultureInfo.CurrentUICulture), moniker);
                var title = string.Empty;
                var icon = OLEMSGICON.OLEMSGICON_INFO;
                var buttons = OLEMSGBUTTON.OLEMSGBUTTON_YESNO;
                var defaultButton = OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST;
                reload = VsShellUtilities.ShowMessageBox(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.
                ReloadItem(e.ItemID, 0);
            }
        }
예제 #2
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, assemblyPath))
            {
                OnInvalidateItems(Parent);
            }
        }