Microsoft.VisualStudio.Project.TrackDocumentsHelper.CanRemoveItems C# (CSharp) Method

CanRemoveItems() public method

Asks the environment for permission to remove files.
public CanRemoveItems ( string files, VSQUERYREMOVEFILEFLAGS flags ) : bool
files string an array of files to remove
flags VSQUERYREMOVEFILEFLAGS The VSQUERYREMOVEFILEFLAGS associated to the files to be removed.
return bool
        public virtual bool CanRemoveItems(string[] files, VSQUERYREMOVEFILEFLAGS[] flags)
        {
            // If we are silent then we assume that the file can be removed, since we do not want to trigger this event.
            if((this.projectMgr.EventTriggeringFlag & SuppressEvents.Tracker) != 0)
            {
                return true;
            }

            if(files == null || files.Length == 0)
            {
                return false;
            }
            int length = files.Length;

            VSQUERYREMOVEFILERESULTS[] summary = new VSQUERYREMOVEFILERESULTS[1];

            ErrorHandler.ThrowOnFailure(this.GetIVsTrackProjectDocuments2().OnQueryRemoveFiles(this.projectMgr.InteropSafeIVsProject3, length, files, flags, summary, null));
            if(summary[0] == VSQUERYREMOVEFILERESULTS.VSQUERYREMOVEFILERESULTS_RemoveNotOK)
            {
                return false;
            }

            return true;
        }