Пример #1
0
        public void Add(WxeStep step)
        {
            ArgumentUtility.CheckNotNull("step", step);

            _steps.Add(step);
            step.SetParentStep(this);
        }
Пример #2
0
        public void Insert(int index, WxeStep step)
        {
            if (_executingStep >= index)
            {
                throw new ArgumentException("Cannot insert step only after the last executed step.", "index");
            }
            ArgumentUtility.CheckNotNull("step", step);

            _steps.Insert(index, step);
            step.SetParentStep(this);
        }
Пример #3
0
 /// <summary>
 /// Gets the first step of the specified type <typeparamref name="T"/>.
 /// </summary>
 /// <typeparam name="T">The type of step to get.</typeparam>
 /// <param name="step">The step from which to start searching for the given step type <typeparamref name="T"/>.</param>
 /// <returns>
 ///   The first <see cref="WxeStep"/> of the specified <typeparamref name="T"/> or <see langword="null"/> if the
 ///   neither the <paramref name="step"/> nor it's parent steps are of a matching type.
 /// </returns>
 protected static T GetStepByType <T> (WxeStep step)
     where T : WxeStep
 {
     for (;
          step != null;
          step = step.ParentStep)
     {
         T expectedStep = step as T;
         if (expectedStep != null)
         {
             return(expectedStep);
         }
     }
     return(null);
 }
Пример #4
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);
        }
Пример #5
0
 /// <summary> Gets the <see cref="WxeFunction"/> for the passed <see cref="WxeStep"/>. </summary>
 /// <include file='..\doc\include\ExecutionEngine\WxeStep.xml' path='WxeStep/GetFunction/*' />
 public static WxeFunction GetFunction(WxeStep step)
 {
     return(WxeStep.GetStepByType <WxeFunction> (step));
 }
Пример #6
0
 public void SetParentStep(WxeStep parentStep)
 {
     ArgumentUtility.CheckNotNull("parentStep", parentStep);
     _parentStep = parentStep;
 }