프로젝트

일반

사용자정보

개정판 d128ceb2

IDd128ceb2a00511f4acf4bbd329bc077aa1c41f62
상위 340a9bf3
하위 748afa9f

백흠경이(가) 5년 이상 전에 추가함

issue #923: add UndoCommand

Change-Id: I7bb9cf1d4276c75e50906b7f4672433afc233e15

차이점 보기:

KCOM/Controls/AdornerFinal.xaml.cs
1 1
using KCOM.Common;
2
using KCOM.Events;
2 3
using MarkupToPDF.Common;
3 4
using MarkupToPDF.Controls.Cad;
4 5
using MarkupToPDF.Controls.Common;
......
1192 1193
            this.isDragging = false;
1193 1194
            DraggerThumb = null;
1194 1195

  
1195
            Undo_Event();
1196
            var comments = (from drawing in this.MemberSet
1197
                            select drawing.DrawingData as CommentUserInfo).ToList();
1198
            UndoCommand.Instance.Execute(comments, this.AngleValue);
1196 1199
        }
1197 1200

  
1198 1201
        /// <summary>
......
1226 1229
                }
1227 1230
            }
1228 1231

  
1229
            Undo_Event();
1232
            var comments = (from drawing in this.MemberSet
1233
                            select drawing.DrawingData as CommentUserInfo).ToList();
1234
            UndoCommand.Instance.Execute(comments, this.AngleValue);
1230 1235
        }
1231 1236

  
1232 1237
        private void rotate_MouseMove(object sender, MouseEventArgs e)
......
1946 1951
                return;
1947 1952
            }
1948 1953

  
1949
            if (ViewerDataModel.Instance.UndoDataList.LastOrDefault().Event == Event_Type.Thumb)
1954
            if ((ViewerDataModel.Instance.UndoDataList.Count > 0) && ViewerDataModel.Instance.UndoDataList.LastOrDefault().Event == Event_Type.Thumb)
1950 1955
            {
1951 1956
                return;
1952 1957
            }
1953
            if (ViewerDataModel.Instance.UndoDataList.LastOrDefault().Markup_List != null)
1958

  
1959
            if ((ViewerDataModel.Instance.UndoDataList.Count > 0) && ViewerDataModel.Instance.UndoDataList.LastOrDefault().Markup_List != null)
1954 1960
            {
1955 1961
                if (ViewerDataModel.Instance.UndoDataList.LastOrDefault().Markup_List.Count > 0)
1956 1962
                {
......
1961 1967
                }
1962 1968
            }
1963 1969

  
1964
            Undo_Event();
1970
            var comments = (from drawing in this.MemberSet
1971
                            select drawing.DrawingData as CommentUserInfo).ToList();
1972
            UndoCommand.Instance.Execute(comments, this.AngleValue);
1965 1973
        }
1966 1974
        
1967 1975
        private void rotate_DragCompleted(object sender, DragCompletedEventArgs e)
1968 1976
        {
1969 1977
            rotateTop.Cursor = new Cursor(MainWindow.CursorChange().StreamSource);
1970
            
1971
            Undo_Event();
1978

  
1979
            var comments = (from drawing in this.MemberSet
1980
                            select drawing.DrawingData as CommentUserInfo).ToList();
1981
            UndoCommand.Instance.Execute(comments, this.AngleValue);
1972 1982
        }
1973 1983

  
1974 1984
        private void drag_DragStarted(object sender, DragStartedEventArgs e)
......
1992 2002
                }
1993 2003
            }
1994 2004

  
1995
            Undo_Event();
1996
        }
1997

  
1998
        private void Undo_Event()
1999
        {
2000
            List<Point> p_set = new List<Point>();
2001

  
2002
            Undo_data UndoData = new Undo_data()
2003
            {
2004
                IsUndo = false,
2005
                Event = Event_Type.Thumb,
2006
                EventTime = DateTime.Now,
2007
                Markup_List = new List<Multi_Undo_data>(),
2008
            };
2009

  
2010
            Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
2011

  
2012
            foreach (var control in MemberSet)
2013
            {
2014
                multi_Undo_Data.PointSet = new List<Point>();
2015
                p_set = new List<Point>();
2016

  
2017
                if (control.DrawingData as TextControl != null)
2018
                {
2019
                    multi_Undo_Data.PointSet.Add((control.DrawingData as TextControl).StartPoint);
2020
                    multi_Undo_Data.PointSet.Add((control.DrawingData as TextControl).EndPoint);
2021
                }
2022

  
2023
                foreach (var point in ((control.DrawingData as CommentUserInfo) as IPath).PointSet)
2024
                {
2025
                    multi_Undo_Data.PointSet.Add(point);
2026
                }
2027

  
2028
                if (control.DrawingData as ArrowTextControl != null)
2029
                {
2030
                    multi_Undo_Data.Angle = AngleValue = (control.DrawingData as ArrowTextControl).Angle;
2031
                }
2032
                else
2033
                {
2034
                    multi_Undo_Data.Angle = AngleValue;
2035
                }
2036

  
2037
                multi_Undo_Data.Markup = control.DrawingData as CommentUserInfo;
2038
                UndoData.Markup_List.Add(multi_Undo_Data);
2039
                multi_Undo_Data = new Multi_Undo_data();
2040
            }
2041
            ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
2042
            {
2043
                ViewerDataModel.Instance.UndoDataList.Remove(i);
2044
            });
2045

  
2046
            ViewerDataModel.Instance.UndoDataList.Add(UndoData);
2047

  
2005
            var comments = (from drawing in this.MemberSet
2006
                            select drawing.DrawingData as CommentUserInfo).ToList();
2007
            UndoCommand.Instance.Execute(comments, this.AngleValue);
2048 2008
        }
2049 2009

  
2050 2010
        private void drag_DragCompleted(object sender, DragCompletedEventArgs e)
2051 2011
        {          
2052 2012
            DragThumb.Cursor = new Cursor(MainWindow.CursorChange().StreamSource);
2053 2013

  
2054
            Undo_Event();
2014
            var comments = (from drawing in this.MemberSet
2015
                            select drawing.DrawingData as CommentUserInfo).ToList();
2016
            UndoCommand.Instance.Execute(comments, this.AngleValue);
2055 2017
        }
2056 2018

  
2057 2019
        public void ControlPointMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
KCOM/Events/Implementation/TopMenuEvent.cs
369 369
                            RefactoryCommentReact(menu);
370 370
                            ViewerDataModel.Instance._markupInfoList.Where(data => data.MarkupInfoID == (item as IKCOM.MarkupInfoItem).MarkupInfoID).FirstOrDefault().UpdateTime = DateTime.Now;
371 371

  
372

  
373 372
                            if (ViewerDataModel.Instance.IsConsolidate)
374 373
                            {
375 374
                                return;
376 375
                            }
376

  
377 377
                            menu.gridViewMarkup.ItemsSource = null;
378 378
                            menu.gridViewMarkup.ItemsSource = ViewerDataModel.Instance._markupInfoList;
379 379
                            menu.gridViewMarkup.SelectedItem = item;
......
382 382
                            descriptor.DisplayContent = "DEPT";
383 383
                            descriptor.SortDirection = ListSortDirection.Ascending;
384 384
                            menu.gridViewMarkup.GroupDescriptors.Add(descriptor);
385

  
385 386
                            if (sender != null)
