프로젝트

일반

사용자정보

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

markus / KCOM / Events / Implementation / TopMenuEvent.cs @ 684ef11c

이력 | 보기 | 이력해설 | 다운로드 (148 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

    
24
namespace KCOM.Views
25
{
26
    public partial class TopMenu : UserControl
27
    {
28
        public int rotateOffSet = 0;
29
        private double[] rotateValue = { 0, 90, 180, 270 };
30
        public System.Windows.Threading.DispatcherTimer SaveTimer { get; set; }
31
        public bool isClosed = true;
32
        public RadWindow CheckPop;
33
        public RadWindow OptionPop;
34
        public MarkupToPDF.Common.Undo_data UndoData;
35
        MarkupToPDF.Controls.Parsing.LayerControl.MarkupReturn markupReturn = new MarkupToPDF.Controls.Parsing.LayerControl.MarkupReturn();
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 "#FFFFFFFF";
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

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

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

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

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

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

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

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

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

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

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

    
406
                    menu.ChangeCommentReact();
407

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

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

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

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

    
472
            Save save = new Save();
473

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

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

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

    
487

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
809

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
1367
            }
1368
        }
1369
        
1370

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

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

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

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

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

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

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

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

    
1445
                isClosed = false;
1446

    
1447
                
1448
                CheckList check = new CheckList();
1449

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

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

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

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

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

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

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

    
1539
            //instanceToggle.IsChecked = false;
1540

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

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

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

    
1609
        }
1610

    
1611
        #region 대기
1612

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

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

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

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

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

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

    
1681

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

    
1686

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

    
1698

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

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

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

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

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

    
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
                    
1752

    
1753
                    instanceMain.dzMainMenu.filename = fileUploader.Run(App.ViewInfo.ProjectNO, instanceMain.dzMainMenu._DocItem.DOCUMENT_NO, App.ViewInfo.UserID, strFile, data);
1754
                    fStream.Close();
1755
                    fStream.Dispose();
1756
                }
1757
                else
1758
                {
1759
                    this.ParentOfType<MainWindow>().DialogMessage_Alert("Available Memory less than 4 mega byte", "Alert");
1760
                }
1761
            }
1762
        }
1763

    
1764
        private void Control_Init(RadToggleButton instanceToggle, object sender)
1765
        {
1766

    
1767
        }
1768

    
1769
        private void ControlEvent(object sender, RoutedEventArgs e)
