JumpTask 类

定义

表示某应用程序在 Windows 7 任务栏跳转列表中的快捷方式。Represents a shortcut to an application in the Windows 7 taskbar Jump List.

public ref class JumpTask : System::Windows::Shell::JumpItem
public class JumpTask : System.Windows.Shell.JumpItem
type JumpTask = class
    inherit JumpItem
Public Class JumpTask
Inherits JumpItem
继承
JumpTask

示例

下面的示例演示如何JumpTask在标记中声明。The following example shows how to declare a JumpTask in markup. 在记事本应用程序中readme.txt 打开一个名为的文本文件。JumpTaskThe JumpTask opens a text file named readme.txt in the Notepad application.

<JumpTask Title="Read Me" 
          Description="Open readme.txt in Notepad." 
          ApplicationPath="C:\Windows\notepad.exe"
          IconResourcePath="C:\Windows\System32\imageres.dll"
          IconResourceIndex="14"
          WorkingDirectory="C:\Users\Public\Documents"
          Arguments="readme.txt"/>

下面的示例演示如何JumpTask在代码中配置。The following example shows how to configure a JumpTask in code. JumpTask打开计算器应用程序。The JumpTask opens the Calculator application.

// Configure a new JumpTask.
JumpTask jumpTask1 = new JumpTask();
// Get the path to Calculator and set the JumpTask properties.
jumpTask1.ApplicationPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.SystemX86), "calc.exe");
jumpTask1.IconResourcePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.SystemX86), "calc.exe");
jumpTask1.Title = "Calculator";
jumpTask1.Description = "Open Calculator.";
jumpTask1.CustomCategory = "User Added Tasks";

注解

JumpTask可以将视为应用程序的快捷方式。A JumpTask can be thought of as a shortcut to an application. 通过设置ApplicationPath属性来指定可执行文件的路径。You specify the path to the executable file by setting the ApplicationPath property. ApplicationPath如果未设置, 则隐含当前正在运行的进程的路径。If the ApplicationPath is not set, the path of the current running process is implied. 您可以选择指定Arguments在启动时传递到应用程序。You can optionally specify Arguments to pass to the application at startup.

你可以设置基本显示属性, 如TitleDescriptionIconResourcePath , 以指定任务在跳转列表中的外观。You can set basic display properties, such as Title, Description, and IconResourcePath to specify the appearance of the task in the Jump List. 与一起使用的图标JumpTask必须作为本机资源提供。An icon used with a JumpTask must be available as a native resource. 如果 DLL 或可执行文件中有多个图标资源, 则可以通过指示IconResourceIndex属性中的偏移量来指定要使用的图标资源。If multiple icon resources are available in a DLL or executable file, you specify the one to use by indicating an offset in the IconResourceIndex property.

默认情况下, JumpTask将放置在 "跳转列表" 的 "任务" 类别中。By default, a JumpTask will be placed in the Tasks category of the Jump List. 可以通过设置CustomCategory属性来指定自定义任务分组。You can specify custom grouping of tasks by setting the CustomCategory property.

可以通过创建JumpTaskTitle指定和CustomCategory的来直观地分隔跳转列表中的项。You can visually separate items in a Jump List by creating a JumpTask that does not have a Title and CustomCategory specified. 此项JumpTask为空将在跳转列表中显示为水平线。This empty JumpTask will be displayed as a horizontal line in the Jump List. 在这种情况下, 可以设置其他属性, 但它们不会有任何影响。In this case, other properties can be set, but they will not have any effect.

构造函数

JumpTask()

初始化 JumpTask 类的新实例。Initializes a new instance of the JumpTask class.

属性

ApplicationPath

获取或设置应用程序的路径。Gets or sets the path to the application.

Arguments

获取或设置启动时要传递给应用程序的参数。Gets or sets the arguments passed to the application on startup.

CustomCategory

获取或设置在 Windows 7Windows 7 任务栏跳转列表中对 JumpItem 进行分组所依据的类别的名称。Gets or sets the name of the category the JumpItem is grouped with in the Windows 7Windows 7 taskbar Jump List.

(继承自 JumpItem)
Description

获取或设置针对跳转列表中的任务在工具提示中显示的文本。Gets or sets the text displayed in the tooltip for the task in the Jump List.

IconResourceIndex

获取或设置嵌入在资源中的图标的索引,索引从零开始。Gets or sets the zero-based index of an icon embedded in a resource.

IconResourcePath

获取或设置资源的路径,该资源包含要在跳转列表中显示的图标。Gets or sets the path to a resource that contains the icon to display in the Jump List.

Title

获取或设置针对跳转列表中的任务显示的文本。Gets or sets the text displayed for the task in the Jump List.

WorkingDirectory

获取或设置启动时应用程序的工作目录。Gets or sets the working directory of the application on startup.

方法

Equals(Object)

确定指定的对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(继承自 Object)
GetHashCode()

作为默认哈希函数。Serves as the default hash function.

(继承自 Object)
GetType()

获取当前实例的 TypeGets the Type of the current instance.

(继承自 Object)
MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(继承自 Object)
ToString()

返回表示当前对象的字符串。Returns a string that represents the current object.

(继承自 Object)

适用于

另请参阅