프로젝트

일반

사용자정보

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

markus / KCOM / Events / Implementation / TopMenuEvent.cs @ 29010418

이력 | 보기 | 이력해설 | 다운로드 (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
            System.Threading.Tasks.Task SaveTask = System.Threading.Tasks.Task.Factory.StartNew(() =>
316
            {
317
                Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, new Action<object, RoutedEventArgs>(_SaveEvent), sender, e);
318
            }).ContinueWith(task =>
319
            {
320
                Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate () { this.ParentOfType<MainWindow>().dzMainMenu.busyIndicator.IsBusy = false; }));
321
            });
322
        }
323

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

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

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

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

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

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

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

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

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

    
405
                    menu.ChangeCommentReact();
406

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

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

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

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

    
471
            Save save = new Save();
472

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

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

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

    
486

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
808

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
1366
            }
1367
        }
1368
        
1369

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

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

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

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

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

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

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

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

    
1444
                isClosed = false;
1445

    
1446
                
1447
                CheckList check = new CheckList();
1448

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

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

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

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

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

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

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

    
1538
            //instanceToggle.IsChecked = false;
1539

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

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

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

    
1608
        }
1609

    
1610
        #region 대기
1611

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

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

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

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

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

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

    
1680

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

    
1685

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

    
1697

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

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

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

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

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

    
1728

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

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

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

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

    
1761
        private void Control_Init(RadToggleButton instanceToggle, object sender)
1762
        {
1763

    
1764
        }
1765

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

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

    
1791
            //if (!instanceMain.IsFreeSelectionMode)
1792
            //{
1793
            //    instanceMain.IsSwingMode = true;
1794
            //}
1795

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

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

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

    
1829

    
1830

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

    
1841
            instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = false;
1842

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

    
2068
                        //instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = true;
2069

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

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

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

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

    
2298

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

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

    
2325
                        ViewerDataModel.Instance.SelectedControl = "ImgControl";
2326
                   //     ViewerDataModel.Instance.ControlTag = null;
2327
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ImgControl;
2328

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

    
2342
                            }
2343
                            else
2344
                            {
2345
                                (Application.Current.MainWindow as MainWindow).dzTopMenu.RefactoryCommentReact(menu);
2346
                            }
2347
                        }*/
2348

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

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

    
2410
                            isClosed = false;
2411
                            CadResultViewer check = new CadResultViewer();
2412
                            check.WindowStartupLocation = WindowStartupLocation.CenterScreen;
2413
                            check.Title = "Viewer";
2414
                            check.Show();
2415

    
2416
                            check.Closed += Check_Closed;
2417

    
2418
                        }
2419
                        break;
2420
                    #endregion
2421
                    default:
2422
                        break;
2423
                }
2424
                #endregion
2425
            }
2426
            else
2427
            {
2428

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

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

    
2461
        }
2462

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

    
2489
        }
2490

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

    
2501
            MarkupToPDF.Controls.Parsing.LayerControl layerControl = new MarkupToPDF.Controls.Parsing.LayerControl();
2502
            string[] data = new string[0];
2503

    
2504
            int cnt = 0;
2505
            var menu = this.ParentOfType<MainWindow>().dzMainMenu;
2506

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

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

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

    
2532
                if (!string.IsNullOrEmpty(FileName))
2533
                {
2534
                    //  File.WriteAllText(SaveDig.FileName, data);
2535
                    File.WriteAllLines(FileName, data);
2536
                }
2537
            }
2538
        }
2539

    
2540
        private double minHeight;
2541
        private double minWidth;
2542

    
2543
        private double maxHeight;
2544
        private double maxWidth;
2545

    
2546
        public bool CanVResize { get; private set; }
2547
        public bool CanHResize { get; private set; }
2548

    
2549
        public void DesignerComponent(FrameworkElement content)
