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