프로젝트

일반

사용자정보

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

markus / KCOM / Events / Implementation / TopMenuEvent.cs @ 036650a0

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

1
using KCOM.Common;
2
using KCOM.Common.Converter;
3
using KCOM.Controls;
4
using KCOM.Events;
5
using KCOMDataModel.DataModel;
6
using MarkupToPDF.Common;
7
using Svg2Xaml;
8
using System;
9
using System.Collections.Generic;
10
using System.Linq;
11
using System.Text;
12
using System.Windows;
13
using System.Windows.Controls;
14
using System.Windows.Input;
15
using System.Windows.Media;
16
using System.Windows.Media.Imaging;
17
using Telerik.Windows.Controls;
18
using IKCOM;
19
using Microsoft.Win32;
20
using System.IO;
21
using System.Reflection;
22
using System.Windows.Controls.Primitives;
23
using MarkupToPDF.Controls.Parsing;
24

    
25
namespace KCOM.Views
26
{
27
    public partial class TopMenu : UserControl
28
    {
29
        public int rotateOffSet = 0;
30
        private double[] rotateValue = { 0, 90, 180, 270 };
31
        public System.Windows.Threading.DispatcherTimer SaveTimer { get; set; }
32
        public bool isClosed = true;
33
        public RadWindow CheckPop;
34
        public RadWindow OptionPop;
35
        public MarkupToPDF.Common.Undo_data UndoData;
36
        MarkupToPDF.Controls.Parsing.LayerControl layer = new MarkupToPDF.Controls.Parsing.LayerControl();
37

    
38
        //임시파일
39
        TempFile temp = new TempFile();
40
        /// <summary>
41
        /// TaskBar에 메시지를 입력합니다
42
        /// </summary>
43
        /// <param name="message"></param>
44
        /// <param name="type"></param>
45
        public void TaskMessage(string message, TaskMessageType type)
46
        {
47
            //if (taskBar != null)
48
            //{
49
            //    string color = "";
50
            //    taskBar.Content = message;
51
            //    DicTaskMessage.TryGetValue(type, out color);
52
            //    taskBar.Foreground = new SolidColorBrush(StringToColorConverter.Parse(color));
53
            //}
54
        }
55

    
56
        /// <summary>
57
        /// Task Type명을 Key값으로 지정합니다
58
        /// </summary>
59
        public enum TaskMessageType
60
        {
61
            Normal,
62
            Caption,
63
            Error,
64
        }
65

    
66
        private void CheckShapeState()
67
        {
68

    
69

    
70
            if (cbHatchShape.IsChecked == true)
71
            {
72
                cbFillShape.IsChecked = false;
73
                ViewerDataModel.Instance.paintSet = MarkupToPDF.Controls.Common.PaintSet.Hatch;
74
            }
75
            else if(cbFillShape.IsChecked == true)
76
            {
77
                cbHatchShape.IsChecked = false;
78
                ViewerDataModel.Instance.paintSet = MarkupToPDF.Controls.Common.PaintSet.Fill;
79
            }
80
            else
81
            {
82
                ViewerDataModel.Instance.paintSet = MarkupToPDF.Controls.Common.PaintSet.None;
83
            }
84
        }
85

    
86
        //강인구 추가(Undo End)
87
        private void SetPaintEvent()
88
        {
89
            List<AdornerMember> AdonerList = GetAdornerItem();
90

    
91
            if (AdonerList.Count > 0)
92
            {
93
                Undo_data UndoData = new Undo_data()
94
                {
95
                    IsUndo = false,
96
                    Event = Event_Type.Option,
97
                    EventTime = DateTime.Now,
98
                    paint = ViewerDataModel.Instance.paintSet,
99
                    Markup_List = new List<Multi_Undo_data>()
100
                };
101
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
102

    
103
                foreach (AdornerMember InnerItem in AdonerList)
104
                {
105
                    multi_Undo_Data.PointSet = new List<Point>();
106

    
107
                    if ((InnerItem.DrawingData as MarkupToPDF.Controls.Common.IShapeControl) != null)
108
                    {
109
                        (InnerItem.DrawingData as MarkupToPDF.Controls.Common.IShapeControl).Paint = ViewerDataModel.Instance.paintSet;
110
                    }
111

    
112
                    multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
113
                    UndoData.Markup_List.Add(multi_Undo_Data);
114
                    multi_Undo_Data = new Multi_Undo_data();
115
                }
116

    
117
                ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
118
                {
119
                    ViewerDataModel.Instance.UndoDataList.Remove(i);                    
120
                });
121
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
122
                
123

    
124
            }
125

    
126
        }
127

    
128
        private void SetHighlightEvent()
129
        {
130
            List<AdornerMember> AdonerList = GetAdornerItem();
131

    
132
            if (AdonerList.Count > 0)
133
            {
134
                foreach (AdornerMember InnerItem in AdonerList)
135
                {
136
                    switch (InnerItem.DrawingData.GetType().Name)
137
                    {
138
                        case ("TextControl"):
139
                            {
140
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).IsHighLight = ViewerDataModel.Instance.checkHighShape;
141
                            }
142
                            break;
143
                        case ("ArrowTextControl"):
144
                            {
145
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape;
146
                            }
147
                            break;
148
                    }
149
                }
150
            }
151

    
152
        }
153

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

    
171
            //    imgShape_RectCloud.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/RectCloud.png", UriKind.Relative));
172
            //    imgShape_Cloud.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/Cloud.png", UriKind.Relative));
173
            //    imgShape_Rect.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/Rectangle.png", UriKind.Relative));
174
            //    imgShape_Tri.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/triangle-icon_None.png", UriKind.Relative));
175
            //    imgShape_Cicle.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/circle-icon_None.png", UriKind.Relative));
176
            //    imgShape_Poly.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/polygon.png", UriKind.Relative));
177
            //    TaskMessage("채우기 옵션이 해제되었습니다", TaskMessageType.Caption);
178
            //}
179
            #endregion
180
            ViewerDataModel.Instance.checkFillShape = (sender as CheckBox).IsChecked.Value;
181

    
182
            if (ViewerDataModel.Instance.checkFillShape)
183
            {
184
                cbHatchShape.IsChecked = false;
185
                ViewerDataModel.Instance.paintSet = MarkupToPDF.Controls.Common.PaintSet.Fill;
186
            }
187
            else
188
            {
189
                ViewerDataModel.Instance.paintSet = MarkupToPDF.Controls.Common.PaintSet.None;
190
            }
191
            SetPaintEvent();
192
        }
193

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

    
225
            //강인구 추가
226
            ViewerDataModel.Instance.checkHatchShape = (sender as CheckBox).IsChecked.Value;
227
            if (ViewerDataModel.Instance.checkHatchShape)
228
            {
229
                cbFillShape.IsChecked = false;
230
                ViewerDataModel.Instance.paintSet = MarkupToPDF.Controls.Common.PaintSet.Hatch;
231
            }
232
            else
233
            {
234
                ViewerDataModel.Instance.paintSet = MarkupToPDF.Controls.Common.PaintSet.None;  
235
            }
236
            SetPaintEvent();
237
        }
238

    
239
 		//강인구 추가
240
        private string SetColor(string ID)
241
        {
242
            try
243
            {
244
                return ViewerDataModel.Instance._markupInfoList.Where(info => info.MarkupInfoID == ID).First().DisplayColor;
245
            }
246
            catch (Exception)
247
            {
248
                return "#FFFFFF";
249
            }
250
        }
251

    
252
        void SaveTimer_Tick(object sender, EventArgs e)
253
        {
254
            //if (this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode != IKCOM.MouseHandlingMode.Drawing)
255
            if (this.ParentOfType<MainWindow>().dzMainMenu.currentControl == null && this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count == 0)
256
            {
257
                SaveEvent(null, null);
258
            }
259

    
260
        }
261

    
262
        private void SaveTime(bool IsRun)
263
        {
264
            if(SaveTimer == null)
265
            {
266
                SaveTimer = new System.Windows.Threading.DispatcherTimer();
267
                SaveTimer.Interval = new TimeSpan(0, 0, 5);
268
                SaveTimer.Tick += new EventHandler(SaveTimer_Tick);
269
            }
270

    
271
            if (IsRun)
272
            {
273
                SaveTimer.Start();
274
            }
275
            else
276
            {
277
                SaveTimer.Stop();
278
            }
279
        }
280
        private void SaveTime(bool IsRun,int timeinterval)
281
        {
282
            if (SaveTimer == null)
283
            {
284
                SaveTimer = new System.Windows.Threading.DispatcherTimer();
285
                SaveTimer.Interval = new TimeSpan(0, timeinterval, 0);
286
                SaveTimer.Tick += new EventHandler(SaveTimer_Tick);
287
            }
288
            else
289
            {
290
                SaveTimer.Stop();
291
                SaveTimer.Interval = new TimeSpan(0, timeinterval, 0);
292
            }
293

    
294
            if (IsRun)
295
            {
296
                SaveTimer.Start();
297
            }
298
            else
299
            {
300
                SaveTimer.Stop();
301
            }
302
        }
303
        /// <summary>
304
        /// enable busy indicator and then call _SaveEvent method.
305
        /// </summary>
306
        /// <param name="sender"></param>
307
        /// <param name="e"></param>
308
        public void SaveEvent(object sender, RoutedEventArgs e)
309
        {
310
            this.ParentOfType<MainWindow>().dzMainMenu.EmptyControlCheck();
311

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

    
314
            this.ParentOfType<MainWindow>().dzMainMenu.busyIndicator.IsBusy = true;
315
            System.Threading.Tasks.Task SaveTask = System.Threading.Tasks.Task.Factory.StartNew(() =>
316
            {
317
                Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, new Action<object, RoutedEventArgs>(_SaveEvent), sender, e);
318
            }).ContinueWith(task =>
319
            {
320
                Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate () { this.ParentOfType<MainWindow>().dzMainMenu.busyIndicator.IsBusy = false; }));
321
            });
322
        }
323

    
324
        /// <summary>
325
        /// save document
326
        /// </summary>
327
        /// <param name="sender"></param>
328
        /// <param name="e"></param>
329
        public void _SaveEvent(object sender, RoutedEventArgs e)
330
        {
331
            try
332
            {
333
                this.ParentOfType<MainWindow>().dzMainMenu.ReleaseAdorner();
334

    
335
                this.ParentOfType<MainWindow>().dzMainMenu.InkControl_Convert();
336

    
337
                var menu = this.ParentOfType<MainWindow>().dzMainMenu;
338

    
339
                //콘솔리 데잇일 경우 
340
                //if (ViewerDataModel.Instance.IsConsolidate && menu.gridViewMarkup.SelectedItems.Count > 1)
341
                //if (ViewerDataModel.Instance.IsConsolidate)
342
                //{
343
                //    ViewerDataModel.Instance.IsConsolidate = false;
344
                //    return;
345
                //}
346

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

    
360
                //코멘트가 없을 경우
361
                if (ViewerDataModel.Instance.MarkupList_USER.Count == 0)
362
                {
363
                    foreach (var item in menu.gridViewMarkup.SelectedItems)
364
                    {
365
                        if ((item as IKCOM.MarkupInfoItem).UserID == App.ViewInfo.UserID)
366
                        {
367
                            this.ParentOfType<MainWindow>().dzMainMenu.DeleteItem((item as IKCOM.MarkupInfoItem));
368
                            return;
369
                        }
370
                    }
371
                }
372

    
373
                if (ViewerDataModel.Instance.MarkupList_USER.Count > 0)
374
                {
375
                    foreach (var item in menu.gridViewMarkup.SelectedItems)
376
                    {
377
                        if ((item as IKCOM.MarkupInfoItem).UserID == App.ViewInfo.UserID)
378
                        {
379
                            /*
380
                            if (menu.UndoData.Markup_List[0].Markup..GetType().Name == "TextControl" && ((MarkupToPDF.Controls.Text.TextControl)(item as IKCOM.MarkupInfoItem).MarkupList[0].).OverViewText == null)
381
                            {
382
                            }
383

    
384
                            this.ParentOfType<MainWindow>().dzMainMenu.DeleteItem((item as IKCOM.MarkupInfoItem));
385
                            return;*/
386
                        }
387
                    }
388
                }
389
                
390

    
391
                    //코멘트가 없을 경우
392
                    //if (ViewerDataModel.Instance.MarkupControls_USER.Count == 0)
393
                    //if (ViewerDataModel.Instance.MarkupControls_USER.Count == 0 && menu.gridViewMarkup.SelectedItems.Count == 0)
394
                    //{
395
                    //    foreach (var item in menu.gridViewMarkup.SelectedItems)
396
                    //    {
397
                    //        if ((item as IKCOM.MarkupInfoItem).UserID == App.ViewInfo.UserID)
398
                    //        {
399
                    //            this.ParentOfType<MainWindow>().dzMainMenu.DeleteItem((item as IKCOM.MarkupInfoItem));
400
                    //            return;
401
                    //        }
402
                    //    }
403
                    //}
404

    
405
                    menu.ChangeCommentReact();
406

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

    
431
                            if (ViewerDataModel.Instance.IsConsolidate)
432
                            {
433
                                return;
434
                            }
435
                            menu.gridViewMarkup.ItemsSource = null;
436
                            menu.gridViewMarkup.ItemsSource = ViewerDataModel.Instance._markupInfoList;
437
                            menu.gridViewMarkup.SelectedItem = item;
438

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

    
467
		public void RefactoryCommentReact(MainMenu menu)
468
        {
469
            this.ParentOfType<MainWindow>().dzMainMenu.InkControl_Convert();
470

    
471
            Save save = new Save();
472

    
473
            //추가
474
            List<IKCOM.MarkupInfoItem> MySelectItem = new List<IKCOM.MarkupInfoItem>();
475

    
476
            foreach(var item in menu.gridViewMarkup.SelectedItems)
477
            {
478
                if ((item as IKCOM.MarkupInfoItem).UserID == App.ViewInfo.UserID)
479
                {
480
                    MySelectItem.Add(item as IKCOM.MarkupInfoItem);
481
                }
482
            }
483

    
484
            //MySelectItem = (menu.gridViewMarkup.SelectedItems.FirstOrDefault() as IKCOM.MarkupInfoItem);
485

    
486

    
487
            save.Project_No = App.ViewInfo.ProjectNO;
488
            save.document_id = App.ViewInfo.DocumentItemID;
489
            save.user_id = App.ViewInfo.UserID;
490
            save.page_no = Convert.ToInt32(tlcurrentPage.Text);
491

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

    
528
            }
529
            catch //(Exception ex)
530
            {
531
                this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert("세이브 실패", "Alert");
532
            }
533
        }
534

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

    
553
                }
