프로젝트

일반

사용자정보

통계
| 브랜치(Branch): | 개정판:

markus / KCOM / Events / RedoCommand.cs @ cbeff740

이력 | 보기 | 이력해설 | 다운로드 (8.88 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 ab7fe8c0 humkyung
            Undo_data redo = ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo).ToList()
51
                .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
                case (Event_Type.Create):
58
                    {
59
                        foreach (var item in redo.Markup_List)
60
                        {
61
                            ViewerDataModel.Instance.MarkupControls_USER.Add(item.Markup);
62 39f0624f ljiyeon
                            ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.MarkupListUpdate(
63 4eb052e4 ljiyeon
                            MarkupParser.MarkupToString(item.Markup, App.ViewInfo.UserID), Event_Type.Create, null, null);
64 f816dd63 humkyung
                        }
65
                    }
66
                    break;
67
                case (Event_Type.Delete):
68
                    {
69
                        foreach (var item in redo.Markup_List)
70
                        {
71
                            ViewerDataModel.Instance.MarkupControls_USER.Remove(item.Markup);
72 39f0624f ljiyeon
                            ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.MarkupListUpdate(
73 4eb052e4 ljiyeon
                            null, Event_Type.Delete, item.Markup.CommentID, null);
74 f816dd63 humkyung
                        }
75
                    }
76
                    break;
77
                case (Event_Type.Thumb):
78
                    {
79
                        List<CommentUserInfo> comment = new List<CommentUserInfo>();
80
81
                        foreach (var item in redo.Markup_List)
82
                        {
83 cbeff740 swate0609
                            double dOriAngle = 0.0;
84
                            List<Point> lstOriPointSet = new List<Point>();
85
86 f816dd63 humkyung
                            ViewerDataModel.Instance.MarkupControls_USER.Remove((item.Markup as CommentUserInfo));
87
88
                            if ((item.Markup as IViewBox) != null)
89
                            {
90 cbeff740 swate0609
                                dOriAngle = (item.Markup as IViewBox).CommentAngle;
91 fa48eb85 taeseongkim
                                (item.Markup as IViewBox).CommentAngle = item.Angle;
92 cbeff740 swate0609
                                item.Angle = dOriAngle;
93 f816dd63 humkyung
                            }
94
                            if ((item.Markup as TextControl) != null)
95
                            {
96 cbeff740 swate0609
                                dOriAngle = (item.Markup as TextControl).CommentAngle;
97 fa48eb85 taeseongkim
                                (item.Markup as TextControl).CommentAngle = item.Angle;
98 cbeff740 swate0609
                                item.Angle = dOriAngle;
99
100
                                if (item.PointSet.Count > 0)
101
                                {
102
                                    foreach(var point in (item.Markup as IPath).PointSet)
103
                                    {
104
                                        lstOriPointSet.Add(point);
105
                                    }
106
107
                                    Canvas.SetLeft((item.Markup as TextControl), item.PointSet[0].X);
108
                                    Canvas.SetTop((item.Markup as TextControl), item.PointSet[0].Y);
109 f816dd63 humkyung
110 cbeff740 swate0609
                                    item.PointSet = lstOriPointSet;
111
                                }
112 f816dd63 humkyung
                            }
113
                            else
114
                            {
115 cbeff740 swate0609
                                dOriAngle = (item.Markup).CommentAngle;
116 f5407d37 swate0609
                                (item.Markup).CommentAngle = item.Angle;
117 cbeff740 swate0609
                                item.Angle = dOriAngle;
118
                                foreach(var point in (item.Markup as IPath).PointSet)
119
                                {
120
                                    lstOriPointSet.Add(point);
121
                                }
122 f816dd63 humkyung
                                (item.Markup as IPath).PointSet = item.PointSet;
123 cbeff740 swate0609
                                item.PointSet = lstOriPointSet;
124 0d00f9c8 humkyung
                                (item.Markup as CommentUserInfo).UpdateControl();
125 f816dd63 humkyung
                            }
126
                            comment.Add(item.Markup);
127
                        }
128
                        final = new AdornerFinal(comment);
129
                        Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.SelectLayer.Children.Add(final);
130
                        SelectionSet.Instance.UnSelect(Common.ViewerDataModel.Instance.SystemMain.dzMainMenu);
131
                    }
132
                    break;
133
                case (Event_Type.Select):
134
                    {
135
                        List<CommentUserInfo> comment = new List<CommentUserInfo>();
136
137
                        foreach (var item in redo.Markup_List)
138
                        {
139
                            ViewerDataModel.Instance.MarkupControls_USER.Remove(item.Markup);
140
141
                            if ((item.Markup as IPath) != null)
142
                            {
143
                                (item.Markup as IPath).LineSize = item.LineSize;
144
                            }
145
                            if ((item.Markup as UIElement) != null)
146
                            {
147
                                (item.Markup as UIElement).Opacity = item.Opacity;
148
                            }
149
                            if ((item.Markup as IDashControl) != null)
150
                            {
151
                                (item.Markup as IDashControl).DashSize = item.DashSize;
152
                            }
153
                            if ((item.Markup as IShapeControl) != null)
154
                            {
155
                                (item.Markup as IShapeControl).Paint = item.paint;
156
                            }
157
158
                            comment.Add(item.Markup);
159
                        }
160
                        final = new AdornerFinal(comment);
161
                        Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.SelectLayer.Children.Add(final);
162
                    }
163
                    break;
164
                case (Event_Type.Option):
165
                    {
166
                        List<CommentUserInfo> comment = new List<CommentUserInfo>();
167
168
                        foreach (var item in redo.Markup_List)
169
                        {
170
                            ViewerDataModel.Instance.MarkupControls_USER.Remove(item.Markup);
171
                            if (redo.LineSize != 0 && item.Markup as IPath != null)
172
                            {
173
                                (item.Markup as IPath).LineSize = redo.LineSize;
174
                            }
175
                            else if (redo.Opacity != 0 && item.Markup as UIElement != null)
176
                            {
177
                                (item.Markup as UIElement).Opacity = redo.Opacity;
178
                            }
179
                            else if (redo.DashSize != null && item.Markup as IDashControl != null)
180
                            {
181
                                (item.Markup as IDashControl).DashSize = redo.DashSize;
182
                            }
183
                            else if (redo.Interval != 0 && item.Markup as LineControl != null)
184
                            {
185
                                (item.Markup as LineControl).Interval = redo.Interval;
186
                            }
187
                            else if (item.Markup as IShapeControl != null)
188
                            {
189
                                (item.Markup as IShapeControl).Paint = redo.paint;
190
                            }
191
                            comment.Add(item.Markup);
192
                        }
193
                        final = new AdornerFinal(comment);
194
                        Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.SelectLayer.Children.Add(final);
195
                    }
196
                    break;
197
            }
198
199 ab7fe8c0 humkyung
            ViewerDataModel.Instance.UndoDataList.Where(data => data.EventTime == redo.EventTime).ToList()
200
                .OrderByDescending(order => order.EventTime).ToList().ForEach(i =>
201 f816dd63 humkyung
            {
202
                i.IsUndo = false;
203
            });
204
        }
205
    }
206
}
클립보드 이미지 추가 (최대 크기: 500 MB)