1770
        {
1771
            RadToggleButton instanceToggle = sender as RadToggleButton;
1772
            var instanceMain = this.ParentOfType<MainWindow>();
1773

    
1774
            #region Ctrl + A 눌렀을 때 대처 방법 
1775
            //원인 : Ctrl + A를 누르면 UIElementSet에 등록을 시키지 않는다(이유는 한꺼번에 많은 양의 컨트롤의 동작이 유입되기 때문에
1776
            //       시스템의 성능저하를 불러올 수 있기 때문이다. 그래서 선택 후 다른 컨트롤을 누르면 등록되지 않은 컨트롤이기 때문에 삭제된다
1777
            //       이를 대처하는 방법으로 아래 코드를 사용한다.
1778
            if (Common.ViewerDataModel.Instance.MarkupControls.Count == 0 && Common.ViewerDataModel.Instance.MarkupControls.Count >= 1)
1779
            {
1780
                //var lstItem = instanceMain.DeepLayer._SelectLayer.ChildrenOfType<AdornerFinal>().ToList();
1781
                //foreach (var item in lstItem)
1782
                //{
1783
                //    foreach (var member in item.MemberSet)
1784
                //    {
1785
                //        if (!instanceMain.DeepLayer.UIElementSet.Contains(member.DrawingData))
1786
                //        {
1787
                //            instanceMain.DeepLayer.UIElementSet.Add(member.DrawingData);
1788
                //        }
1789
                //    }
1790
                //}
1791
            }
1792
            #endregion
1793

    
1794
            //if (!instanceMain.IsFreeSelectionMode)
1795
            //{
1796
            //    instanceMain.IsSwingMode = true;
1797
            //}
1798

    
1799
            #region 다른 컨트롤 버튼 선택 해제
1800
            System.Reactive.Linq.Observable2.FromPropertyChangedPattern(Common.ViewerDataModel.Instance, temp => temp.SelectedControl).Subscribe(ControlState =>
1801
            {
1802
                if (ControlState == null)
1803
                {
1804
                    instanceToggle.IsChecked = false;
1805
                    HiddenControlHide();
1806
                }
1807
            });
1808
            #endregion
1809

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

    
1812
            if (instanceToggle != null)
1813
            {
1814
                Common.ViewerDataModel.Instance.ControlTag = instanceToggle.Tag.ToString();
1815
            }
1816
            else if ((sender as RadRibbonToggleButton) != null)
1817
            {
1818
                Common.ViewerDataModel.Instance.ControlTag = (sender as RadRibbonToggleButton).Tag.ToString();
1819
                instanceToggle = (sender as RadRibbonToggleButton);
1820
            }
1821
            else if ((sender as RadRibbonButton) != null)
1822
            {
1823
                RadRibbonButton instanceButton = sender as RadRibbonButton;
1824
                Common.ViewerDataModel.Instance.ControlTag = instanceButton.Tag.ToString();
1825
            }
1826
            else
1827
            {
1828
                RadButton instanceButton = sender as RadButton;
1829
                Common.ViewerDataModel.Instance.ControlTag = instanceButton.Tag.ToString();
1830
            }
1831

    
1832

    
1833

    
1834
            System.Reactive.Linq.Observable2.FromPropertyChangedPattern(Common.ViewerDataModel.Instance, temp => temp.AngleVisibility).Subscribe(isSee =>
1835
            {
1836
                instanceMain.dzMainMenu.MainAngle.Visibility = isSee;
1837
                System.Reactive.Linq.Observable2.FromPropertyChangedPattern(Common.ViewerDataModel.Instance, temp => temp.AngleValue).Subscribe(p =>
1838
                {
1839
                    instanceMain.dzMainMenu.MainAngle.AngleValue = p;
1840
                });
1841
            });
1842
            instanceMain.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Drawing;
1843

    
1844
            instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = false;
1845

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

    
2071
                        //instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = true;
2072

    
2073
                        Common.ViewerDataModel.Instance.SelectedControl = "Ink";
2074
                        Common.ViewerDataModel.Instance.LineSize = (double)cbLineSize.Value;
2075
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.PenControl;
2076
                        break;
2077
                    #endregion
2078
                    #region Select
2079
                    case "Select":
2080
                        if(this.ParentOfType<MainWindow>().dzMainMenu.currentControl != null)
2081
                        {
2082
                            ViewerDataModel.Instance.MarkupControls_USER.Remove(this.ParentOfType<MainWindow>().dzMainMenu.currentControl);
2083
                            this.ParentOfType<MainWindow>().dzMainMenu.currentControl = null;
2084
                        }
2085
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Selecting;
2086
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2087
                        instanceMain.dzMainMenu.isLeftMouseButtonDownOnWindow = false;
2088
                        break;
2089
                    #endregion
2090
                    #region Image
2091
                    case "Image":
2092
                        Common.ViewerDataModel.Instance.SelectedControl = "ImgControl";
2093
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ImgControl;
2094
                        ImageConverter();
2095
                        break;
2096
                    #endregion
2097
                    #region Sign
2098
                    case "Sign":
2099
                        Common.ViewerDataModel.Instance.SelectedControl = "Sign";
2100
                        Common.ViewerDataModel.Instance.ControlTag = instanceMain.dzMainMenu._ViewInfo.UserID; //사번
2101
                        //강인구 추가
2102
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Sign;
2103
                        //instanceMain.BaseClient.GetUserSignCompleted += (sen, ea) =>
2104
                        //{
2105
                        //    if (ea.Result == null)
2106
                        //    {
2107

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

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

    
2278
                        if (ViewerDataModel.Instance.SystemMain.dzMainMenu.SelectLayer.Children.Count < 1) //선택된 것이 없으면
2279
                        {
2280
                            this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert("Please Select Controls", "Alert");
2281
                        }
2282
                        else//if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
2283
                        {
2284
                            // string MarkupData = "";
2285
                            foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
2286
                            {
2287
                                if (item.GetType().Name == "AdornerFinal" && (item as AdornerFinal).MemberSet.Count >= 1) // 1개 이상 
2288
                                {
2289
                                    //MARKUP_DATA UPDATE
2290
                                    foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
2291
                                    {
2292
                                        if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
2293
                                        {
2294
                                            long group_id = ViewerDataModel.Instance.MarkupList_USER.Where(d => d.ID == (InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo).CommentID).FirstOrDefault().Group_ID;
2295
                                            //MARKUP_DATA UPDATE
2296
                                            //Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.UpdateMarkupData((InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo).CommentID, 0, App.ViewInfo.ProjectNO);
2297
                                            //Logger.sendReqLog("UpdateMarkupData: ", "", 1);
2298
                                            ViewerDataModel.Instance.MarkupList_USER.Where(d => d.ID == (InnerItem.DrawingData as CommentUserInfo).CommentID).FirstOrDefault().Group_ID = 0;
2299
                                            ViewerDataModel.Instance.MarkupList_USER.Where(d => d.ID == (InnerItem.DrawingData as CommentUserInfo).CommentID).FirstOrDefault().IsUpdate = true;
2300

    
2301

    
2302
                                            //MARKUP_DATA_GROUP UPDATE
2303
                                            bool value = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.UpdateMarkupDataGroup(group_id, App.ViewInfo.ProjectNO);
2304
                                            Logger.sendReqLog("AddMarkupDataGroup: ", value.ToString(), 1);
2305
                                        }
2306
                                    }
2307
                                }
2308
                            }
2309
                        }
2310
                        break;
2311
                    #endregion
2312
                    #region Capture
2313
                    case "Capture":
2314
                        SyncInit();
2315
                        //   instanceToggle.IsChecked = false;
2316
                        var CaptureList = this.Parent.ChildrenOfType<RadRibbonToggleButton>();
2317
                        foreach (var togle in CaptureList)
2318
                        {
2319
                            togle.IsChecked = false;
2320
                        }
2321

    
2322
                        if (this.ParentOfType<MainWindow>().dzMainMenu.currentControl != null)
2323
                        {
2324
                            ViewerDataModel.Instance.MarkupControls_USER.Remove(this.ParentOfType<MainWindow>().dzMainMenu.currentControl);
2325
                            this.ParentOfType<MainWindow>().dzMainMenu.currentControl = null;
2326
                        }
2327

    
2328
                        ViewerDataModel.Instance.SelectedControl = "ImgControl";
2329
                   //     ViewerDataModel.Instance.ControlTag = null;
2330
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ImgControl;
2331

    
2332
                        /*
2333
                        //캡쳐 하기 전에 코멘트 저장
2334
                        if (Common.ViewerDataModel.Instance.MarkupControls_USER.Count > 0 || (Application.Current.MainWindow as MainWindow).dzMainMenu.SelectLayer.Children.Count > 0)
2335
                        {
2336
                            var menu = (Application.Current.MainWindow as MainWindow).dzMainMenu;
2337
                            menu.ReleaseAdorner();
2338
                            if (menu.PreviewUserMarkupInfoItem != null && menu.PreviewUserMarkupInfoItem.IsPreviewUser == true)
2339
                            {
2340
                                (Application.Current.MainWindow as MainWindow).dzTopMenu.RefactoryCommentReact(menu);
2341
                            }
2342
                            else if (menu.gridViewMarkup.SelectedItems.Count == 0 || (menu.gridViewMarkup.SelectedItems.FirstOrDefault() as IKCOM.MarkupInfoItem).UserID != App.ViewInfo.UserID)
2343
                            {
2344

    
2345
                            }
2346
                            else
2347
                            {
2348
                                (Application.Current.MainWindow as MainWindow).dzTopMenu.RefactoryCommentReact(menu);
2349
                            }
2350
                        }*/
2351

    
2352
                        //Common.ViewerDataModel.Instance.CheckList_ID = ((e.Source as Telerik.Windows.Controls.RadButton).DataContext as Customer).ID;
2353
                        //Common.ViewerDataModel.Instance.CheckList_ID = ((e.Source as Image).DataContext as Customer).ID;
2354
                        //Common.ViewerDataModel.Instance.PageNumber = ((e.Source as Image).DataContext as Customer).PAGENUMBER;
2355
                        Application.Current.MainWindow.Focus();
2356
                        Common.ViewerDataModel.Instance.Capture_Opacity = 0.49;
2357
                        (Application.Current.MainWindow as MainWindow).dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Capture;
2358
                        break;
2359
                    #endregion
2360
                    #region Cad
2361
                    case "Inside":
2362
                        //instanceMain.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Drawing;
2363
                        //instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = false;
2364
                        Common.ViewerDataModel.Instance.SelectedControl = "InsideWhite";
2365
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.InsideWhite;
2366
                        break;
2367
                    case "Overlap":
2368
                        //instanceMain.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Drawing;
2369
                        //instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = false;
2370
                        Common.ViewerDataModel.Instance.SelectedControl = "OverlapWhite";
2371
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.OverlapWhite;
2372
                        break;
2373
                    case "Clip":
2374
                        //instanceMain.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Drawing;
2375
                        //instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = false;
2376
                        Common.ViewerDataModel.Instance.SelectedControl = "ClipWhite";
2377
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ClipWhite;
2378
                        break;
2379
                    case "CadExport":
2380
                        if (isClosed)
2381
                        {
2382
                            //토글 및 마우스 상태 초기화
2383
                            var toggleList = this.Parent.ChildrenOfType<RadRibbonToggleButton>();
2384
                            foreach (var togle in toggleList)
2385
                            {
2386
                                togle.IsChecked = false;
2387
                            }
2388
                            this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2389

    
2390
                            isClosed = false;
2391
                            //Control 파일 먼저 생성
2392
                            CollapsedButton_Click();
2393
                            CadViewer check = new CadViewer();
2394
                            check.WindowStartupLocation = WindowStartupLocation.CenterScreen;
2395
                            check.Title = "Export Viewer";
2396
                            //check.Topmost = true;
2397
                            check.Show();
2398
                            check.Closed += Check_Closed;
2399
                            instanceToggle.IsChecked = false;
2400
                        }
2401
                        break;
2402
                    case "CadViewer":
2403
                        if (isClosed)
2404
                        {
2405
                            //토글 및 마우스 상태 초기화
2406
                            var toggleList = this.Parent.ChildrenOfType<RadRibbonToggleButton>();
2407
                            foreach (var togle in toggleList)
2408
                            {
2409
                                togle.IsChecked = false;
2410
                            }
2411
                            this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2412

    
2413
                            isClosed = false;
2414
                            CadResultViewer check = new CadResultViewer();
2415
                            check.WindowStartupLocation = WindowStartupLocation.CenterScreen;
2416
                            check.Title = "Viewer";
2417
                            check.Show();
2418

    
2419
                            check.Closed += Check_Closed;
2420

    
2421
                        }
2422
                        break;
2423
                    #endregion
2424
                    default:
2425
                        break;
2426
                }
