Ejemplo n.º 1
0
        public static QueueHandler <T> Start <T>(Func <T, Task> handler, CancellationToken?token = null, int maxDegreeOfParallelism = 5)
        {
            var q = new QueueHandler <T>(handler, token, maxDegreeOfParallelism);

            q.Start();
            return(q);
        }
Ejemplo n.º 2
0
        public static QueueHandler <T> StartWithAction <T>(Action <T> handler, CancellationToken?token = null, int maxDegreeOfParallelism = 5)
        {
            var q = new QueueHandler <T>(x => { handler(x); return(Task.FromResult(0)); }, token, maxDegreeOfParallelism);

            q.Start();
            return(q);
        }
Ejemplo n.º 3
0
        public async Task Login()
        {
            Debug.WriteLine("rtm.start");
            var login = await API.GetRtmLogin();

            Debug.WriteLine("RTM Login: "******"RTM: connected");
            Connected?.Invoke();
            socket.MessageReceived += msg =>
            {
                Debug.WriteLine("received: " + msg);
                handlerQueue.Add(msg);
            };
        }