markus / KCOM / Events / RedoCommand.cs @ 3abe8d4e
이력 | 보기 | 이력해설 | 다운로드 (7.55 KB)
1 |
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 |
using MarkupToPDF.Controls.Parsing; |
19 |
|
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 |
Undo_data redo = ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().OrderBy(order => order.EventTime).FirstOrDefault(); |
51 |
if (redo == null) return; |
52 |
|
53 |
SelectionSet.Instance.UnSelect(Common.ViewerDataModel.Instance.SystemMain.dzMainMenu); |
54 |
switch (redo.Event) |
55 |
{ |
56 |
case (Event_Type.Create): |
57 |
{ |
58 |
foreach (var item in redo.Markup_List) |
59 |
{ |
60 |
ViewerDataModel.Instance.MarkupControls_USER.Add(item.Markup); |
61 |
ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.MarkupListUpdate( |
62 |
MarkupParser.MarkupToString(item.Markup, App.ViewInfo.UserID), Event_Type.Create, null, null); |
63 |
} |
64 |
} |
65 |
break; |
66 |
case (Event_Type.Delete): |
67 |
{ |
68 |
foreach (var item in redo.Markup_List) |
69 |
{ |
70 |
ViewerDataModel.Instance.MarkupControls_USER.Remove(item.Markup); |
71 |
ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.MarkupListUpdate( |
72 |
null, Event_Type.Delete, item.Markup.CommentID, null); |
73 |
} |
74 |
} |
75 |
break; |
76 |
case (Event_Type.Thumb): |
77 |
{ |
78 |
List<CommentUserInfo> comment = new List<CommentUserInfo>(); |
79 |
|
80 |
foreach (var item in redo.Markup_List) |
81 |
{ |
82 |
ViewerDataModel.Instance.MarkupControls_USER.Remove((item.Markup as CommentUserInfo)); |
83 |
|
84 |
if ((item.Markup as IViewBox) != null) |
85 |
{ |
86 |
(item.Markup as IViewBox).CommentAngle = item.Angle; |
87 |
} |
88 |
if ((item.Markup as TextControl) != null) |
89 |
{ |
90 |
(item.Markup as TextControl).CommentAngle = item.Angle; |
91 |
|
92 |
Canvas.SetLeft((item.Markup as TextControl), item.PointSet[0].X); |
93 |
Canvas.SetTop((item.Markup as TextControl), item.PointSet[0].Y); |
94 |
} |
95 |
else |
96 |
{ |
97 |
(item.Markup as IPath).PointSet = item.PointSet; |
98 |
(item.Markup as CommentUserInfo).UpdateControl(); |
99 |
} |
100 |
comment.Add(item.Markup); |
101 |
} |
102 |
final = new AdornerFinal(comment); |
103 |
Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.SelectLayer.Children.Add(final); |
104 |
SelectionSet.Instance.UnSelect(Common.ViewerDataModel.Instance.SystemMain.dzMainMenu); |
105 |
} |
106 |
break; |
107 |
case (Event_Type.Select): |
108 |
{ |
109 |
List<CommentUserInfo> comment = new List<CommentUserInfo>(); |
110 |
|
111 |
foreach (var item in redo.Markup_List) |
112 |
{ |
113 |
ViewerDataModel.Instance.MarkupControls_USER.Remove(item.Markup); |
114 |
|
115 |
if ((item.Markup as IPath) != null) |
116 |
{ |
117 |
(item.Markup as IPath).LineSize = item.LineSize; |
118 |
} |
119 |
if ((item.Markup as UIElement) != null) |
120 |
{ |
121 |
(item.Markup as UIElement).Opacity = item.Opacity; |
122 |
} |
123 |
if ((item.Markup as IDashControl) != null) |
124 |
{ |
125 |
(item.Markup as IDashControl).DashSize = item.DashSize; |
126 |
} |
127 |
if ((item.Markup as IShapeControl) != null) |
128 |
{ |
129 |
(item.Markup as IShapeControl).Paint = item.paint; |
130 |
} |
131 |
|
132 |
comment.Add(item.Markup); |
133 |
} |
134 |
final = new AdornerFinal(comment); |
135 |
Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.SelectLayer.Children.Add(final); |
136 |
} |
137 |
break; |
138 |
case (Event_Type.Option): |
139 |
{ |
140 |
List<CommentUserInfo> comment = new List<CommentUserInfo>(); |
141 |
|
142 |
foreach (var item in redo.Markup_List) |
143 |
{ |
144 |
ViewerDataModel.Instance.MarkupControls_USER.Remove(item.Markup); |
145 |
if (redo.LineSize != 0 && item.Markup as IPath != null) |
146 |
{ |
147 |
(item.Markup as IPath).LineSize = redo.LineSize; |
148 |
} |
149 |
else if (redo.Opacity != 0 && item.Markup as UIElement != null) |
150 |
{ |
151 |
(item.Markup as UIElement).Opacity = redo.Opacity; |
152 |
} |
153 |
else if (redo.DashSize != null && item.Markup as IDashControl != null) |
154 |
{ |
155 |
(item.Markup as IDashControl).DashSize = redo.DashSize; |
156 |
} |
157 |
else if (redo.Interval != 0 && item.Markup as LineControl != null) |
158 |
{ |
159 |
(item.Markup as LineControl).Interval = redo.Interval; |
160 |
} |
161 |
else if (item.Markup as IShapeControl != null) |
162 |
{ |
163 |
(item.Markup as IShapeControl).Paint = redo.paint; |
164 |
} |
165 |
comment.Add(item.Markup); |
166 |
} |
167 |
final = new AdornerFinal(comment); |
168 |
Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.SelectLayer.Children.Add(final); |
169 |
} |
170 |
break; |
171 |
} |
172 |
|
173 |
ViewerDataModel.Instance.UndoDataList.Where(data => data.EventTime == redo.EventTime).ToList().OrderByDescending(order => order.EventTime).ToList().ForEach(i => |
174 |
{ |
175 |
i.IsUndo = false; |
176 |
}); |
177 |
} |
178 |
} |
179 |
} |