프로젝트

일반

사용자정보

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

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

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

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

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

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

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

    
64
        private void CheckShapeState()
65
        {
66

    
67

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

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

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

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

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

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

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

    
122
            }
123

    
124
        }
125

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

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

    
150
        }
151

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

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

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

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

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

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

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

    
258
        }
259

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
403
                    menu.ChangeCommentReact();
404

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

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

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

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

    
469
            Save save = new Save();
470

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

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

    
482
            //MySelectItem = (menu.gridViewMarkup.SelectedItems.FirstOrDefault() as IKCOM.MarkupInfoItem);
483

    
484

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

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

    
526
            }
527
            catch (Exception ex)
528
            {
529
                this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert(string.Format("세이브 실패:{0}", ex.Message), "Alert");
530
            }
531
        }
532

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

    
551
                }
552
                else
553
                {
554
                    RefactoryCommentReact(menu);
555
                }
556
            }
557

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

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

    
572
            List<IKCOM.MarkupInfoItem> markupinfo = new List<IKCOM.MarkupInfoItem>();
573

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

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

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

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

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

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

    
621
        private List<AdornerMember> GetAdornerItem()
622
        {
623
            List<AdornerMember> AdonerList = new List<AdornerMember>();
624

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

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

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

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

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

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

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

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

    
806

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
1364
            }
1365
        }
1366
        
1367

    
1368
        //public event EventHandler<WindowClosedEventArgs> Closed;
1369

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

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

    
1387
        //    CheckPop.Closed += CheckPop_Closed;
1388
        //    CheckPop.ShowDialog();
1389
        //}
1390

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

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

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

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

    
1442
                isClosed = false;
1443

    
1444
                
1445
                CheckList check = new CheckList();
1446

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

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

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

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

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

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

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

    
1536
            //instanceToggle.IsChecked = false;
1537

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

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

    
1603
        private void Control_Event(object sender, RoutedEventArgs e)
1604
        {
1605

    
1606
        }
1607

    
1608
        #region 대기
1609

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

    
1614
            //if (rotateOffSet > 3)
1615
            //    rotateOffSet = 0;
1616

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

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

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

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

    
1678

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

    
1683

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

    
1695

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

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

    
1705
                instanceMain.dzMainMenu.pageNavigator.setPageChange(data);
1706

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

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

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

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

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

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

    
1751
                        Check_Uri.UriCheck(filepath);
1752

    
1753
                        instanceMain.dzMainMenu.filename = filepath;
1754

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

    
1775
        private void Control_Init(RadToggleButton instanceToggle, object sender)
1776
        {
1777

    
1778
        }
1779

    
1780
        private void ControlEvent(object sender, RoutedEventArgs e)
1781
        {
1782
            RadToggleButton instanceToggle = sender as RadToggleButton;
1783
            var instanceMain = this.ParentOfType<MainWindow>();
1784

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

    
1805
            //if (!instanceMain.IsFreeSelectionMode)
1806
            //{
1807
            //    instanceMain.IsSwingMode = true;
1808
            //}
1809

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

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

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

    
1843

    
1844

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

    
1855
            instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = false;
1856

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

    
2082
                        //instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = true;
2083

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

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

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

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

    
2312

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

    
2333
                        if (this.ParentOfType<MainWindow>().dzMainMenu.currentControl != null)
2334
                        {
2335
                            ViewerDataModel.Instance.MarkupControls_USER.Remove(this.ParentOfType<MainWindow>().dzMainMenu.currentControl);
2336
                            this.ParentOfType<MainWindow>().dzMainMenu.currentControl = null;
2337
                        }
2338

    
2339
                        ViewerDataModel.Instance.SelectedControl = "ImgControl";
2340
                   //     ViewerDataModel.Instance.ControlTag = null;
2341
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ImgControl;
2342

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

    
2356
                            }
2357
                            else
2358
                            {
2359
                                (Application.Current.MainWindow as MainWindow).dzTopMenu.RefactoryCommentReact(menu);
2360
                            }
2361
                        }*/
2362

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

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

    
2424
                            isClosed = false;
2425
                            CadResultViewer check = new CadResultViewer();
2426
                            check.WindowStartupLocation = WindowStartupLocation.CenterScreen;
2427
                            check.Title = "Viewer";
