Esempio n. 1
0
 public void AddMuteTweet(ClientTweet tweet)
 {
     if (dicMuteTweet.ContainsKey(tweet.originalTweet.id) == false)
     {
         dicMuteTweet.Add(tweet.originalTweet.id, tweet.originalTweet.text);
     }
 }
Esempio n. 2
0
        /// <summary>
        /// 특정 트윗의 treeviewitem을 찾아 선택 합니다.
        /// </summary>
        /// <param name="tweet">선택 할 트윗</param>
        /// <param name="index">index를 지정 해서 선택 할 경우</param>
        /// <returns></returns>
        private bool FocusTreeViewItem(ClientTweet tweet, int index = -1)
        {
            if (tweet == null)
            {
                return(false);
            }
            if (index == -1)            //index를 지정 해서 focus요청 할 경우가 아닌 경우
            {
                index = FindParentIndex(tweet, listTweet);
            }
            if (index == -1)
            {
                return(false);
            }
            TreeViewItem item = null;

            //for (int i = 0; i < 50; i++)
            //{
            item = GetTreeViewItem(treeView, tweet, index);
            //	if (item == null) break;
            //	if (item.IsVisible) break;
            //}
            SelectTreeViewItem(item);
            return(true);
        }
Esempio n. 3
0
        private ClientTweet GetPrevItem_Recursion(ClientTweet parent, ObservableCollection <ClientTweet> items)
        {
            for (int i = items.Count - 1; i > -1; i--)
            {
                ClientTweet prevParent = items[i];

                if (prevParent.Equals(treeView.SelectedItem))                //선택 한 아이템일 경우 상위 노드를 리턴해야 함
                {
                    if (i - 1 < 0)
                    {
                        bFind = true;
                        return(parent);
                    }
                    else
                    {
                        ClientTweet prevItem = items[i - 1];
                        return(prevItem);
                    }
                }
                ClientTweet ret = GetPrevItem_Recursion(prevParent, prevParent.uiProperty.childNode);
                if (ret != null)
                {
                    return(ret);
                }
            }
            return(null);
        }
Esempio n. 4
0
        private void ReplyAll()
        {
            ClientTweet tweet = selectTweet;

            if (tweet == null)
            {
                return;
            }
            if (tweet.originalTweet == null || tweet.user == null)
            {
                return;
            }

            StringBuilder sb = new StringBuilder();

            sb.Append($"@{tweet.user.screen_name} ");
            if (tweet.retweeted)
            {
                sb.Append($"@{tweet.originalTweet.user.screen_name} ");
            }
            foreach (string name in tweet.hashMention)
            {
                if (DataInstence.CheckIsMe(name) == false)
                {
                    sb.Append($"@{name} ");
                }
            }
            inputTweetBox.Text           = sb.ToString();
            inputTweetBox.SelectionStart = inputTweetBox.Text.Length;
            replyTweet = tweet;
            EnterInputTweet();
        }
Esempio n. 5
0
        //-------------------------------------------------------------------------------------------
        //---------------------------------이미지 미리보기용--------------------------------------
        //-------------------------------------------------------------------------------------------
        private void Image_MouseEnter(object sender, MouseEventArgs e)
        {
            Grid grid = sender as Grid;

            if (grid == null)
            {
                return;
            }
            ClientTweet tweet = grid.DataContext as ClientTweet;

            if (tweet == null)
            {
                return;
            }

            Image i1 = Generate.FindElementByName <Image>(grid, "image1");
            Image i2 = Generate.FindElementByName <Image>(grid, "image2");
            Image i3 = Generate.FindElementByName <Image>(grid, "image3");
            Image i4 = Generate.FindElementByName <Image>(grid, "image4");

            imagePreview1.Source = i1?.Source;
            imagePreview2.Source = i2?.Source;
            imagePreview3.Source = i3?.Source;
            imagePreview4.Source = i4?.Source;
            gridPreview.Width    = (tweet.mediaEntities.media.Count * 100) + (5 * tweet.mediaEntities.media.Count) + 5;

            MoveGridPreview(grid);

            gridPreview.Visibility = Visibility.Visible;
        }
Esempio n. 6
0
 public void Delete(ClientTweet tweet)
 {
     if (OnDelete != null)
     {
         Application.Current.Dispatcher.BeginInvoke(OnDelete, new object[] { tweet });
     }
 }