2427
                #endregion
2428
            }
2429
            else
2430
            {
2431

    
2432
                if (!instanceMain.dzMainMenu.IsFreeSelectionMode)
2433
                {
2434
                    instanceMain.dzMainMenu.IsSwingMode = false;
2435
                    Common.ViewerDataModel.Instance.SelectedControl = "";
2436
                    Common.ViewerDataModel.Instance.ControlTag = null;
2437
                    this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2438
                    this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2439
                }
2440
            }
2441
        }
2442

    
2443
        private void SyncInit()
2444
        {
2445
            try
2446
            {
2447
                if (!ViewerDataModel.Instance.SystemMain.dzMainMenu.testPanel2.IsHidden)
2448
                {
2449
                    ViewerDataModel.Instance.SystemMain.dzMainMenu.testPanel2.IsHidden = true;
2450
                    ViewerDataModel.Instance.PageBalanceMode = false;
2451
                    ViewerDataModel.Instance.PageBalanceNumber = 0;
2452
                    ViewerDataModel.Instance.PageNumber = 0;
2453
                    ViewerDataModel.Instance.MarkupControls_Sync.Clear();
2454
                    ViewerDataModel.Instance.SystemMain.dzMainMenu.gridViewRevMarkup.Visibility = Visibility.Collapsed;
2455
                    ViewerDataModel.Instance.SystemMain.dzMainMenu.UserList.IsChecked = false;
2456
                    ViewerDataModel.Instance.SystemMain.dzMainMenu.BalanceMode.IsChecked = false;
2457
                }
2458
            }
2459
            catch (Exception ex)
2460
            {
2461
                Logger.sendResLog("SyncInit", ex.Message, 0);
2462
            }
2463

    
2464
        }
