Esempio 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);
        }
Esempio 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);
        }
Esempio 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);
            };
        }