コード例 #1
0
        internal void InitializeActivity(Activity activity)
        {
            if (this.currentActivity == null)
            {
                throw new ObjectDisposedException("ActivityExecutionContext");
            }

            if (activity == null)
            {
                throw new ArgumentNullException("activity");
            }

            if (!IsValidChild(activity, false))
            {
                throw new ArgumentException(SR.GetString(SR.AEC_InvalidActivity), "activity");
            }

            if (activity.ExecutionStatus != ActivityExecutionStatus.Initialized)
            {
                throw new InvalidOperationException(SR.GetString(SR.Error_InvalidInitializingState));
            }

            using (ActivityExecutionContext executionContext = new ActivityExecutionContext(activity))
            {
                using (this.currentActivity.WorkflowCoreRuntime.SetCurrentActivity(activity))
                    activity.Initialize(executionContext);
            }
        }