Example #1
0
        public Value EndInvokeMethod(IAsyncResult asyncResult)
        {
            var result  = ObjectMirror.EndInvokeMethodInternalWithResult(asyncResult);
            var outThis = result.OutThis as StructMirror;

            if (outThis != null)
            {
                SetFields(outThis.Fields);
            }
            return(result.Result);
        }
Example #2
0
        public Task <InvokeResult> InvokeMethodAsyncWithResult(ThreadMirror thread, MethodMirror method, IList <Value> arguments, InvokeOptions options = InvokeOptions.None)
        {
            var tcs = new TaskCompletionSource <InvokeResult> ();

            BeginInvokeMethod(thread, method, arguments, options, iar =>
            {
                try {
                    tcs.SetResult(ObjectMirror.EndInvokeMethodInternalWithResult(iar));
                } catch (OperationCanceledException) {
                    tcs.TrySetCanceled();
                } catch (Exception ex) {
                    tcs.TrySetException(ex);
                }
            }, null);
            return(tcs.Task);
        }
 public InvokeResult EndInvokeMethodWithResult(IAsyncResult asyncResult)
 {
     return(ObjectMirror.EndInvokeMethodInternalWithResult(asyncResult));
 }