Editar

Partilhar via


JumpList.GetJumpList(Application) Method

Definition

Returns the JumpList object associated with an application.

public:
 static System::Windows::Shell::JumpList ^ GetJumpList(System::Windows::Application ^ application);
public static System.Windows.Shell.JumpList GetJumpList (System.Windows.Application application);
static member GetJumpList : System.Windows.Application -> System.Windows.Shell.JumpList
Public Shared Function GetJumpList (application As Application) As JumpList

Parameters

application
Application

The application associated with the JumpList.

Returns

The JumpList object associated with the specified application.

Examples

The following example shows how to get the JumpList associated with the current application. A JumpTask is added to the JumpItems collection and added to the Recent category. The Apply method is called to apply the updated JumpList to the Windows shell. This example is part of a larger example available in the JumpList class overview.

private void AddTask(object sender, RoutedEventArgs e)
{
    // 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";
    // Get the JumpList from the application and update it.
    JumpList jumpList1 = JumpList.GetJumpList(App.Current);
    jumpList1.JumpItems.Add(jumpTask1);
    JumpList.AddToRecentCategory(jumpTask1);
    jumpList1.Apply();
}

Remarks

You can call the GetJumpList method to get the JumpList currently associated with an Application. The .NET Framework does not require that this be the JumpList that is currently applied to the Windows shell.

Applies to