프로젝트

일반

사용자정보

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

markus / KCOM / Events / Implementation / TopMenuEvent.cs @ 0f065e57

이력 | 보기 | 이력해설 | 다운로드 (117 KB)

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
        public MarkupToPDF.Common.Undo_data UndoData;
26
        MarkupToPDF.Controls.Parsing.LayerControl.MarkupReturn markupReturn = new MarkupToPDF.Controls.Parsing.LayerControl.MarkupReturn();
27
        MarkupToPDF.Controls.Parsing.LayerControl layer = new MarkupToPDF.Controls.Parsing.LayerControl();
28

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

    
47
        /// <summary>
48
        /// Task Type명을 Key값으로 지정합니다
49
        /// </summary>
50
        public enum TaskMessageType
51
        {
52
            Normal,
53
            Caption,
54
            Error,
55
        }
56

    
57
        private void CheckShapeState()
58
        {
59

    
60

    
61
            if (cbHatchShape.IsChecked == true)
62
            {
63
                cbFillShape.IsChecked = false;
64
                ViewerDataModel.Instance.paintSet = MarkupToPDF.Controls.Common.PaintSet.Hatch;
65
            }
66
            else if(cbFillShape.IsChecked == true)
67
            {
68
                cbHatchShape.IsChecked = false;
69
                ViewerDataModel.Instance.paintSet = MarkupToPDF.Controls.Common.PaintSet.Fill;
70
            }
71
            else
72
            {
73
                ViewerDataModel.Instance.paintSet = MarkupToPDF.Controls.Common.PaintSet.None;
74
            }
75
        }
76

    
77
        //강인구 추가(Undo End)
78
        private void SetPaintEvent()
79
        {
80
            List<AdornerMember> AdonerList = GetAdornerItem();
81

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

    
94
                foreach (AdornerMember InnerItem in AdonerList)
95
                {
96
                    multi_Undo_Data.PointSet = new List<Point>();
97

    
98
                    if ((InnerItem.DrawingData as MarkupToPDF.Controls.Common.IShapeControl) != null)
99
                    {
100
                        (InnerItem.DrawingData as MarkupToPDF.Controls.Common.IShapeControl).Paint = ViewerDataModel.Instance.paintSet;
101
                    }
102

    
103
                    multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
104
                    UndoData.Markup_List.Add(multi_Undo_Data);
105
                    multi_Undo_Data = new Multi_Undo_data();
106
                }
107

    
108
                ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
109
                {
110
                    ViewerDataModel.Instance.UndoDataList.Remove(i);                    
111
                });
112
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
113
                
114

    
115
            }
116

    
117
        }
118

    
119
        private void SetHighlightEvent()
120
        {
121
            List<AdornerMember> AdonerList = GetAdornerItem();
122

    
123
            if (AdonerList.Count > 0)
124
            {
125
                foreach (AdornerMember InnerItem in AdonerList)
126
                {
127
                    switch (InnerItem.DrawingData.GetType().Name)
128
                    {
129
                        case ("TextControl"):
130
                            {
131
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).IsHighLight = ViewerDataModel.Instance.checkHighShape;
132
                            }
133
                            break;
134
                        case ("ArrowTextControl"):
135
                            {
136
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape;
137
                            }
138
                            break;
139
                    }
140
                }
141
            }
142

    
143
        }
144

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

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

    
173
            if (ViewerDataModel.Instance.checkFillShape)
174
            {
175
                cbHatchShape.IsChecked = false;
176
                ViewerDataModel.Instance.paintSet = MarkupToPDF.Controls.Common.PaintSet.Fill;
177
            }
178
            else
179
            {
180
                ViewerDataModel.Instance.paintSet = MarkupToPDF.Controls.Common.PaintSet.None;
181
            }
182
            SetPaintEvent();
183
        }
184

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

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

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

    
243
        void SaveTimer_Tick(object sender, EventArgs e)
244
        {
245
            //if (this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode != IKCOM.MouseHandlingMode.Drawing)
246
            if (this.ParentOfType<MainWindow>().dzMainMenu.currentControl == null && this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count == 0)
247
            {
248
                SaveEvent(null, null);
249
            }
250

    
251
        }
252

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

    
262
            if (IsRun)
263
            {
264
                SaveTimer.Start();
265
            }
266
            else
267
            {
268
                SaveTimer.Stop();
269
            }
270
        }
271
        private void SaveTime(bool IsRun,int timeinterval)
272
        {
273
            if (SaveTimer == null)
274
            {
275
                SaveTimer = new System.Windows.Threading.DispatcherTimer();
276
                SaveTimer.Interval = new TimeSpan(0, timeinterval, 0);
277
                SaveTimer.Tick += new EventHandler(SaveTimer_Tick);
278
            }
279
            else
280
            {
281
                SaveTimer.Stop();
282
                SaveTimer.Interval = new TimeSpan(0, timeinterval, 0);
283
            }
284

    
285
            if (IsRun)
286
            {
287
                SaveTimer.Start();
288
            }
289
            else
290
            {
291
                SaveTimer.Stop();
292
            }
293
        }
294
        /// <summary>
295
        /// enable busy indicator and then call _SaveEvent method.
296
        /// </summary>
297
        /// <param name="sender"></param>
298
        /// <param name="e"></param>
299
        public void SaveEvent(object sender, RoutedEventArgs e)
300
        {
301
            this.ParentOfType<MainWindow>().dzMainMenu.EmptyControlCheck();
302

    
303
            if (this.ParentOfType<MainWindow>().dzMainMenu.busyIndicator.IsBusy == true) return;
304

    
305
            this.ParentOfType<MainWindow>().dzMainMenu.busyIndicator.IsBusy = true;
306

    
307
            System.Threading.Tasks.Task SaveTask = System.Threading.Tasks.Task.Factory.StartNew(() =>
308
            {
309
                Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, new Action<object, RoutedEventArgs>(_SaveEvent), sender, e);
310
            }).ContinueWith(task =>
311
            {
312
                Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate () { this.ParentOfType<MainWindow>().dzMainMenu.busyIndicator.IsBusy = false; }));
313
            });
314
        }
315

    
316
        /// <summary>
317
        /// save document
318
        /// </summary>
319
        /// <param name="sender"></param>
320
        /// <param name="e"></param>
321
        public void _SaveEvent(object sender, RoutedEventArgs e)
322
        {
323
            try
324
            {
325
                this.ParentOfType<MainWindow>().dzMainMenu.ReleaseAdorner();
326

    
327
                this.ParentOfType<MainWindow>().dzMainMenu.InkControl_Convert();
328

    
329
                var menu = this.ParentOfType<MainWindow>().dzMainMenu;
330

    
331
                //콘솔리 데잇일 경우 
332
                //if (ViewerDataModel.Instance.IsConsolidate && menu.gridViewMarkup.SelectedItems.Count > 1)
333
                //if (ViewerDataModel.Instance.IsConsolidate)
334
                //{
335
                //    ViewerDataModel.Instance.IsConsolidate = false;
336
                //    return;
337
                //}
338

    
339
                //코멘트가 없을 경우
340
                //if (ViewerDataModel.Instance.MarkupControls_USER.Count == 0)
341
                //{
342
                //    foreach (var item in menu.gridViewMarkup.SelectedItems)
343
                //    {
344
                //        if ((item as IKCOM.MarkupInfoItem).UserID == App.ViewInfo.UserID)
345
                //        {
346
                //            this.ParentOfType<MainWindow>().dzMainMenu.DeleteItem((item as IKCOM.MarkupInfoItem));
347
                //            return;
348
                //        }
349
                //    }
350
                //}
351

    
352
                //코멘트가 없을 경우
353
                if (ViewerDataModel.Instance.MarkupList_USER.Count == 0)
354
                {
355
                    foreach (var item in menu.gridViewMarkup.SelectedItems)
356
                    {
357
                        if ((item as IKCOM.MarkupInfoItem).UserID == App.ViewInfo.UserID)
358
                        {
359
                            this.ParentOfType<MainWindow>().dzMainMenu.DeleteItem((item as IKCOM.MarkupInfoItem));
360
                            return;
361
                        }
362
                    }
363
                }
364

    
365
                if (ViewerDataModel.Instance.MarkupList_USER.Count > 0)
366
                {
367
                    foreach (var item in menu.gridViewMarkup.SelectedItems)
368
                    {
369
                        if ((item as IKCOM.MarkupInfoItem).UserID == App.ViewInfo.UserID)
370
                        {
371
                            /*
372
                            if (menu.UndoData.Markup_List[0].Markup..GetType().Name == "TextControl" && ((MarkupToPDF.Controls.Text.TextControl)(item as IKCOM.MarkupInfoItem).MarkupList[0].).OverViewText == null)
373
                            {
374
                            }
375

    
376
                            this.ParentOfType<MainWindow>().dzMainMenu.DeleteItem((item as IKCOM.MarkupInfoItem));
377
                            return;*/
378
                        }
379
                    }
380
                }
381
                
382

    
383
                    //코멘트가 없을 경우
384
                    //if (ViewerDataModel.Instance.MarkupControls_USER.Count == 0)
385
                    //if (ViewerDataModel.Instance.MarkupControls_USER.Count == 0 && menu.gridViewMarkup.SelectedItems.Count == 0)
386
                    //{
387
                    //    foreach (var item in menu.gridViewMarkup.SelectedItems)
388
                    //    {
389
                    //        if ((item as IKCOM.MarkupInfoItem).UserID == App.ViewInfo.UserID)
390
                    //        {
391
                    //            this.ParentOfType<MainWindow>().dzMainMenu.DeleteItem((item as IKCOM.MarkupInfoItem));
392
                    //            return;
393
                    //        }
394
                    //    }
395
                    //}
396

    
397
                    menu.ChangeCommentReact();
398

    
399
                if (menu.PreviewUserMarkupInfoItem != null && menu.PreviewUserMarkupInfoItem.IsPreviewUser == true)
400
                {
401
                    RefactoryCommentReact(menu);
402
                }
403
                else if (menu.gridViewMarkup.SelectedItems.Count == 0)
404
                {
405
                    this.ParentOfType<MainWindow>().DialogMessage_Alert("Please Select Your Comment List Item", "Alert");
406
                    return;
407
                }
408
                //else if (menu.gridViewMarkup.SelectedItems.Count == 0 || (menu.gridViewMarkup.SelectedItems.FirstOrDefault() as  IKCOM.MarkupInfoItem).UserID != App.ViewInfo.UserID)
409
                //{
410
                //    this.ParentOfType<MainWindow>().DialogMessage_Alert("Please Select Your Comment List Item", "Alert");
411
                //    return;
412
                //}
413
                // 변경
414
                else
415
                {
416
                    foreach (var item in menu.gridViewMarkup.SelectedItems)
417
                    {
418
                        if ((item as IKCOM.MarkupInfoItem).UserID == App.ViewInfo.UserID)
419
                        {
420
                            RefactoryCommentReact(menu);
421
                            ViewerDataModel.Instance._markupInfoList.Where(data => data.MarkupInfoID == (item as IKCOM.MarkupInfoItem).MarkupInfoID).FirstOrDefault().UpdateTime = DateTime.Now;
422

    
423
                            if (ViewerDataModel.Instance.IsConsolidate)
424
                            {
425
                                return;
426
                            }
427
                            menu.gridViewMarkup.ItemsSource = null;
428
                            menu.gridViewMarkup.ItemsSource = ViewerDataModel.Instance._markupInfoList;
429
                            menu.gridViewMarkup.SelectedItem = item;
430

    
431
                            if (sender != null)
432
                            {
433
                                if (ViewerDataModel.Instance.IsPressCtrl)
434
                                {
435
                                    ViewerDataModel.Instance.IsPressCtrl = false;
436
                                }
437
                                this.ParentOfType<MainWindow>().DialogMessage_Alert("Save 가 완료되었습니다.", "Alert");
438
                            }
439
                            return;
440
                        }
441
                    }
442
                    ////강인구 변경
443
                    //this.ParentOfType<MainWindow>().DialogMessage_Alert("Please Select Your Comment List Item", "Alert");
444
                }
445
                if (sender != null)
446
                {
447
                    if (ViewerDataModel.Instance.IsPressCtrl)
448
                    {
449
                        ViewerDataModel.Instance.IsPressCtrl = false;
450
                    }
451
                    this.ParentOfType<MainWindow>().DialogMessage_Alert("Save 가 완료되었습니다.", "Alert");
452
                }
453
            }
454
            finally
455
            {
456
            }
457
        }
