Exemplo n.º 1
0
        private void InvokeDelegate(InvokeDelegateMessage msg)
        {
            try {
                IReflect target = this.refToObj[msg.TargetId] as IReflect;

                List<object> args = new List<object>();
                args.Add(target);

                foreach (JsValue arg in msg.Parameters) {
                    object item = WrapRemoteValue(arg);
                    args.Add(item);
                }

                object ret = this.helper.InvokeDelegate(args.ToArray());
                HandleReturn(ret);
            }
            catch (Exception ex) {
                Console.WriteLine(ex.Message);
                JsValue value = JsValue.FromPrimitive(ex.Message);
                ReturnMessage retMsg = new ReturnMessage { Value = value, IsException = true };
                this.session.SendMessage(retMsg);
            }
        }
Exemplo n.º 2
0
 public object InvokeRemoteDelegate(int targetId, object[] args)
 {
     InvokeDelegateMessage msg = new InvokeDelegateMessage {
         TargetId = targetId,
         Parameters = WrapParameters(args)
     };
     this.session.SendMessage(msg);
     JsValue value = DispatchAndReturn();
     return WrapRemoteValue(value);
 }