Esempio n. 7
0
        public void Retweet(ClientTweet tweet)
        {
            if (tweet.user.Protected && DataInstence.CheckIsMe(tweet.user.id) == false &&
                DataInstence.option.isRetweetProtectUser == false)
            {
                DalsaeInstence.ShowMessageBox("잠금 계정의 트윗은 리트윗 할 수 없습니다.\r", "알림");
                return;
            }

            if (tweet.originalTweet.retweeted == false)
            {
                MessageBoxResult mr = DalsaeInstence.ShowMessageBox("선택한 트윗을 리트윗 하시겠습니까?", "리트윗 확인", MessageBoxButton.YesNo);
                if (mr != MessageBoxResult.Yes)
                {
                    return;
                }
            }
            if (tweet.user.Protected && tweet.isRetweet == false && DataInstence.CheckIsMe(tweet.user.id) == false)
            {
                DalsaeInstence.RetweetProtect(tweet);
            }
            else
            {
                DalsaeInstence.Retweet(tweet.originalTweet.id, !tweet.originalTweet.retweeted);
            }
        }
Esempio n. 8
0
        public VideoWindow(ClientTweet tweet)
        {
            LoadResources(bitmapMute, Properties.Resources.mute);
            LoadResources(bitmapVolume, Properties.Resources.volume);
            LoadResources(bitmapNext, Properties.Resources.next);
            LoadResources(bitmapPrev, Properties.Resources.prev);
            LoadResources(bitmapPause, Properties.Resources.pause);
            LoadResources(bitmapPlay, Properties.Resources.play);

            InitializeComponent();
            labelTime.Content     = "";
            gridTweet.DataContext = tweet.originalTweet;
            this.tweet            = tweet;
            if (DataInstence.option.isShowImageTweet)
            {
                gridTweet.Visibility = Visibility.Visible;
            }

            LoadVideo();
            SetPosition();
            SetVolume();
            SetVolumeIcon();

            gridBottom.Visibility = Visibility.Collapsed;
        }
Esempio n. 9
0
 public void Tweet(ClientTweet tweet)
 {
     if (OnTweet != null)
     {
         Application.Current.Dispatcher.BeginInvoke(OnTweet, new object[] { tweet });
     }
 }
Esempio n. 10
0
        private void DeleteTweet()
        {
            ClientTweet tweet = selectTweet;

            if (tweet == null)
            {
                return;
            }
            if (tweet.originalTweet == null)
            {
                return;
            }

            if (tweet.user == null)
            {
                return;
            }
            if (tweet.originalTweet.user.id != DataInstence.userInfo.user.id)
            {
                return;                                                                          //자기 트윗 아니면 종료
            }
            if (tweet.uiProperty.isDeleteTweet)
            {
                return;                                            //이미 삭제된 트윗이면 종료
            }
            MessageBoxResult mbr = MessageBox.Show("트윗을 삭제 하시겠습니까?", "삭제", MessageBoxButton.YesNo, MessageBoxImage.None);

            if (mbr == MessageBoxResult.Yes)
            {
                DalsaeInstence.TweetDelete(tweet.originalTweet.id);
            }
            FocusPanel();
        }
Esempio n. 11
0
        public ImageWindow(ClientTweet tweet, string url)
        {
            InitializeComponent();
            listImageControl.Add(image0);
            listImageControl.Add(image1);
            listImageControl.Add(image2);
            listImageControl.Add(image3);

            listProgress.Add(new ImageProgress(progressBar0));
            listProgress.Add(new ImageProgress(progressBar1));
            listProgress.Add(new ImageProgress(progressBar2));
            listProgress.Add(new ImageProgress(progressBar3));
            mainImageProgress = new ImageProgress(mainProgress);

            grid.DataContext = tweet.originalTweet;
            this.tweet       = tweet;
            if (DataInstence.option.isShowImageTweet)
            {
                grid.Visibility = Visibility.Visible;
            }
            if (DataInstence.option.isShowImageBottom == false)
            {
                bottomGrid.Visibility = Visibility.Collapsed;
                rowBottom.Height      = new GridLength(0);
            }
            for (int i = 0; i < tweet.mediaEntities.media.Count; i++)
            {
                if (tweet.mediaEntities.media[i].display_url == url && tweet.mediaEntities.media[i].type == "photo")
                {
                    listMedia.Add(tweet.mediaEntities.media[i]);
                }
            }

            LoadImage(DataInstence.option.isLoadOriginalImage);
        }