554
                else
555
                {
556
                    RefactoryCommentReact(menu);
557
                }
558
            }
559

    
560
            bool isprint = false;
561
            if (Type == "Print")
562
            {
563
                isprint = true;
564
            }
565

    
566
            RadWindow PrintWindow = new RadWindow();
567
            //IKCOM.MarkupInfoItem _result = null;
568
            PrintWindow.Width = 850;
569
            PrintWindow.Height = 600;
570
            //PrintWindow.Width = 650;
571
            //PrintWindow.Height = 550;
572
            PrintWindow.Header = Type;
573

    
574
            List<IKCOM.MarkupInfoItem> markupinfo = new List<IKCOM.MarkupInfoItem>();
575

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

    
579
            if (markupinfo.Count() > 0)
580
            {
581
                Logger.sendResLog("GetPrintDocItemList", "TRUE", 1);
582
            }
583
            else
584
            {
585
                Logger.sendResLog("GetPrintDocItemList", "FALSE", 1);
586
            }
587

    
588
            var Tile_Url = string.Format(@"{0}/TileSource/{1}_Tile/{2}/{3}/",
589
                App.SystemInfo.HostName,
590
                App.ViewInfo.ProjectNO,
591
                (Convert.ToInt64(App.ViewInfo.DocumentItemID) / 100).ToString(),
592
                App.ViewInfo.DocumentItemID
593
                );
594

    
595
            PrintWindow.Content = new KCOM.Control.PrintControl(
596
                      Tile_Url,
597
                      App.ViewInfo.ProjectNO,
598
                      this.ParentOfType<MainWindow>().dzMainMenu._DocInfo, markupinfo,
599
                      this.ParentOfType<MainWindow>().dzMainMenu.pageNavigator.CurrentPage.PageNumber,
600
                      App.ViewInfo.DocumentItemID,
601
                      this.ParentOfType<MainWindow>().dzMainMenu._DocItem.DOCUMENT_NO,
602
                      this.ParentOfType<MainWindow>().dzMainMenu._DocItem.ORIGINAL_FILE, isprint);
603

    
604
            //프린트 팝업 옵션
605
            //PrintWindow.BorderThickness = new Thickness(3);
606
            //PrintWindow.BorderBrush = new SolidColorBrush(Color.FromArgb(255, 37, 160, 218));
607
            PrintWindow.ResizeMode = System.Windows.ResizeMode.NoResize;
608
            PrintWindow.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
609
            PrintWindow.Background = new SolidColorBrush(Colors.Black);
610
            PrintWindow.Background.Opacity = 0.6;
611
            PrintWindow.Owner = Application.Current.MainWindow;
612
            Telerik.Windows.Controls.StyleManager.SetTheme(PrintWindow, new Telerik.Windows.Controls.VisualStudio2013Theme());
613
            PrintWindow.ShowDialog();
614
        }
615

    
616
        //강인구 추가
617
        private void PrintEvent(object sender, RoutedEventArgs e)
618
        {
619
            RadRibbonButton button = sender as RadRibbonButton;
620
            Print_Start(button.Content.ToString());
621
        }
622

    
623
        private List<AdornerMember> GetAdornerItem()
624
        {
625
            List<AdornerMember> AdonerList = new List<AdornerMember>();
626

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

    
666
                foreach (AdornerMember InnerItem in AdonerList)
667
                {
668
                    InnerItem.DrawingData.Opacity = ViewerDataModel.Instance.ControlOpacity;
669
                  
670
                    multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
671
                    UndoData.Markup_List.Add(multi_Undo_Data);
672
                    multi_Undo_Data = new Multi_Undo_data();
673
                }
674

    
675
                ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
676
                {
677
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
678
                });
679
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
680
            }
681
        }
682

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

    
703
                foreach (AdornerMember InnerItem in AdonerList)
704
                {
705
                    switch (InnerItem.DrawingData.GetType().Name)
706
                    {
707
                        case ("LineControl"):
708
                            {
709
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Line.LineControl).LineSize = ViewerDataModel.Instance.LineSize;
710
                            }
711
                            break;
712
                        case ("ArcControl"):
713
                            {
714
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Line.ArcControl).LineSize = ViewerDataModel.Instance.LineSize;
715
                            }
716
                            break;
717
                        case ("ArrowArcControl"):
718
                            {
719
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Line.ArrowArcControl).LineSize = ViewerDataModel.Instance.LineSize;
720
                            }
721
                            break;
722
                        case ("ArrowControl_Multi"):
723
                            {
724
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Line.ArrowControl_Multi).LineSize = ViewerDataModel.Instance.LineSize;
725
                            }
726
                            break;
727
                        case ("CloudControl"):
728
                            {
729
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Polygon.CloudControl).LineSize = ViewerDataModel.Instance.LineSize;
730
                            }
731
                            break;
732
                        case ("PolygonControl"):
733
                            {
734
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Polygon.PolygonControl).LineSize = ViewerDataModel.Instance.LineSize;
735
                            }
736
                            break;
737
                        case ("RectangleControl"):
738
                            {
739
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.RectangleControl).LineSize = ViewerDataModel.Instance.LineSize;
740
                            }
741
                            break;
742
                        case ("RectCloudControl"):
743
                            {
744
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.RectCloudControl).LineSize = ViewerDataModel.Instance.LineSize;
745
                            }
746
                            break;
747
                        case ("TriControl"):
748
                            {
749
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.TriControl).LineSize = ViewerDataModel.Instance.LineSize;
750
                            }
751
                            break;
752
                        case ("CircleControl"):
753
                            {
754
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.CircleControl).LineSize = ViewerDataModel.Instance.LineSize;
755
                            }
756
                            break;
757
                        case ("ArrowTextControl"):
758
                            {
759
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).LineSize = ViewerDataModel.Instance.LineSize;
760
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).BorderSize = new Thickness(ViewerDataModel.Instance.LineSize);
761
                            }
762
                            break;
763
                        case ("TextControl"):
764
                            {
765
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).LineSize = new Thickness(ViewerDataModel.Instance.LineSize);
766
                            }
767
                            break;
768
                        case ("InsideWhiteControl"):
769
                            {
770
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Cad.InsideWhiteControl).LineSize = ViewerDataModel.Instance.LineSize;
771
                            }
772
                            break;
773
                        case ("OverlapWhiteControl"):
774
                            {
775
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Cad.OverlapWhiteControl).LineSize = ViewerDataModel.Instance.LineSize;
776
                            }
777
                            break;
778
                        case ("ClipWhiteControl"):
779
                            {
780
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Cad.ClipWhiteControl).LineSize = ViewerDataModel.Instance.LineSize;
781
                            }
782
                            break;
783
                        case ("CoordinateControl"):
784
                            {
785
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Cad.CoordinateControl).LineSize = 10; //ViewerDataModel.Instance.LineSize
786
                            }
787
                            break;
788
                    }
789
                    
790

    
791
                    multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
792
                    UndoData.Markup_List.Add(multi_Undo_Data);
793
                    multi_Undo_Data = new Multi_Undo_data();
794
                }
795

    
796
                ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
797
                {
798
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
799
                });
800
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
801

    
802
                
803
            }
804
            KCOM.Properties.Settings.Default.LineSize = (double)cbLineSize.Value;
805
            Properties.Settings.Default.Save();
806
        }
807

    
808

    
809
        private void cbIntervalSize_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
810
        {
811
            if (string.IsNullOrEmpty(cbIntervalSize.Value.ToString()))
812
            {
813
                cbIntervalSize.Value = cbIntervalSize.Minimum;
814
            }
815
            List<AdornerMember> AdonerList = GetAdornerItem();
816
            if (AdonerList.Count > 0)
817
            {
818

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

    
829
                foreach (AdornerMember InnerItem in AdonerList)
830
                {
831
                    switch (InnerItem.DrawingData.GetType().Name)
832
                    {
833
                        case ("LineControl"):
834
                            {
835
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Line.LineControl).Interval = ViewerDataModel.Instance.Interval;
836

    
837
                                multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
838
                                UndoData.Markup_List.Add(multi_Undo_Data);
839
                                multi_Undo_Data = new Multi_Undo_data();
840
                            }
841
                            break;
842
                    }
843
                }
844

    
845
                ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
846
                {
847
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
848
                });
849
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
850
            }
851
            KCOM.Properties.Settings.Default.Interval = (double)cbIntervalSize.Value;
852
            Properties.Settings.Default.Save();
853
        }
854
        
855
        private void cbArcLength_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
856
        {
857
            if (string.IsNullOrEmpty(cbArcLength.Value.ToString()))
858
            {
859
                cbArcLength.Value = cbArcLength.Minimum;
860
            }
861
            List<AdornerMember> AdonerList = GetAdornerItem();
862
            if (AdonerList.Count > 0)
863
            {
864

    
865
                //Undo_data UndoData = new Undo_data()
866
                //{
867
                //    IsUndo = false,
868
                //    Event = Event_Type.Option,
869
                //    EventTime = DateTime.Now,
870
                //    Interval = ViewerDataModel.Instance.Interval,
871
                //    Markup_List = new List<Multi_Undo_data>()
872
                //};
873
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
874

    
875
                foreach (AdornerMember InnerItem in AdonerList)
876
                {
877
                    switch (InnerItem.DrawingData.GetType().Name)
878
                    {
879
                        case ("RectCloudControl"):
880
                            {
881
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.RectCloudControl).ArcLength = ViewerDataModel.Instance.ArcLength;
882

    
883
                                //multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
884
                                //UndoData.Markup_List.Add(multi_Undo_Data);
885
                                //multi_Undo_Data = new Multi_Undo_data();
886
                            }
887
                            break;
888
                        case ("CloudControl"):
889
                            {
890
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Polygon.CloudControl).ArcLength = ViewerDataModel.Instance.ArcLength;
891

    
892
                                //multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
893
                                //UndoData.Markup_List.Add(multi_Undo_Data);
894
                                //multi_Undo_Data = new Multi_Undo_data();
895
                            }
896
                            break;
897
                    }
898
                }
899

    
900
                //ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
901
                //{
902
                //    ViewerDataModel.Instance.UndoDataList.Remove(i);
903
                //});
904
                //ViewerDataModel.Instance.UndoDataList.Add(UndoData);
905
            }
906

    
907
            KCOM.Properties.Settings.Default.ArcLength = (double)cbArcLength.Value;
908
            Properties.Settings.Default.Save();
909
        }
910

    
911
        //강인구 추가(Undo End)
912
        private void cbDashStyle_SelectionChanged(object sender, SelectionChangedEventArgs e)
913
        {
914
            //강인구 추가
915
            if (this.ParentOfType<MainWindow>() != null)
916
            {
917
                ViewerDataModel.Instance.DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
918
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
919
                {
920
                    Undo_data UndoData = new Undo_data()
921
                    {
922
                        IsUndo = false,
923
                        Event = Event_Type.Option,
924
                        EventTime = DateTime.Now,
925
                        DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData,
926
                        Markup_List = new List<Multi_Undo_data>()
927
                    };
928
                    Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
929

    
930
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
931
                    {
932
                        if (item.GetType().Name == "AdornerFinal")
933
                        {
934
                            foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
935
                            {
936
                                switch (InnerItem.DrawingData.GetType().Name)
937
                                {
938
                                    case ("LineControl"):
939
                                        {
940
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Line.LineControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
941
                                        }
942
                                        break;
943
                                    case ("ArcControl"):
944
                                        {
945
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Line.ArcControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
946
                                        }
947
                                        break;
948
                                    case ("ArrowArcControl"):
949
                                        {
950
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Line.ArrowArcControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
951
                                        }
952
                                        break;
953
                                    case ("ArrowControl_Multi"):
954
                                        {
955
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Line.ArrowControl_Multi).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
956
                                        }
957
                                        break;
958
                                    case ("CloudControl"):
959
                                        {
960
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Polygon.CloudControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
961
                                        }
962
                                        break;
963
                                    case ("PolygonControl"):
964
                                        {
965
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Polygon.PolygonControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
966
                                        }
967
                                        break;
968
                                    case ("RectangleControl"):
969
                                        {
970
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.RectangleControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
971
                                        }
972
                                        break;
973
                                    case ("RectCloudControl"):
974
                                        {
975
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.RectCloudControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
976
                                        }
977
                                        break;
978
                                    case ("TriControl"):
979
                                        {
980
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.TriControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
981
                                        }
982
                                        break;
983
                                    case ("CircleControl"):
984
                                        {
985
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.CircleControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
986
                                        }
987
                                        break;
988
                                    case ("InsideWhiteControl"):
989
                                        {
990
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Cad.InsideWhiteControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
991
                                        }
992
                                        break;
993
                                    case ("OverlapWhiteControl"):
994
                                        {
995
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Cad.OverlapWhiteControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
996
                                        }
997
                                        break;
998
                                    case ("ClipWhiteControl"):
999
                                        {
1000
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Cad.ClipWhiteControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
1001
                                        }
1002
                                        break;
1003
                                    case ("CoordinateControl"):
1004
                                        {
1005
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Cad.CoordinateControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
1006
                                        }
1007
                                        break;
1008
                                }
1009

    
1010
                                multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
1011
                                UndoData.Markup_List.Add(multi_Undo_Data);
1012
                                multi_Undo_Data = new Multi_Undo_data();
1013
                            }
1014

    
1015
                            ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
1016
                            {
1017
                                ViewerDataModel.Instance.UndoDataList.Remove(i);
1018
                            });
1019
                            ViewerDataModel.Instance.UndoDataList.Add(UndoData);
1020
                        }
1021
                    }
1022
                }
1023
            }
1024
        }
1025

    
1026
        //강인구 추가
1027
        private void comboFontSize_SelectionChanged(object sender, SelectionChangedEventArgs e)
