예제 #1
0
    private static void SetupPushBasedStreams()
    {
        RequestStream  = Observable.FromEventPattern <EventArgs <string> >(ev => RequestEvent += ev, ev => RequestEvent -= ev);
        ResponseStream = RequestStream
                         .Select(url => {
            var client   = new HttpClient();
            var response = client.GetAsync(url.EventArgs.Value).Result;
            return(Parse(response.Content.ReadAsStringAsync().Result).ToObservable());
        }).SelectMany(d => d);

        var readySubject = new Subject <string>();

        ReadyStream  = (IObservable <string>)readySubject;
        ReadyStreamW = (IObserver <string>)readySubject;
    }