markus / KCOM / Events / CreateCommand.cs @ f729ef4e
이력 | 보기 | 이력해설 | 다운로드 (2.18 KB)
1 | f513c215 | 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 | using System.Xml; |
||
25 | using System.Xml.Serialization; |
||
26 | |||
27 | namespace KCOM |
||
28 | { |
||
29 | public class CreateCommand |
||
30 | { |
||
31 | private static readonly CreateCommand _instance = new CreateCommand(); |
||
32 | |||
33 | // Explicit static constructor to tell C# compiler |
||
34 | // not to mark type as beforefieldinit |
||
35 | static CreateCommand() |
||
36 | { |
||
37 | } |
||
38 | |||
39 | private CreateCommand() |
||
40 | { |
||
41 | } |
||
42 | |||
43 | public static CreateCommand Instance |
||
44 | { |
||
45 | get |
||
46 | { |
||
47 | return _instance; |
||
48 | } |
||
49 | } |
||
50 | |||
51 | /// <summary> |
||
52 | /// push given control to undo stack |
||
53 | /// </summary> |
||
54 | /// <author>humkyung</author> |
||
55 | /// <date>2019.06.12</date> |
||
56 | /// <param name="comments"></param> |
||
57 | public void Execute(CommentUserInfo control) |
||
58 | { |
||
59 | ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i => |
||
60 | { |
||
61 | ViewerDataModel.Instance.UndoDataList.Remove(i); |
||
62 | }); |
||
63 | |||
64 | MarkupToPDF.Common.Undo_data UndoData = new Undo_data() |
||
65 | { |
||
66 | IsUndo = false, |
||
67 | Event = Event_Type.Create, |
||
68 | EventTime = DateTime.Now, |
||
69 | Markup_List = new List<Multi_Undo_data>() |
||
70 | }; |
||
71 | |||
72 | Multi_Undo_data multi_Undo_Data = new Multi_Undo_data() |
||
73 | { |
||
74 | Markup = control |
||
75 | }; |
||
76 | UndoData.Markup_List.Add(multi_Undo_Data); |
||
77 | |||
78 | ViewerDataModel.Instance.UndoDataList.Add(UndoData); |
||
79 | |||
80 | control.ApplyOverViewData(); |
||
81 | } |
||
82 | } |
||
83 | } |