1028
        {
1029
            //if (this.ParentOfType<MainWindow>() != null)
1030
            //{
1031
            //    if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
1032
            //    {
1033
            //        foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
1034
            //        {
1035
            //            if (item.GetType().Name == "AdornerFinal")
1036
            //            {
1037
            //                foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
1038
            //                {
1039
            //                    switch (InnerItem.DrawingData.GetType().Name)
1040
            //                    {
1041
            //                        case ("TextControl"):
1042
            //                            {
1043
            //                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextSize = int.Parse(comboFontSize.Text);
1044
            //                            }
1045
            //                            break;
1046
            //                        case ("ArrowTextControl"):
1047
            //                            {
1048
            //                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextSize = int.Parse(comboFontSize.Text);
1049
            //                            }
1050
            //                            break;
1051
            //                    }
1052
            //                }
1053
            //            }
1054
            //        }
1055
            //    }
1056
            //}
1057
        }
1058

    
1059
        //강인구 추가
1060
        private void btnBold_Checked(object sender, RoutedEventArgs e)
1061
        {
1062
            if (this.ParentOfType<MainWindow>() != null)
1063
            {
1064
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
1065
                {
1066
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
1067
                    {
1068
                        if (item.GetType().Name == "AdornerFinal")
1069
                        {
1070
                            foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
1071
                            {
1072
                                switch (InnerItem.DrawingData.GetType().Name)
1073
                                {
1074
                                    case ("TextControl"):
1075
                                        {
1076
                                            if((InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextWeight == FontWeights.Bold)
1077
                                            {
1078
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextWeight = FontWeights.Normal;
1079
                                            }
1080
                                            else
1081
                                            {
1082
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextWeight = FontWeights.Bold;
1083
                                            }
1084

    
1085
                                        }
1086
                                        break;
1087
                                    case ("ArrowTextControl"):
1088
                                        {
1089
                                            if ((InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextWeight == FontWeights.Bold)
1090
                                            {
1091
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextWeight = FontWeights.Normal;
1092
                                            }
1093
                                            else
1094
                                            {
1095
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextWeight = FontWeights.Bold;
1096
                                            }
1097
                                        }
1098
                                        break;
1099
                                }
1100
                            }
1101
                        }
1102
                    }
1103
                }
1104
            }
1105
        }
1106

    
1107
        //강인구 추가
1108
        private void btnItalic_Checked(object sender, RoutedEventArgs e)
1109
        {
1110
            if (this.ParentOfType<MainWindow>() != null)
1111
            {
1112
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
1113
                {
1114
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
1115
                    {
1116
                        if (item.GetType().Name == "AdornerFinal")
1117
                        {
1118
                            foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
1119
                            {
1120
                                switch (InnerItem.DrawingData.GetType().Name)
1121
                                {
1122
                                    case ("TextControl"):
1123
                                        {
1124
                                            if((InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextStyle == FontStyles.Italic)
1125
                                            {
1126
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextStyle = System.Windows.FontStyles.Normal;
1127
                                            }
1128
                                            else
1129
                                            {
1130
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextStyle = FontStyles.Italic;
1131
                                            }
1132

    
1133
                                        }
1134
                                        break;
1135
                                    case ("ArrowTextControl"):
1136
                                        {
1137
                                            if((InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextStyle == FontStyles.Italic)
1138
                                            {
1139
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextStyle = FontStyles.Normal;
1140
                                            }
1141
                                            else
1142
                                            {
1143
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextStyle = FontStyles.Italic;
1144
                                            }
1145
                                        }
1146
                                        break;
1147
                                }
1148
                            }
1149
                        }
1150
                    }
1151
                }
1152
            }
1153
        }
1154

    
1155
        //강인구 추가
1156
        private void btnUnderLine_Checked(object sender, RoutedEventArgs e)
1157
        {
1158
            if (this.ParentOfType<MainWindow>() != null)
1159
            {
1160
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
1161
                {
1162
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
1163
                    {
1164
                        if (item.GetType().Name == "AdornerFinal")
1165
                        {
1166
                            foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
1167
                            {
1168
                                switch (InnerItem.DrawingData.GetType().Name)
1169
                                {
1170
                                    case ("TextControl"):
1171
                                        {
1172
                                            if ((InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).UnderLine == TextDecorations.Underline)
1173
                                            {
1174
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).UnderLine = null;
1175
                                            }
1176
                                            else
1177
                                            {
1178
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).UnderLine = TextDecorations.Underline;
1179
                                            }
1180
                                        }
1181
                                        break;
1182
                                    case ("ArrowTextControl"):
1183
                                        {
1184
                                            if ((InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).UnderLine == TextDecorations.Underline)
1185
                                            {
1186
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).UnderLine = null;
1187
                                            }
1188
                                            else
1189
                                            {
1190
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).UnderLine = TextDecorations.Underline;
1191
                                            }
1192
                                        }
1193
                                        break;
1194
                                }
1195
                            }
1196
                        }
1197
                    }
1198
                }
1199
            }
1200
        }
1201

    
1202
        private void AxisLockEvent(object sender, RoutedEventArgs e)
1203
        {
1204
            ViewerDataModel.Instance.checkAxis = cbAxisLock.IsChecked.Value;
1205
        }
1206

    
1207
        private void comboFontSize_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
1208
        {
1209
            if (string.IsNullOrEmpty(comboFontSize.Value.ToString()))
1210
            {
1211
                comboFontSize.Value = comboFontSize.Minimum;
1212
            }
1213
            if (this.ParentOfType<MainWindow>() != null)
1214
            {
1215
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
1216
                {
1217
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
1218
                    {
1219
                        if (item.GetType().Name == "AdornerFinal")
1220
                        {
1221
                            foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
1222
                            {
1223
                                switch (InnerItem.DrawingData.GetType().Name)
1224
                                {
1225
                                    case ("TextControl"):
1226
                                        {
1227
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextSize = int.Parse(comboFontSize.Value.ToString());
1228
                                        }
1229
                                        break;
1230
                                    case ("ArrowTextControl"):
1231
                                        {
1232
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextSize = int.Parse(comboFontSize.Value.ToString());
1233
                                        }
1234
                                        break;
1235
                                }
1236
                            }
1237
                        }
1238
                    }
1239
                }
1240
            }
1241
            KCOM.Properties.Settings.Default.TextSize = (double)comboFontSize.Value;
1242
            Properties.Settings.Default.Save();
1243
        }
1244

    
1245
        //강인구 추가
1246
        private void RadRibbonComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
1247
        {
1248
            if (this.ParentOfType<MainWindow>() != null)
1249
            {
1250
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
1251
                {
1252
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
1253
                    {
1254
                        if (item.GetType().Name == "AdornerFinal")
1255
                        {
1256
                            foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
1257
                            {
1258
                                switch (InnerItem.DrawingData.GetType().Name)
1259
                                {
1260
                                    case ("TextControl"):
1261
                                        {
1262
                                            //if ((InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).FontFamily == TextDecorations.Underline)
1263
                                            //{
1264
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).FontFamily = new FontFamily(comboFontFamily.Text);
1265
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).Base_TextBlock.FontFamily = new FontFamily(comboFontFamily.Text);
1266
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).Base_TextBox.FontFamily = new FontFamily(comboFontFamily.Text);
1267
                                            //}
1268
                                            //else
1269
                                            //{
1270
                                            //    (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).UnderLine = TextDecorations.Underline;
1271
                                            //}
1272
                                        }
1273
                                        break;
1274
                                    case ("ArrowTextControl"):
1275
                                        {
1276
                                            //if ((InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).UnderLine == TextDecorations.Underline)
1277
                                            //{
1278
                                            //    (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).UnderLine = null;
1279
                                            //}
1280
                                            //else
1281
                                            //{
1282
                                            //    (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).UnderLine = TextDecorations.Underline;
1283
                                            //}
1284
                                        }
1285
                                        break;
1286
                                }
1287
                            }
1288
                        }
1289
                    }
1290
                }
1291
            }
1292
        }
1293

    
1294
        /// <summary>
1295
        /// 텍스트 컨트롤 하일라이트 처리
1296
        /// </summary>
1297
        /// <param name="sender"></param>
1298
        /// <param name="e"></param>
1299
        private void HighlightEvent(object sender, RoutedEventArgs e)
1300
        {
1301

    
1302
            ViewerDataModel.Instance.checkHighShape = (sender as CheckBox).IsChecked.Value;
1303
            SetHighlightEvent();
1304
            //if ((sender as CheckBox).IsChecked.Value)
1305
            //{
1306
            //    TaskMessage("HighLight가 설정되었습니다", TaskMessageType.Normal);
1307
            //}
1308
            //else
1309
            //{
1310
            //    TaskMessage("HighLight가 해제되었습니다", TaskMessageType.Caption);
1311
            //}
1312
            //if (ViewerDataModel.Instance.SelectedEditor as MarkupToPDF.Controls.Text.TextControl != null)
1313
            //{
1314
            //    MarkupToPDF.Controls.Text.TextControl instance = (ViewerDataModel.Instance.SelectedEditor as MarkupToPDF.Controls.Text.TextControl);
1315
            //    instance.IsHighLight = ViewerDataModel.Instance.checkHighShape;
1316
            //    instance.SetText();
1317
            //}
1318
        }
1319

    
1320
        //추가페이지 이동 엔터
1321
        private void tlcurrentPage_KeyDown(object sender, KeyEventArgs e)
1322
        {
1323
            //강인구 추가 tlcurrentPage을 이상하게 입력할수 있기때문에 Try Catch
1324
            if (e.Key == Key.Enter)
1325
            {
1326
                try
1327
                {
1328
                    var instanceMain = this.ParentOfType<MainWindow>();
1329
                    instanceMain.dzMainMenu.pageNavigator.GotoPage(Convert.ToInt32(tlcurrentPage.Text));
1330
                }
1331
                catch (Exception)
1332
                {
1333
                    RadWindow.Alert(new DialogParameters
1334
                    {
1335
                        Owner = Application.Current.MainWindow,
1336
                        Theme = new VisualStudio2013Theme(),
1337
                        Header = "안내",
1338
                        Content = "페이지 번호를 정확하게 입력해 주세요",
1339
                    });
1340
                }
1341
                
1342
            }
1343
        }
1344

    
1345
        private void tlcurrentPage_readonly_KeyDown(object sender, KeyEventArgs e)
1346
        {
1347
            //강인구 추가 tlcurrentPage을 이상하게 입력할수 있기때문에 Try Catch
1348
            if (e.Key == Key.Enter)
1349
            {
1350
                try
1351
                {
1352
                    var instanceMain = this.ParentOfType<MainWindow>();
1353
                    instanceMain.dzMainMenu.pageNavigator.GotoPage(Convert.ToInt32(tlcurrentPage_readonly.Text));
1354
                }
1355
                catch (Exception)
1356
                {
1357
                    RadWindow.Alert(new DialogParameters
1358
                    {
1359
                        Owner = Application.Current.MainWindow,
1360
                        Theme = new VisualStudio2013Theme(),
1361
                        Header = "안내",
1362
                        Content = "페이지 번호를 정확하게 입력해 주세요",
1363
                    });
1364
                }
1365

    
1366
            }
1367
        }
1368
        
1369

    
1370
        //public event EventHandler<WindowClosedEventArgs> Closed;
1371

    
1372
        //private void CheckEvent(object sender, RoutedEventArgs e)
1373
        //{
1374
        //    RadWindow CheckPop = new RadWindow();
1375
        //    test check = new test();
1376

    
1377
        //    CheckPop = new RadWindow
1378
        //    {
1379
        //        Width = 1700,
1380
        //        Height = 510,
1381
        //        Header = "My Check List",
1382
        //        Content = check,
1383
        //        Owner = this,
1384
        //        ResizeMode = System.Windows.ResizeMode.NoResize,
1385
        //        WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen,
1386
        //    };
1387
        //    StyleManager.SetTheme(CheckPop, new VisualStudio2013Theme());
1388

    
1389
        //    CheckPop.Closed += CheckPop_Closed;
1390
        //    CheckPop.ShowDialog();
1391
        //}
1392

    
1393
        private void PanoramaEvent(object sender, RoutedEventArgs e)
1394
        {
1395
            PanoramaShow();
1396
        }
1397

    
1398
        public void PanoramaShow()
1399
        {
1400
            Panorama check = new Panorama();
1401
            double screenWidth = System.Windows.SystemParameters.PrimaryScreenWidth;
1402
            double screenHeight = System.Windows.SystemParameters.PrimaryScreenHeight;
1403
            //double windowWidth = this.Width;
1404
            //double windowHeight = this.Height;
1405

    
1406
            var PanoramaPop = new RadWindow
1407
            {
1408
                //MinWidth = 600,
1409
                //MinHeight = 400,
1410
                //Header = "My Check List",
1411
                Header = "Document No : " + this.ParentOfType<MainWindow>().dzMainMenu._DocItem.DOCUMENT_NO + " / Revision :" + this.ParentOfType<MainWindow>().dzMainMenu._DocItem.REVISION,
1412
                Content = check,
1413
                Owner = this,
1414
                ResizeMode = System.Windows.ResizeMode.CanResizeWithGrip,
1415
                //ResizeMode = System.Windows.ResizeMode.NoResize,
1416
                WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen,
1417
                IsTopmost = false,
1418
                //Left = (screenWidth / 2) - (windowWidth / 2),
1419
                //Top = (screenHeight / 2) - (windowHeight / 2),
1420
                //Left = (screenWidth / 2),
1421
                //Top = (screenHeight / 2),
1422
                Width = screenWidth * 0.4,
1423
                Height = screenHeight * 0.4,
1424
            };
1425
            StyleManager.SetTheme(PanoramaPop, new VisualStudio2013Theme());
1426
            //CheckPop.ShowDialog();
1427
            PanoramaPop.Owner = Application.Current.MainWindow;
1428
            PanoramaPop.Show();
1429
        }
1430

    
1431
        private void CheckEvent(object sender, RoutedEventArgs e)
