public ApolloResult Send <TResp>(TalkerCommand command, IPackable request, TalkerMessageHandler <TResp> handler, object context, float timeout) where TResp : IUnpackable { return(this.Send <TResp>(TalkerMessageType.Request, command, request, handler, context, timeout)); }
public ApolloResult Send <TResp>(TalkerMessageType type, TalkerCommand command, IPackable request, TalkerMessageHandler <TResp> handler, object context, float timeout) where TResp : IUnpackable { ApolloMessage apolloMessage = new ApolloMessage(); apolloMessage.RespType = typeof(TResp); apolloMessage.Context = context; apolloMessage.Life = timeout; if (handler != null) { apolloMessage.Handler = delegate(object req, TalkerEventArgs loginInfo) { if (handler != null) { TalkerEventArgs <TResp> talkerEventArgs = new TalkerEventArgs <TResp>(loginInfo.Result, loginInfo.ErrorMessage); talkerEventArgs.Response = (TResp)((object)loginInfo.Response); talkerEventArgs.Context = loginInfo.Context; handler(req, talkerEventArgs); } }; } return(this.Send(type, command, request, apolloMessage)); }
public ApolloResult Send <TResp>(IPackable request, TalkerMessageHandler <TResp> handler, object context, float timeout) where TResp : IUnpackable { return(this.Send <TResp>(new TalkerCommand(TalkerCommand.CommandDomain.App, request), request, handler, context, timeout)); }