public static ClientEventInfo Create(int id, Request Request, Object target, String eventName)
        {
            ClientEventInfo info = new ClientEventInfo();

            info.Id        = id;
            info.Request   = Request;
            info.Type      = ClearScriptUtils.GetType(target);
            info.EventInfo = info.Type.GetEvent(eventName);
            Type eventArgsType = info.EventInfo.EventHandlerType.GenericTypeArguments[0];

            info.Target       = ClearScriptUtils.IsHostType(target) ? null : target;
            info.Bus          = Activator.CreateInstance(typeof(EventBus <>).MakeGenericType(eventArgsType), new object[] { info });
            info.Delegate     = CreateDelegate(info);
            info.DelegateArgs = new object[1] {
                info.Delegate
            };
            info.WriteLog = true;
            return(info);
        }
Beispiel #2
0
 public bool CanConvert(object val)
 {
     return(ClearScriptUtils.IsHostType(val));
 }