1432
        {
1433
            //창이 떠있을 경우 재 실행 방지
1434
            if (isClosed)
1435
            {
1436
                //토글 및 마우스 상태 초기화
1437
                var toggleList = this.Parent.ChildrenOfType<RadToggleButton>();
1438
                foreach(var togle in toggleList)
1439
                {
1440
                    togle.IsChecked = false;
1441
                }
1442
                this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
1443

    
1444
                isClosed = false;
1445

    
1446
                
1447
                CheckList check = new CheckList();
1448

    
1449
                CheckPop = new RadWindow
1450
                {
1451
                    MinWidth = 1200,
1452
                    MinHeight = 500,
1453
                    //Header = "My Check List",
1454
                    Header = "Document No : " + this.ParentOfType<MainWindow>().dzMainMenu._DocItem.DOCUMENT_NO + " / Revision :" + this.ParentOfType<MainWindow>().dzMainMenu._DocItem.REVISION,
1455
                    Content = check,
1456
                    //Owner = this,
1457
                    //ResizeMode = System.Windows.ResizeMode.CanResizeWithGrip,
1458
                    ResizeMode = System.Windows.ResizeMode.NoResize,
1459
                    WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen,
1460
                    IsTopmost = true,
1461
                };
1462
                StyleManager.SetTheme(CheckPop, new Office2013Theme());
1463
                CheckPop.Closed += CheckPop_Closed;
1464
                
1465
                //CheckPop.ShowDialog();
1466
                CheckPop.Show();
1467
            }
1468
        }
1469

    
1470
        private void OptionPop_Closed(object sender, WindowClosedEventArgs e)
1471
        {
1472
            isClosed = true;
1473
            //this.ParentOfType<MainWindow>().dzMainMenu.PN_Navi.IsEnabled = true;
1474
            this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
1475
            ViewerDataModel.Instance.Capture_Opacity = 0;
1476
        }
1477

    
1478
        private void CheckPop_Closed(object sender, WindowClosedEventArgs e)
1479
        {
1480
            isClosed = true;
1481
            //this.ParentOfType<MainWindow>().dzMainMenu.PN_Navi.IsEnabled = true;
1482
            this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
1483
            ViewerDataModel.Instance.Capture_Opacity = 0;
1484
        }
1485

    
1486
        /// <summary>
1487
        /// 사용자가 선택한 페이지로 이동(썸네일 동기화 시킴)
1488
        /// </summary>
1489
        /// <param name="sender"></param>
1490
        /// <param name="e"></param>
1491
        private void PageGoEvent(object sender, RoutedEventArgs e)
1492
        {
1493
            RadButton button = sender as RadButton;
1494
            var instanceMain = this.ParentOfType<MainWindow>();
1495
            
1496
            //강인구 추가 tlcurrentPage을 이상하게 입력할수 있기때문에 Try Catch
1497
            try
1498
            {
1499
                switch (button.CommandParameter.ToString())
1500
                {
1501
                    case "Down":
1502
                        {
1503
                            instanceMain.dzMainMenu.pageNavigator.GotoPage(Convert.ToInt32(tlcurrentPage.Text) + 1);
1504
                        }
1505
                        break;
1506
                    case "Up":
1507
                        {
1508
                            instanceMain.dzMainMenu.pageNavigator.GotoPage(Convert.ToInt32(tlcurrentPage.Text) - 1);
1509
                        }
1510
                        break;
1511
                }
1512
            }
1513
            catch (Exception)
1514
            {
1515
                RadWindow.Alert(new DialogParameters
1516
                {
1517
                    Owner = Application.Current.MainWindow,
1518
                    Theme = new VisualStudio2013Theme(),
1519
                    Header = "안내",
1520
                    Content = "페이지 번호를 정확하게 입력해 주세요",
1521
                });
1522
            }
1523
        }
1524

    
1525
        private void viewEvent(object sender, RoutedEventArgs e)
1526
        {
1527
            RadRibbonToggleButton viewButton = sender as RadRibbonToggleButton;
1528
            var instanceMain = this.ParentOfType<MainWindow>();
1529

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

    
1532
            //if ((sender as RadRibbonToggleButton) != null)
1533
            //{
1534
            //    Common.ViewerDataModel.Instance.ControlTag = (sender as RadRibbonToggleButton).Tag.ToString();
1535
            //    instanceToggle = (sender as RadRibbonToggleButton);
1536
            //}
1537

    
1538
            //instanceToggle.IsChecked = false;
1539

    
1540
            switch (viewButton.CommandParameter.ToString())
1541
            {
1542
                case "zoomout":
1543
                    {
1544
                        //장원
1545
                        //instanceMain.dzMainMenu.zoomAndPanControl.ZoomTo(new Rect(0, 0, instanceMain.dzMainMenu.zoomAndPanCanvas.ActualWidth, instanceMain.dzMainMenu.zoomAndPanCanvas.ActualHeight));
1546
                        instanceMain.dzMainMenu.zoomAndPanControl.ZoomPointToViewportCenter(ViewerDataModel.Instance.ContentScale -= 0.1, point);
1547
                        viewButton.IsChecked = false;
1548
                        //Common.ViewerDataModel.Instance.zom
1549
                    }
1550
                    break;
1551
                case "zoomin":
1552
                    {
1553
                        instanceMain.dzMainMenu.zoomAndPanControl.ZoomPointToViewportCenter(ViewerDataModel.Instance.ContentScale += 0.1, point);
1554
                        viewButton.IsChecked = false;
1555
                    }
1556
                    break;
1557
                case "fullscreen":
1558
                    {
1559
                        instanceMain.WindowState = WindowState.Maximized;
1560
                        //Sizemode 대기(강인구)
1561
                        //instanceMain.dzMainMenu.imageViewer.SizeMode = Leadtools.Windows.Controls.SizeMode.Fit;
1562
                        instanceMain.dzMainMenu.zoomAndPanControl.ScaleToFit();
1563
                        viewButton.IsChecked = false;
1564
                    }
1565
                    break;
1566
                case "fitWidth":
1567
                    {
1568
                        instanceMain.dzMainMenu.zoomAndPanControl.ScaleToFit();
1569
                        viewButton.IsChecked = false;
1570
                    }
1571
                    break;
1572
                case "fitHeight":
1573
                    {
1574
                        instanceMain.dzMainMenu.zoomAndPanControl.ScaleToFit();
1575
                        viewButton.IsChecked = false;
1576
                    }
1577
                    break;
1578
                case "boundzoom":
1579
                    {
1580

    
1581
                    }
1582
                    break;
1583
                case "Rotate_M":
1584
                    {
1585
                        drawingPannelRotate(false);
1586
                        viewButton.IsChecked = false;
1587
                    }
1588
                    break;
1589
                case "Rotate_P":
1590
                    {
1591
                        drawingPannelRotate(true);
1592
                        viewButton.IsChecked = false;
1593
                    }
1594
                    break;
1595
                case "Rotate_half":
1596
                    {
1597
                        drawingPannelRotate(true);
1598
                        drawingPannelRotate(true);
1599
                        viewButton.IsChecked = false;
1600
                    }
1601
                    break;
1602
            }
1603
        }
1604

    
1605
        private void Control_Event(object sender, RoutedEventArgs e)
1606
        {
1607

    
1608
        }
1609

    
1610
        #region 대기
1611

    
1612
        public void drawingPannelRotate(bool Flag)
1613
        {
1614
            var instanceMain = this.ParentOfType<MainWindow>();
1615

    
1616
            //if (rotateOffSet > 3)
1617
            //    rotateOffSet = 0;
1618

    
1619
            //if (rotateOffSet < 0)
1620
            //    rotateOffSet = 3;
1621

    
1622
            if(Flag)
1623
            {
1624
                if (instanceMain.dzMainMenu.rotate.Angle == 270)
1625
                {
1626
                    instanceMain.dzMainMenu.rotate.Angle = 0;
1627
                }
1628
                else
1629
                {
1630
                    instanceMain.dzMainMenu.rotate.Angle += 90;
1631
                }
1632
            }
1633
            else
1634
            {
1635
                if(instanceMain.dzMainMenu.rotate.Angle == 0)
1636
                {
1637
                    instanceMain.dzMainMenu.rotate.Angle = 270;
1638
                }
1639
                else
1640
                {
1641
                    instanceMain.dzMainMenu.rotate.Angle -= 90;
1642
                }
1643
            }
1644
            //double angle = (double)rotateValue.GetValue(rotateOffSet);
1645
            //instanceMain.dzMainMenu.rotate.Angle = angle;
1646
            var rotationNum = Math.Abs((instanceMain.dzMainMenu.rotate.Angle / 90));
1647

    
1648
            if (instanceMain.dzMainMenu.zoomAndPanCanvas.Width == ViewerDataModel.Instance.ContentWidth)
1649
            {
1650
                double emptySize = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
1651
                instanceMain.dzMainMenu.zoomAndPanCanvas.Width = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
1652
                instanceMain.dzMainMenu.zoomAndPanCanvas.Height = emptySize;
1653
            }
1654
            if (instanceMain.dzMainMenu.rotate.Angle == 0)
1655
            {
1656
                instanceMain.dzMainMenu.translate.X = 0;
1657
                instanceMain.dzMainMenu.translate.Y = 0;
1658
            }
1659
            else if (instanceMain.dzMainMenu.rotate.Angle == 90)
1660
            {
1661
                instanceMain.dzMainMenu.translate.X = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
1662
                instanceMain.dzMainMenu.translate.Y = 0;
1663
            }
1664
            else if (instanceMain.dzMainMenu.rotate.Angle == 180)
1665
            {
1666
                instanceMain.dzMainMenu.translate.X = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
1667
                instanceMain.dzMainMenu.translate.Y = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
1668
            }
1669
            else
1670
            {
1671
                instanceMain.dzMainMenu.translate.X = 0;
1672
                instanceMain.dzMainMenu.translate.Y = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
1673
            }
1674

    
1675
            //instanceMain.dzMainMenu.zoomAndPanControl.RenderTransformOrigin = new Point(0.5, 0.5);
1676
            instanceMain.dzMainMenu.zoomAndPanControl.RotationAngle = instanceMain.dzMainMenu.rotate.Angle;
1677
            //대기(강인구)
1678
            //instanceMain.dzMainMenu.imageViewer.RotateAngle = instanceMain.dzMainMenu.rotate.Angle;
1679

    
1680

    
1681
            //instanceMain.dzMainMenu.imageViewer.RenderTransformOrigin = new Point(0.5, 0.5);
1682
            //RotateTransform rotateTransform = new RotateTransform(instanceMain.dzMainMenu.rotate.Angle);
1683
            //instanceMain.dzMainMenu.imageViewer.RenderTransform = rotateTransform;
1684

    
1685

    
1686
            ViewerDataModel.Instance.ContentWidth = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
1687
            ViewerDataModel.Instance.ContentHeight = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
1688
            ViewerDataModel.Instance.AngleOffsetX = instanceMain.dzMainMenu.translate.X;
1689
            ViewerDataModel.Instance.AngleOffsetY = instanceMain.dzMainMenu.translate.Y;
1690
            ViewerDataModel.Instance.Angle = instanceMain.dzMainMenu.rotate.Angle;
1691
            //ViewerDataModel.Instance.Document_Info.Clear();
1692
            //ViewerDataModel.Instance.Document_Info.Where(i => i.PAGE_NUMBER == instanceMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber).ToList().ForEach(value =>
1693
            //{
1694
            //    value.PAGE_ANGLE = int.Parse(instanceMain.dzMainMenu.rotate.Angle.ToString());
1695
            //});
1696

    
1697

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

    
1703
                instanceMain.dzMainMenu.pageNavigator.ImgListbox.ItemsSource = instanceMain.dzMainMenu.pageNavigator._thumbnailItems;
1704
                var instance = instanceMain.dzMainMenu.CurrentDoc.docInfo.DOCPAGE.Where(p => p.PAGE_NUMBER == instanceMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber).FirstOrDefault();
1705
                instance.PAGE_ANGLE = int.Parse(instanceMain.dzMainMenu.rotate.Angle.ToString());
1706

    
1707
                instanceMain.dzMainMenu.pageNavigator.setPageChange(data);
1708

    
1709
                //rotation page add or update
1710
                var rotationdoc = ViewerDataModel.Instance.RotationDocs.Where(d => d.ID == instance.ID).FirstOrDefault();
1711
                if (rotationdoc != null)
1712
                {
1713
                    rotationdoc.PAGE_ANGLE = instance.PAGE_ANGLE;
1714
                }
1715
                else
1716
                {
1717
                    ViewerDataModel.Instance.RotationDocs.Add(instance);
1718
                }
1719
            });
1720
        }
1721
        #endregion
1722

    
1723
        private void ImageConverter(RadToggleButton instanceToggle)
1724
        {
1725
            try
1726
            {           
1727
                var instanceMain = this.ParentOfType<MainWindow>();
1728
                //http://cloud.devdoftech.co.kr:5977/ImageUpload/FileUpload.asmx
1729

    
1730
                Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
1731
                dlg.Filter = "All files (*.*)|*.*|PNG Images (*.png)|*.png";
1732
                Nullable<bool> result = dlg.ShowDialog();
1733
                if (result == true)
1734
                {
1735
                    instanceMain.dzMainMenu.filename = dlg.FileName;
1736
                    instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ImgControl;
1737

    
1738
                    System.IO.FileInfo fileInfo = new System.IO.FileInfo(instanceMain.dzMainMenu.filename);
1739
                    String strFile = System.IO.Path.GetFileName(instanceMain.dzMainMenu.filename);
1740
                    long numByte = fileInfo.Length;
1741
                    double dLen = Convert.ToDouble(fileInfo.Length / 1000000);
1742
                    kr.co.devdoftech.cloud.FileUpload fileUploader = new kr.co.devdoftech.cloud.FileUpload();
1743

    
1744
                    if (dLen < 4)
1745
                    {
1746
                        System.IO.FileStream fStream = new System.IO.FileStream(instanceMain.dzMainMenu.filename, System.IO.FileMode.Open, System.IO.FileAccess.Read);
1747
                        System.IO.BinaryReader br = new System.IO.BinaryReader(fStream);
1748
                        byte[] data = br.ReadBytes((int)numByte);
1749
                        br.Close();
1750

    
1751
                        string filepath = fileUploader.Run(App.ViewInfo.ProjectNO, instanceMain.dzMainMenu._DocItem.DOCUMENT_NO, App.ViewInfo.UserID, strFile, data);
1752
                        Uri uri;
1753
                        if (!(Uri.TryCreate(filepath, UriKind.Absolute, out uri) && uri.Scheme == Uri.UriSchemeHttp))
1754
                        {
1755
                            throw new Exception();
1756
                        }
1757
                        instanceMain.dzMainMenu.filename = filepath;
1758

    
1759
                        fStream.Close();
1760
                        fStream.Dispose();
1761
                    }
1762
                    else
1763
                    {
1764
                        this.ParentOfType<MainWindow>().DialogMessage_Alert("Available Memory less than 4 mega byte", "Alert");
1765
                    }
1766
                }
1767
            }
1768
            catch(Exception ex)
1769
            {
1770
                instanceToggle.IsChecked = false;
1771
                Common.ViewerDataModel.Instance.SelectedControl = "";
1772
                Common.ViewerDataModel.Instance.ControlTag = null;
1773
                this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
1774
                this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
1775
                this.ParentOfType<MainWindow>().DialogMessage_Alert(""+ ex , "Alert");
1776
            }
1777
        }
