예제 #1
0
 public AccountInfoForm(Yedda.Twitter.Account Account)
 {
     _AccountInfo = Account;
     InitializeComponent();
     FillServerList();
     PopulateForm();
 }
예제 #2
0
        public AccountInfoForm(Yedda.Twitter.Account Account)
        {
            _AccountInfo = Account;
            InitializeComponent();
            PockeTwit.Themes.FormColors.SetColors(this);
            PockeTwit.Localization.XmlBasedResourceManager.LocalizeForm(this);

            FillServerList();
            PopulateForm();

            cbRevalidate.Visible = true;
            cbRevalidate.Checked = false;
        }
예제 #3
0
        public void Render()
        {
            if (Status != null)
            {
                Cursor.Current = Cursors.WaitCursor;

                PockeTwit.Library.status stat = Status;

                //if (Status.retweeted_status != null)
                //{
                //    //why won't this work? does retweeted_status need to
                //    //be saved in the db?
                //    stat = Status.retweeted_status;
                //}

                //if it's a new retweet, make an API call to get orginal tweet
                //so we can show all 140 chars of the tweet
                if (Status.TypeofMessage == PockeTwit.Library.StatusTypes.Retweet)
                {
                    foreach (Yedda.Twitter.Account a in ClientSettings.AccountsList)
                    {
                        if (a.Equals(Status.Account))
                        {
                            Yedda.Twitter.Account NewAccount = new Yedda.Twitter.Account
                            {
                                ServerURL = a.ServerURL,
                                UserName = a.UserName,
                                Password = a.Password,
                                Enabled = a.Enabled,
                                OAuth_token = a.OAuth_token,
                                OAuth_token_secret = a.OAuth_token_secret
                            };
                            Conn = Yedda.Servers.CreateConnection(NewAccount);

                            //Get the tweet again from Twitter
                            stat = PockeTwit.Library.status.DeserializeSingle(Conn.ShowSingleStatus(stat.id), Conn.AccountInfo);

                            //Set the tweet to the original tweet
                            stat = stat.retweeted_status;
                            break;
                        }
                    }
                }

                avatarBox.Image = PockeTwit.ThrottledArtGrabber.GetArt(stat.user.profile_image_url);
                lblUserName.Text = stat.user.screen_name;
                lblTime.Text = stat.TimeStamp;
                if (string.IsNullOrEmpty(stat.source))
                {
                    lblSource.Text = "";
                }
                else
                {

                    lblSource.Text = "from " + StripHTML(System.Web.HttpUtility.HtmlDecode(stat.source));
                }
                string fullText;
                if (ShortText.IsShortTextURL(stat.text))
                {
                    string[] splitup = stat.text.Split(new[] { ' ' });
                    fullText = ShortText.GetFullText(splitup[splitup.Length - 1]);
                }
                else
                {
                    fullText = stat.text;
                }
                if (ClientSettings.AutoTranslate)
                {
                    fullText = GoogleTranslate.GetTranslation(fullText);
                }
                lblText.Text = System.Web.HttpUtility.HtmlDecode(fullText).Replace("&", "&&");
                Cursor.Current = Cursors.Default;
            }
        }
