markus / KCOM / Events / CutCommand.cs @ b79d6e7f
이력 | 보기 | 이력해설 | 다운로드 (3.91 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.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 |
if (item?.GetType().Name == "AdornerFinal") |
67 |
{ |
68 |
MarkupToPDF.Common.UndoDataGroup UndoData = new UndoDataGroup() |
69 |
{ |
70 |
IsUndo = false, |
71 |
Event = EventType.Delete, |
72 |
EventTime = DateTime.Now, |
73 |
MarkupDataColl = new List<UndoData>() |
74 |
}; |
75 |
|
76 |
foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>()) |
77 |
{ |
78 |
var comment = (InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo); |
79 |
|
80 |
UndoData multi_UndoData = new UndoData() |
81 |
{ |
82 |
Markup = comment |
83 |
}; |
84 |
UndoData.MarkupDataColl.Add(multi_UndoData); |
85 |
|
86 |
var data = MarkupParser.MarkupToString(comment, App.ViewInfo.UserID); |
87 |
|
88 |
id = (InnerItem.Symbol_ID != null) ? "|SymbolID|" + InnerItem.Symbol_ID : ""; |
89 |
MarkupData += "|OR|" + data.ConvertData + id; |
90 |
|
91 |
//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 |
ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.MarkupListUpdate( |
99 |
null, EventType.Delete, data.CommentID, null); |
100 |
} |
101 |
ViewerDataModel.Instance.UndoDataList.Add(UndoData); |
102 |
Clipboard.SetText(MarkupData,TextDataFormat.Text); |
103 |
} |
104 |
} |
105 |
|
106 |
Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.SelectLayer.Children.Clear(); |
107 |
} |
108 |
} |
109 |
} |
110 |
} |