1778

    
1779
        private void Control_Init(RadToggleButton instanceToggle, object sender)
1780
        {
1781

    
1782
        }
1783

    
1784
        private void ControlEvent(object sender, RoutedEventArgs e)
1785
        {
1786
            RadToggleButton instanceToggle = sender as RadToggleButton;
1787
            var instanceMain = this.ParentOfType<MainWindow>();
1788

    
1789
            #region Ctrl + A 눌렀을 때 대처 방법 
1790
            //원인 : Ctrl + A를 누르면 UIElementSet에 등록을 시키지 않는다(이유는 한꺼번에 많은 양의 컨트롤의 동작이 유입되기 때문에
1791
            //       시스템의 성능저하를 불러올 수 있기 때문이다. 그래서 선택 후 다른 컨트롤을 누르면 등록되지 않은 컨트롤이기 때문에 삭제된다
1792
            //       이를 대처하는 방법으로 아래 코드를 사용한다.
1793
            if (Common.ViewerDataModel.Instance.MarkupControls.Count == 0 && Common.ViewerDataModel.Instance.MarkupControls.Count >= 1)
1794
            {
1795
                //var lstItem = instanceMain.DeepLayer._SelectLayer.ChildrenOfType<AdornerFinal>().ToList();
1796
                //foreach (var item in lstItem)
1797
                //{
1798
                //    foreach (var member in item.MemberSet)
1799
                //    {
1800
                //        if (!instanceMain.DeepLayer.UIElementSet.Contains(member.DrawingData))
1801
                //        {
1802
                //            instanceMain.DeepLayer.UIElementSet.Add(member.DrawingData);
1803
                //        }
1804
                //    }
1805
                //}
1806
            }
1807
            #endregion
1808

    
1809
            //if (!instanceMain.IsFreeSelectionMode)
1810
            //{
1811
            //    instanceMain.IsSwingMode = true;
1812
            //}
1813

    
1814
            #region 다른 컨트롤 버튼 선택 해제
1815
            System.Reactive.Linq.Observable2.FromPropertyChangedPattern(Common.ViewerDataModel.Instance, temp => temp.SelectedControl).Subscribe(ControlState =>
1816
            {
1817
                if (ControlState == null)
1818
                {
1819
                    instanceToggle.IsChecked = false;
1820
                    HiddenControlHide();
1821
                }
1822
            });
1823
            #endregion
1824

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

    
1827
            if (instanceToggle != null)
1828
            {
1829
                Common.ViewerDataModel.Instance.ControlTag = instanceToggle.Tag.ToString();
1830
            }
1831
            else if ((sender as RadRibbonToggleButton) != null)
1832
            {
1833
                Common.ViewerDataModel.Instance.ControlTag = (sender as RadRibbonToggleButton).Tag.ToString();
1834
                instanceToggle = (sender as RadRibbonToggleButton);
1835
            }
1836
            else if ((sender as RadRibbonButton) != null)
1837
            {
1838
                RadRibbonButton instanceButton = sender as RadRibbonButton;
1839
                Common.ViewerDataModel.Instance.ControlTag = instanceButton.Tag.ToString();
1840
            }
1841
            else
1842
            {
1843
                RadButton instanceButton = sender as RadButton;
1844
                Common.ViewerDataModel.Instance.ControlTag = instanceButton.Tag.ToString();
1845
            }
1846

    
1847

    
1848

    
1849
            System.Reactive.Linq.Observable2.FromPropertyChangedPattern(Common.ViewerDataModel.Instance, temp => temp.AngleVisibility).Subscribe(isSee =>
1850
            {
1851
                instanceMain.dzMainMenu.MainAngle.Visibility = isSee;
1852
                System.Reactive.Linq.Observable2.FromPropertyChangedPattern(Common.ViewerDataModel.Instance, temp => temp.AngleValue).Subscribe(p =>
1853
                {
1854
                    instanceMain.dzMainMenu.MainAngle.AngleValue = p;
1855
                });
1856
            });
1857
            instanceMain.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Drawing;
1858

    
1859
            instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = false;
1860

    
1861
            if (instanceToggle.IsChecked != false)
1862
            {
1863
                #region 컨트롤이 체크되었다면
1864
                switch (instanceToggle.CommandParameter.ToString())
1865
                {
1866
                    #region Line
1867
                    case "Line":
1868
                        Common.ViewerDataModel.Instance.SelectedControl = "Line";
1869
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1870
                        if (instanceToggle.Tag.ToString() == "LineDelete")
1871
                        {
1872
                            //HiddenInterval.Visibility = Visibility.Visible;
1873
                        }
1874
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.SingleLine;
1875
                        break;
1876
                    #endregion
1877
                    #region ChainLine
1878
                    case "ChainLine":
1879
                        Common.ViewerDataModel.Instance.SelectedControl = "ChainLine";
1880
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1881
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ChainLine;
1882
                        break;
1883
                    #endregion
1884
                    #region DimLine
1885
                    case "DimLine":
1886
                        Common.ViewerDataModel.Instance.SelectedControl = "DimLine";
1887
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1888
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.DimLine;
1889
                        break;
1890
                    #endregion
1891
                    #region TwinLine
1892
                    case "TwinLine":
1893
                        Common.ViewerDataModel.Instance.SelectedControl = "TwinLine";
1894
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1895
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.TwinLine;
1896
                        break;
1897
                    #endregion
1898
                    #region CancelLine
1899
                    case "CancelLine":
1900
                        Common.ViewerDataModel.Instance.SelectedControl = "CancelLine";
1901
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1902
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.CancelLine;
1903
                        break;
1904
                    #endregion
1905
                    #region PolygonCloud
1906
                    case "PolygonCloud":
1907
                        Common.ViewerDataModel.Instance.SelectedControl = "PolygonCloud";
1908
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1909
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.PolygonCloud;
1910
                        break;
1911
                    #endregion
1912
                    #region RectCloud
1913
                    case "RectCloud":
1914
                        Common.ViewerDataModel.Instance.SelectedControl = "RectCloud";
1915
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1916
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.RectCloud;
1917
                        break;
1918
                    #endregion
1919
                    #region Rectangle
1920
                    case "Rectangle":
1921
                        Common.ViewerDataModel.Instance.SelectedControl = "Rectangle";
1922
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1923
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Rectangle;
1924
                        break;
1925
                    #endregion
1926
                    #region Triangle
1927
                    case "Triangle":
1928
                        Common.ViewerDataModel.Instance.SelectedControl = "Triangle";
1929
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1930
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Triangle;
1931
                        break;
1932
                    #endregion
1933
                    #region RectCloud
1934
                    case "Circle":
1935
                        Common.ViewerDataModel.Instance.SelectedControl = "Circle";
1936
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1937
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Circle;
1938
                        break;
1939
                    #endregion
1940
                    #region Symbol
1941
                    case "Symbol":
1942
                        Common.ViewerDataModel.Instance.SelectedControl = "Symbol";
1943
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
1944
                        break;
1945
                    #endregion
1946
                    #region SymbolN
1947
                    case "SymbolN":
1948
                        Common.ViewerDataModel.Instance.SelectedControl = "SymbolN";
1949
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Stamp;
1950
                        break;
1951
                    #endregion
1952
                    #region Text
1953
                    case "Text":
1954
                        Common.ViewerDataModel.Instance.SelectedControl = "Text";
1955
                        TaskMessage("Text 도구는 텍스트 영역을 더블 클릭하여 텍스트를 재 편집 할 수 있습니다", TaskMessageType.Normal);
1956
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.TextControl;
1957
                        break;
1958
                    #endregion
1959
                    #region TextBorder
1960
                    case "TextBorder":
1961
                        Common.ViewerDataModel.Instance.SelectedControl = "TextBorder";
1962
                        TaskMessage("Text 도구는 텍스트 영역을 더블 클릭하여 텍스트를 재 편집 할 수 있습니다", TaskMessageType.Normal);
1963
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.TextBorder;
1964
                        break;
1965
                    #endregion
1966
                    #region TextCloud
1967
                    case "TextCloud":
1968
                        Common.ViewerDataModel.Instance.SelectedControl = "TextCloud";
1969
                        TaskMessage("Text 도구는 텍스트 영역을 더블 클릭하여 텍스트를 재 편집 할 수 있습니다", TaskMessageType.Normal);
1970
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.TextCloud;
1971
                        break;
1972
                    #endregion
1973
                    #region Date
1974
                    case "Date":
1975
                        Common.ViewerDataModel.Instance.SelectedControl = "Date";
1976
                        TaskMessage("날짜 컨트롤을 더블 클릭하면 날짜를 변경할 수 있습니다", TaskMessageType.Normal);
1977
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Date;
1978
                        break;
1979
                    #endregion
1980
                    #region ArrowText
1981
                    case "ArrowText":
1982
                        TaskMessage("ArrowText 컨트롤은 그린 후 컨트롤을 선택하였을 시 중간점을 조정할 수 있습니다", TaskMessageType.Normal);
1983
                        if (instanceToggle.Tag.ToString() == "ArrowText_Cloud")
1984
                        {
1985
                            Common.ViewerDataModel.Instance.SelectedControl = "ArrowText_Cloud";
1986
                            instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowTextCloudControl;
1987
                        }
1988
                        else if (instanceToggle.Tag.ToString() == "ArrowText_Border")
1989
                        {
1990
                            Common.ViewerDataModel.Instance.SelectedControl = "ArrowTextBorderControl";
1991
                            instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowTextBorderControl;
1992
                        }
1993
                        else if (instanceToggle.Tag.ToString() == "ArrowTextFix_Normal")
1994
                        {
1995
                            Common.ViewerDataModel.Instance.SelectedControl = "ArrowTransTextControl";
1996
                            instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowTransTextControl;
1997
                        }
1998
                        else if (instanceToggle.Tag.ToString() == "ArrowTextFix_Border")
1999
                        {
2000
                            Common.ViewerDataModel.Instance.SelectedControl = "ArrowTransTextBorderControl";
2001
                            instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowTransTextBorderControl;
2002
                        }
2003
                        else if (instanceToggle.Tag.ToString() == "ArrowTextFix_Cloud")
2004
                        {
2005
                            Common.ViewerDataModel.Instance.SelectedControl = "ArrowTransTextCloudControl";
2006
                            instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowTransTextCloudControl;
2007
                        }
2008
                        else
2009
                        {
2010
                            Common.ViewerDataModel.Instance.SelectedControl = "ArrowText";
2011
                            instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowTextControl;
2012
                            //HiddenAxisLock.Visibility = Visibility.Visible;
2013
                        }
2014
                        break;
2015
                    #endregion
2016
                    #region Arrow
2017
                    case "Arrow":
2018
                        Common.ViewerDataModel.Instance.SelectedControl = "Arrow";
2019
                        //HiddenAxisLock.Visibility = Visibility.Visible;
2020
                        //HiddenDimSize.Visibility = Visibility.Visible;
2021
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowLine;
2022
                        break;
2023
                    #endregion
2024
                    #region Shape
2025
                    case "Shape":
2026
                        Common.ViewerDataModel.Instance.SelectedControl = "Shape";
2027
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Mark;
2028
                        break;
2029
                    #endregion
2030
                    #region Polygon
2031
                    case "Polygon":
2032
                        Common.ViewerDataModel.Instance.SelectedControl = "Polygon";
2033
                        TaskMessage("자유형 코멘트 도구는 오른쪽 마우스 클릭을 통해 그리기를 마칠 수 있습니다", TaskMessageType.Normal);
2034
                        //HiddenAxisLock.Visibility = Visibility.Visible;
2035
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.PolygonControl;
2036
                        break;
2037
                    #endregion
2038
                    #region Arc
2039
                    case "Arc":
2040
                        Common.ViewerDataModel.Instance.SelectedControl = "Arc";
2041
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArcLine;
2042
                        //HiddenAxisLock.Visibility = Visibility.Visible;
2043
                        TaskMessage("Arc 코멘트 도구는 오른쪽 마우스를 사용해 좌우 반전을 사용하실 수 있습니다", TaskMessageType.Normal);
2044
                        break;
2045
                    #endregion
2046
                    #region ArrowArc
2047
                    case "ArrowArc":
2048
                        Common.ViewerDataModel.Instance.SelectedControl = "ArrowArc";
2049
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArcArrow;
2050
                        //HiddenAxisLock.Visibility = Visibility.Visible;
2051
                        TaskMessage("ArcArrow 코멘트 도구는 오른쪽 마우스를 사용해 좌우 반전을 사용하실 수 있습니다", TaskMessageType.Normal);
2052
                        break;
2053
                    #endregion
2054
                    #region ArrowMulti
2055
                    case "ArrowMulti":
2056
                        Common.ViewerDataModel.Instance.SelectedControl = "ArrowMulti";
2057
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowMultiLine;
2058
                        //HiddenAxisLock.Visibility = Visibility.Visible;
2059
                        break;
2060
                    #endregion
2061
                    #region Etc
2062
                    case "Etc":
2063
                        Common.ViewerDataModel.Instance.SelectedControl = "Etc";
2064
                        break;
2065
                    #endregion
2066
                    #region Ink
2067
                    case "Ink":
2068
                        if (instanceToggle.Tag.ToString() == "EraserClear")
2069
                        {
2070
                            TaskMessage("해당 컨트롤은 점 단위로 그려진 펜을 지웁니다", TaskMessageType.Normal);
2071
                            //instanceMain.dzMainMenu.inkDrawingCanvas.EditingMode = InkCanvasEditingMode.EraseByPoint;
2072
                            instanceMain.dzMainMenu.inkBoard.Tag = "EraseByPoint";
2073
                        }
2074
                        else if (instanceToggle.Tag.ToString() == "Eraser")
2075
                        {
2076
                            TaskMessage("해당 컨트롤은 선 단위로 그려진 펜을 지웁니다", TaskMessageType.Normal);
2077
                            instanceMain.dzMainMenu.inkBoard.Tag = "EraseByStroke";
2078
                            //instanceMain.dzMainMenu.inkDrawingCanvas.EditingMode = InkCanvasEditingMode.EraseByStroke;
2079
                        }
2080
                        else
2081
                        {
2082
                            instanceMain.dzMainMenu.inkBoard.Tag = "Ink";
2083
                            //instanceMain.dzMainMenu.inkDrawingCanvas.EditingMode = InkCanvasEditingMode.Ink;
2084
                        }
2085

    
2086
                        //instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = true;
2087

    
2088
                        Common.ViewerDataModel.Instance.SelectedControl = "Ink";
2089
                        Common.ViewerDataModel.Instance.LineSize = (double)cbLineSize.Value;
2090
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.PenControl;
2091
                        break;
2092
                    #endregion
2093
                    #region Select
2094
                    case "Select":
2095
                        if(this.ParentOfType<MainWindow>().dzMainMenu.currentControl != null)
2096
                        {
2097
                            ViewerDataModel.Instance.MarkupControls_USER.Remove(this.ParentOfType<MainWindow>().dzMainMenu.currentControl);
2098
                            this.ParentOfType<MainWindow>().dzMainMenu.currentControl = null;
2099
                        }
2100
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Selecting;
2101
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2102
                        instanceMain.dzMainMenu.isLeftMouseButtonDownOnWindow = false;
2103
                        break;
2104
                    #endregion
2105
                    #region Image
2106
                    case "Image":
2107
                        Common.ViewerDataModel.Instance.SelectedControl = "ImgControl";
2108
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ImgControl;
2109
                        ImageConverter(instanceToggle);
2110
                        break;
2111
                    #endregion
2112
                    #region Sign
2113
                    case "Sign":
2114
                        Common.ViewerDataModel.Instance.SelectedControl = "Sign";
2115
                        Common.ViewerDataModel.Instance.ControlTag = instanceMain.dzMainMenu._ViewInfo.UserID; //사번
2116
                        //강인구 추가
2117
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Sign;
2118
                        //instanceMain.BaseClient.GetUserSignCompleted += (sen, ea) =>
2119
                        //{
2120
                        //    if (ea.Result == null)
2121
                        //    {
2122

    
2123
                        //        this.ParentOfType<MainPage>().DialogMessage_Alert("You Don't Have Sign Data", "Alert");
2124
                        //    }
2125
                        //    else
2126
                        //    {
2127
                        //        byte[] imageBytes = System.Convert.FromBase64String(ea.Result);
2128
                        //        using (MemoryStream ms = new MemoryStream(imageBytes))
2129
                        //        {
2130
                        //            BitmapImage im = new BitmapImage();
2131
                        //            im.SetSource(ms);
2132
                        //            instanceMain.DeepLayer.SignImage = im;
2133
                        //            ms.Close();
2134
                        //        }
2135
                        //    }
2136
                        //};
2137
                        //instanceMain.BaseClient.GetUserSignAsync(instanceMain._ViewInfo.UserID);
2138
                        break;
2139
                    #endregion
2140
                    #region Check
2141
                    case "Check":
2142
                        Common.ViewerDataModel.Instance.SelectedControl = "Check";
2143
                        Common.ViewerDataModel.Instance.ControlTag = instanceMain.dzMainMenu._ViewInfo.UserID; //사번
2144
                        //강인구 추가
2145
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Symbol;
2146
                        break;
2147
                    #endregion
2148
                    #region Batch
2149
                    case "Batch":
2150
                        Common.ViewerDataModel.Instance.SelectedControl = "Batch";
2151
                        Common.ViewerDataModel.Instance.ControlTag = instanceMain.dzMainMenu._ViewInfo.UserID; //사번
2152
                        //강인구 추가
2153
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Mark;
2154
                        instanceMain.dzMainMenu.txtBatch.Visibility = Visibility.Visible;
2155
                        instanceMain.dzMainMenu.txtBatch.Text = "Place Mark";
2156
                        break;
2157
                    #endregion
2158
                    #region Copy
2159
                    case "Copy":
2160
                        Copy_Start();
2161
                        instanceToggle.IsChecked = false;
2162
                        ViewerDataModel.Instance.SelectedControl = "";
2163
                        ViewerDataModel.Instance.ControlTag = null;
2164
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2165
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2166
                        break;
2167
                    #endregion
2168
                    #region Cut
2169
                    case "Cut":
2170
                        Cut_Start();
2171
                        instanceToggle.IsChecked = false;
2172
                        ViewerDataModel.Instance.SelectedControl = "";
2173
                        ViewerDataModel.Instance.ControlTag = null;
2174
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2175
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2176
                        break;
2177
                    #endregion
2178
                    #region Paste
2179
                    case "Paste":
2180
                        Paste_Start();
2181
                        instanceToggle.IsChecked = false;
2182
                        ViewerDataModel.Instance.SelectedControl = "";
2183
                        ViewerDataModel.Instance.ControlTag = null;
2184
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2185
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;                        
2186
                        break;
2187
                    #endregion
2188
                    #region Delete
2189
                    case "Delete":
2190
                        Delete_Start();
2191
                        instanceToggle.IsChecked = false;
2192
                        ViewerDataModel.Instance.SelectedControl = "";
2193
                        ViewerDataModel.Instance.ControlTag = null;
2194
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2195
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2196
                        break;
2197
                    #endregion
2198
                    #region Undo
2199
                    case "Undo":
2200
                        this.ParentOfType<MainWindow>().dzMainMenu.Undo();
2201
                        instanceToggle.IsChecked = false;
2202
                        ViewerDataModel.Instance.SelectedControl = "";
2203
                        ViewerDataModel.Instance.ControlTag = null;
2204
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2205
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2206
                        break;
2207
                    #endregion
2208
                    #region Redo
2209
                    case "Redo":
2210
                        this.ParentOfType<MainWindow>().dzMainMenu.Redo();
2211
                        instanceToggle.IsChecked = false;
2212
                        ViewerDataModel.Instance.SelectedControl = "";
2213
                        ViewerDataModel.Instance.ControlTag = null;
2214
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2215
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2216
                        break;
2217
                    #endregion
2218
                    #region DragZoom
2219
                    case "DragZoom":
2220
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.DragZoom;
2221
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2222
                        instanceMain.dzMainMenu.isLeftMouseButtonDownOnWindow = false;
2223
                        break;
2224
                    #endregion
2225
                    #region Grouping
2226
                    case "Group":
2227
                        var GrouptoggleList = this.Parent.ChildrenOfType<RadRibbonToggleButton>();
2228
                        foreach (var togle in GrouptoggleList)
2229
                        {
2230
                            togle.IsChecked = false;
2231
                        }
2232

    
2233
                        if (this.ParentOfType<MainWindow>().dzMainMenu.currentControl != null)
2234
                        {
2235
                            ViewerDataModel.Instance.MarkupControls_USER.Remove(this.ParentOfType<MainWindow>().dzMainMenu.currentControl);
2236
                            this.ParentOfType<MainWindow>().dzMainMenu.currentControl = null;
2237
                        }
2238
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2239
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2240
                        instanceMain.dzMainMenu.isLeftMouseButtonDownOnWindow = false;
2241
                        if (ViewerDataModel.Instance.SystemMain.dzMainMenu.SelectLayer.Children.Count < 1) //선택된 것이 없으면
2242
                        {
2243
                            this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert("Please Select Controls", "Alert");
2244
                        }
2245
                        else//if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
2246
                        {
2247
                            // string MarkupData = "";
2248
                            foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
2249
                            {
2250
                                if (item.GetType().Name == "AdornerFinal" && (item as AdornerFinal).MemberSet.Count >= 2) // 얘가 2개 이상이여야 그룹가능 버튼도 막을거긴하지만 일단..
2251
                                {
2252
                                    //MARKUP_DATA_GROUP INSERT
2253
                                    MARKUP_DATA_GROUP mARKUP_DATA_GROUP = new MARKUP_DATA_GROUP
2254
                                    {
2255
                                        SYMBOL_ID = null,//InnerItem.Symbol_ID
2256
                                        STATE = 0,
2257
                                    };
2258
                                    long group_id = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.AddMarkupDataGroup(mARKUP_DATA_GROUP, App.ViewInfo.ProjectNO);
2259
                                    Logger.sendReqLog("AddMarkupDataGroup: ", "", 1);
2260
                                    if (group_id > 0)
2261
                                    {
2262
                                        foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
2263
                                        {
2264
                                            if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
2265
                                            {
2266
                                                //MARKUP_DATA UPDATE
2267
                                                //Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.UpdateMarkupData((InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo).CommentID, group_id, App.ViewInfo.ProjectNO);
2268
                                                //Logger.sendReqLog("UpdateMarkupData: ", "", 1);
2269
                                                ViewerDataModel.Instance.MarkupList_USER.Where(d => d.ID == (InnerItem.DrawingData as CommentUserInfo).CommentID).FirstOrDefault().Group_ID = group_id;
2270
                                                ViewerDataModel.Instance.MarkupList_USER.Where(d => d.ID == (InnerItem.DrawingData as CommentUserInfo).CommentID).FirstOrDefault().IsUpdate = true;
2271
                                            }
2272
                                        }
2273
                                    }
2274
                                }
2275
                            }
2276
                        }
2277
                        break;
2278
                    case "UnGroup":
2279
                        var UnGrouptoggleList = this.Parent.ChildrenOfType<RadRibbonToggleButton>();
2280
                        foreach (var togle in UnGrouptoggleList)
2281
                        {
2282
                            togle.IsChecked = false;
2283
                        }
2284
                        if (this.ParentOfType<MainWindow>().dzMainMenu.currentControl != null)
2285
                        {
2286
                            ViewerDataModel.Instance.MarkupControls_USER.Remove(this.ParentOfType<MainWindow>().dzMainMenu.currentControl);
2287
                            this.ParentOfType<MainWindow>().dzMainMenu.currentControl = null;
2288
                        }
2289
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2290
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2291
                        instanceMain.dzMainMenu.isLeftMouseButtonDownOnWindow = false;
2292

    
2293
                        if (ViewerDataModel.Instance.SystemMain.dzMainMenu.SelectLayer.Children.Count < 1) //선택된 것이 없으면
2294
                        {
2295
                            this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert("Please Select Controls", "Alert");
2296
                        }
2297
                        else//if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
2298
                        {
2299
                            // string MarkupData = "";
2300
                            foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
2301
                            {
2302
                                if (item.GetType().Name == "AdornerFinal" && (item as AdornerFinal).MemberSet.Count >= 1) // 1개 이상 
2303
                                {
2304
                                    //MARKUP_DATA UPDATE
2305
                                    foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
2306
                                    {
2307
                                        if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
2308
                                        {
2309
                                            long group_id = ViewerDataModel.Instance.MarkupList_USER.Where(d => d.ID == (InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo).CommentID).FirstOrDefault().Group_ID;
2310
                                            //MARKUP_DATA UPDATE
2311
                                            //Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.UpdateMarkupData((InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo).CommentID, 0, App.ViewInfo.ProjectNO);
2312
                                            //Logger.sendReqLog("UpdateMarkupData: ", "", 1);
2313
                                            ViewerDataModel.Instance.MarkupList_USER.Where(d => d.ID == (InnerItem.DrawingData as CommentUserInfo).CommentID).FirstOrDefault().Group_ID = 0;
2314
                                            ViewerDataModel.Instance.MarkupList_USER.Where(d => d.ID == (InnerItem.DrawingData as CommentUserInfo).CommentID).FirstOrDefault().IsUpdate = true;
2315

    
2316

    
2317
                                            //MARKUP_DATA_GROUP UPDATE
2318
                                            bool value = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.UpdateMarkupDataGroup(group_id, App.ViewInfo.ProjectNO);
2319
                                            Logger.sendReqLog("AddMarkupDataGroup: ", value.ToString(), 1);
2320
                                        }
2321
                                    }
2322
                                }
2323
                            }
2324
                        }
2325
                        break;
2326
                    #endregion
2327
                    #region Capture
2328
                    case "Capture":
2329
                        SyncInit();
2330
                        //   instanceToggle.IsChecked = false;
2331
                        var CaptureList = this.Parent.ChildrenOfType<RadRibbonToggleButton>();
2332
                        foreach (var togle in CaptureList)
2333
                        {
2334
                            togle.IsChecked = false;
2335
                        }
2336

    
2337
                        if (this.ParentOfType<MainWindow>().dzMainMenu.currentControl != null)
2338
                        {
2339
                            ViewerDataModel.Instance.MarkupControls_USER.Remove(this.ParentOfType<MainWindow>().dzMainMenu.currentControl);
2340
                            this.ParentOfType<MainWindow>().dzMainMenu.currentControl = null;
2341
                        }
2342

    
2343
                        ViewerDataModel.Instance.SelectedControl = "ImgControl";
2344
                   //     ViewerDataModel.Instance.ControlTag = null;
2345
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ImgControl;
2346

    
2347
                        /*
2348
                        //캡쳐 하기 전에 코멘트 저장
2349
                        if (Common.ViewerDataModel.Instance.MarkupControls_USER.Count > 0 || (Application.Current.MainWindow as MainWindow).dzMainMenu.SelectLayer.Children.Count > 0)
2350
                        {
2351
                            var menu = (Application.Current.MainWindow as MainWindow).dzMainMenu;
2352
                            menu.ReleaseAdorner();
2353
                            if (menu.PreviewUserMarkupInfoItem != null && menu.PreviewUserMarkupInfoItem.IsPreviewUser == true)
2354
                            {
2355
                                (Application.Current.MainWindow as MainWindow).dzTopMenu.RefactoryCommentReact(menu);
2356
                            }
2357
                            else if (menu.gridViewMarkup.SelectedItems.Count == 0 || (menu.gridViewMarkup.SelectedItems.FirstOrDefault() as IKCOM.MarkupInfoItem).UserID != App.ViewInfo.UserID)
2358
                            {
2359

    
2360
                            }
2361
                            else
2362
                            {
2363
                                (Application.Current.MainWindow as MainWindow).dzTopMenu.RefactoryCommentReact(menu);
2364
                            }
2365
                        }*/
2366

    
2367
                        //Common.ViewerDataModel.Instance.CheckList_ID = ((e.Source as Telerik.Windows.Controls.RadButton).DataContext as Customer).ID;
2368
                        //Common.ViewerDataModel.Instance.CheckList_ID = ((e.Source as Image).DataContext as Customer).ID;
2369
                        //Common.ViewerDataModel.Instance.PageNumber = ((e.Source as Image).DataContext as Customer).PAGENUMBER;
2370
                        Application.Current.MainWindow.Focus();
2371
                        Common.ViewerDataModel.Instance.Capture_Opacity = 0.49;
2372
                        (Application.Current.MainWindow as MainWindow).dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Capture;
2373
                        break;
2374
                    #endregion
2375
                    #region Cad
2376
                    case "Inside":
2377
                        //instanceMain.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Drawing;
2378
                        //instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = false;
2379
                        Common.ViewerDataModel.Instance.SelectedControl = "InsideWhite";
2380
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.InsideWhite;
2381
                        break;
2382
                    case "Overlap":
2383
                        //instanceMain.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Drawing;
2384
                        //instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = false;
2385
                        Common.ViewerDataModel.Instance.SelectedControl = "OverlapWhite";
2386
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.OverlapWhite;
2387
                        break;
2388
                    case "Clip":
2389
                        //instanceMain.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Drawing;
2390
                        //instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = false;
2391
                        Common.ViewerDataModel.Instance.SelectedControl = "ClipWhite";
2392
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ClipWhite;
2393
                        break;
2394
                    case "CadExport":
2395
                        if (isClosed)
2396
                        {
2397
                            //토글 및 마우스 상태 초기화
2398
                            var toggleList = this.Parent.ChildrenOfType<RadRibbonToggleButton>();
2399
                            foreach (var togle in toggleList)
2400
                            {
2401
                                togle.IsChecked = false;
2402
                            }
2403
                            this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2404

    
2405
                            isClosed = false;
2406
                            //Control 파일 먼저 생성
2407
                            CollapsedButton_Click();
2408
                            CadViewer check = new CadViewer();
2409
                            check.WindowStartupLocation = WindowStartupLocation.CenterScreen;
2410
                            check.Title = "Export Viewer";
2411
                            //check.Topmost = true;
2412
                            check.Show();
2413
                            check.Closed += Check_Closed;
2414
                            instanceToggle.IsChecked = false;
2415
                        }
2416
                        break;
2417
                    case "CadViewer":
2418
                        if (isClosed)
2419
                        {
2420
                            //토글 및 마우스 상태 초기화
2421
                            var toggleList = this.Parent.ChildrenOfType<RadRibbonToggleButton>();
2422
                            foreach (var togle in toggleList)
2423
                            {
2424
                                togle.IsChecked = false;
2425
                            }
2426
                            this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2427

    
2428
                            isClosed = false;
2429
                            CadResultViewer check = new CadResultViewer();
2430
                            check.WindowStartupLocation = WindowStartupLocation.CenterScreen;
2431
                            check.Title = "Viewer";
2432
                            check.Show();
2433

    
2434
                            check.Closed += Check_Closed;
2435

    
2436
                        }
2437
                        break;
2438
                    #endregion
2439
                    default:
2440
                        break;
2441
                }
2442
                #endregion
2443
            }
2444
            else
2445
            {
2446

    
2447
                if (!instanceMain.dzMainMenu.IsFreeSelectionMode)
2448
                {
2449
                    instanceMain.dzMainMenu.IsSwingMode = false;
2450
                    Common.ViewerDataModel.Instance.SelectedControl = "";
2451
                    Common.ViewerDataModel.Instance.ControlTag = null;
2452
                    this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2453
                    this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2454
                }
2455
            }
2456
        }
