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

CanAddItems() public method

Asks the environment for permission to add files.
public CanAddItems ( string files, VSQUERYADDFILEFLAGS flags ) : bool
files string The files to add.
flags VSQUERYADDFILEFLAGS The VSQUERYADDFILEFLAGS flags associated to the files added
return bool
        public virtual bool CanAddItems(string[] files, VSQUERYADDFILEFLAGS[] flags)
        {
            // If we are silent then we assume that the file can be added, 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 len = files.Length;
            VSQUERYADDFILERESULTS[] summary = new VSQUERYADDFILERESULTS[1];
            ErrorHandler.ThrowOnFailure(this.GetIVsTrackProjectDocuments2().OnQueryAddFiles(this.projectMgr.InteropSafeIVsProject3, len, files, flags, summary, null));
            if(summary[0] == VSQUERYADDFILERESULTS.VSQUERYADDFILERESULTS_AddNotOK)
            {
                return false;
            }

            return true;
        }