markus / KCOM / Events / CopyCommand.cs @ 51c6ce90
이력 | 보기 | 이력해설 | 다운로드 (2.61 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 | 5b48dae7 | taeseongkim | using System.Windows.Threading; |
25 | b37ef4b3 | humkyung | using System.Xml; |
26 | using System.Xml.Serialization; |
||
27 | |||
28 | namespace KCOM |
||
29 | { |
||
30 | public class CopyCommand |
||
31 | { |
||
32 | private static readonly CopyCommand _instance = new CopyCommand(); |
||
33 | |||
34 | // Explicit static constructor to tell C# compiler |
||
35 | // not to mark type as beforefieldinit |
||
36 | static CopyCommand() |
||
37 | { |
||
38 | } |
||
39 | |||
40 | private CopyCommand() |
||
41 | { |
||
42 | } |
||
43 | |||
44 | public static CopyCommand Instance |
||
45 | { |
||
46 | get |
||
47 | { |
||
48 | return _instance; |
||
49 | } |
||
50 | } |
||
51 | |||
52 | /// <summary> |
||
53 | /// copy 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 | foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>()) |
||
70 | { |
||
71 | var data = MarkupParser.MarkupToString(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo, App.ViewInfo.UserID); |
||
72 | id = (InnerItem.Symbol_ID != null) ? "|SymbolID|" + InnerItem.Symbol_ID : ""; |
||
73 | MarkupData += "|OR|" + data.ConvertData + id; |
||
74 | } |
||
75 | 5b48dae7 | taeseongkim | |
76 | Dispatcher.CurrentDispatcher.Invoke(() => |
||
77 | { |
||
78 | Clipboard.SetData(DataFormats.StringFormat,MarkupData); |
||
79 | }, DispatcherPriority.Background); |
||
80 | } |
||
81 | b37ef4b3 | humkyung | } |
82 | } |
||
83 | } |
||
84 | } |
||
85 | } |