protected override string InvokeJS(string identifier, string argsJson) { if (!_node.CheckAccess()) { return(_node.Run(() => _jsCallDispatcher.invokeJSFromDotNet(identifier, argsJson)).Result); } return(_jsCallDispatcher.invokeJSFromDotNet(identifier, argsJson)); }
public override Task InvokeAsync(Action workItem) { if (workItem is null) { throw new ArgumentNullException(nameof(workItem)); } if (_node.CheckAccess()) { workItem(); return(Task.CompletedTask); } return(_node.Run(workItem)); }
public void Write(LogLevel logLevel, string finalMessage) { if (_node.CheckAccess()) { WriteIntern(logLevel, finalMessage); return; } var entry = Tuple.Create(logLevel, finalMessage); lock (_syncObject) { if (_queuedEntries != null) { _queuedEntries.Add(entry); return; } _queuedEntries = new List <Tuple <LogLevel, string> > { entry }; } _node.Run(WriteQueuedEntries); }
public static Task Run(this IBridgeToNode thiz, Action action) { return(thiz.Run(() => { action(); return (object)null; })); }
public static Task Run(this IBridgeToNode thiz, Action <object> action, object state, CancellationToken cancellationToken = default) { return(thiz.Run(RunActionState, new Action(() => action(state)), cancellationToken)); }
public static Task RunAsync(this IBridgeToNode thiz, Func <object, Task> asyncAction, object state, CancellationToken cancellationToken = default) { return(thiz.Run(asyncAction, state, cancellationToken).Unwrap()); }
public static Task Run(this IBridgeToNode thiz, Action action, CancellationToken cancellationToken = default) { return(thiz.Run(RunActionState, action, cancellationToken)); }
public static Task <T> RunAsync <T>(this IBridgeToNode thiz, Func <Task <T> > asyncFunc, CancellationToken cancellationToken = default) { return(thiz.Run(asyncFunc, cancellationToken).Unwrap()); }
public static Task RunAsync(this IBridgeToNode thiz, Func <Task> asyncAction) { return(thiz.Run(asyncAction).Unwrap()); }
public static Task <T> RunAsync <T>(this IBridgeToNode thiz, Func <Task <T> > asyncFunc) { return(thiz.Run(asyncFunc).Unwrap()); }