Esempio n. 12
0
        private void AddHashTag()
        {
            ClientTweet tweet = selectTweet;

            if (tweet == null)
            {
                return;
            }
            if (tweet.originalTweet == null)
            {
                return;
            }

            if (tweet.lastEntities.hashtags.Count == 0)
            {
                return;
            }

            StringBuilder sb = new StringBuilder();

            for (int i = 0; i < tweet.lastEntities.hashtags.Count; i++)
            {
                sb.Append($" #{tweet.lastEntities.hashtags[i].text} ");
            }
            inputTweetBox.Text           = sb.ToString();
            inputTweetBox.SelectionStart = 0;
            EnterInputTweet();
        }
Esempio n. 13
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);
        }
Esempio n. 14
0
        private void contextClick_Url(object sender, RoutedEventArgs e)
        {
            MenuItem item = sender as MenuItem;

            if (item == null)
            {
                return;
            }
            ClientTweet tweet = selectTweet;

            if (tweet == null)
            {
                return;
            }

            for (int i = 0; i < tweet.listUrl.Count; i++)
            {
                ClientURL url = item.Tag as ClientURL;
                if (url == null)
                {
                    continue;
                }
                if (tweet.listUrl[i].expanded_url == url.expanded_url)
                {
                    System.Diagnostics.Process.Start(tweet.listUrl[i].expanded_url);
                    TweetInstence.AddTweet(eTweetPanel.eOpen, tweet);
                    break;
                }
            }
        }
Esempio n. 15
0
 private void CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
 {
     if (e.Action == NotifyCollectionChangedAction.Add)
     {
         if (_scrollViewer.ContentVerticalOffset != 0.0)                ///스크롤 고정용 기능
         {
             isAddedTweet       = true;
             prevScrollPosition = _scrollViewer.ContentVerticalOffset;
             int index = 0;
             if (e.NewItems[0] is ClientTweet)
             {
                 ClientTweet tweet = e.NewItems[0] as ClientTweet;
                 index = listTweet.IndexOf(tweet);
             }
             else
             {
                 ClientDirectMessage dm = e.NewItems[0] as ClientDirectMessage;
                 index = listDM.IndexOf(dm);
             }
             TreeViewItem addedItem = GetTreeViewItem(treeView, e.NewItems[0], index);
             if (addedItem == null)
             {
                 return;
             }
             addedItem.Loaded += AddTreeViewItem_LoadedScroll;
         }
         //addedItem.Loaded += SetBackgroundTweet;
         //prevScrollPosition = _scrollViewer.ContentVerticalOffset + firstItem.DesiredSize.Height;
         //_scrollViewer.ScrollToVerticalOffset(prevScrollPosition);
     }
 }
Esempio n. 16
0
 public void SingleTweet(ClientTweet tweet, UIProperty property)
 {
     if (OnSingleTweet != null)
     {
         Application.Current.Dispatcher.BeginInvoke(OnSingleTweet, new object[] { tweet, property });
     }
 }
Esempio n. 17
0
 public void Focus()
 {
     if (treeView.Items?.Count == 0)
     {
         treeView.Focus();
     }
     else if (treeView.SelectedItem == null)
     {
         if (listTweet != null)
         {
             FocusTreeViewItem(listTweet[0], 0);
         }
         else if (listDM != null)
         {
             TreeViewItem item = GetTreeViewItem(treeView, listDM[0], 0);
             if (item != null)
             {
                 item.Focus();
             }
         }
     }
     else if (listTweet != null)         //트윗을 선택 하고 이전 스크롤 유지하는 기능
     {
         ClientTweet tweet = treeView.SelectedItem as ClientTweet;
         if (tweet == null)
         {
             //App.SendException("TreeViewManager Focus Tweet NULL!");
             treeView.Focus();
             return;
         }
         int index = FindParentIndex(tweet, listTweet);
         if (index == -1)
         {
             return;
         }
         TreeViewItem treeViewItem = GetTreeViewItem(treeView, tweet, index);
         if (treeViewItem == null)
         {
             //App.SendException("TreeViewManager Focus TreeViewItem NULL!");
             treeView.Focus();
             return;
         }
         Point selPoint = treeViewItem.TranslatePoint(new Point(0, 0), scrollViewer);
         if (selPoint.Y < 0 && selPoint.Y + treeViewItem.ActualHeight < 0 || selPoint.Y > scrollViewer.ActualHeight)
         {
             prevScrollPosition = scrollViewer.VerticalOffset;
         }
         SelectTreeViewItem(treeViewItem);
     }
     else
     {
         ClientDirectMessage dm = treeView.SelectedItem as ClientDirectMessage;
         int index = listDM.IndexOf(dm);
         GetTreeViewItem(treeView, dm, index)?.Focus();
     }
 }