386 387
                            {
387 388
                                if (ViewerDataModel.Instance.IsPressCtrl)
KCOM/Events/Implementation/TopMenuEvent.cs.bak
1
using KCOM.Common;
2
using KCOM.Common.Converter;
3
using KCOM.Controls;
4
using KCOM.Events;
5
using MarkupToPDF.Common;
6
using System;
7
using System.Collections.Generic;
8
using System.Linq;
9
using System.Text;
10
using System.Windows;
11
using System.Windows.Controls;
12
using System.Windows.Input;
13
using System.Windows.Media;
14
using Telerik.Windows.Controls;
15

  
16
namespace KCOM.Views
17
{
18
    public partial class TopMenu : UserControl
19
    {
20
        public int rotateOffSet = 0;
21
        private double[] rotateValue = { 0, 90, 180, 270 };
22
        public System.Windows.Threading.DispatcherTimer SaveTimer { get; set; }
23
        public bool isClosed = true;
24
        public RadWindow CheckPop;
25

  
26
        /// <summary>
27
        /// TaskBar에 메시지를 입력합니다
28
        /// </summary>
29
        /// <param name="message"></param>
30
        /// <param name="type"></param>
31
        public void TaskMessage(string message, TaskMessageType type)
32
        {
33
            //if (taskBar != null)
34
            //{
35
            //    string color = "";
36
            //    taskBar.Content = message;
37
            //    DicTaskMessage.TryGetValue(type, out color);
38
            //    taskBar.Foreground = new SolidColorBrush(StringToColorConverter.Parse(color));
39
            //}
40
        }
41

  
42
        /// <summary>
43
        /// Task Type명을 Key값으로 지정합니다
44
        /// </summary>
45
        public enum TaskMessageType
46
        {
47
            Normal,
48
            Caption,
49
            Error,
50
        }
51

  
52
        private void CheckShapeState()
53
        {
54

  
55

  
56
            if (cbHatchShape.IsChecked == true)
57
            {
58
                cbFillShape.IsChecked = false;
59
                ViewerDataModel.Instance.paintSet = MarkupToPDF.Controls.Common.PaintSet.Hatch;
60
            }
61
            else if(cbFillShape.IsChecked == true)
62
            {
63
                cbHatchShape.IsChecked = false;
64
                ViewerDataModel.Instance.paintSet = MarkupToPDF.Controls.Common.PaintSet.Fill;
65
            }
66
            else
67
            {
68
                ViewerDataModel.Instance.paintSet = MarkupToPDF.Controls.Common.PaintSet.None;
69
            }
70
        }
71

  
72
        //강인구 추가(Undo End)
73
        private void SetPaintEvent()
74
        {
75
            List<AdornerMember> AdonerList = GetAdornerItem();
76

  
77
            if (AdonerList.Count > 0)
78
            {
79
                Undo_data UndoData = new Undo_data()
80
                {
81
                    IsUndo = false,
82
                    Event = Event_Type.Option,
83
                    EventTime = DateTime.Now,
84
                    paint = ViewerDataModel.Instance.paintSet,
85
                    Markup_List = new List<Multi_Undo_data>()
86
                };
87
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
88

  
89
                foreach (AdornerMember InnerItem in AdonerList)
90
                {
91
                    multi_Undo_Data.PointSet = new List<Point>();
92

  
93
                    if ((InnerItem.DrawingData as MarkupToPDF.Controls.Common.IShapeControl) != null)
94
                    {
95
                        (InnerItem.DrawingData as MarkupToPDF.Controls.Common.IShapeControl).Paint = ViewerDataModel.Instance.paintSet;
96
                    }
97

  
98
                    multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
99
                    UndoData.Markup_List.Add(multi_Undo_Data);
100
                    multi_Undo_Data = new Multi_Undo_data();
101
                }
102

  
103
                ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
104
                {
105
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
106
                });
107
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
108
            }
109

  
110
        }
111

  
112
        private void SetHighlightEvent()
113
        {
114
            List<AdornerMember> AdonerList = GetAdornerItem();
115

  
116
            if (AdonerList.Count > 0)
117
            {
118
                foreach (AdornerMember InnerItem in AdonerList)
119
                {
120
                    switch (InnerItem.DrawingData.GetType().Name)
121
                    {
122
                        case ("TextControl"):
123
                            {
124
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).IsHighLight = ViewerDataModel.Instance.checkHighShape;
125
                            }
126
                            break;
127
                        case ("ArrowTextControl"):
128
                            {
129
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape;
130
                            }
131
                            break;
132
                    }
133
                }
134
            }
135

  
136
        }
137

  
138
        private void FillShapeEvent(object sender, RoutedEventArgs e)
139
        {
140
            #region 주석
141
            //if ((sender as CheckBox).IsChecked.Value)
142
            //{
143
            //    cbHatchShape.IsChecked = false;
144
            //    imgShape_RectCloud.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/RectCloud_Fill.png", UriKind.Relative));
145
            //    imgShape_Cloud.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/Cloud_Fill.png", UriKind.Relative));
146
            //    imgShape_Rect.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/Rectangle_Fill.png", UriKind.Relative));
147
            //    imgShape_Tri.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/triangle-icon.png", UriKind.Relative));
148
            //    imgShape_Cicle.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/circle-icon.png", UriKind.Relative));
149
            //    imgShape_Poly.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/polygon_Fill.png", UriKind.Relative));
150
            //    TaskMessage("채우기 옵션이 적용되었습니다", TaskMessageType.Normal);
151
            //}
152
            //else
153
            //{
154

  
155
            //    imgShape_RectCloud.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/RectCloud.png", UriKind.Relative));
156
            //    imgShape_Cloud.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/Cloud.png", UriKind.Relative));
157
            //    imgShape_Rect.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/Rectangle.png", UriKind.Relative));
158
            //    imgShape_Tri.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/triangle-icon_None.png", UriKind.Relative));
159
            //    imgShape_Cicle.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/circle-icon_None.png", UriKind.Relative));
160
            //    imgShape_Poly.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/polygon.png", UriKind.Relative));
161
            //    TaskMessage("채우기 옵션이 해제되었습니다", TaskMessageType.Caption);
162
            //}
163
            #endregion
164
            ViewerDataModel.Instance.checkFillShape = (sender as CheckBox).IsChecked.Value;
165

  
166
            if (ViewerDataModel.Instance.checkFillShape)
167
            {
168
                cbHatchShape.IsChecked = false;
169
                ViewerDataModel.Instance.paintSet = MarkupToPDF.Controls.Common.PaintSet.Fill;
170
            }
171
            else
172
            {
173
                ViewerDataModel.Instance.paintSet = MarkupToPDF.Controls.Common.PaintSet.None;
174
            }
175
            SetPaintEvent();
176
            
177

  
178

  
179
        }
180

  
181
        /// <summary>
182
        /// 도형 빗금 처리
183
        /// </summary>
184
        /// <param name="sender"></param>
185
        /// <param name="e"></param>
186
        private void HatchShapeEvent(object sender, RoutedEventArgs e)
187
        {
188
			#region 주석
189
            //if ((sender as CheckBox).IsChecked.Value)
190
            //{
191
            //    cbFillShape.IsChecked = false;
192
            //    imgShape_RectCloud.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/RectCloud_Hatch.png", UriKind.Relative));
193
            //    imgShape_Cloud.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/Cloud_Hatch.png", UriKind.Relative));
194
            //    imgShape_Rect.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/rectangle-icon_Hatch.png", UriKind.Relative));
195
            //    imgShape_Tri.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/triangle-icon_Hatch.png", UriKind.Relative));
196
            //    imgShape_Cicle.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/circle-icon_Hatch.png", UriKind.Relative));
197
            //    imgShape_Poly.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/polygon_hatch.png", UriKind.Relative));
198
            //    TaskMessage("무늬 옵션이 적용되었습니다", TaskMessageType.Normal);
199
            //}
200
            //else
201
            //{
202
            //    imgShape_RectCloud.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/RectCloud.png", UriKind.Relative));
203
            //    imgShape_Cloud.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/Cloud.png", UriKind.Relative));
204
            //    imgShape_Rect.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/Rectangle.png", UriKind.Relative));
205
            //    imgShape_Tri.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/triangle-icon_None.png", UriKind.Relative));
206
            //    imgShape_Cicle.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/circle-icon_None.png", UriKind.Relative));
207
            //    imgShape_Poly.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/polygon.png", UriKind.Relative));
208
            //    TaskMessage("무늬 옵션이 해제되었습니다", TaskMessageType.Caption);
209
            //} 
210
            #endregion
211

  
212
            //강인구 추가
213
            ViewerDataModel.Instance.checkHatchShape = (sender as CheckBox).IsChecked.Value;
214
            if (ViewerDataModel.Instance.checkHatchShape)
215
            {
216
                cbFillShape.IsChecked = false;
217
                ViewerDataModel.Instance.paintSet = MarkupToPDF.Controls.Common.PaintSet.Hatch;
218
            }
219
            else
220
            {
221
                ViewerDataModel.Instance.paintSet = MarkupToPDF.Controls.Common.PaintSet.None;  
222
            }
223
            SetPaintEvent();
224
        }
225

  
226
 		//강인구 추가
227
        private string SetColor(string ID)
228
        {
229
            try
230
            {
231
                return ViewerDataModel.Instance._markupInfoList.Where(info => info.MarkupInfoID == ID).First().DisplayColor;
232
            }
233
            catch (Exception)
234
            {
235
                return "#FFFFFF";
236
            }
237
        }
238

  
239
        void SaveTimer_Tick(object sender, EventArgs e)
240
        {
241
            //if (this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode != IKCOM.MouseHandlingMode.Drawing)
242
            if (this.ParentOfType<MainWindow>().dzMainMenu.currentControl == null && this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count == 0)
243
            {
244
                //Console.WriteLine("세이브 실시");
245

  
246
                SaveEvent(null, null);
247
            }
248

  
249
        }
250

  
251
        private void SaveTime(bool IsRun)
252
        {
253
            if(SaveTimer == null)
254
            {
255
                SaveTimer = new System.Windows.Threading.DispatcherTimer();
256
                SaveTimer.Interval = new TimeSpan(0, 0, 5);
257
                SaveTimer.Tick += new EventHandler(SaveTimer_Tick);
258
            }
259

  
260
            if (IsRun)
261
            {
262
                SaveTimer.Start();
263
            }
264
            else
265
            {
266
                SaveTimer.Stop();
267
            }
268
        }
269

  
270
        public void SaveEvent(object sender, RoutedEventArgs e)
271
        {
272
            this.ParentOfType<MainWindow>().dzMainMenu.ReleaseAdorner();
273

  
274
            this.ParentOfType<MainWindow>().dzMainMenu.InkControl_Convert();
275

  
276
            var menu = this.ParentOfType<MainWindow>().dzMainMenu;
277

  
278
            //콘솔리 데잇일 경우 
279
            //if (ViewerDataModel.Instance.IsConsolidate && menu.gridViewMarkup.SelectedItems.Count > 1)
280
            if (ViewerDataModel.Instance.IsConsolidate)
281
            {
282
                ViewerDataModel.Instance.IsConsolidate = false;
283
                return;
284
            }
285

  
286
            //코멘트가 없을 경우
287
            //if (ViewerDataModel.Instance.MarkupControls_USER.Count == 0)
288
            //{
289
            //    foreach (var item in menu.gridViewMarkup.SelectedItems)
290
            //    {
291
            //        if ((item as IKCOM.MarkupInfoItem).UserID == App.ViewInfo.UserID)
292
            //        {
293
            //            this.ParentOfType<MainWindow>().dzMainMenu.DeleteItem((item as IKCOM.MarkupInfoItem));
294
            //            return;
295
            //        }
296
            //    }
297
            //}
298

  
299
            //코멘트가 없을 경우
300
            if (ViewerDataModel.Instance.MarkupList_USER.Count == 0)
301
            {
302
                foreach (var item in menu.gridViewMarkup.SelectedItems)
303
                {
304
                    if ((item as IKCOM.MarkupInfoItem).UserID == App.ViewInfo.UserID)
305
                    {
306
                        this.ParentOfType<MainWindow>().dzMainMenu.DeleteItem((item as IKCOM.MarkupInfoItem));
307
                        return;
308
                    }
309
                }
310
            }
311

  
312
            //코멘트가 없을 경우
313
            //if (ViewerDataModel.Instance.MarkupControls_USER.Count == 0)
314
            //if (ViewerDataModel.Instance.MarkupControls_USER.Count == 0 && menu.gridViewMarkup.SelectedItems.Count == 0)
315
            //{
316
            //    foreach (var item in menu.gridViewMarkup.SelectedItems)
317
            //    {
318
            //        if ((item as IKCOM.MarkupInfoItem).UserID == App.ViewInfo.UserID)
319
            //        {
320
            //            this.ParentOfType<MainWindow>().dzMainMenu.DeleteItem((item as IKCOM.MarkupInfoItem));
321
            //            return;
322
            //        }
323
            //    }
324
            //}
325

  
326
            menu.ChangeCommentReact();
327

  
328
            if (menu.PreviewUserMarkupInfoItem != null && menu.PreviewUserMarkupInfoItem.IsPreviewUser == true)
329
            {
330
                RefactoryCommentReact(menu);
331
            }
332
            else if(menu.gridViewMarkup.SelectedItems.Count == 0)
333
            {
334
                this.ParentOfType<MainWindow>().DialogMessage_Alert("Please Select Your Comment List Item", "Alert");
335
                return;
336
            }
337
            //else if (menu.gridViewMarkup.SelectedItems.Count == 0 || (menu.gridViewMarkup.SelectedItems.FirstOrDefault() as  IKCOM.MarkupInfoItem).UserID != App.ViewInfo.UserID)
338
            //{
339
            //    this.ParentOfType<MainWindow>().DialogMessage_Alert("Please Select Your Comment List Item", "Alert");
340
            //    return;
341
            //}
342
            //강인구 변경
343
            else
344
            {
345
                foreach (var item in menu.gridViewMarkup.SelectedItems)
346
                {
347
                    if ((item as IKCOM.MarkupInfoItem).UserID == App.ViewInfo.UserID)
348
                    {
349
                        RefactoryCommentReact(menu);
350
                        return;
351
                    }
352
                }
353
                //강인구 변경
354
                this.ParentOfType<MainWindow>().DialogMessage_Alert("Please Select Your Comment List Item", "Alert");
355
            }
356
        }
357

  
358
		public void RefactoryCommentReact(MainMenu menu)
359
        {
360
            this.ParentOfType<MainWindow>().dzMainMenu.InkControl_Convert();
361

  
362
            Save save = new Save();
363

  
364
            //강인구 추가
365
            List<IKCOM.MarkupInfoItem> MySelectItem = new List<IKCOM.MarkupInfoItem>();
366

  
367
            foreach(var item in menu.gridViewMarkup.SelectedItems)
368
            {
369
                if ((item as IKCOM.MarkupInfoItem).UserID == App.ViewInfo.UserID)
370
                {
371
                    MySelectItem.Add(item as IKCOM.MarkupInfoItem);
372
                }
373
            }
374

  
375
            //MySelectItem = (menu.gridViewMarkup.SelectedItems.FirstOrDefault() as IKCOM.MarkupInfoItem);
376

  
377

  
378
            save.Project_No = App.ViewInfo.ProjectNO;
379
            save.document_id = App.ViewInfo.DocumentItemID;
380
            save.user_id = App.ViewInfo.UserID;
381
            save.page_no = Convert.ToInt32(tlcurrentPage.Text);
382

  
383
            try
384
            {
385
                menu.ChangeCommentReact();
386
                if (menu.PreviewUserMarkupInfoItem != null) //신규 코멘트인지(MarkupInfo가 없는 경우)
387
                {
388
                    if (menu.gridViewMarkup.SelectedItems.FirstOrDefault() != null) //복수 페이지 혹은 저장한 경우
389
                    {
390
                        foreach(var item in MySelectItem)
391
                        {
392
                            save.MarkupSave(item);
393
                        }
394
                        //save.MarkupSave(menu.gridViewMarkup.SelectedItems.FirstOrDefault() as IKCOM.MarkupInfoItem);
395
                    }
396
                    else  //단일 페이지인 경우
397
                    {
398
                        //menu.ChangeCommentReact();
399
                        foreach (var item in MySelectItem)
400
                        {
401
                            save.MarkupSave(item);
402
                        }
403
                        //save.MarkupSave(menu.gridViewMarkup.SelectedItems.FirstOrDefault() as IKCOM.MarkupInfoItem);
404
                    }
405
                }
406
                else //기존 코멘트에 작업하는 경우
407
                {
408
                    if (menu.gridViewMarkup.SelectedItems.FirstOrDefault() != null)
409
                    {
410
                        foreach (var item in MySelectItem)
411
                        {
412
                            save.MarkupSave(item);
413
                        }
414
                        //save.MarkupSave(menu.gridViewMarkup.SelectedItems.FirstOrDefault() as IKCOM.MarkupInfoItem);
415
                    }
416
                }
417
                using (KCOMDataModel.DataModel.CIEntities Entity = new KCOMDataModel.DataModel.CIEntities(KCOMDataModel.Common.ConnectStringBuilder.ProjectCIConnectString(App.ViewInfo.ProjectNO).ToString()))
418
                {
419
                    KCOMDataModel.DataModel.DOCPAGE _docpage = new KCOMDataModel.DataModel.DOCPAGE();
420

  
421

  
422
                    ViewerDataModel.Instance.Document_Info.OrderBy(i => i.PAGE_NUMBER).ToList().ForEach(data =>
423
                    {
424
                        _docpage = (from info in Entity.DOCPAGE
425
                                    where info.ID == data.ID
426
                                    select info).FirstOrDefault();
427

  
428
                        if (_docpage.PAGE_ANGLE != data.PAGE_ANGLE)
429
                        {
430
                            _docpage.PAGE_ANGLE = data.PAGE_ANGLE;
431
                        }
432
                    });
433

  
434
                    Entity.SaveChanges();
435
                }
436
            }
437
            catch (Exception ex)
438
            {
439
                MessageBox.Show("세이브 실패 : " + ex.Message);
440
            }
441
        }
442

  
443
        //강인구 추가
444
        public void Print_Start(string Type)
445
        {
446

  
447
            if(ViewerDataModel.Instance.MarkupControls_USER.Count > 0 || this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
448
            {
449
                var menu = this.ParentOfType<MainWindow>().dzMainMenu;
450
                menu.ReleaseAdorner();
451
                if (menu.PreviewUserMarkupInfoItem != null && menu.PreviewUserMarkupInfoItem.IsPreviewUser == true)
452
                {
453
                    RefactoryCommentReact(menu);
454
                }
455
                else if (menu.gridViewMarkup.SelectedItems.Count == 0 || (menu.gridViewMarkup.SelectedItems.FirstOrDefault() as IKCOM.MarkupInfoItem).UserID != App.ViewInfo.UserID)
456
                {
457

  
458
                }
459
                else
460
                {
461
                    RefactoryCommentReact(menu);
462
                }
463
            }
464

  
465
            bool isprint = false;
466
            if (Type == "Print")
467
            {
468
                isprint = true;
469
            }
470

  
471
            RadWindow PrintWindow = new RadWindow();
472
            IKCOM.MarkupInfoItem _result = null;
473
            PrintWindow.Width = 850;
474
            PrintWindow.Height = 600;
475
            //PrintWindow.Width = 650;
476
            //PrintWindow.Height = 550;
477
            PrintWindow.Header = Type;
478

  
479
            List<IKCOM.MarkupInfoItem> markupinfo = new List<IKCOM.MarkupInfoItem>();
480

  
481
            using (KCOMDataModel.DataModel.CIEntities Entity = new KCOMDataModel.DataModel.CIEntities(KCOMDataModel.Common.ConnectStringBuilder.ProjectCIConnectString(App.ViewInfo.ProjectNO).ToString()))
482
            {
483
                var docinfo = from info in Entity.DOCINFO
484
                              where info.DOCUMENT_ID == App.ViewInfo.DocumentItemID
485
                              && info.PROJECT_NO == App.ViewInfo.ProjectNO
486
                              select info;
487

  
488
                var docitem = docinfo.First();
489

  
490
                foreach (KCOMDataModel.DataModel.MARKUP_INFO markinfo in docitem.MARKUP_INFO)
491
                {
492
                    var member = (from mem in Entity.MEMBER
493
                                  where mem.ID == markinfo.USER_ID
494
                                  select mem).First();
495

  
496
                    _result = new IKCOM.MarkupInfoItem
497
                    {
498
                        MarkupInfoID = markinfo.ID,
499
                        Consolidate = markinfo.CONSOLIDATE,
500
                        CreateTime = markinfo.UPDATE_TIME.HasValue ? markinfo.UPDATE_TIME.Value : markinfo.CREATE_TIME,
501
                        DisplayColor = SetColor(markinfo.ID),
502
                        UserID = markinfo.USER_ID,
503
                        UserName = member.NAME,
504
                        Depatment = member.DEPARTMENT,
505
                    };
506

  
507
                    _result.MarkupList = new List<IKCOM.MarkupItem>();
508
                    var markup_Version = markinfo.MARKUP_INFO_VERSION.OrderByDescending(p => p.CREATE_DATE).First();
509

  
510
                    foreach (KCOMDataModel.DataModel.MARKUP_DATA markdata in markup_Version.MARKUP_DATA)
511
                    {
512
                        IKCOM.MarkupItem markitem = new IKCOM.MarkupItem()
513
                        {
514
                            ID = markdata.ID,
515
                            PageNumber = markdata.PAGENUMBER,
516
                        };
517
                        _result.MarkupList.Add(markitem);
518
                    }
519

  
520
                    _result.PageCount = _result.MarkupList.GroupBy(i => i.PageNumber).Count();
521

  
522
                    markupinfo.Add(_result);
523
                }
524

  
525

  
526
                
527
                //PrintWindow.Content = new KCOM.Control.PrintControl(@"http://honeyhead.net/Pages/000000/111111/11111111/", docitem.PROJECT_NO, docitem, markupinfo, 1, docitem.DOCUMENT_ID, "VP-001-001", "http://honeyhead.net/Ensemble/000000_app/VPCS_DOCLIB/100/001/TEST_C.pdf", isprint);
528

  
529
                //강인구 추가 
530
                var Tile_Url = string.Format(@"{0}/TileSource/{1}_Tile/{2}/{3}/", 
531
                    App.SystemInfo.HostName,
532
                    App.ViewInfo.ProjectNO,
533
                    (Convert.ToInt64(App.ViewInfo.DocumentItemID) / 100).ToString(),
534
                    App.ViewInfo.DocumentItemID
535
                    );
536

  
537

  
538
                PrintWindow.Content = new KCOM.Control.PrintControl(
539
                          Tile_Url,
540
                          docitem.PROJECT_NO,
541
                          docitem, markupinfo,
542
                          this.ParentOfType<MainWindow>().dzMainMenu.pageNavigator.CurrentPage.PageNumber,
543
                          docitem.DOCUMENT_ID,
544
                          this.ParentOfType<MainWindow>().dzMainMenu._DocItem.DOCUMENT_NO,
545
                          docitem.ORIGINAL_FILE, isprint);
546

  
547
                //http://cloud.devdoftech.co.kr:5977/TileSource/000000_Tile/111111/11111111/1.jpg
548
            }
549

  
550
            //프린트 팝업 옵션
551
            //PrintWindow.BorderThickness = new Thickness(3);
552
            //PrintWindow.BorderBrush = new SolidColorBrush(Color.FromArgb(255, 37, 160, 218));
553
            PrintWindow.ResizeMode = System.Windows.ResizeMode.NoResize;
554
            PrintWindow.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
555
            PrintWindow.Background = new SolidColorBrush(Colors.Black);
556
            PrintWindow.Background.Opacity = 0.6;
557

  
558
            Telerik.Windows.Controls.StyleManager.SetTheme(PrintWindow, new Telerik.Windows.Controls.VisualStudio2013Theme());
559
            //Telerik.Windows.Controls.StyleManager.SetTheme(PrintWindow, new Telerik.Windows.Controls.Office2013Theme());
560
            PrintWindow.ShowDialog();
561
        }
562

  
563
        //강인구 추가
564
        private void PrintEvent(object sender, RoutedEventArgs e)
565
        {
566
            RadRibbonButton button = sender as RadRibbonButton;
567
            Print_Start(button.Content.ToString());
568
        }
569

  
570
        private List<AdornerMember> GetAdornerItem()
571
        {
572
            List<AdornerMember> AdonerList = new List<AdornerMember>();
573

  
574
            if (this.ParentOfType<MainWindow>() != null)
575
            {
576
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
577
                {
578
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
579
                    {
580
                        if (item.GetType().Name == "AdornerFinal")
581
                        {
582
                            foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
583
                            {
584
                                AdonerList.Add(InnerItem);
585
                            }
586
                        }
587
                    }
588
                }
589
            }
590
            return AdonerList;
591
        }
592
        /// <summary>
593
        /// 투명도
594
        /// </summary>
595
        /// <param name="sender"></param>
596
        /// <param name="e"></param>
597
        //강인구 추가(Undo End)
598
        private void sdOpacity_ValueChanged(object sender, RoutedEventArgs e)
599
        {
600
            List<AdornerMember> AdonerList = GetAdornerItem();
601
            if(AdonerList.Count > 0)
602
            {
603
                Undo_data UndoData = new Undo_data()
604
                {
605
                    IsUndo = false,
606
                    Event = Event_Type.Option,
607
                    EventTime = DateTime.Now,
608
                    Opacity = ViewerDataModel.Instance.ControlOpacity,
609
                    Markup_List = new List<Multi_Undo_data>()
610
                };
611
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
612

  
613
                foreach (AdornerMember InnerItem in AdonerList)
614
                {
615
                    InnerItem.DrawingData.Opacity = ViewerDataModel.Instance.ControlOpacity;
616
                  
617
                    multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
618
                    UndoData.Markup_List.Add(multi_Undo_Data);
619
                    multi_Undo_Data = new Multi_Undo_data();
620
                }
621

  
622
                ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
623
                {
624
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
625
                });
626
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
627
            }
628
        }
629

  
630
        //강인구 추가(Undo End)
631
        private void cbLineSize_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
632
        {
633
            List<AdornerMember> AdonerList = GetAdornerItem();
634
            if (AdonerList.Count > 0)
635
            {
636
                Undo_data UndoData = new Undo_data()
637
                {
638
                    IsUndo = false,
639
                    Event = Event_Type.Option,
640
                    EventTime = DateTime.Now,
641
                    LineSize = ViewerDataModel.Instance.LineSize,
642
                    Markup_List = new List<Multi_Undo_data>()
643
                };
644
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
645

  
646
                foreach (AdornerMember InnerItem in AdonerList)
647
                {
648
                    switch (InnerItem.DrawingData.GetType().Name)
649
                    {
650
                        case ("LineControl"):
651
                            {
652
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Line.LineControl).LineSize = ViewerDataModel.Instance.LineSize;
653
                            }
654
                            break;
655
                        case ("ArcControl"):
656
                            {
657
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Line.ArcControl).LineSize = ViewerDataModel.Instance.LineSize;
658
                            }
659
                            break;
660
                        case ("ArrowControl_Multi"):
661
                            {
662
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Line.ArrowControl_Multi).LineSize = ViewerDataModel.Instance.LineSize;
663
                            }
664
                            break;
665
                        case ("CloudControl"):
666
                            {
667
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Polygon.CloudControl).LineSize = ViewerDataModel.Instance.LineSize;
668
                            }
669
                            break;
670
                        case ("PolygonControl"):
671
                            {
672
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Polygon.PolygonControl).LineSize = ViewerDataModel.Instance.LineSize;
673
                            }