458

    
459
		public void RefactoryCommentReact(MainMenu menu)
460
        {
461
            this.ParentOfType<MainWindow>().dzMainMenu.InkControl_Convert();
462

    
463
            Save save = new Save();
464

    
465
            //추가
466
            List<IKCOM.MarkupInfoItem> MySelectItem = new List<IKCOM.MarkupInfoItem>();
467

    
468
            foreach(var item in menu.gridViewMarkup.SelectedItems)
469
            {
470
                if ((item as IKCOM.MarkupInfoItem).UserID == App.ViewInfo.UserID)
471
                {
472
                    MySelectItem.Add(item as IKCOM.MarkupInfoItem);
473
                }
474
            }
475

    
476
            //MySelectItem = (menu.gridViewMarkup.SelectedItems.FirstOrDefault() as IKCOM.MarkupInfoItem);
477

    
478

    
479
            save.Project_No = App.ViewInfo.ProjectNO;
480
            save.document_id = App.ViewInfo.DocumentItemID;
481
            save.user_id = App.ViewInfo.UserID;
482
            save.page_no = Convert.ToInt32(tlcurrentPage.Text);
483

    
484
            try
485
            {
486
                menu.ChangeCommentReact();
487
                if (menu.PreviewUserMarkupInfoItem != null) //신규 코멘트인지(MarkupInfo가 없는 경우)
488
                {
489
                    if (menu.gridViewMarkup.SelectedItems.FirstOrDefault() != null) //복수 페이지 혹은 저장한 경우
490
                    {
491
                        foreach(var item in MySelectItem)
492
                        {
493
                            save.MarkupSave(item);
494
                        }
495
                        //save.MarkupSave(menu.gridViewMarkup.SelectedItems.FirstOrDefault() as IKCOM.MarkupInfoItem);
496
                    }
497
                    else  //단일 페이지인 경우
498
                    {
499
                        //menu.ChangeCommentReact();
500
                        foreach (var item in MySelectItem)
501
                        {
502
                            save.MarkupSave(item);
503
                        }
504
                        //save.MarkupSave(menu.gridViewMarkup.SelectedItems.FirstOrDefault() as IKCOM.MarkupInfoItem);
505
                    }
506
                }
507
                else //기존 코멘트에 작업하는 경우
508
                {
509
                    if (menu.gridViewMarkup.SelectedItems.FirstOrDefault() != null)
510
                    {
511
                        foreach (var item in MySelectItem)
512
                        {
513
                            save.MarkupSave(item);
514
                        }
515
                        //save.MarkupSave(menu.gridViewMarkup.SelectedItems.FirstOrDefault() as IKCOM.MarkupInfoItem);
516
                    }
517
                }
518
                save.PageAngleSave(App.ViewInfo.ProjectNO, ViewerDataModel.Instance.RotationDocs);
519

    
520
            }
521
            catch (Exception ex)
522
            {
523
                this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert("세이브 실패", "Alert");
524
            }
525
        }
526

    
527
        //강인구 추가
528
        public void Print_Start(string Type)
529
        {
530
            if (ViewerDataModel.Instance.IsPressCtrl)
531
            {
532
                ViewerDataModel.Instance.IsPressCtrl = false;
533
            }
534
            if (ViewerDataModel.Instance.MarkupControls_USER.Count > 0 || this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
535
            {
536
                var menu = this.ParentOfType<MainWindow>().dzMainMenu;
537
                menu.ReleaseAdorner();
538
                if (menu.PreviewUserMarkupInfoItem != null && menu.PreviewUserMarkupInfoItem.IsPreviewUser == true)
539
                {
540
                    RefactoryCommentReact(menu);
541
                }
542
                else if (menu.gridViewMarkup.SelectedItems.Count == 0 || (menu.gridViewMarkup.SelectedItems.FirstOrDefault() as IKCOM.MarkupInfoItem).UserID != App.ViewInfo.UserID)
543
                {
544

    
545
                }
546
                else
547
                {
548
                    RefactoryCommentReact(menu);
549
                }
550
            }
551

    
552
            bool isprint = false;
553
            if (Type == "Print")
554
            {
555
                isprint = true;
556
            }
557

    
558
            RadWindow PrintWindow = new RadWindow();
559
            IKCOM.MarkupInfoItem _result = null;
560
            PrintWindow.Width = 850;
561
            PrintWindow.Height = 600;
562
            //PrintWindow.Width = 650;
563
            //PrintWindow.Height = 550;
564
            PrintWindow.Header = Type;
565

    
566
            List<IKCOM.MarkupInfoItem> markupinfo = new List<IKCOM.MarkupInfoItem>();
567

    
568
            Logger.sendReqLog("GetPrintDocItemList: ", App.ViewInfo.ProjectNO + "," + App.ViewInfo.DocumentItemID + "," + ViewerDataModel.Instance._markupInfoList.ToList(), 1);
569
            markupinfo = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.GetPrintDocItemList(App.ViewInfo.ProjectNO, App.ViewInfo.DocumentItemID, ViewerDataModel.Instance._markupInfoList.ToList());
570

    
571
            if (markupinfo.Count() > 0)
572
            {
573
                Logger.sendResLog("GetPrintDocItemList", "TRUE", 1);
574
            }
575
            else
576
            {
577
                Logger.sendResLog("GetPrintDocItemList", "FALSE", 1);
578
            }
579

    
580
            var Tile_Url = string.Format(@"{0}/TileSource/{1}_Tile/{2}/{3}/",
581
                App.SystemInfo.HostName,
582
                App.ViewInfo.ProjectNO,
583
                (Convert.ToInt64(App.ViewInfo.DocumentItemID) / 100).ToString(),
584
                App.ViewInfo.DocumentItemID
585
                );
586

    
587
            PrintWindow.Content = new KCOM.Control.PrintControl(
588
                      Tile_Url,
589
                      App.ViewInfo.ProjectNO,
590
                      this.ParentOfType<MainWindow>().dzMainMenu._DocInfo, markupinfo,
591
                      this.ParentOfType<MainWindow>().dzMainMenu.pageNavigator.CurrentPage.PageNumber,
592
                      App.ViewInfo.DocumentItemID,
593
                      this.ParentOfType<MainWindow>().dzMainMenu._DocItem.DOCUMENT_NO,
594
                      this.ParentOfType<MainWindow>().dzMainMenu._DocItem.ORIGINAL_FILE, isprint);
595

    
596
            //프린트 팝업 옵션
597
            //PrintWindow.BorderThickness = new Thickness(3);
598
            //PrintWindow.BorderBrush = new SolidColorBrush(Color.FromArgb(255, 37, 160, 218));
599
            PrintWindow.ResizeMode = System.Windows.ResizeMode.NoResize;
600
            PrintWindow.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
601
            PrintWindow.Background = new SolidColorBrush(Colors.Black);
602
            PrintWindow.Background.Opacity = 0.6;
603

    
604
            Telerik.Windows.Controls.StyleManager.SetTheme(PrintWindow, new Telerik.Windows.Controls.VisualStudio2013Theme());
605
            PrintWindow.ShowDialog();
606
        }
607

    
608
        //강인구 추가
609
        private void PrintEvent(object sender, RoutedEventArgs e)
610
        {
611
            RadRibbonButton button = sender as RadRibbonButton;
612
            Print_Start(button.Content.ToString());
613
        }
614

    
615
        private List<AdornerMember> GetAdornerItem()
616
        {
617
            List<AdornerMember> AdonerList = new List<AdornerMember>();
618

    
619
            if (this.ParentOfType<MainWindow>() != null)
620
            {
621
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
622
                {
623
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
624
                    {
625
                        if (item.GetType().Name == "AdornerFinal")
626
                        {
627
                            foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
628
                            {
629
                                AdonerList.Add(InnerItem);
630
                            }
631
                        }
632
                    }
633
                }
634
            }
635
            return AdonerList;
636
        }
637
        /// <summary>
638
        /// 투명도
639
        /// </summary>
640
        /// <param name="sender"></param>
641
        /// <param name="e"></param>
642
        //강인구 추가(Undo End)
643
        private void sdOpacity_ValueChanged(object sender, RoutedEventArgs e)
644
        {
645
            List<AdornerMember> AdonerList = GetAdornerItem();
646
            if(AdonerList.Count > 0)
647
            {
648
                Undo_data UndoData = new Undo_data()
649
                {
650
                    IsUndo = false,
651
                    Event = Event_Type.Option,
652
                    EventTime = DateTime.Now,
653
                    Opacity = ViewerDataModel.Instance.ControlOpacity,
654
                    Markup_List = new List<Multi_Undo_data>()
655
                };
656
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
657

    
658
                foreach (AdornerMember InnerItem in AdonerList)
659
                {
660
                    InnerItem.DrawingData.Opacity = ViewerDataModel.Instance.ControlOpacity;
661
                  
662
                    multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
663
                    UndoData.Markup_List.Add(multi_Undo_Data);
664
                    multi_Undo_Data = new Multi_Undo_data();
665
                }
666

    
667
                ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
668
                {
669
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
670
                });
671
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
672
            }
673
        }
674

    
675
        //강인구 추가(Undo End)
676
        private void cbLineSize_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
677
        {
678
            if (string.IsNullOrEmpty(cbLineSize.Value.ToString()))
679
            {
680
                cbLineSize.Value = cbLineSize.Minimum;
681
            }
682
            List<AdornerMember> AdonerList = GetAdornerItem();
683
            if (AdonerList.Count > 0)
684
            {
685
                Undo_data UndoData = new Undo_data()
686
                {
687
                    IsUndo = false,
688
                    Event = Event_Type.Option,
689
                    EventTime = DateTime.Now,
690
                    LineSize = ViewerDataModel.Instance.LineSize,
691
                    Markup_List = new List<Multi_Undo_data>()
692
                };
693
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
694

    
695
                foreach (AdornerMember InnerItem in AdonerList)
696
                {
697
                    switch (InnerItem.DrawingData.GetType().Name)
698
                    {
699
                        case ("LineControl"):
700
                            {
701
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Line.LineControl).LineSize = ViewerDataModel.Instance.LineSize;
702
                            }
703
                            break;
704
                        case ("ArcControl"):
705
                            {
706
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Line.ArcControl).LineSize = ViewerDataModel.Instance.LineSize;
707
                            }
708
                            break;
709
                        case ("ArrowControl_Multi"):
710
                            {
711
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Line.ArrowControl_Multi).LineSize = ViewerDataModel.Instance.LineSize;
712
                            }
713
                            break;
714
                        case ("CloudControl"):
715
                            {
716
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Polygon.CloudControl).LineSize = ViewerDataModel.Instance.LineSize;
717
                            }
