Interaction logic for TweetElement.xaml
Inheritance: System.Windows.Controls.UserControl, IDisposable
Example #1
0
        private void prefetch(UserDatabase.User usr)
        {
            TwitterStatusCollection prefetch = usr.tweetStack.Twitter.GetTweets();

            foreach (TwitterStatus status in prefetch)
            {
                TweetElement element = new TweetElement(this, status, usr, ImageCache.GetImage(status.User.Id, status.User.ProfileImageLocation));
                element.polyOpacity = polygonOpacity;
                this.TweetElements.Items.Add(element);

                if (this.TweetElements.Items.Count > o3o.Properties.Settings.Default.amountOfTWeetsToDisplay)
                {
                    TweetElement el = (TweetElement)this.TweetElements.Items[this.TweetElements.Items.Count - 1];
                    this.TweetElements.Items.Remove(el);
                    el.Dispose();
                }
            }

            TwitterStatusCollection prefetchMentions = usr.tweetStack.Twitter.GetMentions();

            foreach (TwitterStatus status in prefetchMentions)
            {
                TweetElement element = new TweetElement(this, status, usr, ImageCache.GetImage(status.User.Id, status.User.ProfileImageLocation));
                element.polyOpacity = polygonOpacity;
                this.TweetMentions.Items.Add(element);

                if (this.TweetElements.Items.Count > o3o.Properties.Settings.Default.amountOfTWeetsToDisplay)
                {
                    TweetElement el = (TweetElement)this.TweetMentions.Items[this.TweetMentions.Items.Count - 1];
                    this.TweetMentions.Items.Remove(el);
                    el.Dispose();
                }
            }

            TwitterDirectMessageCollection fetchmessages = usr.tweetStack.Twitter.GetMessages();

            foreach (TwitterDirectMessage message in fetchmessages)
            {
                DMElement element = new DMElement(this, message, usr, ImageCache.GetImage(message.SenderId, message.Sender.ProfileImageLocation));
                element.polyOpacity = polygonOpacity;
                this.TweetMessages.Items.Add(element);

                if (this.TweetMessages.Items.Count > o3o.Properties.Settings.Default.amountOfTWeetsToDisplay)
                {
                    DMElement el = (DMElement)this.TweetMessages.Items[this.TweetMessages.Items.Count - 1];
                    this.TweetMessages.Items.Remove(el);
                    el.Dispose();
                }
            }
        }
Example #2
0
 void SetTweetDate(DMElement tweet, TimeSpan Difference)
 {
     if (Difference.Days > 0)
     {
         tweet.datelabel.Text = tweet.Status.CreatedDate.Day.ToString() + " " + CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(tweet.Status.CreatedDate.Month).Substring(0, 3) + " " + tweet.Status.CreatedDate.Year;
     }
     else if (Difference.Hours > 0)
     {
         tweet.datelabel.Text = Difference.Hours.ToString() + "h";
     }
     else if (Difference.Hours <= 1 && Difference.Minutes >= 1)
     {
         tweet.datelabel.Text = Difference.Minutes.ToString() + "m";
     }
     else if (Difference.Minutes < 1)
     {
         tweet.datelabel.Text = Difference.Seconds.ToString() + "s";
     }
 }
Example #3
0
        void o3o_NewDM(TwitterDirectMessage DM, UserDatabase.User _usr)  // PLZ CHECK IF WORK
        {
            DMElement element;

            if (UsrDB.Users.Count > 1)
            {
                element = new DMElement(this, DM, _usr, ImageCache.GetImage(DM.Sender.Id, DM.Sender.ProfileImageLocation), true);
            }
            else
            {
                element = new DMElement(this, DM, _usr, ImageCache.GetImage(DM.Sender.Id, DM.Sender.ProfileImageLocation));
            }
            element.polyOpacity = polygonOpacity;
            this.TweetMessages.Items.Add(element);
            if (this.TweetMessages.Items.Count > o3o.Properties.Settings.Default.amountOfTWeetsToDisplay)
            {
                TweetElement el = (TweetElement)this.TweetMessages.Items[this.TweetMessages.Items.Count - 1];
                this.TweetMessages.Items.Remove(el);
                el.Dispose();
            }
        }
