Baconography.NeutralServices.OfflineDelayableRedditService.RunQueue C# (CSharp) Method

RunQueue() public method

public RunQueue ( ThreadPoolTimer timer ) : System.Threading.Tasks.Task
timer Windows.System.Threading.ThreadPoolTimer
return System.Threading.Tasks.Task
        public async Task RunQueue(ThreadPoolTimer timer)
        {
            try
            {
                if (_settingsService.IsOnline() && (await _userService.GetUser()).Username != null)
                {
                    var actionTpl = await _offlineService.DequeueAction();
                    if (actionTpl != null)
                    {
                        switch (actionTpl.Item1)
                        {
                            case "AddComment":
                                {
                                    await AddComment(actionTpl.Item2["parentId"], actionTpl.Item2["content"]);
                                    break;
                                }
                            case "EditComment":
                                {
                                    await EditComment(actionTpl.Item2["thingId"], actionTpl.Item2["text"]);
                                    break;
                                }
                            case "AddMessage":
                                {
                                    await AddMessage(actionTpl.Item2["recipient"], actionTpl.Item2["subject"], actionTpl.Item2["message"]);
                                    break;
                                }
                            case "AddPost":
                                {
                                    await AddPost(actionTpl.Item2["kind"], actionTpl.Item2["url"], actionTpl.Item2["subreddit"], actionTpl.Item2["title"]);
                                    break;
                                }
                            case "AddVote":
                                {
                                    await AddVote(actionTpl.Item2["thingId"], int.Parse(actionTpl.Item2["direction"]));
                                    break;
                                }
                            case "AddSubredditSubscription":
                                {
                                    await AddSubredditSubscription(actionTpl.Item2["subreddit"], bool.Parse(actionTpl.Item2["direction"]));
                                    break;
                                }
                            case "AddSavedThing":
                                {
                                    await AddSavedThing(actionTpl.Item2["thingId"]);
                                    break;
                                }
                            case "AddReportOnThing":
                                {
                                    await AddReportOnThing(actionTpl.Item2["thingId"]);
                                    break;
                                }
                        }
                    }
                }
            }
            catch (TaskCanceledException)
            {
            }
            catch (Exception e)
            {
                System.Diagnostics.Debug.WriteLine(e.ToString());
            }
            //we dont need to be particularly active here, as we dont want to burn battery when nothing is happening and we dont want to choke out
            //the content requests when the user is actively browsing around
            _queueTimer = ThreadPoolTimer.CreateTimer(async (timerParam) => await RunQueue(timerParam), new TimeSpan(0, 0, 2));
        }