718
                            break;
719
                        case ("PolygonControl"):
720
                            {
721
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Polygon.PolygonControl).LineSize = ViewerDataModel.Instance.LineSize;
722
                            }
723
                            break;
724
                        case ("RectangleControl"):
725
                            {
726
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.RectangleControl).LineSize = ViewerDataModel.Instance.LineSize;
727
                            }
728
                            break;
729
                        case ("RectCloudControl"):
730
                            {
731
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.RectCloudControl).LineSize = ViewerDataModel.Instance.LineSize;
732
                            }
733
                            break;
734
                        case ("TriControl"):
735
                            {
736
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.TriControl).LineSize = ViewerDataModel.Instance.LineSize;
737
                            }
738
                            break;
739
                        case ("CircleControl"):
740
                            {
741
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.CircleControl).LineSize = ViewerDataModel.Instance.LineSize;
742
                            }
743
                            break;
744
                    }
745
                    
746

    
747
                    multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
748
                    UndoData.Markup_List.Add(multi_Undo_Data);
749
                    multi_Undo_Data = new Multi_Undo_data();
750
                }
751

    
752
                ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
753
                {
754
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
755
                });
756
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
757

    
758
                
759
            }
760
            KCOM.Properties.Settings.Default.LineSize = (double)cbLineSize.Value;
761
            Properties.Settings.Default.Save();
762
        }
763

    
764

    
765
        private void cbIntervalSize_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
766
        {
767
            if (string.IsNullOrEmpty(cbIntervalSize.Value.ToString()))
768
            {
769
                cbIntervalSize.Value = cbIntervalSize.Minimum;
770
            }
771
            List<AdornerMember> AdonerList = GetAdornerItem();
772
            if (AdonerList.Count > 0)
773
            {
774

    
775
                Undo_data UndoData = new Undo_data()
776
                {
777
                    IsUndo = false,
778
                    Event = Event_Type.Option,
779
                    EventTime = DateTime.Now,
780
                    Interval = ViewerDataModel.Instance.Interval,
781
                    Markup_List = new List<Multi_Undo_data>()
782
                };
783
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
784

    
785
                foreach (AdornerMember InnerItem in AdonerList)
786
                {
787
                    switch (InnerItem.DrawingData.GetType().Name)
788
                    {
789
                        case ("LineControl"):
790
                            {
791
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Line.LineControl).Interval = ViewerDataModel.Instance.Interval;
792

    
793
                                multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
794
                                UndoData.Markup_List.Add(multi_Undo_Data);
795
                                multi_Undo_Data = new Multi_Undo_data();
796
                            }
797
                            break;
798
                    }
799
                }
800

    
801
                ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
802
                {
803
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
804
                });
805
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
806
            }
807
            KCOM.Properties.Settings.Default.Interval = (double)cbIntervalSize.Value;
808
            Properties.Settings.Default.Save();
809
        }
810
        
811
        private void cbArcLength_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
812
        {
813
            if (string.IsNullOrEmpty(cbArcLength.Value.ToString()))
814
            {
815
                cbArcLength.Value = cbArcLength.Minimum;
816
            }
817
            List<AdornerMember> AdonerList = GetAdornerItem();
818
            if (AdonerList.Count > 0)
819
            {
820

    
821
                //Undo_data UndoData = new Undo_data()
822
                //{
823
                //    IsUndo = false,
824
                //    Event = Event_Type.Option,
825
                //    EventTime = DateTime.Now,
826
                //    Interval = ViewerDataModel.Instance.Interval,
827
                //    Markup_List = new List<Multi_Undo_data>()
828
                //};
829
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
830

    
831
                foreach (AdornerMember InnerItem in AdonerList)
832
                {
833
                    switch (InnerItem.DrawingData.GetType().Name)
834
                    {
835
                        case ("RectCloudControl"):
836
                            {
837
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.RectCloudControl).ArcLength = ViewerDataModel.Instance.ArcLength;
838

    
839
                                //multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
840
                                //UndoData.Markup_List.Add(multi_Undo_Data);
841
                                //multi_Undo_Data = new Multi_Undo_data();
842
                            }
843
                            break;
844
                        case ("CloudControl"):
845
                            {
846
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Polygon.CloudControl).ArcLength = ViewerDataModel.Instance.ArcLength;
847

    
848
                                //multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
849
                                //UndoData.Markup_List.Add(multi_Undo_Data);
850
                                //multi_Undo_Data = new Multi_Undo_data();
851
                            }
852
                            break;
853
                    }
854
                }
855

    
856
                //ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
857
                //{
858
                //    ViewerDataModel.Instance.UndoDataList.Remove(i);
859
                //});
860
                //ViewerDataModel.Instance.UndoDataList.Add(UndoData);
861
            }
862

    
863
            KCOM.Properties.Settings.Default.ArcLength = (double)cbArcLength.Value;
864
            Properties.Settings.Default.Save();
865
        }
866

    
867
        //강인구 추가(Undo End)
868
        private void cbDashStyle_SelectionChanged(object sender, SelectionChangedEventArgs e)
869
        {
870
            //강인구 추가
871
            if (this.ParentOfType<MainWindow>() != null)
872
            {
873
                ViewerDataModel.Instance.DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
874
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
875
                {
876
                    Undo_data UndoData = new Undo_data()
877
                    {
878
                        IsUndo = false,
879
                        Event = Event_Type.Option,
880
                        EventTime = DateTime.Now,
881
                        DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData,
882
                        Markup_List = new List<Multi_Undo_data>()
883
                    };
884
                    Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
885

    
886
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
887
                    {
888
                        if (item.GetType().Name == "AdornerFinal")
889
                        {
890
                            foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
891
                            {
892
                                switch (InnerItem.DrawingData.GetType().Name)
893
                                {
894
                                    case ("LineControl"):
895
                                        {
896
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Line.LineControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
897
                                        }
898
                                        break;
899
                                    case ("ArcControl"):
900
                                        {
901
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Line.ArcControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
902
                                        }
903
                                        break;
904
                                    case ("ArrowControl_Multi"):
905
                                        {
906
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Line.ArrowControl_Multi).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
907
                                        }
908
                                        break;
909
                                    case ("CloudControl"):
910
                                        {
911
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Polygon.CloudControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
912
                                        }
913
                                        break;
914
                                    case ("PolygonControl"):
915
                                        {
916
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Polygon.PolygonControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
917
                                        }
918
                                        break;
919
                                    case ("RectangleControl"):
920
                                        {
921
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.RectangleControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
922
                                        }
923
                                        break;
924
                                    case ("RectCloudControl"):
925
                                        {
926
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.RectCloudControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
927
                                        }
928
                                        break;
929
                                    case ("TriControl"):
930
                                        {
931
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.TriControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
932
                                        }
933
                                        break;
934
                                    case ("CircleControl"):
935
                                        {
936
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.CircleControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
937
                                        }
938
                                        break;
939
                                }
940

    
941
                                multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
942
                                UndoData.Markup_List.Add(multi_Undo_Data);
943
                                multi_Undo_Data = new Multi_Undo_data();
944
                            }
945

    
946
                            ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
947
                            {
948
                                ViewerDataModel.Instance.UndoDataList.Remove(i);
949
                            });
950
                            ViewerDataModel.Instance.UndoDataList.Add(UndoData);
951
                        }
952
                    }
953
                }
954
            }
955
        }
956

    
957
        //강인구 추가
958
        private void comboFontSize_SelectionChanged(object sender, SelectionChangedEventArgs e)
959
        {
960
            //if (this.ParentOfType<MainWindow>() != null)
961
            //{
962
            //    if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
963
            //    {
964
            //        foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
965
            //        {
966
            //            if (item.GetType().Name == "AdornerFinal")
967
            //            {
968
            //                foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
969
            //                {
970
            //                    switch (InnerItem.DrawingData.GetType().Name)
971
            //                    {
972
            //                        case ("TextControl"):
973
            //                            {
974
            //                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextSize = int.Parse(comboFontSize.Text);
975
            //                            }
976
            //                            break;
977
            //                        case ("ArrowTextControl"):
978
            //                            {
979
            //                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextSize = int.Parse(comboFontSize.Text);
980
            //                            }
981
            //                            break;
982
            //                    }
983
            //                }
984
            //            }
985
            //        }
986
            //    }
987
            //}
988
        }
989

    
990
        //강인구 추가
991
        private void btnBold_Checked(object sender, RoutedEventArgs e)
992
        {
993
            if (this.ParentOfType<MainWindow>() != null)
994
            {
995
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
996
                {
997
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
998
                    {
999
                        if (item.GetType().Name == "AdornerFinal")
1000
                        {
1001
                            foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
1002
                            {
1003
                                switch (InnerItem.DrawingData.GetType().Name)
1004
                                {
1005
                                    case ("TextControl"):
1006
                                        {
1007
                                            if((InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextWeight == FontWeights.Bold)
1008
                                            {
1009
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextWeight = FontWeights.Normal;
1010
                                            }
1011
                                            else
1012
                                            {
1013
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextWeight = FontWeights.Bold;
1014
                                            }
1015

    
1016
                                        }
1017
                                        break;
1018
                                    case ("ArrowTextControl"):
1019
                                        {
1020
                                            if ((InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextWeight == FontWeights.Bold)
1021
                                            {
1022
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextWeight = FontWeights.Normal;
1023
                                            }
1024
                                            else
1025
                                            {
1026
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextWeight = FontWeights.Bold;
1027
                                            }
1028
                                        }
1029
                                        break;
1030
                                }
1031
                            }
1032
                        }
1033
                    }
1034
                }
1035
            }
1036
        }
1037

    
1038
        //강인구 추가
1039
        private void btnItalic_Checked(object sender, RoutedEventArgs e)
1040
        {
1041
            if (this.ParentOfType<MainWindow>() != null)
1042
            {
1043
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
1044
                {
1045
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
1046
                    {
1047
                        if (item.GetType().Name == "AdornerFinal")
1048
                        {
1049
                            foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
1050
                            {
1051
                                switch (InnerItem.DrawingData.GetType().Name)
1052
                                {
1053
                                    case ("TextControl"):
1054
                                        {
1055
                                            if((InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextStyle == FontStyles.Italic)
1056
                                            {
1057
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextStyle = System.Windows.FontStyles.Normal;
1058
                                            }
1059
                                            else
1060
                                            {
1061
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextStyle = FontStyles.Italic;
1062
                                            }
1063

    
1064
                                        }
1065
                                        break;
1066
                                    case ("ArrowTextControl"):
1067
                                        {
1068
                                            if((InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextStyle == FontStyles.Italic)
1069
                                            {
1070
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextStyle = FontStyles.Normal;
1071
                                            }
1072
                                            else
1073
                                            {
1074
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextStyle = FontStyles.Italic;
1075
                                            }
1076
                                        }
1077
                                        break;
1078
                                }
1079
                            }
1080
                        }
1081
                    }
1082
                }
1083
            }
1084
        }
1085

    
1086
        //강인구 추가
1087
        private void btnUnderLine_Checked(object sender, RoutedEventArgs e)
1088
        {
1089
            if (this.ParentOfType<MainWindow>() != null)
1090
            {
1091
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
1092
                {
1093
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
1094
                    {
1095
                        if (item.GetType().Name == "AdornerFinal")
1096
                        {
1097
                            foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
1098
                            {
1099
                                switch (InnerItem.DrawingData.GetType().Name)
1100
                                {
1101
                                    case ("TextControl"):
1102
                                        {
1103
                                            if ((InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).UnderLine == TextDecorations.Underline)
1104
                                            {
1105
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).UnderLine = null;
1106
                                            }
1107
                                            else
1108
                                            {
1109
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).UnderLine = TextDecorations.Underline;
1110
                                            }
1111
                                        }
1112
                                        break;
1113
                                    case ("ArrowTextControl"):
1114
                                        {
1115
                                            if ((InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).UnderLine == TextDecorations.Underline)
1116
                                            {
1117
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).UnderLine = null;
1118
                                            }
1119
                                            else
1120
                                            {
1121
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).UnderLine = TextDecorations.Underline;
1122
                                            }
1123
                                        }
1124
                                        break;
1125
                                }
1126
                            }
1127
                        }
1128
                    }
1129
                }
1130
            }
1131
        }
