Ejemplo n.º 1
0
        void backgroundWorkerMentions_DoWork(object sender, DoWorkEventArgs e)
        {
            Tuple <List <Post>, ApiCallResponse> items;
            ParametersMyStream parameter = new ParametersMyStream();

            parameter.count = Properties.Settings.Default.TwitterItemsFetchInPast;
            if (Mentions.Count > 0)
            {
                parameter.since_id = Mentions.Max(i => i.Id).ToString();
            }
            parameter.include_annotations = true;
            items = Posts.getMentionsOfUsernameOrId(this.accessToken, this.username, parameter);

            if (items.Item2.success)
            {
                foreach (Post post in items.Item1)
                {
                    if (!post.machine_only && !string.IsNullOrEmpty(post.text) && !post.is_deleted)
                    {
                        ApnItem item = new ApnItem(post, this);
                        if (item != null)
                        {
                            item.isMention        = true;
                            item.receivingAccount = this;
                            backgroundWorkerMentions.ReportProgress(50, item);
                        }
                    }
                }
                backgroundWorkerMentions.ReportProgress(99, items.Item2);
            }
        }