프로젝트

일반

사용자정보

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

markus / KCOM / Events / CutCommand.cs @ b1c2c6fe

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

1 b37ef4b3 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 CutCommand
30
    {
31
        private static readonly CutCommand _instance = new CutCommand();
32
33
        // Explicit static constructor to tell C# compiler
34
        // not to mark type as beforefieldinit
35
        static CutCommand()
36
        {
37
        }
38
39
        private CutCommand()
40
        {
41
        }
42
43
        public static CutCommand Instance
44
        {
45
            get
46
            {
47
                return _instance;
48
            }
49
        }
50
51
        /// <summary>
52
        /// cut selected controls
53
        /// </summary>
54
        /// <author>humkyung</author>
55
        /// <date>2019.06.18</date>
56
        /// <param name="comments"></param>
57
        public void Execute()
58
        {
59
            if (Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.SelectLayer.Children.Count > 0)
60
            {
61
                string MarkupData = string.Empty;
62
63
                foreach (var item in Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.SelectLayer.Children)
64
                {
65
                    string id = string.Empty;
66 26ec6226 taeseongkim
                    if (item?.GetType().Name == "AdornerFinal")
67 b37ef4b3 humkyung
                    {
68 873011c4 humkyung
                        MarkupToPDF.Common.UndoDataGroup UndoData = new UndoDataGroup()
69 26ec6226 taeseongkim
                        {
70
                            IsUndo = false,
71 873011c4 humkyung
                            Event = EventType.Delete,
72 26ec6226 taeseongkim
                            EventTime = DateTime.Now,
73 b79d6e7f humkyung
                            MarkupDataColl = new List<UndoData>()
74 26ec6226 taeseongkim
                        };
75
76 b37ef4b3 humkyung
                        foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
77
                        {
78 26ec6226 taeseongkim
                            var comment = (InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo);
79
80 b79d6e7f humkyung
                            UndoData multi_UndoData = new UndoData()
81 26ec6226 taeseongkim
                            {
82
                                Markup = comment
83
                            };
84 873011c4 humkyung
                            UndoData.MarkupDataColl.Add(multi_UndoData);
85 26ec6226 taeseongkim
86
                            var data = MarkupParser.MarkupToString(comment, App.ViewInfo.UserID);
87
88 b37ef4b3 humkyung
                            id = (InnerItem.Symbol_ID != null) ? "|SymbolID|" + InnerItem.Symbol_ID : "";
89
                            MarkupData += "|OR|" + data.ConvertData + id;
90 4eb052e4 ljiyeon
91 26ec6226 taeseongkim
                            //Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.UpdateMyMarkupList();
92
                            ViewerDataModel.Instance.MarkupControls_USER.Remove(comment);
93
                            ViewerDataModel.Instance.MarkupControls.Remove(comment);
94
95
                            var Item_ = ViewerDataModel.Instance.MyMarkupList.Where(d => d.ID == comment.CommentID).FirstOrDefault();
96
                            ViewerDataModel.Instance.MyMarkupList.Remove(Item_);
97
98 39f0624f ljiyeon
                            ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.MarkupListUpdate(
99 873011c4 humkyung
                            null, EventType.Delete, data.CommentID, null);
100 b37ef4b3 humkyung
                        }
101 26ec6226 taeseongkim
                        ViewerDataModel.Instance.UndoDataList.Add(UndoData);
102
                        Clipboard.SetText(MarkupData,TextDataFormat.Text);
103 b37ef4b3 humkyung
                    }
104
                }
105
106
                Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.SelectLayer.Children.Clear();
107
            }
108
        }
109
    }
110
}
클립보드 이미지 추가 (최대 크기: 500 MB)