674
                            break;
675
                        case ("RectangleControl"):
676
                            {
677
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.RectangleControl).LineSize = ViewerDataModel.Instance.LineSize;
678
                            }
679
                            break;
680
                        case ("RectCloudControl"):
681
                            {
682
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.RectCloudControl).LineSize = ViewerDataModel.Instance.LineSize;
683
                            }
684
                            break;
685
                        case ("TriControl"):
686
                            {
687
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.TriControl).LineSize = ViewerDataModel.Instance.LineSize;
688
                            }
689
                            break;
690
                        case ("CircleControl"):
691
                            {
692
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.CircleControl).LineSize = ViewerDataModel.Instance.LineSize;
693
                            }
694
                            break;
695
                    }
696
                    
697

  
698
                    multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
699
                    UndoData.Markup_List.Add(multi_Undo_Data);
700
                    multi_Undo_Data = new Multi_Undo_data();
701
                }
702

  
703
                ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
704
                {
705
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
706
                });
707
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
708
            }
709
        }
710

  
711
        //강인구 추가(Undo End)
712
        private void cbDashStyle_SelectionChanged(object sender, SelectionChangedEventArgs e)
713
        {
714
            //강인구 추가
715
            if (this.ParentOfType<MainWindow>() != null)
716
            {
717
                ViewerDataModel.Instance.DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
718
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
719
                {
720
                    Undo_data UndoData = new Undo_data()
721
                    {
722
                        IsUndo = false,
723
                        Event = Event_Type.Option,
724
                        EventTime = DateTime.Now,
725
                        DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData,
726
                        Markup_List = new List<Multi_Undo_data>()
727
                    };
728
                    Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
729

  
730
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
731
                    {
732
                        if (item.GetType().Name == "AdornerFinal")
733
                        {
734
                            foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
735
                            {
736
                                switch (InnerItem.DrawingData.GetType().Name)
737
                                {
738
                                    case ("LineControl"):
739
                                        {
740
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Line.LineControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
741
                                        }
742
                                        break;
743
                                    case ("ArcControl"):
744
                                        {
745
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Line.ArcControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
746
                                        }
747
                                        break;
748
                                    case ("ArrowControl_Multi"):
749
                                        {
750
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Line.ArrowControl_Multi).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
751
                                        }
752
                                        break;
753
                                    case ("CloudControl"):
754
                                        {
755
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Polygon.CloudControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
756
                                        }
757
                                        break;
758
                                    case ("PolygonControl"):
759
                                        {
760
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Polygon.PolygonControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
761
                                        }
762
                                        break;
763
                                    case ("RectangleControl"):
764
                                        {
765
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.RectangleControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
766
                                        }
767
                                        break;
768
                                    case ("RectCloudControl"):
769
                                        {
770
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.RectCloudControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
771
                                        }
772
                                        break;
773
                                    case ("TriControl"):
774
                                        {
775
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.TriControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
776
                                        }
777
                                        break;
778
                                    case ("CircleControl"):
779
                                        {
780
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.CircleControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
781
                                        }
782
                                        break;
783
                                }
784

  
785
                                multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
786
                                UndoData.Markup_List.Add(multi_Undo_Data);
787
                                multi_Undo_Data = new Multi_Undo_data();
788
                            }
789

  
790
                            ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
791
                            {
792
                                ViewerDataModel.Instance.UndoDataList.Remove(i);
793
                            });
794
                            ViewerDataModel.Instance.UndoDataList.Add(UndoData);
795
                        }
796
                    }
797
                }
