public static void NotifyTimeLineDone(TimelineManagement.TimeLineType TType) { if (TType == TimelineManagement.TimeLineType.Friends) { FriendsUpdating = false; } if (TType == TimelineManagement.TimeLineType.Messages) {MessagesUpdating = false; } if (TType == TimelineManagement.TimeLineType.Searches) { SearchesUpdating = false; } if (TimeLineDone != null) { TimeLineDone(TType); } }
public static void NotifyTimeLineFetching(TimelineManagement.TimeLineType TType) { if (TType == TimelineManagement.TimeLineType.Friends) { FriendsUpdating = true; } if (TType == TimelineManagement.TimeLineType.Messages) { MessagesUpdating = true; } if (TType== TimelineManagement.TimeLineType.Searches){ SearchesUpdating = true; } if (TimeLineFetching != null) { TimeLineFetching(TType); } }
public static string GetLatestItem(Twitter.Account account, TimelineManagement.TimeLineType typeToGet, string ExtraArguments) { string FetchQuery = SQLGetLastStatusID; switch (typeToGet) { case TimelineManagement.TimeLineType.Friends: FetchQuery = FetchQuery + " AND " + SQLFetchFriends + SQLOrder + SQLLimit; break; case TimelineManagement.TimeLineType.Replies: FetchQuery = FetchQuery + " AND " + SQLFetchReplies + SQLOrder + SQLLimit; break; case TimelineManagement.TimeLineType.Direct: FetchQuery = FetchQuery + " AND " + SQLFetchDirects + SQLOrder + SQLLimit; break; case TimelineManagement.TimeLineType.Messages: FetchQuery = FetchQuery + " AND " + SQLFetchRepliesAndMessages + SQLOrder + SQLLimit; break; case TimelineManagement.TimeLineType.Searches: FetchQuery = FetchQuery + " AND " + ExtraArguments + SQLFetchSearches + SQLOrder + SQLLimit; break; } using (SQLiteConnection conn = GetConnection()) { using (var comm = new SQLiteCommand(FetchQuery, conn)) { comm.Parameters.Add(new SQLiteParameter("@accountsummary", account.Summary)); comm.Parameters.Add(new SQLiteParameter("@count", 1)); conn.Open(); return (string) comm.ExecuteScalar(); } } }
private void ResetDictionaries() { FollowingDictionary.Clear(); TwitterConnections.Clear(); foreach (Yedda.Twitter.Account a in ClientSettings.AccountsList) { Twitter.Account AccountInfo = new Twitter.Account { ServerURL = a.ServerURL, UserName = a.UserName, Password = a.Password, OAuth_token = a.OAuth_token, OAuth_token_secret = a.OAuth_token_secret, Enabled = a.Enabled }; Twitter TwitterConn = Servers.CreateConnection(AccountInfo); TwitterConnections.Add(TwitterConn); Following f = new Following(TwitterConn); FollowingDictionary.Add(TwitterConn, f); } SetConnectedMenus(); Manager = new TimelineManagement(); Manager.Progress += Manager_Progress; Manager.CompleteLoaded += Manager_CompleteLoaded; Manager.Startup(TwitterConnections); Manager.FriendsUpdated += Manager_FriendsUpdated; Manager.MessagesUpdated += Manager_MessagesUpdated; Manager.SearchesUpdated += Manager_SearchesUpdated; foreach (Following f in FollowingDictionary.Values) { f.LoadFromTwitter(); } }
public static int CountItemsNewerThan(TimelineManagement.TimeLineType typeToGet, string ID, string Constraints) { //Need to EXCLUDE items exclusive to other groups if (ID == null) { return 0; } using (SQLiteConnection conn = GetConnection()) { string FetchQuery = SQLCountFromCache; string midClause = AddTypeWhereClause(typeToGet); midClause = Constraints + " AND " + midClause; if (string.IsNullOrEmpty(Constraints)) { midClause = midClause + SQLIgnoreGrouped; } FetchQuery = FetchQuery + midClause + SQLOrder; using (var comm = new SQLiteCommand(FetchQuery, conn)) { comm.Parameters.Add(new SQLiteParameter("@id", ID)); conn.Open(); object o = comm.ExecuteScalar(); return Convert.ToInt32(o); } } }
public static string GetLatestItem(Twitter.Account account, TimelineManagement.TimeLineType typeToGet) { return GetLatestItem(account, typeToGet, ""); }
private static string AddTypeWhereClause(TimelineManagement.TimeLineType typeToGet) { switch (typeToGet) { case TimelineManagement.TimeLineType.Friends: return SQLFetchFriends; case TimelineManagement.TimeLineType.Messages: return SQLFetchRepliesAndMessages; case TimelineManagement.TimeLineType.Searches: return SQLFetchSearches; } return null; }
public static List<status> GetList(TimelineManagement.TimeLineType typeToGet, int Count, string Constraints) { var cache = new List<status>(); using (SQLiteConnection conn = GetConnection()) { string FetchQuery = SQLFetchFromCache; FetchQuery = FetchQuery + " WHERE " + AddTypeWhereClause(typeToGet) + Constraints + SQLOrder + SQLLimit; using (var comm = new SQLiteCommand(FetchQuery, conn)) { comm.Parameters.Add(new SQLiteParameter("@count", Count)); conn.Open(); using (SQLiteDataReader r = comm.ExecuteReader()) { while (r.Read()) { var newStat = new status { id = r.GetString(0), text = r.GetString(1), TypeofMessage = ((StatusTypes) r.GetInt32(14)), createdAt = r.GetDateTime(3), in_reply_to_status_id = r.GetString(4), favorited = r.GetString(5), source = r.GetString(6), AccountSummary = r.GetString(7), SearchTerm = r.GetString(10) }; var u = new User { id = r.GetString(2), screen_name = r.GetString(10), name = r.GetString(11), description = r.GetString(12), profile_image_url = r.GetString(13) }; newStat.user = u; cache.Add(newStat); } } conn.Close(); } } return cache; }
public static string GetNewestItem(TimelineManagement.TimeLineType typeToGet, string Constraints) { using (SQLiteConnection conn = GetConnection()) { string fetchQuery = SQLFetchNewest; fetchQuery = fetchQuery + " WHERE " + AddTypeWhereClause(typeToGet) + Constraints + SQLOrder + SQLLimit; using (var comm = new SQLiteCommand(fetchQuery, conn)) { comm.Parameters.Add(new SQLiteParameter("@count", 1)); conn.Open(); using (SQLiteDataReader r = comm.ExecuteReader()) { while (r.Read()) { string latestID = r.GetString(0); return latestID; } } } } return ""; }
public static List<status> GetList(TimelineManagement.TimeLineType typeToGet, int Count) { string Constraints = null; if (typeToGet == TimelineManagement.TimeLineType.Friends) { Constraints = SQLIgnoreGrouped; } return GetList(typeToGet, Count, Constraints); }
private void ResetDictionaries() { FollowingDictionary.Clear(); TwitterConnections.Clear(); foreach (Yedda.Twitter.Account a in ClientSettings.AccountsList) { Yedda.Twitter TwitterConn = new Yedda.Twitter(); TwitterConn.AccountInfo.ServerURL = a.ServerURL; TwitterConn.AccountInfo.UserName = a.UserName; TwitterConn.AccountInfo.Password = a.Password; TwitterConn.AccountInfo.Enabled = a.Enabled; TwitterConnections.Add(TwitterConn); Following f = new Following(TwitterConn); FollowingDictionary.Add(TwitterConn, f); } SetConnectedMenus(); Manager = new TimelineManagement(); Manager.Progress += new TimelineManagement.delProgress(Manager_Progress); Manager.CompleteLoaded += new TimelineManagement.delComplete(Manager_CompleteLoaded); Manager.Startup(TwitterConnections); Manager.FriendsUpdated += new TimelineManagement.delFriendsUpdated(Manager_FriendsUpdated); Manager.MessagesUpdated += new TimelineManagement.delMessagesUpdated(Manager_MessagesUpdated); foreach (Following f in FollowingDictionary.Values) { f.LoadFromTwitter(); } }