Ejemplo n.º 1
0
        public void DeleteTweet(ClientStreamDelete tweet)
        {
            ClientTweet deleteRetweet = null;

            lock (lockObject)
            {
                foreach (KeyValuePair <eTweetPanel, ObservableCollection <ClientTweet> > list in dicTweetTree)
                {
                    for (int i = 0; i < list.Value.Count; i++)
                    {
                        if (list.Value[i].originalTweet == null)
                        {
                            continue;                                                          //버튼!!!
                        }
                        if (list.Value[i].id == tweet.delete.status.id)                        //일반 트윗 체크
                        {
                            list.Value[i].uiProperty.isDeleteTweet = true;
                            dicHashs[list.Key].Remove(list.Value[i].id);
                            list.Value[i].originalTweet.retweeted = false;
                            deleteRetweet = list.Value[i];
                        }
                        else if (list.Value[i].originalTweet.id == tweet.delete.status.id)                        //리트윗 체크, 원본 터지면 같이 삭제
                        {
                            list.Value[i].uiProperty.isDeleteTweet = true;
                            dicHashs[list.Key].Remove(list.Value[i].originalTweet.id);
                            list.Value[i].originalTweet.retweeted = false;
                            deleteRetweet = list.Value[i];
                        }
                    }
                }
            }

            //if (deleteRetweet != null)
            //Retweet(deleteRetweet, false);
        }
Ejemplo n.º 2
0
 private void ResponseUSDelete(ClientStreamDelete delete)
 {
     TweetInstence.DeleteTweet(delete);
     //DDeleteTweet dele = new DDeleteTweet(TweetInstence.DeleteTweet);
     //Application.Current.Dispatcher.BeginInvoke(dele, new object[] { delete });
 }
Ejemplo n.º 3
0
        private void ResponseJson(string json)
        {
            //try
            //{
            //	Friends friends = JsonConvert.DeserializeObject<Friends>(json);
            //	return;
            //}
            //catch (Exception e) { }
            try
            {
                ClientTweet tweet = JsonConvert.DeserializeObject <ClientTweet>(json);
                if (tweet?.created_at != null && tweet.dateTime != DateTime.MinValue)
                {
                    if (OnTweet != null)
                    {
                        Application.Current.Dispatcher.BeginInvoke(OnTweet, new object[] { tweet });
                    }
                    //OnTweet?.Invoke(tweet);
                    return;
                }
            }
            catch (Exception e) { }

            try
            {
                ClientStreamDelete delete = JsonConvert.DeserializeObject <ClientStreamDelete>(json);
                if (delete?.delete != null)
                {
                    if (OnDelete != null)
                    {
                        Application.Current.Dispatcher.BeginInvoke(OnDelete, new object[] { delete });
                    }
                    //OnDelete?.Invoke(delete);
                    return;
                }
            }
            catch (Exception e) { }

            try
            {
                StreamDirectMessage dm = JsonConvert.DeserializeObject <StreamDirectMessage>(json);
                if (dm?.direct_message != null)
                {
                    if (OnDM != null)
                    {
                        Application.Current.Dispatcher.BeginInvoke(OnDM, new object[] { dm });
                    }
                    //OnDM?.Invoke(dm);
                    return;
                }
            }
            catch (Exception e) { }

            try
            {
                StreamEvent streamEvent = JsonConvert.DeserializeObject <StreamEvent>(json);
                if (streamEvent?.Event != null)
                {
                    if (OnEvent != null)
                    {
                        Application.Current.Dispatcher.BeginInvoke(OnEvent, new object[] { streamEvent });
                    }
                    //OnEvent?.Invoke(streamEvent);
                    return;
                }
            }
            catch (Exception e) { }
        }