private void RefreshImageContent(List <CommentData.Medium> medias, StackPanel panel) { Image lastImage = null; foreach (var media in medias) { if (media.url_hq != null) { Image videoImage = new Image(); GlobalHelper.AssignImage(videoImage, "img_vid.png"); MainWindow.SetClickObject(videoImage); videoImage.MouseLeftButtonDown += (s, e) => { System.Diagnostics.Process.Start(media.url_hq); e.Handled = true; }; panel.Children.Add(videoImage); } else { string uri = media.origin_url; bool overrideGif = false; if (uri.Contains(".gif") && !Properties.Settings.Default.UseGIF) { overrideGif = true; uri = "gif.png"; } if (uri != null) { Image image = new Image(); if (overrideGif != true) { image.Tag = new Image[2] { lastImage, null }; if (lastImage != null && lastImage.Tag is Image[]) { ((Image[])lastImage.Tag)[1] = image; } } else { image.Tag = media.origin_url; } GlobalHelper.AssignImage(image, uri); image.Stretch = Stretch.UniformToFill; image.Margin = new Thickness(0, 0, 0, 10); image.MouseRightButtonDown += GlobalHelper.CopyImageHandler; image.MouseLeftButtonDown += GlobalHelper.SaveImageHandler; lastImage = image; panel.Children.Add(image); } } } }
public static void AssignProfile(FriendSelectControl fsc, ShareData.Actor actor, PostInfoWindow instance, string likeID = null) { fsc.MouseEnter += (s, e) => { fsc.Background = Brushes.LightGray; }; fsc.MouseLeave += (s, e) => { fsc.Background = Brushes.Transparent; }; fsc.TB_Name.Text = actor.display_name; string imgUri = actor.profile_thumbnail_url; if (Properties.Settings.Default.GIFProfile && actor.profile_video_url_square_small != null) { imgUri = actor.profile_video_url_square_small; } GlobalHelper.AssignImage(fsc.IMG_Profile, imgUri); fsc.IMG_Profile.Tag = actor.id; fsc.IMG_Profile.MouseLeftButtonDown += GlobalHelper.SubContentMouseEvent; MainWindow.SetClickObject(fsc.Grid); if (actor.relationship.Equals("N")) { fsc.IC_Friend.Visibility = Visibility.Visible; MainWindow.SetClickObject(fsc.IC_Friend); fsc.IC_Friend.MouseLeftButtonDown += async(s, e) => { fsc.IC_Friend.Kind = MaterialDesignThemes.Wpf.PackIconKind.ProgressClock; await KakaoRequestClass.FriendRequest(actor.id, false); fsc.IC_Friend.Kind = MaterialDesignThemes.Wpf.PackIconKind.ProgressCheck; fsc.IC_Friend.IsEnabled = false; e.Handled = true; }; } if (actor.relationship.Equals("R")) { fsc.IC_Friend.Visibility = Visibility.Visible; fsc.IC_Friend.Kind = MaterialDesignThemes.Wpf.PackIconKind.PersonAdd; fsc.IC_Friend.Foreground = Brushes.OrangeRed; } if (likeID != null && instance.data.actor.id.Equals(MainWindow.UserProfile.id)) { fsc.IC_Delete.Visibility = Visibility.Visible; fsc.IC_Delete.PreviewMouseLeftButtonDown += async(s, e) => { e.Handled = true; await KakaoRequestClass.DeleteLike(instance.data.id, likeID); instance.SP_Emotions.Children.Remove(fsc); }; } }
private void ShowFriends(string filter) { SP_Content.Children.Clear(); controls.Clear(); foreach (var friend in MainWindow.UserFriends.profiles) { if (friend.blocked != true && friend.display_name.ToLower().Contains(filter.ToLower())) { if (CB_OnlyFavorite.IsChecked == true && !friend.is_favorite) { continue; } FriendSelectControl fsc = new FriendSelectControl { id = friend.id, name = friend.display_name }; MainWindow.SetClickObject(fsc.Grid); string imgUri = friend.profile_thumbnail_url; if (Properties.Settings.Default.GIFProfile && friend.profile_video_url_square_small != null) { imgUri = friend.profile_video_url_square_small; } GlobalHelper.AssignImage(fsc.IMG_Profile, imgUri); fsc.TB_Name.Text = friend.display_name; fsc.TB_Name.Tag = friend.is_favorite; fsc.Grid.Tag = friend.id; fsc.MouseLeftButtonDown += OnGridClick; fsc.Tag = false; fsc.Background = Brushes.Transparent; controls.Add(fsc); SP_Content.Children.Add(fsc); } } SV_Content.ScrollToTop(); if (controls.Count == 0) { TB_Empty.Visibility = Visibility.Visible; } else { TB_Empty.Visibility = Visibility.Collapsed; } }
public MailReadWindow(string id) { InitializeComponent(); this.id = id; RA_Loading.Visibility = Visibility.Visible; PR_Loading.Visibility = Visibility.Visible; Dispatcher.InvokeAsync(async() => { var mail = await KakaoRequestClass.GetMailDetail(id); 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(IMG_Profile, imgUri); MainWindow.SetClickObject(IMG_Profile); 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.@object?.background != null && [email protected]("image")) { GlobalHelper.AssignImage(IMG_Main, [email protected]); } TB_Main.Text = mail.content; TB_Name.Text = mail.sender.display_name + "님으로부터"; RA_Loading.Visibility = Visibility.Collapsed; PR_Loading.IsActive = false; }); }
private bool AddAsset(string path, string editKey) { try { if (assets.Count < 20) { Image image = new Image(); GlobalHelper.AssignImage(image, path); if (path.EndsWith(".mp4")) { GlobalHelper.AssignImage(image, "video2.png"); } image.Margin = new Thickness(5, 5, 5, 5); image.Width = 80; image.Height = image.Width; image.Stretch = Stretch.Uniform; AssetData assetData = new AssetData() { Image = image, Key = editKey, Path = path, Type = path.ToLower().EndsWith(".gif") ? "gif" : "image", Caption = "" }; if (path.ToLower().Equals("video2.png") || path.ToLower().EndsWith(".mp4")) { assetData.Type = "video"; } image.MouseLeftButtonDown += assetData.Remove; assets.Add(assetData); SP_Pictures.Children.Add(image); return(true); } else { ShowImageAlert(); return(false); } } catch (Exception) { return(false); } }
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; }
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; }
public ProfileWindow() { InitializeComponent(); //if (!Properties.Settings.Default.HideScrollBar) //SV_Main.VerticalScrollBarVisibility = ScrollBarVisibility.Auto; RC_Mask.Visibility = Visibility.Visible; PR_Mask.Visibility = Visibility.Visible; Dispatcher.InvokeAsync(async() => { await MainWindow.UpdateProfile(); RC_Mask.Visibility = Visibility.Collapsed; PR_Mask.Visibility = Visibility.Collapsed; TB_Name.Text = MainWindow.UserProfile.display_name; TBX_Name.Text = MainWindow.UserProfile.display_name; TB_Desc.Text = MainWindow.UserProfile.status_objects?[0]?.message ?? "한줄 소개 없음"; TBX_Desc.Text = MainWindow.UserProfile.status_objects?[0]?.message ?? ""; if (MainWindow.UserProfile.status_objects?[0]?.message == null) { isDescExists = false; IC_DescEdit.Foreground = ButtonUnActivatedBrush; IC_DescDelete.Kind = MaterialDesignThemes.Wpf.PackIconKind.Add; } else { isDescExists = true; IC_DescEdit.Foreground = ButtonActivatedBrush; IC_DescDelete.Kind = MaterialDesignThemes.Wpf.PackIconKind.Delete; MainWindow.SetClickObject(IC_DescEdit); } string uri = MainWindow.UserProfile.profile_video_url_square_small ?? MainWindow.UserProfile.profile_thumbnail_url; GlobalHelper.AssignImage(IMG_Profile, uri); GlobalHelper.AssignImage(IMG_ProfileBG, MainWindow.UserProfile.bg_image_url); MainWindow.SetClickObject(EL_ProfileEdit); MainWindow.SetClickObject(IC_BGEdit); MainWindow.SetClickObject(IC_NameEdit); MainWindow.SetClickObject(IC_DescDelete); MainWindow.SetClickObject(IC_BirthdayDelete); MainWindow.SetClickObject(IC_SexDelete); if (MainWindow.UserProfile.birth_type == null) { isBirthdayExists = false; IC_BirthdayDelete.Kind = MaterialDesignThemes.Wpf.PackIconKind.Add; CB_SunDate.IsEnabled = false; DP_Birthday.IsEnabled = false; } else { isBirthdayExists = true; IC_BirthdayDelete.Kind = MaterialDesignThemes.Wpf.PackIconKind.Delete; CB_SunDate.IsChecked = MainWindow.UserProfile.birth_type.Equals("+"); CB_LeapType.IsChecked = MainWindow.UserProfile.birth_leap_type; DP_Birthday.SelectedDate = DateTime.ParseExact(MainWindow.UserProfile.birth, "yyyyMMdd", System.Globalization.CultureInfo.InvariantCulture); } if (MainWindow.UserProfile.gender_permission.Length > 0) { isGenderExists = true; CB_PublicSex.IsChecked = MainWindow.UserProfile.gender_permission.Equals("A"); if (MainWindow.UserProfile.gender.Equals("M")) { RB_Male.IsChecked = true; } else if (MainWindow.UserProfile.gender.Equals("F")) { RB_Female.IsChecked = true; } else { RB_Alien.IsChecked = true; } IC_SexDelete.Kind = MaterialDesignThemes.Wpf.PackIconKind.Delete; } else { isGenderExists = false; RB_Male.IsEnabled = false; RB_Female.IsEnabled = false; RB_Alien.IsEnabled = false; CB_PublicSex.IsEnabled = false; IC_SexDelete.Kind = MaterialDesignThemes.Wpf.PackIconKind.Add; } DP_Birthday.SelectedDateChanged += DP_Birthday_SelectedDateChanged; }); }
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); } }
public async Task RefreshTimeline(string from, bool isClear) { if (from == null) { lastOffset = -1; } BT_Refresh.IsEnabled = false; PR_Loading.IsActive = true; TB_RefreshBT.Text = "갱신중..."; IC_Refresh.Kind = MaterialDesignThemes.Wpf.PackIconKind.ProgressClock; List <CommentData.PostData> feeds; if (!isProfile) { TimeLineData.TimeLine feedData = await KakaoRequestClass.GetFeed(from); nextRequest = feedData.next_since; feeds = feedData.feeds; } else { string from2 = from; if (showBookmarked) { from2 = null; } var profile = await KakaoRequestClass.GetProfileFeed(profileID, from2); relationship = await KakaoRequestClass.GetProfileRelationship(profileID); if (profile.profile.bg_image_url != null) { string imgUri = profile.profile.profile_video_url_square_small ?? profile.profile.profile_image_url2; if (Properties.Settings.Default.GIFProfile && profile.profile.profile_video_url_square_small != null) { imgUri = profile.profile.profile_video_url_square_small; } GlobalHelper.AssignImage(IMG_Profile, imgUri); GlobalHelper.AssignImage(IMG_ProfileBG, profile.profile.bg_image_url); IMG_Profile.MouseLeftButtonDown += GlobalHelper.SaveImageHandler; IMG_ProfileBG.MouseLeftButtonDown += GlobalHelper.SaveImageHandler; TB_Name.Text = profile.profile.display_name; if (profile.profile.status_objects?.Count > 0) { TB_Desc.Text = profile.profile.status_objects?[0]?.message ?? "한줄 소개 없음"; } else { TB_Desc.Text = "한줄 소개 없음"; } TB_Desc2.Text = profile.mutual_friend?.message ?? "함께 아는 친구 없음"; TB_Desc2.Text += "/ " + profile.profile.activity_count.ToString() + "개의 스토리"; } GD_Favorite.Visibility = Visibility.Collapsed; if (relationship.relationship.Equals("F")) { IC_Friend.Kind = MaterialDesignThemes.Wpf.PackIconKind.AccountMinus; IC_Friend.ToolTip = "친구 삭제"; GD_Favorite.Visibility = Visibility.Visible; if (profile.profile.is_favorite) { IC_Favorite.Fill = Brushes.OrangeRed; } else { IC_Favorite.Fill = Brushes.Gray; } MainWindow.SetClickObject(IC_Favorite); ICP_Favorite.MouseEnter += (s, e) => { Mouse.OverrideCursor = Cursors.Hand; e.Handled = true; }; async void onMouseDown(object s, MouseButtonEventArgs e) { await KakaoRequestClass.FavoriteRequest(profile.profile.id, profile.profile.is_favorite); await RefreshTimeline(null, true); e.Handled = true; } IC_Favorite.MouseLeftButtonDown += onMouseDown; ICP_Favorite.MouseLeftButtonDown += onMouseDown; } else if (relationship.relationship.Equals("R")) { IC_Friend.Kind = MaterialDesignThemes.Wpf.PackIconKind.AccountRemove; IC_Friend.ToolTip = "친구 신청 취소"; } else if (relationship.relationship.Equals("C")) { IC_Friend.Kind = MaterialDesignThemes.Wpf.PackIconKind.AccountQuestionMark; IC_Friend.ToolTip = "친구 신청 처리"; } else if (relationship.relationship.Equals("N")) { IC_Friend.Kind = MaterialDesignThemes.Wpf.PackIconKind.AccountPlus; IC_Friend.ToolTip = "친구 추가"; } else { IC_Friend.Visibility = Visibility.Collapsed; } BT_Write.Visibility = Visibility.Collapsed; if (profile.activities.Count > 15) { nextRequest = profile.activities.Last().id; } if (MainWindow.UserProfile.id.Equals(profileID) && showBookmarked != true) { Title = "내 프로필"; TB_Desc2.Text = profile.profile.activity_count.ToString() + "개의 스토리"; } else { Title = profile.profile.display_name + "님의 프로필"; } if (showBookmarked) { Title = "관심글 조회"; var bookmarks = await KakaoRequestClass.GetBookmark(profileID, from); var feedsNow = new List <CommentData.PostData>(); foreach (var bookmark in bookmarks.bookmarks) { if (bookmark.status == 0) { feedsNow.Add(bookmark.activity); } } feeds = feedsNow; nextRequest = bookmarks.bookmarks.Last().id; } else { feeds = profile.activities; } } if (isProfile && feeds.Count != 18) { scrollEnd = true; } if (isClear) { SP_Content.Children.Clear(); SV_Content.ScrollToVerticalOffset(0); } foreach (var feed in feeds) { if (feed.verb.Equals("post") || feed.verb.Equals("share")) { TimeLinePageControl tlp = GenerateTimeLinePageControl(feed); SP_Content.Children.Add(tlp); SP_Content.Children.Add(new Rectangle() { Height = 10, Fill = Brushes.Transparent }); } else if (feed.verb.Equals("bundled_feed")) { try { if (feed.bundled_feed != null && feed.bundled_feed.type.Equals("share")) { CommentData.PostData feedNow = feed.bundled_feed.activities?[0]; if (feedNow != null) { feedNow.@object = feed.bundled_feed.original_activity; TimeLinePageControl tlp = GenerateTimeLinePageControl(feedNow); GlobalHelper.SetShareFriendsTB(tlp.TB_Title, feed.bundled_feed.title_decorators); tlp.TB_Title.Visibility = Visibility.Visible; tlp.TB_TitleSep.Visibility = Visibility.Visible; SP_Content.Children.Add(tlp); SP_Content.Children.Add(new Rectangle() { Height = 10, Fill = Brushes.Transparent }); } } else if (feed.bundled_feed != null && feed.bundled_feed.type.Equals("up")) { CommentData.PostData feedNow = feed.bundled_feed.original_activity; if (feedNow != null) { TimeLinePageControl tlp = GenerateTimeLinePageControl(feedNow); GlobalHelper.SetShareFriendsTB(tlp.TB_Title, feed.bundled_feed.title_decorators); tlp.TB_Title.Visibility = Visibility.Visible; tlp.TB_TitleSep.Visibility = Visibility.Visible; SP_Content.Children.Add(tlp); SP_Content.Children.Add(new Rectangle() { Height = 10, Fill = Brushes.Transparent }); } } } catch (Exception) { } } } BT_Refresh.IsEnabled = true; TB_RefreshBT.Text = "새로고침"; IC_Refresh.Kind = MaterialDesignThemes.Wpf.PackIconKind.Refresh; PR_Loading.IsActive = false; return; }
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); }