798
            }
799
        }
800

  
801
        //강인구 추가
802
        private void comboFontSize_SelectionChanged(object sender, SelectionChangedEventArgs e)
803
        {
804
            if (this.ParentOfType<MainWindow>() != null)
805
            {
806
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
807
                {
808
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
809
                    {
810
                        if (item.GetType().Name == "AdornerFinal")
811
                        {
812
                            foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
813
                            {
814
                                switch (InnerItem.DrawingData.GetType().Name)
815
                                {
816
                                    case ("TextControl"):
817
                                        {
818
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextSize = int.Parse(comboFontSize.Text);
819
                                        }
820
                                        break;
821
                                    case ("ArrowTextControl"):
822
                                        {
823
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextSize = int.Parse(comboFontSize.Text);
824
                                        }
825
                                        break;
826
                                }
827
                            }
828
                        }
829
                    }
830
                }
831
            }
832
        }
833

  
834
        //강인구 추가
835
        private void btnBold_Checked(object sender, RoutedEventArgs e)
836
        {
837
            if (this.ParentOfType<MainWindow>() != null)
838
            {
839
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
840
                {
841
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
842
                    {
843
                        if (item.GetType().Name == "AdornerFinal")
844
                        {
845
                            foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
846
                            {
847
                                switch (InnerItem.DrawingData.GetType().Name)
848
                                {
849
                                    case ("TextControl"):
850
                                        {
851
                                            if((InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextWeight == FontWeights.Heavy)
852
                                            {
853
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextWeight = FontWeights.Normal;
854
                                            }
855
                                            else
856
                                            {
857
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextWeight = FontWeights.Heavy;
858
                                            }
859

  
860
                                        }
861
                                        break;
862
                                    case ("ArrowTextControl"):
863
                                        {
864
                                            if ((InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextWeight == FontWeights.Heavy)
865
                                            {
866
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextWeight = FontWeights.Normal;
867
                                            }
868
                                            else
869
                                            {
870
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextWeight = FontWeights.Heavy;
871
                                            }
872
                                        }
873
                                        break;
874
                                }
875
                            }
876
                        }
877
                    }
878
                }
879
            }
880
        }
881

  
882
        //강인구 추가
883
        private void btnItalic_Checked(object sender, RoutedEventArgs e)
884
        {
885
            if (this.ParentOfType<MainWindow>() != null)
886
            {
887
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
888
                {
889
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
890
                    {
891
                        if (item.GetType().Name == "AdornerFinal")
892
                        {
893
                            foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
894
                            {
895
                                switch (InnerItem.DrawingData.GetType().Name)
896
                                {
897
                                    case ("TextControl"):
898
                                        {
899
                                            if((InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextStyle == FontStyles.Italic)
900
                                            {
901
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextStyle = System.Windows.FontStyles.Normal;
902
                                            }
903
                                            else
904
                                            {
905
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextStyle = FontStyles.Italic;
906
                                            }
907

  
908
                                        }
909
                                        break;
910
                                    case ("ArrowTextControl"):
911
                                        {
912
                                            if((InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextStyle == FontStyles.Italic)
913
                                            {
914
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextStyle = FontStyles.Normal;
915
                                            }
916
                                            else
917
                                            {
918
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextStyle = FontStyles.Italic;
919
                                            }
920
                                        }
921
                                        break;
922
                                }
923
                            }
924
                        }
925
                    }
926
                }
927
            }
928
        }
929

  
930
        //강인구 추가
931
        private void btnUnderLine_Checked(object sender, RoutedEventArgs e)
932
        {
933
            if (this.ParentOfType<MainWindow>() != null)
934
            {
935
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
936
                {
937
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
938
                    {
939
                        if (item.GetType().Name == "AdornerFinal")
940
                        {
941
                            foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
942
                            {
943
                                switch (InnerItem.DrawingData.GetType().Name)
944
                                {
945
                                    case ("TextControl"):
946
                                        {
947
                                            if ((InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).UnderLine == TextDecorations.Underline)
948
                                            {
949
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).UnderLine = null;
950
                                            }
951
                                            else
952
                                            {
953
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).UnderLine = TextDecorations.Underline;
954
                                            }
955
                                        }
956
                                        break;
957
                                    case ("ArrowTextControl"):
958
                                        {
959
                                            if ((InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).UnderLine == TextDecorations.Underline)
960
                                            {
961
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).UnderLine = null;
962
                                            }
963
                                            else
964
                                            {
965
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).UnderLine = TextDecorations.Underline;
966
                                            }
967
                                        }
968
                                        break;
969
                                }
970
                            }
971
                        }
972
                    }
973
                }
974
            }
975
        }
