public virtual TResult Invoke() { try { return(Origin.Invoke()); } catch (Exception) { return(default);
public void Invoke() { while (this.invokables.Any()) { IInvokable invokable = this.invokables.Pop(); invokable.Invoke(); } }
public void TestThatPageExists(IInvokable page) { page.Invoke(); var pageClassName = page.GetType().ToString(); Assert.IsTrue(page.Exists(), "Page should exist: " + pageClassName); Console.WriteLine(pageClassName + "Done. Current title is: " + WebBrowser.Driver.Title); }
public T CallFunction <T>(string name, params object[] args) { SearchFunction(name); if (FunctionNode.TryGetValue(name, out func)) { return((T)func.Invoke(args)); } return(default(T)); }
public static void InvokeIfNeeded(IInvokable control, Action method) { if (control.InvokeRequired) { control.Invoke(new Action(() => InvokeIfNeeded(control, method))); return; } method(); }
///Calls and returns a value of a custom function in the flowgraph public object CallFunction(string name, params object[] args) { IInvokable func = null; if (functions.TryGetValue(name, out func)) { return(func.Invoke(args)); } return(null); }
private static void InvokeInvocation(IInvokable invokation) { try { invokation.Invoke(); } catch (Exception e) { throw new ActionInvokationException("An error occured while performing the registered operation", e); } }
///Calls and returns a value of a custom function in the flowgraph public object CallFunction(string name, params object[] args) { Debug.Assert(isRunning, "Trying to Execute Function but graph is not running"); IInvokable func = null; if (functions.TryGetValue(name, out func)) { return(func.Invoke(args)); } return(null); }
public object Invoke(IScriptContext context, object[] args) { IInvokable method = GetValue() as IInvokable; if (method != null) { return(method.Invoke(context, args)); } throw new ScriptIdNotFoundException(string.Format("Method {0} not found", name)); }
void GetFunctionResult() { if (!searchOnce) { searchOnce = true; if (portArgs.Count > 0) { objectArgs = new object[portArgs.Count]; } if (string.IsNullOrEmpty(functionName)) { Debug.Log("FunctionName can't be null", graph.agent.gameObject); } List <Graph> nestedGraph = new List <Graph>(); nestedGraph = graphOwner.value.graph.GetAllNestedGraphs <Graph>(true); nestedGraph.Add(graphOwner.value.graph); nestedGraph.ForEach(x => Debug.Log(x.name)); foreach (var g in nestedGraph) { try { var dict = ((FlowGraph)g).GetFunctions(); if (dict != null && dict.Count > 0) { foreach (var d in dict) { if (functionName == d.Key) { func = d.Value; } } } } catch (System.Exception e) { var a = e.Data; } } } for (var i = 0; i < portArgs.Count; i++) { objectArgs[i] = portArgs[i].value; } if (func != null) { outArg = func.Invoke(objectArgs); } else { Debug.LogWarning("Can't Find Function:" + functionName); } }
private void InvokeInternal(IInvokable message) { if (_isPending) { if (_pendingMessages == null) { _pendingMessages = new List <IInvokable>(); } _pendingMessages.Add(message); } else { foreach (var observer in _observers) { message.Invoke(observer); } } }
public T CallFunction <T>(string name, bool IncludeNestedGraph = false, params object[] args) { if (IncludeNestedGraph) { if (!searchOnce) { searchOnce = true; nestedGraph = behaviour.GetAllNestedGraphs <Graph>(true); nestedGraph.Add(behaviour); foreach (var g in nestedGraph) { if (g.GetType() == typeof(FlowGraph) || g.GetType().IsSubclassOf(typeof(FlowGraph))) { var dict = ((FlowGraph)g).GetFunctions(); if (dict != null && dict.Count > 0) { foreach (var d in dict) { FunctionNode.Add(d.Key, d.Value); } } } } } } if (IncludeNestedGraph) { if (FunctionNode.TryGetValue(name, out func)) { return((T)func.Invoke(args)); } return(default(T)); } else { return(behaviour.CallFunction <T>(name, args)); } }
internal double InvokeGoAndReturnDouble(IInvokable a) { return((double)a.Invoke(null)); }
internal object InvokeGoWithoutArgs(IInvokable a) { return(a.Invoke(null)); }
internal object InvokeGo(IInvokable a, string arg) { return(a.Invoke(new object[] { arg })); }
/// <summary> /// Inject dependencies into the given invoker, invoke it, and return the response /// </summary> protected T Get <T>(IInvokable <T> invoker) { InjectDependencies(invoker); return(invoker.Invoke()); }
private static object CallFunction(IInvokable functionDefinition, ScriptFunctionCall scriptFunctionCall, IScriptContext context) { scriptFunctionCall.Evaluate(context); return(functionDefinition.Invoke(context, (object[])context.Result)); }
private static object CallFunction(IInvokable functionDefinition, ScriptFunctionCall scriptFunctionCall, IScriptContext context) { scriptFunctionCall.Evaluate(context); return functionDefinition.Invoke(context, (object[])context.Result); }
private void InvokeInternal(IInvokable message) { if (_isPending) { if (_pendingMessages == null) _pendingMessages = new List<IInvokable>(); _pendingMessages.Add(message); } else { foreach (var observer in _observers) message.Invoke(observer); } }
internal static void CallTwice(IInvokable a) { a.Invoke(null); a.Invoke(null); }
Value invoke() => invokable.Invoke(new Arguments());
public object Invoke(IInvokable invokable, params object[] args) { return(invokable.Invoke(args)); }
public override void Execute(T parameter) { _invokable.Invoke(parameter); }
private async Task LocalObjectMessagePumpAsync() { while (true) { try { Message message; lock (this.Messages) { if (this.Messages.Count == 0) { this.Running = false; break; } message = this.Messages.Dequeue(); } if (message.IsExpired) { _manager.messagingTrace.OnDropExpiredMessage(message, MessagingStatisticsGroup.Phase.Invoke); continue; } RequestContextExtensions.Import(message.RequestContextData); IInvokable request = null; try { request = (IInvokable)message.BodyObject; } catch (Exception deserializationException) { if (_manager.logger.IsEnabled(LogLevel.Warning)) { _manager.logger.LogWarning( deserializationException, "Exception during message body deserialization in " + nameof(LocalObjectMessagePumpAsync) + " for message: {Message}", message); } _manager.runtimeClient.SendResponse(message, Response.FromException(deserializationException)); continue; } try { request.SetTarget(this); var response = await request.Invoke(); if (message.Direction != Message.Directions.OneWay) { this.SendResponseAsync(message, response); } } catch (Exception exc) { this.ReportException(message, exc); } } catch (Exception outerException) { // ignore, keep looping. _manager.logger.LogWarning( outerException, "Exception in " + nameof(LocalObjectMessagePumpAsync)); } finally { RequestContext.Clear(); } } }
public override void Execute() { _invokable.Invoke(); }