예제 #4
0
        private void AddStatusesToList(Library.status[] mergedstatuses, bool KeepPosition)
        {
            if (mergedstatuses == null) //Why would this turn up null? Comm error?
            {
                //MessageBox.Show("Status list was null for " + statList.CurrentList());
                return;
            }
            if (mergedstatuses.Length == 0) { return; }
            if (InvokeRequired)
            {
                delAddStatuses d = AddStatusesToList;
                this.Invoke(d, new object[] { mergedstatuses, KeepPosition });
            }
            else
            {
                int newItems = 0;
                if(KeepPosition)
                {
                    IDisplayItem selectedItem = statList.SelectedItem;
                    if (selectedItem != null && selectedItem is StatusItem)
                    {
                        TimelineManagement.TimeLineType t = TimelineManagement.TimeLineType.Friends;
                        if (statList.CurrentList() == "Messages_TimeLine")
                        {
                            t = TimelineManagement.TimeLineType.Messages;
                        }
                        string constraints = "";
                        if (currentSpecialTimeLine != null)
                        {
                            constraints = currentSpecialTimeLine.GetConstraints();
                            t = (currentSpecialTimeLine.Timelinetype == SpecialTimelines.SpecialTimeLinesRepository.TimeLineType.UserGroup) ? TimelineManagement.TimeLineType.Friends : TimelineManagement.TimeLineType.Searches;
                        }
                        newItems = LocalStorage.DataBaseUtility.CountItemsNewerThan(t, (selectedItem as StatusItem).Tweet.id, constraints);
                    }
                }

                int oldOffset = 0;
                int oldIndex = 0;

                oldIndex = statList.SelectedIndex;
                oldOffset = statList.YOffset - (ClientSettings.ItemHeight * oldIndex);

                statList.Clear();
                foreach (Library.status stat in mergedstatuses)
                {
                    if (stat == null || stat.user == null || stat.user.screen_name == null) continue;
                    StatusItem item = new StatusItem {Tweet = stat};
                    statList.AddItem(item);
                }
                IDisplayItem currentItem = null;
                if (!ClientSettings.AutoScrollToTop)
                {
                    if (oldIndex >= 0 && KeepPosition && newItems < ClientSettings.MaxTweets)
                    {
                        try
                        {
                            statList.SelectedItem = statList[newItems];
                            currentItem = statList.SelectedItem;
                            statList.YOffset = oldOffset + (newItems * ClientSettings.ItemHeight);
                        }
                        catch (KeyNotFoundException)
                        {
                            //What to do?
                        }
                    }
                    else
                    {
                        statList.JumpToLastSelected();
                        currentItem = statList[0];
                    }
                }
                else
                {
                    statList.SelectedItem = statList[0];
                    currentItem = statList.SelectedItem;
                    statList.YOffset = 0;
                }

                if (currentItem != null)
                {
                    if (currentItem is StatusItem)
                        CurrentlySelectedAccount = (currentItem as StatusItem).Tweet.Account;
                    UpdateRightMenu();
                }
                statList.Redraw();
                statList.RerenderPortal();
                statList.Repaint();
            }
        }