976
        
977
        //강인구 추가
978
        private void RadRibbonComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
979
        {
980
            if (this.ParentOfType<MainWindow>() != null)
981
            {
982
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
983
                {
984
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
985
                    {
986
                        if (item.GetType().Name == "AdornerFinal")
987
                        {
988
                            foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
989
                            {
990
                                switch (InnerItem.DrawingData.GetType().Name)
991
                                {
992
                                    case ("TextControl"):
993
                                        {
994
                                            //if ((InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).FontFamily == TextDecorations.Underline)
995
                                            //{
996
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).FontFamily = new FontFamily(comboFontFamily.Text);
997
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).Base_TextBlock.FontFamily = new FontFamily(comboFontFamily.Text);
998
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).Base_TextBox.FontFamily = new FontFamily(comboFontFamily.Text);
999
                                            //}
1000
                                            //else
1001
                                            //{
1002
                                            //    (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).UnderLine = TextDecorations.Underline;
1003
                                            //}
1004
                                        }
1005
                                        break;
1006
                                    case ("ArrowTextControl"):
1007
                                        {
1008
                                            //if ((InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).UnderLine == TextDecorations.Underline)
1009
                                            //{
1010
                                            //    (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).UnderLine = null;
1011
                                            //}
1012
                                            //else
1013
                                            //{
1014
                                            //    (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).UnderLine = TextDecorations.Underline;
1015
                                            //}
1016
                                        }
1017
                                        break;
1018
                                }
1019
                            }
1020
                        }
1021
                    }
