Example #1
0
        public void Abort(string Reason)
        {
            if (wfApp == null)
            {
                return;
            }
            var _state = typeof(System.Activities.WorkflowApplication).GetField("state", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance).GetValue(wfApp);

            if (_state.ToString() != "Aborted")
            {
                wfApp.Abort(Reason);
                return;
            }
            hasError     = true;
            isCompleted  = true;
            state        = "aborted";
            Exception    = new Exception(Reason);
            errormessage = Reason;
            Save();
            if (runWatch != null)
            {
                runWatch.Stop();
            }
            OnIdleOrComplete?.Invoke(this, EventArgs.Empty);
        }