/// <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); }
/// <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); }