2457

    
2458
        private void SyncInit()
2459
        {
2460
            try
2461
            {
2462
                if (!ViewerDataModel.Instance.SystemMain.dzMainMenu.testPanel2.IsHidden)
2463
                {
2464
                    ViewerDataModel.Instance.SystemMain.dzMainMenu.testPanel2.IsHidden = true;
2465
                    ViewerDataModel.Instance.PageBalanceMode = false;
2466
                    ViewerDataModel.Instance.PageBalanceNumber = 0;
2467
                    ViewerDataModel.Instance.PageNumber = 0;
2468
                    ViewerDataModel.Instance.MarkupControls_Sync.Clear();
2469
                    ViewerDataModel.Instance.SystemMain.dzMainMenu.gridViewRevMarkup.Visibility = Visibility.Collapsed;
2470
                    ViewerDataModel.Instance.SystemMain.dzMainMenu.UserList.IsChecked = false;
2471
                    ViewerDataModel.Instance.SystemMain.dzMainMenu.BalanceMode.IsChecked = false;
2472
                }
2473
            }
2474
            catch (Exception ex)
2475
            {
2476
                Logger.sendResLog("SyncInit", ex.Message, 0);
2477
            }
2478

    
2479
        }
2480

    
2481
        Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
2482
        CommentUserInfo currentControl { get; set; }
