public static ClassWithAllDataTypes Call(IWxePage page, WxeUserControl userControl, Control sender, ITransactionMode transactionMode, ClassWithAllDataTypes inParameter) { ArgumentUtility.CheckNotNull("page", page); ArgumentUtility.CheckNotNull("userControl", userControl); ArgumentUtility.CheckNotNull("sender", sender); if (page.IsReturningPostBack == false) { var function = new ShowSecondUserControlFunction(transactionMode, inParameter); function.ExceptionHandler.SetCatchExceptionTypes(typeof(System.Exception)); var actualUserControl = (WxeUserControl)page.FindControl(userControl.PermanentUniqueID); Assertion.IsNotNull(actualUserControl); actualUserControl.ExecuteFunction(function, sender, null); throw new Exception("(Unreachable code)"); } else { var function = (ShowSecondUserControlFunction)page.ReturningFunction; if (function.ExceptionHandler.Exception != null) { throw function.ExceptionHandler.Exception; } return(function.ReturnedObjectWithAllDataTypes); } }
/// <summary> Executes the <see cref="WxeFunction"/> defined by the <see cref="WxeFunctionCommandInfo"/>. </summary> /// <param name="wxePage"> /// The <see cref="IWxePage"/> where this command is rendered on. Must not be <see langword="null"/>. /// </param> /// <param name="additionalWxeParameters"> /// The parameters passed to the <see cref="WxeFunction"/> in addition to the executing function's variables. /// Use <see langword="null"/> or an empty collection if all parameters are supplied by the /// <see cref="WxeFunctionCommandInfo.Parameters"/> string and the function stack. /// </param> /// <exception cref="InvalidOperationException"> /// <para> /// Thrown if called while the <see cref="Type"/> is not set to <see cref="CommandType.WxeFunction"/>. /// </para><para> /// Thrown if neither the <see cref="WxeFunctionCommandInfo.MappingID"/> nor the /// <see cref="WxeFunctionCommandInfo.TypeName"/> are set. /// </para><para> /// Thrown if the <see cref="WxeFunctionCommandInfo.MappingID"/> and <see cref="WxeFunctionCommandInfo.TypeName"/> /// specify different functions. /// </para> /// </exception> public virtual void ExecuteWxeFunction(IWxePage wxePage, NameObjectCollection additionalWxeParameters) { ArgumentUtility.CheckNotNull("wxePage", wxePage); if (Type != CommandType.WxeFunction) { throw new InvalidOperationException("Call to ExecuteWxeFunction not allowed unless Type is set to CommandType.WxeFunction."); } if (!wxePage.IsReturningPostBack) { string target = WxeFunctionCommand.Target; bool hasTarget = !string.IsNullOrEmpty(target); WxeFunction function = WxeFunctionCommand.InitializeFunction(additionalWxeParameters); IWxeCallArguments callArguments; if (hasTarget) { callArguments = new WxeCallArguments((Control)OwnerControl, new WxeCallOptionsExternal(target, null, false)); } else { callArguments = WxeCallArguments.Default; } try { wxePage.ExecuteFunction(function, callArguments); } catch (WxeCallExternalException) { } } }
public void SetUp() { _mockRepository = new MockRepository(); _rootFunction = new TestFunction(); _subFunction = _mockRepository.PartialMock <TestFunction>(); _httpContextMock = _mockRepository.DynamicMock <HttpContextBase>(); _pageExecutorMock = _mockRepository.StrictMock <IWxePageExecutor>(); _functionState = new WxeFunctionState(_rootFunction, true); _pageStep = _mockRepository.PartialMock <WxePageStep> ("ThePage"); _pageStep.SetPageExecutor(_pageExecutorMock); _pageMock = _mockRepository.DynamicMock <IWxePage>(); _postBackCollection = new NameValueCollection { { "Key", "Value" } }; _wxeHandler = new WxeHandler(); UrlMappingConfiguration.Current.Mappings.Add(new UrlMappingEntry(_rootFunction.GetType(), "~/root.wxe")); UrlMappingConfiguration.Current.Mappings.Add(new UrlMappingEntry(_subFunction.GetType(), "~/sub.wxe")); _functionStateManager = new WxeFunctionStateManager(new FakeHttpSessionStateBase()); _wxeContext = new WxeContext(_httpContextMock, _functionStateManager, _functionState, new NameValueCollection()); }
/// <summary> Executes the <paramref name="function"/> in the current window. </summary> /// <include file='..\..\doc\include\ExecutionEngine\WxePageExtensions.xml' path='WxePageExtensions/ExecuteFunction/param[@name="page" or @name="function" or @name="createPermaUrl" or @name="useParentPermaUrl" or @name="permaUrlParameters"]' /> public static void ExecuteFunction( this IWxePage page, WxeFunction function, bool createPermaUrl, bool useParentPermaUrl, NameValueCollection permaUrlParameters) { var permaUrlOptions = CreatePermaUrlOptions(createPermaUrl, useParentPermaUrl, permaUrlParameters); var arguments = new WxeCallArgumentsWithoutSender(permaUrlOptions); Execute(page, function, arguments); }
public static void foo() { WxeArgument <List <int[, ][]> > list = null; IWxePage page = null; Call(page, "", list, (WxeArgument <string>)null); Call(page, "", new List <int[, ][]>(), ""); }
/// <summary>Executes the <paramref name="function"/> in the current window without triggering the current post-back event on returning.</summary> /// <remarks>This overload tries to determine automatically whether the current event was caused by the <c>__EVENTTARGET</c> field.</remarks> /// <include file='..\..\doc\include\ExecutionEngine\WxePageExtensions.xml' path='WxePageExtensions/ExecuteFunctionNoRepost/param[@name="page" or @name="function" or @name="sender" or @name="createPermaUrl" or @name="useParentPermaUrl" or @name="permaUrlParameters"]' /> public static void ExecuteFunctionNoRepost( this IWxePage page, WxeFunction function, Control sender, bool createPermaUrl, bool useParentPermaUrl, NameValueCollection permaUrlParameters) { var permaUrlOptions = CreatePermaUrlOptions(createPermaUrl, useParentPermaUrl, permaUrlParameters); var options = new WxeCallOptionsNoRepost(permaUrlOptions); var arguments = new WxeCallArguments(sender, options); Execute(page, function, arguments); }
/// <summary> /// Executes the <see cref="WxeFunction"/> defined by the <see cref="WxeFunctionCommand"/>. /// </summary> /// <param name="wxePage"> The <see cref="IWxePage"/> where this command is rendered on. </param> /// <param name="listIndices"> /// The array of indices for the <see cref="IBusinessObject"/> instances on which the rendered /// command is applied on. /// </param> /// <param name="businessObjects"> /// The array of <see cref="IBusinessObject"/> instances on which the rendered command is applied on. /// </param> public void ExecuteWxeFunction(IWxePage wxePage, int[] listIndices, IBusinessObject[] businessObjects) { ArgumentUtility.CheckNotNull("wxePage", wxePage); if (!wxePage.IsReturningPostBack) { NameObjectCollection parameters = PrepareWxeFunctionParameters(listIndices, businessObjects); ExecuteWxeFunction(wxePage, parameters); } }
public PreProcessingSubFunctionStateParameters(IWxePage page, WxeFunction subFunction, WxePermaUrlOptions permaUrlOptions) { ArgumentUtility.CheckNotNull("page", page); ArgumentUtility.CheckNotNull("subFunction", subFunction); ArgumentUtility.CheckNotNull("permaUrlOptions", permaUrlOptions); _page = page; _subFunction = subFunction; _permaUrlOptions = permaUrlOptions; }
private static void Execute(IWxePage page, WxeFunction function, IWxeCallArguments arguments) { try { page.ExecuteFunction(function, arguments); } catch (WxeCallExternalException) { } }
public static void ExecuteFunctionExternal( this IWxePage page, WxeFunction function, bool createPermaUrl, bool useParentPermaUrl, NameValueCollection urlParameters, bool returnToCaller, NameValueCollection callerUrlParameters) { throw new NotSupportedException("ExecuteFunctionExternal for redirects requires a sender to be specified. (1.13.180)"); }
public WxeExecutor(HttpContext context, IWxePage page, WxePageInfo wxePageInfo) { ArgumentUtility.CheckNotNull("context", context); ArgumentUtility.CheckNotNull("page", page); ArgumentUtility.CheckNotNull("wxePageInfo", wxePageInfo); _wxePageInfo = wxePageInfo; _page = page; _httpContext = context; _httpContext.Handler = page; }
/// <summary> /// Executes a <see cref="WxeFunction"/> outside the current function's context (i.e. asynchron) using the /// specified window or frame through javascript window.open(...). /// </summary> /// <include file='..\..\doc\include\ExecutionEngine\WxePageExtensions.xml' path='WxePageExtensions/ExecuteFunctionExternal/param[@name="page" or @name="function" or @name="target" or @name="features" or @name="sender" or @name="returningPostback" or @name="createPermaUrl" or @name="useParentPermaUrl"]' /> public static void ExecuteFunctionExternal( this IWxePage page, WxeFunction function, string target, string features, Control sender, bool returningPostback, bool createPermaUrl, bool useParentPermaUrl) { ExecuteFunctionExternal(page, function, target, features, sender, returningPostback, createPermaUrl, useParentPermaUrl, null); }
/// <summary> /// Executes a <see cref="WxeFunction"/> outside the current function's context (i.e. asynchron) using the /// specified window or frame through javascript window.open(...). /// </summary> /// <include file='..\..\doc\include\ExecutionEngine\WxePageExtensions.xml' path='WxePageExtensions/ExecuteFunctionExternal/param[@name="page" or @name="function" or @name="target" or @name="sender" or @name="returningPostback" or @name="createPermaUrl" or @name="useParentPermaUrl" or @name="urlParameters"]' /> public static void ExecuteFunctionExternal( this IWxePage page, WxeFunction function, string target, Control sender, bool returningPostback, bool createPermaUrl, bool useParentPermaUrl, NameValueCollection urlParameters) { ExecuteFunctionExternal(page, function, target, null, sender, returningPostback, createPermaUrl, useParentPermaUrl, urlParameters); }
public override void SetUp() { base.SetUp(); _parentStep = new WxePageStep("page.aspx"); ExecutionStateContextMock.Stub(stub => stub.CurrentStep).Return(_parentStep).Repeat.Any(); _pageMock = MockRepository.StrictMock <IWxePage>(); PostBackCollection.Add("Key", "Value"); PostBackCollection.Add(c_senderUniqueID, "Value"); PostBackCollection.Add(ControlHelper.PostEventSourceID, "TheEventSource"); PostBackCollection.Add(ControlHelper.PostEventArgumentID, "TheEventArgument"); }
/// <summary> /// Executes a <see cref="WxeFunction"/> outside the current function's context (i.e. asynchron) using the /// current window or frame. The execution engine uses a redirect request to transfer the execution to the new function. /// </summary> /// <include file='..\..\doc\include\ExecutionEngine\WxePageExtensions.xml' path='WxePageExtensions/ExecuteFunctionExternal/param[@name="page" or @name="function" or @name="sender" or @name="createPermaUrl" or @name="useParentPermaUrl" or @name="urlParameters" or @name="returnToCaller" or @name="callerUrlParameters"]' /> public static void ExecuteFunctionExternal( this IWxePage page, WxeFunction function, Control sender, bool createPermaUrl, bool useParentPermaUrl, NameValueCollection urlParameters, bool returnToCaller, NameValueCollection callerUrlParameters) { var permaUrlOptions = CreatePermaUrlOptions((createPermaUrl || urlParameters != null), useParentPermaUrl, urlParameters); var options = new WxeCallOptionsExternalByRedirect(permaUrlOptions, returnToCaller, callerUrlParameters); var arguments = new WxeCallArguments(sender, options); Execute(page, function, arguments); }
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); }
/// <summary> /// Executes a <see cref="WxeFunction"/> outside the current function's context (i.e. asynchron) using the /// specified window or frame through javascript window.open(...). /// </summary> /// <include file='..\..\doc\include\ExecutionEngine\WxePageExtensions.xml' path='WxePageExtensions/ExecuteFunctionExternal/param[@name="page" or @name="function" or @name="target" or @name="features" or @name="sender" or @name="returningPostback" or @name="createPermaUrl" or @name="useParentPermaUrl" or @name="urlParameters"]' /> public static void ExecuteFunctionExternal( this IWxePage page, WxeFunction function, string target, string features, Control sender, bool returningPostback, bool createPermaUrl, bool useParentPermaUrl, NameValueCollection urlParameters) { var permaUrlOptions = CreatePermaUrlOptions(createPermaUrl, useParentPermaUrl, urlParameters); var options = new WxeCallOptionsExternal(target, features, returningPostback, permaUrlOptions); var arguments = new WxeCallArguments(sender, options); Execute(page, function, arguments); }
public void SetUp() { _mockRepository = new MockRepository(); _rootFunction = new TestFunction(); PrivateInvoke.InvokeNonPublicMethod(_rootFunction, "SetFunctionToken", "RootFunction"); _subFunction = _mockRepository.PartialMock <TestFunction>(); _httpContextMock = _mockRepository.DynamicMock <HttpContextBase>(); _pageExecutorMock = _mockRepository.StrictMock <IWxePageExecutor>(); _functionState = new WxeFunctionState(_rootFunction, true); _pageStep = _mockRepository.PartialMock <WxePageStep> ("ThePage"); _pageStep.SetPageExecutor(_pageExecutorMock); _rootFunction.Add(_pageStep); _pageMock = _mockRepository.DynamicMock <IWxePage>(); _postBackCollection = new NameValueCollection { { "Key", "Value" } }; _wxeHandler = new WxeHandler(); UrlMappingConfiguration.Current.Mappings.Add(new UrlMappingEntry(_rootFunction.GetType(), "~/root.wxe")); UrlMappingConfiguration.Current.Mappings.Add(new UrlMappingEntry(_subFunction.GetType(), "~/sub.wxe")); _functionStateManager = new WxeFunctionStateManager(new FakeHttpSessionStateBase()); Uri uri = new Uri("http://localhost/root.wxe"); _responseMock = _mockRepository.StrictMock <HttpResponseBase>(); _responseMock.Stub(stub => stub.ApplyAppPathModifier("~/sub.wxe")).Return("/session/sub.wxe").Repeat.Any(); _responseMock.Stub(stub => stub.ApplyAppPathModifier("/session/sub.wxe")).Return("/session/sub.wxe").Repeat.Any(); _responseMock.Stub(stub => stub.ApplyAppPathModifier("~/root.wxe")).Return("/session/root.wxe").Repeat.Any(); _responseMock.Stub(stub => stub.ApplyAppPathModifier("/session/root.wxe")).Return("/session/root.wxe").Repeat.Any(); _responseMock.Stub(stub => stub.ContentEncoding).Return(Encoding.Default).Repeat.Any(); _httpContextMock.Stub(stub => stub.Response).Return(_responseMock).Repeat.Any(); _requestMock = _mockRepository.StrictMock <HttpRequestBase>(); _requestMock.Stub(stub => stub.Url).Return(uri).Repeat.Any(); _httpContextMock.Stub(stub => stub.Request).Return(_requestMock).Repeat.Any(); _wxeContext = new WxeContext(_httpContextMock, _functionStateManager, _functionState, new NameValueCollection()); WxeContextMock.SetCurrent(_wxeContext); }
public void SetUp() { _mockRepository = new MockRepository(); _rootFunction = new TestFunction(); _subFunction = _mockRepository.PartialMock <TestFunction>(); _httpContextMock = _mockRepository.DynamicMock <HttpContextBase>(); _functionState = new WxeFunctionState(_rootFunction, true); _pageStep = _mockRepository.PartialMock <WxePageStep> ("ThePage"); _pageMock = _mockRepository.DynamicMock <IWxePage>(); _wxeHandler = new WxeHandler(); _functionStateManager = new WxeFunctionStateManager(new FakeHttpSessionStateBase()); _wxeContext = new WxeContext(_httpContextMock, _functionStateManager, _functionState, new NameValueCollection()); }
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(); }
/// <summary> Initializes a new instance of the <b>WxePageInfo</b> type. </summary> /// <param name="page"> /// The <see cref="IWxePage"/> containing this <b>WxePageInfo</b> object. /// The page must be derived from <see cref="System.Web.UI.Page">System.Web.UI.Page</see>. /// </param> public WxePageInfo(IWxePage page) : base(page) { ArgumentUtility.CheckNotNull("page", page); _page = page; }
public static void Call(IWxePage page, string input, List <int[, ][]> other, string ReturnValue) { }
public static void Call(IWxePage page, WxeArgument <string> input, WxeArgument <List <int[, ][]> > other, WxeArgument <string> ReturnValue) { }
/// <summary> /// Executes a <see cref="WxeFunction"/> outside the current function's context (i.e. asynchron) using the /// current window or frame. The execution engine uses a redirect request to transfer the execution to the new function. /// </summary> /// <include file='..\..\doc\include\ExecutionEngine\WxePageExtensions.xml' path='WxePageExtensions/ExecuteFunctionExternal/param[@name="page" or @name="function" or @name="sender" or @name="createPermaUrl" or @name="useParentPermaUrl" or @name="urlParameters"]' /> public static void ExecuteFunctionExternal( this IWxePage page, WxeFunction function, Control sender, bool createPermaUrl, bool useParentPermaUrl, NameValueCollection urlParameters) { ExecuteFunctionExternal(page, function, sender, createPermaUrl, useParentPermaUrl, urlParameters, true, null); }
/// <summary>Executes the <paramref name="function"/> in the current window without triggering the current post-back event on returning.</summary> /// <remarks> /// This overload allows you to specify whether the current event was caused by the <c>__EVENTTARGET</c> field. /// When in doubt, use <see cref="M:Remotion.Web.ExecutionEngine.Obsolete.WxePageExtensions.ExecuteFunctionNoRepost(Remotion.Web.ExecutionEngine.IWxePage,Remotion.Web.ExecutionEngine.WxeFunction,System.Web.UI.Control,System.Boolean,System.Boolean)">WxePageExtensions.ExecuteFunctionNoRepost(IWxePage,WxeFunction,Control,Boolean,Boolean)</see>. /// </remarks> /// <include file='..\..\doc\include\ExecutionEngine\WxePageExtensions.xml' path='WxePageExtensions/ExecuteFunctionNoRepost/param[@name="page" or @name="function" or @name="sender" or @name="usesEventTarget" or @name="createPermaUrl" or @name="useParentPermaUrl"]' /> public static void ExecuteFunctionNoRepost( this IWxePage page, WxeFunction function, Control sender, bool usesEventTarget, bool createPermaUrl, bool useParentPermaUrl) { ExecuteFunctionNoRepost(page, function, sender, usesEventTarget, createPermaUrl, useParentPermaUrl, null); }
/// <summary>Executes the <paramref name="function"/> in the current window without triggering the current post-back event on returning.</summary> /// <remarks> /// This overload allows you to specify whether the current event was caused by the <c>__EVENTTARGET</c> field. /// When in doubt, use <see cref="M:Remotion.Web.ExecutionEngine.Obsolete.WxePageExtensions.ExecuteFunctionNoRepost(Remotion.Web.ExecutionEngine.IWxePage,Remotion.Web.ExecutionEngine.WxeFunction,System.Web.UI.Control)">WxePageExtensions.ExecuteFunctionNoRepost(IWxePage,WxeFunction,Control)</see>. /// </remarks> /// <include file='..\..\doc\include\ExecutionEngine\WxePageExtensions.xml' path='WxePageExtensions/ExecuteFunctionNoRepost/param[@name="page" or @name="function" or @name="sender" or @name="usesEventTarget"]' /> public static void ExecuteFunctionNoRepost(this IWxePage page, WxeFunction function, Control sender, bool usesEventTarget) { ExecuteFunctionNoRepost(page, function, sender, usesEventTarget, false, false, null); }
/// <summary>Executes the <paramref name="function"/> in the current window without triggering the current post-back event on returning.</summary> /// <remarks>This overload tries to determine automatically whether the current event was caused by the <c>__EVENTTARGET</c> field.</remarks> /// <include file='..\..\doc\include\ExecutionEngine\WxePageExtensions.xml' path='WxePageExtensions/ExecuteFunctionNoRepost/param[@name="page" or @name="function" or @name="sender"]' /> public static void ExecuteFunctionNoRepost(this IWxePage page, WxeFunction function, Control sender) { ExecuteFunctionNoRepost(page, function, sender, false, false, null); }
/// <summary> /// Executes a <see cref="WxeFunction"/> outside the current function's context (i.e. asynchron) using the /// specified window or frame through javascript window.open(...). /// </summary> /// <include file='..\..\doc\include\ExecutionEngine\WxePageExtensions.xml' path='WxePageExtensions/ExecuteFunctionExternal/param[@name="page" or @name="function" or @name="target" or @name="features" or @name="sender" or @name="returningPostback"]' /> public static void ExecuteFunctionExternal( this IWxePage page, WxeFunction function, string target, string features, Control sender, bool returningPostback) { ExecuteFunctionExternal(page, function, target, features, sender, returningPostback, false, false, null); }
/// <summary> Executes the <paramref name="function"/> in the current window. </summary> /// <include file='..\..\doc\include\ExecutionEngine\WxePageExtensions.xml' path='WxePageExtensions/ExecuteFunction/param[@name="page" or @name="function" or @name="createPermaUrl" or @name="useParentPermaUrl"]' /> public static void ExecuteFunction(this IWxePage page, WxeFunction function, bool createPermaUrl, bool useParentPermaUrl) { ExecuteFunction(page, function, createPermaUrl, useParentPermaUrl, null); }
/// <summary> Executes the <paramref name="function"/> in the current window. </summary> /// <include file='..\..\doc\include\ExecutionEngine\WxePageExtensions.xml' path='WxePageExtensions/ExecuteFunction/param[@name="page" or @name="function"]' /> public static void ExecuteFunction(this IWxePage page, WxeFunction function) { ExecuteFunction(page, function, false, false, null); }