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