void IWxeCallArguments.Dispatch(IWxeExecutor executor, WxeFunction function) { ArgumentUtility.CheckNotNull("executor", executor); ArgumentUtility.CheckNotNull("function", function); executor.ExecuteFunction(function, null, new WxeCallOptions(_permaUrlOptions)); }
/// <summary>Executes the <paramref name="function"/> using the specified <paramref name="callArguments"/>.</summary> /// <param name="function">The <see cref="WxeFunction"/> to be executed. Must not be <see langword="null" />.</param> /// <param name="callArguments">The <see cref="IWxeCallArguments"/> used to control the function invocation. Must not be <see langword="null" />.</param> public void ExecuteFunction(WxeFunction function, IWxeCallArguments callArguments) { ArgumentUtility.CheckNotNull("function", function); ArgumentUtility.CheckNotNull("callArguments", callArguments); callArguments.Dispatch(_wxePageInfo.Executor, function); }
void IWxeCallArguments.Dispatch(IWxeExecutor executor, WxeFunction function) { ArgumentUtility.CheckNotNull("executor", executor); ArgumentUtility.CheckNotNull("function", function); _options.Dispatch(executor, function, _sender); }
public WxeFunctionState(WxeFunction function, bool enableCleanUp) : this( function, WebConfiguration.Current.ExecutionEngine.FunctionTimeout, enableCleanUp) { }
/// <summary> Gets the URL to be used for transfering to the external function. </summary> internal string GetDestinationUrlForExternalFunction(WxeFunction function, string functionToken, WxePermaUrlOptions permaUrlOptions) { string href; if (permaUrlOptions.UsePermaUrl) { NameValueCollection internalUrlParameters; if (permaUrlOptions.UrlParameters == null) { internalUrlParameters = function.VariablesContainer.SerializeParametersForQueryString(); } else { internalUrlParameters = permaUrlOptions.UrlParameters.Clone(); } internalUrlParameters.Set(WxeHandler.Parameters.WxeFunctionToken, functionToken); href = GetPermanentUrl(function.GetType(), internalUrlParameters, permaUrlOptions.UseParentPermaUrl); } else { UrlMappingEntry mappingEntry = UrlMappingConfiguration.Current.Mappings[function.GetType()]; string path = (mappingEntry != null) ? mappingEntry.Resource : _httpContext.Request.Url.AbsolutePath; href = GetPath(path, functionToken, permaUrlOptions.UrlParameters); } return(href); }
protected virtual void Dispatch(IWxeExecutor executor, WxeFunction function) { ArgumentUtility.CheckNotNull("executor", executor); ArgumentUtility.CheckNotNull("function", function); //_options.Dispatch (executor, function, _sender); }
/// <summary> Initializes a new <see cref="WxeFunction"/>, encapsulated in a <see cref="WxeFunctionState"/> object. </summary> /// <include file='..\doc\include\ExecutionEngine\WxeHandler.xml' path='WxeHandler/CreateNewFunctionState/*' /> protected WxeFunctionState CreateNewFunctionState(HttpContext context, Type type) { ArgumentUtility.CheckNotNull("context", context); ArgumentUtility.CheckNotNull("type", type); WxeFunctionStateManager functionStates = WxeFunctionStateManager.Current; functionStates.CleanUpExpired(); WxeFunction function = (WxeFunction)Activator.CreateInstance(type); WxeFunctionState functionState = new WxeFunctionState(function, true); functionStates.Add(functionState); function.VariablesContainer.InitializeParameters(context.Request.QueryString); string returnUrlArg = context.Request.QueryString[Parameters.ReturnUrl]; string returnToSelfArg = context.Request.QueryString[Parameters.WxeReturnToSelf]; if (!string.IsNullOrEmpty(returnUrlArg)) { function.ReturnUrl = returnUrlArg; } else if (!string.IsNullOrEmpty(returnToSelfArg)) { if (bool.Parse(returnToSelfArg)) { function.ReturnUrl = context.Request.RawUrl; } } return(functionState); }
public void SetReturnState(WxeFunction returningFunction, bool isReturningPostBack, NameValueCollection previousPostBackCollection) { ArgumentUtility.CheckNotNull("returningFunction", returningFunction); _returningFunction = returningFunction; _isReturningPostBack = isReturningPostBack; _postBackCollection = previousPostBackCollection; }
public override void Dispatch(IWxeExecutor executor, WxeFunction function, Control sender) { ArgumentUtility.CheckNotNull("executor", executor); ArgumentUtility.CheckNotNull("function", function); ArgumentUtility.CheckNotNull("sender", sender); executor.ExecuteFunction(function, sender, this); }
/// <summary>Initalizes a new <see cref="WxeFunctionState"/> with the passed <paramref name="function"/> and returns the associated function token.</summary> internal string GetFunctionTokenForExternalFunction(WxeFunction function, bool returnFromExecute) { bool enableCleanUp = !returnFromExecute; WxeFunctionState functionState = new WxeFunctionState(function, enableCleanUp); _functionStateManager.Add(functionState); return(functionState.FunctionToken); }
public override void Dispatch(IWxeExecutor executor, WxeFunction function, Control sender) { ArgumentUtility.CheckNotNull("executor", executor); ArgumentUtility.CheckNotNull("function", function); ArgumentUtility.CheckNotNull("sender", sender); executor.ExecuteFunctionExternalByRedirect(function, sender, this); throw new WxeCallExternalException(); }
public void ExecuteFunction(WxeFunction function, Control sender, bool?usesEventTarget) { if (CurrentPageStep.UserControlExecutor.IsNull) { CurrentPageStep.ExecuteFunction(this, function, sender, usesEventTarget ?? UsesEventTarget); } else { CurrentUserControlStep.ExecuteFunction(this, function, sender, usesEventTarget ?? UsesEventTarget); } }
public WxeFunctionState( WxeFunction function, int lifetime, bool enableCleanUp) { ArgumentUtility.CheckNotNull("function", function); _lifetime = lifetime; _functionToken = Guid.NewGuid().ToString(); _function = function; _function.SetFunctionToken(_functionToken); _isCleanUpEnabled = enableCleanUp; _postBackID = 0; s_log.Debug(string.Format("Created WxeFunctionState {0}.", _functionToken)); }
/// <summary> Invokes <see cref="WxeFunction.Execute(WxeContext)"/> on the <paramref name="function"/>. </summary> /// <include file='..\doc\include\ExecutionEngine\WxeHandler.xml' path='WxeHandler/ExecuteFunction/*' /> protected virtual void ExecuteFunction(WxeFunction function, WxeContext context, bool isNew) { ArgumentUtility.CheckNotNull("function", function); ArgumentUtility.CheckNotNull("context", context); if (function.IsAborted) { throw new ArgumentException("The function " + function.GetType().FullName + " is aborted."); } function.ExceptionHandler.AppendCatchExceptionTypes(typeof(WxeUserCancelException)); function.Execute(context); }
/// <summary> /// Executes a <see cref="WxeFunction"/> in the current window from any <see cref="Page"/> by using a redirect. /// </summary> /// <include file='..\doc\include\ExecutionEngine\WxeContext.xml' path='WxeContext/ExecuteFunctionExternal/param[@name="page" or @name="function" or @name="createPermaUrl" or @name="urlParameters" or @name="returnToCaller"]' /> public static void ExecuteFunctionExternal( Page page, WxeFunction function, bool createPermaUrl, NameValueCollection urlParameters, bool returnToCaller) { ArgumentUtility.CheckNotNull("page", page); ArgumentUtility.CheckNotNull("function", function); string href = GetExternalFunctionUrl(function, createPermaUrl, urlParameters); if (returnToCaller) { function.ReturnUrl = page.Request.RawUrl; } System.Web.HttpContext.Current.Response.Redirect(href); }
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); }
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> /// Executes a <see cref="WxeFunction"/> in the specified window or frame from any <see cref="Page"/> /// by using java script. /// </summary> /// <include file='..\doc\include\ExecutionEngine\WxeContext.xml' path='WxeContext/ExecuteFunctionExternal/param[@name="page" or @name="function" or @name="target" or @name="features" or @name="createPermaUrl" or @name="urlParameters"]' /> public static void ExecuteFunctionExternal( Page page, WxeFunction function, string target, string features, bool createPermaUrl, NameValueCollection urlParameters) { ArgumentUtility.CheckNotNull("page", page); ArgumentUtility.CheckNotNull("function", function); ArgumentUtility.CheckNotNullOrEmpty("target", target); string href = GetExternalFunctionUrl(function, createPermaUrl, urlParameters); string openScript; if (features != null) { openScript = string.Format("window.open('{0}', '{1}', '{2}');\r\n", href, target, features); } else { openScript = string.Format("window.open('{0}', '{1}');\r\n", href, target); } ScriptManager.RegisterStartupScript(page, typeof(WxeContext), "WxeExecuteFunction", openScript, true); function.SetExecutionCompletedScript("window.close();"); }
private static string GetExternalFunctionUrl(WxeFunction function, bool createPermaUrl, NameValueCollection urlParameters) { string functionToken = WxeContext.Current.GetFunctionTokenForExternalFunction(function, false); NameValueCollection internalUrlParameters; if (urlParameters == null) { if (createPermaUrl) { internalUrlParameters = function.VariablesContainer.SerializeParametersForQueryString(); } else { internalUrlParameters = new NameValueCollection(); } } else { internalUrlParameters = NameValueCollectionUtility.Clone(urlParameters); } internalUrlParameters.Set(WxeHandler.Parameters.WxeFunctionToken, functionToken); return(WxeContext.GetPermanentUrl(WxeContext.Current.HttpContext, function.GetType(), internalUrlParameters)); }
/// <summary> /// Executes a <see cref="WxeFunction"/> in the specified window or frame from any <see cref="Page"/> /// by using java script. /// </summary> /// <include file='..\doc\include\ExecutionEngine\WxeContext.xml' path='WxeContext/ExecuteFunctionExternal/param[@name="page" or @name="function" or @name="target" or @name="features" or @name="urlParameters"]' /> public static void ExecuteFunctionExternal(Page page, WxeFunction function, string target, string features, NameValueCollection urlParameters) { ExecuteFunctionExternal(page, function, target, features, false, urlParameters); }
/// <summary> /// Executes a <see cref="WxeFunction"/> in the current window from any <see cref="Page"/> by using a redirect. /// </summary> /// <include file='..\doc\include\ExecutionEngine\WxeContext.xml' path='WxeContext/ExecuteFunctionExternal/param[@name="page" or @name="function" or @name="urlParameters" or @name="returnToCaller"]' /> public static void ExecuteFunctionExternal(Page page, WxeFunction function, NameValueCollection urlParameters, bool returnToCaller) { ExecuteFunctionExternal(page, function, false, urlParameters, returnToCaller); }
private void ClearReturnState() { _returningFunction = null; _isReturningPostBack = false; _postBackCollection = null; }
public abstract void Dispatch(IWxeExecutor executor, WxeFunction function, Control sender);
void IWxeCallArguments.Dispatch(IWxeExecutor executor, WxeFunction function) { Dispatch(executor, function); }