2465

    
2466
        Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
2467
        CommentUserInfo currentControl { get; set; }
2468
        private Point GetSquareEndPoint(Point StartP, Point EndP)
2469
        {
2470
            Point Return_Point = new Point();
2471
            double dx = EndP.X - StartP.X;
2472
            double dy = EndP.Y - StartP.Y;
2473
            double length;
2474
            length = Math.Max(Math.Abs(dx), Math.Abs(dy));
2475
            Return_Point.X = (dx > 0) ? StartP.X + length : StartP.X - length;
2476
            Return_Point.Y = (dy > 0) ? StartP.Y + length : StartP.Y - length;
2477
            return Return_Point;
2478
        }
2479
        private void Check_Closed(object sender, EventArgs e)
2480
        {
2481
            isClosed = true;
2482
            //this.ParentOfType<MainWindow>().dzMainMenu.PN_Navi.IsEnabled = true;
2483
            //토글 및 마우스 상태 초기화
2484
            var toggleList = this.Parent.ChildrenOfType<RadToggleButton>();
2485
            foreach (var togle in toggleList)
2486
            {
2487
                togle.IsChecked = false;
2488
            }
2489
            this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2490
            ViewerDataModel.Instance.Capture_Opacity = 0;
2491

    
2492
        }
2493

    
2494
        /* public class test 
2495
         {
2496
             public double width { get; set; }
2497
             public double height { get; set; }
2498
         }
2499
         */
2500
        private void CollapsedButton_Click()
2501
        {
2502
            this.ParentOfType<MainWindow>().dzTopMenu._SaveEvent(null, null); // 저장하지 못한 데이터가 있다면 저장
2503

    
2504
            MarkupToPDF.Controls.Parsing.LayerControl layerControl = new MarkupToPDF.Controls.Parsing.LayerControl();
2505
            string[] data = new string[0];
2506

    
2507
            int cnt = 0;
2508
            var menu = this.ParentOfType<MainWindow>().dzMainMenu;
2509

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

    
2512
            foreach (var item in gridSelectionItem)
2513
            {
2514
                if ((item.UserID == App.ViewInfo.UserID) && (ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.CurrentPage != null))
2515
                {
2516
                    var instance = ViewerDataModel.Instance.MarkupList_USER.Where(d => d.PageNumber == ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber &&
2517
                    d.MarkupInfoID == item.MarkupInfoID).ToList();
2518
                    data = new string[instance.Count];
2519
                    foreach (var markup in instance)
2520
                    {
2521
                        data[cnt++] = MarkupToPDF.Serialize.Core.JsonSerializerHelper.UnCompressString(markup.Data);
2522
                    }
2523
                }
2524
            }
2525

    
2526
            if (data != null)
2527
            {
2528
                string FilePath = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\Cad");
2529
                string FileName = FilePath + "\\commentstring.json"; // Default file name
2530
                if (!File.Exists(FilePath))
2531
                {
2532
                    Directory.CreateDirectory(FilePath);
2533
                }
2534

    
2535
                if (!string.IsNullOrEmpty(FileName))
2536
                {
2537
                    //  File.WriteAllText(SaveDig.FileName, data);
2538
                    File.WriteAllLines(FileName, data);
2539
                }
2540
            }
2541
        }