예제 #5
0
 private void SwitchToUserTimeLine(string TextClicked)
 {
     UpdateHistoryPosition();
     ShowUserID = TextClicked.Replace("@", "");
     StatusItem statItem = statList.SelectedItem as StatusItem;
     if (statItem == null) { return; }
     ChangeCursor(Cursors.WaitCursor);
     HistoryItem i = new HistoryItem();
     i.Argument = ShowUserID;
     i.Account = statItem.Tweet.Account;
     i.Action = Yedda.Twitter.ActionType.User_Timeline;
     History.Push(i);
     CurrentlySelectedAccount = statItem.Tweet.Account;
     Yedda.Twitter Conn = GetMatchingConnection(CurrentlySelectedAccount);
     SwitchToList("@User_TimeLine");
     //if getting authenticating user's timeline, you can merge in their retweets
     if (CurrentlySelectedAccount.UserName == ShowUserID)
     {
         List<status> tempList = new List<status>();
         status[] UserTimeLine = Manager.GetUserTimeLine(Conn, ShowUserID);
         status[] UserRetweeted = Manager.GetRetweetedByMe(Conn, ShowUserID);
         // It's not a problem if there's an error
         if(UserTimeLine != null)
             tempList.AddRange(UserTimeLine);
         if(UserRetweeted != null)
             tempList.AddRange(UserRetweeted);
         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;
 }
예제 #6
0
 private void SwitchToUserFavorites(String userID)
 {
     //currentSpecialTimeLine = null;
     UpdateHistoryPosition();
     userID = userID.Replace("@", "");
     StatusItem statItem = (StatusItem)statList.SelectedItem;
     if (statItem == null) { return; }
     ChangeCursor(Cursors.WaitCursor);
     HistoryItem i = new HistoryItem();
     i.Argument = userID;
     i.Account = statItem.Tweet.Account;
     i.Action = Yedda.Twitter.ActionType.Favorites; //i.Action = Yedda.Twitter.ActionType.User_Timeline;
     History.Push(i);
     CurrentlySelectedAccount = statItem.Tweet.Account;
     Yedda.Twitter Conn = GetMatchingConnection(CurrentlySelectedAccount);
     SwitchToList("Favorites_TimeLine"); //SwitchToList("@User_TimeLine");
     AddStatusesToList(Manager.GetUserFavorites(userID)); //AddStatusesToList(Manager.GetUserTimeLine(Conn, ShowUserID));
     ChangeCursor(Cursors.Default);
     return;
 }
예제 #7
0
        void statusList_SelectedItemChanged(object sender, EventArgs e)
        {
            Type selectedType = statList.SelectedItem.GetType();
            if (selectedType != _lastSelectedItemType)
            {
                // item type has changed, update menus
                CreateRightMenu();
                UpdateRightMenu();
                _lastSelectedItemType = selectedType;
            }

            StatusItem statItem = statList.SelectedItem as StatusItem;
            if (statItem == null) { return; }
            CurrentlySelectedAccount = statItem.Tweet.Account;
            SetConnectedMenus(GetMatchingConnection(CurrentlySelectedAccount), statItem);
            //UpdateRightMenu(); -- THIS IS DONE IN SETCONNECTEDMENUS
            UpdateHistoryPosition();
            int clickedNumber = statItem.Index + 1;
            SetLeftMenu();
            LastSelectedItems.SetLastSelected(statList.CurrentList(), statItem.Tweet, currentSpecialTimeLine);
        }
예제 #8
0
        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;
        }
예제 #9
0
        private bool SetEverythingUp()
        {
            HistoryItem firstItem = new HistoryItem();
            firstItem.Action = Yedda.Twitter.ActionType.Friends_Timeline;
            History.Push(firstItem);
            if (System.IO.File.Exists(ClientSettings.AppPath + "\\crash.txt"))
            {
                using (CrashReport errorForm = new CrashReport())
                {
                    //errorForm.Owner = this;
                    errorForm.ShowDialog();
                    errorForm.Dispose();
                }
            }
            if (!StartBackground)
            {
                this.Show();
            }
            bool ret = true;

            if (ClientSettings.CheckVersion)
            {
                Checker = new UpgradeChecker();
                Checker.UpgradeFound += new UpgradeChecker.delUpgradeFound(UpdateChecker_UpdateFound);
            }
            SetUpListControl();

            try
            {
                ResetDictionaries();
            }
            catch (OutOfMemoryException)
            {
                PockeTwit.Localization.LocalizedMessageBox.Show("There's not enough memory to run PockeTwit. You may want to close some applications and try again.");
                if (Manager != null)
                {
                    Manager.ShutDown();
                }
                this.Close();
            }
            catch (Exception ex)
            {
                PockeTwit.Localization.LocalizedMessageBox.Show("Corrupt settings - {0}\r\nPlease reconfigure.", ex.Message);
                ClearSettings();
                ResetDictionaries();
            }

            CurrentlySelectedAccount = ClientSettings.DefaultAccount;

            Notifyer = new NotificationHandler();
            Notifyer.MessagesNotificationClicked += new NotificationHandler.DelNotificationClicked(Notifyer_MessagesNotificationClicked);

            return ret;
        }
예제 #10
0
 private void SwitchToUserTimeLine(string TextClicked)
 {
     UpdateHistoryPosition();
     ShowUserID = TextClicked.Replace("@", "");
     StatusItem statItem = (StatusItem)statList.SelectedItem;
     if (statItem == null) { return; }
     ChangeCursor(Cursors.WaitCursor);
     HistoryItem i = new HistoryItem();
     i.Argument = ShowUserID;
     i.Account = statItem.Tweet.Account;
     i.Action = Yedda.Twitter.ActionType.User_Timeline;
     History.Push(i);
     CurrentlySelectedAccount = statItem.Tweet.Account;
     Yedda.Twitter Conn = GetMatchingConnection(CurrentlySelectedAccount);
     SwitchToList("@User_TimeLine");
     AddStatusesToList(Manager.GetUserTimeLine(Conn, ShowUserID));
     ChangeCursor(Cursors.Default);
     return;
 }
