markus / KCOM / Events / CutCommand.cs @ c7b02506
이력 | 보기 | 이력해설 | 다운로드 (4.26 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 | 873011c4 | humkyung | MarkupToPDF.Common.UndoDataGroup UndoData = new UndoDataGroup() |
70 | 26ec6226 | taeseongkim | { |
71 | IsUndo = false, |
||
72 | 873011c4 | humkyung | Event = EventType.Delete, |
73 | 26ec6226 | taeseongkim | EventTime = DateTime.Now, |
74 | b79d6e7f | humkyung | MarkupDataColl = new List<UndoData>() |
75 | 26ec6226 | taeseongkim | }; |
76 | |||
77 | b37ef4b3 | humkyung | foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>()) |
78 | { |
||
79 | 26ec6226 | taeseongkim | var comment = (InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo); |
80 | |||
81 | b79d6e7f | humkyung | UndoData multi_UndoData = new UndoData() |
82 | 26ec6226 | taeseongkim | { |
83 | Markup = comment |
||
84 | }; |
||
85 | 873011c4 | humkyung | UndoData.MarkupDataColl.Add(multi_UndoData); |
86 | 26ec6226 | taeseongkim | |
87 | var data = MarkupParser.MarkupToString(comment, App.ViewInfo.UserID); |
||
88 | |||
89 | b37ef4b3 | humkyung | id = (InnerItem.Symbol_ID != null) ? "|SymbolID|" + InnerItem.Symbol_ID : ""; |
90 | MarkupData += "|OR|" + data.ConvertData + id; |
||
91 | 4eb052e4 | ljiyeon | |
92 | 26ec6226 | taeseongkim | //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 | 39f0624f | ljiyeon | ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.MarkupListUpdate( |
100 | 873011c4 | humkyung | null, EventType.Delete, data.CommentID, null); |
101 | b37ef4b3 | humkyung | } |
102 | 26ec6226 | taeseongkim | ViewerDataModel.Instance.UndoDataList.Add(UndoData); |
103 | 299f2c11 | 이지연 | //Clipboard.SetText(MarkupData,TextDataFormat.Text); |
104 | c7b02506 | 이지연 | Dispatcher.CurrentDispatcher.Invoke(() => |
105 | { |
||
106 | Clipboard.SetData(DataFormats.StringFormat, MarkupData); |
||
107 | }, DispatcherPriority.Background); |
||
108 | //Clipboard.SetData(DataFormats.StringFormat, MarkupData); |
||
109 | 299f2c11 | 이지연 | |
110 | b37ef4b3 | humkyung | } |
111 | } |
||
112 | |||
113 | Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.SelectLayer.Children.Clear(); |
||
114 | } |
||
115 | } |
||
116 | } |
||
117 | } |