1022
                }
1023
            }
1024
        }
1025

  
1026
        /// <summary>
1027
        /// 텍스트 컨트롤 하일라이트 처리
1028
        /// </summary>
1029
        /// <param name="sender"></param>
1030
        /// <param name="e"></param>
1031
        private void HighlightEvent(object sender, RoutedEventArgs e)
1032
        {
1033

  
1034
            ViewerDataModel.Instance.checkHighShape = (sender as CheckBox).IsChecked.Value;
1035
            SetHighlightEvent();
1036
            //if ((sender as CheckBox).IsChecked.Value)
1037
            //{
1038
            //    TaskMessage("HighLight가 설정되었습니다", TaskMessageType.Normal);
1039
            //}
1040
            //else
1041
            //{
1042
            //    TaskMessage("HighLight가 해제되었습니다", TaskMessageType.Caption);
1043
            //}
1044
            //if (ViewerDataModel.Instance.SelectedEditor as MarkupToPDF.Controls.Text.TextControl != null)
1045
            //{
1046
            //    MarkupToPDF.Controls.Text.TextControl instance = (ViewerDataModel.Instance.SelectedEditor as MarkupToPDF.Controls.Text.TextControl);
1047
            //    instance.IsHighLight = ViewerDataModel.Instance.checkHighShape;
1048
            //    instance.SetText();
1049
            //}
1050
        }
