共用方式為


IVsTrackProjectDocuments2 Interface

Definition

Used by projects to query the environment for permission to add, remove, or rename a file or directory in a solution.

public interface class IVsTrackProjectDocuments2
public interface class IVsTrackProjectDocuments2
__interface IVsTrackProjectDocuments2
[System.Runtime.InteropServices.Guid("53544C4D-6639-11D3-A60D-005004775AB1")]
[System.Runtime.InteropServices.InterfaceType(1)]
public interface IVsTrackProjectDocuments2
[System.Runtime.InteropServices.Guid("53544C4D-6639-11D3-A60D-005004775AB1")]
[System.Runtime.InteropServices.InterfaceType(System.Runtime.InteropServices.ComInterfaceType.InterfaceIsIUnknown)]
public interface IVsTrackProjectDocuments2
[<System.Runtime.InteropServices.Guid("53544C4D-6639-11D3-A60D-005004775AB1")>]
[<System.Runtime.InteropServices.InterfaceType(1)>]
type IVsTrackProjectDocuments2 = interface
[<System.Runtime.InteropServices.Guid("53544C4D-6639-11D3-A60D-005004775AB1")>]
[<System.Runtime.InteropServices.InterfaceType(System.Runtime.InteropServices.ComInterfaceType.InterfaceIsIUnknown)>]
type IVsTrackProjectDocuments2 = interface
Public Interface IVsTrackProjectDocuments2
Attributes

Remarks

Use the IVsTrackProjectDocuments2 interface to request permission from the environment to add, remove, or rename any file or directory in a project and (if permission is granted) to inform the environment when these actions are completed. You need to make these calls even if your project does not support source control. You must use IVsTrackProjectDocuments2 for all files, not just master files. For example, if you have a form with a .resx file and other files, you need to tell the environment about all of the files. Do not call the methods of IVsTrackProjectDocuments2 at project open or close. Any entity that requires the information provided through IVsTrackProjectDocuments2 at startup can wait for the OnAfterOpenSolution event and iterate through the solution to find the information required. On shutdown, this information is not needed. Access to IVsTrackProjectDocuments2 is provided from the SVsTrackProjectDocuments service.

For each call on IVsTrackProjectDocuments2, there are two methods, the OnQuery* method and the OnAfter* method. Call the appropriate OnQuery* method to request permission to add, remove, or rename a file or directory in a project. From this call, you might receive notification that the operation cannot proceed. For example, if the Enterprise Framework and Template (EFT) project system does not permit the user to add a file that does not meet policy, the project must be prepared to not perform the add, remove, or rename. If permission is granted, the project must complete the add, rename, or remove action and then call the appropriate OnAfter* method to inform the environment of the changes made to the project.

The IVsTrackProjectDocuments2 method also applies to directories, but directory calls are optional. If your project system has directory information, then provide this information to the environment using these methods. However, if the project system does not have this information, then the environment will infer it.

Note

All directory calls are optional. However, if you call one of the OnQuery* directory methods and the call was successful, then you are required to call the corresponding OnAfter* directory method.

IVsTrackProjectDocuments2 is accessed using the SVsTrackProjectDocuments service.

Notes to Implementers

Implemented by the environment. This interface is the mechanism for gathering the information regarding when a file or directory is added, removed, or renamed in a project.

Notes to Callers

Called by projects to query the environment as to whether a file or directory can be added, removed, or renamed in a solution. For all actions approved by the environment, the appropriate method is then called after the action is completed. IVsTrackProjectDocuments2 must be used by all projects, regardless of whether they support source control.

Methods

AdviseTrackProjectDocumentsEvents(IVsTrackProjectDocumentsEvents2, UInt32)

This method enables clients to receive notifications of project documents events.

BeginBatch()

This method starts a batch of IVsTrackProjectDocuments2.OnAfter* method calls.

EndBatch()

This method ends the batch started by BeginBatch() and displays any user interface (UI) that was generated within the batch.

Flush()

This method displays the UI for the IVsTrackProjectDocuments2 calls completed so far without ending the batch.

OnAfterAddDirectories(IVsProject, Int32, String[])

This method is called by a project after directories have been added to the project.

OnAfterAddDirectoriesEx(IVsProject, Int32, String[], VSADDDIRECTORYFLAGS[])

This method is called by a project after directories have been added to the project. This method is equivalent to OnAfterAddDirectories(IVsProject, Int32, String[]), but it also takes flags.

OnAfterAddFiles(IVsProject, Int32, String[])

This method is called by a project after files have been added to the project.

OnAfterAddFilesEx(IVsProject, Int32, String[], VSADDFILEFLAGS[])

This method is called by a project after files have been added to the project.

OnAfterRemoveDirectories(IVsProject, Int32, String[], VSREMOVEDIRECTORYFLAGS[])

This method is called by a project after directories have been removed from the project.

OnAfterRemoveFiles(IVsProject, Int32, String[], VSREMOVEFILEFLAGS[])

This method is called by a project after files have been removed from the project.

OnAfterRenameDirectories(IVsProject, Int32, String[], String[], VSRENAMEDIRECTORYFLAGS[])

This method is called by a project after a directory has been renamed in the project.

OnAfterRenameFile(IVsProject, String, String, VSRENAMEFILEFLAGS)

This method is called by a project after a file has been renamed in the project.

OnAfterRenameFiles(IVsProject, Int32, String[], String[], VSRENAMEFILEFLAGS[])

This method is called by a project after files have been renamed in the project.

OnAfterSccStatusChanged(IVsProject, Int32, String[], UInt32[])

This method is called by the Source Control Stub to inform listeners that source control status has changed. Do not call this method.

OnQueryAddDirectories(IVsProject, Int32, String[], VSQUERYADDDIRECTORYFLAGS[], VSQUERYADDDIRECTORYRESULTS[], VSQUERYADDDIRECTORYRESULTS[])

This method is called by a project to determine whether directories can be added to the project.

OnQueryAddFiles(IVsProject, Int32, String[], VSQUERYADDFILEFLAGS[], VSQUERYADDFILERESULTS[], VSQUERYADDFILERESULTS[])

This method is called by a project to determine whether files can be added to the project.

OnQueryRemoveDirectories(IVsProject, Int32, String[], VSQUERYREMOVEDIRECTORYFLAGS[], VSQUERYREMOVEDIRECTORYRESULTS[], VSQUERYREMOVEDIRECTORYRESULTS[])

This method is called by a project to determine whether directories can be removed from the project.

OnQueryRemoveFiles(IVsProject, Int32, String[], VSQUERYREMOVEFILEFLAGS[], VSQUERYREMOVEFILERESULTS[], VSQUERYREMOVEFILERESULTS[])

This method is called by a project to determine whether files can be removed from the project.

OnQueryRenameDirectories(IVsProject, Int32, String[], String[], VSQUERYRENAMEDIRECTORYFLAGS[], VSQUERYRENAMEDIRECTORYRESULTS[], VSQUERYRENAMEDIRECTORYRESULTS[])

This method is called by a project to determine whether directories in the project can be renamed.

OnQueryRenameFile(IVsProject, String, String, VSRENAMEFILEFLAGS, Int32)

This method is called by a project to determine whether a file in the project can be renamed.

OnQueryRenameFiles(IVsProject, Int32, String[], String[], VSQUERYRENAMEFILEFLAGS[], VSQUERYRENAMEFILERESULTS[], VSQUERYRENAMEFILERESULTS[])

This method is called by a project to determine whether files can be renamed in the project.

UnadviseTrackProjectDocumentsEvents(UInt32)

This method prevents clients from receiving notifications of project documents events.

Applies to