2483
        private Point GetSquareEndPoint(Point StartP, Point EndP)
2484
        {
2485
            Point Return_Point = new Point();
2486
            double dx = EndP.X - StartP.X;
2487
            double dy = EndP.Y - StartP.Y;
2488
            double length;
2489
            length = Math.Max(Math.Abs(dx), Math.Abs(dy));
2490
            Return_Point.X = (dx > 0) ? StartP.X + length : StartP.X - length;
2491
            Return_Point.Y = (dy > 0) ? StartP.Y + length : StartP.Y - length;
2492
            return Return_Point;
2493
        }
2494
        private void Check_Closed(object sender, EventArgs e)
2495
        {
2496
            isClosed = true;
2497
            //this.ParentOfType<MainWindow>().dzMainMenu.PN_Navi.IsEnabled = true;
2498
            //토글 및 마우스 상태 초기화
2499
            var toggleList = this.Parent.ChildrenOfType<RadToggleButton>();
2500
            foreach (var togle in toggleList)
2501
            {
2502
                togle.IsChecked = false;
2503
            }
2504
            this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2505
            ViewerDataModel.Instance.Capture_Opacity = 0;
2506

    
2507
        }
2508

    
2509
        /* public class test 
2510
         {
2511
             public double width { get; set; }
2512
             public double height { get; set; }
2513
         }
2514
         */
2515
        private void CollapsedButton_Click()
2516
        {
2517
            this.ParentOfType<MainWindow>().dzTopMenu._SaveEvent(null, null); // 저장하지 못한 데이터가 있다면 저장
2518

    
2519
            MarkupToPDF.Controls.Parsing.LayerControl layerControl = new MarkupToPDF.Controls.Parsing.LayerControl();
2520
            string[] data = new string[0];
2521

    
2522
            int cnt = 0;
2523
            var menu = this.ParentOfType<MainWindow>().dzMainMenu;
2524

    
2525
            List<MarkupInfoItem> gridSelectionItem = menu.gridViewMarkup.SelectedItems.Cast<MarkupInfoItem>().ToList(); //선택 된 마크업
2526

    
2527
            foreach (var item in gridSelectionItem)
2528
            {
2529
                if ((item.UserID == App.ViewInfo.UserID) && (ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.CurrentPage != null))
2530
                {
2531
                    var instance = ViewerDataModel.Instance.MarkupList_USER.Where(d => d.PageNumber == ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber &&
2532
                    d.MarkupInfoID == item.MarkupInfoID).ToList();
2533
                    data = new string[instance.Count];
2534
                    foreach (var markup in instance)
2535
                    {
2536
                        data[cnt++] = MarkupToPDF.Serialize.Core.JsonSerializerHelper.UnCompressString(markup.Data);
2537
                    }
2538
                }
2539
            }
2540

    
2541
            if (data != null)
2542
            {
2543
                string FilePath = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\Cad");
2544
                string FileName = FilePath + "\\commentstring.json"; // Default file name
2545
                if (!File.Exists(FilePath))
2546
                {
2547
                    Directory.CreateDirectory(FilePath);
2548
                }
2549

    
2550
                if (!string.IsNullOrEmpty(FileName))
2551
                {
2552
                    //  File.WriteAllText(SaveDig.FileName, data);
2553
                    File.WriteAllLines(FileName, data);
2554
                }
2555
            }
2556
        }
2557

    
2558
        private double minHeight;
2559
        private double minWidth;
2560

    
2561
        private double maxHeight;
2562
        private double maxWidth;
2563

    
2564
        public bool CanVResize { get; private set; }
2565
        public bool CanHResize { get; private set; }
2566

    
2567
        public void DesignerComponent(FrameworkElement content)
2568
        {
2569
            this.InitializeComponent();
2570

    
2571
            if (!double.IsNaN(content.Width))
2572
            {
2573
                CanHResize = false;
2574
                this.Width = content.Width;
2575
            }
2576
            else
2577
            {
2578
                CanHResize = true;
2579
                this.Width = 23.0;
2580
            }
2581
            if (!double.IsNaN(content.Height))
2582
            {
2583
                CanVResize = false;
2584
                this.Height = content.Height; ;
2585
            }
2586
            else
2587
            {
2588
                CanVResize = true;
2589
                this.Height = 23.0;
2590
            }
2591

    
2592
            minWidth = content.MinWidth < 10.0 ? 10.0 : content.MinWidth;
2593
            minHeight = content.MinHeight < 10.0 ? 10.0 : content.MinHeight;
2594
            maxWidth = content.MaxWidth;
2595
            maxHeight = content.MaxHeight;
2596

    
2597
            double top = (double)content.GetValue(Canvas.TopProperty);
2598
            if (double.IsNaN(top))
2599
                top = 0.0;
2600
            double left = (double)content.GetValue(Canvas.LeftProperty);
2601
            if (double.IsNaN(left))
2602
                left = 0.0;
2603
            SetValue(Canvas.TopProperty, top);
2604
            SetValue(Canvas.LeftProperty, left);
2605

    
2606
            //Set the actual content. Note that "Content" property is a new property. See below
2607
            this.Content = content;
2608
        }
2609
        private void Thumb_DragDelta(object sender, DragDeltaEventArgs e)
2610
        {
2611
            string name = ((Thumb)sender).Name;
2612
            if (name.Contains("Top"))
2613
            {
2614
                double newHeight = this.Height - e.VerticalChange;
2615
                if (newHeight >= minHeight && newHeight <= maxHeight)
2616
                {
2617
                    this.Height = newHeight;
2618
                    SetValue(Canvas.TopProperty,
2619
                (double)GetValue(Canvas.TopProperty) + e.VerticalChange);
2620
                }
2621
            }
2622
            if (name.Contains("Right"))
2623
            {
2624
                double newWidth = this.Width + e.HorizontalChange;
2625
                if (newWidth >= minWidth && newWidth <= maxWidth)
2626
                    this.Width = newWidth;
2627
            }
2628
            if (name.Contains("Bottom"))
2629
            {
2630
                double newHeight = this.Height + e.VerticalChange;
2631
                if (newHeight >= minHeight && newHeight <= maxHeight)
2632
                    this.Height = newHeight;
2633
            }
2634
            if (name.Contains("Left"))
2635
            {
2636
                double newWidth = this.Width - e.HorizontalChange;
2637
                if (newWidth >= minWidth && newWidth <= maxWidth)
2638
                {
2639
                    this.Width = newWidth;
2640
                    SetValue(Canvas.LeftProperty,
2641
                (double)GetValue(Canvas.LeftProperty) + e.HorizontalChange);
2642
                }
2643
            }
2644
        }
2645

    
2646
        private void drawControlBorder(object sender)
2647
        {
2648
            System.Windows.Controls.Control control = (System.Windows.Controls.Control)sender;
2649
        }
2650

    
2651
        private void ResizeThumb_DragDelta(object sender, MouseButtonEventArgs e)
2652
        {
2653
            System.Windows.Controls.Control designerItem = (System.Windows.Controls.Control)sender;
2654
            if (designerItem != null)
2655
            {
2656
                double deltaVertical, deltaHorizontal;
2657

    
2658
                switch (VerticalAlignment)
2659
                {
2660
                    case VerticalAlignment.Bottom:
2661
                        deltaVertical = designerItem.ActualHeight - designerItem.MinHeight;
2662
                        designerItem.Height -= deltaVertical;
2663
                        break;
2664
                    case VerticalAlignment.Top:
2665
                        deltaVertical = designerItem.ActualHeight - designerItem.MinHeight;
2666
                        Canvas.SetTop(designerItem, Canvas.GetTop(designerItem) + deltaVertical);
2667
                        designerItem.Height -= deltaVertical;
2668
                        break;
2669
                    default:
2670
                        break;
2671
                }
2672

    
2673
                switch (HorizontalAlignment)
2674
                {
2675
                    case HorizontalAlignment.Left:
2676
                        deltaHorizontal = designerItem.ActualWidth - designerItem.MinWidth;
2677
                        Canvas.SetLeft(designerItem, Canvas.GetLeft(designerItem) + deltaHorizontal);
2678
                        designerItem.Width -= deltaHorizontal;
2679
                        break;
2680
                    case HorizontalAlignment.Right:
2681
                        deltaHorizontal = designerItem.ActualWidth - designerItem.MinWidth;
2682
                        designerItem.Width -= deltaHorizontal;
2683
                        break;
2684
                    default:
2685
                        break;
2686
                }
2687
            }
2688
            e.Handled = true;
2689
        }
