示例#1
0
        protected override void Execute(NativeActivityContext context)
        {
            TimeSpan actualValue = this.Duration.Get(context);

            if (actualValue < TimeSpan.Zero)
            {
                throw FxTrace.Exception.ArgumentOutOfRange("Duration", actualValue, System.Activities.SR.DurationIsNegative(base.DisplayName));
            }
            if (actualValue != TimeSpan.Zero)
            {
                TimerExtension timerExtension = this.GetTimerExtension(context);
                Bookmark       bookmark       = context.CreateBookmark();
                timerExtension.RegisterTimer(actualValue, bookmark);
                this.timerBookmark.Set(context, bookmark);
            }
        }
示例#2
0
        protected override void Execute(NativeActivityContext context)
        {
            TimeSpan duration = this.Duration.Get(context);

            if (duration < TimeSpan.Zero)
            {
                throw FxTrace.Exception.ArgumentOutOfRange("Duration", duration, SR.DurationIsNegative(this.DisplayName));
            }

            if (duration == TimeSpan.Zero)
            {
                return;
            }

            TimerExtension timerExtension = GetTimerExtension(context);
            Bookmark       bookmark       = context.CreateBookmark();

            timerExtension.RegisterTimer(duration, bookmark);
            this.timerBookmark.Set(context, bookmark);
        }