Bagikan melalui


Delay.Duration Properti

Definisi

Durasi timer yang Delay dibuat aktivitas. Jika durasi diatur ke MaxValue, penundaan tidak terbatas.

public:
 property System::Activities::InArgument<TimeSpan> ^ Duration { System::Activities::InArgument<TimeSpan> ^ get(); void set(System::Activities::InArgument<TimeSpan> ^ value); };
[System.Activities.RequiredArgument]
public System.Activities.InArgument<TimeSpan> Duration { get; set; }
[<System.Activities.RequiredArgument>]
member this.Duration : System.Activities.InArgument<TimeSpan> with get, set
Public Property Duration As InArgument(Of TimeSpan)

Nilai Properti

Durasi timer.

Atribut

Contoh

Sampel kode berikut menunjukkan penggunaan Durasi dalam Delay aktivitas. Contoh ini berasal dari sampel Menggunakan Aktivitas Pilih .

static Activity CreateWF()
{
    Variable<string> name = new Variable<string>();
    Sequence body = new Sequence
    {
        Variables = { name },
        Activities =
        {
            new WriteLine { Text = "What is your name? (You have 5 seconds to answer)" },
            new Pick
            {
               Branches =
               {
                   new PickBranch
                    {
                       Trigger = new ReadString
                       {
                           Result = name,
                           BookmarkName = bookmarkName
                       },
                       Action = new WriteLine
                       {
                           Text = new InArgument<string>(env => "Hello " + name.Get(env))
                       }
                   },
                   new PickBranch
                    {
                       Trigger = new Delay
                       {
                           Duration = TimeSpan.FromSeconds(5)
                       },
                       Action = new WriteLine
                       {
                           Text = "Time is up."
                       }
                   }
               }
           }
       }
    };

    return body;
}

Berlaku untuk