1051

  
1052
        //강인구 추가페이지 이동 엔터
1053
        private void tlcurrentPage_KeyDown(object sender, KeyEventArgs e)
1054
        {
1055
            //강인구 추가 tlcurrentPage을 이상하게 입력할수 있기때문에 Try Catch
1056
            if (e.Key == Key.Enter)
1057
            {
1058
                try
1059
                {
1060
                    var instanceMain = this.ParentOfType<MainWindow>();
1061
                    instanceMain.dzMainMenu.pageNavigator.GotoPage(Convert.ToInt32(tlcurrentPage.Text));
1062
                }
1063
                catch (Exception)
1064
                {
1065
                    RadWindow.Alert(new DialogParameters
1066
                    {
1067
                        Theme = new VisualStudio2013Theme(),
1068
                        Header = "안내",
1069
                        Content = "페이지 번호를 정확하게 입력해 주세요",
1070
                    });
1071
                }
1072
                
1073
            }
1074
        }
1075

  
1076
        public event EventHandler<WindowClosedEventArgs> Closed;
1077

  
1078
        //private void CheckEvent(object sender, RoutedEventArgs e)
1079
        //{
1080
        //    RadWindow CheckPop = new RadWindow();
1081
        //    test check = new test();
1082

  
1083
        //    CheckPop = new RadWindow
1084
        //    {
1085
        //        Width = 1700,
1086
        //        Height = 510,
1087
        //        Header = "My Check List",
1088
        //        Content = check,
1089
        //        Owner = this,
1090
        //        ResizeMode = System.Windows.ResizeMode.NoResize,
1091
        //        WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen,
1092
        //    };
1093
        //    StyleManager.SetTheme(CheckPop, new VisualStudio2013Theme());
1094

  
1095
        //    CheckPop.Closed += CheckPop_Closed;
1096
        //    CheckPop.ShowDialog();
1097
        //}
1098

  
1099
        private void PanoramaEvent(object sender, RoutedEventArgs e)
1100
        {
1101
            PanoramaShow();
1102
        }
1103

  
1104
        public void PanoramaShow()
1105
        {
1106
            Panorama check = new Panorama();
1107
            double screenWidth = System.Windows.SystemParameters.PrimaryScreenWidth;
1108
            double screenHeight = System.Windows.SystemParameters.PrimaryScreenHeight;
1109
            //double windowWidth = this.Width;
1110
            //double windowHeight = this.Height;
1111

  
1112
            var PanoramaPop = new RadWindow
1113
            {
1114
                //MinWidth = 600,
1115
                //MinHeight = 400,
1116
                //Header = "My Check List",
1117
                Header = "Document No : " + this.ParentOfType<MainWindow>().dzMainMenu._DocItem.DOCUMENT_NO + " / Revision :" + this.ParentOfType<MainWindow>().dzMainMenu._DocItem.REVISION,
1118
                Content = check,
1119
                Owner = this,
1120
                ResizeMode = System.Windows.ResizeMode.CanResizeWithGrip,
1121
                //ResizeMode = System.Windows.ResizeMode.NoResize,
1122
                WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen,
1123
                IsTopmost = false,
1124
                //Left = (screenWidth / 2) - (windowWidth / 2),
1125
                //Top = (screenHeight / 2) - (windowHeight / 2),
1126
                //Left = (screenWidth / 2),
1127
                //Top = (screenHeight / 2),
1128
                Width = screenWidth * 0.4,
1129
                Height = screenHeight * 0.4,
1130
            };
1131
            StyleManager.SetTheme(PanoramaPop, new VisualStudio2013Theme());
1132
            //CheckPop.ShowDialog();
1133
            PanoramaPop.Show();
1134
        }
1135
        private void CheckEvent(object sender, RoutedEventArgs e)
1136
        {
1137
            //창이 떠있을 경우 재 실행 방지
1138
            if (isClosed)
1139
            {
1140
                //토글 및 마우스 상태 초기화
1141
                var toggleList = this.Parent.ChildrenOfType<RadToggleButton>();
1142
                foreach(var togle in toggleList)
1143
                {
1144
                    togle.IsChecked = false;
1145
                }
1146
                this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
1147

  
1148
                isClosed = false;
1149

  
1150
                
1151
                CheckList check = new CheckList();
1152

  
1153
                CheckPop = new RadWindow
1154
                {
1155
                    MinWidth = 1200,
1156
                    MinHeight = 500,
1157
                    //Header = "My Check List",
1158
                    Header = "Document No : " + this.ParentOfType<MainWindow>().dzMainMenu._DocItem.DOCUMENT_NO + " / Revision :" + this.ParentOfType<MainWindow>().dzMainMenu._DocItem.REVISION,
1159
                    Content = check,
1160
                    Owner = this,
1161
                    //ResizeMode = System.Windows.ResizeMode.CanResizeWithGrip,
1162
                    ResizeMode = System.Windows.ResizeMode.NoResize,
1163
                    WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen,
1164
                    IsTopmost = true,
1165
                };
1166
                StyleManager.SetTheme(CheckPop, new Office2013Theme());
1167
                CheckPop.Closed += CheckPop_Closed;
1168
                
1169
                //CheckPop.ShowDialog();
1170
                CheckPop.Show();
1171
            }
1172
        }