2690

    
2691
        SaveFileDialog SaveDig = new SaveFileDialog(); //파일 세이브 다이얼로그
2692

    
2693
        void ExportMethod()
2694
        {
2695
            //FileDialogFilter filterImage = new FileDialogFilter("Image Files", "*.jpg", "*.png");
2696
            SaveDig.Filter = "PDF file format|*.pdf";
2697
            SaveDig.Title = "Save an DWG File";
2698
            SaveDig.ShowDialog();
2699
        }
2700

    
2701
        private void cbAutoSave_Checked(object sender, RoutedEventArgs e)
2702
        {            
2703
            if (cbAutoSave.IsChecked == true)
2704
            {
2705
                SaveTime(true, (int)cbSaveInterval.Value);
2706
            }
2707
            else
2708
            {
2709
                SaveTime(false, (int)cbSaveInterval.Value);
2710
            }
2711
        }
2712
        private void cbSaveInterval_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
2713
        {
2714
            if(string.IsNullOrEmpty(cbSaveInterval.Value.ToString()))
2715
            {
2716
                cbSaveInterval.Value = cbSaveInterval.Minimum;
2717
            }
2718
            if (cbAutoSave.IsChecked == true)
2719
            {
2720
                SaveTime(true, (int)cbSaveInterval.Value);
2721
            }
2722

    
2723
            KCOM.Properties.Settings.Default.SaveInterval = (double)cbSaveInterval.Value;
2724
            Properties.Settings.Default.Save();
2725
        }
2726
        //강인구 자동 저장 추가
2727
        private void AutoSave(object sender, RoutedEventArgs e)
2728
        {
2729
            RadToggleButton instanceToggle = sender as RadToggleButton;
2730

    
2731
            if(instanceToggle.IsChecked == true)
2732
            {
2733
                SaveTime(true);
2734
            }
2735
            else
2736
            {
2737
                SaveTime(false);
2738
            }
2739
        }
2740

    
2741
        public void Copy_Start()
2742
        {
2743
            if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
2744
            {
2745
                string MarkupData = "";
2746

    
2747
                foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
2748
                {
2749
                    if (item.GetType().Name == "AdornerFinal")
2750
                    {
2751
                        foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
2752

    
2753
                        {
2754
                            if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
2755
                            {
2756
                                var markupReturn = MarkupParser.MarkupToString(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo, App.ViewInfo.UserID);
2757
                                MarkupData += "|OR|" + markupReturn.ConvertData;
2758
                            }
2759
                        }
2760
                        Clipboard.SetText(MarkupData);
2761
                    }
2762
                }
2763
            }
2764
        }
2765

    
2766
        public void Cut_Start()
2767
        {
2768
            if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
2769
            {
2770
                foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
2771
                {
2772
                    string MarkupData = "";
2773

    
2774
                    if (item.GetType().Name == "AdornerFinal")
2775
                    {
2776
                        foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
2777
                        {
2778
                            if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
2779
                            {
2780
                                var markupReturn = MarkupParser.MarkupToString(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo, App.ViewInfo.UserID);
2781
                                MarkupData += "|OR|" + markupReturn.ConvertData;
2782
                            }
2783
                        }
2784
                        //클립보드에 넣음
2785
                        Clipboard.SetText(MarkupData);
2786
                    }
2787
                }
2788
                this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Clear();
2789
            }
2790
        }
2791

    
2792
        public void Paste_Start()
2793
        {
2794
            //마크업 붙여넣기
2795
            //if (Clipboard.GetText().Contains("|DZ|"))
2796
            if (Clipboard.GetText().Contains("|OR||DZ|"))
2797
            {
2798
                List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>();
2799

    
2800
                string[] delimiterChars = { "|OR|" };
2801
                string[] data = Clipboard.GetText().Split(delimiterChars, StringSplitOptions.RemoveEmptyEntries);
2802

    
2803
                this.ParentOfType<MainWindow>().dzMainMenu.ReleaseAdorner();
2804

    
2805
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
2806

    
2807
                //강인구 Undo/Redo 보류
2808
                UndoData = new Undo_data()
2809
                {
2810
                    IsUndo = false,
2811
                    Event = Event_Type.Create,
2812
                    EventTime = DateTime.Now,
2813
                    Markup_List = new List<Multi_Undo_data>()
2814
                };
2815

    
2816
                ViewerDataModel.Instance.UndoDataList.Where(data1 => data1.IsUndo == true).ToList().ForEach(i =>
2817
                {
2818
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
2819
                });
2820

    
2821
                foreach (string parse in data)
2822
                {
2823
                    if (parse != "")
2824
                    {
2825
                        System.Windows.Controls.Control item = layer.markupParse_Paste(parse, ViewerDataModel.Instance.MarkupControls_USER);
2826
                        (item as MarkupToPDF.Common.CommentUserInfo).CommentID = Events.Save.shortGuid();
2827

    
2828
                        ViewerDataModel.Instance.MarkupControls.Remove(item as MarkupToPDF.Common.CommentUserInfo);
2829
                        ViewerDataModel.Instance.MarkupControls_USER.Remove(item as MarkupToPDF.Common.CommentUserInfo);
2830

    
2831
                        adornerSet.Add(item as MarkupToPDF.Common.CommentUserInfo);
2832

    
2833
                        //Controls.AdornerFinal final = new Controls.AdornerFinal(item as MarkupToPDF.Common.CommentUserInfo);
2834
                        //this.dzMainMenu.SelectLayer.Children.Add(final);
2835

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

    
2838
                        UndoData.Markup_List.Add(multi_Undo_Data);
2839
                        ViewerDataModel.Instance.UndoDataList.Add(UndoData);                        
2840
                    }
2841
                }
2842
                Controls.AdornerFinal final = new Controls.AdornerFinal(adornerSet);
2843

    
2844
                if(this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.X < 0)
2845
                {
2846
                    Canvas.SetLeft(final, 0);
2847
                    Canvas.SetTop(final, 0);
2848
                }
2849
                else
2850
                {
2851
                    double realPointX = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.X - final.BorderSize.X - (final.BorderSize.Width / 2);
2852
                    double realPointY = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.Y - final.BorderSize.Y - (final.BorderSize.Height / 2);
2853
                    final.MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(realPointX, realPointY));
2854

    
2855
                    if (final.MemberSet.Where(type => type.Drawingtype == MarkupToPDF.Controls.Common.ControlType.TextControl).FirstOrDefault() != null)
2856
                    {
2857
                        final.MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(0.001, 0.001)); //dummy
2858
                    }
2859

    
2860
                }
2861
                
2862

    
2863
                this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Add(final);
2864

    
2865
                //붙여 넣을때 원본 컨트롤과 겹치지 않도록 설정
2866
                //Canvas.SetLeft(final, 50);
2867
                //Canvas.SetTop(final, 50);
2868
            }
2869
            //외부 이미지 붙여넣기
2870
            else if (Clipboard.GetImage() != null)
2871
            {
2872
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
2873

    
2874
                //강인구 Undo/Redo 보류
2875
                UndoData = new Undo_data()
2876
                {
2877
                    IsUndo = false,
2878
                    Event = Event_Type.Create,
2879
                    EventTime = DateTime.Now,
2880
                    Markup_List = new List<Multi_Undo_data>()
2881
                };
2882

    
2883

    
2884
                string temppath = System.IO.Path.GetTempPath();
2885
                //string filename = KCOM.Events.Save.shortCommentKey();
2886
                string filename = KCOM.Events.Save.shortFileKey();
2887

    
2888
                System.Drawing.Image clipboardImage = System.Windows.Forms.Clipboard.GetImage();
2889
                clipboardImage.Save(temppath + "\\" + filename);
2890

    
2891
                System.IO.FileInfo fileInfo = new System.IO.FileInfo(temppath + "\\" + filename);
2892
                String strFile = System.IO.Path.GetFileName(fileInfo.FullName);
2893
                long numByte = fileInfo.Length;
2894
                double dLen = Convert.ToDouble(fileInfo.Length / 1000000);
2895
                kr.co.devdoftech.cloud.FileUpload fileUploader = new kr.co.devdoftech.cloud.FileUpload();
2896

    
2897
                if (dLen < 4)
2898
                {
2899
                    System.IO.FileStream fStream = new System.IO.FileStream(fileInfo.FullName,
2900
                    System.IO.FileMode.Open, System.IO.FileAccess.Read);
2901
                    System.IO.BinaryReader br = new System.IO.BinaryReader(fStream);
2902
                    byte[] data = br.ReadBytes((int)numByte);
2903

    
2904
                    filename = fileUploader.Run(App.ViewInfo.ProjectNO, this.ParentOfType<MainWindow>().dzMainMenu._DocItem.DOCUMENT_NO, App.ViewInfo.UserID, strFile + ".png", data);
2905
                    br.Close();
2906
                    fStream.Close();
2907
                    fStream.Dispose();
2908
                }
2909
                else
2910
                {
2911
                    this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert("Available Memory less than 4 mega byte", "Alert");
2912
                    return;
2913
                }
2914

    
2915
                fileInfo.Delete();
2916

    
2917
                //System.Drawing.Image clipboardImage = System.Windows.Forms.Clipboard.GetImage();
2918
                System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(clipboardImage);
2919
                IntPtr hBitmap = bmp.GetHbitmap();
2920
                System.Windows.Media.ImageSource WpfBitmap = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(hBitmap, IntPtr.Zero, Int32Rect.Empty, System.Windows.Media.Imaging.BitmapSizeOptions.FromEmptyOptions());
2921
                Image img = new Image();
2922
                //img.Source = new System.Windows.Media.Imaging.BitmapImage(new Uri(filename));
2923
                if (filename.Contains(".svg"))
2924
                {
2925
                    byte[] imageData = null;
2926
                    DrawingImage image = null;
2927
                    using (System.Net.WebClient web = new System.Net.WebClient())
2928
                    {
2929
                        imageData = web.DownloadData(new Uri(filename));
2930
                        System.IO.Stream stream = new System.IO.MemoryStream(imageData);
2931
                        image = SvgReader.Load(stream);
2932
                    }
2933
                    img.Source = image;
2934
                }
2935
                else
2936
                {
2937
                    img.Source = new BitmapImage(new Uri(filename));
2938
                }
2939

    
2940
                var currentControl = new MarkupToPDF.Controls.Etc.ImgControl
2941
                {
2942
                    PointSet = new List<Point>(),
2943
                    //FilePath = img.Source.ToString(),
2944
                    FilePath = filename,
2945
                    ImageData = img.Source,
2946
                    StartPoint = new Point(100, 100),
2947
                    EndPoint = new Point(200, 200),
2948
                    TopRightPoint = new Point(100, 200),
2949
                    LeftBottomPoint = new Point(200, 100)
2950
                };
2951

    
2952
                currentControl.TopRightPoint = new Point(currentControl.StartPoint.X + clipboardImage.Width, currentControl.StartPoint.Y);
2953
                currentControl.LeftBottomPoint = new Point(currentControl.StartPoint.X, currentControl.StartPoint.Y + clipboardImage.Height);
2954
                currentControl.EndPoint = new Point(currentControl.StartPoint.X + clipboardImage.Width, currentControl.StartPoint.Y + clipboardImage.Height);
2955

    
2956
                currentControl.PointSet = new List<Point>
2957
                                        {
2958
                                            currentControl.StartPoint,
2959
                                            currentControl.LeftBottomPoint,
2960
                                            currentControl.EndPoint,
2961
                                            currentControl.TopRightPoint,
2962
                                        };
2963

    
2964
                multi_Undo_Data = this.ParentOfType<MainWindow>().dzMainMenu.Control_Style(currentControl as MarkupToPDF.Common.CommentUserInfo);
2965
                UndoData.Markup_List.Add(multi_Undo_Data);
2966
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
2967

    
2968
                ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl as MarkupToPDF.Common.CommentUserInfo);
2969
                currentControl.CommentID = Events.Save.shortGuid();
2970

    
2971
                currentControl.ApplyTemplate();
2972
                currentControl.SetImage();
2973

    
2974
                ViewerDataModel.Instance.MarkupControls_USER.Remove(currentControl as MarkupToPDF.Common.CommentUserInfo);
2975
                Controls.AdornerFinal final = new Controls.AdornerFinal(currentControl as MarkupToPDF.Common.CommentUserInfo);
2976
                this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Add(final);
2977

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

    
2982
            }
2983
        }
2984

    
2985
        public void Delete_Start()
2986
        {
2987
            if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
2988
            {
2989
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
2990

    
2991
                UndoData = new Undo_data()
2992
                {
2993
                    IsUndo = false,
2994
                    Event = Event_Type.Delete,
2995
                    EventTime = DateTime.Now,
2996
                    Markup_List = new List<Multi_Undo_data>()
2997
                };
2998

    
2999
                foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
3000
                {
3001
                    if (item.GetType().Name == "AdornerFinal")
3002
                    {
3003
                        (item as Controls.AdornerFinal).unRegister();
3004

    
3005
                        foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
3006
                        {
3007
                            //if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
3008
                            if (!ViewerDataModel.Instance.MarkupControls_USER.Contains(InnerItem.DrawingData))
3009
                            {
3010

    
3011
                                multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
3012
                                UndoData.Markup_List.Add(multi_Undo_Data);
3013
                                multi_Undo_Data = new Multi_Undo_data();
3014

    
3015
                                ViewerDataModel.Instance.MarkupControls.Remove(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo);
3016

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

    
3019
                                ViewerDataModel.Instance.MarkupList_USER.Remove(Item_);
3020

    
3021
                                //임시파일에서도 삭제한다.
3022
                                temp.DelTemp((InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo).CommentID, this.ParentOfType<MainWindow>().dzMainMenu.pageNavigator.CurrentPage.PageNumber.ToString());
3023
                                
3024
                            }
3025
                        }
3026
                    }
3027

    
3028
                    ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
3029
                    {
3030
                        ViewerDataModel.Instance.UndoDataList.Remove(i);
3031
                    });
3032
                    ViewerDataModel.Instance.UndoDataList.Add(UndoData);
3033
                }
3034
            }
3035
            this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Clear();
3036
        }
3037

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