2542

    
2543
        private double minHeight;
2544
        private double minWidth;
2545

    
2546
        private double maxHeight;
2547
        private double maxWidth;
2548

    
2549
        public bool CanVResize { get; private set; }
2550
        public bool CanHResize { get; private set; }
2551

    
2552
        public void DesignerComponent(FrameworkElement content)
2553
        {
2554
            this.InitializeComponent();
2555

    
2556
            if (!double.IsNaN(content.Width))
2557
            {
2558
                CanHResize = false;
2559
                this.Width = content.Width;
2560
            }
2561
            else
2562
            {
2563
                CanHResize = true;
2564
                this.Width = 23.0;
2565
            }
2566
            if (!double.IsNaN(content.Height))
2567
            {
2568
                CanVResize = false;
2569
                this.Height = content.Height; ;
2570
            }
2571
            else
2572
            {
2573
                CanVResize = true;
2574
                this.Height = 23.0;
2575
            }
2576

    
2577
            minWidth = content.MinWidth < 10.0 ? 10.0 : content.MinWidth;
2578
            minHeight = content.MinHeight < 10.0 ? 10.0 : content.MinHeight;
2579
            maxWidth = content.MaxWidth;
2580
            maxHeight = content.MaxHeight;
2581

    
2582
            double top = (double)content.GetValue(Canvas.TopProperty);
2583
            if (double.IsNaN(top))
2584
                top = 0.0;
2585
            double left = (double)content.GetValue(Canvas.LeftProperty);
2586
            if (double.IsNaN(left))
2587
                left = 0.0;
2588
            SetValue(Canvas.TopProperty, top);
2589
            SetValue(Canvas.LeftProperty, left);
2590

    
2591
            //Set the actual content. Note that "Content" property is a new property. See below
2592
            this.Content = content;
2593
        }
2594
        private void Thumb_DragDelta(object sender, DragDeltaEventArgs e)
2595
        {
2596
            string name = ((Thumb)sender).Name;
2597
            if (name.Contains("Top"))
2598
            {
2599
                double newHeight = this.Height - e.VerticalChange;
2600
                if (newHeight >= minHeight && newHeight <= maxHeight)
2601
                {
2602
                    this.Height = newHeight;
2603
                    SetValue(Canvas.TopProperty,
2604
                (double)GetValue(Canvas.TopProperty) + e.VerticalChange);
2605
                }
2606
            }
2607
            if (name.Contains("Right"))
2608
            {
2609
                double newWidth = this.Width + e.HorizontalChange;
2610
                if (newWidth >= minWidth && newWidth <= maxWidth)
2611
                    this.Width = newWidth;
2612
            }
2613
            if (name.Contains("Bottom"))
2614
            {
2615
                double newHeight = this.Height + e.VerticalChange;
2616
                if (newHeight >= minHeight && newHeight <= maxHeight)
2617
                    this.Height = newHeight;
2618
            }
2619
            if (name.Contains("Left"))
2620
            {
2621
                double newWidth = this.Width - e.HorizontalChange;
2622
                if (newWidth >= minWidth && newWidth <= maxWidth)
2623
                {
2624
                    this.Width = newWidth;
2625
                    SetValue(Canvas.LeftProperty,
2626
                (double)GetValue(Canvas.LeftProperty) + e.HorizontalChange);
2627
                }
2628
            }
2629
        }
2630

    
2631
        private void drawControlBorder(object sender)
2632
        {
2633
            System.Windows.Controls.Control control = (System.Windows.Controls.Control)sender;
2634
        }
2635

    
2636
        private void ResizeThumb_DragDelta(object sender, MouseButtonEventArgs e)
2637
        {
2638
            System.Windows.Controls.Control designerItem = (System.Windows.Controls.Control)sender;
2639
            if (designerItem != null)
2640
            {
2641
                double deltaVertical, deltaHorizontal;
2642

    
2643
                switch (VerticalAlignment)
2644
                {
2645
                    case VerticalAlignment.Bottom:
2646
                        deltaVertical = designerItem.ActualHeight - designerItem.MinHeight;
2647
                        designerItem.Height -= deltaVertical;
2648
                        break;
2649
                    case VerticalAlignment.Top:
2650
                        deltaVertical = designerItem.ActualHeight - designerItem.MinHeight;
2651
                        Canvas.SetTop(designerItem, Canvas.GetTop(designerItem) + deltaVertical);
2652
                        designerItem.Height -= deltaVertical;
2653
                        break;
2654
                    default:
2655
                        break;
2656
                }
2657

    
2658
                switch (HorizontalAlignment)
2659
                {
2660
                    case HorizontalAlignment.Left:
2661
                        deltaHorizontal = designerItem.ActualWidth - designerItem.MinWidth;
2662
                        Canvas.SetLeft(designerItem, Canvas.GetLeft(designerItem) + deltaHorizontal);
2663
                        designerItem.Width -= deltaHorizontal;
2664
                        break;
2665
                    case HorizontalAlignment.Right:
2666
                        deltaHorizontal = designerItem.ActualWidth - designerItem.MinWidth;
2667
                        designerItem.Width -= deltaHorizontal;
2668
                        break;
2669
                    default:
2670
                        break;
2671
                }
2672
            }
2673
            e.Handled = true;
2674
        }
