示例#1
0
        public static WorkflowApplication GetWorkflowApplication(AutomationActivity activity)
        {
            var workflowApplication = new WorkflowApplication(activity)
            {
                Completed = delegate(WorkflowApplicationCompletedEventArgs e)
                {
                    switch (e.CompletionState)
                    {
                        case ActivityInstanceState.Faulted:

                            //Logger.GetInstance().Log().Error("workflow " +
                            //                                 scriptGuid +
                            //                                 " stopped! Error Message:\n"
                            //                                 +
                            //                                 e.TerminationException.
                            //                                     GetType().FullName +
                            //                                 "\n"
                            //                                 +
                            //                                 e.TerminationException.
                            //                                     Message);
                            //Status = "Terminated";
                            break;

                        case ActivityInstanceState.Canceled:

                            //Logger.GetInstance().Log().Warn("workflow " + scriptGuid +
                            //                                " Cancel.");
                            //Status = "Canceled";
                            break;

                            //Logger.GetInstance().Log().Info("workflow " + scriptGuid +
                            //                                " Completed.");
                            //Status = "Completed";
                    }
                },
                Aborted = delegate
                {
                    //Logger.GetInstance().Log().Error("workflow " +
                    //                                 scriptGuid
                    //                                 + " aborted! Error Message:\n"
                    //                                 + e.Reason.GetType().FullName + "\n" +
                    //                                 e.Reason.Message);
                    //Status = "Aborted";
                }
            };
            return workflowApplication;
        }
示例#2
0
        public WorkflowApplication GetWorkflowApplication(AutomationActivity activity)
        {
            var workflowApplication = new WorkflowApplication(activity)
            {
                Completed = delegate(WorkflowApplicationCompletedEventArgs e)
                {
                    switch (e.CompletionState)
                    {
                        case ActivityInstanceState.Faulted:
                            Log.Error("workflow [" + activity.Id + "] " + activity.DisplayName +
                                      " stopped! Error Message:\n" + e.TerminationException.GetType().FullName + "\n" +
                                      e.TerminationException.Message + "\n" + e.TerminationException.StackTrace);
                            Status = "Terminated";
                            ClientInstancesManager.GetInstance().GetComputer(ClientId).Status = "Ready";
                            break;

                        case ActivityInstanceState.Canceled:
                            Log.Error("workflow [" + activity.Id + "] " + activity.DisplayName + " Cancel.");
                            Status = "Canceled";
                            ClientInstancesManager.GetInstance().GetComputer(ClientId).Status = "Ready";
                            break;

                        default:
                            Log.Info("workflow [" + activity.Id + "] " + activity.DisplayName + " Completed.");
                            Status = "Completed";
                            ClientInstancesManager.GetInstance().GetComputer(ClientId).Status = "Ready";
                            break;
                    }
                },
                Aborted = delegate(WorkflowApplicationAbortedEventArgs e)
                {
                    Log.Error(" aborted! Error Message:\n" + e.Reason.GetType().FullName + "\n" + e.Reason.Message);
                    Status = "Aborted";
                    ClientInstancesManager.GetInstance().GetComputer(ClientId).Status = "Ready";
                }
            };
            return workflowApplication;
        }