2428
                            check.Show();
2429

    
2430
                            check.Closed += Check_Closed;
2431

    
2432
                        }
2433
                        break;
2434
                    #endregion
2435
                    default:
2436
                        break;
2437
                }
2438
                #endregion
2439
            }
2440
            else
2441
            {
2442

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

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

    
2475
        }
2476

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

    
2503
        }
2504

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

    
2515
            string[] data = new string[0];
2516

    
2517
            int cnt = 0;
2518
            var menu = this.ParentOfType<MainWindow>().dzMainMenu;
2519

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

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

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

    
2545
                if (!string.IsNullOrEmpty(FileName))
2546
                {
2547
                    //  File.WriteAllText(SaveDig.FileName, data);
2548
                    File.WriteAllLines(FileName, data);
2549
                }
2550
            }
2551
        }
2552

    
2553
        private double minHeight;
2554
        private double minWidth;
2555

    
2556
        private double maxHeight;
2557
        private double maxWidth;
2558

    
2559
        public bool CanVResize { get; private set; }
2560
        public bool CanHResize { get; private set; }
2561

    
2562
        public void DesignerComponent(FrameworkElement content)
2563
        {
2564
            this.InitializeComponent();
2565

    
2566
            if (!double.IsNaN(content.Width))
2567
            {
2568
                CanHResize = false;
2569
                this.Width = content.Width;
2570
            }
2571
            else
2572
            {
2573
                CanHResize = true;
2574
                this.Width = 23.0;
2575
            }
2576
            if (!double.IsNaN(content.Height))
2577
            {
2578
                CanVResize = false;
2579
                this.Height = content.Height; ;
2580
            }
2581
            else
2582
            {
2583
                CanVResize = true;
2584
                this.Height = 23.0;
2585
            }
2586

    
2587
            minWidth = content.MinWidth < 10.0 ? 10.0 : content.MinWidth;
2588
            minHeight = content.MinHeight < 10.0 ? 10.0 : content.MinHeight;
2589
            maxWidth = content.MaxWidth;
2590
            maxHeight = content.MaxHeight;
2591

    
2592
            double top = (double)content.GetValue(Canvas.TopProperty);
2593
            if (double.IsNaN(top))
2594
                top = 0.0;
2595
            double left = (double)content.GetValue(Canvas.LeftProperty);
2596
            if (double.IsNaN(left))
2597
                left = 0.0;
2598
            SetValue(Canvas.TopProperty, top);
2599
            SetValue(Canvas.LeftProperty, left);
2600

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

    
2641
        private void drawControlBorder(object sender)
2642
        {
2643
            System.Windows.Controls.Control control = (System.Windows.Controls.Control)sender;
2644
        }
2645

    
2646
        private void ResizeThumb_DragDelta(object sender, MouseButtonEventArgs e)
2647
        {
2648
            System.Windows.Controls.Control designerItem = (System.Windows.Controls.Control)sender;
2649
            if (designerItem != null)
2650
            {
2651
                double deltaVertical, deltaHorizontal;
2652

    
2653
                switch (VerticalAlignment)
2654
                {
2655
                    case VerticalAlignment.Bottom:
2656
                        deltaVertical = designerItem.ActualHeight - designerItem.MinHeight;
2657
                        designerItem.Height -= deltaVertical;
2658
                        break;
2659
                    case VerticalAlignment.Top:
2660
                        deltaVertical = designerItem.ActualHeight - designerItem.MinHeight;
2661
                        Canvas.SetTop(designerItem, Canvas.GetTop(designerItem) + deltaVertical);
2662
                        designerItem.Height -= deltaVertical;
2663
                        break;
2664
                    default:
2665
                        break;
2666
                }
2667

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

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

    
2688
        void ExportMethod()
2689
        {
2690
            //FileDialogFilter filterImage = new FileDialogFilter("Image Files", "*.jpg", "*.png");
2691
            SaveDig.Filter = "PDF file format|*.pdf";
2692
            SaveDig.Title = "Save an DWG File";
2693
            SaveDig.ShowDialog();
2694
        }
2695

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

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

    
2726
            if(instanceToggle.IsChecked == true)
2727
            {
2728
                SaveTime(true);
2729
            }
2730
            else
2731
            {
2732
                SaveTime(false);
2733
            }
2734
        }
2735

    
2736
        public void Copy_Start()
2737
        {
2738
            if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
2739
            {
2740
                string MarkupData = "";
2741

    
2742
                foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
2743
                {
2744
                    if (item.GetType().Name == "AdornerFinal")
2745
                    {
2746
                        foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
2747

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

    
2761
        public void Cut_Start()
2762
        {
2763
            if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
2764
            {
2765
                foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
2766
                {
2767
                    string MarkupData = "";
2768

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

    
2787
        public void Paste_Start()
2788
        {
2789
            //마크업 붙여넣기
2790
            //if (Clipboard.GetText().Contains("|DZ|"))
2791
            if (Clipboard.GetText().Contains("|OR||DZ|"))
2792
            {
2793
                List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>();
2794

    
2795
                string[] delimiterChars = { "|OR|" };
2796
                string[] data = Clipboard.GetText().Split(delimiterChars, StringSplitOptions.RemoveEmptyEntries);
2797

    
2798
                this.ParentOfType<MainWindow>().dzMainMenu.ReleaseAdorner();
2799

    
2800
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
2801

    
2802
                //강인구 Undo/Redo 보류
2803
                UndoData = new Undo_data()
2804
                {
2805
                    IsUndo = false,
2806
                    Event = Event_Type.Create,
2807
                    EventTime = DateTime.Now,
2808
                    Markup_List = new List<Multi_Undo_data>()
2809
                };
2810

    
2811
                ViewerDataModel.Instance.UndoDataList.Where(data1 => data1.IsUndo == true).ToList().ForEach(i =>
2812
                {
2813
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
2814
                });
2815

    
2816
                foreach (string parse in data)
2817
                {
2818
                    if (parse != "")
2819
                    {
2820
                        System.Windows.Controls.Control item = MarkupParser.ParseEx(App.ViewInfo.ProjectNO, parse, ViewerDataModel.Instance.MarkupControls_USER, string.Empty, string.Empty);
2821
                        (item as MarkupToPDF.Common.CommentUserInfo).CommentID = Events.Save.shortGuid();
2822

    
2823
                        ViewerDataModel.Instance.MarkupControls.Remove(item as MarkupToPDF.Common.CommentUserInfo);
2824
                        ViewerDataModel.Instance.MarkupControls_USER.Remove(item as MarkupToPDF.Common.CommentUserInfo);
2825

    
2826
                        adornerSet.Add(item as MarkupToPDF.Common.CommentUserInfo);
2827

    
2828
                        //Controls.AdornerFinal final = new Controls.AdornerFinal(item as MarkupToPDF.Common.CommentUserInfo);
2829
                        //this.dzMainMenu.SelectLayer.Children.Add(final);
2830

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

    
2833
                        UndoData.Markup_List.Add(multi_Undo_Data);
2834
                        ViewerDataModel.Instance.UndoDataList.Add(UndoData);                        
2835
                    }
2836
                }
2837
                Controls.AdornerFinal final = new Controls.AdornerFinal(adornerSet);
2838

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

    
2850
                    if (final.MemberSet.Where(type => type.Drawingtype == MarkupToPDF.Controls.Common.ControlType.TextControl).FirstOrDefault() != null)
2851
                    {
2852
                        final.MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(0.001, 0.001)); //dummy
2853
                    }
2854

    
2855
                }
2856
                
2857

    
2858
                this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Add(final);
2859

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

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

    
2880

    
2881
                    string temppath = System.IO.Path.GetTempPath();
2882
                    //string filename = KCOM.Events.Save.shortCommentKey();
2883
                    string filename = KCOM.Events.Save.shortFileKey();
2884

    
2885
                    System.Drawing.Image clipboardImage = System.Windows.Forms.Clipboard.GetImage();
2886
                    clipboardImage.Save(temppath + "\\" + filename);
2887

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

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

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

    
2913
                    fileInfo.Delete();
2914

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

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

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

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

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

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

    
2969
                    currentControl.ApplyTemplate();
2970
                    currentControl.SetImage();
2971

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

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

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

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

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

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

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

    
3017
                                ViewerDataModel.Instance.MarkupControls.Remove(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo);
3018

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

    
3021
                                ViewerDataModel.Instance.MarkupList_USER.Remove(Item_);
3022

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

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

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