IVsTrackProjectDocumentsEvents2.OnQueryRenameFiles Method
This method notifies the client when a project has requested to rename files.
Namespace: Microsoft.VisualStudio.Shell.Interop
Assembly: Microsoft.VisualStudio.Shell.Interop (in Microsoft.VisualStudio.Shell.Interop.dll)
Syntax
'宣言
Function OnQueryRenameFiles ( _
pProject As IVsProject, _
cFiles As Integer, _
rgszMkOldNames As String(), _
rgszMkNewNames As String(), _
rgFlags As VSQUERYRENAMEFILEFLAGS(), _
<OutAttribute> pSummaryResult As VSQUERYRENAMEFILERESULTS(), _
<OutAttribute> rgResults As VSQUERYRENAMEFILERESULTS() _
) As Integer
'使用
Dim instance As IVsTrackProjectDocumentsEvents2
Dim pProject As IVsProject
Dim cFiles As Integer
Dim rgszMkOldNames As String()
Dim rgszMkNewNames As String()
Dim rgFlags As VSQUERYRENAMEFILEFLAGS()
Dim pSummaryResult As VSQUERYRENAMEFILERESULTS()
Dim rgResults As VSQUERYRENAMEFILERESULTS()
Dim returnValue As Integer
returnValue = instance.OnQueryRenameFiles(pProject, _
cFiles, rgszMkOldNames, rgszMkNewNames, _
rgFlags, pSummaryResult, rgResults)
int OnQueryRenameFiles(
IVsProject pProject,
int cFiles,
string[] rgszMkOldNames,
string[] rgszMkNewNames,
VSQUERYRENAMEFILEFLAGS[] rgFlags,
VSQUERYRENAMEFILERESULTS[] pSummaryResult,
VSQUERYRENAMEFILERESULTS[] rgResults
)
int OnQueryRenameFiles(
[InAttribute] IVsProject^ pProject,
[InAttribute] int cFiles,
[InAttribute] array<String^>^ rgszMkOldNames,
[InAttribute] array<String^>^ rgszMkNewNames,
[InAttribute] array<VSQUERYRENAMEFILEFLAGS>^ rgFlags,
[OutAttribute] array<VSQUERYRENAMEFILERESULTS>^ pSummaryResult,
[OutAttribute] array<VSQUERYRENAMEFILERESULTS>^ rgResults
)
function OnQueryRenameFiles(
pProject : IVsProject,
cFiles : int,
rgszMkOldNames : String[],
rgszMkNewNames : String[],
rgFlags : VSQUERYRENAMEFILEFLAGS[],
pSummaryResult : VSQUERYRENAMEFILERESULTS[],
rgResults : VSQUERYRENAMEFILERESULTS[]
) : int
Parameters
pProject
Type: Microsoft.VisualStudio.Shell.Interop.IVsProject[in] Project requesting to rename files.
cFiles
Type: System.Int32[in] Number of files to rename.
rgszMkOldNames
Type: [][in] Array of old file names.
rgszMkNewNames
Type: [][in] Array of new file names.
rgFlags
Type: [][in] Array of flags. For a list of rgFlags values, see VSQUERYRENAMEFILEFLAGS.
pSummaryResult
Type: [][out] Summary result object. This object is a summation of the yes and no results for the array of files passed in rgszMkOldNames. If the result for a single file is no, then pSummaryResult is equal to VSQUERYRENAMEFILERESULTS_RenameNotOK; if the results for all files are yes, then pSummaryResult is equal to VSQUERYRENAMEFILERESULTS_RenameOK. For a list of pSummaryResult values, see VSQUERYRENAMEFILERESULTS.
rgResults
Type: [][out] Array of results. For a list of rgResults values, see VSQUERYRENAMEFILERESULTS.
Return Value
Type: System.Int32
If the method succeeds, it returns S_OK. If it fails, it returns an error code.
Remarks
COM Signature
From IVsTrackProjectDocumentsEvents2.idl
HRESULT IVsTrackProjectDocumentsEvents2::OnQueryRenameFiles(
[in] IVsProject *pProject,
[in] int cFiles, [in, size_is(cFiles)] const LPCOLESTR rgszMkOldNames[],
[in, size_is(cFiles)] const LPCOLESTR rgszMkNewNames[],
[in, size_is(cFiles)] const VSQUERYRENAMEFILEFLAGS rgflags[],
[out] VSQUERYRENAMEFILERESULTS *pSummaryResult,
[out, size_is(cFiles)] VSQUERYRENAMEFILERESULTS rgResults[]
);
Use IVsTrackProjectDocumentsEvents2.OnQueryRenameFiles to indicate whether specified files can be renamed in the project. Only deny a query if allowing the operation would compromise your stable state. For example, source control denies rename queries if the new name conflicts with an existing file already under source control.
Permissions
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.
See Also
Reference
IVsTrackProjectDocumentsEvents2 Interface