Example #1
0
        protected override string InvokeJS(string identifier, string argsJson)
        {
            if (!_node.CheckAccess())
            {
                return(_node.Run(() => _jsCallDispatcher.invokeJSFromDotNet(identifier, argsJson)).Result);
            }

            return(_jsCallDispatcher.invokeJSFromDotNet(identifier, argsJson));
        }
Example #2
0
        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));
        }
Example #3
0
        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);
        }
Example #4
0
 public static Task Run(this IBridgeToNode thiz, Action action)
 {
     return(thiz.Run(() =>
     {
         action();
         return (object)null;
     }));
 }
Example #5
0
 public static Task Run(this IBridgeToNode thiz, Action <object> action, object state, CancellationToken cancellationToken = default)
 {
     return(thiz.Run(RunActionState, new Action(() => action(state)), cancellationToken));
 }
Example #6
0
 public static Task RunAsync(this IBridgeToNode thiz, Func <object, Task> asyncAction, object state, CancellationToken cancellationToken = default)
 {
     return(thiz.Run(asyncAction, state, cancellationToken).Unwrap());
 }
Example #7
0
 public static Task Run(this IBridgeToNode thiz, Action action, CancellationToken cancellationToken = default)
 {
     return(thiz.Run(RunActionState, action, cancellationToken));
 }
Example #8
0
 public static Task <T> RunAsync <T>(this IBridgeToNode thiz, Func <Task <T> > asyncFunc, CancellationToken cancellationToken = default)
 {
     return(thiz.Run(asyncFunc, cancellationToken).Unwrap());
 }
Example #9
0
 public static Task RunAsync(this IBridgeToNode thiz, Func <Task> asyncAction)
 {
     return(thiz.Run(asyncAction).Unwrap());
 }
Example #10
0
 public static Task <T> RunAsync <T>(this IBridgeToNode thiz, Func <Task <T> > asyncFunc)
 {
     return(thiz.Run(asyncFunc).Unwrap());
 }