1173

  
1174
        private void CheckPop_Closed(object sender, WindowClosedEventArgs e)
1175
        {
1176
            isClosed = true;
1177
            //this.ParentOfType<MainWindow>().dzMainMenu.PN_Navi.IsEnabled = true;
1178
            this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
1179
            ViewerDataModel.Instance.Capture_Opacity = 0;
1180
        }
1181

  
1182
        private void PageGoEvent(object sender, RoutedEventArgs e)
1183
        {
1184
            RadButton button = sender as RadButton;
1185
            var instanceMain = this.ParentOfType<MainWindow>();
1186
            
1187
            //강인구 추가 tlcurrentPage을 이상하게 입력할수 있기때문에 Try Catch
1188
            try
1189
            {
1190
                switch (button.CommandParameter.ToString())
1191
                {
1192
                    case "Down":
1193
                        {
1194
                            instanceMain.dzMainMenu.pageNavigator.GotoPage(Convert.ToInt32(tlcurrentPage.Text) + 1);
1195
                        }
1196
                        break;
1197
                    case "Up":
1198
                        {
1199
                            instanceMain.dzMainMenu.pageNavigator.GotoPage(Convert.ToInt32(tlcurrentPage.Text) - 1);
1200
                        }
1201
                        break;
1202
                }
1203
            }
1204
            catch (Exception)
1205
            {
1206
                RadWindow.Alert(new DialogParameters
1207
                {
1208
                    Theme = new VisualStudio2013Theme(),
1209
                    Header = "안내",
1210
                    Content = "페이지 번호를 정확하게 입력해 주세요",
1211
                });
1212
            }
1213
        }
1214

  
1215
        private void viewEvent(object sender, RoutedEventArgs e)
1216
        {
1217
            RadButton viewButton = sender as RadButton;
1218
            var instanceMain = this.ParentOfType<MainWindow>();
1219

  
1220
            Point point = new Point(instanceMain.dzMainMenu.zoomAndPanCanvas.Width / 2, instanceMain.dzMainMenu.zoomAndPanCanvas.Height / 2);
1221

  
1222
            switch (viewButton.CommandParameter.ToString())
1223
            {
1224
                case "zoomout":
1225
                    {
1226
                        //장원
1227
                        //instanceMain.dzMainMenu.zoomAndPanControl.ZoomTo(new Rect(0, 0, instanceMain.dzMainMenu.zoomAndPanCanvas.ActualWidth, instanceMain.dzMainMenu.zoomAndPanCanvas.ActualHeight));
1228

  
1229
                        instanceMain.dzMainMenu.zoomAndPanControl.ZoomPointToViewportCenter(ViewerDataModel.Instance.ContentScale -= 0.1, point);
1230
                        //Common.ViewerDataModel.Instance.zom
1231
                    }
1232
                    break;
1233
                case "zoomin":
1234
                    {
1235
                        instanceMain.dzMainMenu.zoomAndPanControl.ZoomPointToViewportCenter(ViewerDataModel.Instance.ContentScale += 0.1, point);
1236
                    }
1237
                    break;
1238
                case "fullscreen":
1239
                    {
1240
                        instanceMain.WindowState = WindowState.Maximized;
1241
                        instanceMain.dzMainMenu.imageViewer.SizeMode = Leadtools.Windows.Controls.SizeMode.Fit;
1242
                        instanceMain.dzMainMenu.zoomAndPanControl.ScaleToFit();
1243
                    }
1244
                    break;
1245
                case "fitWidth":
1246
                    {
1247
                        instanceMain.dzMainMenu.zoomAndPanControl.ScaleToFit();
1248
                    }
1249
                    break;
1250
                case "fitHeight":
1251
                    {
1252
                        instanceMain.dzMainMenu.zoomAndPanControl.ScaleToFit();
1253
                    }
1254
                    break;
1255
                case "boundzoom":
1256
                    {                       
1257

  
1258
                            bool isGO = false;
1259
                            instanceMain.dzMainMenu.imageViewer.MouseLeftButtonDown += (sen, ea) =>
1260
                            {
1261
                                isGO = true;
1262
                            };
1263
                            instanceMain.dzMainMenu.imageViewer.MouseLeftButtonUp += (sen, ea) =>
1264
                            {
1265
                                isGO = false;
1266
                            };
1267
                            instanceMain.dzMainMenu.imageViewer.SizeMode = Leadtools.Windows.Controls.SizeMode.Fit;
1268
                            instanceMain.dzMainMenu.imageViewer.InteractiveMode = Leadtools.Windows.Controls.InteractiveMode.UserRectangle;
1269
                            instanceMain.dzMainMenu.imageViewer.InteractiveUserRectangle += (sen, ea) =>
1270
                            {
1271
                                System.Diagnostics.Debug.WriteLine(ea.Bounds);
1272
                                if (ea.Status == Leadtools.Windows.Controls.InteractiveModeStatus.End)
1273
                                {
1274
                                //zoomAndPanControl.ZoomTo(ea.Bounds);
1275
                                instanceMain.dzMainMenu.zoomAndPanControl.ZoomTo(ea.Bounds);
1276
                                    instanceMain.dzMainMenu.imageViewer.SizeMode = Leadtools.Windows.Controls.SizeMode.Normal;
1277
                                    instanceMain.dzMainMenu.imageViewer.InteractiveMode = Leadtools.Windows.Controls.InteractiveMode.None;
1278
                                }
1279
                            };
1280
                            //Canvas.SetZIndex(instanceMain.dzMainMenu.imageViewer, 10);
1281
                    }
1282
                    break;
1283
                case "Rotate_M":
1284
                    {
1285
                        drawingPannelRotate(false);
1286
                        //UpdateLayout();
1287
                    }
1288
                    break;
1289
                case "Rotate_P":
1290
                    {
1291
                        drawingPannelRotate(true);
1292
                        //UpdateLayout();
1293
                    }
1294
                    break;
1295
                case "Rotate_half":
1296
                    {
1297
                        drawingPannelRotate(true);
1298
                        drawingPannelRotate(true);
1299
                        //UpdateLayout();
1300
                    }
1301
                    break;
1302
            }
1303
        }
1304

  
1305
        #region 대기
1306

  
1307
        public void drawingPannelRotate(bool Flag)
1308
        {
1309
            var instanceMain = this.ParentOfType<MainWindow>();
1310

  
1311
            //if (rotateOffSet > 3)
1312
            //    rotateOffSet = 0;
1313

  
1314
            //if (rotateOffSet < 0)
1315
            //    rotateOffSet = 3;
1316

  
1317
            if(Flag)
1318
            {
1319
                if (instanceMain.dzMainMenu.rotate.Angle == 270)
1320
                {
... 이 차이점은 표시할 수 있는 최대 줄수를 초과해서 이 차이점은 잘렸습니다.

내보내기 Unified diff

클립보드 이미지 추가 (최대 크기: 500 MB)