Esempio n. 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));
        }
Esempio n. 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));
        }
Esempio n. 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);
        }
Esempio n. 4
0
 public static Task Run(this IBridgeToNode thiz, Action action)
 {
     return(thiz.Run(() =>
     {
         action();
         return (object)null;
     }));
 }
Esempio n. 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));
 }
Esempio n. 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());
 }
Esempio n. 7
0
 public static Task Run(this IBridgeToNode thiz, Action action, CancellationToken cancellationToken = default)
 {
     return(thiz.Run(RunActionState, action, cancellationToken));
 }
Esempio n. 8
0
 public static Task <T> RunAsync <T>(this IBridgeToNode thiz, Func <Task <T> > asyncFunc, CancellationToken cancellationToken = default)
 {
     return(thiz.Run(asyncFunc, cancellationToken).Unwrap());
 }
Esempio n. 9
0
 public static Task RunAsync(this IBridgeToNode thiz, Func <Task> asyncAction)
 {
     return(thiz.Run(asyncAction).Unwrap());
 }
Esempio n. 10
0
 public static Task <T> RunAsync <T>(this IBridgeToNode thiz, Func <Task <T> > asyncFunc)
 {
     return(thiz.Run(asyncFunc).Unwrap());
 }