프로젝트

일반

사용자정보

통계
| 브랜치(Branch): | 개정판:

markus / KCOM / Events / DeleteCommand.cs @ d62c0439

이력 | 보기 | 이력해설 | 다운로드 (2.57 KB)

1
using KCOM.Common;
2
using KCOM.Controls;
3
using KCOM.Views;
4
using MarkupToPDF.Common;
5
using MarkupToPDF.Controls.Parsing;
6
using Newtonsoft.Json;
7
using Newtonsoft.Json.Converters;
8
using Newtonsoft.Json.Linq;
9
using Newtonsoft.Json.Serialization;
10
using System;
11
using System.Collections;
12
using System.Collections.Generic;
13
using System.ComponentModel;
14
using System.Data;
15
using System.IO;
16
using System.Linq;
17
using System.Reflection;
18
using System.Runtime.Serialization.Formatters;
19
using System.Runtime.Serialization.Formatters.Binary;
20
using System.Runtime.Serialization.Json;
21
using System.Text;
22
using System.Windows;
23
using System.Windows.Media;
24
using System.Xml;
25
using System.Xml.Serialization;
26

    
27
namespace KCOM
28
{
29
    public class DeleteCommand
30
    {
31
        private static readonly DeleteCommand _instance = new DeleteCommand();
32

    
33
        // Explicit static constructor to tell C# compiler
34
        // not to mark type as beforefieldinit
35
        static DeleteCommand()
36
        {
37
        }
38

    
39
        private DeleteCommand()
40
        {
41
        }
42

    
43
        public static DeleteCommand Instance
44
        {
45
            get
46
            {
47
                return _instance;
48
            }
49
        }
50

    
51
        /// <summary>
52
        /// delete given comments
53
        /// </summary>
54
        /// <author>humkyung</author>
55
        /// <date>2019.06.12</date>
56
        /// <param name="comments"></param>
57
        public void Execute(ICollection<CommentUserInfo> comments)
58
        {
59
            MarkupToPDF.Common.Undo_data UndoData = new Undo_data()
60
            {
61
                IsUndo = false,
62
                Event = Event_Type.Delete,
63
                EventTime = DateTime.Now,
64
                Markup_List = new List<Multi_Undo_data>()
65
            };
66

    
67
            foreach (var comment in comments)
68
            {
69
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data()
70
                {
71
                    Markup = comment
72
                };
73
                UndoData.Markup_List.Add(multi_Undo_Data);
74

    
75
                ViewerDataModel.Instance.MarkupControls_USER.Remove(comment);
76
                ViewerDataModel.Instance.MarkupControls.Remove(comment);
77

    
78
                var Item_ = ViewerDataModel.Instance.MyMarkupList.Where(d => d.ID == comment.CommentID).FirstOrDefault();
79
                ViewerDataModel.Instance.MyMarkupList.Remove(Item_);
80
            }
81

    
82
            ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
83
            {
84
                ViewerDataModel.Instance.UndoDataList.Remove(i);
85
            });
86
            ViewerDataModel.Instance.UndoDataList.Add(UndoData);
87
        }
88
    }
89
}
클립보드 이미지 추가 (최대 크기: 500 MB)