Esempio n. 18
0
        /// <summary>
        /// 하위 트윗 추가(대화, 인용)
        /// </summary>
        /// <param name="tweet">대화 트윗</param>
        private void AddTweet(ClientTweet tweet)
        {
            if (hashTweet.Contains(tweet.id))
            {
                return;
            }

            hashTweet.Add(tweet.id);
            childNode.Add(tweet);
        }
Esempio n. 19
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            object ret   = null;
            string param = parameter?.ToString() ?? "";

            if (targetType.Name == "ImageSource")
            {
                if (value is ClientTweet)
                {
                    ClientTweet tweet = value as ClientTweet;
                    if (tweet.originalTweet == null)
                    {
                        App.SendException("Propic Converter Original Tweet NULL!", "");
                        return(null);
                    }
                    if (tweet.originalTweet.user == null)
                    {
                        App.SendException("Propic Converter Original Tweet -> user NULL!", "");
                        return(null);
                    }
                    if (param == "big")
                    {
                        ret = tweet.originalTweet?.user?.profile_image_url.Replace("_normal", "_bigger");
                    }
                    else
                    {
                        ret = tweet.originalTweet?.user?.profile_image_url;
                    }
                }
                else if (value is string)
                {
                    string str = value.ToString();
                    if (param == "big")
                    {
                        ret = str.Replace("_normal", "_bigger");
                    }
                    else
                    {
                        ret = str;
                    }
                }
            }
            else if (targetType.Name == "Visibility")
            {
                if (param == "big")
                {
                    ret = DataInstence.option.isBigPropic ? Visibility.Visible : Visibility.Collapsed;
                }
                else
                {
                    ret = DataInstence.option.isBigPropic == false ? Visibility.Visible : Visibility.Collapsed;
                }
            }
            return(ret);
        }
Esempio n. 20
0
        private void contextClick_UserRetweetOff(object sender, RoutedEventArgs e)
        {
            ClientTweet tweet = selectTweet;

            if (tweet == null)
            {
                return;
            }

            DalsaeInstence.RetweetOff(tweet.user.id);
        }
Esempio n. 21
0
 private void ClearInput()
 {
     isAddedGif         = false;
     pathGif            = string.Empty;
     replyTweet         = null;
     inputTweetBox.Text = "";
     ClearPreviewImage();
     listBitmapImage.Clear();
     UpdateImage();
     FocusPanel();
 }
Esempio n. 22
0
        private void contextOnOpening(object sender, ContextMenuEventArgs e)
        {
            ClientTweet tweet = selectTweet;
            Grid        grid  = sender as Grid;

            if (tweet == null || grid == null)
            {
                return;
            }
            grid.ContextMenu = CreateContextMenu(tweet);
        }
Esempio n. 23
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            object ret = null;

            if (targetType.Name == "ImageSource")
            {
                ClientTweet tweet = value as ClientTweet;
                if (tweet == null)
                {
                    return(null);
                }
                if (tweet.isPhoto)
                {
                    string param = parameter?.ToString() ?? "";
                    if (param == "one" && tweet.mediaEntities.media.Count > 0)
                    {
                        ret = $"{tweet.mediaEntities.media[0].media_url_https}:thumb";
                    }
                    else if (param == "two" && tweet.mediaEntities.media.Count > 1)
                    {
                        ret = $"{tweet.mediaEntities.media[1].media_url_https}:thumb";
                    }
                    else if (param == "three" && tweet.mediaEntities.media.Count > 2)
                    {
                        ret = $"{tweet.mediaEntities.media[2].media_url_https}:thumb";
                    }
                    else if (param == "four" && tweet.mediaEntities.media.Count > 3)
                    {
                        ret = $"{tweet.mediaEntities.media[3].media_url_https}:thumb";
                    }
                    else
                    {
                        ret = null;
                    }
                }
                else if (tweet.isMovie)               //동영상 썸네일
                {
                    string param = parameter?.ToString() ?? "";
                    if (param == "one" && tweet.extended_entities?.media.Count > 0)
                    {
                        ret = $"{tweet.extended_entities.media[0].media_url_https}:thumb";
                    }
                    else
                    {
                        ret = null;
                    }
                }
            }
            else if (targetType.Name == "Visibility")
            {
                ret = DataInstence.option.isShowPreview ? Visibility.Visible : Visibility.Collapsed;
            }
            return(ret);
        }