1132

    
1133
        private void AxisLockEvent(object sender, RoutedEventArgs e)
1134
        {
1135
            ViewerDataModel.Instance.checkAxis = cbAxisLock.IsChecked.Value;
1136
        }
1137

    
1138
        private void comboFontSize_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
1139
        {
1140
            if (string.IsNullOrEmpty(comboFontSize.Value.ToString()))
1141
            {
1142
                comboFontSize.Value = comboFontSize.Minimum;
1143
            }
1144
            if (this.ParentOfType<MainWindow>() != null)
1145
            {
1146
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
1147
                {
1148
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
1149
                    {
1150
                        if (item.GetType().Name == "AdornerFinal")
1151
                        {
1152
                            foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
1153
                            {
1154
                                switch (InnerItem.DrawingData.GetType().Name)
1155
                                {
1156
                                    case ("TextControl"):
1157
                                        {
1158
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextSize = int.Parse(comboFontSize.Value.ToString());
1159
                                        }
1160
                                        break;
1161
                                    case ("ArrowTextControl"):
1162
                                        {
1163
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextSize = int.Parse(comboFontSize.Value.ToString());
1164
                                        }
1165
                                        break;
1166
                                }
1167
                            }
1168
                        }
1169
                    }
1170
                }
1171
            }
1172
            KCOM.Properties.Settings.Default.TextSize = (double)comboFontSize.Value;
1173
            Properties.Settings.Default.Save();
1174
        }
1175

    
1176
        //강인구 추가
1177
        private void RadRibbonComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
1178
        {
1179
            if (this.ParentOfType<MainWindow>() != null)
1180
            {
1181
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
1182
                {
1183
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
1184
                    {
1185
                        if (item.GetType().Name == "AdornerFinal")
1186
                        {
1187
                            foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
1188
                            {
1189
                                switch (InnerItem.DrawingData.GetType().Name)
1190
                                {
1191
                                    case ("TextControl"):
1192
                                        {
1193
                                            //if ((InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).FontFamily == TextDecorations.Underline)
1194
                                            //{
1195
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).FontFamily = new FontFamily(comboFontFamily.Text);
1196
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).Base_TextBlock.FontFamily = new FontFamily(comboFontFamily.Text);
1197
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).Base_TextBox.FontFamily = new FontFamily(comboFontFamily.Text);
1198
                                            //}
1199
                                            //else
1200
                                            //{
1201
                                            //    (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).UnderLine = TextDecorations.Underline;
1202
                                            //}
1203
                                        }
1204
                                        break;
1205
                                    case ("ArrowTextControl"):
1206
                                        {
1207
                                            //if ((InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).UnderLine == TextDecorations.Underline)
1208
                                            //{
1209
                                            //    (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).UnderLine = null;
1210
                                            //}
1211
                                            //else
1212
                                            //{
1213
                                            //    (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).UnderLine = TextDecorations.Underline;
1214
                                            //}
1215
                                        }
1216
                                        break;
1217
                                }
1218
                            }
1219
                        }
1220
                    }
1221
                }
1222
            }
1223
        }
1224

    
1225
        /// <summary>
1226
        /// 텍스트 컨트롤 하일라이트 처리
1227
        /// </summary>
1228
        /// <param name="sender"></param>
1229
        /// <param name="e"></param>
1230
        private void HighlightEvent(object sender, RoutedEventArgs e)
1231
        {
1232

    
1233
            ViewerDataModel.Instance.checkHighShape = (sender as CheckBox).IsChecked.Value;
1234
            SetHighlightEvent();
1235
            //if ((sender as CheckBox).IsChecked.Value)
1236
            //{
1237
            //    TaskMessage("HighLight가 설정되었습니다", TaskMessageType.Normal);
1238
            //}
1239
            //else
1240
            //{
1241
            //    TaskMessage("HighLight가 해제되었습니다", TaskMessageType.Caption);
1242
            //}
1243
            //if (ViewerDataModel.Instance.SelectedEditor as MarkupToPDF.Controls.Text.TextControl != null)
1244
            //{
1245
            //    MarkupToPDF.Controls.Text.TextControl instance = (ViewerDataModel.Instance.SelectedEditor as MarkupToPDF.Controls.Text.TextControl);
1246
            //    instance.IsHighLight = ViewerDataModel.Instance.checkHighShape;
1247
            //    instance.SetText();
1248
            //}
1249
        }
1250

    
1251
        //강인구 추가페이지 이동 엔터
1252
        private void tlcurrentPage_KeyDown(object sender, KeyEventArgs e)
1253
        {
1254
            //강인구 추가 tlcurrentPage을 이상하게 입력할수 있기때문에 Try Catch
1255
            if (e.Key == Key.Enter)
1256
            {
1257
                try
1258
                {
1259
                    var instanceMain = this.ParentOfType<MainWindow>();
1260
                    instanceMain.dzMainMenu.pageNavigator.GotoPage(Convert.ToInt32(tlcurrentPage.Text));
1261
                }
1262
                catch (Exception)
1263
                {
1264
                    RadWindow.Alert(new DialogParameters
1265
                    {
1266
                        Theme = new VisualStudio2013Theme(),
1267
                        Header = "안내",
1268
                        Content = "페이지 번호를 정확하게 입력해 주세요",
1269
                    });
1270
                }
1271
                
1272
            }
1273
        }
1274

    
1275
        public event EventHandler<WindowClosedEventArgs> Closed;
1276

    
1277
        //private void CheckEvent(object sender, RoutedEventArgs e)
1278
        //{
1279
        //    RadWindow CheckPop = new RadWindow();
1280
        //    test check = new test();
1281

    
1282
        //    CheckPop = new RadWindow
1283
        //    {
1284
        //        Width = 1700,
1285
        //        Height = 510,
1286
        //        Header = "My Check List",
1287
        //        Content = check,
1288
        //        Owner = this,
1289
        //        ResizeMode = System.Windows.ResizeMode.NoResize,
1290
        //        WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen,
1291
        //    };
1292
        //    StyleManager.SetTheme(CheckPop, new VisualStudio2013Theme());
1293

    
1294
        //    CheckPop.Closed += CheckPop_Closed;
1295
        //    CheckPop.ShowDialog();
1296
        //}
1297

    
1298
        private void PanoramaEvent(object sender, RoutedEventArgs e)
1299
        {
1300
            PanoramaShow();
1301
        }
1302

    
1303
        public void PanoramaShow()
1304
        {
1305
            Panorama check = new Panorama();
1306
            double screenWidth = System.Windows.SystemParameters.PrimaryScreenWidth;
1307
            double screenHeight = System.Windows.SystemParameters.PrimaryScreenHeight;
1308
            //double windowWidth = this.Width;
1309
            //double windowHeight = this.Height;
1310

    
1311
            var PanoramaPop = new RadWindow
1312
            {
1313
                //MinWidth = 600,
1314
                //MinHeight = 400,
1315
                //Header = "My Check List",
1316
                Header = "Document No : " + this.ParentOfType<MainWindow>().dzMainMenu._DocItem.DOCUMENT_NO + " / Revision :" + this.ParentOfType<MainWindow>().dzMainMenu._DocItem.REVISION,
1317
                Content = check,
1318
                Owner = this,
1319
                ResizeMode = System.Windows.ResizeMode.CanResizeWithGrip,
1320
                //ResizeMode = System.Windows.ResizeMode.NoResize,
1321
                WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen,
1322
                IsTopmost = false,
1323
                //Left = (screenWidth / 2) - (windowWidth / 2),
1324
                //Top = (screenHeight / 2) - (windowHeight / 2),
1325
                //Left = (screenWidth / 2),
1326
                //Top = (screenHeight / 2),
1327
                Width = screenWidth * 0.4,
1328
                Height = screenHeight * 0.4,
1329
            };
1330
            StyleManager.SetTheme(PanoramaPop, new VisualStudio2013Theme());
1331
            //CheckPop.ShowDialog();
1332
            PanoramaPop.Show();
1333
        }
1334

    
1335
        private void CheckEvent(object sender, RoutedEventArgs e)
1336
        {
1337
            //창이 떠있을 경우 재 실행 방지
1338
            if (isClosed)
1339
            {
1340
                //토글 및 마우스 상태 초기화
1341
                var toggleList = this.Parent.ChildrenOfType<RadToggleButton>();
1342
                foreach(var togle in toggleList)
1343
                {
1344
                    togle.IsChecked = false;
1345
                }
1346
                this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
1347

    
1348
                isClosed = false;
1349

    
1350
                
1351
                CheckList check = new CheckList();
1352

    
1353
                CheckPop = new RadWindow
1354
                {
1355
                    MinWidth = 1200,
1356
                    MinHeight = 500,
1357
                    //Header = "My Check List",
1358
                    Header = "Document No : " + this.ParentOfType<MainWindow>().dzMainMenu._DocItem.DOCUMENT_NO + " / Revision :" + this.ParentOfType<MainWindow>().dzMainMenu._DocItem.REVISION,
1359
                    Content = check,
1360
                    //Owner = this,
1361
                    //ResizeMode = System.Windows.ResizeMode.CanResizeWithGrip,
1362
                    ResizeMode = System.Windows.ResizeMode.NoResize,
1363
                    WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen,
1364
                    IsTopmost = true,
1365
                };
1366
                StyleManager.SetTheme(CheckPop, new Office2013Theme());
1367
                CheckPop.Closed += CheckPop_Closed;
1368
                
1369
                //CheckPop.ShowDialog();
1370
                CheckPop.Show();
1371
            }
1372
        }
1373

    
1374
        private void CheckPop_Closed(object sender, WindowClosedEventArgs e)
1375
        {
1376
            isClosed = true;
1377
            //this.ParentOfType<MainWindow>().dzMainMenu.PN_Navi.IsEnabled = true;
1378
            this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
1379
            ViewerDataModel.Instance.Capture_Opacity = 0;
1380
        }
1381

    
1382
        /// <summary>
1383
        /// 사용자가 선택한 페이지로 이동(썸네일 동기화 시킴)
1384
        /// </summary>
1385
        /// <param name="sender"></param>
1386
        /// <param name="e"></param>
1387
        private void PageGoEvent(object sender, RoutedEventArgs e)
