Esempio n. 1
0
        public List <MentionList> GetMentions(string format, string apiToken, string apiTokenSecret)
        {
            SinaApiService myApi    = new SinaApiService();
            string         myResult = myApi.mentions(format, consumerKey, consumerKeySecret, apiToken, apiTokenSecret);
            XDocument      doc      = XDocument.Parse(myResult);

            return(MentionList.Parse(doc.Root));
        }
 protected async override void OnNavigatedTo(NavigationEventArgs e)
 {
     if (e.NavigationMode == NavigationMode.New)
     {
         MentionList.Clear();
         page = 1;
         await getList();
     }
 }
Esempio n. 3
0
        private void btFavorite_Click(object sender, RoutedEventArgs e)
        {
            HyperlinkButton tmpButton   = (HyperlinkButton)sender;
            MentionList     MentionItem = (MentionList)tmpButton.DataContext;

            if (MentionItem != null)
            {
                MentionItem.IsFavorited = true;
                CreateFavorite(MentionItem.FriendTwitterID);
            }
        }
Esempio n. 4
0
        private void btRepost_Click(object sender, RoutedEventArgs e)
        {
            HyperlinkButton tmpButton   = (HyperlinkButton)sender;
            MentionList     MentionItem = (MentionList)tmpButton.DataContext;

            if (MentionItem != null)
            {
                userMentionChildWindow = new UserMentionChildWindow(MentionItem.FriendTwitterID);
                userMentionChildWindow.Show();
            }
        }
Esempio n. 5
0
        public void AddNewStatus(Status status)
        {
            MentionList.SuspendLayout();
            replies.Add(status);
            var newTweet = new TweetItem(status, this);

            MentionList.Controls.Add(newTweet);
            MentionList.Controls.SetChildIndex(newTweet, 0);
            MentionList.ResumeLayout();

            this.status = status;
        }
Esempio n. 6
0
        private void hbretweetImageViewer_Click(object sender, RoutedEventArgs e)
        {
            HyperlinkButton tmpLinkButton = (HyperlinkButton)sender;
            MentionList     MentionItem   = (MentionList)tmpLinkButton.DataContext;

            if (MentionItem != null)
            {
                imageViewerChildWindow = new ImageViewerChildWindow(MentionItem.UsersItem.FriendName, MentionItem.RetweeterItem.MiddleImageURL, MentionItem.RetweeterItem.OriginalImageURL);

                imageViewerChildWindow.Show();
            }
        }
Esempio n. 7
0
        private void btUnFavorite_Click(object sender, RoutedEventArgs e)
        {
            HyperlinkButton tmpButton   = (HyperlinkButton)sender;
            MentionList     MentionItem = (MentionList)tmpButton.DataContext;

            if (MentionItem != null)
            {
                MentionItem.IsFavorited = false;

                foreach (FavoriteList item in Globals.FavoriteCollection)
                {
                    if (item.FriendTwitterID == MentionItem.FriendTwitterID)
                    {
                        Globals.FavoriteCollection.Remove(item);
                        DelFavorite(MentionItem.FriendTwitterID);
                        break;
                    }
                }
            }
        }
Esempio n. 8
0
        /// <summary>
        /// Updates the mention, trend or SIR lists according to the message type.
        /// </summary>
        /// <param name="message"></param>
        private void UpdateLists(Message message)
        {
            // Update the relevant lists
            switch (message.MessageType)
            {
            case "E":
                URLList.Clear();
                foreach (var item in processor.QuarantinedLinks)
                {
                    URLList.Add("Link: " + item.Key.ToString() + "\nCount: " + item.Value.ToString());
                }
                Email email = (Email)message;
                if (email.EmailType == "SIR")
                {
                    SIRList.Clear();
                    SIR sir = (SIR)email;
                    // Loop through SIRList and Add new instances
                    foreach (var item in processor.SirList)
                    {
                        SIRList.Add("Sort Code: " + item.Key.ToString() + "\nCount: " + item.Value.ToString());
                    }
                }
                break;

            case "T":
                MentionList.Clear();
                TrendList.Clear();
                foreach (var item in processor.MentionsList)
                {
                    MentionList.Add("Mention: " + item.Key.ToString() + "\nCount: " + item.Value.ToString());
                }
                foreach (var item in processor.TrendingList)
                {
                    TrendList.Add("Trend: " + item.Key.ToString() + "\nCount : " + item.Value.ToString());
                }
                break;

            default:
                break;
            }
        }
Esempio n. 9
0
        private async Task GetReply(Status status)
        {
            try
            {
                if (status.InReplyToStatusId != null)
                {
                    Status replyStatus = await TwitterTools.ShowStatus(id : (long)status.InReplyToStatusId);

                    replies.Add(replyStatus);

                    MentionList.SuspendLayout();
                    MentionList.Controls.Add(new TweetItem(replyStatus, this));
                    MentionList.ResumeLayout();

                    await GetReply(replyStatus);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }
        private async Task getList()
        {
            islistbusy          = true;
            indicator.IsVisible = true;
            try
            {
                using (Stream stream = await new HttpHelp().Get(string.Format(StaticData.mention, page)))
                {
                    StreamReader sr  = new StreamReader(stream);
                    JObject      obj = JObject.Parse(sr.ReadToEnd());

                    if (!(bool)obj["success"])
                    {
                        if ((string)obj["message"] != null)
                        {
                            MessageBox.Show((string)obj["message"]);
                        }
                        indicator.IsVisible = false;
                        return;
                    }

                    int totalPage = (int)obj["totalPage"];
                    if (page < totalPage)
                    {
                        page++;
                    }
                    else
                    {
                        page = 0;
                    }

                    List <int>    commentList = new List <int>();
                    List <ACItem> contentList = new List <ACItem>();
                    foreach (var commentid in (obj["commentList"] as JArray))
                    {
                        commentList.Add((int)commentid);
                    }
                    foreach (var content in (obj["contentList"] as JArray))
                    {
                        contentList.Add(new ACItem((string)content["title"], (string)content["url"], (string)content["comments"], TimeFuc.getTime((long)content["releaseDate"]).ToString(), (string)content["username"], (string)content["description"]));
                    }
                    foreach (var item in obj["commentContentArr"].Values())
                    {
                        if (!commentContentArr.ContainsKey(item.ToObject <comment>().cid))
                        {
                            commentContentArr.Add(item.ToObject <comment>().cid, item.ToObject <comment>());
                        }
                    }

                    if (commentList.Count > 0)
                    {
                        for (int i = 0; i < commentList.Count; i++)
                        {
                            try
                            {
                                Mention item = new Mention();

                                item.title  = contentList[i].title;
                                item.href   = contentList[i].href;
                                item.dis    = contentList[i].dis;
                                item.time   = contentList[i].time;
                                item.name   = contentList[i].name;
                                item.beizhu = contentList[i].beizhu;

                                comment comment = commentContentArr[commentList[i]];

                                item.content  = comment.content;
                                item.userName = comment.userName;
                                item.postDate = comment.postDate;
                                item.userImg  = comment.userImg;
                                item.count    = comment.count;

                                if (comment.quoteId != 0)
                                {
                                    comment pcomment = commentContentArr[comment.quoteId];
                                    item.pcontent  = pcomment.content;
                                    item.puserName = pcomment.userName;
                                    item.ppostDate = pcomment.postDate;
                                    item.pcount    = pcomment.count;
                                }

                                MentionList.Add(item);
                            }
                            catch { }
                        }
                    }
                }
            }
            catch { }
            islistbusy          = false;
            indicator.IsVisible = false;
        }