markus / KCOM / Events / CutCommand.cs @ 5c5e04cc
이력 | 보기 | 이력해설 | 다운로드 (4.02 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 | c7b02506 | 이지연 | using System.Windows.Threading; |
25 | b37ef4b3 | humkyung | 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 | 26ec6226 | taeseongkim | if (item?.GetType().Name == "AdornerFinal") |
68 | b37ef4b3 | humkyung | { |
69 | 02a9f323 | humkyung | MarkupToPDF.Common.UndoDataGroup UndoDataGrp = new UndoDataGroup() |
70 | 26ec6226 | taeseongkim | { |
71 | IsUndo = false, |
||
72 | 02a9f323 | humkyung | Event = EventType.Delete |
73 | 26ec6226 | taeseongkim | }; |
74 | |||
75 | 02a9f323 | humkyung | foreach (var InnerItem in (item as Controls.AdornerFinal).Members) |
76 | b37ef4b3 | humkyung | { |
77 | 26ec6226 | taeseongkim | var comment = (InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo); |
78 | |||
79 | 19d602e0 | humkyung | UndoData multi_UndoData = new UndoData(comment); |
80 | 02a9f323 | humkyung | UndoDataGrp.MarkupDataColl.Add(multi_UndoData); |
81 | 26ec6226 | taeseongkim | |
82 | var data = MarkupParser.MarkupToString(comment, App.ViewInfo.UserID); |
||
83 | |||
84 | b37ef4b3 | humkyung | id = (InnerItem.Symbol_ID != null) ? "|SymbolID|" + InnerItem.Symbol_ID : ""; |
85 | MarkupData += "|OR|" + data.ConvertData + id; |
||
86 | 4eb052e4 | ljiyeon | |
87 | 26ec6226 | taeseongkim | //Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.UpdateMyMarkupList(); |
88 | ViewerDataModel.Instance.MarkupControls_USER.Remove(comment); |
||
89 | ViewerDataModel.Instance.MarkupControls.Remove(comment); |
||
90 | |||
91 | var Item_ = ViewerDataModel.Instance.MyMarkupList.Where(d => d.ID == comment.CommentID).FirstOrDefault(); |
||
92 | ViewerDataModel.Instance.MyMarkupList.Remove(Item_); |
||
93 | |||
94 | 39f0624f | ljiyeon | ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.MarkupListUpdate( |
95 | 873011c4 | humkyung | null, EventType.Delete, data.CommentID, null); |
96 | b37ef4b3 | humkyung | } |
97 | 02a9f323 | humkyung | |
98 | ViewerDataModel.Instance.UndoDataList.Add(UndoDataGrp); |
||
99 | 299f2c11 | 이지연 | //Clipboard.SetText(MarkupData,TextDataFormat.Text); |
100 | c7b02506 | 이지연 | Dispatcher.CurrentDispatcher.Invoke(() => |
101 | { |
||
102 | Clipboard.SetData(DataFormats.StringFormat, MarkupData); |
||
103 | }, DispatcherPriority.Background); |
||
104 | //Clipboard.SetData(DataFormats.StringFormat, MarkupData); |
||
105 | 299f2c11 | 이지연 | |
106 | b37ef4b3 | humkyung | } |
107 | } |
||
108 | |||
109 | Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.SelectLayer.Children.Clear(); |
||
110 | } |
||
111 | } |
||
112 | } |
||
113 | } |