Example #4
0
 // PLZ CHECK IF WORK
 void o3o_NewDM(TwitterDirectMessage DM, UserDatabase.User _usr)
 {
     DMElement element = new DMElement(Mainwindow, DM, _usr);
     element.polyOpacity = polygonOpacity;
     Mainwindow.TweetMessages.Items.Add(element);
     if (Mainwindow.TweetMessages.Items.Count > o3o.Properties.Settings.Default.amountOfTWeetsToDisplay)
     {
         Mainwindow.TweetMessages.Items.RemoveAt(Mainwindow.TweetElements.Items.Count);
     }
 }
Example #5
0
 void SetTweetDate(DMElement tweet, TimeSpan Difference)
 {
     if (Difference.Days > 0)
     {
         tweet.datelabel.Text = tweet.Status.CreatedDate.Day.ToString() + " " + CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(tweet.Status.CreatedDate.Month).Substring(0, 3) +" "+ tweet.Status.CreatedDate.Year;
     }
     else if (Difference.Hours > 0)
     {
         tweet.datelabel.Text = Difference.Hours.ToString() + "h";
     }
     else if (Difference.Hours <= 1 && Difference.Minutes >= 1)
     {
         tweet.datelabel.Text = Difference.Minutes.ToString() + "m";
     }
     else if (Difference.Minutes < 1)
     {
         tweet.datelabel.Text = Difference.Seconds.ToString() + "s";
     }
 }
Example #6
0
        private void prefetch(UserDatabase.User usr)
        {
            TwitterStatusCollection prefetch = usr.tweetStack.Twitter.GetTweets();
            foreach (TwitterStatus status in prefetch)
            {

                TweetElement element = new TweetElement(this, status, usr, ImageCache.GetImage(status.User.Id, status.User.ProfileImageLocation));
                element.polyOpacity = polygonOpacity;
                this.TweetElements.Items.Add(element);

                if (this.TweetElements.Items.Count > o3o.Properties.Settings.Default.amountOfTWeetsToDisplay)
                {
                    TweetElement el = (TweetElement)this.TweetElements.Items[this.TweetElements.Items.Count - 1];
                    this.TweetElements.Items.Remove(el);
                    el.Dispose();
                }
            }

            TwitterStatusCollection prefetchMentions = usr.tweetStack.Twitter.GetMentions();

            foreach (TwitterStatus status in prefetchMentions)
            {

                TweetElement element = new TweetElement(this, status, usr, ImageCache.GetImage(status.User.Id, status.User.ProfileImageLocation));
                element.polyOpacity = polygonOpacity;
                this.TweetMentions.Items.Add(element);

                if (this.TweetElements.Items.Count > o3o.Properties.Settings.Default.amountOfTWeetsToDisplay)
                {
                    TweetElement el = (TweetElement)this.TweetMentions.Items[this.TweetMentions.Items.Count - 1];
                    this.TweetMentions.Items.Remove(el);
                    el.Dispose();
                }
            }

            TwitterDirectMessageCollection fetchmessages = usr.tweetStack.Twitter.GetMessages();

            foreach (TwitterDirectMessage message in fetchmessages)
            {

                DMElement element = new DMElement(this, message, usr, ImageCache.GetImage(message.SenderId, message.Sender.ProfileImageLocation));
                element.polyOpacity = polygonOpacity;
                this.TweetMessages.Items.Add(element);

                if (this.TweetMessages.Items.Count > o3o.Properties.Settings.Default.amountOfTWeetsToDisplay)
                {
                    DMElement el = (DMElement)this.TweetMessages.Items[this.TweetMessages.Items.Count - 1];
                    this.TweetMessages.Items.Remove(el);
                    el.Dispose();
                }
            }
        }
Example #7
0
 // PLZ CHECK IF WORK
 void o3o_NewDM(TwitterDirectMessage DM, UserDatabase.User _usr)
 {
     DMElement element;
     if (UsrDB.Users.Count > 1)
     {
          element = new DMElement(this, DM, _usr, ImageCache.GetImage(DM.Sender.Id, DM.Sender.ProfileImageLocation), true);
     }
     else
     {
          element = new DMElement(this, DM, _usr, ImageCache.GetImage(DM.Sender.Id, DM.Sender.ProfileImageLocation));
     }
     element.polyOpacity = polygonOpacity;
     this.TweetMessages.Items.Add(element);
     if (this.TweetMessages.Items.Count > o3o.Properties.Settings.Default.amountOfTWeetsToDisplay)
     {
         TweetElement el = (TweetElement)this.TweetMessages.Items[this.TweetMessages.Items.Count - 1];
         this.TweetMessages.Items.Remove(el);
         el.Dispose();
     }
 }