1388
        {
1389
            RadButton button = sender as RadButton;
1390
            var instanceMain = this.ParentOfType<MainWindow>();
1391
            
1392
            //강인구 추가 tlcurrentPage을 이상하게 입력할수 있기때문에 Try Catch
1393
            try
1394
            {
1395
                switch (button.CommandParameter.ToString())
1396
                {
1397
                    case "Down":
1398
                        {
1399
                            instanceMain.dzMainMenu.pageNavigator.GotoPage(Convert.ToInt32(tlcurrentPage.Text) + 1);
1400
                        }
1401
                        break;
1402
                    case "Up":
1403
                        {
1404
                            instanceMain.dzMainMenu.pageNavigator.GotoPage(Convert.ToInt32(tlcurrentPage.Text) - 1);
1405
                        }
1406
                        break;
1407
                }
1408
            }
1409
            catch (Exception)
1410
            {
1411
                RadWindow.Alert(new DialogParameters
1412
                {
1413
                    Theme = new VisualStudio2013Theme(),
1414
                    Header = "안내",
1415
                    Content = "페이지 번호를 정확하게 입력해 주세요",
1416
                });
1417
            }
1418
        }
1419

    
1420
        private void viewEvent(object sender, RoutedEventArgs e)
1421
        {
1422
            RadRibbonToggleButton viewButton = sender as RadRibbonToggleButton;
1423
            var instanceMain = this.ParentOfType<MainWindow>();
1424

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

    
1427
            //if ((sender as RadRibbonToggleButton) != null)
1428
            //{
1429
            //    Common.ViewerDataModel.Instance.ControlTag = (sender as RadRibbonToggleButton).Tag.ToString();
1430
            //    instanceToggle = (sender as RadRibbonToggleButton);
1431
            //}
1432

    
1433
            //instanceToggle.IsChecked = false;
1434

    
1435
            switch (viewButton.CommandParameter.ToString())
1436
            {
1437
                case "zoomout":
1438
                    {
1439
                        //장원
1440
                        //instanceMain.dzMainMenu.zoomAndPanControl.ZoomTo(new Rect(0, 0, instanceMain.dzMainMenu.zoomAndPanCanvas.ActualWidth, instanceMain.dzMainMenu.zoomAndPanCanvas.ActualHeight));
1441
                        instanceMain.dzMainMenu.zoomAndPanControl.ZoomPointToViewportCenter(ViewerDataModel.Instance.ContentScale -= 0.1, point);
1442
                        viewButton.IsChecked = false;
1443
                        //Common.ViewerDataModel.Instance.zom
1444
                    }
1445
                    break;
1446
                case "zoomin":
1447
                    {
1448
                        instanceMain.dzMainMenu.zoomAndPanControl.ZoomPointToViewportCenter(ViewerDataModel.Instance.ContentScale += 0.1, point);
1449
                        viewButton.IsChecked = false;
1450
                    }
1451
                    break;
1452
                case "fullscreen":
1453
                    {
1454
                        instanceMain.WindowState = WindowState.Maximized;
1455
                        //Sizemode 대기(강인구)
1456
                        //instanceMain.dzMainMenu.imageViewer.SizeMode = Leadtools.Windows.Controls.SizeMode.Fit;
1457
                        instanceMain.dzMainMenu.zoomAndPanControl.ScaleToFit();
1458
                        viewButton.IsChecked = false;
1459
                    }
1460
                    break;
1461
                case "fitWidth":
1462
                    {
1463
                        instanceMain.dzMainMenu.zoomAndPanControl.ScaleToFit();
1464
                        viewButton.IsChecked = false;
1465
                    }
1466
                    break;
1467
                case "fitHeight":
1468
                    {
1469
                        instanceMain.dzMainMenu.zoomAndPanControl.ScaleToFit();
1470
                        viewButton.IsChecked = false;
1471
                    }
1472
                    break;
1473
                case "boundzoom":
1474
                    {
1475

    
1476
                    }
1477
                    break;
1478
                case "Rotate_M":
1479
                    {
1480
                        drawingPannelRotate(false);
1481
                        viewButton.IsChecked = false;
1482
                    }
1483
                    break;
1484
                case "Rotate_P":
1485
                    {
1486
                        drawingPannelRotate(true);
1487
                        viewButton.IsChecked = false;
1488
                    }
1489
                    break;
1490
                case "Rotate_half":
1491
                    {
1492
                        drawingPannelRotate(true);
1493
                        drawingPannelRotate(true);
1494
                        viewButton.IsChecked = false;
1495
                    }
1496
                    break;
1497
            }
1498
        }
1499

    
1500
        private void Control_Event(object sender, RoutedEventArgs e)
1501
        {
1502

    
1503
        }
1504

    
1505
        #region 대기
1506

    
1507
        public void drawingPannelRotate(bool Flag)
1508
        {
1509
            var instanceMain = this.ParentOfType<MainWindow>();
1510

    
1511
            //if (rotateOffSet > 3)
1512
            //    rotateOffSet = 0;
1513

    
1514
            //if (rotateOffSet < 0)
1515
            //    rotateOffSet = 3;
1516

    
1517
            if(Flag)
1518
            {
1519
                if (instanceMain.dzMainMenu.rotate.Angle == 270)
1520
                {
1521
                    instanceMain.dzMainMenu.rotate.Angle = 0;
1522
                }
1523
                else
1524
                {
1525
                    instanceMain.dzMainMenu.rotate.Angle += 90;
1526
                }
1527
            }
1528
            else
1529
            {
1530
                if(instanceMain.dzMainMenu.rotate.Angle == 0)
1531
                {
1532
                    instanceMain.dzMainMenu.rotate.Angle = 270;
1533
                }
1534
                else
1535
                {
1536
                    instanceMain.dzMainMenu.rotate.Angle -= 90;
1537
                }
1538
            }
1539
            //double angle = (double)rotateValue.GetValue(rotateOffSet);
1540
            //instanceMain.dzMainMenu.rotate.Angle = angle;
1541
            var rotationNum = Math.Abs((instanceMain.dzMainMenu.rotate.Angle / 90));
1542

    
1543
            if (instanceMain.dzMainMenu.zoomAndPanCanvas.Width == ViewerDataModel.Instance.ContentWidth)
1544
            {
1545
                double emptySize = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
1546
                instanceMain.dzMainMenu.zoomAndPanCanvas.Width = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
1547
                instanceMain.dzMainMenu.zoomAndPanCanvas.Height = emptySize;
1548
            }
1549
            if (instanceMain.dzMainMenu.rotate.Angle == 0)
1550
            {
1551
                instanceMain.dzMainMenu.translate.X = 0;
1552
                instanceMain.dzMainMenu.translate.Y = 0;
1553
            }
1554
            else if (instanceMain.dzMainMenu.rotate.Angle == 90)
1555
            {
1556
                instanceMain.dzMainMenu.translate.X = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
1557
                instanceMain.dzMainMenu.translate.Y = 0;
1558
            }
1559
            else if (instanceMain.dzMainMenu.rotate.Angle == 180)
1560
            {
1561
                instanceMain.dzMainMenu.translate.X = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
1562
                instanceMain.dzMainMenu.translate.Y = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
1563
            }
1564
            else
1565
            {
1566
                instanceMain.dzMainMenu.translate.X = 0;
1567
                instanceMain.dzMainMenu.translate.Y = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
1568
            }
1569

    
1570
            //instanceMain.dzMainMenu.zoomAndPanControl.RenderTransformOrigin = new Point(0.5, 0.5);
1571
            instanceMain.dzMainMenu.zoomAndPanControl.RotationAngle = instanceMain.dzMainMenu.rotate.Angle;
1572
            //대기(강인구)
1573
            //instanceMain.dzMainMenu.imageViewer.RotateAngle = instanceMain.dzMainMenu.rotate.Angle;
1574

    
1575

    
1576
            //instanceMain.dzMainMenu.imageViewer.RenderTransformOrigin = new Point(0.5, 0.5);
1577
            //RotateTransform rotateTransform = new RotateTransform(instanceMain.dzMainMenu.rotate.Angle);
1578
            //instanceMain.dzMainMenu.imageViewer.RenderTransform = rotateTransform;
1579

    
1580

    
1581
            ViewerDataModel.Instance.ContentWidth = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
1582
            ViewerDataModel.Instance.ContentHeight = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
1583
            ViewerDataModel.Instance.AngleOffsetX = instanceMain.dzMainMenu.translate.X;
1584
            ViewerDataModel.Instance.AngleOffsetY = instanceMain.dzMainMenu.translate.Y;
1585
            ViewerDataModel.Instance.Angle = instanceMain.dzMainMenu.rotate.Angle;
1586
            //ViewerDataModel.Instance.Document_Info.Clear();
1587
            //ViewerDataModel.Instance.Document_Info.Where(i => i.PAGE_NUMBER == instanceMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber).ToList().ForEach(value =>
1588
            //{
1589
            //    value.PAGE_ANGLE = int.Parse(instanceMain.dzMainMenu.rotate.Angle.ToString());
1590
            //});
1591

    
1592

    
1593
            //이미지 각도 변경 시 실시간 Thumbnail 각도 변경(강인구 추가)
1594
            instanceMain.dzMainMenu.pageNavigator._thumbnailItems.Where(info => info.PageNumber == instanceMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber).ToList().ForEach(data =>
1595
            {
1596
                data.Angle = int.Parse(instanceMain.dzMainMenu.rotate.Angle.ToString());
1597

    
1598
                instanceMain.dzMainMenu.pageNavigator.ImgListbox.ItemsSource = instanceMain.dzMainMenu.pageNavigator._thumbnailItems;
1599
                var instance = instanceMain.dzMainMenu.CurrentDoc.docInfo.DOCPAGE.Where(p => p.PAGE_NUMBER == instanceMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber).FirstOrDefault();
1600
                instance.PAGE_ANGLE = int.Parse(instanceMain.dzMainMenu.rotate.Angle.ToString());
1601

    
1602
                instanceMain.dzMainMenu.pageNavigator.setPageChange(data);
1603

    
1604
                //rotation page add or update
1605
                var rotationdoc = ViewerDataModel.Instance.RotationDocs.Where(d => d.ID == instance.ID).FirstOrDefault();
1606
                if (rotationdoc != null)
1607
                {
1608
                    rotationdoc.PAGE_ANGLE = instance.PAGE_ANGLE;
1609
                }
1610
                else
1611
                {
1612
                    ViewerDataModel.Instance.RotationDocs.Add(instance);
1613
                }
1614
            });
1615
        }
1616
        #endregion
1617

    
1618
        private void ImageConverter()
1619
        {
1620
            var instanceMain = this.ParentOfType<MainWindow>();
1621
            //http://cloud.devdoftech.co.kr:5977/ImageUpload/FileUpload.asmx
1622

    
1623

    
1624
            Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
1625
            dlg.Filter = "All files (*.*)|*.*|PNG Images (*.png)|*.png";
1626
            Nullable<bool> result = dlg.ShowDialog();
1627
            if (result == true)
1628
            {
1629
                instanceMain.dzMainMenu.filename = dlg.FileName;
1630
                instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ImgControl;
1631

    
1632
                System.IO.FileInfo fileInfo = new System.IO.FileInfo(instanceMain.dzMainMenu.filename);
1633
                String strFile = System.IO.Path.GetFileName(instanceMain.dzMainMenu.filename);
1634
                long numByte = fileInfo.Length;
1635
                double dLen = Convert.ToDouble(fileInfo.Length / 1000000);
1636
                kr.co.devdoftech.cloud.FileUpload fileUploader = new kr.co.devdoftech.cloud.FileUpload();
1637

    
1638
                if (dLen < 4)
1639
                {
1640
                    System.IO.FileStream fStream = new System.IO.FileStream(instanceMain.dzMainMenu.filename, System.IO.FileMode.Open, System.IO.FileAccess.Read);
1641
                    System.IO.BinaryReader br = new System.IO.BinaryReader(fStream);
1642
                    byte[] data = br.ReadBytes((int)numByte);
1643
                    br.Close();
1644

    
1645
                    instanceMain.dzMainMenu.filename = fileUploader.Run(App.ViewInfo.ProjectNO, instanceMain.dzMainMenu._DocItem.DOCUMENT_NO, App.ViewInfo.UserID, strFile, data);
1646
                    fStream.Close();
1647
                    fStream.Dispose();
1648
                }
1649
                else
1650
                {
1651
                    this.ParentOfType<MainWindow>().DialogMessage_Alert("Available Memory less than 4 mega byte", "Alert");
1652
                }
1653
            }
1654
        }
