Esempio n. 1
0
        private void VerifyWorkflowCanBeChanged(IWorkflowCoreRuntime workflowCoreRuntime)
        {
            ActivityCondition condition = workflowCoreRuntime.RootActivity.GetValue(ConditionProperty) as ActivityCondition;

            if (condition != null)
            {
                using (workflowCoreRuntime.SetCurrentActivity(workflowCoreRuntime.RootActivity))
                {
                    if (!condition.Evaluate(workflowCoreRuntime.RootActivity, workflowCoreRuntime))
                    {
                        throw new InvalidOperationException(SR.GetString(CultureInfo.CurrentCulture, "Error_DynamicUpdateEvaluation", new object[] { workflowCoreRuntime.InstanceID.ToString() }));
                    }
                }
            }
        }
Esempio n. 2
0
        private void VerifyWorkflowCanBeChanged(IWorkflowCoreRuntime workflowCoreRuntime)
        {
            // check if the update is allowed on this root-activity.
            ActivityCondition dynamicUpdateCondition = ((Activity)workflowCoreRuntime.RootActivity).GetValue(WorkflowChanges.ConditionProperty) as ActivityCondition;

            if (dynamicUpdateCondition != null)
            {
                using (workflowCoreRuntime.SetCurrentActivity(workflowCoreRuntime.RootActivity))
                {
                    if (!dynamicUpdateCondition.Evaluate(workflowCoreRuntime.RootActivity, workflowCoreRuntime))
                    {
                        throw new InvalidOperationException(SR.GetString(CultureInfo.CurrentCulture, SR.Error_DynamicUpdateEvaluation, new object[] { workflowCoreRuntime.InstanceID.ToString() }));
                    }
                }
            }
        }