void UpdateTimeLine(RestUsage r, RestUpdateDelegate func, TimeLineType type, int sinceListIndex) { r.LastExecTime = DateTime.Now; r.IsRunning = true; ThreadPool.QueueUserWorkItem(delegate(object o) { try { Status[] statuses = func(_restSinceList[sinceListIndex], null, r.Count, null); _restSinceList[sinceListIndex] = TwitterClient.GetMaxStatusID(_restSinceList[sinceListIndex], statuses); _dispatcher.BeginInvoke(new EmptyDelegate(delegate() { for (int i = 0; i < statuses.Length; i++) { statuses[i].AccountInfo = this; if (type == TimeLineType.Home && IsMention(statuses[i])) { Mentions.Add(statuses[i]); if (!_mgr.HomeIncludeMentions) { continue; } } else if (type == TimeLineType.Mentions && _mgr.HomeIncludeMentions) { HomeTimeline.Add(statuses[i]); } r.TimeLine.Add(statuses[i]); } })); } catch { } finally { r.IsRunning = false; r.LastExecTime = DateTime.Now; r.UpdateNextExecTimeRemaining(); } }); }
public void UpdateTimeLines() { RestUpdateDelegate[] funcs = new RestUpdateDelegate[] { _client.GetHomeTimeline, _client.GetMentions, _client.GetDirectMessagesAll }; for (int i = 0; i < funcs.Length; i++) { RestUsage r = _restInfoList[i]; if (!r.IsRunning && r.IsEnabled) { if (r.NextExecTime < DateTime.Now) { UpdateTimeLine(r, funcs[i], (TimeLineType)i, i); } r.UpdateNextExecTimeRemaining(); } } }
void UpdateTimeLine(RestUsage r, RestUpdateDelegate func, TimeLineType type, int sinceListIndex) { r.LastExecTime = DateTime.Now; r.IsRunning = true; ThreadPool.QueueUserWorkItem (delegate (object o) { try { Status[] statuses = func (_restSinceList[sinceListIndex], null, r.Count, null); _restSinceList[sinceListIndex] = TwitterClient.GetMaxStatusID (_restSinceList[sinceListIndex], statuses); _dispatcher.BeginInvoke (new EmptyDelegate (delegate () { for (int i = 0; i < statuses.Length; i++) { statuses[i].AccountInfo = this; if (type == TimeLineType.Home && IsMention (statuses[i])) { Mentions.Add (statuses[i]); if (!_mgr.HomeIncludeMentions) continue; } else if (type == TimeLineType.Mentions && _mgr.HomeIncludeMentions) { HomeTimeline.Add (statuses[i]); } r.TimeLine.Add (statuses[i]); } })); } catch { } finally { r.IsRunning = false; r.LastExecTime = DateTime.Now; r.UpdateNextExecTimeRemaining (); } }); }
public void UpdateTimeLines() { RestUpdateDelegate[] funcs = new RestUpdateDelegate[] {_client.GetHomeTimeline, _client.GetMentions, _client.GetDirectMessagesAll}; for (int i = 0; i < funcs.Length; i ++) { RestUsage r = _restInfoList[i]; if (!r.IsRunning && r.IsEnabled) { if (r.NextExecTime < DateTime.Now) UpdateTimeLine (r, funcs[i], (TimeLineType)i, i); r.UpdateNextExecTimeRemaining (); } } }