2675

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

    
2678
        void ExportMethod()
2679
        {
2680
            //FileDialogFilter filterImage = new FileDialogFilter("Image Files", "*.jpg", "*.png");
2681
            SaveDig.Filter = "PDF file format|*.pdf";
2682
            SaveDig.Title = "Save an DWG File";
2683
            SaveDig.ShowDialog();
2684
        }
2685

    
2686
        private void cbAutoSave_Checked(object sender, RoutedEventArgs e)
2687
        {            
2688
            if (cbAutoSave.IsChecked == true)
2689
            {
2690
                SaveTime(true, (int)cbSaveInterval.Value);
2691
            }
2692
            else
2693
            {
2694
                SaveTime(false, (int)cbSaveInterval.Value);
2695
            }
2696
        }
2697
        private void cbSaveInterval_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
2698
        {
2699
            if(string.IsNullOrEmpty(cbSaveInterval.Value.ToString()))
2700
            {
2701
                cbSaveInterval.Value = cbSaveInterval.Minimum;
2702
            }
2703
            if (cbAutoSave.IsChecked == true)
2704
            {
2705
                SaveTime(true, (int)cbSaveInterval.Value);
2706
            }
2707

    
2708
            KCOM.Properties.Settings.Default.SaveInterval = (double)cbSaveInterval.Value;
2709
            Properties.Settings.Default.Save();
2710
        }
2711
        //강인구 자동 저장 추가
2712
        private void AutoSave(object sender, RoutedEventArgs e)
2713
        {
2714
            RadToggleButton instanceToggle = sender as RadToggleButton;
2715

    
2716
            if(instanceToggle.IsChecked == true)
2717
            {
2718
                SaveTime(true);
2719
            }
2720
            else
2721
            {
2722
                SaveTime(false);
2723
            }
2724
        }
2725

    
2726
        public void Copy_Start()
2727
        {
2728
            if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
2729
            {
2730
                string MarkupData = "";
2731

    
2732
                foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
2733
                {
2734
                    if (item.GetType().Name == "AdornerFinal")
2735
                    {
2736
                        foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
2737

    
2738
                        {
2739
                            if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
2740
                            {
2741
                                markupReturn = layer.MarkupToString(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo, App.ViewInfo.UserID);
2742
                                MarkupData += "|OR|" + markupReturn.ConvertData;
2743
                            }
2744
                        }
2745
                        Clipboard.SetText(MarkupData);
2746
                    }
2747
                }
2748
            }
2749
        }
2750

    
2751
        public void Cut_Start()
2752
        {
2753
            if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
2754
            {
2755
                foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
2756
                {
2757
                    string MarkupData = "";
2758

    
2759
                    if (item.GetType().Name == "AdornerFinal")
2760
                    {
2761
                        foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
2762
                        {
2763
                            if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
2764
                            {
2765
                                markupReturn = layer.MarkupToString(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo, App.ViewInfo.UserID);
2766
                                MarkupData += "|OR|" + markupReturn.ConvertData;
2767
                            }
2768
                        }
2769
                        //클립보드에 넣음
2770
                        Clipboard.SetText(MarkupData);
2771
                    }
2772
                }
2773
                this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Clear();
2774
            }
2775
        }
2776

    
2777
        public void Paste_Start()
