Ejemplo n.º 1
0
            public List <WatchEvent> GetLastEvent()
            {
                List <WatchEvent> list = new List <WatchEvent>();
                var watchResponse      = new WatchResponse(stream.ResponseStream.Current);
                var cur = watchResponse.GetEvents();

                if (cur.Count > 0)
                {
                    list.Add(cur[cur.Count - 1]);
                    this.OnNext(stream.ResponseStream.Current);
                }
                while (true)
                {
                    var task = stream.ResponseStream.MoveNext();
                    if (task.Result)
                    {
                        watchResponse = new WatchResponse(stream.ResponseStream.Current);
                        cur           = watchResponse.GetEvents();
                        if (cur.Count > 0)
                        {
                            list.Add(cur[cur.Count - 1]);
                            this.OnNext(stream.ResponseStream.Current);
                        }
                    }
                    else
                    {
                        break;
                    }
                }
                return(list);
            }
Ejemplo n.º 2
0
            public List <WatchEvent> ReadAll()
            {
                List <WatchEvent> list = new List <WatchEvent>();
                var watchResponse      = new WatchResponse(stream.ResponseStream.Current);

                list.AddRange(watchResponse.GetEvents());
                this.OnNext(stream.ResponseStream.Current);
                while (true)
                {
                    var task = stream.ResponseStream.MoveNext();
                    if (task.Result)
                    {
                        watchResponse = new WatchResponse(stream.ResponseStream.Current);
                        list.AddRange(watchResponse.GetEvents());
                        this.OnNext(stream.ResponseStream.Current);
                    }
                    else
                    {
                        break;
                    }
                }
                return(list);
            }