예제 #1
0
        private static object CreateRemoteObservable(QbservableProtocol protocol, object instance, Type dataType)
        {
            var sink = protocol.GetOrAddSink(protocol.CreateClientDuplexSinkInternal);

            int id = 0;

            id = sink.RegisterObservableCallback(serverId => Subscribe(sink, new DuplexCallbackId(id, serverId), instance, dataType));

            return(Activator.CreateInstance(typeof(DuplexCallbackObservable <>).MakeGenericType(dataType), id));
        }
예제 #2
0
        private static object CreateRemoteEnumerable(QbservableProtocol protocol, IEnumerable instance, Type dataType)
        {
            var sink = protocol.GetOrAddSink(protocol.CreateClientDuplexSinkInternal);

            int id = 0;

            id = sink.RegisterEnumerableCallback(instance.GetEnumerator);

            return(Activator.CreateInstance(typeof(DuplexCallbackEnumerable <>).MakeGenericType(dataType), id));
        }
예제 #3
0
 private DuplexCallback(QbservableProtocol protocol, Func <int, object[], object> callback)
 {
     this.id = protocol
               .GetOrAddSink(protocol.CreateClientDuplexSinkInternal)
               .RegisterInvokeCallback(arguments => callback(this.id, arguments));
 }