프로젝트

일반

사용자정보

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

markus / KCOM / Events / CutCommand.cs @ c7b02506

이력 | 보기 | 이력해설 | 다운로드 (4.26 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.Windows.Threading;
25
using System.Xml;
26
using System.Xml.Serialization;
27

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

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

    
40
        private CutCommand()
41
        {
42
        }
43

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

    
52
        /// <summary>
53
        /// cut selected controls
54
        /// </summary>
55
        /// <author>humkyung</author>
56
        /// <date>2019.06.18</date>
57
        /// <param name="comments"></param>
58
        public void Execute()
59
        {
60
            if (Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.SelectLayer.Children.Count > 0)
61
            {
62
                string MarkupData = string.Empty;
63

    
64
                foreach (var item in Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.SelectLayer.Children)
65
                {
66
                    string id = string.Empty;
67
                    if (item?.GetType().Name == "AdornerFinal")
68
                    {
69
                        MarkupToPDF.Common.UndoDataGroup UndoData = new UndoDataGroup()
70
                        {
71
                            IsUndo = false,
72
                            Event = EventType.Delete,
73
                            EventTime = DateTime.Now,
74
                            MarkupDataColl = new List<UndoData>()
75
                        };
76

    
77
                        foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
78
                        {
79
                            var comment = (InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo);
80

    
81
                            UndoData multi_UndoData = new UndoData()
82
                            {
83
                                Markup = comment
84
                            };
85
                            UndoData.MarkupDataColl.Add(multi_UndoData);
86

    
87
                            var data = MarkupParser.MarkupToString(comment, App.ViewInfo.UserID);
88

    
89
                            id = (InnerItem.Symbol_ID != null) ? "|SymbolID|" + InnerItem.Symbol_ID : "";
90
                            MarkupData += "|OR|" + data.ConvertData + id;
91

    
92
                            //Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.UpdateMyMarkupList();
93
                            ViewerDataModel.Instance.MarkupControls_USER.Remove(comment);
94
                            ViewerDataModel.Instance.MarkupControls.Remove(comment);
95

    
96
                            var Item_ = ViewerDataModel.Instance.MyMarkupList.Where(d => d.ID == comment.CommentID).FirstOrDefault();
97
                            ViewerDataModel.Instance.MyMarkupList.Remove(Item_);
98

    
99
                            ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.MarkupListUpdate(
100
                            null, EventType.Delete, data.CommentID, null);
101
                        }
102
                        ViewerDataModel.Instance.UndoDataList.Add(UndoData);
103
                        //Clipboard.SetText(MarkupData,TextDataFormat.Text);
104
                        Dispatcher.CurrentDispatcher.Invoke(() =>
105
                        {
106
                            Clipboard.SetData(DataFormats.StringFormat, MarkupData);
107
                        }, DispatcherPriority.Background);
108
                        //Clipboard.SetData(DataFormats.StringFormat, MarkupData);
109

    
110
                    }
111
                }
112

    
113
                Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.SelectLayer.Children.Clear();
114
            }
115
        }
116
    }
117
}
클립보드 이미지 추가 (최대 크기: 500 MB)