프로젝트

일반

사용자정보

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

markus / KCOM / Events / RedoCommand.cs @ 34ac8db7

이력 | 보기 | 이력해설 | 다운로드 (3.72 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
            UndoDataGroup redo = ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo).ToList()
51
                .OrderBy(order => order.EventTime).FirstOrDefault();
52
            if (redo == null) return;
53

    
54
            SelectionSet.Instance.UnSelect(Common.ViewerDataModel.Instance.SystemMain.dzMainMenu);
55
            switch (redo.Event)
56
            {
57
                case (EventType.Create):
58
                    {
59
                        foreach (var item in redo.MarkupDataColl)
60
                        {
61
                            ViewerDataModel.Instance.MarkupControls_USER.Add(item.Markup);
62

    
63
                            ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.MarkupListUpdate(
64
                            MarkupParser.MarkupToString(item.Markup, App.ViewInfo.UserID), EventType.Create, null, null);
65
                        }
66
                    }
67
                    break;
68
                case (EventType.Delete):
69
                    {
70
                        foreach (var item in redo.MarkupDataColl)
71
                        {
72
                            ViewerDataModel.Instance.MarkupControls_USER.Remove(item.Markup);
73

    
74
                            ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.MarkupListUpdate(
75
                            null, EventType.Delete, item.Markup.CommentID, null);
76
                        }
77
                    }
78
                    break;
79
                case (EventType.Operation):
80
                    {
81
                        List<CommentUserInfo> comment = new List<CommentUserInfo>();
82

    
83
                        foreach (var item in redo.MarkupDataColl)
84
                        {
85
                            ViewerDataModel.Instance.MarkupControls_USER.Remove(item.Markup);
86

    
87
                            var tmp = item.Markup.Clone();
88
                            item.Markup.Copy(item.Clone);
89
                            item.Clone.Copy(tmp);
90
                            item.Markup.UpdateControl();
91

    
92
                            comment.Add(item.Markup);
93
                        }
94
                        final = new AdornerFinal(comment);
95
                        Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.SelectLayer.Children.Add(final);
96
                        SelectionSet.Instance.UnSelect(Common.ViewerDataModel.Instance.SystemMain.dzMainMenu);
97
                    }
98
                    break;
99
            }
100

    
101
            ViewerDataModel.Instance.UndoDataList.Where(data => data.EventTime == redo.EventTime).ToList()
102
                .OrderByDescending(order => order.EventTime).ToList().ForEach(i =>
103
            {
104
                i.IsUndo = false;
105
            });
106
        }
107
    }
108
}
클립보드 이미지 추가 (최대 크기: 500 MB)