예제 #11
0
        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;
        }
예제 #12
0
        private void AddStatusesToList(Library.status[] mergedstatuses, bool KeepPosition)
        {
            if (InvokeRequired)
            {
                delAddStatuses d = new delAddStatuses(AddStatusesToList);
                this.Invoke(d, new object[] { mergedstatuses, KeepPosition });
            }
            else
            {
                int newItems = 0;
                if(KeepPosition)
                {
                    FingerUI.StatusItem selectedItem = (FingerUI.StatusItem)statList.SelectedItem;
                    TimelineManagement.TimeLineType t = TimelineManagement.TimeLineType.Friends;
                    if(statList.CurrentList()=="Messages_TimeLine")
                    {
                        t = TimelineManagement.TimeLineType.Messages;
                    }
                    string Constraints = "";
                    if(currentGroup!=null){
                        Constraints = currentGroup.GetConstraints();}
                    newItems = LocalStorage.DataBaseUtility.CountItemsNewerThan(t, selectedItem.Tweet.id, Constraints);
                }
                
                if (mergedstatuses == null) { return; }
                if (mergedstatuses.Length == 0) { return; }
            
                int OldOffset = 0;
                int oldIndex = 0;

                
                
                oldIndex = statList.SelectedIndex;
                OldOffset = statList.YOffset - (ClientSettings.ItemHeight * oldIndex);

                int oldCount = statList.Count;
                statList.Clear();
                foreach (Library.status stat in mergedstatuses)
                {
                    if (stat != null && stat.user != null && stat.user.screen_name != null)
                    {
                        FingerUI.StatusItem item = new FingerUI.StatusItem();
                        item.Tweet = stat;
                        statList.AddItem(item);
                    }
                }
                FingerUI.StatusItem currentItem = null;
                if (!ClientSettings.AutoScrollToTop)
                {
                    if (oldIndex >= 0 && KeepPosition && newItems < ClientSettings.MaxTweets)
                    {
                        try
                        {
                            statList.SelectedItem = statList[newItems];
                            currentItem = (FingerUI.StatusItem)statList.SelectedItem;
                            statList.YOffset = OldOffset + (newItems * ClientSettings.ItemHeight);
                        }
                        catch (KeyNotFoundException)
                        {
                            //What to do?
                        }
                    }
                    else
                    {
                        statList.JumpToLastSelected();
                        currentItem = (FingerUI.StatusItem)statList[0];
                    }
                }
                else
                {
                    statList.SelectedItem = statList[0];
                    statList.YOffset = 0;
                }
                if (currentItem != null)
                {
                    CurrentlySelectedAccount = currentItem.Tweet.Account;
                    UpdateRightMenu();
                }
                statList.Redraw();
                statList.RerenderPortal();
                statList.Repaint();
                
                
            }
        }
예제 #13
0
 void statusList_SelectedItemChanged(object sender, EventArgs e)
 {
     FingerUI.StatusItem statItem = (FingerUI.StatusItem)statList.SelectedItem;
     if (statItem == null) { return; }
     CurrentlySelectedAccount = statItem.Tweet.Account;
     SetConnectedMenus(GetMatchingConnection(CurrentlySelectedAccount), statItem);
     //UpdateRightMenu(); -- THIS IS DONE IN SETCONNECTEDMENUS
     UpdateHistoryPosition();
     int clickedNumber = statItem.Index + 1;
     SetLeftMenu();
     
     LastSelectedItems.SetLastSelected(statList.CurrentList(), statItem.Tweet, currentGroup);
 }