/// <summary>
        /// Fires when the user clicks on Add a Comment, on the status page.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void CommentButton_Click(object sender, RoutedEventArgs e)
        {
            //The logged in user can make a comment by simply clicking this button.
            Button btn = sender as Button;

            Datum datum = (Datum)btn.DataContext;

            if (datum != null)
            {
                commentPoster = new CommentPoster();
                PostWindow postWindow = new PostWindow();
                postWindow.titleText.Text = "Add a comment";
                postWindow.theStatusPostControl.Visibility = Visibility.Visible;
                postWindow.theLinksControl.Visibility      = Visibility.Hidden;
                postWindow.theBlogPostControl.Visibility   = Visibility.Hidden;
                postWindow.ShowDialog();

                string tkBuild = "Bearer " + Token;
                string comment = postWindow.theStatusPostControl.Body;

                loadingTextBlock.Text = "Making a comment...";
                await commentPoster.MakeAComment(tkBuild, datum.id, comment);

                if (commentPoster.success == true)
                {
                    loadingTextBlock.Text = "Commented Successfully.";
                    Refresh();
                }
                else
                {
                    loadingTextBlock.Text = "Unable to post your comment at this time. Please try again later.";
                }
                //MessageBox.Show("Unable to comment at this time.");
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Handles the creation of forum posts.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void StatusButton_Click(object sender, RoutedEventArgs e)
        {
            //Access the post window
            PostWindow postWindow = new PostWindow();

            //We can use the blog control for forums
            postWindow.theBlogPostControl.Visibility   = Visibility.Visible;
            postWindow.theLinksControl.Visibility      = Visibility.Hidden;
            postWindow.theStatusPostControl.Visibility = Visibility.Hidden;

            try
            {
                postWindow.theBlogPostControl.TitleBox.Text = "Enter your forum post title.";

                postWindow.ShowDialog();
                //Get the title of the post.
                string title = postWindow.theBlogPostControl.PostTitle;
                string body  = postWindow.theBlogPostControl.PostBody;

                MakeAForumPost(title, body, FID);
            }
            catch (Exception t)
            {
                MessageBox.Show(t.Message);
            }
        }
Ejemplo n.º 3
0
        public static void PostScreen()
        {
            string filename = SaveScreen();

            PostWindow postWindows = new PostWindow(filename)
            {
                Owner = App.Agot2
            };

            postWindows.Show();
        }
Ejemplo n.º 4
0
        public static void CreatePostWindow(MainWindowViewModel Parent)
        {
            var PWindow = new PostWindow();

            PostWindowViewModel vm = (PostWindowViewModel)PWindow.DataContext;

            vm.ParentViewModel = Parent;

            PWindow.WindowStartupLocation = WindowStartupLocation.CenterOwner;
            PWindow.Show();
        }
        private async void MainContentMouseEvent(object s, MouseButtonEventArgs e)
        {
            string id = (string)((FrameworkElement)s).Tag;

            try
            {
                CommentData.PostData data = await KakaoRequestClass.GetPost(id);

                PostWindow.ShowPostWindow(data, id);
            }
            catch (Exception) { }
            e.Handled = true;
        }
Ejemplo n.º 6
0
        private async void EditButton_Click(object sender, RoutedEventArgs e)
        {
            string tkBuild = "Bearer " + Token;

            Button editButton = sender as Button;
            Datum  datum      = (Datum)editButton.DataContext;

            if (datum != null)
            {
                PostWindow postWindow = new PostWindow();

                //Get the post ID.
                int postID = datum.id;
                //Since this is a status post, only the body is needed.
                string body  = datum.body;
                string title = datum.title;
                postWindow.theStatusPostControl.Visibility = Visibility.Hidden;
                postWindow.theBlogPostControl.Visibility   = Visibility.Visible;
                postWindow.theLinksControl.Visibility      = Visibility.Hidden;

                //First clear the textbox
                postWindow.theStatusPostControl.RTBox.Document.Blocks.Clear();
                postWindow.theBlogPostControl.TitleBox.Clear();
                //Append the message to be edited to the rich text box.

                postWindow.theBlogPostControl.RTBox.AppendText(body);
                postWindow.theBlogPostControl.TitleBox.Text = title;
                //We are ready for edit.
                postWindow.ShowDialog();

                string returnEditedText = postWindow.theBlogPostControl.PostBody;
                string EditedTitle      = postWindow.theBlogPostControl.PostTitle;

                string editEndpoint = @"https://api.africoders.com/v1/edit/post" + "?id=" + postID + "&title=" + EditedTitle + "&body=" + returnEditedText;

                postHelper            = new PostHelper(editEndpoint);
                loadingTextBlock.Text = "Editing post...";

                await postHelper.MakePostAsync(tkBuild);

                //MessageBox.Show("Post edited successfully.");

                loadingTextBlock.Text = "Post edited.";

                //Refresh
                Refresh();
            }
        }
Ejemplo n.º 7
0
        private void StatusButton_Click(object sender, RoutedEventArgs e)
        {
            PostWindow postWindow = new PostWindow();

            postWindow.titleText.Text                  = "Share a link with us";
            postWindow.theLinksControl.Visibility      = Visibility.Visible;
            postWindow.theBlogPostControl.Visibility   = Visibility.Hidden;
            postWindow.theStatusPostControl.Visibility = Visibility.Hidden;

            postWindow.ShowDialog();
            string title = postWindow.theLinksControl.Title;
            string body  = postWindow.theLinksControl.Body;
            string url   = postWindow.theLinksControl.URL;

            MakePost(body, title, url);
        }
Ejemplo n.º 8
0
        private void StatusButton_Click(object sender, RoutedEventArgs e)
        {
            PostWindow postWindow = new PostWindow();

            postWindow.titleText.Text = "Submit a job Advert.";
            postWindow.theBlogPostControl.Visibility   = Visibility.Visible;
            postWindow.theStatusPostControl.Visibility = Visibility.Hidden;
            postWindow.theLinksControl.Visibility      = Visibility.Hidden;

            postWindow.ShowDialog();
            //Since the blog post and job advert post are similar, they can effectively sgare the same control.
            string title = postWindow.theBlogPostControl.PostTitle;
            string body  = postWindow.theBlogPostControl.PostBody;

            MakePost(body, title);
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Handles the update of user posts.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void EditButton_Click(object sender, RoutedEventArgs e)
        {
            PostWindow postWindow = new PostWindow();
            string     tokenBuild = "Bearer " + Token;
            Button     btn        = sender as Button;

            ForumModel.Datum datum = (ForumModel.Datum)btn.DataContext;

            if (datum != null)
            {
                postWindow.theBlogPostControl.Visibility   = Visibility.Visible;
                postWindow.theStatusPostControl.Visibility = Visibility.Hidden;
                postWindow.theLinksControl.Visibility      = Visibility.Hidden;


                postWindow.titleText.Text = "Edit your forum post";
                //Reformat the titleBox to reflect the current text.
                postWindow.theBlogPostControl.TitleBox.Text = datum.title;

                string bodyConverted = datum.body;
                //Clear the TB
                postWindow.theBlogPostControl.RTBox.Document.Blocks.Clear();

                postWindow.theBlogPostControl.RTBox.AppendText(bodyConverted);

                postWindow.ShowDialog();
                string editedTitle = postWindow.theBlogPostControl.PostTitle;
                string editedBody  = postWindow.theBlogPostControl.PostBody;

                int    id       = datum.id;
                string endpoint = @"https://api.africoders.com/v1/edit/post?id=" + id.ToString() + "&title=" + editedTitle + "&body=" + editedBody;

                postHelper            = new PostHelper(endpoint);
                loadingTextBlock.Text = "Editing Post.";
                await postHelper.MakePostAsync(tokenBuild);

                if (postHelper.StatusPostSuccessful)
                {
                    loadingTextBlock.Text = "Edited Post Successfully.";
                    Refresh();
                }
                else
                {
                    loadingTextBlock.Text = "Unable to edit post. Please try again.";
                }
            }
        }
        private void AddShares(List <ShareData.Share> shares)
        {
            foreach (var share in shares)
            {
                FriendSelectControl fsc = new FriendSelectControl();
                AssignProfile(fsc, share.actor, this);
                fsc.Grid.MouseLeftButtonDown += async(s, e) =>
                {
                    try
                    {
                        PostData pd = await KakaoRequestClass.GetPost(share.activity_id);

                        PostWindow.ShowPostWindow(pd, share.activity_id);
                    }
                    catch (Exception) {}
                    e.Handled = true;
                };
                SP_Shares.Children.Add(fsc);
            }
        }
Ejemplo n.º 11
0
        /// <summary>
        /// Fires when the user intends to make a comment.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void CommentButton_Click(object sender, RoutedEventArgs e)
        {
            string tkBuild = "Bearer " + Token;

            Button btn = sender as Button;

            ForumModel.Datum datum = (ForumModel.Datum)btn.DataContext;

            if (datum != null)
            {
                int Id = datum.id;
                commentPoster = new CommentPoster();
                PostWindow postWindow = new PostWindow();

                postWindow.theStatusPostControl.Visibility = Visibility.Visible;
                postWindow.theLinksControl.Visibility      = Visibility.Hidden;
                postWindow.theBlogPostControl.Visibility   = Visibility.Hidden;
                postWindow.ShowDialog();

                string comment = postWindow.theStatusPostControl.Body;


                loadingTextBlock.Text = "Making a comment...";

                await commentPoster.MakeAComment(tkBuild, Id, comment);

                if (commentPoster.success)
                {
                    loadingTextBlock.Text = "Commented Successfully.";
                    Refresh();
                }
                else
                {
                    loadingTextBlock.Text = "Unable to post your comment.";
                    //MessageBox.Show("Unable to comment at this time.");
                }
            }
        }
Ejemplo n.º 12
0
        /// <summary>
        /// Handles the creation of blog posts.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void StatusButton_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                PostWindow postWin = new PostWindow();
                postWin.theBlogPostControl.Visibility   = Visibility.Visible;
                postWin.theStatusPostControl.Visibility = Visibility.Hidden;
                postWin.theLinksControl.Visibility      = Visibility.Hidden;
                postWin.titleText.Text = "Share a blog post!";

                postWin.ShowDialog();

                string title = postWin.theBlogPostControl.PostTitle;
                string body  = postWin.theBlogPostControl.PostBody;

                MakeBlogPost(title, body);
            }

            catch
            {
                MessageBox.Show("Unable to complete the operation at this time.");
            }
        }
        /// <summary>
        /// Handles the making of statuses.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void StatusButton_Click(object sender, RoutedEventArgs e)
        {
            PostWindow postWindow = new PostWindow();


            postWindow.titleText.Text = "What is on your mind right now?";


            //Set the visibility of controls.
            postWindow.theBlogPostControl.Visibility   = Visibility.Hidden;
            postWindow.theStatusPostControl.Visibility = Visibility.Visible;
            postWindow.theLinksControl.Visibility      = Visibility.Hidden;
            postWindow.ShowDialog();


            string message = postWindow.theStatusPostControl.Body;

            loadingTextBlock.Text = "Creating a status post..";
            //pass in the message.
            MakePost(message);

            //release valuable resources
            postWindow.Close();
        }
 public static void ActivateHandler(string invokedArgs, NotificationUserInput userInput)
 {
     Application.Current.Dispatcher.Invoke(async delegate
     {
         if (!invokedArgs.Contains("default null string"))
         {
             try
             {
                 if (invokedArgs.Contains("LIKE!@#$%"))
                 {
                     string text       = invokedArgs.Substring(0, invokedArgs.IndexOf("LIKE!@#$%"));
                     string activityID = text.Split(new string[] { "activities/" }, StringSplitOptions.None)[1];
                     string commentID  = invokedArgs.Split(new string[] { "LIKE!@#$%" }, StringSplitOptions.None)[1];
                     await KakaoRequestClass.LikeComment(activityID, commentID, false);
                 }
                 else if (invokedArgs.Contains("REPLY!@#$%"))
                 {
                     string text       = invokedArgs.Substring(0, invokedArgs.IndexOf("REPLY!@#$%"));
                     string[] datas    = invokedArgs.Split(new string[] { "R!@=!!" }, StringSplitOptions.None);
                     string id         = datas[1];
                     string name       = datas[2];
                     string writer     = datas[3];
                     string identity   = datas[4];
                     string msg        = userInput["tbReply"];
                     string activityID = text.Split(new string[] { "activities/" }, StringSplitOptions.None)[1];
                     await KakaoRequestClass.ReplyToFeed(activityID, msg, id, name);
                 }
                 else
                 {
                     //MessageBox.Show(invokedArgs);
                     string text       = invokedArgs.Split(new string[] { "!" }, StringSplitOptions.None)[1];
                     string activityID = text.Split(new string[] { "activities/" }, StringSplitOptions.None)[1];
                     string url        = invokedArgs.Split(new string[] { "!" }, StringSplitOptions.None)[0];
                     try
                     {
                         PostData data = await KakaoRequestClass.GetPost(activityID);
                         if (data != null && activityID != null)
                         {
                             PostWindow.ShowPostWindow(data, activityID);
                         }
                     }
                     catch (Exception) { }
                 }
             }
             catch (Exception)
             {
                 try
                 {
                     string id = invokedArgs.Replace("https://story.kakao.com/", "");
                     if (id.Length > 0)
                     {
                         TimeLineWindow tlw = new TimeLineWindow(id);
                         tlw.Show();
                         tlw.Activate();
                     }
                     else
                     {
                         throw new InvalidDataException();
                     }
                 }
                 catch (Exception)
                 {
                     System.Diagnostics.Process.Start(invokedArgs.Split(new string[] { "!" }, StringSplitOptions.None)[0]);
                 }
             }
         }
     });
 }
        public TimeLinePageControl GenerateTimeLinePageControl(CommentData.PostData feed)
        {
            TimeLinePageControl tlp = new TimeLinePageControl();

            if (Properties.Settings.Default.ScrollTimeline)
            {
                tlp.SV_Content.MaxHeight = 300;
            }
            try
            {
                try
                {
                    RefreshTimeLineFeed(tlp, feed);
                }
                catch (Exception)
                {
                    tlp.TB_Content.Text = "";
                    tlp.TB_Content.Inlines.Clear();
                    tlp.TB_Content.Inlines.Add(new Bold(new Run("(오류 : 삭제 등의 원인으로 인해 글 원본을 가져올 수 없습니다)")));
                    tlp.GD_Share.Visibility = Visibility.Collapsed;
                }

                if (feed.scrap != null)
                {
                    GlobalHelper.RefreshScrap(feed.scrap, tlp.Scrap_Main);
                }

                MainWindow.SetClickObject(tlp.Card);

                tlp.Card.Tag       = feed.id;
                tlp.TB_Content.Tag = feed.id;
                tlp.SP_Content.Tag = feed.id;

                tlp.Card.MouseLeftButtonDown        += MainContentMouseEvent;
                tlp.TB_Content.MouseRightButtonDown += (s, e) =>
                {
                    Clipboard.SetDataObject(feed.content);
                    MessageBox.Show("클립보드에 글 내용이 복사됐습니다.");
                    e.Handled = true;
                };

                if (feed.verb.Equals("share"))
                {
                    if (feed.@object?.share_count == null || feed.@object?.id == null || feed.@object?.actor?.profile_thumbnail_url == null)
                    {
                        tlp.TB_Content.Inlines.Add(new Bold(new Run("\n(오류 : 삭제 등의 원인으로 인해 공유글 원본을 가져올 수 없습니다)")));
                        tlp.GD_Share.Visibility = Visibility.Collapsed;
                    }
                    else
                    {
                        tlp.GD_ShareCount.Visibility      = Visibility.Visible;
                        tlp.TB_GD_ShareCount.Text         = [email protected]_count.ToString();
                        tlp.GD_Share.Tag                  = [email protected];
                        tlp.GD_Share.MouseLeftButtonDown += ShareContentMouseEvent;

                        string imgUri = [email protected]_image_url2 ?? [email protected]_thumbnail_url;
                        if (Properties.Settings.Default.GIFProfile && [email protected]_video_url_square_small != null)
                        {
                            imgUri = [email protected]_video_url_square_small;
                        }
                        GlobalHelper.AssignImage(tlp.IMG_ProfileShare, imgUri);
                        MainWindow.SetClickObject(tlp.IMG_ProfileShare);

                        tlp.IMG_ProfileShare.Tag = [email protected];
                        tlp.IMG_ProfileShare.MouseLeftButtonDown += GlobalHelper.SubContentMouseEvent;

                        tlp.TB_NameShare.Text = [email protected]_name;
                        tlp.TB_DateShare.Text = PostWindow.GetTimeString([email protected]_at);
                        GlobalHelper.RefreshContent([email protected]_decorators, [email protected], tlp.TB_ShareContent);

                        tlp.TB_ShareContent.MouseRightButtonDown += (s, e) =>
                        {
                            Clipboard.SetDataObject([email protected]);
                            MessageBox.Show("클립보드에 공유한 글 내용이 복사됐습니다.");
                            e.Handled = true;
                        };

                        if ([email protected]_type != null && [email protected] != null)
                        {
                            RefreshImageContent([email protected], tlp.SP_ShareContent);
                        }

                        if ([email protected] != null)
                        {
                            GlobalHelper.RefreshScrap([email protected], tlp.Scrap_Share);
                        }
                        if ([email protected]_with_tags != null && [email protected]_with_tags.Count > 0)
                        {
                            Separator sep = new Separator();
                            tlp.SP_ShareContent.Children.Add(sep);
                            sep.Margin = new Thickness(0, 5, 0, 5);
                            var TB_Closest_With = GlobalHelper.GetWithFriendTB(feed.@object);
                            tlp.SP_ShareContent.Children.Add(TB_Closest_With);
                            tlp.SP_ShareContent.Visibility = Visibility.Visible;
                        }
                    }
                }
                else
                {
                    tlp.GD_Share.Visibility = Visibility.Collapsed;
                }
            }
            catch (Exception e)
            {
                tlp.SP_Content.Background = Brushes.DarkRed;
                tlp.TB_Name.Text          = "오류!";
                tlp.TB_Content.Text       = e.StackTrace;
            }
            return(tlp);
        }
        public async Task Refresh()
        {
            PR_Loading.IsActive  = true;
            BT_Refresh.IsEnabled = false;
            TB_RefreshBT.Text    = "갱신중..";
            IC_Refresh.Kind      = MaterialDesignThemes.Wpf.PackIconKind.ProgressClock;
            List <CSNotification> notifications = await KakaoRequestClass.RequestNotification(true);

            SP_Content.Children.Clear();
            foreach (var notification in notifications)
            {
                string thumbnailURL = notification.actor?.profile_thumbnail_url ?? "";
                if (Properties.Settings.Default.GIFProfile && notification.actor?.profile_video_url_square_small != null)
                {
                    thumbnailURL = notification.actor?.profile_video_url_square_small;
                }
                string message              = notification.message;
                string timestamp            = PostWindow.GetTimeString(notification.created_at);
                NotificationControl content = new NotificationControl();
                MainWindow.SetClickObject(content);
                content.TB_Content.Text    = message;
                content.TB_Content.ToolTip = content.TB_Content.Text;
                string contentMessage = notification.content ?? "내용 없음";
                if (contentMessage.Contains("\n"))
                {
                    contentMessage = contentMessage.Split(new string[] { "\n" }, StringSplitOptions.None)[0];
                }

                content.TB_Message.Text    = contentMessage;
                content.TB_Message.ToolTip = content.TB_Message.Text;
                if (!notification.is_new)
                {
                    content.RA_Notify.Fill = Brushes.Transparent;
                }
                if (content.TB_Message.Text.Trim().Length == 0)
                {
                    content.TB_Message.Text = "내용 없음";
                }
                content.TB_Date.Text = timestamp;
                string uri = "https://story.kakao.com/";
                GlobalHelper.AssignImage(content.IMG_Thumbnail, thumbnailURL);
                MainWindow.SetClickObject(content.IMG_Thumbnail);
                content.IMG_Thumbnail.MouseLeftButtonDown += (s, e) =>
                {
                    try
                    {
                        TimeLineWindow tlw = new TimeLineWindow(notification.actor.id);
                        tlw.Show();
                        tlw.Activate();
                    }
                    catch (Exception)
                    {
                        MessageBox.Show("접근이 불가능한 스토리입니다.");
                    }
                    e.Handled = true;
                };
                if (notification.scheme.Contains("?profile_id="))
                {
                    var ObjStr   = notification.scheme.Split(new string[] { "?profile_id=" }, StringSplitOptions.None);
                    var Profile  = ObjStr[1];
                    var Identity = ObjStr[0].Split('.')[1];
                    uri += Profile + "/" + Identity + "!" + ObjStr[0];
                    var feedID = ObjStr[0].Split(new string[] { "activities/" }, StringSplitOptions.None)[1];
                    content.MouseLeftButtonDown += async(s, e) =>
                    {
                        string target = uri.Split(new string[] { "!" }, StringSplitOptions.None)[0];
                        try
                        {
                            var post = await KakaoRequestClass.GetPost(feedID);

                            PostWindow.ShowPostWindow(post, feedID);
                        }
                        catch (Exception) { }
                        content.RA_Notify.Fill = Brushes.Transparent;
                        e.Handled = true;
                    };
                }
                else if (notification.scheme.Contains("kakaostory://profiles/"))
                {
                    content.MouseLeftButtonDown += (s, e) =>
                    {
                        try
                        {
                            string         id  = notification.scheme.Replace("kakaostory://profiles/", "");
                            TimeLineWindow tlw = new TimeLineWindow(id);
                            tlw.Show();
                            tlw.Activate();
                        }
                        catch (Exception)
                        {
                            MessageBox.Show("접근할 수 없는 스토리입니다.");
                        }
                        e.Handled = true;
                    };
                }
                SP_Content.Children.Add(content);
            }
            BT_Refresh.IsEnabled = true;
            TB_RefreshBT.Text    = "새로고침";
            IC_Refresh.Kind      = MaterialDesignThemes.Wpf.PackIconKind.Refresh;

            SV_Content.ScrollToTop();
            RA_Loading.Visibility = Visibility.Collapsed;
            PR_Loading.IsActive   = false;
        }
Ejemplo n.º 17
0
        public async Task Refresh()
        {
            BT_Refresh.IsEnabled = false;
            PR_Loading.IsActive  = true;
            TB_RefreshBT.Text    = "갱신중..";
            IC_Refresh.Kind      = MaterialDesignThemes.Wpf.PackIconKind.ProgressClock;
            var mails = await KakaoRequestClass.GetMails();

            SP_Main.Children.Clear();
            foreach (var mail in mails)
            {
                var mc = new MailControl();
                mc.TB_Name.Text    = mail.sender.display_name;
                mc.TB_Content.Text = mail.summary;
                mc.TB_Date.Text    = PostWindow.GetTimeString(mail.created_at);

                string imgUri = mail.sender.profile_thumbnail_url;
                if (Properties.Settings.Default.GIFProfile && mail.sender.profile_video_url_square_small != null)
                {
                    imgUri = mail.sender.profile_video_url_square_small;
                }
                GlobalHelper.AssignImage(mc.IMG_Profile, imgUri);
                MainWindow.SetClickObject(mc.IMG_Profile);
                mc.IMG_Profile.PreviewMouseLeftButtonDown += (s, e) =>
                {
                    e.Handled = true;
                    try
                    {
                        TimeLineWindow tlw = new TimeLineWindow(mail.sender.id);
                        tlw.Show();
                        tlw.Activate();
                    }
                    catch (Exception)
                    {
                        MessageBox.Show("접근이 불가능한 스토리입니다.");
                    }
                };

                if (mail.read_at == null || mail.read_at.Value.Year < 1)
                {
                    mc.RA_BG.Fill = Brushes.Teal;
                }

                mc.Grid.MouseLeftButtonDown += (s, e) =>
                {
                    e.Handled     = true;
                    mc.RA_BG.Fill = Brushes.Transparent;
                    var window = new MailReadWindow(mail.id);
                    window.Show();
                };

                mc.IC_Reply.PreviewMouseLeftButtonDown += (s, e) =>
                {
                    e.Handled     = true;
                    mc.RA_BG.Fill = Brushes.Transparent;
                    var window = new MailWriteWindow(mail.sender.id, mail.sender.display_name);
                    window.Show();
                };

                MainWindow.SetClickObject(mc.Grid);

                SP_Main.Children.Add(mc);
                var sep = new Separator
                {
                    Foreground = new SolidColorBrush(Color.FromRgb(221, 221, 221))
                };
                SP_Main.Children.Add(sep);
            }
            PR_Loading.IsActive  = false;
            BT_Refresh.IsEnabled = true;
            TB_RefreshBT.Text    = "새로고침";
            IC_Refresh.Kind      = MaterialDesignThemes.Wpf.PackIconKind.Refresh;
        }
        private void RefreshTimeLineFeed(TimeLinePageControl tlp, CommentData.PostData feed)
        {
            tlp.SP_Comments?.Children?.Clear();
            tlp.SP_Content?.Children?.Clear();
            string imgUri = feed.actor.profile_image_url2 ?? feed.actor.profile_thumbnail_url;

            if (Properties.Settings.Default.GIFProfile && feed.actor.profile_video_url_square_small != null)
            {
                imgUri = feed.actor.profile_video_url_square_small;
            }
            GlobalHelper.AssignImage(tlp.IMG_Profile, imgUri);

            MainWindow.SetClickObject(tlp.IMG_Profile);
            tlp.IMG_Profile.Tag = feed.actor.id;
            tlp.IMG_Profile.MouseLeftButtonDown += GlobalHelper.SubContentMouseEvent;

            tlp.TB_Name.Text = feed.actor.display_name;
            tlp.TB_Date.Text = PostWindow.GetTimeString(feed.created_at);
            GlobalHelper.RefreshContent(feed.content_decorators, feed.content, tlp.TB_Content);
            if (feed.media_type != null && feed.media != null)
            {
                RefreshImageContent(feed.media, tlp.SP_Content);
            }

            bool willDisplayInfo = false;

            if (feed.comment_count > 0)
            {
                willDisplayInfo = true;

                tlp.TB_CommentCount.Visibility = Visibility.Visible;
                var txt = new Bold(new Run($" {feed.comment_count.ToString()}  "))
                {
                    FontSize = 12
                };
                tlp.TB_CommentCount.Inlines.Add(txt);
            }
            else
            {
                tlp.TB_CommentCount.Visibility = Visibility.Collapsed;
                tlp.SP_Comments.Margin         = new Thickness(0, 0, 0, 0);
            }

            if (feed.like_count > 0)
            {
                willDisplayInfo             = true;
                tlp.TB_LikeCount.Visibility = Visibility.Visible;
                var txt = new Bold(new Run($" {feed.like_count.ToString()}  "));
                txt.FontSize = 12;
                tlp.TB_LikeCount.Inlines.Add(txt);
            }
            else
            {
                tlp.TB_LikeCount.Visibility = Visibility.Collapsed;
            }

            int shares = feed.share_count - feed.sympathy_count;

            if (shares > 0)
            {
                willDisplayInfo = true;
                tlp.TB_ShareCount.Visibility = Visibility.Visible;
                var txt = new Bold(new Run($" {shares.ToString()}  "));
                txt.FontSize = 12;
                tlp.TB_ShareCount.Inlines.Add(txt);
            }
            else
            {
                tlp.TB_ShareCount.Visibility = Visibility.Collapsed;
            }

            if (feed.sympathy_count > 0)
            {
                willDisplayInfo           = true;
                tlp.TB_UpCount.Visibility = Visibility.Visible;
                var txt = new Bold(new Run($" {feed.sympathy_count.ToString()}  "));
                txt.FontSize = 12;
                tlp.TB_UpCount.Inlines.Add(txt);
            }
            else
            {
                tlp.TB_UpCount.Visibility = Visibility.Collapsed;
            }

            if (!willDisplayInfo)
            {
                tlp.RD_CommentInfos.Height = new GridLength(0);
            }

            if (feed.closest_with_tags != null && feed.closest_with_tags.Count > 0)
            {
                Separator sep = new Separator();
                tlp.SP_Main.Children.Add(sep);
                sep.Margin = new Thickness(0, 5, 0, 5);
                var TB_Closest_With = GlobalHelper.GetWithFriendTB(feed);
                tlp.SP_Main.Children.Add(TB_Closest_With);
            }
        }
Ejemplo n.º 19
0
        private void addPost(object sender, EventArgs e)
        {
            PostWindow postWindow = new PostWindow();

            postWindow.Show();
        }