1655

    
1656
        private void Control_Init(RadToggleButton instanceToggle, object sender)
1657
        {
1658

    
1659
        }
1660

    
1661
        private void ControlEvent(object sender, RoutedEventArgs e)
1662
        {
1663
            RadToggleButton instanceToggle = sender as RadToggleButton;
1664
            var instanceMain = this.ParentOfType<MainWindow>();
1665

    
1666
            #region Ctrl + A 눌렀을 때 대처 방법 
1667
            //원인 : Ctrl + A를 누르면 UIElementSet에 등록을 시키지 않는다(이유는 한꺼번에 많은 양의 컨트롤의 동작이 유입되기 때문에
1668
            //       시스템의 성능저하를 불러올 수 있기 때문이다. 그래서 선택 후 다른 컨트롤을 누르면 등록되지 않은 컨트롤이기 때문에 삭제된다
1669
            //       이를 대처하는 방법으로 아래 코드를 사용한다.
1670
            if (Common.ViewerDataModel.Instance.MarkupControls.Count == 0 && Common.ViewerDataModel.Instance.MarkupControls.Count >= 1)
1671
            {
1672
                //var lstItem = instanceMain.DeepLayer._SelectLayer.ChildrenOfType<AdornerFinal>().ToList();
1673
                //foreach (var item in lstItem)
1674
                //{
1675
                //    foreach (var member in item.MemberSet)
1676
                //    {
1677
                //        if (!instanceMain.DeepLayer.UIElementSet.Contains(member.DrawingData))
1678
                //        {
1679
                //            instanceMain.DeepLayer.UIElementSet.Add(member.DrawingData);
1680
                //        }
1681
                //    }
1682
                //}
1683
            }
1684
            #endregion
1685

    
1686
            //if (!instanceMain.IsFreeSelectionMode)
1687
            //{
1688
            //    instanceMain.IsSwingMode = true;
1689
            //}
1690

    
1691
            #region 다른 컨트롤 버튼 선택 해제
1692
            System.Reactive.Linq.Observable2.FromPropertyChangedPattern(Common.ViewerDataModel.Instance, temp => temp.SelectedControl).Subscribe(ControlState =>
1693
            {
1694
                if (ControlState == null)
1695
                {
1696
                    instanceToggle.IsChecked = false;
1697
                    HiddenControlHide();
1698
                }
1699
            });
1700
            #endregion
1701

    
1702
            Release_ToggleButton(sender); //-> 해당 컨트롤을 제외한 모든 컨트롤에 대해 해제 처리
1703

    
1704
            if (instanceToggle != null)
1705
            {
1706
                Common.ViewerDataModel.Instance.ControlTag = instanceToggle.Tag.ToString();
1707
            }
1708
            else if ((sender as RadRibbonToggleButton) != null)
1709
            {
1710
                Common.ViewerDataModel.Instance.ControlTag = (sender as RadRibbonToggleButton).Tag.ToString();
1711
                instanceToggle = (sender as RadRibbonToggleButton);
1712
            }
1713
            else if ((sender as RadRibbonButton) != null)
1714
            {
1715
                RadRibbonButton instanceButton = sender as RadRibbonButton;
1716
                Common.ViewerDataModel.Instance.ControlTag = instanceButton.Tag.ToString();
1717
            }
1718
            else
1719
            {
1720
                RadButton instanceButton = sender as RadButton;
1721
                Common.ViewerDataModel.Instance.ControlTag = instanceButton.Tag.ToString();
1722
            }
1723

    
1724

    
1725

    
1726
            System.Reactive.Linq.Observable2.FromPropertyChangedPattern(Common.ViewerDataModel.Instance, temp => temp.AngleVisibility).Subscribe(isSee =>
1727
            {
1728
                instanceMain.dzMainMenu.MainAngle.Visibility = isSee;
1729
                System.Reactive.Linq.Observable2.FromPropertyChangedPattern(Common.ViewerDataModel.Instance, temp => temp.AngleValue).Subscribe(p =>
1730
                {
1731
                    instanceMain.dzMainMenu.MainAngle.AngleValue = p;
1732
                });
1733
            });
1734
            instanceMain.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Drawing;
1735

    
1736
            instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = false;
1737

    
1738
            if (instanceToggle.IsChecked != false)
1739
            {
1740
                #region 컨트롤이 체크되었다면
1741
                switch (instanceToggle.CommandParameter.ToString())
1742
                {
1743
                    #region Line
1744
                    case "Line":
1745
                        Common.ViewerDataModel.Instance.SelectedControl = "Line";
1746
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1747
                        if (instanceToggle.Tag.ToString() == "LineDelete")
1748
                        {
1749
                            //HiddenInterval.Visibility = Visibility.Visible;
1750
                        }
1751
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.SingleLine;
1752
                        break;
1753
                    #endregion
1754
                    #region ChainLine
1755
                    case "ChainLine":
1756
                        Common.ViewerDataModel.Instance.SelectedControl = "ChainLine";
1757
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1758
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ChainLine;
1759
                        break;
1760
                    #endregion
1761
                    #region DimLine
1762
                    case "DimLine":
1763
                        Common.ViewerDataModel.Instance.SelectedControl = "DimLine";
1764
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1765
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.DimLine;
1766
                        break;
1767
                    #endregion
1768
                    #region TwinLine
1769
                    case "TwinLine":
1770
                        Common.ViewerDataModel.Instance.SelectedControl = "TwinLine";
1771
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1772
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.TwinLine;
1773
                        break;
1774
                    #endregion
1775
                    #region CancelLine
1776
                    case "CancelLine":
1777
                        Common.ViewerDataModel.Instance.SelectedControl = "CancelLine";
1778
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1779
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.CancelLine;
1780
                        break;
1781
                    #endregion
1782
                    #region PolygonCloud
1783
                    case "PolygonCloud":
1784
                        Common.ViewerDataModel.Instance.SelectedControl = "PolygonCloud";
1785
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1786
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.PolygonCloud;
1787
                        break;
1788
                    #endregion
1789
                    #region RectCloud
1790
                    case "RectCloud":
1791
                        Common.ViewerDataModel.Instance.SelectedControl = "RectCloud";
1792
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1793
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.RectCloud;
1794
                        break;
1795
                    #endregion
1796
                    #region Rectangle
1797
                    case "Rectangle":
1798
                        Common.ViewerDataModel.Instance.SelectedControl = "Rectangle";
1799
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1800
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Rectangle;
1801
                        break;
1802
                    #endregion
1803
                    #region Triangle
1804
                    case "Triangle":
1805
                        Common.ViewerDataModel.Instance.SelectedControl = "Triangle";
1806
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1807
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Triangle;
1808
                        break;
1809
                    #endregion
1810
                    #region RectCloud
1811
                    case "Circle":
1812
                        Common.ViewerDataModel.Instance.SelectedControl = "Circle";
1813
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1814
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Circle;
1815
                        break;
1816
                    #endregion
1817
                    #region Symbol
1818
                    case "Symbol":
1819
                        Common.ViewerDataModel.Instance.SelectedControl = "Symbol";
1820
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
1821
                        break;
1822
                    #endregion
1823
                    #region SymbolN
1824
                    case "SymbolN":
1825
                        Common.ViewerDataModel.Instance.SelectedControl = "SymbolN";
1826
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Stamp;
1827
                        break;
1828
                    #endregion
1829
                    #region Text
1830
                    case "Text":
1831
                        Common.ViewerDataModel.Instance.SelectedControl = "Text";
1832
                        TaskMessage("Text 도구는 텍스트 영역을 더블 클릭하여 텍스트를 재 편집 할 수 있습니다", TaskMessageType.Normal);
1833
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.TextControl;
1834
                        break;
1835
                    #endregion
1836
                    #region TextBorder
1837
                    case "TextBorder":
1838
                        Common.ViewerDataModel.Instance.SelectedControl = "TextBorder";
1839
                        TaskMessage("Text 도구는 텍스트 영역을 더블 클릭하여 텍스트를 재 편집 할 수 있습니다", TaskMessageType.Normal);
1840
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.TextBorder;
1841
                        break;
1842
                    #endregion
1843
                    #region TextCloud
1844
                    case "TextCloud":
1845
                        Common.ViewerDataModel.Instance.SelectedControl = "TextCloud";
1846
                        TaskMessage("Text 도구는 텍스트 영역을 더블 클릭하여 텍스트를 재 편집 할 수 있습니다", TaskMessageType.Normal);
1847
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.TextCloud;
1848
                        break;
1849
                    #endregion
1850
                    #region Date
1851
                    case "Date":
1852
                        Common.ViewerDataModel.Instance.SelectedControl = "Date";
1853
                        TaskMessage("날짜 컨트롤을 더블 클릭하면 날짜를 변경할 수 있습니다", TaskMessageType.Normal);
1854
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Date;
1855
                        break;
1856
                    #endregion
1857
                    #region ArrowText
1858
                    case "ArrowText":
1859
                        TaskMessage("ArrowText 컨트롤은 그린 후 컨트롤을 선택하였을 시 중간점을 조정할 수 있습니다", TaskMessageType.Normal);
1860
                        if (instanceToggle.Tag.ToString() == "ArrowText_Cloud")
1861
                        {
1862
                            Common.ViewerDataModel.Instance.SelectedControl = "ArrowText_Cloud";
1863
                            instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowTextCloudControl;
1864
                        }
1865
                        else if (instanceToggle.Tag.ToString() == "ArrowText_Border")
1866
                        {
1867
                            Common.ViewerDataModel.Instance.SelectedControl = "ArrowTextBorderControl";
1868
                            instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowTextBorderControl;
1869
                        }
1870
                        else if (instanceToggle.Tag.ToString() == "ArrowTextFix_Normal")
1871
                        {
1872
                            Common.ViewerDataModel.Instance.SelectedControl = "ArrowTransTextControl";
1873
                            instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowTransTextControl;
1874
                        }
1875
                        else if (instanceToggle.Tag.ToString() == "ArrowTextFix_Border")
1876
                        {
1877
                            Common.ViewerDataModel.Instance.SelectedControl = "ArrowTransTextBorderControl";
1878
                            instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowTransTextBorderControl;
1879
                        }
1880
                        else if (instanceToggle.Tag.ToString() == "ArrowTextFix_Cloud")
1881
                        {
1882
                            Common.ViewerDataModel.Instance.SelectedControl = "ArrowTransTextCloudControl";
1883
                            instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowTransTextCloudControl;
1884
                        }
1885
                        else
1886
                        {
1887
                            Common.ViewerDataModel.Instance.SelectedControl = "ArrowText";
1888
                            instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowTextControl;
1889
                            //HiddenAxisLock.Visibility = Visibility.Visible;
1890
                        }
1891
                        break;
1892
                    #endregion
1893
                    #region Arrow
1894
                    case "Arrow":
1895
                        Common.ViewerDataModel.Instance.SelectedControl = "Arrow";
1896
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1897
                        //HiddenDimSize.Visibility = Visibility.Visible;
1898
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowLine;
1899
                        break;
1900
                    #endregion
1901
                    #region Shape
1902
                    case "Shape":
1903
                        Common.ViewerDataModel.Instance.SelectedControl = "Shape";
1904
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Mark;
1905
                        break;
1906
                    #endregion
1907
                    #region Polygon
1908
                    case "Polygon":
1909
                        Common.ViewerDataModel.Instance.SelectedControl = "Polygon";
1910
                        TaskMessage("자유형 코멘트 도구는 오른쪽 마우스 클릭을 통해 그리기를 마칠 수 있습니다", TaskMessageType.Normal);
1911
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1912
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.PolygonControl;
1913
                        break;
1914
                    #endregion
1915
                    #region Arc
1916
                    case "Arc":
1917
                        Common.ViewerDataModel.Instance.SelectedControl = "Arc";
1918
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArcLine;
1919
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1920
                        TaskMessage("Arc 코멘트 도구는 오른쪽 마우스를 사용해 좌우 반전을 사용하실 수 있습니다", TaskMessageType.Normal);
1921
                        break;
1922
                    #endregion
1923
                    #region ArrowMulti
1924
                    case "ArrowMulti":
1925
                        Common.ViewerDataModel.Instance.SelectedControl = "ArrowMulti";
1926
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowMultiLine;
1927
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1928
                        break;
1929
                    #endregion
1930
                    #region Etc
1931
                    case "Etc":
1932
                        Common.ViewerDataModel.Instance.SelectedControl = "Etc";
1933
                        break;
1934
                    #endregion
1935
                    #region Ink
1936
                    case "Ink":
1937
                        if (instanceToggle.Tag.ToString() == "EraserClear")
1938
                        {
1939
                            TaskMessage("해당 컨트롤은 점 단위로 그려진 펜을 지웁니다", TaskMessageType.Normal);
1940
                            //instanceMain.dzMainMenu.inkDrawingCanvas.EditingMode = InkCanvasEditingMode.EraseByPoint;
1941
                            instanceMain.dzMainMenu.inkBoard.Tag = "EraseByPoint";
1942
                        }
1943
                        else if (instanceToggle.Tag.ToString() == "Eraser")
1944
                        {
1945
                            TaskMessage("해당 컨트롤은 선 단위로 그려진 펜을 지웁니다", TaskMessageType.Normal);
1946
                            instanceMain.dzMainMenu.inkBoard.Tag = "EraseByStroke";
1947
                            //instanceMain.dzMainMenu.inkDrawingCanvas.EditingMode = InkCanvasEditingMode.EraseByStroke;
1948
                        }
1949
                        else
1950
                        {
1951
                            instanceMain.dzMainMenu.inkBoard.Tag = "Ink";
1952
                            //instanceMain.dzMainMenu.inkDrawingCanvas.EditingMode = InkCanvasEditingMode.Ink;
1953
                        }
1954

    
1955
                        //instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = true;
1956

    
1957
                        Common.ViewerDataModel.Instance.SelectedControl = "Ink";
1958
                        Common.ViewerDataModel.Instance.LineSize = (double)cbLineSize.Value;
1959
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.PenControl;
1960
                        break;
1961
                    #endregion
1962
                    #region Select
1963
                    case "Select":
1964
                        if(this.ParentOfType<MainWindow>().dzMainMenu.currentControl != null)
1965
                        {
1966
                            ViewerDataModel.Instance.MarkupControls_USER.Remove(this.ParentOfType<MainWindow>().dzMainMenu.currentControl);
1967
                            this.ParentOfType<MainWindow>().dzMainMenu.currentControl = null;
1968
                        }
1969
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Selecting;
1970
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
1971
                        instanceMain.dzMainMenu.isLeftMouseButtonDownOnWindow = false;
1972
                        break;
1973
                    #endregion
1974
                    #region Image
1975
                    case "Image":
1976
                        Common.ViewerDataModel.Instance.SelectedControl = "ImgControl";
1977
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ImgControl;
1978
                        ImageConverter();
1979
                        break;
1980
                    #endregion
1981
                    #region Sign
1982
                    case "Sign":
1983
                        Common.ViewerDataModel.Instance.SelectedControl = "Sign";
1984
                        Common.ViewerDataModel.Instance.ControlTag = instanceMain.dzMainMenu._ViewInfo.UserID; //사번
1985
                        //강인구 추가
1986
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Sign;
1987
                        //instanceMain.BaseClient.GetUserSignCompleted += (sen, ea) =>
1988
                        //{
1989
                        //    if (ea.Result == null)
1990
                        //    {
1991

    
1992
                        //        this.ParentOfType<MainPage>().DialogMessage_Alert("You Don't Have Sign Data", "Alert");
1993
                        //    }
1994
                        //    else
1995
                        //    {
1996
                        //        byte[] imageBytes = System.Convert.FromBase64String(ea.Result);
1997
                        //        using (MemoryStream ms = new MemoryStream(imageBytes))
1998
                        //        {
1999
                        //            BitmapImage im = new BitmapImage();
2000
                        //            im.SetSource(ms);
2001
                        //            instanceMain.DeepLayer.SignImage = im;
2002
                        //            ms.Close();
2003
                        //        }
2004
                        //    }
2005
                        //};
2006
                        //instanceMain.BaseClient.GetUserSignAsync(instanceMain._ViewInfo.UserID);
2007
                        break;
2008
                    #endregion
2009
                    #region Check
2010
                    case "Check":
2011
                        Common.ViewerDataModel.Instance.SelectedControl = "Check";
2012
                        Common.ViewerDataModel.Instance.ControlTag = instanceMain.dzMainMenu._ViewInfo.UserID; //사번
2013
                        //강인구 추가
2014
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Symbol;
2015
                        break;
2016
                    #endregion
2017
                    #region Batch
2018
                    case "Batch":
2019
                        Common.ViewerDataModel.Instance.SelectedControl = "Batch";
2020
                        Common.ViewerDataModel.Instance.ControlTag = instanceMain.dzMainMenu._ViewInfo.UserID; //사번
2021
                        //강인구 추가
2022
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Mark;
2023
                        instanceMain.dzMainMenu.txtBatch.Visibility = Visibility.Visible;
2024
                        instanceMain.dzMainMenu.txtBatch.Text = "Place Mark";
2025
                        break;
2026
                    #endregion
2027
                    #region Copy
2028
                    case "Copy":
2029
                        Copy_Start();
2030
                        instanceToggle.IsChecked = false;
2031
                        ViewerDataModel.Instance.SelectedControl = "";
2032
                        ViewerDataModel.Instance.ControlTag = null;
2033
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2034
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2035
                        break;
2036
                    #endregion
2037
                    #region Cut
2038
                    case "Cut":
2039
                        Cut_Start();
2040
                        instanceToggle.IsChecked = false;
2041
                        ViewerDataModel.Instance.SelectedControl = "";
2042
                        ViewerDataModel.Instance.ControlTag = null;
2043
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2044
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2045
                        break;
2046
                    #endregion
2047
                    #region Paste
2048
                    case "Paste":
2049
                        Paste_Start();
2050
                        instanceToggle.IsChecked = false;
2051
                        ViewerDataModel.Instance.SelectedControl = "";
2052
                        ViewerDataModel.Instance.ControlTag = null;
2053
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2054
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;                        
2055
                        break;
2056
                    #endregion
2057
                    #region Delete
2058
                    case "Delete":
2059
                        Delete_Start();
2060
                        instanceToggle.IsChecked = false;
2061
                        ViewerDataModel.Instance.SelectedControl = "";
2062
                        ViewerDataModel.Instance.ControlTag = null;
2063
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2064
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2065
                        break;
2066
                    #endregion
2067
                    #region Undo
2068
                    case "Undo":
2069
                        this.ParentOfType<MainWindow>().dzMainMenu.Undo();
2070
                        instanceToggle.IsChecked = false;
2071
                        ViewerDataModel.Instance.SelectedControl = "";
2072
                        ViewerDataModel.Instance.ControlTag = null;
2073
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2074
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2075
                        break;
2076
                    #endregion
2077
                    #region Redo
2078
                    case "Redo":
2079
                        this.ParentOfType<MainWindow>().dzMainMenu.Redo();
2080
                        instanceToggle.IsChecked = false;
2081
                        ViewerDataModel.Instance.SelectedControl = "";
2082
                        ViewerDataModel.Instance.ControlTag = null;
2083
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2084
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2085
                        break;
2086
                    #endregion
2087
                    #region DragZoom
2088
                    case "DragZoom":
2089
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.DragZoom;
2090
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2091
                        instanceMain.dzMainMenu.isLeftMouseButtonDownOnWindow = false;
2092
                        break;
2093
                    #endregion
2094

    
2095
                    default:
2096
                        break;
2097
                }
2098
                #endregion
2099
            }
2100
            else
2101
            {
2102

    
2103
                if (!instanceMain.dzMainMenu.IsFreeSelectionMode)
2104
                {
2105
                    instanceMain.dzMainMenu.IsSwingMode = false;
2106
                    Common.ViewerDataModel.Instance.SelectedControl = "";
2107
                    Common.ViewerDataModel.Instance.ControlTag = null;
2108
                    this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2109
                    this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2110
                }
2111
            }
2112
        }
