프로젝트

일반

사용자정보

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

markus / KCOM / Events / DeleteCommand.cs @ c4a8d205

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

1 959b3ef2 humkyung
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 873011c4 humkyung
            MarkupToPDF.Common.UndoDataGroup UndoData = new UndoDataGroup()
60 959b3ef2 humkyung
            {
61
                IsUndo = false,
62 873011c4 humkyung
                Event = EventType.Delete,
63 959b3ef2 humkyung
                EventTime = DateTime.Now,
64 b79d6e7f humkyung
                MarkupDataColl = new List<UndoData>()
65 959b3ef2 humkyung
            };
66
67
            foreach (var comment in comments)
68
            {
69 b79d6e7f humkyung
                UndoData multi_UndoData = new UndoData()
70 959b3ef2 humkyung
                {
71
                    Markup = comment
72
                };
73 873011c4 humkyung
                UndoData.MarkupDataColl.Add(multi_UndoData);
74 959b3ef2 humkyung
75
                ViewerDataModel.Instance.MarkupControls_USER.Remove(comment);
76
                ViewerDataModel.Instance.MarkupControls.Remove(comment);
77
78 d62c0439 humkyung
                var Item_ = ViewerDataModel.Instance.MyMarkupList.Where(d => d.ID == comment.CommentID).FirstOrDefault();
79
                ViewerDataModel.Instance.MyMarkupList.Remove(Item_);
80 4eb052e4 ljiyeon
81 39f0624f ljiyeon
                ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.MarkupListUpdate(
82 873011c4 humkyung
                null, EventType.Delete, MarkupParser.MarkupToString(multi_UndoData.Markup, App.ViewInfo.UserID).CommentID, null);
83 959b3ef2 humkyung
            }
84
85
            ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
86
            {
87
                ViewerDataModel.Instance.UndoDataList.Remove(i);
88
            });
89 4eb052e4 ljiyeon
            ViewerDataModel.Instance.UndoDataList.Add(UndoData);            
90 959b3ef2 humkyung
        }
91
    }
92
}
클립보드 이미지 추가 (최대 크기: 500 MB)