프로젝트

일반

사용자정보

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

markus / KCOM / Events / Implementation / TopMenuEvent.cs @ 399976da

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

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

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

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

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

    
64
        private void CheckShapeState()
65
        {
66

    
67

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

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

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

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

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

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

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

    
122
            }
123

    
124
        }
125

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

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

    
150
        }
151

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

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

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

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

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

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

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

    
258
        }
259

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

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

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

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

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

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

    
333
                this.ParentOfType<MainWindow>().dzMainMenu.InkControl_Convert();
334

    
335
                var menu = this.ParentOfType<MainWindow>().dzMainMenu;
336

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

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

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

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

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

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

    
403
                    menu.ChangeCommentReact();
404

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

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

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

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

    
473
            Save save = new Save();
474

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

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

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

    
488

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

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

    
530
            }
531
            catch (Exception ex)
532
            {
533
                this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert(string.Format("세이브 실패:{0}", ex.Message), "Alert");
534
                throw new Exception(); 
535
            }
536
        }
537

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

    
556
                }
557
                else
558
                {
559
                    RefactoryCommentReact(menu);
560
                }
561
            }
562

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

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

    
577
            List<IKCOM.MarkupInfoItem> markupinfo = new List<IKCOM.MarkupInfoItem>();
578

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

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

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

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

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

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

    
626
        private List<AdornerMember> GetAdornerItem()
627
        {
628
            List<AdornerMember> AdonerList = new List<AdornerMember>();
629

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

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

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

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

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

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

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

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

    
811

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
1369
            }
1370
        }
1371
        
1372

    
1373
        //public event EventHandler<WindowClosedEventArgs> Closed;
1374

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

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

    
1392
        //    CheckPop.Closed += CheckPop_Closed;
1393
        //    CheckPop.ShowDialog();
1394
        //}
1395

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

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

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

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

    
1447
                isClosed = false;
1448

    
1449
                
1450
                CheckList check = new CheckList();
1451

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

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

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

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

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

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

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

    
1541
            //instanceToggle.IsChecked = false;
1542

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

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

    
1608
        private void Control_Event(object sender, RoutedEventArgs e)
1609
        {
1610

    
1611
        }
1612

    
1613
        #region 대기
1614

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

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

    
1622
            //if (rotateOffSet < 0)
1623
            //    rotateOffSet = 3;
1624

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

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

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

    
1683

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

    
1688

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

    
1700

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

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

    
1710
                instanceMain.dzMainMenu.pageNavigator.setPageChange(data);
1711

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

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

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

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

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

    
1754
                        string filepath = fileUploader.Run(App.ViewInfo.ProjectNO, instanceMain.dzMainMenu._DocItem.DOCUMENT_NO, App.ViewInfo.UserID, strFile, data);
1755

    
1756
                        Check_Uri.UriCheck(filepath);
1757

    
1758
                        instanceMain.dzMainMenu.filename = filepath;
1759

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

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

    
1783
        }
1784

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

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

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

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

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

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

    
1848

    
1849

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

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

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

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

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

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

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

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

    
2317

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

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

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

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

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

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

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

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

    
2435
                            check.Closed += Check_Closed;
2436

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

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

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

    
2480
        }
2481

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

    
2508
        }
2509

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

    
2520
            string[] data = new string[0];
2521

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

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

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

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

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

    
2558
        private double minHeight;
2559
        private double minWidth;
2560

    
2561
        private double maxHeight;
2562
        private double maxWidth;
2563

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
2805
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
2806

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

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

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

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

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

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

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

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

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

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

    
2860
                }
2861
                
2862

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

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

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

    
2885

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

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

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

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

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

    
2918
                    fileInfo.Delete();
2919

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

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

    
2955
                    currentControl.TopRightPoint = new Point(currentControl.StartPoint.X + clipboardImage.Width, currentControl.StartPoint.Y);
2956
                    currentControl.LeftBottomPoint = new Point(currentControl.StartPoint.X, currentControl.StartPoint.Y + clipboardImage.Height);
2957
                    currentControl.EndPoint = new Point(currentControl.StartPoint.X + clipboardImage.Width, currentControl.StartPoint.Y + clipboardImage.Height);
2958

    
2959
                    currentControl.PointSet = new List<Point>
2960
                                        {
2961
                                            currentControl.StartPoint,
2962
                                            currentControl.LeftBottomPoint,
2963
                                            currentControl.EndPoint,
2964
                                            currentControl.TopRightPoint,
2965
                                        };
2966

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

    
2971
                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl as MarkupToPDF.Common.CommentUserInfo);
2972
                    currentControl.CommentID = Events.Save.shortGuid();
2973

    
2974
                    currentControl.ApplyTemplate();
2975
                    currentControl.SetImage();
2976

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

    
2981
                    double realPointX = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.X - final.BorderSize.X - (final.BorderSize.Width / 2);
2982
                    double realPointY = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.Y - final.BorderSize.Y - (final.BorderSize.Height / 2);
2983
                    final.MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(realPointX, realPointY));
2984
                }
2985
                catch(Exception ex)
2986
                {
2987
                    this.ParentOfType<MainWindow>().DialogMessage_Alert("" + ex, "Alert");
2988
                }
2989
            }
2990
        }
2991

    
2992
        public void Delete_Start()
2993
        {
2994
            if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
2995
            {
2996
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
2997

    
2998
                UndoData = new Undo_data()
2999
                {
3000
                    IsUndo = false,
3001
                    Event = Event_Type.Delete,
3002
                    EventTime = DateTime.Now,
3003
                    Markup_List = new List<Multi_Undo_data>()
3004
                };
3005

    
3006
                foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
3007
                {
3008
                    if (item.GetType().Name == "AdornerFinal")
3009
                    {
3010
                        (item as Controls.AdornerFinal).unRegister();
3011

    
3012
                        foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
3013
                        {
3014
                            //if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
3015
                            if (!ViewerDataModel.Instance.MarkupControls_USER.Contains(InnerItem.DrawingData))
3016
                            {
3017

    
3018
                                multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
3019
                                UndoData.Markup_List.Add(multi_Undo_Data);
3020
                                multi_Undo_Data = new Multi_Undo_data();
3021

    
3022
                                ViewerDataModel.Instance.MarkupControls.Remove(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo);
3023

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

    
3026
                                ViewerDataModel.Instance.MarkupList_USER.Remove(Item_);
3027

    
3028
                                //임시파일에서도 삭제한다.
3029
                                TempFile.DelTemp((InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo).CommentID, this.ParentOfType<MainWindow>().dzMainMenu.pageNavigator.CurrentPage.PageNumber.ToString());
3030
                                
3031
                            }
3032
                        }
3033
                    }
3034

    
3035
                    ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
3036
                    {
3037
                        ViewerDataModel.Instance.UndoDataList.Remove(i);
3038
                    });
3039
                    ViewerDataModel.Instance.UndoDataList.Add(UndoData);
3040
                }
3041
            }
3042
            this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Clear();
3043
        }
3044

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