2113

    
2114
        private void cbAutoSave_Checked(object sender, RoutedEventArgs e)
2115
        {            
2116
            if (cbAutoSave.IsChecked == true)
2117
            {
2118
                SaveTime(true, (int)cbSaveInterval.Value);
2119
            }
2120
            else
2121
            {
2122
                SaveTime(false, (int)cbSaveInterval.Value);
2123
            }
2124
        }
2125
        private void cbSaveInterval_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
2126
        {
2127
            if(string.IsNullOrEmpty(cbSaveInterval.Value.ToString()))
2128
            {
2129
                cbSaveInterval.Value = cbSaveInterval.Minimum;
2130
            }
2131
            if (cbAutoSave.IsChecked == true)
2132
            {
2133
                SaveTime(true, (int)cbSaveInterval.Value);
2134
            }
2135

    
2136
            KCOM.Properties.Settings.Default.SaveInterval = (double)cbSaveInterval.Value;
2137
            Properties.Settings.Default.Save();
2138
        }
2139
        //강인구 자동 저장 추가
2140
        private void AutoSave(object sender, RoutedEventArgs e)
2141
        {
2142
            RadToggleButton instanceToggle = sender as RadToggleButton;
2143

    
2144
            if(instanceToggle.IsChecked == true)
2145
            {
2146
                SaveTime(true);
2147
            }
2148
            else
2149
            {
2150
                SaveTime(false);
2151
            }
2152
        }
2153

    
2154
        public void Copy_Start()
2155
        {
2156
            if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
2157
            {
2158
                string MarkupData = "";
2159

    
2160
                foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
2161
                {
2162
                    if (item.GetType().Name == "AdornerFinal")
2163
                    {
2164
                        foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
2165

    
2166
                        {
2167
                            if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
2168
                            {
2169
                                markupReturn = layer.MarkupToString(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo, App.ViewInfo.UserID);
2170
                                MarkupData += "|OR|" + markupReturn.ConvertData;
2171
                            }
2172
                        }
2173
                        Clipboard.SetText(MarkupData);
2174
                    }
2175
                }
2176
            }
2177
        }
2178

    
2179
        public void Cut_Start()
