示例#1
0
        private void dgv_CommentList_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            if (e.Button != MouseButtons.Left)
            {
                return;
            }

            int currentMouseOverRow = dgv_CommentList.HitTest(e.X, e.Y).RowIndex;

            if (currentMouseOverRow >= 0)
            {
                dgv_CommentList.ClearSelection();

                dgv_CommentList.Rows[currentMouseOverRow].Selected = true;
            }

            if (dgv_CommentList.SelectedRows == null || dgv_CommentList.SelectedRows.Count == 0)
            {
                return;
            }

            DeleteInformationRow row    = (dgv_CommentList.SelectedRows[0] as DeleteInformationRow);
            CommentInformation   target = row.CommentInformation;

            string msg = "갤러리 삭제 : " + (target.IsGalleryDeleted ? "삭제됨" : "삭제안됨") + Environment.NewLine
                         + "갤로그 삭제 : " + (target.IsGallogDeleted ? "삭제됨" : "삭제안됨") + Environment.NewLine
                         + "메시지 : " + (target.DeleteMessage);

            MessageBox.Show(msg, "리플 삭제 정보", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
示例#2
0
        private async void menu_DeleteComment_Clicked(object sender, EventArgs e)
        {
            if (dgv_CommentList.SelectedRows == null || dgv_CommentList.SelectedRows.Count == 0)
            {
                return;
            }

            DeleteInformationRow row    = (dgv_CommentList.SelectedRows[0] as DeleteInformationRow);
            CommentInformation   target = row.CommentInformation;

            if (currentTask != CleanerTask.None)
            {
                return;
            }

            SetStatusMessage("리플을 삭제하는 중입니다...");

            currentTask = CleanerTask.DeleteGallogComments;

            try
            {
                await conn.DeleteComment(target, true);
            }
            catch
            {
                return;
            }

            // 갤로그와 갤러리 둘다 삭제 되었을 경우
            if (target.IsGalleryDeleted && target.IsGallogDeleted)
            {
                if (row.DataGridView != null)
                {
                    row.DataGridView.Rows.Remove(row);
                }
                gb_CommentGroup.Text = "내가 쓴 리플 [" + dgv_CommentList.Rows.Count.ToString() + "]";
                SetStatusMessage("리플을 삭제하였습니다.");
            }
            else
            {
                string rmErrMsg = "";
                if (!target.IsGalleryDeleted)
                {
                    rmErrMsg = "리플을 삭제하는데 실패하였습니다. - 갤러리 삭제 실패";
                }
                else
                {
                    rmErrMsg = "리플을 삭제하는데 실패하였습니다. - 갤로그 삭제 실패";
                }

                SetStatusMessage(rmErrMsg);
            }

            currentTask = CleanerTask.None;
        }
示例#3
0
        public Coordinate GetFromOperated(List <CommentInformation> operatedComments, CommentInformation currentComment,
                                          double videoDuration, double commentDuration, double time, ICanvas canvas, RelativeValue fontHeight)
        {
            var canvasWidth    = canvas.CanvasWidth;
            var vpos1          = GetActualVpos(currentComment.Content.Vpos, videoDuration, commentDuration);
            var y              = Math.Max(0, currentComment.LastY.GetActual(canvas));
            var firstCollision = true;
            var currentWidth   = currentComment.Size.Width.GetActual(canvas);

            for (int i = 0; i < operatedComments.Count; i++)
            {
                var operatedComment = operatedComments[i];
                var vpos2           = GetActualVpos(operatedComment.Content.Vpos, videoDuration, commentDuration);
                var operatedWidth   = operatedComment.Size.Width.GetActual(canvas);

                var a = GetPositionX(vpos1, vpos2 / 100.0 + commentDuration, currentWidth, canvasWidth, commentDuration);
                var b = GetPositionX(vpos2, vpos1 / 100.0, operatedWidth, canvasWidth, commentDuration) + operatedWidth;
                var c = GetPositionX(vpos2, vpos1 / 100.0 + commentDuration, operatedWidth, canvasWidth, commentDuration);
                var d = GetPositionX(vpos1, vpos2 / 100.0, currentWidth, canvasWidth, commentDuration) + currentWidth;

                if (
                    CheckY(y, operatedComment.LastY.GetActual(canvas), fontHeight.GetActual(canvas)) &&
                    (!(((b < canvasWidth) && (0 < a) && (vpos2 <= vpos1)) || ((c < canvasWidth) && (0 < d) && (vpos1 < vpos2))))
                    )
                {
                    i = -1;
                    if (firstCollision)
                    {
                        firstCollision = false;
                        y = 0;
                    }
                    else
                    {
                        y += fontHeight.GetActual(canvas);
                    }
                }
            }
            var x = GetPositionX(vpos1, time, currentWidth, canvasWidth, commentDuration);

            return(new Coordinate(x, y));
        }
示例#4
0
        private async void DeleteCommentAsync(DeleteInformationRow row, bool both)
        {
            CommentInformation info = row.CommentInformation;
            CommentInformation res  = null;

            try
            {
                res = await conn.DeleteComment(info, both);
            }
            catch { }

            if (!res.IsGalleryDeleted || (both && !res.IsGallogDeleted))
            {
                for (int j = 0; j < deleteRetryCnt; j++)
                {
                    // 실패시, Sleep 후 재시도
                    await Task.Delay(deleteRetryTime);

                    res = await conn.DeleteComment(info, both);

                    if (res.IsGalleryDeleted && (!both || res.IsGallogDeleted))
                    {
                        break;
                    }
                }
            }

            info.IsGalleryDeleted = res.IsGalleryDeleted;
            info.IsGallogDeleted  = res.IsGallogDeleted;
            info.DeleteMessage    = res.DeleteMessage;

            deleteEndCnt++;

            if (!info.IsGalleryDeleted || (both && !info.IsGallogDeleted))
            {
                if (deleteStartCnt <= deleteEndCnt)
                {
                    currentTask = CleanerTask.None;

                    if (both)
                    {
                        SetStatusMessage("쓴 리플 - 갤로그도 삭제 완료");
                    }
                    else
                    {
                        SetStatusMessage("쓴 리플 - 갤러리만 삭제 완료");
                    }
                }
                return;
            }

            // 갤로그도 삭제일 경우에만 화면 지움
            if (both)
            {
                if (row.DataGridView != null)
                {
                    row.DataGridView.Rows.Remove(row);
                }
                gb_CommentGroup.Text = "내가 쓴 리플 [" + dgv_CommentList.Rows.Count.ToString() + "]";
            }

            if (deleteStartCnt <= deleteEndCnt)
            {
                currentTask = CleanerTask.None;

                if (both)
                {
                    SetStatusMessage("쓴 리플 - 갤로그도 삭제 완료");
                }
                else
                {
                    SetStatusMessage("쓴 리플 - 갤러리만 삭제 완료");
                }
            }
        }
示例#5
0
 public DeleteInformationRow(CommentInformation commentInfo, DataGridView dgv)
 {
     CommentInformation = commentInfo;
     this.CreateCells(dgv, CommentInformation.Name, CommentInformation.Content, CommentInformation.Date);
 }