Exemplo n.º 1
0
        public static async Task RespondToQuery <TType>(this IDispatcherClient client, TType result, ServerDomainMessage original)
        {
            if (result == null)
            {
                return;
            }

            var data = new QueryEvent <TType>(original.EventName, result);

            await client.SendToClient(original.Sender, new ServerDomainMessage
            {
                EventName = data.GetType().FullName,
                EventType = EventType.QueryResult,
                EventData = JsonConvert.SerializeObject(data),
                TypeName  = typeof(QueryEvent <TType>).AssemblyQualifiedName
            }, CancellationToken.None);
        }