protected override void Cancel(NativeActivityContext context)
 {
     if (!this.suppressCancel.Get(context))
     {
         context.CancelChildren();
     }
 }
 private void OnWorkItemCanceled(NativeActivityContext context, Bookmark bookmark, object value)
 {
     if (!_suppressCancel.Get(context))
     {
         context.CancelChildren();
     }
 }
 protected override void Cancel(NativeActivityContext context)
 {
     if (!this.state.Get(context).SuppressCancel)
     {
         context.CancelChildren();
     }
 }
Ejemplo n.º 4
0
        private void OnCompleted(NativeActivityContext context, ActivityInstance instance, T newResult)
        {
            bool set = isSet.Get(context);

            if (set)
            {
                T    res = firstResult.Get(context);
                bool equal;
                if (res != null && newResult != null)
                {
                    equal = newResult.Equals(res);
                }
                else
                {
                    equal = false;
                }
                Result.Set(context, equal);

                if (!equal)
                {
                    context.CancelChildren();
                }
            }
            else
            {
                firstResult.Set(context, newResult);
                isSet.Set(context, true);
            }
        }
Ejemplo n.º 5
0
        void OnFinish(NativeActivityContext context, Bookmark bookmark, object o)
        {
            var twilio = context.GetExtension <ITwilioContext>();
            var r      = (NameValueCollection)o;
            var result = r["QueueResult"];
            var sid    = r["QueueSid"];
            var time   = r["QueueTime"];

            // set result values
            if (result != null)
            {
                Result.Set(context, ParseResult(result));
            }
            if (sid != null)
            {
                Sid.Set(context, sid);
            }
            if (time != null)
            {
                Time.Set(context, TimeSpan.FromSeconds(int.Parse(time)));
            }

            // cancel all outstanding activities
            context.RemoveAllBookmarks();
            context.CancelChildren();
        }
Ejemplo n.º 6
0
 private void OnNext(NativeActivityContext context, Bookmark bookmark, object value)
 {
     context.CancelChildren();
     if (value is Bookmark b)
     {
         context.ResumeBookmark(b, value);
     }
 }
Ejemplo n.º 7
0
 private void OnConditionComplete(NativeActivityContext context, ActivityInstance completedInstance, bool result)
 {
     if (result)
     {
         context.CancelChildren();
         _hasCompleted.Set(context, true);
     }
 }
Ejemplo n.º 8
0
 private void OnChildComplete(NativeActivityContext context, ActivityInstance completedInstance, bool result)
 {
     if (result)
     {
         context.CancelChildren();
         this.Result.Set(context, true);
     }
 }
Ejemplo n.º 9
0
        protected override void Cancel(NativeActivityContext context)
        {
            //not required since this is the default behavior. but should
            //get in the habit of adding this code anytime you
            //schedule execution of an activity

            Console.WriteLine("Cancel");
            context.CancelChildren();
        }
Ejemplo n.º 10
0
 protected override void Cancel(NativeActivityContext context)
 {
     Console.WriteLine("Cancel");
     if (context.IsCancellationRequested)
     {
         Console.WriteLine("IsCancellationRequested");
         context.CancelChildren();
     }
 }
Ejemplo n.º 11
0
        protected override void Cancel(NativeActivityContext context)
        {
            bool suppressCancel = this.suppressCancel.Get(context);

            if (!suppressCancel)
            {
                context.CancelChildren();
            }
        }
Ejemplo n.º 12
0
        protected override void Cancel(NativeActivityContext context)
        {
            TryCatchState state = this.state.Get(context);

            if (!state.SuppressCancel)
            {
                context.CancelChildren();
            }
        }
Ejemplo n.º 13
0
        private void OnContinue(NativeActivityContext context, Bookmark bookmark, object value)
        {
            context.CancelChildren();
            Bookmark _bookmark = value as Bookmark;

            if (_bookmark != null)
            {
                context.ResumeBookmark(_bookmark, value);
            }
        }
Ejemplo n.º 14
0
 protected override void Cancel(NativeActivityContext context)
 {
     base.Cancel(context);
     context.CancelChildren();
     if (_bodyError.Get(context) == null)
     {
         context.GetExtension <CriticalSectionQueueExtension>()
         .Exit(_resumeBookmark.Get(context), QueueName.Get(context));
     }
 }
Ejemplo n.º 15
0
        private void OnBreak(NativeActivityContext context, Bookmark bookmark, object value)
        {
            context.CancelChildren();
            breakRequested = true;
            Bookmark _bookmark = value as Bookmark;

            if (_bookmark != null)
            {
                context.ResumeBookmark(_bookmark, value);
            }
        }