2550
        {
2551
            this.InitializeComponent();
2552

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

    
2574
            minWidth = content.MinWidth < 10.0 ? 10.0 : content.MinWidth;
2575
            minHeight = content.MinHeight < 10.0 ? 10.0 : content.MinHeight;
2576
            maxWidth = content.MaxWidth;
2577
            maxHeight = content.MaxHeight;
2578

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

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

    
2628
        private void drawControlBorder(object sender)
2629
        {
2630
            System.Windows.Controls.Control control = (System.Windows.Controls.Control)sender;
2631
        }
2632

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

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

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

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

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

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

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

    
2713
            if(instanceToggle.IsChecked == true)
2714
            {
2715
                SaveTime(true);
2716
            }
2717
            else
2718
            {
2719
                SaveTime(false);
2720
            }
2721
        }
2722

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

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

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

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

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

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

    
2782
                string[] delimiterChars = { "|OR|" };
2783
                string[] data = Clipboard.GetText().Split(delimiterChars, StringSplitOptions.RemoveEmptyEntries);
2784

    
2785
                this.ParentOfType<MainWindow>().dzMainMenu.ReleaseAdorner();
2786

    
2787
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
2788

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

    
2798
                ViewerDataModel.Instance.UndoDataList.Where(data1 => data1.IsUndo == true).ToList().ForEach(i =>
2799
                {
2800
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
2801
                });
2802

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

    
2810
                        ViewerDataModel.Instance.MarkupControls.Remove(item as MarkupToPDF.Common.CommentUserInfo);
2811
                        ViewerDataModel.Instance.MarkupControls_USER.Remove(item as MarkupToPDF.Common.CommentUserInfo);
2812

    
2813
                        adornerSet.Add(item as MarkupToPDF.Common.CommentUserInfo);
2814

    
2815
                        //Controls.AdornerFinal final = new Controls.AdornerFinal(item as MarkupToPDF.Common.CommentUserInfo);
2816
                        //this.dzMainMenu.SelectLayer.Children.Add(final);
2817

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

    
2820
                        UndoData.Markup_List.Add(multi_Undo_Data);
2821
                        ViewerDataModel.Instance.UndoDataList.Add(UndoData);                        
2822
                    }
2823
                }
2824
                Controls.AdornerFinal final = new Controls.AdornerFinal(adornerSet);
2825

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

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

    
2842
                }
2843
                
2844

    
2845
                this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Add(final);
2846

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

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

    
2865

    
2866
                string temppath = System.IO.Path.GetTempPath();
2867
                //string filename = KCOM.Events.Save.shortCommentKey();
2868
                string filename = KCOM.Events.Save.shortFileKey();
2869

    
2870
                System.Drawing.Image clipboardImage = System.Windows.Forms.Clipboard.GetImage();
2871
                clipboardImage.Save(temppath + "\\" + filename);
2872

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

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

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

    
2897
                fileInfo.Delete();
2898

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

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

    
2934
                currentControl.TopRightPoint = new Point(currentControl.StartPoint.X + clipboardImage.Width, currentControl.StartPoint.Y);
2935
                currentControl.LeftBottomPoint = new Point(currentControl.StartPoint.X, currentControl.StartPoint.Y + clipboardImage.Height);
2936
                currentControl.EndPoint = new Point(currentControl.StartPoint.X + clipboardImage.Width, currentControl.StartPoint.Y + clipboardImage.Height);
2937

    
2938
                currentControl.PointSet = new List<Point>
2939
                                        {
2940
                                            currentControl.StartPoint,
2941
                                            currentControl.LeftBottomPoint,
2942
                                            currentControl.EndPoint,
2943
                                            currentControl.TopRightPoint,
2944
                                        };
2945

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

    
2950
                ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl as MarkupToPDF.Common.CommentUserInfo);
2951
                currentControl.CommentID = Events.Save.shortGuid();
2952

    
2953
                currentControl.ApplyTemplate();
2954
                currentControl.SetImage();
2955

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

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

    
2964
            }
2965
        }
2966

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

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

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

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

    
2993
                                multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
2994
                                UndoData.Markup_List.Add(multi_Undo_Data);
2995
                                multi_Undo_Data = new Multi_Undo_data();
2996

    
2997
                                ViewerDataModel.Instance.MarkupControls.Remove(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo);
2998

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

    
3001
                                ViewerDataModel.Instance.MarkupList_USER.Remove(Item_);
3002

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

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

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