markus / KCOM / Events / RedoCommand.cs @ 53f99751
이력 | 보기 | 이력해설 | 다운로드 (4.06 KB)
1 | f816dd63 | humkyung | using MarkupToPDF.Common; |
---|---|---|---|
2 | using MarkupToPDF.Controls.Common; |
||
3 | using MarkupToPDF.Controls.Line; |
||
4 | using MarkupToPDF.Controls.Polygon; |
||
5 | using MarkupToPDF.Controls.Shape; |
||
6 | using MarkupToPDF.Controls.Text; |
||
7 | using MarkupToPDF.Controls.Etc; |
||
8 | using System; |
||
9 | using System.Collections.Generic; |
||
10 | using System.Linq; |
||
11 | using System.Text; |
||
12 | using System.Windows; |
||
13 | using System.Windows.Controls; |
||
14 | using System.Windows.Media; |
||
15 | using MarkupToPDF.Controls.Cad; |
||
16 | using KCOM.Common; |
||
17 | using KCOM.Controls; |
||
18 | 4eb052e4 | ljiyeon | using MarkupToPDF.Controls.Parsing; |
19 | f816dd63 | humkyung | |
20 | namespace KCOM.Events |
||
21 | { |
||
22 | public class RedoCommand |
||
23 | { |
||
24 | private static readonly RedoCommand _instance = new RedoCommand(); |
||
25 | |||
26 | // Explicit static constructor to tell C# compiler |
||
27 | // not to mark type as beforefieldinit |
||
28 | static RedoCommand() |
||
29 | { |
||
30 | } |
||
31 | |||
32 | private RedoCommand() |
||
33 | { |
||
34 | } |
||
35 | |||
36 | public static RedoCommand Instance |
||
37 | { |
||
38 | get |
||
39 | { |
||
40 | return _instance; |
||
41 | } |
||
42 | } |
||
43 | |||
44 | /// <summary> |
||
45 | /// redo |
||
46 | /// </summary> |
||
47 | public void Execute() |
||
48 | { |
||
49 | AdornerFinal final; |
||
50 | 873011c4 | humkyung | UndoDataGroup redo = ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo).ToList() |
51 | ab7fe8c0 | humkyung | .OrderBy(order => order.EventTime).FirstOrDefault(); |
52 | f816dd63 | humkyung | if (redo == null) return; |
53 | |||
54 | SelectionSet.Instance.UnSelect(Common.ViewerDataModel.Instance.SystemMain.dzMainMenu); |
||
55 | switch (redo.Event) |
||
56 | { |
||
57 | 873011c4 | humkyung | case (EventType.Create): |
58 | f816dd63 | humkyung | { |
59 | 7f669d88 | humkyung | List<CommentUserInfo> comments = new List<CommentUserInfo>(); |
60 | 873011c4 | humkyung | foreach (var item in redo.MarkupDataColl) |
61 | f816dd63 | humkyung | { |
62 | 7f669d88 | humkyung | item.Markup.Load(); |
63 | item.Markup.UpdateControl(); |
||
64 | comments.Add(item.Markup); |
||
65 | 34ac8db7 | humkyung | |
66 | 39f0624f | ljiyeon | ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.MarkupListUpdate( |
67 | 7f669d88 | humkyung | MarkupParser.MarkupToString(item.Markup, App.ViewInfo.UserID), EventType.Create, null, null); |
68 | f816dd63 | humkyung | } |
69 | 7f669d88 | humkyung | |
70 | var adorner = new AdornerFinal(comments); |
||
71 | Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.SelectLayer.Children.Add(adorner); |
||
72 | f816dd63 | humkyung | } |
73 | break; |
||
74 | 873011c4 | humkyung | case (EventType.Delete): |
75 | f816dd63 | humkyung | { |
76 | 873011c4 | humkyung | foreach (var item in redo.MarkupDataColl) |
77 | f816dd63 | humkyung | { |
78 | 7f669d88 | humkyung | ViewerDataModel.Instance.MarkupControls_USER.Remove((item.Markup)); |
79 | 34ac8db7 | humkyung | |
80 | 39f0624f | ljiyeon | ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.MarkupListUpdate( |
81 | 873011c4 | humkyung | null, EventType.Delete, item.Markup.CommentID, null); |
82 | f816dd63 | humkyung | } |
83 | } |
||
84 | break; |
||
85 | 873011c4 | humkyung | case (EventType.Operation): |
86 | f816dd63 | humkyung | { |
87 | List<CommentUserInfo> comment = new List<CommentUserInfo>(); |
||
88 | |||
89 | 873011c4 | humkyung | foreach (var item in redo.MarkupDataColl) |
90 | f816dd63 | humkyung | { |
91 | 86143026 | humkyung | ViewerDataModel.Instance.MarkupControls_USER.Remove(item.Markup); |
92 | cbeff740 | swate0609 | |
93 | 86143026 | humkyung | var tmp = item.Markup.Clone(); |
94 | item.Markup.Copy(item.Clone); |
||
95 | item.Clone.Copy(tmp); |
||
96 | item.Markup.UpdateControl(); |
||
97 | f816dd63 | humkyung | |
98 | comment.Add(item.Markup); |
||
99 | } |
||
100 | 7f669d88 | humkyung | var adoner = new AdornerFinal(comment); |
101 | Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.SelectLayer.Children.Add(adoner); |
||
102 | ///SelectionSet.Instance.UnSelect(Common.ViewerDataModel.Instance.SystemMain.dzMainMenu); |
||
103 | f816dd63 | humkyung | } |
104 | break; |
||
105 | } |
||
106 | |||
107 | ab7fe8c0 | humkyung | ViewerDataModel.Instance.UndoDataList.Where(data => data.EventTime == redo.EventTime).ToList() |
108 | .OrderByDescending(order => order.EventTime).ToList().ForEach(i => |
||
109 | f816dd63 | humkyung | { |
110 | i.IsUndo = false; |
||
111 | }); |
||
112 | } |
||
113 | } |
||
114 | } |