Ejemplo n.º 16
0
 protected override void Cancel(NativeActivityContext context)
 {
     if (this.CompletionCondition == null)
     {
         base.Cancel(context);
     }
     else
     {
         context.CancelChildren();
     }
 }
 protected override void Cancel(NativeActivityContext context)
 {
     if (this.CompletionCondition == null)
     {
         base.Cancel(context);
     }
     else
     {
         context.CancelChildren();
     }
 }
Ejemplo n.º 18
0
        /// <summary>
        /// Invoked when digits are available.
        /// </summary>
        /// <param name="context"></param>
        /// <param name="bookmark"></param>
        /// <param name="o"></param>
        void OnFinish(NativeActivityContext context, Bookmark bookmark, object o)
        {
            var r      = (NameValueCollection)o;
            var digits = r["Digits"] ?? "";

            Result.Set(context, digits);
            Digits.Set(context, digits);

            // cancel all children
            context.RemoveAllBookmarks();
            context.CancelChildren();
        }
Ejemplo n.º 19
0
 private void CleanUp(NativeActivityContext context)
 {
     try
     {
         StopMonitoring(context);
     }
     finally
     {
         // Clean-up even if there is an exception in the derived class.
         context.RemoveBookmark(_triggerBookmark);
         context.CancelChildren();
     }
 }
Ejemplo n.º 20
0
        protected override void Cancel(NativeActivityContext context)
        {
            context.CancelChildren();
            var bookmark = bookmarkProgress.Get(context);

            var extension = context.GetExtension <Hosting.FileCopyExtension>();

            extension.Cancel(bookmark.Name);

            this.noPersistHandle.Get(context).Exit(context);
            context.RemoveBookmark(bookmark);
            context.MarkCanceled();
        }
Ejemplo n.º 21
0
 protected override void Cancel(NativeActivityContext context)
 {
     // If we don't have a completion condition then we can just
     // use default logic.
     if (this.CompletionCondition == null)
     {
         base.Cancel(context);
     }
     else
     {
         context.CancelChildren();
     }
 }
Ejemplo n.º 22
0
        private void PrepareForExit(NativeActivityContext context, string targetStateId)
        {
            ReadOnlyCollection <System.Activities.ActivityInstance> children = context.GetChildren();

            base.Result.Set(context, targetStateId);
            this.isExiting.Set(context, true);
            if (children.Count > 0)
            {
                context.CancelChildren();
            }
            else
            {
                this.ScheduleExit(context);
            }
        }
Ejemplo n.º 23
0
        void PrepareForExit(NativeActivityContext context, string targetStateId)
        {
            ReadOnlyCollection<ActivityInstance> children = context.GetChildren();
            this.Result.Set(context, targetStateId);
            this.isExiting.Set(context, true);

            if (children.Count > 0)
            {
                // Cancel all other pending triggers.
                context.CancelChildren();
            }
            else
            {
                this.ScheduleExit(context);
            }
        }
Ejemplo n.º 24
0
        void PrepareForExit(NativeActivityContext context, string targetStateId)
        {
            Debug.Assert(!this.hasRunningChildState.Get(context), "There should not be any running child state.");
            ReadOnlyCollection <ActivityInstance> children = context.GetChildren();

            this.Result.Set(context, targetStateId);
            this.isExiting.Set(context, true);
            if (children.Count > 0)
            {
                // Cancel all other pending triggers.
                context.CancelChildren();
            }
            else
            {
                ScheduleExit(context);
            }
        }
 void OnConditionComplete(NativeActivityContext context, ActivityInstance completedInstance, bool result)
 {
     if (result)
     {
         context.CancelChildren();
         this.hasCompleted.Set(context, true);
     }
     else
     {
         // get the next child and schedule it!
         IEnumerator <T> enumerator = this.valueEnumerator.Get(context);
         if (this.valueEnumerator.Get(context).MoveNext())
         {
             context.ScheduleAction(this.Body, this.valueEnumerator.Get(context).Current, onBodyComplete);
         }
     }
 }
