private void initalizeStateCodeActivity_Initialize_ExecuteCode(object sender, EventArgs e) { List <NamedFunctionCall> namedFunctionCalls = new List <NamedFunctionCall>(); if (Payload != "") { IFunction function = FunctionFacade.GetFunction(Payload); BaseRuntimeTreeNode baseRuntimeTreeNode = FunctionFacade.BuildTree(function, new Dictionary <string, object>()); NamedFunctionCall namedFunctionCall = new NamedFunctionCall("", (BaseFunctionRuntimeTreeNode)baseRuntimeTreeNode); namedFunctionCalls.Add(namedFunctionCall); string layoutLabel = string.Format(StringResourceSystemFacade.GetString("Composite.Plugins.AllFunctionsElementProvider", "FunctionTesterWorkflow.Layout.Label"), function.Name); this.Bindings.Add("LayoutLabel", layoutLabel); } this.Bindings.Add("FunctionCalls", namedFunctionCalls); this.Bindings.Add("Parameters", new List <ManagedParameterDefinition>()); this.Bindings.Add("PageId", PageManager.GetChildrenIDs(Guid.Empty).FirstOrDefault()); if (UserSettings.ActiveLocaleCultureInfo != null) { List <KeyValuePair <string, string> > activeCulturesDictionary = UserSettings.ActiveLocaleCultureInfos.Select(f => new KeyValuePair <string, string>(f.Name, DataLocalizationFacade.GetCultureTitle(f))).ToList(); this.Bindings.Add("ActiveCultureName", UserSettings.ActiveLocaleCultureInfo.Name); this.Bindings.Add("ActiveCulturesList", activeCulturesDictionary); } this.Bindings.Add("PageDataScopeName", DataScopeIdentifier.AdministratedName); this.Bindings.Add("PageDataScopeList", new Dictionary <string, string> { { DataScopeIdentifier.AdministratedName, StringResourceSystemFacade.GetString("Composite.Plugins.AllFunctionsElementProvider", "FunctionTesterWorkflow.AdminitrativeScope.Label") }, { DataScopeIdentifier.PublicName, StringResourceSystemFacade.GetString("Composite.Plugins.AllFunctionsElementProvider", "FunctionTesterWorkflow.PublicScope.Label") } }); Guid stateId = Guid.NewGuid(); var state = new FunctionCallDesignerState { WorkflowId = WorkflowInstanceId, ConsoleIdInternal = GetCurrentConsoleId() }; SessionStateManager.DefaultProvider.AddState <IFunctionCallEditorState>(stateId, state, DateTime.Now.AddDays(7.0)); this.Bindings.Add("SessionStateProvider", SessionStateManager.DefaultProviderName); this.Bindings.Add("SessionStateId", stateId); }
private static object GetFunctionCallResult(FunctionContextContainer functionContextContainer, NamedFunctionCall namedFunctionCall, bool addDetailedComments) { object result = namedFunctionCall.FunctionCall.GetValue(functionContextContainer); if (!(result is IXsltExtensionDefinition)) { if (addDetailedComments) { if (result is IEnumerable <XElement> ) { result = ((IEnumerable <XElement>)result).ToList(); // timers dont like lazy stuff, so evaluate now } if (result is IEnumerable <XNode> ) { result = ((IEnumerable <XNode>)result).ToList(); // timers dont like lazy stuff, so evaluate now } } result = CreateFunctionCallResultNode(namedFunctionCall.Name, result); } return(result); }