TaskbarItemInfo.ProgressState Vlastnost

Definice

Získá nebo nastaví hodnotu, která určuje, jak je indikátor průběhu zobrazen na tlačítku hlavního panelu.

public:
 property System::Windows::Shell::TaskbarItemProgressState ProgressState { System::Windows::Shell::TaskbarItemProgressState get(); void set(System::Windows::Shell::TaskbarItemProgressState value); };
public System.Windows.Shell.TaskbarItemProgressState ProgressState { get; set; }
member this.ProgressState : System.Windows.Shell.TaskbarItemProgressState with get, set
Public Property ProgressState As TaskbarItemProgressState

Hodnota vlastnosti

Hodnota výčtu, která určuje, jak se indikátor průběhu zobrazí na tlačítku hlavního panelu. Výchozí formát je None.

Příklady

Následující příklad ukazuje, jak nastavit ProgressState vlastnost v kódu. Stav se nastavuje v obslužné rutině BackgroundWorker.RunWorkerCompleted události, který označuje, jestli byla úloha na pozadí zastavena uživatelem, ukončena s chybou nebo dokončena normálně. Tento příklad je součástí většího příkladu poskytnutého TaskbarItemInfo pro třídu .

void bw_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
{
    // When the task ends, change the ProgressState and Overlay
    // of the taskbar item to indicate a stopped task.
    if (e.Cancelled == true)
    {
        // The task was stopped by the user. Show the progress indicator
        // in the paused state.
        this.taskBarItemInfo1.ProgressState = TaskbarItemProgressState.Paused;
    }
    else if (e.Error != null)
    {
        // The task ended with an error. Show the progress indicator
        // in the error state.
        this.taskBarItemInfo1.ProgressState = TaskbarItemProgressState.Error;
    }
    else
    {
        // The task completed normally. Remove the progress indicator.
        this.taskBarItemInfo1.ProgressState = TaskbarItemProgressState.None;
    }
    // In all cases, show the 'Stopped' overlay.
    this.taskBarItemInfo1.Overlay = (DrawingImage)this.FindResource("StopImage");
}
Private Sub bw_RunWorkerCompleted(ByVal sender As Object, ByVal e As RunWorkerCompletedEventArgs)
    ' When the task ends, change the ProgressState and Overlay
    ' of the taskbar item to indicate a stopped task.
    If e.Cancelled = True Then
        ' The task was stopped by the user. Show the progress indicator
        ' in the paused state.
        Me.taskBarItemInfo1.ProgressState = TaskbarItemProgressState.Paused
    ElseIf e.Error IsNot Nothing Then
        ' The task ended with an error. Show the progress indicator
        ' in the error state.
        Me.taskBarItemInfo1.ProgressState = TaskbarItemProgressState.Error
    Else
        ' The task completed normally. Remove the progress indicator.
        Me.taskBarItemInfo1.ProgressState = TaskbarItemProgressState.None
        ' In all cases, show the 'Stopped' overlay.
        Me.taskBarItemInfo1.Overlay = Me.FindResource("StopImage")
    End If
End Sub

Poznámky

Průběh dlouhotrvajících úkolů můžete sdělit zobrazením indikátoru průběhu na tlačítku na hlavním panelu windows 7. Barva indikátoru je určena ProgressState vlastností, která obsahuje jednu z hodnot výčtu TaskbarItemProgressState . Pokud je ProgressStateNormal, je indikátor zelený. Když Paused, je indikátor žlutý. Když Error, je indikátor červený. U těchto stavů určuje vlastnost, ProgressValue kolik tlačítka na hlavním panelu je vyplněné indikátorem průběhu. ProgressValue u jiných hodnot je ignorována ProgressState. Indeterminate zobrazuje pulzující zelený indikátor na celém tlačítku na hlavním panelu. Pro Nonese nezobrazuje žádný indikátor.

Následující obrázek znázorňuje indikátor průběhu hlavního panelu ve Normal stavu .

Ukázka informací o položce
Indikátor průběhu hlavního panelu Windows

Platí pro