Ejemplo n.º 26
0
        /// <summary>
        /// Invoked when digits are available.
        /// </summary>
        /// <param name="context"></param>
        /// <param name="bookmark"></param>
        /// <param name="o"></param>
        void OnAction(NativeActivityContext context, Bookmark bookmark, object o)
        {
            var r        = (NameValueCollection)o;
            var sid      = r["RecordingSid"];
            var url      = r["RecordingUrl"];
            var duration = r["RecordingDuration"];
            var digits   = r["Digits"];

            Sid.Set(context, sid);
            Url.Set(context, url != null ? new Uri(url, UriKind.RelativeOrAbsolute) : null);
            Duration.Set(context, duration != null ? TimeSpan.FromSeconds(int.Parse(duration)) : TimeSpan.Zero);
            Digits.Set(context, digits);
            Result.Set(context, Url.Get(context));

            // cancel all children
            context.RemoveAllBookmarks();
            context.CancelChildren();
        }
Ejemplo n.º 27
0
        /// <summary>
        /// Invoked when digits are available.
        /// </summary>
        /// <param name="context"></param>
        /// <param name="bookmark"></param>
        /// <param name="o"></param>
        void OnFinish(NativeActivityContext context, Bookmark bookmark, object o)
        {
            var r            = (NameValueCollection)o;
            var status       = r["DialCallStatus"];
            var sid          = r["DialCallSid"];
            var duration     = r["DialCallDuration"];
            var recordingUrl = r["RecordingUrl"];

            // set output arguments
            Result.Set(context, status != null ? ParseCallStatus(status) : DialCallStatus.Unknown);
            Status.Set(context, status != null ? ParseCallStatus(status) : DialCallStatus.Unknown);
            Sid.Set(context, sid);
            Duration.Set(context, duration != null ? TimeSpan.FromSeconds(int.Parse(duration)) : TimeSpan.Zero);
            RecordingUrl.Set(context, recordingUrl != null ? new Uri(recordingUrl) : null);

            // cancel all children
            context.RemoveAllBookmarks();
            context.CancelChildren();
        }
Ejemplo n.º 28
0
        public void Cancel(NativeActivityContext context)
        {
            bool bookmarkResumed = _bookmarkResumed.Get(context);

            if (!bookmarkResumed)
            {
                CancellationTokenSource cancellationTokenSource = _cancellationTokenSource.Get(context);

                cancellationTokenSource.Cancel();
                cancellationTokenSource.Dispose();
            }

            context.MarkCanceled();
            // Overriding the Cancel method inhibits the propagation of cancellation requests to children.
            context.CancelChildren();

            if (!bookmarkResumed)
            {
                _noPersistHandle.Get(context).Exit(context);
            }
        }
Ejemplo n.º 29
0
 protected override void Cancel(NativeActivityContext context)
 {
     context.CancelChildren();
 }
Ejemplo n.º 30
0
 protected override void Cancel(NativeActivityContext context)
 {
     // If we don't have a completion condition then we can just
     // use default logic.
     if (this.CompletionCondition == null)
     {
         base.Cancel(context);
     }
     else
     {
         context.CancelChildren();
     }
 }
Ejemplo n.º 31
0
 void OnConditionComplete(NativeActivityContext context, ActivityInstance completedInstance, bool result)
 {
     if (result)
     {
         context.CancelChildren();
         this.hasCompleted.Set(context, true);
     }
 }
Ejemplo n.º 32
0
        protected override void Cancel(NativeActivityContext context)
        {
            context.CancelChildren();
            var bookmark = bookmarkProgress.Get(context);

            var extension = context.GetExtension<Hosting.FileCopyExtension>();
            extension.Cancel(bookmark.Name);

            this.noPersistHandle.Get(context).Exit(context);
            context.RemoveBookmark(bookmark);
            context.MarkCanceled();
        }
Ejemplo n.º 33
0
 protected void DisposeMonitor(NativeActivityContext context)
 {
     context.RemoveBookmark(this._monitorBookmark);
     context.CancelChildren();
 }
Ejemplo n.º 34
0
 private void OnContinue(NativeActivityContext context, Bookmark bookmark, object value)
 {
     context.CancelChildren();
     context.ScheduleActivity(Condition, ConditionCompletion);
 }
Ejemplo n.º 35
0
 /// <summary>
 /// The on receive completed.
 /// </summary>
 /// <param name="context">
 /// The context.
 /// </param>
 /// <param name="completedInstance">
 /// The completed instance.
 /// </param>
 private void OnReceiveCompleted(
     NativeActivityContext context, ActivityInstance completedInstance)
 {
     // Cancel the remaining children
     context.CancelChildren();
 }
Ejemplo n.º 36
0
 private void OnBreak(NativeActivityContext context, Bookmark bookmark, object value)
 {
     context.CancelChildren();
 }
 protected override void Cancel(NativeActivityContext context)
 {
     context.CancelChildren();
 }