コード例 #1
0
        public override void Execute(WxeContext context)
        {
            ArgumentUtility.CheckNotNull("context", context);

            if (_wxeHandler != null)
            {
                context.HttpContext.Handler = _wxeHandler;
                _wxeHandler = null;
            }

            if (!_isExecutionStarted)
            {
                _isExecutionStarted = true;
                _isPostBack         = false;
            }
            else
            {
                _isPostBack = true;
            }

            _userControlExecutor.Execute(context);

            try
            {
                PageStep.PageExecutor.ExecutePage(context, PageStep.Page, PageStep.IsPostBack);
            }
            finally
            {
                if (_userControlExecutor.IsReturningPostBack)
                {
                    _userControlExecutor = NullUserControlExecutor.Null;
                }
            }
        }
コード例 #2
0
        public void ExecuteFunctionExternalByRedirect(PreProcessingSubFunctionStateParameters parameters, WxeReturnOptions returnOptions)
        {
            ArgumentUtility.CheckNotNull("parameters", parameters);
            ArgumentUtility.CheckNotNull("returnOptions", returnOptions);

            if (_executionState.IsExecuting)
            {
                throw new InvalidOperationException("Cannot execute function while another function executes.");
            }

            _wxeHandler = parameters.Page.WxeHandler;

            _executionState = new ExecuteByRedirect_PreProcessingSubFunctionState(this, parameters, returnOptions);
            Execute();
        }
コード例 #3
0
        public virtual void Initialize(HttpContext context)
        {
            if (ControlHelper.IsDesignMode(_control))
            {
                return;
            }
            ArgumentUtility.CheckNotNull("context", context);

            if (_control is Page)
            {
                _wxeHandler = context.Handler as WxeHandler;
            }
            else
            {
                IWxePage wxePage = _control.Page as IWxePage;
                if (wxePage == null)
                {
                    throw new InvalidOperationException(string.Format("'{0}' can only be added to a Page implementing the IWxePage interface.", _control.GetType().FullName));
                }
                _wxeHandler = wxePage.WxeHandler;
            }
            if (_wxeHandler == null)
            {
                throw new HttpException(string.Format("No current WxeHandler found. Most likely cause of the exception: "
                                                      + "The page '{0}' has been called directly instead of using a WXE Handler to invoke the associated WXE Function.",
                                                      _control.Page.GetType()));
            }


            WxeStep executingStep = _wxeHandler.RootFunction.ExecutingStep;

            if (executingStep is WxeUserControlStep)
            {
                _currentUserControlStep     = (WxeUserControlStep)executingStep;
                _currentUserControlFunction = WxeStep.GetFunction(_currentUserControlStep);
                _currentPageStep            = _currentUserControlStep.PageStep;
            }
            else
            {
                _currentUserControlStep     = null;
                _currentUserControlFunction = null;
                _currentPageStep            = (WxePageStep)executingStep;
            }

            _currentPageFunction = WxeStep.GetFunction(_currentPageStep);
        }
コード例 #4
0
        /// <summary>
        ///   Displays the <see cref="WxePageStep"/>'s page or the sub-function that has been invoked by the
        ///   <see cref="ExecuteFunction(Infrastructure.WxePageStepExecutionStates.PreProcessingSubFunctionStateParameters,Infrastructure.WxeRepostOptions)"/> method.
        /// </summary>
        /// <include file='..\doc\include\ExecutionEngine\WxePageStep.xml' path='WxePageStep/Execute/*' />
        public override void Execute(WxeContext context)
        {
            ArgumentUtility.CheckNotNull("context", context);

            if (_wxeHandler != null)
            {
                context.HttpContext.Handler = _wxeHandler;
                _wxeHandler = null;
            }

            if (!_isExecutionStarted)
            {
                _isExecutionStarted = true;
                _isPostBack         = false;
            }
            else
            {
                _isPostBack = true;
            }

            ClearIsOutOfSequencePostBack();
            ClearReturnState();

            while (_executionState.IsExecuting)
            {
                _executionState.ExecuteSubFunction(context);
            }

            _userControlExecutor.Execute(context);

            try
            {
                _pageExecutor.ExecutePage(context, Page, _isPostBack);
            }
            finally
            {
                if (_userControlExecutor.IsReturningPostBack)
                {
                    _userControlExecutor = NullUserControlExecutor.Null;
                }

                ClearIsOutOfSequencePostBack();
                ClearReturnState();
            }
        }
コード例 #5
0
        public void ExecuteFunction(WxeUserControl userControl, WxeFunction subFunction, Control sender, bool usesEventTarget)
        {
            ArgumentUtility.CheckNotNull("userControl", userControl);
            ArgumentUtility.CheckNotNull("subFunction", subFunction);
            ArgumentUtility.CheckNotNull("sender", sender);

            IWxePage wxePage = userControl.WxePage;

            _wxeHandler = wxePage.WxeHandler;

            _userControlExecutor = new UserControlExecutor(this, userControl, subFunction, sender, usesEventTarget);

            IReplaceableControl replaceableControl = userControl;

            replaceableControl.Replacer.Controls.Clear();
            wxePage.SaveAllState();

            Execute();
        }