Esempio n. 24
0
 public void LoadSingleTweet(ClientTweet tweet)
 {
     if (tweet.isQTRetweet)
     {
         apiInstence.LoadSingleTweet(tweet, tweet.originalTweet.quoted_status_id_str);
     }
     if (string.IsNullOrEmpty(tweet.originalTweet.in_reply_to_status_id_str) == false)
     {
         apiInstence.LoadSingleTweet(tweet, tweet.originalTweet.in_reply_to_status_id_str);
     }
 }
Esempio n. 25
0
 private void ResponseUSTweet(ClientTweet tweet)
 {
     tweet.Init();
     if (tweet.isRetweet && DataInstence.CheckIsMe(tweet.user.id))
     {
         tweet.originalTweet.retweeted = true;
     }
     TweetInstence.AddTweet(eTweetPanel.eHome, tweet);
     //DeleAddTweet dele = new DeleAddTweet(TweetInstence.AddTweet);
     //Application.Current.Dispatcher.BeginInvoke(dele, new object[] { eTweetPanel.eHome, tweet });
 }
Esempio n. 26
0
        public void LoadSingleTweet(ClientTweet tweet, string tweetID)
        {
            PacketSingleTweet packet = new PacketSingleTweet(tweetID);

            if (tweet.uiProperty.parentTweet == null)
            {
                RequestSingleTweetPacket <ClientTweet>(packet, tweet.uiProperty, responseInstence.SingleTweet);
            }
            else
            {
                RequestSingleTweetPacket <ClientTweet>(packet, tweet.uiProperty.parentTweet, responseInstence.SingleTweet);
            }
        }
Esempio n. 27
0
 private void ResponseTweet(ClientTweet tweet)
 {
     if (tweet?.user?.id == userInfo.user.id)
     {
         if (tweet.user.screen_name != userInfo.user.screen_name)
         {
             userInfo.user.screen_name = tweet.user.screen_name;
         }
         if (tweet.user.profile_image_url != userInfo.user.profile_image_url)
         {
             userInfo.user.profile_image_url = tweet.user.profile_image_url;
         }
     }
 }
Esempio n. 28
0
        //TODO
        //옵션 폼 만들고 체크
        private void contextClick_ClientMute(object sender, RoutedEventArgs e)
        {
            ClientTweet tweet = selectTweet;

            if (tweet == null)
            {
                return;
            }

            DataInstence.option.AddMuteClient(tweet.originalTweet.source);
            FileManager.FileInstence.UpdateOption(DataInstence.option);
            MessageBox.Show($"클라이언트 {tweet.originalTweet.source} 가 뮤트에 추가되었습니다.", "알림", MessageBoxButton.OK,
                            MessageBoxImage.Information);
        }
Esempio n. 29
0
        private void contextClick_TweetMute(object sender, RoutedEventArgs e)
        {
            ClientTweet tweet = selectTweet;

            if (tweet == null)
            {
                return;
            }

            DataInstence.option.AddMuteTweet(tweet);
            FileManager.FileInstence.UpdateOption(DataInstence.option);
            MessageBox.Show($"트윗 '{tweet.originalTweet.text}' 가 뮤트에 추가되었습니다.\r\n해당 트윗과 해당 트윗에 온 답글을 표시하지 않습니다.", "알림", MessageBoxButton.OK,
                            MessageBoxImage.Information);
        }
Esempio n. 30
0
        private void AddFavorite()
        {
            ClientTweet tweet = selectTweet;

            if (tweet == null)
            {
                return;
            }
            if (tweet.originalTweet == null)
            {
                return;
            }

            DalsaeInstence.Favorite(tweet.originalTweet.id, !tweet.originalTweet.favorited);
        }