프로젝트

일반

사용자정보

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

markus / KCOM / Events / Implementation / TopMenuEvent.cs @ 08a73330

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

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

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

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

    
474
            Save save = new Save();
475

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

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

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

    
489

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
812

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
1370
            }
1371
        }
1372
        
1373

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

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

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

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

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

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

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

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

    
1448
                isClosed = false;
1449

    
1450
                
1451
                CheckList check = new CheckList();
1452

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

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

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

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

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

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

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

    
1542
            //instanceToggle.IsChecked = false;
1543

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

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

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

    
1612
        }
1613

    
1614
        #region 대기
1615

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

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

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

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

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

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

    
1684

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

    
1689

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

    
1701

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

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

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

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

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

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

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

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

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

    
1757
                        Check_Uri.UriCheck(filepath);
1758

    
1759
                        instanceMain.dzMainMenu.filename = filepath;
1760

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

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

    
1784
        }
1785

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

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

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

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

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

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

    
1849

    
1850

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

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

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

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

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

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

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

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

    
2318

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

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

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

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

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

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

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

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

    
2436
                            check.Closed += Check_Closed;
2437

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

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

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

    
2481
        }
2482

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

    
2509
        }
2510

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

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

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

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

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

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

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

    
2559
        private double minHeight;
2560
        private double minWidth;
2561

    
2562
        private double maxHeight;
2563
        private double maxWidth;
2564

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
2806
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
2807

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

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

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

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

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

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

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

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

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

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

    
2861
                }
2862
                
2863

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

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

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

    
2886

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

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

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

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

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

    
2919
                    fileInfo.Delete();
2920

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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