Exemple #1
0
 public object ConvertTo(Type t)
 {
     if (t == typeof(Func <object, Task <object> >) || t == typeof(Func <object[], Task <object> >))
     {
         if (dictionary.ContainsKey("rpa_function") && (bool)dictionary["rpa_function"])
         {
             if (t == typeof(Func <object, Task <object> >))
             {
                 return(new Func <object, Task <object> >((object arg) =>
                 {
                     return RemoteSender.Invoke(server, socket, (string)dictionary["rpa_id"], new object[] { arg });
                 }));
             }
             else if (t == typeof(Func <object[], Task <object> >))
             {
                 return(new Func <object[], Task <object> >((object[] args) =>
                 {
                     return RemoteSender.Invoke(server, socket, (string)dictionary["rpa_id"], args);
                 }));
             }
         }
         else
         {
             var ex = new RemoteException("Cannot cast this object as a Function");
             ex.Code = "INVALID_CAST_EXCEPTION";
             throw ex;
         }
     }
     else if (t == typeof(Dictionary <string, object>))
     {
         return(dictionary);
     }
     return(this);
 }
Exemple #2
0
 public override bool TryInvoke(InvokeBinder binder, object[] args, out object result)
 {
     if (server == null)
     {
         result = null;
         return(false);
     }
     result = RemoteSender.Invoke(server, socket, (string)dictionary["rpa_id"], args);
     return(true);
 }
Exemple #3
0
 public Task <object> Invoke(object[] args)
 {
     return(RemoteSender.Invoke(server, socket, (string)dictionary["rpa_id"], args));
 }