2778
        {
2779
            //마크업 붙여넣기
2780
            //if (Clipboard.GetText().Contains("|DZ|"))
2781
            if (Clipboard.GetText().Contains("|OR||DZ|"))
2782
            {
2783
                List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>();
2784

    
2785
                string[] delimiterChars = { "|OR|" };
2786
                string[] data = Clipboard.GetText().Split(delimiterChars, StringSplitOptions.RemoveEmptyEntries);
2787

    
2788
                this.ParentOfType<MainWindow>().dzMainMenu.ReleaseAdorner();
2789

    
2790
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
2791

    
2792
                //강인구 Undo/Redo 보류
2793
                UndoData = new Undo_data()
2794
                {
2795
                    IsUndo = false,
2796
                    Event = Event_Type.Create,
2797
                    EventTime = DateTime.Now,
2798
                    Markup_List = new List<Multi_Undo_data>()
2799
                };
2800

    
2801
                ViewerDataModel.Instance.UndoDataList.Where(data1 => data1.IsUndo == true).ToList().ForEach(i =>
2802
                {
2803
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
2804
                });
2805

    
2806
                foreach (string parse in data)
2807
                {
2808
                    if (parse != "")
2809
                    {
2810
                        System.Windows.Controls.Control item = layer.markupParse_Paste(parse, ViewerDataModel.Instance.MarkupControls_USER);
2811
                        (item as MarkupToPDF.Common.CommentUserInfo).CommentID = Events.Save.shortGuid();
2812

    
2813
                        ViewerDataModel.Instance.MarkupControls.Remove(item as MarkupToPDF.Common.CommentUserInfo);
2814
                        ViewerDataModel.Instance.MarkupControls_USER.Remove(item as MarkupToPDF.Common.CommentUserInfo);
2815

    
2816
                        adornerSet.Add(item as MarkupToPDF.Common.CommentUserInfo);
2817

    
2818
                        //Controls.AdornerFinal final = new Controls.AdornerFinal(item as MarkupToPDF.Common.CommentUserInfo);
2819
                        //this.dzMainMenu.SelectLayer.Children.Add(final);
2820

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

    
2823
                        UndoData.Markup_List.Add(multi_Undo_Data);
2824
                        ViewerDataModel.Instance.UndoDataList.Add(UndoData);                        
2825
                    }
2826
                }
2827
                Controls.AdornerFinal final = new Controls.AdornerFinal(adornerSet);
2828

    
2829
                if(this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.X < 0)
2830
                {
2831
                    Canvas.SetLeft(final, 0);
2832
                    Canvas.SetTop(final, 0);
2833
                }
2834
                else
2835
                {
2836
                    double realPointX = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.X - final.BorderSize.X - (final.BorderSize.Width / 2);
2837
                    double realPointY = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.Y - final.BorderSize.Y - (final.BorderSize.Height / 2);
2838
                    final.MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(realPointX, realPointY));
2839

    
2840
                    if (final.MemberSet.Where(type => type.Drawingtype == MarkupToPDF.Controls.Common.ControlType.TextControl).FirstOrDefault() != null)
2841
                    {
2842
                        final.MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(0.001, 0.001)); //dummy
2843
                    }
2844

    
2845
                }
2846
                
2847

    
2848
                this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Add(final);
2849

    
2850
                //붙여 넣을때 원본 컨트롤과 겹치지 않도록 설정
2851
                //Canvas.SetLeft(final, 50);
2852
                //Canvas.SetTop(final, 50);
2853
            }
2854
            //외부 이미지 붙여넣기
2855
            else if (Clipboard.GetImage() != null)
