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 async void IC_Friend_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e) { if (relationship.relationship.Equals("F")) { bool isDelete = MessageBox.Show("친구를 삭제하시겠습니까?", "안내", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes; if (isDelete) { await KakaoRequestClass.DeleteFriend(relationship.id); await RefreshTimeline(null, true); } } else if (relationship.relationship.Equals("R")) { bool isRequest = MessageBox.Show("이 사용자에게 친구 신청을 보내시겠습니까?", "안내", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes; if (isRequest) { await KakaoRequestClass.FriendRequest(relationship.id, true); await RefreshTimeline(null, true); } } else if (relationship.relationship.Equals("C")) { var question = MessageBox.Show("친구 신청을 수락하시겠습니까?", "안내", MessageBoxButton.YesNo, MessageBoxImage.Question); if (question != MessageBoxResult.Cancel && question != MessageBoxResult.None) { bool isDelete = question == MessageBoxResult.No; await KakaoRequestClass.FriendAccept(relationship.id, isDelete); await RefreshTimeline(null, true); } } else if (relationship.relationship.Equals("N")) { await KakaoRequestClass.FriendRequest(relationship.id, false); await RefreshTimeline(null, true); } }