ItemOperations 接口
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
执行公共文件操作的对象。
public interface class ItemOperations
public interface class ItemOperations
__interface ItemOperations
[System.Runtime.InteropServices.Guid("D5DBE57B-C074-4E95-B015-ABEEAA391693")]
[System.Runtime.InteropServices.TypeLibType(4160)]
public interface ItemOperations
[<System.Runtime.InteropServices.Guid("D5DBE57B-C074-4E95-B015-ABEEAA391693")>]
[<System.Runtime.InteropServices.TypeLibType(4160)>]
type ItemOperations = interface
Public Interface ItemOperations
- 属性
示例
Sub ItemOperationsExample()
Dim Cmds As Commands = DTE.Commands
Dim Cmd As Command
Dim Doc As Document
Dim TxtDoc As TextDocument
DTE.ItemOperations.NewFile("General\Text File")
Doc = ActiveDocument
TxtDoc = Doc.Object("TextDocument")
For Each Cmd In Cmds
If (Cmd.Name <> "") Then
TxtDoc.Selection.Text = Cmd.Name & vbLf
TxtDoc.Selection.Collapse()
End If
Next
End Sub
注解
可以使用对象以 ItemOperations 编程方式打开解决方案和项目或向其添加项。 请注意, ItemOperations 方法仅作用于当前选定的项。
此示例使用 ItemOperations 对象生成一个列出所有可用命令名称的文本文档。
属性
| DTE |
获取顶级扩展性对象。 |
| Parent |
获取对象的直接父对象 ItemOperations 。 |
| PromptToSave |
获取所有未保存的文件并允许用户保存其中的一个或多个。 |
方法
| AddExistingItem(String) |
将现有项添加到当前项目。 |
| AddNewItem(String, String) |
将新项添加到当前项目。 |
| IsFileOpen(String, String) |
指示指定的保存文件当前是否在指定视图中处于打开状态。 |
| Navigate(String, vsNavigateOptions) |
转到给定 URL。 |
| NewFile(String, String, String) |
创建一个文件,如同你在集成开发环境 (IDE) 中调用了 新文件 命令。 |
| OpenFile(String, String) |
打开一个文件,如同你在集成开发环境 (IDE) 中调用了 " 打开文件 " 命令一样。 |