2856
            {
2857
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
2858

    
2859
                //강인구 Undo/Redo 보류
2860
                UndoData = new Undo_data()
2861
                {
2862
                    IsUndo = false,
2863
                    Event = Event_Type.Create,
2864
                    EventTime = DateTime.Now,
2865
                    Markup_List = new List<Multi_Undo_data>()
2866
                };
2867

    
2868

    
2869
                string temppath = System.IO.Path.GetTempPath();
2870
                //string filename = KCOM.Events.Save.shortCommentKey();
2871
                string filename = KCOM.Events.Save.shortFileKey();
2872

    
2873
                System.Drawing.Image clipboardImage = System.Windows.Forms.Clipboard.GetImage();
2874
                clipboardImage.Save(temppath + "\\" + filename);
2875

    
2876
                System.IO.FileInfo fileInfo = new System.IO.FileInfo(temppath + "\\" + filename);
2877
                String strFile = System.IO.Path.GetFileName(fileInfo.FullName);
2878
                long numByte = fileInfo.Length;
2879
                double dLen = Convert.ToDouble(fileInfo.Length / 1000000);
2880
                kr.co.devdoftech.cloud.FileUpload fileUploader = new kr.co.devdoftech.cloud.FileUpload();
2881

    
2882
                if (dLen < 4)
2883
                {
2884
                    System.IO.FileStream fStream = new System.IO.FileStream(fileInfo.FullName,
2885
                    System.IO.FileMode.Open, System.IO.FileAccess.Read);
2886
                    System.IO.BinaryReader br = new System.IO.BinaryReader(fStream);
2887
                    byte[] data = br.ReadBytes((int)numByte);
2888

    
2889
                    filename = fileUploader.Run(App.ViewInfo.ProjectNO, this.ParentOfType<MainWindow>().dzMainMenu._DocItem.DOCUMENT_NO, App.ViewInfo.UserID, strFile + ".png", data);
2890
                    br.Close();
2891
                    fStream.Close();
2892
                    fStream.Dispose();
2893
                }
2894
                else
2895
                {
2896
                    this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert("Available Memory less than 4 mega byte", "Alert");
2897
                    return;
2898
                }
2899

    
2900
                fileInfo.Delete();
2901

    
2902
                //System.Drawing.Image clipboardImage = System.Windows.Forms.Clipboard.GetImage();
2903
                System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(clipboardImage);
2904
                IntPtr hBitmap = bmp.GetHbitmap();
2905
                System.Windows.Media.ImageSource WpfBitmap = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(hBitmap, IntPtr.Zero, Int32Rect.Empty, System.Windows.Media.Imaging.BitmapSizeOptions.FromEmptyOptions());
2906
                Image img = new Image();
2907
                //img.Source = new System.Windows.Media.Imaging.BitmapImage(new Uri(filename));
2908
                if (filename.Contains(".svg"))
2909
                {
2910
                    byte[] imageData = null;
2911
                    DrawingImage image = null;
2912
                    using (System.Net.WebClient web = new System.Net.WebClient())
2913
                    {
2914
                        imageData = web.DownloadData(new Uri(filename));
2915
                        System.IO.Stream stream = new System.IO.MemoryStream(imageData);
2916
                        image = SvgReader.Load(stream);
2917
                    }
2918
                    img.Source = image;
2919
                }
2920
                else
2921
                {
2922
                    img.Source = new BitmapImage(new Uri(filename));
2923
                }
2924

    
2925
                var currentControl = new MarkupToPDF.Controls.Etc.ImgControl
2926
                {
2927
                    PointSet = new List<Point>(),
2928
                    //FilePath = img.Source.ToString(),
2929
                    FilePath = filename,
2930
                    ImageData = img.Source,
2931
                    StartPoint = new Point(100, 100),
2932
                    EndPoint = new Point(200, 200),
2933
                    TopRightPoint = new Point(100, 200),
2934
                    LeftBottomPoint = new Point(200, 100)
2935
                };
2936

    
2937
                currentControl.TopRightPoint = new Point(currentControl.StartPoint.X + clipboardImage.Width, currentControl.StartPoint.Y);
2938
                currentControl.LeftBottomPoint = new Point(currentControl.StartPoint.X, currentControl.StartPoint.Y + clipboardImage.Height);
2939
                currentControl.EndPoint = new Point(currentControl.StartPoint.X + clipboardImage.Width, currentControl.StartPoint.Y + clipboardImage.Height);
2940

    
2941
                currentControl.PointSet = new List<Point>
2942
                                        {
2943
                                            currentControl.StartPoint,
2944
                                            currentControl.LeftBottomPoint,
2945
                                            currentControl.EndPoint,
2946
                                            currentControl.TopRightPoint,
2947
                                        };
2948

    
2949
                multi_Undo_Data = this.ParentOfType<MainWindow>().dzMainMenu.Control_Style(currentControl as MarkupToPDF.Common.CommentUserInfo);
2950
                UndoData.Markup_List.Add(multi_Undo_Data);
2951
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
2952

    
2953
                ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl as MarkupToPDF.Common.CommentUserInfo);
2954
                currentControl.CommentID = Events.Save.shortGuid();
2955

    
2956
                currentControl.ApplyTemplate();
2957
                currentControl.SetImage();
2958

    
2959
                ViewerDataModel.Instance.MarkupControls_USER.Remove(currentControl as MarkupToPDF.Common.CommentUserInfo);
2960
                Controls.AdornerFinal final = new Controls.AdornerFinal(currentControl as MarkupToPDF.Common.CommentUserInfo);
2961
                this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Add(final);
2962

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

    
2967
            }
2968
        }
2969

    
2970
        public void Delete_Start()
2971
        {
2972
            if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
2973
            {
2974
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
2975

    
2976
                UndoData = new Undo_data()
2977
                {
2978
                    IsUndo = false,
2979
                    Event = Event_Type.Delete,
2980
                    EventTime = DateTime.Now,
2981
                    Markup_List = new List<Multi_Undo_data>()
2982
                };
2983

    
2984
                foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
2985
                {
2986
                    if (item.GetType().Name == "AdornerFinal")
2987
                    {
2988
                        (item as Controls.AdornerFinal).unRegister();
2989

    
2990
                        foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
2991
                        {
2992
                            //if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
2993
                            if (!ViewerDataModel.Instance.MarkupControls_USER.Contains(InnerItem.DrawingData))
2994
                            {
2995

    
2996
                                multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
2997
                                UndoData.Markup_List.Add(multi_Undo_Data);
2998
                                multi_Undo_Data = new Multi_Undo_data();
2999

    
3000
                                ViewerDataModel.Instance.MarkupControls.Remove(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo);
3001

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

    
3004
                                ViewerDataModel.Instance.MarkupList_USER.Remove(Item_);
3005

    
3006
                                //임시파일에서도 삭제한다.
3007
                                temp.DelTemp((InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo).CommentID, this.ParentOfType<MainWindow>().dzMainMenu.pageNavigator.CurrentPage.PageNumber.ToString());
3008
                                
3009
                            }
3010
                        }
3011
                    }
3012

    
3013
                    ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
3014
                    {
3015
                        ViewerDataModel.Instance.UndoDataList.Remove(i);
3016
                    });
3017
                    ViewerDataModel.Instance.UndoDataList.Add(UndoData);
3018
                }
3019
            }
3020
            this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Clear();
3021
        }
3022

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