Interaction logic for TweetElement.xaml
Inheritance: System.Windows.Controls.UserControl, IDisposable
Ejemplo n.º 1
0
        public void FillHome(TwitterStatus status, UserDatabase.User _usr)
        {
            if (status.InReplyToScreenName == UsrDB.Users.Find(u => u.UserDetails.ScreenName == _usr.UserDetails.ScreenName).UserDetails.ScreenName)
            {
                FillMentions(status, _usr);
            }
            TweetElement element;

            if (UsrDB.Users.Count > 1)
            {
                element = new TweetElement(this, status, _usr, ImageCache.GetImage(status.User.Id, status.User.ProfileImageLocation), true);
            }
            else
            {
                element = new TweetElement(this, status, _usr, ImageCache.GetImage(status.User.Id, status.User.ProfileImageLocation));
            }
            element.polyOpacity = polygonOpacity;
            this.TweetElements.Items.Insert(0, 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();
            }
        }
Ejemplo n.º 2
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();
                }
            }
        }
Ejemplo n.º 3
0
 public void Notification(TwitterStatus status, UserDatabase.User _usr)
 {
     if (o3o.Properties.Settings.Default.ShowNotificationPopup)
     {
         notify       notification = new notify(this);
         TweetElement element;
         if (UsrDB.Users.Count > 1)
         {
             element = new TweetElement(this, status, _usr, ImageCache.GetImage(status.User.Id, status.User.ProfileImageLocation), true);
         }
         else
         {
             element = new TweetElement(this, status, _usr, ImageCache.GetImage(status.User.Id, status.User.ProfileImageLocation));
         }
         element.polyOpacity = polygonOpacity;
         notification.content.Items.Add(element);
         playsound();
     }
 }
Ejemplo n.º 4
0
 void SetTweetDate(TweetElement 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);
     }
     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";
     }
 }
Ejemplo n.º 5
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();
            }
        }
Ejemplo n.º 6
0
 public void FillMentions(TwitterStatus status, UserDatabase.User _usr)
 {
     TweetElement element = new TweetElement(Mainwindow, status, _usr);
     element.polyOpacity = polygonOpacity;
     Mainwindow.TweetMentions.Items.Insert(0, element);
     if (Mainwindow.TweetMentions.Items.Count > o3o.Properties.Settings.Default.amountOfTWeetsToDisplay)
     {
         //Mainwindow.TweetMentions.Items.RemoveAt(Mainwindow.TweetElements.Items.Count-1);
         TweetElement el = Mainwindow.TweetMentions.Items[Mainwindow.TweetElements.Items.Count - 1];
         Mainwindow.TweetMentions.Items.Remove(el);
         el.Dispose();
     }
 }
Ejemplo n.º 7
0
        public void Notification(TwitterStatus status, UserDatabase.User _usr)
        {
            notify notification = new notify();
            TweetElement element = new TweetElement(Mainwindow, status, _usr);

            element.polyOpacity = polygonOpacity;
            element.replyBtn.Source = new BitmapImage(new Uri("/o3o;component/Images/reply.png", UriKind.Relative));
            notification.content.Items.Add(element);
            playsound();
        }
Ejemplo n.º 8
0
 public void FillHome(TwitterStatus status, UserDatabase.User _usr)
 {
     if (status.InReplyToScreenName == UsrDB.Users.Find(u => u.UserDetails.ScreenName == _usr.UserDetails.ScreenName).UserDetails.ScreenName)
     {
         FillMentions(status, _usr) ;
     }
     TweetElement element = new TweetElement(Mainwindow, status, _usr);
     element.polyOpacity = polygonOpacity;
     Mainwindow.TweetElements.Items.Insert(0, element);
     if (Mainwindow.TweetElements.Items.Count > o3o.Properties.Settings.Default.amountOfTWeetsToDisplay)
     {
        // Mainwindow.TweetElements.Items[Mainwindow.TweetElements.Items.Count - 1].Dispose();
         //Mainwindow.TweetElements.Items.RemoveAt(Mainwindow.TweetElements.Items.Count-1);
         TweetElement el = Mainwindow.TweetElements.Items[Mainwindow.TweetElements.Items.Count - 1];
         Mainwindow.TweetElements.Items.Remove(el);
         el.Dispose();
     }
 }
Ejemplo n.º 9
0
 void SetTweetDate(TweetElement 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);
     }
     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";
     }
 }
Ejemplo n.º 10
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();
                }
            }
        }
Ejemplo n.º 11
0
 public void Notification(TwitterStatus status, UserDatabase.User _usr)
 {
     if (o3o.Properties.Settings.Default.ShowNotificationPopup)
     {
         notify notification = new notify(this);
         TweetElement element;
         if (UsrDB.Users.Count > 1)
         {
             element = new TweetElement(this, status, _usr, ImageCache.GetImage(status.User.Id, status.User.ProfileImageLocation), true);
         }
         else
         {
             element = new TweetElement(this, status, _usr, ImageCache.GetImage(status.User.Id, status.User.ProfileImageLocation));
         }
         element.polyOpacity = polygonOpacity;
         notification.content.Items.Add(element);
         playsound();
     }
 }
Ejemplo n.º 12
0
 public void FillMentions(TwitterStatus status, UserDatabase.User _usr)
 {
     TweetElement element;
     if (UsrDB.Users.Count > 1)
     {
         element = new TweetElement(this, status, _usr, ImageCache.GetImage(status.User.Id, status.User.ProfileImageLocation), true);
     }
     else
     {
         element = new TweetElement(this, status, _usr, ImageCache.GetImage(status.User.Id, status.User.ProfileImageLocation));
     }
     element.polyOpacity = polygonOpacity;
     this.TweetMentions.Items.Insert(0, element);
     if (this.TweetMentions.Items.Count > o3o.Properties.Settings.Default.amountOfTWeetsToDisplay)
     {
         TweetElement el = (TweetElement)this.TweetMentions.Items[this.TweetElements.Items.Count - 1];
         this.TweetMentions.Items.Remove(el);
         el.Dispose();
     }
 }