2180
        {
2181
            if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
2182
            {
2183
                foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
2184
                {
2185
                    string MarkupData = "";
2186

    
2187
                    if (item.GetType().Name == "AdornerFinal")
2188
                    {
2189
                        foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
2190
                        {
2191
                            if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
2192
                            {
2193
                                markupReturn = layer.MarkupToString(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo, App.ViewInfo.UserID);
2194
                                MarkupData += "|OR|" + markupReturn.ConvertData;
2195
                            }
2196
                        }
2197
                        //클립보드에 넣음
2198
                        Clipboard.SetText(MarkupData);
2199
                    }
2200
                }
2201
                this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Clear();
2202
            }
2203
        }
2204

    
2205
        public void Paste_Start()
2206
        {
2207
            //마크업 붙여넣기
2208
            //if (Clipboard.GetText().Contains("|DZ|"))
2209
            if (Clipboard.GetText().Contains("|OR||DZ|"))
2210
            {
2211
                List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>();
2212

    
2213
                string[] delimiterChars = { "|OR|" };
2214
                string[] data = Clipboard.GetText().Split(delimiterChars, StringSplitOptions.RemoveEmptyEntries);
2215

    
2216
                this.ParentOfType<MainWindow>().dzMainMenu.ReleaseAdorner();
2217

    
2218
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
2219

    
2220
                //강인구 Undo/Redo 보류
2221
                UndoData = new Undo_data()
2222
                {
2223
                    IsUndo = false,
2224
                    Event = Event_Type.Create,
2225
                    EventTime = DateTime.Now,
2226
                    Markup_List = new List<Multi_Undo_data>()
2227
                };
2228

    
2229
                ViewerDataModel.Instance.UndoDataList.Where(data1 => data1.IsUndo == true).ToList().ForEach(i =>
2230
                {
2231
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
2232
                });
2233

    
2234
                foreach (string parse in data)
2235
                {
2236
                    if (parse != "")
2237
                    {
2238
                        System.Windows.Controls.Control item = layer.markupParse_Paste(parse, ViewerDataModel.Instance.MarkupControls_USER);
2239
                        (item as MarkupToPDF.Common.CommentUserInfo).CommentID = Events.Save.shortGuid();
2240

    
2241
                        ViewerDataModel.Instance.MarkupControls.Remove(item as MarkupToPDF.Common.CommentUserInfo);
2242
                        ViewerDataModel.Instance.MarkupControls_USER.Remove(item as MarkupToPDF.Common.CommentUserInfo);
2243

    
2244
                        adornerSet.Add(item as MarkupToPDF.Common.CommentUserInfo);
2245

    
2246
                        //Controls.AdornerFinal final = new Controls.AdornerFinal(item as MarkupToPDF.Common.CommentUserInfo);
2247
                        //this.dzMainMenu.SelectLayer.Children.Add(final);
2248

    
2249
                        multi_Undo_Data = this.ParentOfType<MainWindow>().dzMainMenu.Control_Style(item as MarkupToPDF.Common.CommentUserInfo);
2250

    
2251
                        UndoData.Markup_List.Add(multi_Undo_Data);
2252
                        ViewerDataModel.Instance.UndoDataList.Add(UndoData);                        
2253
                    }
2254
                }
2255
                Controls.AdornerFinal final = new Controls.AdornerFinal(adornerSet);
2256

    
2257
                if(this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.X < 0)
2258
                {
2259
                    Canvas.SetLeft(final, 0);
2260
                    Canvas.SetTop(final, 0);
2261
                }
2262
                else
2263
                {
2264
                    double realPointX = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.X - final.BorderSize.X - (final.BorderSize.Width / 2);
2265
                    double realPointY = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.Y - final.BorderSize.Y - (final.BorderSize.Height / 2);
2266
                    final.MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(realPointX, realPointY));
2267

    
2268
                    if (final.MemberSet.Where(type => type.Drawingtype == MarkupToPDF.Controls.Common.ControlType.TextControl).FirstOrDefault() != null)
2269
                    {
2270
                        final.MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(0.001, 0.001)); //dummy
2271
                    }
2272

    
2273
                }
2274
                
2275

    
2276
                this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Add(final);
2277

    
2278
                //붙여 넣을때 원본 컨트롤과 겹치지 않도록 설정
2279
                //Canvas.SetLeft(final, 50);
2280
                //Canvas.SetTop(final, 50);
2281
            }
2282
            //외부 이미지 붙여넣기
2283
            else if (Clipboard.GetImage() != null)
2284
            {
2285
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
2286

    
2287
                //강인구 Undo/Redo 보류
2288
                UndoData = new Undo_data()
2289
                {
2290
                    IsUndo = false,
2291
                    Event = Event_Type.Create,
2292
                    EventTime = DateTime.Now,
2293
                    Markup_List = new List<Multi_Undo_data>()
2294
                };
2295

    
2296

    
2297
                string temppath = System.IO.Path.GetTempPath();
2298
                //string filename = KCOM.Events.Save.shortCommentKey();
2299
                string filename = KCOM.Events.Save.shortFileKey();
2300

    
2301
                System.Drawing.Image clipboardImage = System.Windows.Forms.Clipboard.GetImage();
2302
                clipboardImage.Save(temppath + "\\" + filename);
2303

    
2304
                System.IO.FileInfo fileInfo = new System.IO.FileInfo(temppath + "\\" + filename);
2305
                String strFile = System.IO.Path.GetFileName(fileInfo.FullName);
2306
                long numByte = fileInfo.Length;
2307
                double dLen = Convert.ToDouble(fileInfo.Length / 1000000);
2308
                kr.co.devdoftech.cloud.FileUpload fileUploader = new kr.co.devdoftech.cloud.FileUpload();
2309

    
2310
                if (dLen < 4)
2311
                {
2312
                    System.IO.FileStream fStream = new System.IO.FileStream(fileInfo.FullName,
2313
                    System.IO.FileMode.Open, System.IO.FileAccess.Read);
2314
                    System.IO.BinaryReader br = new System.IO.BinaryReader(fStream);
2315
                    byte[] data = br.ReadBytes((int)numByte);
2316

    
2317
                    filename = fileUploader.Run(App.ViewInfo.ProjectNO, this.ParentOfType<MainWindow>().dzMainMenu._DocItem.DOCUMENT_NO, App.ViewInfo.UserID, strFile + ".png", data);
2318
                    br.Close();
2319
                    fStream.Close();
2320
                    fStream.Dispose();
2321
                }
2322
                else
2323
                {
2324
                    this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert("Available Memory less than 4 mega byte", "Alert");
2325
                    return;
2326
                }
2327

    
2328
                fileInfo.Delete();
2329

    
2330
                //System.Drawing.Image clipboardImage = System.Windows.Forms.Clipboard.GetImage();
2331
                System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(clipboardImage);
2332
                IntPtr hBitmap = bmp.GetHbitmap();
2333
                System.Windows.Media.ImageSource WpfBitmap = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(hBitmap, IntPtr.Zero, Int32Rect.Empty, System.Windows.Media.Imaging.BitmapSizeOptions.FromEmptyOptions());
2334
                Image img = new Image();
2335
                img.Source = new System.Windows.Media.Imaging.BitmapImage(new Uri(filename));
2336

    
2337

    
2338

    
2339

    
2340

    
2341
                var currentControl = new MarkupToPDF.Controls.Etc.ImgControl
2342
                {
2343
                    PointSet = new List<Point>(),
2344
                    FilePath = img.Source.ToString(),
2345
                    ImageData = img.Source,
2346
                    StartPoint = new Point(100, 100),
2347
                    EndPoint = new Point(200, 200),
2348
                    TopRightPoint = new Point(100, 200),
2349
                    LeftBottomPoint = new Point(200, 100)
2350
                };
2351

    
2352
                currentControl.TopRightPoint = new Point(currentControl.StartPoint.X + clipboardImage.Width, currentControl.StartPoint.Y);
2353
                currentControl.LeftBottomPoint = new Point(currentControl.StartPoint.X, currentControl.StartPoint.Y + clipboardImage.Height);
2354
                currentControl.EndPoint = new Point(currentControl.StartPoint.X + clipboardImage.Width, currentControl.StartPoint.Y + clipboardImage.Height);
2355

    
2356
                currentControl.PointSet = new List<Point>
2357
                                        {
2358
                                            currentControl.StartPoint,
2359
                                            currentControl.LeftBottomPoint,
2360
                                            currentControl.EndPoint,
2361
                                            currentControl.TopRightPoint,
2362
                                        };
2363

    
2364
                multi_Undo_Data = this.ParentOfType<MainWindow>().dzMainMenu.Control_Style(currentControl as MarkupToPDF.Common.CommentUserInfo);
2365
                UndoData.Markup_List.Add(multi_Undo_Data);
2366
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
2367

    
2368
                ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl as MarkupToPDF.Common.CommentUserInfo);
2369
                currentControl.CommentID = Events.Save.shortGuid();
2370

    
2371
                currentControl.ApplyTemplate();
2372
                currentControl.SetImage();
2373

    
2374
                ViewerDataModel.Instance.MarkupControls_USER.Remove(currentControl as MarkupToPDF.Common.CommentUserInfo);
2375
                Controls.AdornerFinal final = new Controls.AdornerFinal(currentControl as MarkupToPDF.Common.CommentUserInfo);
2376
                this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Add(final);
2377

    
2378
                double realPointX = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.X - final.BorderSize.X - (final.BorderSize.Width / 2);
2379
                double realPointY = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.Y - final.BorderSize.Y - (final.BorderSize.Height / 2);
2380
                final.MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(realPointX, realPointY));
2381

    
2382
            }
2383
        }
2384

    
2385
        public void Delete_Start()
2386
        {
2387
            if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
2388
            {
2389
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
2390

    
2391
                UndoData = new Undo_data()
2392
                {
2393
                    IsUndo = false,
2394
                    Event = Event_Type.Delete,
2395
                    EventTime = DateTime.Now,
2396
                    Markup_List = new List<Multi_Undo_data>()
2397
                };
2398

    
2399
                foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
2400
                {
2401
                    if (item.GetType().Name == "AdornerFinal")
2402
                    {
2403
                        (item as Controls.AdornerFinal).unRegister();
2404

    
2405
                        foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
2406
                        {
2407
                            //if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
2408
                            if (!ViewerDataModel.Instance.MarkupControls_USER.Contains(InnerItem.DrawingData))
2409
                            {
2410

    
2411
                                multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
2412
                                UndoData.Markup_List.Add(multi_Undo_Data);
2413
                                multi_Undo_Data = new Multi_Undo_data();
2414

    
2415
                                ViewerDataModel.Instance.MarkupControls.Remove(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo);
2416

    
2417
                                var Item_ = ViewerDataModel.Instance.MarkupList_USER.Where(d => d.ID == (InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo).CommentID).FirstOrDefault();
2418

    
2419
                                ViewerDataModel.Instance.MarkupList_USER.Remove(Item_);
2420

    
2421
                                //임시파일에서도 삭제한다.
2422
                                temp.DelTemp((InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo).CommentID, this.ParentOfType<MainWindow>().dzMainMenu.pageNavigator.CurrentPage.PageNumber.ToString());
2423
                                
2424
                            }
2425
                        }
2426
                    }
2427

    
2428
                    ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
2429
                    {
2430
                        ViewerDataModel.Instance.UndoDataList.Remove(i);
2431
                    });
2432
                    ViewerDataModel.Instance.UndoDataList.Add(UndoData);
2433
                }
2434
            }
2435
            this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Clear();
2436
        }
2437

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