private void DisplaySearchInfo(ISpecialTimeLine t) { var searchLine = (SavedSearchTimeLine) t; Label SearchText = new Label(); SearchText.Width = pnlUsers.Width - (ClientSettings.TextSize + 10); SearchText.Text = searchLine.SearchPhrase; SearchText.Height = ClientSettings.TextSize + 5; pnlUsers.Controls.Add(SearchText); }
public static void Add(ISpecialTimeLine newLine) { lock (Items) { if (!Items.ContainsKey(newLine.name)) { Items.Add(newLine.name, newLine); NotificationHandler.AddSpecialTimeLineNotifications(newLine); } } }
public static void AddSpecialTimeLineNotifications(ISpecialTimeLine line) { if (!_notifications.ContainsKey(line.name)) { var c = new NotificationInfoClass { Name = "PockeTwit: " + line.name, Group = line, GUID = line.name, // Need to make sure we're checking searches if this is a saved search timeline Type = (line.Timelinetype == SpecialTimelines.SpecialTimeLinesRepository.TimeLineType.UserGroup) ? TimelineManagement.TimeLineType.Friends : TimelineManagement.TimeLineType.Searches }; _notifications.Add(c.GUID, c); LoadAllRegistries(); } }
private void DisplayUserGroupInfo(ISpecialTimeLine t) { UserGroupTimeLine ut = (UserGroupTimeLine)t; int width = pnlUsers.Width - (ClientSettings.TextSize + 10); Label lblName = new Label(); Label lblExclusive = new Label(); lblName.Text = PockeTwit.Localization.XmlBasedResourceManager.GetString("User"); lblName.Width = width; lblName.Height = ClientSettings.TextSize + 5; lblExclusive.Text = PockeTwit.Localization.XmlBasedResourceManager.GetString("Exclusive"); lblExclusive.Left = pnlUsers.Width - ((ClientSettings.TextSize * 4) + 10); lblExclusive.Height = lblName.Height; pnlUsers.Controls.Add(lblExclusive); pnlUsers.Controls.Add(lblName); int topOflabel = lblName.Bottom + 5; foreach (UserGroupTimeLine.GroupTerm gt in ut.Terms) { UserGroupTimeLine.GroupTerm gt1 = gt; LinkLabel nameLabel = new LinkLabel(); nameLabel.Width = lblName.Width; nameLabel.Click += ((o, e1) => DeleteItem(ut, gt1)); nameLabel.Text = gt.Name; nameLabel.Top = topOflabel; nameLabel.Height = (int) ClientSettings.TextSize + 5; CheckBox chkExclusive = new CheckBox(); chkExclusive.Click += ((o, e1) => ToggleExclusive(ut, gt1, chkExclusive)); chkExclusive.Left = nameLabel.Right - ClientSettings.TextSize; chkExclusive.Top = nameLabel.Top; chkExclusive.Width = ClientSettings.TextSize + 10; chkExclusive.Height = nameLabel.Height; chkExclusive.Checked = gt.Exclusive; pnlUsers.Controls.Add(chkExclusive); pnlUsers.Controls.Add(nameLabel); topOflabel = nameLabel.Bottom + 5; } }
public static void Remove(ISpecialTimeLine oldLine) { lock (Items) { if (Items.ContainsKey(oldLine.name)) { Items.Remove(oldLine.name); NotificationHandler.RemoveSpecialTimeLineNotifications(oldLine); } } using (var conn = DataBaseUtility.GetConnection()) { conn.Open(); using (var t = conn.BeginTransaction()) { using (var comm = new SQLiteCommand(conn)) { if (oldLine is UserGroupTimeLine) { var line = (UserGroupTimeLine) oldLine; comm.CommandText = "DELETE FROM usersInGroups WHERE groupname=@groupname;"; comm.Parameters.Add(new SQLiteParameter("@groupname", line.name)); comm.ExecuteNonQuery(); comm.CommandText = "DELETE FROM groups WHERE groupname=@groupname;"; comm.ExecuteNonQuery(); } else { var line = (SavedSearchTimeLine) oldLine; comm.CommandText = "DELETE FROM savedSearches WHERE searchName=@searchName;"; comm.Parameters.Add(new SQLiteParameter("@searchName", line.name)); comm.ExecuteNonQuery(); } } t.Commit(); } } }
public static void SetLastSelected(string ListName, status selectedStatus, ISpecialTimeLine specialTime) { if (ListName == "Conversation" || ListName == "Search_TimeLine" || ListName == "@User_TimeLine" || ListName == "Favorites_TimeLine" ) { return; } if (!LastSelectedItemsDictionary.ContainsKey(ListName)) { LastSelectedItemsDictionary.Add(ListName, ""); } LastSelectedItemsDictionary[ListName] = selectedStatus.id; var newInfo = new NewestSelectedInformation { CreatedAtTicks = (Int64) selectedStatus.createdAt.Ticks, id = selectedStatus.id }; if (!NewestSelectedItemsDictionary.ContainsKey(ListName)) { lock(NewestSelectedItemsDictionary) { NewestSelectedItemsDictionary.Add(ListName, newInfo); StoreNewestInfoInRegistry(ListName, newInfo); } SetUnreadCount(ListName, selectedStatus.id, specialTime); } else { if (NewestSelectedItemsDictionary[ListName].CreatedAtTicks <= newInfo.CreatedAtTicks) { NewestSelectedItemsDictionary[ListName] = newInfo; StoreNewestInfoInRegistry(ListName, newInfo); SetUnreadCount(ListName, newInfo.id, specialTime); } } StoreSelectedItem(ListName, selectedStatus.id); }
private void ShowFriendsTimeLine() { currentSpecialTimeLine = null; ChangeCursor(Cursors.WaitCursor); bool Redraw = statList.CurrentList() != "Friends_TimeLine"; SwitchToList("Friends_TimeLine"); History.Clear(); HistoryItem i = new HistoryItem(); i.Action = Yedda.Twitter.ActionType.Friends_Timeline; History.Push(i); statList.SetSelectedMenu(RefreshFriendsTimeLineMenuItem); AddStatusesToList(Manager.GetFriendsImmediately()); ChangeCursor(Cursors.Default); }
public TrendingTopicItem(TweetList list, ISpecialTimeLine timeLine) { _list = list; _timeLine = timeLine; Value = this.GetType().ToString(); }
private void AddGroupSelectMenuItem(ISpecialTimeLine t) { delMenuClicked showItemClicked = delegate() { ShowSpecialTimeLine(t, Yedda.Twitter.PagingMode.None); }; GroupsMenuItem.Visible = true; FingerUI.Menu.SideMenuItem item = new FingerUI.Menu.SideMenuItem(showItemClicked, t.name, statList.LeftMenu, t.ListName); GroupsMenuItem.SubMenuItems.Add(item); }
private void ShowUserTimeLine() { currentSpecialTimeLine = null; UpdateHistoryPosition(); ChangeCursor(Cursors.WaitCursor); StatusItem statItem = statList.SelectedItem as StatusItem; if (statItem == null) { return; } ShowUserID = statItem.Tweet.user.screen_name; CurrentlySelectedAccount = statItem.Tweet.Account; Yedda.Twitter Conn = GetMatchingConnection(CurrentlySelectedAccount); SwitchToList("@User_TimeLine"); HistoryItem i = new HistoryItem(); i.Action = Yedda.Twitter.ActionType.User_Timeline; i.Account = CurrentlySelectedAccount; i.Argument = ShowUserID; History.Push(i); //if getting authenticating user's timeline, you can merge in their retweets if (CurrentlySelectedAccount.UserName == ShowUserID) { List<status> tempList = new List<status>(); tempList.AddRange(Manager.GetUserTimeLine(Conn, ShowUserID)); tempList.AddRange(Manager.GetRetweetedByMe(Conn, ShowUserID)); tempList.Sort(); if (tempList.Count > 20) { tempList.RemoveRange(20, tempList.Count - 20); } AddStatusesToList(tempList.ToArray()); } else { AddStatusesToList(Manager.GetUserTimeLine(Conn, ShowUserID)); } ChangeCursor(Cursors.Default); return; }
private void ShowSendDirectMessagesTimeLine() { currentSpecialTimeLine = null; ChangeCursor(Cursors.WaitCursor); SwitchToList("SendDirectMessages_TimeLine"); HistoryItem i = new HistoryItem(); i.Action = Yedda.Twitter.ActionType.Send_Direct_Messages; History.Push(i); statList.SetSelectedMenu(SendDirectMessagesMenuItem); AddStatusesToList(Manager.GetSendDirectMessagesTimeLine()); ChangeCursor(Cursors.Default); }
public Library.status[] GetGroupedTimeLine(ISpecialTimeLine t, Yedda.Twitter.PagingMode pagingMode) { TimeLineType timeLineType = TimeLineType.Friends; if(t is SavedSearchTimeLine) { var savedLine = (SavedSearchTimeLine) t; if(!savedLine.autoUpdate) { return GetRegularSavedSearchTimeLine(savedLine, pagingMode); } timeLineType = TimeLineType.Searches; } return LocalStorage.DataBaseUtility.GetList(timeLineType, ClientSettings.MaxTweets, t.GetConstraints()).ToArray(); }
private void ShowUserTimeLine() { currentSpecialTimeLine = null; UpdateHistoryPosition(); ChangeCursor(Cursors.WaitCursor); StatusItem statItem = (StatusItem)statList.SelectedItem; if (statItem == null) { return; } ShowUserID = statItem.Tweet.user.screen_name; CurrentlySelectedAccount = statItem.Tweet.Account; Yedda.Twitter Conn = GetMatchingConnection(CurrentlySelectedAccount); SwitchToList("@User_TimeLine"); HistoryItem i = new HistoryItem(); i.Action = Yedda.Twitter.ActionType.User_Timeline; i.Account = CurrentlySelectedAccount; i.Argument = ShowUserID; History.Push(i); AddStatusesToList(Manager.GetUserTimeLine(Conn, ShowUserID)); ChangeCursor(Cursors.Default); return; }
public static void RemoveSpecialTimeLineNotifications(ISpecialTimeLine line) { if (_notifications.ContainsKey(line.name)) { _notifications.Remove(line.name); try { Registry.CurrentUser.DeleteSubKeyTree("\\ControlPanel\\Notifications\\" + line.name); } catch (Exception) {} LoadAllRegistries(); } }
private void ShowMessagesTimeLine() { currentSpecialTimeLine = null; ChangeCursor(Cursors.WaitCursor); SwitchToList("Messages_TimeLine"); History.Clear(); HistoryItem i = new HistoryItem(); i.Action = Yedda.Twitter.ActionType.Mentions; History.Push(i); statList.SetSelectedMenu(RefreshMessagesMenuItem); AddStatusesToList(Manager.GetMessagesImmediately()); ChangeCursor(Cursors.Default); }
private void ShowPublicTimeLine() { currentSpecialTimeLine = null; ChangeCursor(Cursors.WaitCursor); SwitchToList("Public_TimeLine"); HistoryItem i = new HistoryItem(); i.Action = Yedda.Twitter.ActionType.Public_Timeline; History.Push(i); statList.SetSelectedMenu(PublicMenuItem); AddStatusesToList(Manager.GetPublicTimeLine()); ChangeCursor(Cursors.Default); }
public MoreResultsItem(TweetList list, ISpecialTimeLine timeLine) { _list = list; _timeLine = timeLine; Value = this.GetType().ToString(); }
private void ShowTrends() { currentSpecialTimeLine = null; ChangeCursor(Cursors.WaitCursor); SwitchToList("TrendingTopics"); HistoryItem i = new HistoryItem(); i.Action = Yedda.Twitter.ActionType.Favorites; //TODO History.Push(i); statList.SetSelectedMenu(ViewFavoritesMenuItem); //test = LetsBeTrends.GetTrend("GoodNight"); statList.Clear(); ArrayList al = LetsBeTrends.GetCurrentTrends(); foreach (Hashtable a in al) { TrendingTopic tt = new TrendingTopic(); tt.Name = (String)a["name"]; tt.LastTrended = (String)a["last_trended_at"]; tt.FirstTrended = (String)a["first_trended_at"]; tt.Query = (String)a["query"]; try { if (a.Contains("description")) { Hashtable h = (Hashtable)a["description"]; tt.Description = (String)h["text"]; } else { tt.Description = "No description available."; } } catch (Exception ex) { Console.WriteLine("Error: " + ex.Message); tt.Description = "No description available."; } statList.AddItem(new TrendingTopicItem(this, null, tt)); } statList.SelectedItem = statList[0]; statList.YOffset = 0; statList.Redraw(); statList.RerenderPortal(); statList.Repaint(); ChangeCursor(Cursors.Default); }
public static void SetUnreadCount(string ListName, string selectedStatus, ISpecialTimeLine specialTime) { int updatedCount = GetUpdatedCount(ListName, specialTime, selectedStatus); if(!UnreadItemCount.ContainsKey(ListName)) { UnreadItemCount.Add(ListName, updatedCount); } else { UnreadItemCount[ListName] = updatedCount; } SetUnreadInRegistry(ListName, updatedCount); UnreadCountChanged(ListName, updatedCount); }
internal void ShowSpecialTimeLine(ISpecialTimeLine t, Yedda.Twitter.PagingMode pagingMode) { UpdateHistoryPosition(); currentSpecialTimeLine = t; ChangeCursor(Cursors.WaitCursor); HistoryItem i = new HistoryItem(); i.Action = Yedda.Twitter.ActionType.Search; i.Argument = t.name; i.ItemInfo = t; History.Push(i); SwitchToList(t.ListName); statList.ClearVisible(); AddStatusesToList(Manager.GetGroupedTimeLine(t, pagingMode), false); if (t.Timelinetype == SpecialTimeLinesRepository.TimeLineType.SavedSearch) statList.AddItem(new MoreResultsItem(this,t)); ChangeCursor(Cursors.Default); }
public static int GetUpdatedCount(string ListName, ISpecialTimeLine specialTime, string selectedStatus) { TimelineManagement.TimeLineType t = SpecialTimeLinesRepository.GetTimelineTypeFromSpecialType(ListName); string Constraints = null; if (specialTime != null) { Constraints = specialTime.GetConstraints(); } return LocalStorage.DataBaseUtility.CountItemsNewerThan(t, selectedStatus, Constraints); }
private void GetConversation(HistoryItem history) { currentSpecialTimeLine = null; UpdateHistoryPosition(); HistoryItem i = new HistoryItem(); Library.status lastStatus; Yedda.Twitter Conn; if (history == null) { StatusItem selectedItem = statList.SelectedItem as StatusItem; if (selectedItem == null) { return; } if (string.IsNullOrEmpty(selectedItem.Tweet.in_reply_to_status_id)) { return; } Conn = GetMatchingConnection(selectedItem.Tweet.Account); lastStatus = selectedItem.Tweet; i.Account = selectedItem.Tweet.Account; i.Action = Yedda.Twitter.ActionType.Conversation; i.Argument = lastStatus.id; } else { i = history; Conn = GetMatchingConnection(history.Account); try { lastStatus = Library.status.DeserializeSingle(Conn.ShowSingleStatus(i.Argument), i.Account); } catch { return; } } ChangeCursor(Cursors.WaitCursor); //List<Library.status> Conversation = GetConversationFROMTHEFUTURE(lastStatus); List<Library.status> Conversation = new List<PockeTwit.Library.status>(); History.Push(i); while (!string.IsNullOrEmpty(lastStatus.in_reply_to_status_id)) { Conversation.Add(lastStatus); try { lastStatus = Library.status.DeserializeSingle(Conn.ShowSingleStatus(lastStatus.in_reply_to_status_id), Conn.AccountInfo); } catch { lastStatus = null; break; } } if (lastStatus != null) { Conversation.Add(lastStatus); } statList.SwitchTolist("Conversation"); statList.ClearVisible(); AddStatusesToList(Conversation.ToArray()); ChangeCursor(Cursors.Default); this.SetLeftMenu(); }
public static void AddSpecialTimeLineNotifications(ISpecialTimeLine line) { if (!_notifications.ContainsKey(line.name)) { var c = new NotificationInfoClass { Name = "PockeTwit: " + line.name, Group = line, GUID = line.name, Type = TimelineManagement.TimeLineType.Friends }; _notifications.Add(c.GUID, c); LoadAllRegistries(); } }