프로젝트

일반

사용자정보

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

markus / KCOM / Events / Implementation / TopMenuEvent.cs @ 43e1d368

이력 | 보기 | 이력해설 | 다운로드 (156 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
using Telerik.Windows.Data;
25
using System.ComponentModel;
26
using System.Web;
27
using Markus.Fonts;
28
using System.Threading.Tasks;
29

    
30
namespace KCOM.Views
31
{
32
    public partial class TopMenu : UserControl
33
    {
34
        public int rotateOffSet = 0;
35
        private double[] rotateValue = { 0, 90, 180, 270 };
36
        public System.Windows.Threading.DispatcherTimer SaveTimer { get; set; }
37
        public bool isClosed = true;
38
        public RadWindow CheckPop;
39
        public RadWindow OptionPop;
40

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

    
59
        /// <summary>
60
        /// Task Type명을 Key값으로 지정합니다
61
        /// </summary>
62
        public enum TaskMessageType
63
        {
64
            Normal,
65
            Caption,
66
            Error,
67
        }
68

    
69
        private void CheckShapeState()
70
        {
71

    
72

    
73
            if (cbHatchShape.IsChecked == true)
74
            {
75
                cbFillShape.IsChecked = false;
76
                ViewerDataModel.Instance.paintSet = MarkupToPDF.Controls.Common.PaintSet.Hatch;
77
            }
78
            else if(cbFillShape.IsChecked == true)
79
            {
80
                cbHatchShape.IsChecked = false;
81
                ViewerDataModel.Instance.paintSet = MarkupToPDF.Controls.Common.PaintSet.Fill;
82
            }
83
            else
84
            {
85
                ViewerDataModel.Instance.paintSet = MarkupToPDF.Controls.Common.PaintSet.None;
86
            }
87
        }
88

    
89
        /// <summary>
90
        ///  comment의 속성 변경시 저장여부 확인 하도록 undocommand에 추가
91
        /// </summary>
92
        /// <param name="adnoerFinal"></param>
93
        public void ChangeComment(Controls.AdornerFinal adnoerFinal)
94
        {
95
            var adornerMembers = adnoerFinal.Members.Cast<Controls.AdornerMember>();
96

    
97
            if (adornerMembers.Count() > 0)
98
            {
99
                UndoCommand.Instance.Push(adornerMembers.Select(x => x.DrawingData).Cast<CommentUserInfo>().ToList(), adnoerFinal.AngleValue);
100
            }
101
        }
102

    
103
        //강인구 추가(Undo End)
104
        private void SetPaintEvent()
105
        {
106
            List<AdornerMember> AdonerList = GetAdornerItem();
107

    
108
            if (AdonerList.Count > 0)
109
            {
110
                Undo_data UndoData = new Undo_data()
111
                {
112
                    IsUndo = false,
113
                    Event = Event_Type.Option,
114
                    EventTime = DateTime.Now,
115
                    paint = ViewerDataModel.Instance.paintSet,
116
                    Markup_List = new List<Multi_Undo_data>()
117
                };
118
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
119

    
120
                foreach (AdornerMember InnerItem in AdonerList)
121
                {
122
                    multi_Undo_Data.PointSet = new List<Point>();
123

    
124
                    if ((InnerItem.DrawingData as MarkupToPDF.Controls.Common.IShapeControl) != null)
125
                    {
126
                        (InnerItem.DrawingData as MarkupToPDF.Controls.Common.IShapeControl).Paint = ViewerDataModel.Instance.paintSet;
127
                    }
128

    
129
                    multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
130
                    UndoData.Markup_List.Add(multi_Undo_Data);
131
                    multi_Undo_Data = new Multi_Undo_data();
132
                }
133

    
134
                ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
135
                {
136
                    ViewerDataModel.Instance.UndoDataList.Remove(i);                    
137
                });
138
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
139
            }
140
        }
141

    
142
        private void SetHighlightEvent()
143
        {
144
            List<AdornerMember> AdonerList = GetAdornerItem();
145

    
146
            if (AdonerList.Count > 0)
147
            {
148
                foreach (AdornerMember InnerItem in AdonerList)
149
                {
150
                    switch (InnerItem.DrawingData.GetType().Name)
151
                    {
152
                        case ("TextControl"):
153
                            {
154
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).IsHighLight = ViewerDataModel.Instance.checkHighShape;
155
                            }
156
                            break;
157
                        case ("ArrowTextControl"):
158
                            {
159
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape;
160
                            }
161
                            break;
162
                    }
163
                }
164

    
165
                ViewerDataModel.Instance.IsMarkupUpdate = true;
166
            }
167

    
168
        }
169

    
170
        private void FillShapeEvent(object sender, RoutedEventArgs e)
171
        {
172
            #region 주석
173
            //if ((sender as CheckBox).IsChecked.Value)
174
            //{
175
            //    cbHatchShape.IsChecked = false;
176
            //    imgShape_RectCloud.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/RectCloud_Fill.png", UriKind.Relative));
177
            //    imgShape_Cloud.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/Cloud_Fill.png", UriKind.Relative));
178
            //    imgShape_Rect.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/Rectangle_Fill.png", UriKind.Relative));
179
            //    imgShape_Tri.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/triangle-icon.png", UriKind.Relative));
180
            //    imgShape_Cicle.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/circle-icon.png", UriKind.Relative));
181
            //    imgShape_Poly.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/polygon_Fill.png", UriKind.Relative));
182
            //    TaskMessage("채우기 옵션이 적용되었습니다", TaskMessageType.Normal);
183
            //}
184
            //else
185
            //{
186

    
187
            //    imgShape_RectCloud.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/RectCloud.png", UriKind.Relative));
188
            //    imgShape_Cloud.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/Cloud.png", UriKind.Relative));
189
            //    imgShape_Rect.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/Rectangle.png", UriKind.Relative));
190
            //    imgShape_Tri.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/triangle-icon_None.png", UriKind.Relative));
191
            //    imgShape_Cicle.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/circle-icon_None.png", UriKind.Relative));
192
            //    imgShape_Poly.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/polygon.png", UriKind.Relative));
193
            //    TaskMessage("채우기 옵션이 해제되었습니다", TaskMessageType.Caption);
194
            //}
195
            #endregion
196
            ViewerDataModel.Instance.checkFillShape = (sender as CheckBox).IsChecked.Value;
197

    
198
            if (ViewerDataModel.Instance.checkFillShape)
199
            {
200
                cbHatchShape.IsChecked = false;
201
                ViewerDataModel.Instance.paintSet = MarkupToPDF.Controls.Common.PaintSet.Fill;
202
            }
203
            else
204
            {
205
                ViewerDataModel.Instance.paintSet = MarkupToPDF.Controls.Common.PaintSet.None;
206
            }
207
            SetPaintEvent();
208
        }
209

    
210
        /// <summary>
211
        /// 도형 빗금 처리
212
        /// </summary>
213
        /// <param name="sender"></param>
214
        /// <param name="e"></param>
215
        private void HatchShapeEvent(object sender, RoutedEventArgs e)
216
        {
217
			#region 주석
218
            //if ((sender as CheckBox).IsChecked.Value)
219
            //{
220
            //    cbFillShape.IsChecked = false;
221
            //    imgShape_RectCloud.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/RectCloud_Hatch.png", UriKind.Relative));
222
            //    imgShape_Cloud.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/Cloud_Hatch.png", UriKind.Relative));
223
            //    imgShape_Rect.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/rectangle-icon_Hatch.png", UriKind.Relative));
224
            //    imgShape_Tri.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/triangle-icon_Hatch.png", UriKind.Relative));
225
            //    imgShape_Cicle.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/circle-icon_Hatch.png", UriKind.Relative));
226
            //    imgShape_Poly.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/polygon_hatch.png", UriKind.Relative));
227
            //    TaskMessage("무늬 옵션이 적용되었습니다", TaskMessageType.Normal);
228
            //}
229
            //else
230
            //{
231
            //    imgShape_RectCloud.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/RectCloud.png", UriKind.Relative));
232
            //    imgShape_Cloud.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/Cloud.png", UriKind.Relative));
233
            //    imgShape_Rect.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/Rectangle.png", UriKind.Relative));
234
            //    imgShape_Tri.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/triangle-icon_None.png", UriKind.Relative));
235
            //    imgShape_Cicle.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/circle-icon_None.png", UriKind.Relative));
236
            //    imgShape_Poly.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/polygon.png", UriKind.Relative));
237
            //    TaskMessage("무늬 옵션이 해제되었습니다", TaskMessageType.Caption);
238
            //} 
239
            #endregion
240

    
241
            //강인구 추가
242
            ViewerDataModel.Instance.checkHatchShape = (sender as CheckBox).IsChecked.Value;
243
            if (ViewerDataModel.Instance.checkHatchShape)
244
            {
245
                cbFillShape.IsChecked = false;
246
                ViewerDataModel.Instance.paintSet = MarkupToPDF.Controls.Common.PaintSet.Hatch;
247
            }
248
            else
249
            {
250
                ViewerDataModel.Instance.paintSet = MarkupToPDF.Controls.Common.PaintSet.None;  
251
            }
252
            SetPaintEvent();
253
        }
254

    
255
        void SaveTimer_Tick(object sender, EventArgs e)
256
        {
257
            //if (this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode != IKCOM.MouseHandlingMode.Drawing)
258
            if (this.ParentOfType<MainWindow>().dzMainMenu.currentControl == null && this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count == 0)
259
            {
260
                SaveEventCallback(null, null);
261
            }
262
        }
263

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

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

    
296
            if (IsRun)
297
            {
298
                SaveTimer.Start();
299
            }
300
            else
301
            {
302
                SaveTimer.Stop();
303
            }
304
        }
305
        /// <summary>
306
        /// enable busy indicator and then call _SaveEvent method.
307
        /// </summary>
308
        /// <param name="sender"></param>
309
        /// <param name="e"></param>
310
        public async void SaveEventCallback(object sender, RoutedEventArgs e)
311
        {
312
            var mianMenu = this.ParentOfType<MainWindow>().dzMainMenu;
313

    
314
            if (mianMenu.busyIndicator.IsBusy == true)
315
            {
316
                return;
317
            }
318

    
319
            //var result = await Dispatcher.InvokeAsync<bool>(()=>
320
            //{
321
                this.ParentOfType<MainWindow>().dzMainMenu.busyIndicator.IsBusy = true;
322

    
323
                _SaveEvent(sender, e);
324

    
325
                mianMenu.busyIndicator.IsBusy = false;
326
               
327
            //});
328

    
329
            //System.Threading.Tasks.Task SaveTask = System.Threading.Tasks.Task.Factory.StartNew(() =>
330
            //{
331
            //    Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, new Action<object, RoutedEventArgs>(_SaveEvent), sender, e);
332
            //}).ContinueWith(task =>
333
            //{
334
            //    Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate () { this.ParentOfType<MainWindow>().dzMainMenu.busyIndicator.IsBusy = false; }));
335
            //});
336
        }
337

    
338
        /// <summary>
339
        /// save markup
340
        ///  - convert ink control to polygon control if ink control exists
341
        ///  - unselect and update my markup list
342
        /// <param name="sender"></param>
343
        /// <param name="e"></param>
344
        public bool _SaveEvent(object sender, RoutedEventArgs e)
345
        {
346
            bool result = false;
347

    
348
            var mainMenu = this.ParentOfType<MainWindow>().dzMainMenu;
349
            try
350
            {
351
                mainMenu.ConvertInkControlToPolygon();
352

    
353
                SelectionSet.Instance.UnSelect(this.ParentOfType<MainWindow>().dzMainMenu);
354
                // update mylist and gridview
355
                mainMenu.UpdateMyMarkupList();
356

    
357
                if (mainMenu.gridViewMarkup.SelectedItems.Count == 0 && mainMenu.gridViewMarkup.Items.Count > 0)
358
                {
359
                    this.ParentOfType<MainWindow>().DialogMessage_Alert("Please Select Your Comment List Item", "Alert");
360
                }
361
                else
362
                {                    
363
                    foreach (var item in mainMenu.gridViewMarkup.SelectedItems)
364
                    {
365
                        if ((item as IKCOM.MarkupInfoItem).UserID == App.ViewInfo.UserID)
366
                        {
367
                            /// 저장 서비스 호출
368
                            this.ExecuteSaveCommandAsync(mainMenu);
369

    
370
                            ViewerDataModel.Instance._markupInfoList.Where(data => data.MarkupInfoID == (item as IKCOM.MarkupInfoItem).MarkupInfoID).FirstOrDefault().UpdateTime = DateTime.Now;
371
                            if (!ViewerDataModel.Instance.IsConsolidate && (sender != null))
372
                            {
373
                                this.ParentOfType<MainWindow>().DialogMessage_Alert("Save is complete.", "Info");
374
                                
375
                            }
376

    
377
                            result = true;
378
                        }
379
                    }
380
                }
381

    
382
                mainMenu.SetCommentPages(null);
383

    
384
                ViewerDataModel.Instance.UndoDataList.Clear();
385
            }
386
            catch (Exception ex)
387
            {
388
                System.Diagnostics.Debug.WriteLine("_SaveEvent Error : " + ex.ToString());
389
            }
390
            finally
391
            {
392
                /*
393
                /// delete markup information when 코멘트가 없을 경우
394
                if (ViewerDataModel.Instance.MyMarkupList.Count == 0)
395
                {
396
                    foreach (var item in menu.gridViewMarkup.SelectedItems)
397
                    {
398
                        if ((item as IKCOM.MarkupInfoItem).UserID == App.ViewInfo.UserID)
399
                        {
400
                            //this.ParentOfType<MainWindow>().dzMainMenu.DeleteItem((item as IKCOM.MarkupInfoItem));
401
                        }
402
                    }
403
                }
404
                */
405
            }
406

    
407
            return result;
408
        }
409

    
410
        public async Task<bool>  SaveEventAsync()
411
        {
412
            bool result = false;
413

    
414
            var mainMenu = this.ParentOfType<MainWindow>().dzMainMenu;
415
            try
416
            {
417
                mainMenu.ConvertInkControlToPolygon();
418

    
419
                SelectionSet.Instance.UnSelect(this.ParentOfType<MainWindow>().dzMainMenu);
420
                // update mylist and gridview
421
                mainMenu.UpdateMyMarkupList();
422

    
423
                if (mainMenu.gridViewMarkup.SelectedItems.Count == 0 && mainMenu.gridViewMarkup.Items.Count > 0)
424
                {
425
                    this.ParentOfType<MainWindow>().DialogMessage_Alert("Please Select Your Comment List Item", "Alert");
426
                }
427
                else
428
                {
429
                    foreach (var item in mainMenu.gridViewMarkup.SelectedItems)
430
                    {
431
                        if ((item as IKCOM.MarkupInfoItem).UserID == App.ViewInfo.UserID)
432
                        {
433
                            /// 저장 서비스 호출
434
                            result = await this.ExecuteSaveCommandAsync(mainMenu);
435

    
436
                            ViewerDataModel.Instance._markupInfoList.Where(data => data.MarkupInfoID == (item as IKCOM.MarkupInfoItem).MarkupInfoID).FirstOrDefault().UpdateTime = DateTime.Now;
437
                        }
438
                    }
439
                }
440

    
441
                mainMenu.SetCommentPages(null);
442

    
443
                ViewerDataModel.Instance.UndoDataList.Clear();
444
                result = true;
445
            }
446
            catch (Exception ex)
447
            {
448
                System.Diagnostics.Debug.WriteLine("_SaveEvent Error : " + ex.ToString());
449
            }
450
            finally
451
            {
452
                /*
453
                /// delete markup information when 코멘트가 없을 경우
454
                if (ViewerDataModel.Instance.MyMarkupList.Count == 0)
455
                {
456
                    foreach (var item in menu.gridViewMarkup.SelectedItems)
457
                    {
458
                        if ((item as IKCOM.MarkupInfoItem).UserID == App.ViewInfo.UserID)
459
                        {
460
                            //this.ParentOfType<MainWindow>().dzMainMenu.DeleteItem((item as IKCOM.MarkupInfoItem));
461
                        }
462
                    }
463
                }
464
                */
465
            }
466

    
467
            return result;
468
        }
469

    
470
        public bool SaveEvent()
471
        {
472
            bool result = false;
473

    
474
            var mainMenu = this.ParentOfType<MainWindow>().dzMainMenu;
475
            try
476
            {
477
                mainMenu.ConvertInkControlToPolygon();
478

    
479
                SelectionSet.Instance.UnSelect(this.ParentOfType<MainWindow>().dzMainMenu);
480
                // update mylist and gridview
481
                mainMenu.UpdateMyMarkupList();
482

    
483
                if (mainMenu.gridViewMarkup.SelectedItems.Count == 0 && mainMenu.gridViewMarkup.Items.Count > 0)
484
                {
485
                    this.ParentOfType<MainWindow>().DialogMessage_Alert("Please Select Your Comment List Item", "Alert");
486
                }
487
                else
488
                {
489
                    foreach (var item in mainMenu.gridViewMarkup.SelectedItems)
490
                    {
491
                        if ((item as IKCOM.MarkupInfoItem).UserID == App.ViewInfo.UserID)
492
                        {
493
                            /// 저장 서비스 호출
494
                            result = this.ExecuteSaveCommandAsync(mainMenu).GetAwaiter().GetResult();
495

    
496
                            ViewerDataModel.Instance._markupInfoList.Where(data => data.MarkupInfoID == (item as IKCOM.MarkupInfoItem).MarkupInfoID).FirstOrDefault().UpdateTime = DateTime.Now;
497
                        }
498
                    }
499
                }
500

    
501
                mainMenu.SetCommentPages(null);
502

    
503
                ViewerDataModel.Instance.UndoDataList.Clear();
504
                result = true;
505
            }
506
            catch (Exception ex)
507
            {
508
                System.Diagnostics.Debug.WriteLine("_SaveEvent Error : " + ex.ToString());
509
            }
510
            finally
511
            {
512
                /*
513
                /// delete markup information when 코멘트가 없을 경우
514
                if (ViewerDataModel.Instance.MyMarkupList.Count == 0)
515
                {
516
                    foreach (var item in menu.gridViewMarkup.SelectedItems)
517
                    {
518
                        if ((item as IKCOM.MarkupInfoItem).UserID == App.ViewInfo.UserID)
519
                        {
520
                            //this.ParentOfType<MainWindow>().dzMainMenu.DeleteItem((item as IKCOM.MarkupInfoItem));
521
                        }
522
                    }
523
                }
524
                */
525
            }
526

    
527
            return result;
528
        }
529

    
530
        /// <summary>
531
        /// call save command
532
        /// </summary>
533
        /// <param name="menu"></param>
534
		public void ExecuteSaveCommand2(MainMenu menu)
535
        {
536
            if (menu.pageNavigator.CurrentPage != null)
537
            {
538
                SaveCommand.Instance.Project_No = App.ViewInfo.ProjectNO;
539
                SaveCommand.Instance.document_id = App.ViewInfo.DocumentItemID;
540
                SaveCommand.Instance.user_id = App.ViewInfo.UserID;
541
                SaveCommand.Instance.page_no = menu.pageNavigator.CurrentPage.PageNumber;
542

    
543
                try
544
                {
545
                    if (ViewerDataModel.Instance.UndoDataList.Count > 0)
546
                    {
547
                        List<IKCOM.MarkupInfoItem> SelectedMarkupInfos = new List<IKCOM.MarkupInfoItem>();
548
                        foreach (var item in menu.gridViewMarkup.SelectedItems)
549
                        {
550
                            if ((item as IKCOM.MarkupInfoItem).UserID == App.ViewInfo.UserID)
551
                            {
552
                                SelectedMarkupInfos.Add(item as IKCOM.MarkupInfoItem);
553
                            }
554
                        }
555

    
556
                        SaveCommand.Instance.Execute(SelectedMarkupInfos);
557
                    }
558

    
559
                    if (ViewerDataModel.Instance.RotationDocs.Count > 0)
560
                    {
561
                        SaveCommand.Instance.PageAngleSave(App.ViewInfo.ProjectNO, ViewerDataModel.Instance.RotationDocs);
562
                    }
563
                }
564
                catch (Exception ex)
565
                {
566
                    this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert(string.Format("세이브 실패:{0}", ex.Message), "Alert");
567
                    throw ex;
568
                }
569
            }
570
            else
571
            {
572
                System.Diagnostics.Debug.WriteLine("ExecuteSaveCommand Error - pageNavigator.CurrentPage null");
573
            }
574
        }
575
        public async Task<bool> ExecuteSaveCommandAsync(MainMenu menu)
576
        {
577
            bool result = false;
578

    
579
            if (menu.pageNavigator.CurrentPage != null)
580
            {
581
                SaveCommand.Instance.Project_No = App.ViewInfo.ProjectNO;
582
                SaveCommand.Instance.document_id = App.ViewInfo.DocumentItemID;
583
                SaveCommand.Instance.user_id = App.ViewInfo.UserID;
584
                SaveCommand.Instance.page_no = menu.pageNavigator.CurrentPage.PageNumber;
585

    
586
                try
587
                {
588
                    if (ViewerDataModel.Instance.UndoDataList.Count > 0 || ViewerDataModel.Instance.IsMarkupUpdate)
589
                    {
590
                        List<IKCOM.MarkupInfoItem> SelectedMarkupInfos = new List<IKCOM.MarkupInfoItem>();
591
                        foreach (var item in menu.gridViewMarkup.SelectedItems)
592
                        {
593
                            if ((item as IKCOM.MarkupInfoItem).UserID == App.ViewInfo.UserID)
594
                            {
595
                                SelectedMarkupInfos.Add(item as IKCOM.MarkupInfoItem);
596
                            }
597
                        }
598

    
599
                        result = await SaveCommand.Instance.Execute(SelectedMarkupInfos);
600
                        ViewerDataModel.Instance.IsMarkupUpdate = false;
601
                    }
602
                    else
603
                    {
604
                        result = true;
605
                    }
606

    
607
                    if (ViewerDataModel.Instance.RotationDocs.Count > 0)
608
                    {
609
                        SaveCommand.Instance.PageAngleSave(App.ViewInfo.ProjectNO, ViewerDataModel.Instance.RotationDocs);
610
                    }
611
                }
612
                catch (Exception ex)
613
                {
614
                    this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert(string.Format("세이브 실패:{0}", ex.Message), "Alert");
615
                    throw ex;
616
                }
617
            }
618
            else
619
            {
620
                System.Diagnostics.Debug.WriteLine("ExecuteSaveCommand Error - pageNavigator.CurrentPage null");
621
            }
622

    
623
            return result;
624
        }
625

    
626
        public bool ExecuteSaveCommand(MainMenu menu)
627
        {
628
            bool result = false;
629

    
630
            if (menu.pageNavigator.CurrentPage != null)
631
            {
632
                SaveCommand.Instance.Project_No = App.ViewInfo.ProjectNO;
633
                SaveCommand.Instance.document_id = App.ViewInfo.DocumentItemID;
634
                SaveCommand.Instance.user_id = App.ViewInfo.UserID;
635
                SaveCommand.Instance.page_no = menu.pageNavigator.CurrentPage.PageNumber;
636

    
637
                try
638
                {
639
                    if (ViewerDataModel.Instance.UndoDataList.Count > 0 || ViewerDataModel.Instance.IsMarkupUpdate)
640
                    {
641
                        List<IKCOM.MarkupInfoItem> SelectedMarkupInfos = new List<IKCOM.MarkupInfoItem>();
642
                        foreach (var item in menu.gridViewMarkup.SelectedItems)
643
                        {
644
                            if ((item as IKCOM.MarkupInfoItem).UserID == App.ViewInfo.UserID)
645
                            {
646
                                SelectedMarkupInfos.Add(item as IKCOM.MarkupInfoItem);
647
                            }
648
                        }
649

    
650
                        result = SaveCommand.Instance.Execute(SelectedMarkupInfos).GetAwaiter().GetResult();
651
                        ViewerDataModel.Instance.IsMarkupUpdate = false;
652
                    }
653
                    else
654
                    {
655
                        result = true;
656
                    }
657

    
658
                    if (ViewerDataModel.Instance.RotationDocs.Count > 0)
659
                    {
660
                        SaveCommand.Instance.PageAngleSave(App.ViewInfo.ProjectNO, ViewerDataModel.Instance.RotationDocs);
661
                    }
662
                }
663
                catch (Exception ex)
664
                {
665
                    this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert(string.Format("세이브 실패:{0}", ex.Message), "Alert");
666
                    throw ex;
667
                }
668
            }
669
            else
670
            {
671
                System.Diagnostics.Debug.WriteLine("ExecuteSaveCommand Error - pageNavigator.CurrentPage null");
672
            }
673

    
674
            return result;
675
        }
676

    
677
        //강인구 추가
678
        public void Print_Start(string Type)
679
        {
680
            if (ViewerDataModel.Instance.MarkupControls_USER.Count > 0 || this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
681
            {
682
                var menu = this.ParentOfType<MainWindow>().dzMainMenu;
683
                SelectionSet.Instance.UnSelect(menu);
684
                if (menu.PreviewUserMarkupInfoItem != null && menu.PreviewUserMarkupInfoItem.IsPreviewUser == true)
685
                {
686
                    this.SaveEventCallback(null, null);
687
                }
688
                else if (menu.gridViewMarkup.SelectedItems.Count == 0 || (menu.gridViewMarkup.SelectedItems.FirstOrDefault() as IKCOM.MarkupInfoItem).UserID != App.ViewInfo.UserID)
689
                {
690

    
691
                }
692
                else
693
                {
694
                    this.SaveEventCallback(null, null);
695
                }
696
            }
697

    
698
            bool isprint = false;
699
            if (Type == "Print")
700
            {
701
                isprint = true;
702
            }
703

    
704
            RadWindow PrintWindow = new RadWindow();
705
            PrintWindow.Width = 850;
706
            PrintWindow.Height = 600;
707
            PrintWindow.Header = Type;
708

    
709
            List<IKCOM.MarkupInfoItem> markupinfo = new List<IKCOM.MarkupInfoItem>();
710

    
711
            markupinfo = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.GetPrintDocItemList(App.ViewInfo.ProjectNO, App.ViewInfo.DocumentItemID, ViewerDataModel.Instance._markupInfoList.ToList());
712

    
713
            if (markupinfo?.Count() > 0)
714
            {
715
                //Logger.sendResLog("GetPrintDocItemList", "TRUE", 1);
716
            }
717
            else
718
            {
719
                //Logger.sendResLog("GetPrintDocItemList", "FALSE", 1);
720
            }
721

    
722
            /// Tile Source URL을 구한다
723

    
724
            string sImageURL = ViewerDataModel.Instance.SystemMain.dzMainMenu.GetImageURL(App.ViewInfo.DocumentItemID, this.ParentOfType<MainWindow>().dzMainMenu.pageNavigator.CurrentPage.PageNumber);
725
            var url = new Uri(sImageURL);
726
            string sFolder = App.ViewInfo.DocumentItemID.All(char.IsDigit) ? (Convert.ToInt64(App.ViewInfo.DocumentItemID) / 100).ToString() : App.ViewInfo.DocumentItemID.Substring(0, 5);
727
            var Tile_Url = string.Format(@"{0}://{1}:{2}/TileSource/{3}_Tile/{4}/{5}/",
728
                url.Scheme, url.Host, url.Port,
729
                App.ViewInfo.ProjectNO,
730
                sFolder,
731
                App.ViewInfo.DocumentItemID
732
                );
733
            /// up to here
734

    
735
            var docitem = this.ParentOfType<MainWindow>().dzMainMenu._DocItem;
736

    
737
            PrintWindow.Content = new KCOM.Control.PrintControl(
738
                      Tile_Url,
739
                      App.ViewInfo.ProjectNO,
740
                      this.ParentOfType<MainWindow>().dzMainMenu._DocInfo,
741
                      markupinfo,
742
                      this.ParentOfType<MainWindow>().dzMainMenu.pageNavigator.CurrentPage.PageNumber,
743
                      docitem.GROUP_NO,
744
                      docitem.DOCUMENT_NO,
745
                      docitem.ORIGINAL_FILE,
746
                      isprint);
747

    
748
            //프린트 팝업 옵션
749
            //PrintWindow.BorderThickness = new Thickness(3);
750
            //PrintWindow.BorderBrush = new SolidColorBrush(Color.FromArgb(255, 37, 160, 218));
751
            PrintWindow.ResizeMode = System.Windows.ResizeMode.NoResize;
752
            PrintWindow.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
753
            PrintWindow.Background = new SolidColorBrush(Colors.Black);
754
            PrintWindow.Background.Opacity = 0.6;
755
            PrintWindow.Owner = Application.Current.MainWindow;
756
            Telerik.Windows.Controls.StyleManager.SetTheme(PrintWindow, new Telerik.Windows.Controls.VisualStudio2013Theme());
757
            PrintWindow.ShowDialog();
758
        }
759

    
760
        //강인구 추가
761
        private void PrintEvent(object sender, RoutedEventArgs e)
762
        {
763
            RadRibbonButton button = sender as RadRibbonButton;
764
            Print_Start(button.Content.ToString());
765
        }
766

    
767
        private List<AdornerMember> GetAdornerItem()
768
        {
769
            List<AdornerMember> AdonerList = new List<AdornerMember>();
770

    
771
            if (this.ParentOfType<MainWindow>() != null)
772
            {
773
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
774
                {
775
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
776
                    {
777
                        if (item.GetType().Name == "AdornerFinal")
778
                        {
779
                            foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
780
                            {
781
                                AdonerList.Add(InnerItem);
782
                            }
783
                        }
784
                    }
785
                }
786
            }
787

    
788
            return AdonerList;
789
        }
790
        /// <summary>
791
        /// 투명도
792
        /// </summary>
793
        /// <param name="sender"></param>
794
        /// <param name="e"></param>
795
        //강인구 추가(Undo End)
796
        private void sdOpacity_ValueChanged(object sender, RoutedEventArgs e)
797
        {
798
            List<AdornerMember> AdonerList = GetAdornerItem();
799
            if(AdonerList.Count > 0)
800
            {
801
                Undo_data UndoData = new Undo_data()
802
                {
803
                    IsUndo = false,
804
                    Event = Event_Type.Option,
805
                    EventTime = DateTime.Now,
806
                    Opacity = ViewerDataModel.Instance.ControlOpacity,
807
                    Markup_List = new List<Multi_Undo_data>()
808
                };
809
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
810

    
811
                foreach (AdornerMember InnerItem in AdonerList)
812
                {
813
                    InnerItem.DrawingData.Opacity = ViewerDataModel.Instance.ControlOpacity;
814
                  
815
                    multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
816
                    UndoData.Markup_List.Add(multi_Undo_Data);
817
                    multi_Undo_Data = new Multi_Undo_data();
818
                }
819

    
820
                ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
821
                {
822
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
823
                });
824
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
825
            }
826
        }
827

    
828
        //강인구 추가(Undo End)
829
        private void cbLineSize_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
830
        {
831
            if (string.IsNullOrEmpty(cbLineSize.Value.ToString()))
832
            {
833
                cbLineSize.Value = cbLineSize.Minimum;
834
            }
835
            List<AdornerMember> AdonerList = GetAdornerItem();
836
            if (AdonerList.Count > 0)
837
            {
838
                Undo_data UndoData = new Undo_data()
839
                {
840
                    IsUndo = false,
841
                    Event = Event_Type.Option,
842
                    EventTime = DateTime.Now,
843
                    LineSize = ViewerDataModel.Instance.LineSize,
844
                    Markup_List = new List<Multi_Undo_data>()
845
                };
846
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
847

    
848
                foreach (AdornerMember InnerItem in AdonerList)
849
                {
850
                    switch (InnerItem.DrawingData.GetType().Name)
851
                    {
852
                        case ("LineControl"):
853
                            {
854
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Line.LineControl).LineSize = ViewerDataModel.Instance.LineSize;
855
                            }
856
                            break;
857
                        case ("ArcControl"):
858
                            {
859
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Line.ArcControl).LineSize = ViewerDataModel.Instance.LineSize;
860
                            }
861
                            break;
862
                        case ("ArrowArcControl"):
863
                            {
864
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Line.ArrowArcControl).LineSize = ViewerDataModel.Instance.LineSize;
865
                            }
866
                            break;
867
                        case ("ArrowControl_Multi"):
868
                            {
869
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Line.ArrowControl_Multi).LineSize = ViewerDataModel.Instance.LineSize;
870
                            }
871
                            break;
872
                        case ("CloudControl"):
873
                            {
874
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Polygon.CloudControl).LineSize = ViewerDataModel.Instance.LineSize;
875
                            }
876
                            break;
877
                        case ("PolygonControl"):
878
                            {
879
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Polygon.PolygonControl).LineSize = ViewerDataModel.Instance.LineSize;
880
                            }
881
                            break;
882
                        case ("RectangleControl"):
883
                            {
884
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.RectangleControl).LineSize = ViewerDataModel.Instance.LineSize;
885
                            }
886
                            break;
887
                        case ("RectCloudControl"):
888
                            {
889
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.RectCloudControl).LineSize = ViewerDataModel.Instance.LineSize;
890
                            }
891
                            break;
892
                        case ("TriControl"):
893
                            {
894
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.TriControl).LineSize = ViewerDataModel.Instance.LineSize;
895
                            }
896
                            break;
897
                        case ("CircleControl"):
898
                            {
899
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.CircleControl).LineSize = ViewerDataModel.Instance.LineSize;
900
                            }
901
                            break;
902
                        case ("ArrowTextControl"):
903
                            {
904
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).LineSize = ViewerDataModel.Instance.LineSize;
905
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).BorderSize = new Thickness(ViewerDataModel.Instance.LineSize);
906
                            }
907
                            break;
908
                        case ("TextControl"):
909
                            {
910
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).LineSize = new Thickness(ViewerDataModel.Instance.LineSize);
911
                            }
912
                            break;
913
                        case ("InsideWhiteControl"):
914
                            {
915
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Cad.InsideWhiteControl).LineSize = ViewerDataModel.Instance.LineSize;
916
                            }
917
                            break;
918
                        case ("OverlapWhiteControl"):
919
                            {
920
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Cad.OverlapWhiteControl).LineSize = ViewerDataModel.Instance.LineSize;
921
                            }
922
                            break;
923
                        case ("ClipWhiteControl"):
924
                            {
925
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Cad.ClipWhiteControl).LineSize = ViewerDataModel.Instance.LineSize;
926
                            }
927
                            break;
928
                        case ("CoordinateControl"):
929
                            {
930
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Cad.CoordinateControl).LineSize = 10; //ViewerDataModel.Instance.LineSize
931
                            }
932
                            break;
933
                    }
934
                    
935

    
936
                    multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
937
                    UndoData.Markup_List.Add(multi_Undo_Data);
938
                    multi_Undo_Data = new Multi_Undo_data();
939
                }
940

    
941
                ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
942
                {
943
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
944
                });
945
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
946

    
947
                
948
            }
949
            KCOM.Properties.Settings.Default.LineSize = (double)cbLineSize.Value;
950
            Properties.Settings.Default.Save();
951
        }
952

    
953

    
954
        private void cbIntervalSize_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
955
        {
956
            if (string.IsNullOrEmpty(cbIntervalSize.Value.ToString()))
957
            {
958
                cbIntervalSize.Value = cbIntervalSize.Minimum;
959
            }
960
            List<AdornerMember> AdonerList = GetAdornerItem();
961
            if (AdonerList.Count > 0)
962
            {
963

    
964
                Undo_data UndoData = new Undo_data()
965
                {
966
                    IsUndo = false,
967
                    Event = Event_Type.Option,
968
                    EventTime = DateTime.Now,
969
                    Interval = ViewerDataModel.Instance.Interval,
970
                    Markup_List = new List<Multi_Undo_data>()
971
                };
972
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
973

    
974
                foreach (AdornerMember InnerItem in AdonerList)
975
                {
976
                    switch (InnerItem.DrawingData.GetType().Name)
977
                    {
978
                        case ("LineControl"):
979
                            {
980
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Line.LineControl).Interval = ViewerDataModel.Instance.Interval;
981

    
982
                                multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
983
                                UndoData.Markup_List.Add(multi_Undo_Data);
984
                                multi_Undo_Data = new Multi_Undo_data();
985
                            }
986
                            break;
987
                    }
988
                }
989

    
990
                ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
991
                {
992
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
993
                });
994
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
995
            }
996
            KCOM.Properties.Settings.Default.Interval = (double)cbIntervalSize.Value;
997
            Properties.Settings.Default.Save();
998
        }
999
        
1000
        private void cbArcLength_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
1001
        {
1002
            if (string.IsNullOrEmpty(cbArcLength.Value.ToString()))
1003
            {
1004
                cbArcLength.Value = cbArcLength.Minimum;
1005
            }
1006
            List<AdornerMember> AdonerList = GetAdornerItem();
1007
            if (AdonerList.Count > 0)
1008
            {
1009

    
1010
                //Undo_data UndoData = new Undo_data()
1011
                //{
1012
                //    IsUndo = false,
1013
                //    Event = Event_Type.Option,
1014
                //    EventTime = DateTime.Now,
1015
                //    Interval = ViewerDataModel.Instance.Interval,
1016
                //    Markup_List = new List<Multi_Undo_data>()
1017
                //};
1018
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
1019

    
1020
                foreach (AdornerMember InnerItem in AdonerList)
1021
                {
1022
                    switch (InnerItem.DrawingData.GetType().Name)
1023
                    {
1024
                        case ("RectCloudControl"):
1025
                            {
1026
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.RectCloudControl).ArcLength = ViewerDataModel.Instance.ArcLength;
1027

    
1028
                                //multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
1029
                                //UndoData.Markup_List.Add(multi_Undo_Data);
1030
                                //multi_Undo_Data = new Multi_Undo_data();
1031
                            }
1032
                            break;
1033
                        case ("CloudControl"):
1034
                            {
1035
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Polygon.CloudControl).ArcLength = ViewerDataModel.Instance.ArcLength;
1036

    
1037
                                //multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
1038
                                //UndoData.Markup_List.Add(multi_Undo_Data);
1039
                                //multi_Undo_Data = new Multi_Undo_data();
1040
                            }
1041
                            break;
1042
                    }
1043
                }
1044

    
1045
                //ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
1046
                //{
1047
                //    ViewerDataModel.Instance.UndoDataList.Remove(i);
1048
                //});
1049
                //ViewerDataModel.Instance.UndoDataList.Add(UndoData);
1050
            }
1051

    
1052
            KCOM.Properties.Settings.Default.ArcLength = (double)cbArcLength.Value;
1053
            Properties.Settings.Default.Save();
1054
        }
1055

    
1056
        //강인구 추가(Undo End)
1057
        private void cbDashStyle_SelectionChanged(object sender, SelectionChangedEventArgs e)
1058
        {
1059
            //강인구 추가
1060
            if (this.ParentOfType<MainWindow>() != null)
1061
            {
1062
                ViewerDataModel.Instance.DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
1063
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
1064
                {
1065
                    Undo_data UndoData = new Undo_data()
1066
                    {
1067
                        IsUndo = false,
1068
                        Event = Event_Type.Option,
1069
                        EventTime = DateTime.Now,
1070
                        DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData,
1071
                        Markup_List = new List<Multi_Undo_data>()
1072
                    };
1073
                    Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
1074

    
1075
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
1076
                    {
1077
                        if (item.GetType().Name == "AdornerFinal")
1078
                        {
1079
                            foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
1080
                            {
1081
                                switch (InnerItem.DrawingData.GetType().Name)
1082
                                {
1083
                                    case ("LineControl"):
1084
                                        {
1085
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Line.LineControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
1086
                                        }
1087
                                        break;
1088
                                    case ("ArcControl"):
1089
                                        {
1090
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Line.ArcControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
1091
                                        }
1092
                                        break;
1093
                                    case ("ArrowArcControl"):
1094
                                        {
1095
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Line.ArrowArcControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
1096
                                        }
1097
                                        break;
1098
                                    case ("ArrowControl_Multi"):
1099
                                        {
1100
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Line.ArrowControl_Multi).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
1101
                                        }
1102
                                        break;
1103
                                    case ("CloudControl"):
1104
                                        {
1105
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Polygon.CloudControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
1106
                                        }
1107
                                        break;
1108
                                    case ("PolygonControl"):
1109
                                        {
1110
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Polygon.PolygonControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
1111
                                        }
1112
                                        break;
1113
                                    case ("RectangleControl"):
1114
                                        {
1115
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.RectangleControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
1116
                                        }
1117
                                        break;
1118
                                    case ("RectCloudControl"):
1119
                                        {
1120
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.RectCloudControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
1121
                                        }
1122
                                        break;
1123
                                    case ("TriControl"):
1124
                                        {
1125
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.TriControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
1126
                                        }
1127
                                        break;
1128
                                    case ("CircleControl"):
1129
                                        {
1130
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.CircleControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
1131
                                        }
1132
                                        break;
1133
                                    case ("InsideWhiteControl"):
1134
                                        {
1135
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Cad.InsideWhiteControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
1136
                                        }
1137
                                        break;
1138
                                    case ("OverlapWhiteControl"):
1139
                                        {
1140
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Cad.OverlapWhiteControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
1141
                                        }
1142
                                        break;
1143
                                    case ("ClipWhiteControl"):
1144
                                        {
1145
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Cad.ClipWhiteControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
1146
                                        }
1147
                                        break;
1148
                                    case ("CoordinateControl"):
1149
                                        {
1150
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Cad.CoordinateControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
1151
                                        }
1152
                                        break;
1153
                                }
1154

    
1155
                                multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
1156
                                UndoData.Markup_List.Add(multi_Undo_Data);
1157
                                multi_Undo_Data = new Multi_Undo_data();
1158
                            }
1159

    
1160
                            ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
1161
                            {
1162
                                ViewerDataModel.Instance.UndoDataList.Remove(i);
1163
                            });
1164
                            ViewerDataModel.Instance.UndoDataList.Add(UndoData);
1165
                        }
1166
                    }
1167
                }
1168
            }
1169
        }
1170

    
1171
        //강인구 추가
1172
        private void comboFontSize_SelectionChanged(object sender, SelectionChangedEventArgs e)
1173
        {
1174
            //if (this.ParentOfType<MainWindow>() != null)
1175
            //{
1176
            //    if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
1177
            //    {
1178
            //        foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
1179
            //        {
1180
            //            if (item.GetType().Name == "AdornerFinal")
1181
            //            {
1182
            //                foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
1183
            //                {
1184
            //                    switch (InnerItem.DrawingData.GetType().Name)
1185
            //                    {
1186
            //                        case ("TextControl"):
1187
            //                            {
1188
            //                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextSize = int.Parse(comboFontSize.Text);
1189
            //                            }
1190
            //                            break;
1191
            //                        case ("ArrowTextControl"):
1192
            //                            {
1193
            //                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextSize = int.Parse(comboFontSize.Text);
1194
            //                            }
1195
            //                            break;
1196
            //                    }
1197
            //                }
1198
            //            }
1199
            //        }
1200
            //    }
1201
            //}
1202
        }
1203

    
1204
        //강인구 추가
1205
        private void btnBold_Checked(object sender, RoutedEventArgs e)
1206
        {
1207
            if (this.ParentOfType<MainWindow>() != null)
1208
            {
1209
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
1210
                {
1211
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
1212
                    {
1213
                        if (item.GetType().Name == "AdornerFinal")
1214
                        {
1215
                            foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
1216
                            {
1217
                                switch (InnerItem.DrawingData.GetType().Name)
1218
                                {
1219
                                    case ("TextControl"):
1220
                                        {
1221
                                            if((InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextWeight == FontWeights.Bold)
1222
                                            {
1223
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextWeight = FontWeights.Normal;
1224
                                                ViewerDataModel.Instance.IsMarkupUpdate = true;
1225
                                            }
1226
                                            else
1227
                                            {
1228
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextWeight = FontWeights.Bold;
1229
                                                ViewerDataModel.Instance.IsMarkupUpdate = true;
1230
                                            }
1231

    
1232
                                        }
1233
                                        break;
1234
                                    case ("ArrowTextControl"):
1235
                                        {
1236
                                            if ((InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextWeight == FontWeights.Bold)
1237
                                            {
1238
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextWeight = FontWeights.Normal;
1239
                                                ViewerDataModel.Instance.IsMarkupUpdate = true;
1240
                                            }
1241
                                            else
1242
                                            {
1243
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextWeight = FontWeights.Bold;
1244
                                                ViewerDataModel.Instance.IsMarkupUpdate = true;
1245
                                            }
1246
                                        }
1247
                                        break;
1248
                                }
1249
                            }
1250
                        }
1251
                    }
1252
                }
1253
            }
1254
        }
1255

    
1256
        //강인구 추가
1257
        private void btnItalic_Checked(object sender, RoutedEventArgs e)
1258
        {
1259
            if (this.ParentOfType<MainWindow>() != null)
1260
            {
1261
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
1262
                {
1263
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
1264
                    {
1265
                        if (item.GetType().Name == "AdornerFinal")
1266
                        {
1267
                            foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
1268
                            {
1269
                                switch (InnerItem.DrawingData.GetType().Name)
1270
                                {
1271
                                    case ("TextControl"):
1272
                                        {
1273
                                            if((InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextStyle == FontStyles.Italic)
1274
                                            {
1275
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextStyle = System.Windows.FontStyles.Normal;
1276
                                                ViewerDataModel.Instance.IsMarkupUpdate = true;
1277
                                            }
1278
                                            else
1279
                                            {
1280
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextStyle = FontStyles.Italic;
1281
                                                ViewerDataModel.Instance.IsMarkupUpdate = true;
1282
                                            }
1283

    
1284
                                        }
1285
                                        break;
1286
                                    case ("ArrowTextControl"):
1287
                                        {
1288
                                            if((InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextStyle == FontStyles.Italic)
1289
                                            {
1290
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextStyle = FontStyles.Normal;
1291
                                                ViewerDataModel.Instance.IsMarkupUpdate = true;
1292
                                            }
1293
                                            else
1294
                                            {
1295
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextStyle = FontStyles.Italic;
1296
                                                ViewerDataModel.Instance.IsMarkupUpdate = true;
1297
                                            }
1298
                                        }
1299
                                        break;
1300
                                }
1301
                            }
1302
                        }
1303
                    }
1304
                }
1305
            }
1306
        }
1307

    
1308
        //강인구 추가
1309
        private void btnUnderLine_Checked(object sender, RoutedEventArgs e)
1310
        {
1311
            if (this.ParentOfType<MainWindow>() != null)
1312
            {
1313
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
1314
                {
1315
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
1316
                    {
1317
                        if (item.GetType().Name == "AdornerFinal")
1318
                        {
1319
                            foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
1320
                            {
1321
                                switch (InnerItem.DrawingData.GetType().Name)
1322
                                {
1323
                                    case ("TextControl"):
1324
                                        {
1325
                                            if ((InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).UnderLine == TextDecorations.Underline)
1326
                                            {
1327
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).UnderLine = null;
1328
                                            }
1329
                                            else
1330
                                            {
1331
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).UnderLine = TextDecorations.Underline;
1332
                                            }
1333
                                        }
1334
                                        break;
1335
                                    case ("ArrowTextControl"):
1336
                                        {
1337
                                            if ((InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).UnderLine == TextDecorations.Underline)
1338
                                            {
1339
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).UnderLine = null;
1340
                                            }
1341
                                            else
1342
                                            {
1343
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).UnderLine = TextDecorations.Underline;
1344
                                            }
1345
                                        }
1346
                                        break;
1347
                                }
1348

    
1349
                                ViewerDataModel.Instance.IsMarkupUpdate = true;
1350
                            }
1351
                        }
1352
                    }
1353
                }
1354
            }
1355
        }
1356

    
1357
        private void comboFontSize_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
1358
        {
1359
            if (string.IsNullOrEmpty(comboFontSize.Value.ToString()))
1360
            {
1361
                comboFontSize.Value = comboFontSize.Minimum;
1362
            }
1363
            if (this.ParentOfType<MainWindow>() != null)
1364
            {
1365
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
1366
                {
1367
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
1368
                    {
1369
                        if (item.GetType().Name == "AdornerFinal")
1370
                        {
1371
                            foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
1372
                            {
1373
                                switch (InnerItem.DrawingData.GetType().Name)
1374
                                {
1375
                                    case ("TextControl"):
1376
                                        {
1377
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextSize = int.Parse(comboFontSize.Value.ToString());
1378
                                        }
1379
                                        break;
1380
                                    case ("ArrowTextControl"):
1381
                                        {
1382
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextSize = int.Parse(comboFontSize.Value.ToString());
1383
                                        }
1384
                                        break;
1385
                                }
1386
                            }
1387

    
1388
                            ChangeComment(item as Controls.AdornerFinal);
1389
                        }
1390
                    }
1391
                }
1392
            }
1393

    
1394
            KCOM.Properties.Settings.Default.TextSize = (double)comboFontSize.Value;
1395
            Properties.Settings.Default.Save();
1396
        }
1397

    
1398
        //강인구 추가
1399
        private void comboFontFamily_SelectionChanged(object sender, SelectionChangedEventArgs e)
1400
        {
1401
            
1402
            if (comboFontFamily.SelectedItem != null && !IsSuspendChange)
1403
            {
1404
                var main = this.ParentOfType<MainWindow>()?.dzMainMenu;
1405
                var font = comboFontFamily.SelectedItem as Markus.Fonts.MarkusFont;
1406
                var lstTextCtrl = SelectTextControl();
1407

    
1408
                foreach (var item in lstTextCtrl)
1409
                {
1410
                    if (item is MarkupToPDF.Controls.Text.ArrowTextControl ctrl1)
1411
                    {
1412
                        ViewerDataModel.Instance.IsMarkupUpdate = true;
1413
                        ctrl1.SetFontFamily(font.FontFamily);
1414
                    }
1415
                    else if (item is MarkupToPDF.Controls.Text.TextControl ctrl2)
1416
                    {
1417
                        ViewerDataModel.Instance.IsMarkupUpdate = true;
1418
                        ctrl2.SetFontFamily(font.FontFamily);
1419
                    }
1420
                }
1421

    
1422
                KCOM.Properties.Settings.Default.FontFamily = font.FontFamily.FontName();
1423
                Properties.Settings.Default.Save();
1424
            }
1425
        }
1426

    
1427
        private List<UIElement> SelectTextControl()
1428
        {
1429
            List<UIElement> lstTextCtrl = new List<UIElement>();
1430

    
1431
            var main = this.ParentOfType<MainWindow>()?.dzMainMenu;
1432
            var font = comboFontFamily.SelectedItem as Markus.Fonts.MarkusFont;
1433

    
1434

    
1435
            if (main.SelectLayer.FindChildByType<AdornerFinal>() != null)
1436
            {
1437
                lstTextCtrl.AddRange(main.SelectLayer.FindChildByType<AdornerFinal>().Members.Where(x => x.DrawingData is MarkupToPDF.Controls.Common.ITextControl).Select(x => x.DrawingData));
1438
            }
1439

    
1440
            lstTextCtrl.AddRange(main.zoomAndPanCanvas.FindAllChildren(x => x is MarkupToPDF.Controls.Common.ITextControl c && (c.IsSelected || c.IsEditingMode == true)).Select(x => (UIElement)x));
1441

    
1442
            return lstTextCtrl;
1443
        }
1444

    
1445

    
1446
        /// <summary>
1447
        /// 텍스트 컨트롤 하일라이트 처리
1448
        /// </summary>
1449
        /// <param name="sender"></param>
1450
        /// <param name="e"></param>
1451
        private void HighlightEvent(object sender, RoutedEventArgs e)
1452
        {
1453

    
1454
            ViewerDataModel.Instance.checkHighShape = (sender as CheckBox).IsChecked.Value;
1455
            SetHighlightEvent();
1456
            //if ((sender as CheckBox).IsChecked.Value)
1457
            //{
1458
            //    TaskMessage("HighLight가 설정되었습니다", TaskMessageType.Normal);
1459
            //}
1460
            //else
1461
            //{
1462
            //    TaskMessage("HighLight가 해제되었습니다", TaskMessageType.Caption);
1463
            //}
1464
            //if (ViewerDataModel.Instance.SelectedEditor as MarkupToPDF.Controls.Text.TextControl != null)
1465
            //{
1466
            //    MarkupToPDF.Controls.Text.TextControl instance = (ViewerDataModel.Instance.SelectedEditor as MarkupToPDF.Controls.Text.TextControl);
1467
            //    instance.IsHighLight = ViewerDataModel.Instance.checkHighShape;
1468
            //    instance.SetText();
1469
            //}
1470
        }
1471

    
1472
        //추가페이지 이동 엔터
1473
        private void tlcurrentPage_KeyDown(object sender, KeyEventArgs e)
1474
        {
1475
            //강인구 추가 tlcurrentPage을 이상하게 입력할수 있기때문에 Try Catch
1476
            if (e.Key == Key.Enter)
1477
            {
1478
                try
1479
                {
1480
                    var instanceMain = this.ParentOfType<MainWindow>();
1481
                    var max = instanceMain.dzMainMenu.pageNavigator._thumbnailItems.Max(f => f.PageNumber);
1482
                    if (string.IsNullOrEmpty(tlcurrentPage.Text))
1483
                    {
1484
                        RadWindow.Alert(new DialogParameters
1485
                        {
1486
                            Owner = Application.Current.MainWindow,
1487
                            Theme = new VisualStudio2013Theme(),
1488
                            Header = "Info",
1489
                            Content = "Enter the correct page number.",
1490
                        });
1491
                    }
1492
                    else
1493
                    {
1494
                        if (Convert.ToInt32(tlcurrentPage.Text) > max || Convert.ToInt32(tlcurrentPage.Text) == 0)
1495
                        {
1496
                            RadWindow.Alert(new DialogParameters
1497
                            {
1498
                                Owner = Application.Current.MainWindow,
1499
                                Theme = new VisualStudio2013Theme(),
1500
                                Header = "Info",
1501
                                Content = "Enter the correct page number.",
1502
                            });
1503
                        }
1504
                        else
1505
                        {
1506
                            instanceMain.dzMainMenu.pageNavigator.GotoPage(Convert.ToInt32(tlcurrentPage.Text));
1507
                        }
1508
                    }
1509
                    
1510
                }
1511
                catch (Exception)
1512
                {
1513
                    RadWindow.Alert(new DialogParameters
1514
                    {
1515
                        Owner = Application.Current.MainWindow,
1516
                        Theme = new VisualStudio2013Theme(),
1517
                        Header = "Info",
1518
                        Content = "Enter the correct page number.",
1519
                    });
1520
                }
1521
                
1522
            }
1523
        }
1524
        private string previousText;
1525
        private void TlcurrentPage_PreviewTextInput(object sender, TextCompositionEventArgs e)
1526
        {
1527
            System.Text.RegularExpressions.Regex regex = new System.Text.RegularExpressions.Regex("[^0-9]+");
1528
            e.Handled = regex.IsMatch(e.Text);
1529
        }
1530
        private void TlcurrentPage_TextChanged(object sender, TextChangedEventArgs e)
1531
        {
1532
            double num = 0;
1533
            bool success = double.TryParse(((TextBox)sender).Text, out num);
1534
            if (success & num >= 0)
1535
                previousText = ((TextBox)sender).Text;
1536
            else
1537
            {
1538
                if (string.IsNullOrEmpty(((TextBox)sender).Text))
1539
                {
1540
                    ((TextBox)sender).Text = "";
1541
                }
1542
                else
1543
                {
1544

    
1545
                    ((TextBox)sender).Text = previousText;
1546
                }
1547
            }
1548
        }
1549

    
1550
        /// <summary>
1551
        /// 입력한 페이지로 이동한다
1552
        /// </summary>
1553
        /// <param name="sender"></param>
1554
        /// <param name="e"></param>
1555
        private void tlcurrentPage_readonly_KeyDown(object sender, KeyEventArgs e)
1556
        {
1557
            if (e.Key == Key.Enter)
1558
            {
1559
                try
1560
                {
1561
                    var instanceMain = this.ParentOfType<MainWindow>();
1562
                    instanceMain.dzMainMenu.pageNavigator.GotoPage(Convert.ToInt32(tlcurrentPage_readonly.Text));
1563
                }
1564
                catch (Exception)
1565
                {
1566
                    RadWindow.Alert(new DialogParameters
1567
                    {
1568
                        Owner = Application.Current.MainWindow,
1569
                        Theme = new VisualStudio2013Theme(),
1570
                        Header = "Info",
1571
                        Content = "Enter the correct page number.",
1572
                    });
1573
                }
1574
            }
1575
        }
1576
        
1577
        private void PanoramaEvent(object sender, RoutedEventArgs e)
1578
        {
1579
            PanoramaShow();
1580
        }
1581

    
1582
        public void PanoramaShow()
1583
        {
1584
            Panorama check = new Panorama();
1585
            double screenWidth = System.Windows.SystemParameters.PrimaryScreenWidth;
1586
            double screenHeight = System.Windows.SystemParameters.PrimaryScreenHeight;
1587
            //double windowWidth = this.Width;
1588
            //double windowHeight = this.Height;
1589

    
1590
            var PanoramaPop = new RadWindow
1591
            {
1592
                //MinWidth = 600,
1593
                //MinHeight = 400,
1594
                //Header = "My Check List",
1595
                Header = "Document No : " + this.ParentOfType<MainWindow>().dzMainMenu._DocItem.DOCUMENT_NO + " / Revision :" + this.ParentOfType<MainWindow>().dzMainMenu._DocItem.REVISION,
1596
                Content = check,
1597
                Owner = this,
1598
                ResizeMode = System.Windows.ResizeMode.CanResizeWithGrip,
1599
                //ResizeMode = System.Windows.ResizeMode.NoResize,
1600
                WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen,
1601
                IsTopmost = false,
1602
                //Left = (screenWidth / 2) - (windowWidth / 2),
1603
                //Top = (screenHeight / 2) - (windowHeight / 2),
1604
                //Left = (screenWidth / 2),
1605
                //Top = (screenHeight / 2),
1606
                Width = screenWidth * 0.4,
1607
                Height = screenHeight * 0.4,
1608
            };
1609
            StyleManager.SetTheme(PanoramaPop, new VisualStudio2013Theme());
1610
            //CheckPop.ShowDialog();
1611
            PanoramaPop.Owner = Application.Current.MainWindow;
1612
            PanoramaPop.Show();
1613
        }
1614

    
1615
        private void CheckEvent(object sender, RoutedEventArgs e)
1616
        {
1617
            //창이 떠있을 경우 재 실행 방지
1618
            if (isClosed)
1619
            {
1620
                //토글 및 마우스 상태 초기화
1621
                var toggleList = this.Parent.ChildrenOfType<RadToggleButton>();
1622
                foreach(var togle in toggleList)
1623
                {
1624
                    togle.IsChecked = false;
1625
                }
1626
                this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
1627

    
1628
                isClosed = false;
1629

    
1630
                
1631
                CheckList check = new CheckList(this.ParentOfType<MainWindow>());
1632

    
1633
                CheckPop = new RadWindow
1634
                {
1635
                    MinWidth = 1200,
1636
                    MinHeight = 500,
1637
                    //Header = "My Check List",
1638
                    Header = "Document No : " + this.ParentOfType<MainWindow>().dzMainMenu._DocItem.DOCUMENT_NO + " / Revision :" + this.ParentOfType<MainWindow>().dzMainMenu._DocItem.REVISION,
1639
                    Content = check,
1640
                    //Owner = this,
1641
                    //ResizeMode = System.Windows.ResizeMode.CanResizeWithGrip,
1642
                    ResizeMode = System.Windows.ResizeMode.NoResize,
1643
                    WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen,
1644
                    IsTopmost = true,
1645
                };
1646
                StyleManager.SetTheme(CheckPop, new Office2013Theme());
1647
                CheckPop.Closed += CheckPop_Closed;
1648
                
1649
                //CheckPop.ShowDialog();
1650
                CheckPop.Show();
1651
            }
1652
        }
1653

    
1654
        private void SignManagerEvent(object sender,RoutedEventArgs e)
1655
        {
1656
            SignManager signManager = new SignManager();
1657

    
1658
            RadWindow signManagerPop = new RadWindow
1659
            {
1660
                MinWidth = 1200,
1661
                MinHeight = 500,
1662
                //Header = "My Check List",
1663
                Header = "",
1664
                Content = signManager,
1665
                Owner = this,
1666
                //ResizeMode = System.Windows.ResizeMode.CanResizeWithGrip,
1667
                ResizeMode = System.Windows.ResizeMode.CanResize,
1668
                WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen,
1669
            };
1670
            StyleManager.SetTheme(signManagerPop, new Office2013Theme());
1671

    
1672
            //CheckPop.ShowDialog();
1673
            signManagerPop.ShowDialog();
1674
        }
1675

    
1676
        private void OptionPop_Closed(object sender, WindowClosedEventArgs e)
1677
        {
1678
            isClosed = true;
1679
            //this.ParentOfType<MainWindow>().dzMainMenu.PN_Navi.IsEnabled = true;
1680
            this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
1681
            ViewerDataModel.Instance.Capture_Opacity = 0;
1682
        }
1683

    
1684
        private void CheckPop_Closed(object sender, WindowClosedEventArgs e)
1685
        {
1686
            isClosed = true;
1687
            //this.ParentOfType<MainWindow>().dzMainMenu.PN_Navi.IsEnabled = true;
1688
            this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
1689
            ViewerDataModel.Instance.Capture_Opacity = 0;
1690
        }
1691

    
1692
        /// <summary>
1693
        /// 사용자가 선택한 페이지로 이동(썸네일 동기화 시킴)
1694
        /// </summary>
1695
        /// <param name="sender"></param>
1696
        /// <param name="e"></param>
1697
        private void PageGoEvent(object sender, RoutedEventArgs e)
1698
        {
1699
            RadButton button = sender as RadButton;
1700
            var instanceMain = this.ParentOfType<MainWindow>();
1701
            
1702
            //강인구 추가 tlcurrentPage을 이상하게 입력할수 있기때문에 Try Catch
1703
            try
1704
            {
1705
                switch (button.CommandParameter.ToString())
1706
                {
1707
                    case "Down":
1708
                        {
1709
                            instanceMain.dzMainMenu.pageNavigator.GotoPage(Convert.ToInt32(tlcurrentPage.Text) + 1);
1710
                        }
1711
                        break;
1712
                    case "Up":
1713
                        {
1714
                            instanceMain.dzMainMenu.pageNavigator.GotoPage(Convert.ToInt32(tlcurrentPage.Text) - 1);
1715
                        }
1716
                        break;
1717
                }
1718
            }
1719
            catch (Exception)
1720
            {
1721
                RadWindow.Alert(new DialogParameters
1722
                {
1723
                    Owner = Application.Current.MainWindow,
1724
                    Theme = new VisualStudio2013Theme(),
1725
                    Header = "Info",
1726
                    Content = "Enter the correct page number.",
1727
                });
1728
            }
1729
        }
1730

    
1731
        private void viewEvent(object sender, RoutedEventArgs e)
1732
        {
1733
            RadRibbonToggleButton viewButton = sender as RadRibbonToggleButton;
1734
            var instanceMain = this.ParentOfType<MainWindow>();
1735

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

    
1738
            //if ((sender as RadRibbonToggleButton) != null)
1739
            //{
1740
            //    Common.ViewerDataModel.Instance.ControlTag = (sender as RadRibbonToggleButton).Tag.ToString();
1741
            //    instanceToggle = (sender as RadRibbonToggleButton);
1742
            //}
1743

    
1744
            //instanceToggle.IsChecked = false;
1745

    
1746
            switch (viewButton.CommandParameter.ToString())
1747
            {
1748
                case "zoomout":
1749
                    {
1750
                        //장원
1751
                        //instanceMain.dzMainMenu.zoomAndPanControl.ZoomTo(new Rect(0, 0, instanceMain.dzMainMenu.zoomAndPanCanvas.ActualWidth, instanceMain.dzMainMenu.zoomAndPanCanvas.ActualHeight));
1752
                        instanceMain.dzMainMenu.zoomAndPanControl.ZoomPointToViewportCenter(ViewerDataModel.Instance.ContentScale -= 0.1, point);
1753
                        viewButton.IsChecked = false;
1754
                        //Common.ViewerDataModel.Instance.zom
1755
                    }
1756
                    break;
1757
                case "zoomin":
1758
                    {
1759
                        instanceMain.dzMainMenu.zoomAndPanControl.ZoomPointToViewportCenter(ViewerDataModel.Instance.ContentScale += 0.1, point);
1760
                        viewButton.IsChecked = false;
1761
                    }
1762
                    break;
1763
                case "fullscreen":
1764
                    {
1765
                        instanceMain.WindowState = WindowState.Maximized;
1766
                        //Sizemode 대기(강인구)
1767
                        //instanceMain.dzMainMenu.imageViewer.SizeMode = Leadtools.Windows.Controls.SizeMode.Fit;
1768
                        instanceMain.dzMainMenu.zoomAndPanControl.ScaleToFit();
1769
                        viewButton.IsChecked = false;
1770
                    }
1771
                    break;
1772
                case "fitWidth":
1773
                    {
1774
                        instanceMain.dzMainMenu.zoomAndPanControl.ScaleToFit();
1775
                        viewButton.IsChecked = false;
1776
                    }
1777
                    break;
1778
                case "fitHeight":
1779
                    {
1780
                        instanceMain.dzMainMenu.zoomAndPanControl.ScaleToFit();
1781
                        viewButton.IsChecked = false;
1782
                    }
1783
                    break;
1784
                case "boundzoom":
1785
                    {
1786

    
1787
                    }
1788
                    break;
1789
                case "Rotate_M":
1790
                    {
1791
                        drawingPannelRotate(false);
1792
                        viewButton.IsChecked = false;
1793
                    }
1794
                    break;
1795
                case "Rotate_P":
1796
                    {
1797
                        drawingPannelRotate(true);
1798
                        viewButton.IsChecked = false;
1799
                    }
1800
                    break;
1801
                case "Rotate_half":
1802
                    {
1803
                        drawingPannelRotate(true);
1804
                        drawingPannelRotate(true);
1805
                        viewButton.IsChecked = false;
1806
                    }
1807
                    break;
1808
            }
1809
        }
1810

    
1811
        private void Control_Event(object sender, RoutedEventArgs e)
1812
        {
1813

    
1814
        }
1815

    
1816
        #region 대기
1817

    
1818
        public void drawingPannelRotate(bool Flag)
1819
        {
1820
            var instanceMain = this.ParentOfType<MainWindow>();
1821

    
1822
            //if (rotateOffSet > 3)
1823
            //    rotateOffSet = 0;
1824

    
1825
            //if (rotateOffSet < 0)
1826
            //    rotateOffSet = 3;
1827

    
1828
            if(Flag)
1829
            {
1830
                if (instanceMain.dzMainMenu.rotate.Angle == 270)
1831
                {
1832
                    instanceMain.dzMainMenu.rotate.Angle = 0;
1833
                }
1834
                else
1835
                {
1836
                    instanceMain.dzMainMenu.rotate.Angle += 90;
1837
                }
1838
            }
1839
            else
1840
            {
1841
                if(instanceMain.dzMainMenu.rotate.Angle == 0)
1842
                {
1843
                    instanceMain.dzMainMenu.rotate.Angle = 270;
1844
                }
1845
                else
1846
                {
1847
                    instanceMain.dzMainMenu.rotate.Angle -= 90;
1848
                }
1849
            }
1850
            //double angle = (double)rotateValue.GetValue(rotateOffSet);
1851
            //instanceMain.dzMainMenu.rotate.Angle = angle;
1852
            var rotationNum = Math.Abs((instanceMain.dzMainMenu.rotate.Angle / 90));
1853

    
1854
            if (instanceMain.dzMainMenu.zoomAndPanCanvas.Width == ViewerDataModel.Instance.ContentWidth)
1855
            {
1856
                double emptySize = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
1857
                instanceMain.dzMainMenu.zoomAndPanCanvas.Width = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
1858
                instanceMain.dzMainMenu.zoomAndPanCanvas.Height = emptySize;
1859
            }
1860
            if (instanceMain.dzMainMenu.rotate.Angle == 0)
1861
            {
1862
                instanceMain.dzMainMenu.translate.X = 0;
1863
                instanceMain.dzMainMenu.translate.Y = 0;
1864
            }
1865
            else if (instanceMain.dzMainMenu.rotate.Angle == 90)
1866
            {
1867
                instanceMain.dzMainMenu.translate.X = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
1868
                instanceMain.dzMainMenu.translate.Y = 0;
1869
            }
1870
            else if (instanceMain.dzMainMenu.rotate.Angle == 180)
1871
            {
1872
                instanceMain.dzMainMenu.translate.X = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
1873
                instanceMain.dzMainMenu.translate.Y = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
1874
            }
1875
            else
1876
            {
1877
                instanceMain.dzMainMenu.translate.X = 0;
1878
                instanceMain.dzMainMenu.translate.Y = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
1879
            }
1880

    
1881
            //instanceMain.dzMainMenu.zoomAndPanControl.RenderTransformOrigin = new Point(0.5, 0.5);
1882
            instanceMain.dzMainMenu.zoomAndPanControl.RotationAngle = instanceMain.dzMainMenu.rotate.Angle;
1883
            //대기(강인구)
1884
            //instanceMain.dzMainMenu.imageViewer.RotateAngle = instanceMain.dzMainMenu.rotate.Angle;
1885

    
1886

    
1887
            //instanceMain.dzMainMenu.imageViewer.RenderTransformOrigin = new Point(0.5, 0.5);
1888
            //RotateTransform rotateTransform = new RotateTransform(instanceMain.dzMainMenu.rotate.Angle);
1889
            //instanceMain.dzMainMenu.imageViewer.RenderTransform = rotateTransform;
1890

    
1891

    
1892
            ViewerDataModel.Instance.ContentWidth = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
1893
            ViewerDataModel.Instance.ContentHeight = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
1894
            ViewerDataModel.Instance.AngleOffsetX = instanceMain.dzMainMenu.translate.X;
1895
            ViewerDataModel.Instance.AngleOffsetY = instanceMain.dzMainMenu.translate.Y;
1896
            ViewerDataModel.Instance.PageAngle = instanceMain.dzMainMenu.rotate.Angle;
1897
            //ViewerDataModel.Instance.Document_Info.Clear();
1898
            //ViewerDataModel.Instance.Document_Info.Where(i => i.PAGE_NUMBER == instanceMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber).ToList().ForEach(value =>
1899
            //{
1900
            //    value.PAGE_ANGLE = int.Parse(instanceMain.dzMainMenu.rotate.Angle.ToString());
1901
            //});
1902

    
1903

    
1904
            //이미지 각도 변경 시 실시간 Thumbnail 각도 변경(강인구 추가)
1905
            var thumbnaillist = instanceMain.dzMainMenu.pageNavigator._thumbnailItems.Where(info => info.PageNumber == instanceMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber);
1906

    
1907
            foreach (var data in thumbnaillist)
1908
            {
1909
                data.Angle = int.Parse(instanceMain.dzMainMenu.rotate.Angle.ToString());
1910

    
1911
                //instanceMain.dzMainMenu.pageNavigator.ImgListbox.ItemsSource = instanceMain.dzMainMenu.pageNavigator._thumbnailItems;
1912
                var instance = instanceMain.dzMainMenu.CurrentDoc.docInfo.DOCPAGE.Where(p => p.PAGE_NUMBER == instanceMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber).FirstOrDefault();
1913
                instance.PAGE_ANGLE = int.Parse(instanceMain.dzMainMenu.rotate.Angle.ToString());
1914

    
1915
                instanceMain.dzMainMenu.pageNavigator.GotoPage(data.PageNumber);
1916

    
1917
                //rotation page add or update
1918
                var rotationdoc = ViewerDataModel.Instance.RotationDocs.Where(d => d.ID == instance.ID).FirstOrDefault();
1919
                if (rotationdoc != null)
1920
                {
1921
                    rotationdoc.PAGE_ANGLE = instance.PAGE_ANGLE;
1922
                }
1923
                else
1924
                {
1925
                    ViewerDataModel.Instance.RotationDocs.Add(instance);
1926
                }
1927
            }
1928
        }
1929
        #endregion
1930

    
1931
        private void ImageConverter(RadToggleButton instanceToggle)
1932
        {
1933
            try
1934
            {           
1935
                var instanceMain = this.ParentOfType<MainWindow>();
1936

    
1937
                Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
1938
                dlg.Filter = "All files (*.*)|*.*|PNG Images (*.png)|*.png";
1939
                Nullable<bool> result = dlg.ShowDialog();
1940
                if (result == true)
1941
                {
1942
                    instanceMain.dzMainMenu.filename = dlg.FileName;
1943
                    instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ImgControl;
1944

    
1945
                    System.IO.FileInfo fileInfo = new System.IO.FileInfo(instanceMain.dzMainMenu.filename);
1946
                    String strFile = System.IO.Path.GetFileName(instanceMain.dzMainMenu.filename);
1947
                    long numByte = fileInfo.Length;
1948
                    double dLen = Convert.ToDouble(fileInfo.Length / 1000000);
1949
                    kr.co.devdoftech.cloud.FileUpload fileUploader = App.FileUploader;
1950
             
1951
                    if (dLen < 4)
1952
                    {
1953
                        System.IO.FileStream fStream = new System.IO.FileStream(instanceMain.dzMainMenu.filename, System.IO.FileMode.Open, System.IO.FileAccess.Read);
1954
                        System.IO.BinaryReader br = new System.IO.BinaryReader(fStream);
1955
                        byte[] data = br.ReadBytes((int)numByte);
1956
                        br.Close();
1957

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

    
1960
                        Check_Uri.UriCheck(filepath);
1961

    
1962
                        instanceMain.dzMainMenu.filename = filepath;
1963

    
1964
                        fStream.Close();
1965
                        fStream.Dispose();
1966
                    }
1967
                    else
1968
                    {
1969
                        this.ParentOfType<MainWindow>().DialogMessage_Alert("Available Memory less than 4 mega byte", "Alert");
1970
                    }
1971
                }
1972
                else
1973
                {
1974
                    instanceToggle.IsChecked = false;
1975
                    Common.ViewerDataModel.Instance.SelectedControl = "";
1976
                    Common.ViewerDataModel.Instance.ControlTag = null;
1977
                    this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
1978
                    this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
1979
                    this.ParentOfType<MainWindow>().DialogMessage_Alert("No Image selected.", "Alert");
1980
                }
1981
            }
1982
            catch(Exception ex)
1983
            {
1984
                instanceToggle.IsChecked = false;
1985
                Common.ViewerDataModel.Instance.SelectedControl = "";
1986
                Common.ViewerDataModel.Instance.ControlTag = null;
1987
                this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
1988
                this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
1989
                App.FileLogger.Error("Image Converter ",ex);
1990

    
1991
                this.ParentOfType<MainWindow>().DialogMessage_Alert("System Error" , "Alert");
1992
            }
1993
        }
1994

    
1995
        private void Control_Init(RadToggleButton instanceToggle, object sender)
1996
        {
1997

    
1998
        }
1999

    
2000
        private void ControlEvent(object sender, RoutedEventArgs e)
2001
        {
2002
            RadToggleButton instanceToggle = sender as RadToggleButton;
2003
            var instanceMain = this.ParentOfType<MainWindow>();
2004

    
2005
            #region Ctrl + A 눌렀을 때 대처 방법 
2006
            //원인 : Ctrl + A를 누르면 UIElementSet에 등록을 시키지 않는다(이유는 한꺼번에 많은 양의 컨트롤의 동작이 유입되기 때문에
2007
            //       시스템의 성능저하를 불러올 수 있기 때문이다. 그래서 선택 후 다른 컨트롤을 누르면 등록되지 않은 컨트롤이기 때문에 삭제된다
2008
            //       이를 대처하는 방법으로 아래 코드를 사용한다.
2009
            if (Common.ViewerDataModel.Instance.MarkupControls.Count == 0 && Common.ViewerDataModel.Instance.MarkupControls.Count >= 1)
2010
            {
2011
                //var lstItem = instanceMain.DeepLayer._SelectLayer.ChildrenOfType<AdornerFinal>().ToList();
2012
                //foreach (var item in lstItem)
2013
                //{
2014
                //    foreach (var member in item.MemberSet)
2015
                //    {
2016
                //        if (!instanceMain.DeepLayer.UIElementSet.Contains(member.DrawingData))
2017
                //        {
2018
                //            instanceMain.DeepLayer.UIElementSet.Add(member.DrawingData);
2019
                //        }
2020
                //    }
2021
                //}
2022
            }
2023
            #endregion
2024

    
2025
            //if (!instanceMain.IsFreeSelectionMode)
2026
            //{
2027
            //    instanceMain.IsSwingMode = true;
2028
            //}
2029

    
2030
            //#region 다른 컨트롤 버튼 선택 해제
2031
            //System.Reactive.Linq.Observable2.FromPropertyChangedPattern(Common.ViewerDataModel.Instance, temp => temp.SelectedControl).Subscribe(ControlState =>
2032
            //{
2033
            //    if (ControlState == null)
2034
            //    {
2035
            //        instanceToggle.IsChecked = false;
2036
            //        HiddenControlHide();
2037
            //    }
2038
            //});
2039
            //#endregion
2040

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

    
2043
            if (instanceToggle != null)
2044
            {
2045
                Common.ViewerDataModel.Instance.ControlTag = instanceToggle.Tag.ToString();
2046
            }
2047
            else if ((sender as RadRibbonToggleButton) != null)
2048
            {
2049
                Common.ViewerDataModel.Instance.ControlTag = (sender as RadRibbonToggleButton).Tag.ToString();
2050
                instanceToggle = (sender as RadRibbonToggleButton);
2051
            }
2052
            else if ((sender as RadRibbonButton) != null)
2053
            {
2054
                RadRibbonButton instanceButton = sender as RadRibbonButton;
2055
                Common.ViewerDataModel.Instance.ControlTag = instanceButton.Tag.ToString();
2056
            }
2057
            else
2058
            {
2059
                RadButton instanceButton = sender as RadButton;
2060
                Common.ViewerDataModel.Instance.ControlTag = instanceButton.Tag.ToString();
2061
            }
2062

    
2063

    
2064
            //System.Reactive.Linq.Observable2.FromPropertyChangedPattern(Common.ViewerDataModel.Instance, temp => temp.AngleVisibility).Subscribe(isSee =>
2065
            //{
2066
            //    if (instanceToggle.CommandParameter.ToString() == "ChainLine")
2067
            //    {
2068

    
2069
            //    }
2070
            //    else
2071
            //    {
2072
            //        System.Diagnostics.Debug.WriteLine(" instanceMain.dzMainMenu.MainAngle.Visibility   " + isSee);
2073

    
2074
            //        if (instanceMain.dzMainMenu.MainAngle.Visibility != isSee)
2075
            //        {
2076
            //            instanceMain.dzMainMenu.MainAngle.Visibility = isSee;
2077
            //        }
2078
            //    }
2079
            //    //System.Reactive.Linq.Observable2.FromPropertyChangedPattern(Common.ViewerDataModel.Instance, temp => temp.AngleValue).Subscribe(p =>
2080
            //    //{
2081
            //    //    instanceMain.dzMainMenu.MainAngle.AngleValue = p;
2082
            //    //});
2083
            //});
2084

    
2085
            instanceMain.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Drawing;
2086

    
2087
            instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = false;
2088

    
2089
            if (instanceToggle.IsChecked != false)
2090
            {
2091
                string param = instanceToggle.CommandParameter.ToString();
2092
                string MacroIndex = "";
2093

    
2094
                if (param.StartsWith("MACRO"))
2095
                {
2096
                    param = "MACRO";
2097
                    MacroIndex = param.Replace("MACRO;","");
2098

    
2099
                    //Common.ViewerDataModel.Instance.MacroItems = MacroHelper.LoadMacroItems(MacroIndex);
2100
                    //var items = MacroHelper.TopMenuItems();
2101

    
2102
                    Common.ViewerDataModel.Instance.MacroItems = new List<MacroItem>
2103
                    {
2104
                        new MacroItem
2105
                        {
2106
                            Desc = "Cloud Rectangle",
2107
                            ControlType = MarkupToPDF.Controls.Common.ControlType.RectCloud
2108
                        },
2109
                        new MacroItem
2110
                        {
2111
                             Desc = "Arrow TextBox",
2112
                            ControlType = MarkupToPDF.Controls.Common.ControlType.ArrowTextBorderControl
2113
                        }
2114
                    };
2115
                }
2116

    
2117
                #region 컨트롤이 체크되었다면
2118
                switch (param)
2119
                {
2120
                    #region Line
2121
                    case "Line":
2122
                        Common.ViewerDataModel.Instance.SelectedControl = "Line";
2123
                        //HiddenAxisLock.Visibility = Visibility.Visible;
2124
                        if (instanceToggle.Tag.ToString() == "LineDelete")
2125
                        {
2126
                            //HiddenInterval.Visibility = Visibility.Visible;
2127
                        }
2128
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.SingleLine;
2129
                        break;
2130
                    #endregion
2131
                    #region ChainLine
2132
                    case "ChainLine":
2133
                        Common.ViewerDataModel.Instance.SelectedControl = "ChainLine";
2134
                        //HiddenAxisLock.Visibility = Visibility.Visible;
2135
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ChainLine;
2136
                        break;
2137
                    #endregion
2138
                    #region DimLine
2139
                    case "DimLine":
2140
                        Common.ViewerDataModel.Instance.SelectedControl = "DimLine";
2141
                        //HiddenAxisLock.Visibility = Visibility.Visible;
2142
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.DimLine;
2143
                        break;
2144
                    #endregion
2145
                    #region TwinLine
2146
                    case "TwinLine":
2147
                        Common.ViewerDataModel.Instance.SelectedControl = "TwinLine";
2148
                        //HiddenAxisLock.Visibility = Visibility.Visible;
2149
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.TwinLine;
2150
                        break;
2151
                    #endregion
2152
                    #region CancelLine
2153
                    case "CancelLine":
2154
                        Common.ViewerDataModel.Instance.SelectedControl = "CancelLine";
2155
                        //HiddenAxisLock.Visibility = Visibility.Visible;
2156
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.CancelLine;
2157
                        break;
2158
                    #endregion
2159
                    #region PolygonCloud
2160
                    case "PolygonCloud":
2161
                        Common.ViewerDataModel.Instance.SelectedControl = "PolygonCloud";
2162
                        //HiddenAxisLock.Visibility = Visibility.Visible;
2163
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.PolygonCloud;
2164
                        break;
2165
                    #endregion
2166
                    #region RectCloud
2167
                    case "RectCloud":
2168
                        Common.ViewerDataModel.Instance.SelectedControl = "RectCloud";
2169
                        //HiddenAxisLock.Visibility = Visibility.Visible;
2170
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.RectCloud;
2171
                        break;
2172
                    #endregion
2173
                    #region Rectangle
2174
                    case "Rectangle":
2175
                        Common.ViewerDataModel.Instance.SelectedControl = "Rectangle";
2176
                        //HiddenAxisLock.Visibility = Visibility.Visible;
2177
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Rectangle;
2178
                        break;
2179
                    #endregion
2180
                    #region Triangle
2181
                    case "Triangle":
2182
                        Common.ViewerDataModel.Instance.SelectedControl = "Triangle";
2183
                        //HiddenAxisLock.Visibility = Visibility.Visible;
2184
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Triangle;
2185
                        break;
2186
                    #endregion
2187
                    #region RectCloud
2188
                    case "Circle":
2189
                        Common.ViewerDataModel.Instance.SelectedControl = "Circle";
2190
                        //HiddenAxisLock.Visibility = Visibility.Visible;
2191
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Circle;
2192
                        break;
2193
                    #endregion
2194
                    #region Symbol
2195
                    case "Symbol":
2196
                        Common.ViewerDataModel.Instance.SelectedControl = "Symbol";
2197
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2198
                        break;
2199
                    #endregion
2200
                    #region SymbolN
2201
                    case "SymbolN":
2202
                        Common.ViewerDataModel.Instance.SelectedControl = "SymbolN";
2203
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Stamp;
2204
                        break;
2205
                    #endregion
2206
                    #region Text
2207
                    case "Text":
2208
                        Common.ViewerDataModel.Instance.SelectedControl = "Text";
2209
                        TaskMessage("Text 도구는 텍스트 영역을 더블 클릭하여 텍스트를 재 편집 할 수 있습니다", TaskMessageType.Normal);
2210
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.TextControl;
2211
                        break;
2212
                    #endregion
2213
                    #region TextBorder
2214
                    case "TextBorder":
2215
                        Common.ViewerDataModel.Instance.SelectedControl = "TextBorder";
2216
                        TaskMessage("Text 도구는 텍스트 영역을 더블 클릭하여 텍스트를 재 편집 할 수 있습니다", TaskMessageType.Normal);
2217
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.TextBorder;
2218
                        break;
2219
                    #endregion
2220
                    #region TextCloud
2221
                    case "TextCloud":
2222
                        Common.ViewerDataModel.Instance.SelectedControl = "TextCloud";
2223
                        TaskMessage("Text 도구는 텍스트 영역을 더블 클릭하여 텍스트를 재 편집 할 수 있습니다", TaskMessageType.Normal);
2224
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.TextCloud;
2225
                        break;
2226
                    #endregion
2227
                    #region Date
2228
                    case "Date":
2229
                        Common.ViewerDataModel.Instance.SelectedControl = "Date";
2230
                        TaskMessage("날짜 컨트롤을 더블 클릭하면 날짜를 변경할 수 있습니다", TaskMessageType.Normal);
2231
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Date;
2232
                        break;
2233
                    #endregion
2234
                    #region ArrowText
2235
                    case "ArrowText":
2236
                        TaskMessage("ArrowText 컨트롤은 그린 후 컨트롤을 선택하였을 시 중간점을 조정할 수 있습니다", TaskMessageType.Normal);
2237
                        if (instanceToggle.Tag.ToString() == "ArrowText_Cloud")
2238
                        {
2239
                            Common.ViewerDataModel.Instance.SelectedControl = "ArrowText_Cloud";
2240
                            instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowTextCloudControl;
2241
                        }
2242
                        else if (instanceToggle.Tag.ToString() == "ArrowText_Border")
2243
                        {
2244
                            Common.ViewerDataModel.Instance.SelectedControl = "ArrowTextBorderControl";
2245
                            instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowTextBorderControl;
2246
                        }
2247
                        else if (instanceToggle.Tag.ToString() == "ArrowTextFix_Normal")
2248
                        {
2249
                            Common.ViewerDataModel.Instance.SelectedControl = "ArrowTransTextControl";
2250
                            instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowTransTextControl;
2251
                        }
2252
                        else if (instanceToggle.Tag.ToString() == "ArrowTextFix_Border")
2253
                        {
2254
                            Common.ViewerDataModel.Instance.SelectedControl = "ArrowTransTextBorderControl";
2255
                            instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowTransTextBorderControl;
2256
                        }
2257
                        else if (instanceToggle.Tag.ToString() == "ArrowTextFix_Cloud")
2258
                        {
2259
                            Common.ViewerDataModel.Instance.SelectedControl = "ArrowTransTextCloudControl";
2260
                            instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowTransTextCloudControl;
2261
                        }
2262
                        else
2263
                        {
2264
                            Common.ViewerDataModel.Instance.SelectedControl = "ArrowText";
2265
                            instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowTextControl;
2266
                            //HiddenAxisLock.Visibility = Visibility.Visible;
2267
                        }
2268
                        break;
2269
                    #endregion
2270
                    #region Arrow
2271
                    case "Arrow":
2272
                        Common.ViewerDataModel.Instance.SelectedControl = "Arrow";
2273
                        //HiddenAxisLock.Visibility = Visibility.Visible;
2274
                        //HiddenDimSize.Visibility = Visibility.Visible;
2275
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowLine;
2276
                        break;
2277
                    #endregion
2278
                    #region Shape
2279
                    case "Shape":
2280
                        Common.ViewerDataModel.Instance.SelectedControl = "Shape";
2281
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Mark;
2282
                        break;
2283
                    #endregion
2284
                    #region Polygon
2285
                    case "Polygon":
2286
                        Common.ViewerDataModel.Instance.SelectedControl = "Polygon";
2287
                        TaskMessage("자유형 코멘트 도구는 오른쪽 마우스 클릭을 통해 그리기를 마칠 수 있습니다", TaskMessageType.Normal);
2288
                        //HiddenAxisLock.Visibility = Visibility.Visible;
2289
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.PolygonControl;
2290
                        break;
2291
                    #endregion
2292
                    #region Arc
2293
                    case "Arc":
2294
                        Common.ViewerDataModel.Instance.SelectedControl = "Arc";
2295
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArcLine;
2296
                        //HiddenAxisLock.Visibility = Visibility.Visible;
2297
                        TaskMessage("Arc 코멘트 도구는 오른쪽 마우스를 사용해 좌우 반전을 사용하실 수 있습니다", TaskMessageType.Normal);
2298
                        break;
2299
                    #endregion
2300
                    #region ArrowArc
2301
                    case "ArrowArc":
2302
                        Common.ViewerDataModel.Instance.SelectedControl = "ArrowArc";
2303
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArcArrow;
2304
                        //HiddenAxisLock.Visibility = Visibility.Visible;
2305
                        TaskMessage("ArcArrow 코멘트 도구는 오른쪽 마우스를 사용해 좌우 반전을 사용하실 수 있습니다", TaskMessageType.Normal);
2306
                        break;
2307
                    #endregion
2308
                    #region ArrowMulti
2309
                    case "ArrowMulti":
2310
                        Common.ViewerDataModel.Instance.SelectedControl = "ArrowMulti";
2311
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowMultiLine;
2312
                        //HiddenAxisLock.Visibility = Visibility.Visible;
2313
                        break;
2314
                    #endregion
2315
                    #region Etc
2316
                    case "Etc":
2317
                        Common.ViewerDataModel.Instance.SelectedControl = "Etc";
2318
                        break;
2319
                    #endregion
2320
                    #region Ink
2321
                    case "Ink":
2322
                        if (instanceToggle.Tag.ToString() == "EraserClear")
2323
                        {
2324
                            TaskMessage("해당 컨트롤은 점 단위로 그려진 펜을 지웁니다", TaskMessageType.Normal);
2325
                            //instanceMain.dzMainMenu.inkDrawingCanvas.EditingMode = InkCanvasEditingMode.EraseByPoint;
2326
                            instanceMain.dzMainMenu.inkBoard.Tag = "EraseByPoint";
2327
                        }
2328
                        else if (instanceToggle.Tag.ToString() == "Eraser")
2329
                        {
2330
                            TaskMessage("해당 컨트롤은 선 단위로 그려진 펜을 지웁니다", TaskMessageType.Normal);
2331
                            instanceMain.dzMainMenu.inkBoard.Tag = "EraseByStroke";
2332
                            //instanceMain.dzMainMenu.inkDrawingCanvas.EditingMode = InkCanvasEditingMode.EraseByStroke;
2333
                        }
2334
                        else
2335
                        {
2336
                            instanceMain.dzMainMenu.inkBoard.Tag = "Ink";
2337
                            //instanceMain.dzMainMenu.inkDrawingCanvas.EditingMode = InkCanvasEditingMode.Ink;
2338
                        }
2339

    
2340
                        //instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = true;
2341

    
2342
                        Common.ViewerDataModel.Instance.SelectedControl = "Ink";
2343
                        Common.ViewerDataModel.Instance.LineSize = (double)cbLineSize.Value;
2344
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.PenControl;
2345
                        break;
2346
                    #endregion
2347
                    #region Select
2348
                    case "Select":
2349
                        if(this.ParentOfType<MainWindow>().dzMainMenu.currentControl != null)
2350
                        {
2351
                            ViewerDataModel.Instance.MarkupControls_USER.Remove(this.ParentOfType<MainWindow>().dzMainMenu.currentControl);
2352
                            this.ParentOfType<MainWindow>().dzMainMenu.currentControl = null;
2353
                        }
2354
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Selecting;
2355
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2356
                        instanceMain.dzMainMenu.isLeftMouseButtonDownOnWindow = false;
2357
                        break;
2358
                    #endregion
2359
                    #region Image
2360
                    case "Image":
2361
                        Common.ViewerDataModel.Instance.SelectedControl = "ImgControl";
2362
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ImgControl;
2363
                        ImageConverter(instanceToggle);
2364
                        break;
2365
                    #endregion
2366
                    #region Sign
2367
                    case "Sign":
2368
                        Common.ViewerDataModel.Instance.SelectedControl = "Sign";
2369
                        Common.ViewerDataModel.Instance.ControlTag = instanceMain.dzMainMenu._ViewInfo.UserID; //사번
2370
                        //강인구 추가
2371
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Sign;
2372
                        //instanceMain.BaseClient.GetUserSignCompleted += (sen, ea) =>
2373
                        //{
2374
                        //    if (ea.Result == null)
2375
                        //    {
2376

    
2377
                        //        this.ParentOfType<MainPage>().DialogMessage_Alert("You Don't Have Sign Data", "Alert");
2378
                        //    }
2379
                        //    else
2380
                        //    {
2381
                        //        byte[] imageBytes = System.Convert.FromBase64String(ea.Result);
2382
                        //        using (MemoryStream ms = new MemoryStream(imageBytes))
2383
                        //        {
2384
                        //            BitmapImage im = new BitmapImage();
2385
                        //            im.SetSource(ms);
2386
                        //            instanceMain.DeepLayer.SignImage = im;
2387
                        //            ms.Close();
2388
                        //        }
2389
                        //    }
2390
                        //};
2391
                        //instanceMain.BaseClient.GetUserSignAsync(instanceMain._ViewInfo.UserID);
2392
                        break;
2393
                    #endregion
2394
                    #region Check
2395
                    case "Check":
2396
                        Common.ViewerDataModel.Instance.SelectedControl = "Check";
2397
                        Common.ViewerDataModel.Instance.ControlTag = instanceMain.dzMainMenu._ViewInfo.UserID; //사번
2398
                        //강인구 추가
2399
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Symbol;
2400
                        break;
2401
                    #endregion
2402
                    #region Batch
2403
                    case "Batch":
2404
                        Common.ViewerDataModel.Instance.SelectedControl = "Batch";
2405
                        Common.ViewerDataModel.Instance.ControlTag = instanceMain.dzMainMenu._ViewInfo.UserID; //사번
2406
                        //강인구 추가
2407
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Mark;
2408
                        instanceMain.dzMainMenu.txtBatch.Visibility = Visibility.Visible;
2409
                        instanceMain.dzMainMenu.txtBatch.Text = "Place Mark";
2410
                        break;
2411
                    #endregion
2412

    
2413
                    #region MACRO -MACRO1
2414
                    case "MACRO":
2415
                        Common.ViewerDataModel.Instance.SelectedControl = "MACRO";
2416
                        Common.ViewerDataModel.Instance.ControlTag = instanceMain.dzMainMenu._ViewInfo.UserID; //사번
2417

    
2418
                        MacroHelper.MacroAction();
2419

    
2420
                        break;
2421
                    #endregion
2422

    
2423
                    #region Copy
2424
                    case "Copy":
2425
                        Copy_Start();
2426
                        instanceToggle.IsChecked = false;
2427
                        ViewerDataModel.Instance.SelectedControl = "";
2428
                        ViewerDataModel.Instance.ControlTag = null;
2429
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2430
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2431
                        break;
2432
                    #endregion
2433
                    #region Cut
2434
                    case "Cut":
2435
                        //Cut_Start();
2436
                        CutCommand.Instance.Execute();
2437
                        instanceToggle.IsChecked = false;
2438
                        ViewerDataModel.Instance.SelectedControl = "";
2439
                        ViewerDataModel.Instance.ControlTag = null;
2440
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2441
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2442
                        break;
2443
                    #endregion
2444
                    #region Paste
2445
                    case "Paste":
2446
                        Paste_Start();
2447
                        instanceToggle.IsChecked = false;
2448
                        ViewerDataModel.Instance.SelectedControl = "";
2449
                        ViewerDataModel.Instance.ControlTag = null;
2450
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2451
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;                        
2452
                        break;
2453
                    #endregion
2454
                    #region Delete
2455
                    case "Delete":
2456
                        DeleteCommand.Instance.Execute(SelectionSet.Instance.SelectedItems);
2457
                        this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Clear();
2458

    
2459
                        instanceToggle.IsChecked = false;
2460
                        ViewerDataModel.Instance.SelectedControl = "";
2461
                        ViewerDataModel.Instance.ControlTag = null;
2462
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2463
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2464
                        break;
2465
                    #endregion
2466
                    #region Undo
2467
                    case "Undo":
2468
                        UndoCommand.Instance.Execute();
2469
                        instanceToggle.IsChecked = false;
2470
                        ViewerDataModel.Instance.SelectedControl = "";
2471
                        ViewerDataModel.Instance.ControlTag = null;
2472
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2473
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2474
                        break;
2475
                    #endregion
2476
                    #region Redo
2477
                    case "Redo":
2478
                        RedoCommand.Instance.Execute();
2479
                        instanceToggle.IsChecked = false;
2480
                        ViewerDataModel.Instance.SelectedControl = "";
2481
                        ViewerDataModel.Instance.ControlTag = null;
2482
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2483
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2484
                        break;
2485
                    #endregion
2486
                    #region DragZoom
2487
                    case "DragZoom":
2488
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.DragZoom;
2489
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2490
                        instanceMain.dzMainMenu.isLeftMouseButtonDownOnWindow = false;
2491
                        break;
2492
                    #endregion
2493
                    #region Grouping
2494
                    case "Group":
2495
                        //var GrouptoggleList = this.Parent.ChildrenOfType<RadRibbonToggleButton>();
2496
                        //foreach (var togle in GrouptoggleList)
2497
                        //{
2498
                        //    togle.IsChecked = false;
2499
                        //}
2500

    
2501
                        //if (this.ParentOfType<MainWindow>().dzMainMenu.currentControl != null)
2502
                        //{
2503
                        //    ViewerDataModel.Instance.MarkupControls_USER.Remove(this.ParentOfType<MainWindow>().dzMainMenu.currentControl);
2504
                        //    this.ParentOfType<MainWindow>().dzMainMenu.currentControl = null;
2505
                        //}
2506
                        //this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2507
                        //instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2508
                        //instanceMain.dzMainMenu.isLeftMouseButtonDownOnWindow = false;
2509
                        //if (ViewerDataModel.Instance.SystemMain.dzMainMenu.SelectLayer.Children.Count < 1) //선택된 것이 없으면
2510
                        //{
2511
                        //    this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert("Please Select Controls", "Alert");
2512
                        //}
2513
                        //else//if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
2514
                        //{
2515
                        //    // string MarkupData = "";
2516
                        //    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
2517
                        //    {
2518
                        //        if (item.GetType().Name == "AdornerFinal" && (item as AdornerFinal).MemberSet.Count >= 2) // 얘가 2개 이상이여야 그룹가능 버튼도 막을거긴하지만 일단..
2519
                        //        {
2520
                        //            //MARKUP_DATA_GROUP INSERT
2521
                        //            MARKUP_DATA_GROUP mARKUP_DATA_GROUP = new MARKUP_DATA_GROUP
2522
                        //            {
2523
                        //                SYMBOL_ID = null,//InnerItem.Symbol_ID
2524
                        //                STATE = 0,
2525
                        //            };
2526
                        //            long group_id = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.AddMarkupDataGroup(mARKUP_DATA_GROUP, App.ViewInfo.ProjectNO);
2527
                        //            //Logger.sendReqLog("AddMarkupDataGroup: ", "", 1);
2528
                        //            if (group_id > 0)
2529
                        //            {
2530
                        //                foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
2531
                        //                {
2532
                        //                    if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
2533
                        //                    {
2534
                        //                        //MARKUP_DATA UPDATE
2535
                        //                        //Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.UpdateMarkupData((InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo).CommentID, group_id, App.ViewInfo.ProjectNO);
2536
                        //                        ////Logger.sendReqLog("UpdateMarkupData: ", "", 1);
2537
                        //                        ViewerDataModel.Instance.MyMarkupList.Where(d => d.ID == (InnerItem.DrawingData as CommentUserInfo).CommentID).FirstOrDefault().Group_ID = group_id;
2538
                        //                        ViewerDataModel.Instance.MyMarkupList.Where(d => d.ID == (InnerItem.DrawingData as CommentUserInfo).CommentID).FirstOrDefault().IsUpdate = true;
2539
                        //                    }
2540
                        //                }
2541
                        //            }
2542
                        //        }
2543
                        //    }
2544
                        //}
2545
                        break;
2546
                    case "UnGroup":
2547
                        //var UnGrouptoggleList = this.Parent.ChildrenOfType<RadRibbonToggleButton>();
2548
                        //foreach (var togle in UnGrouptoggleList)
2549
                        //{
2550
                        //    togle.IsChecked = false;
2551
                        //}
2552
                        //if (this.ParentOfType<MainWindow>().dzMainMenu.currentControl != null)
2553
                        //{
2554
                        //    ViewerDataModel.Instance.MarkupControls_USER.Remove(this.ParentOfType<MainWindow>().dzMainMenu.currentControl);
2555
                        //    this.ParentOfType<MainWindow>().dzMainMenu.currentControl = null;
2556
                        //}
2557
                        //this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2558
                        //instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2559
                        //instanceMain.dzMainMenu.isLeftMouseButtonDownOnWindow = false;
2560

    
2561
                        //if (ViewerDataModel.Instance.SystemMain.dzMainMenu.SelectLayer.Children.Count < 1) //선택된 것이 없으면
2562
                        //{
2563
                        //    this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert("Please Select Controls", "Alert");
2564
                        //}
2565
                        //else//if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
2566
                        //{
2567
                        //    // string MarkupData = "";
2568
                        //    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
2569
                        //    {
2570
                        //        if (item.GetType().Name == "AdornerFinal" && (item as AdornerFinal).MemberSet.Count >= 1) // 1개 이상 
2571
                        //        {
2572
                        //            //MARKUP_DATA UPDATE
2573
                        //            foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
2574
                        //            {
2575
                        //                if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
2576
                        //                {
2577
                        //                    long group_id = ViewerDataModel.Instance.MyMarkupList.Where(d => d.ID == (InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo).CommentID).FirstOrDefault().Group_ID;
2578
                        //                    //MARKUP_DATA UPDATE
2579
                        //                    //Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.UpdateMarkupData((InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo).CommentID, 0, App.ViewInfo.ProjectNO);
2580
                        //                    ////Logger.sendReqLog("UpdateMarkupData: ", "", 1);
2581
                        //                    ViewerDataModel.Instance.MyMarkupList.Where(d => d.ID == (InnerItem.DrawingData as CommentUserInfo).CommentID).FirstOrDefault().Group_ID = 0;
2582
                        //                    ViewerDataModel.Instance.MyMarkupList.Where(d => d.ID == (InnerItem.DrawingData as CommentUserInfo).CommentID).FirstOrDefault().IsUpdate = true;
2583

    
2584

    
2585
                        //                    //MARKUP_DATA_GROUP UPDATE
2586
                        //                    //bool value = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.UpdateMarkupDataGroup(group_id, App.ViewInfo.ProjectNO);
2587
                        //                    ////Logger.sendReqLog("AddMarkupDataGroup: ", value.ToString(), 1);
2588
                        //                }
2589
                        //            }
2590
                        //        }
2591
                        //    }
2592
                        //}
2593
                        break;
2594
                    #endregion
2595
                    #region Capture
2596
                    case "Capture":
2597
                        SyncInit();
2598
                        //   instanceToggle.IsChecked = false;
2599
                        var CaptureList = this.Parent.ChildrenOfType<RadRibbonToggleButton>();
2600
                        foreach (var togle in CaptureList)
2601
                        {
2602
                            togle.IsChecked = false;
2603
                        }
2604

    
2605
                        if (this.ParentOfType<MainWindow>().dzMainMenu.currentControl != null)
2606
                        {
2607
                            ViewerDataModel.Instance.MarkupControls_USER.Remove(this.ParentOfType<MainWindow>().dzMainMenu.currentControl);
2608
                            this.ParentOfType<MainWindow>().dzMainMenu.currentControl = null;
2609
                        }
2610

    
2611
                        ViewerDataModel.Instance.SelectedControl = "ImgControl";
2612
                   //     ViewerDataModel.Instance.ControlTag = null;
2613
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ImgControl;
2614

    
2615
                        /*
2616
                        //캡쳐 하기 전에 코멘트 저장
2617
                        if (Common.ViewerDataModel.Instance.MarkupControls_USER.Count > 0 || (Application.Current.MainWindow as MainWindow).dzMainMenu.SelectLayer.Children.Count > 0)
2618
                        {
2619
                            var menu = (Application.Current.MainWindow as MainWindow).dzMainMenu;
2620
                            menu.ReleaseAdorner();
2621
                            if (menu.PreviewUserMarkupInfoItem != null && menu.PreviewUserMarkupInfoItem.IsPreviewUser == true)
2622
                            {
2623
                                (Application.Current.MainWindow as MainWindow).dzTopMenu.RefactoryCommentReact(menu);
2624
                            }
2625
                            else if (menu.gridViewMarkup.SelectedItems.Count == 0 || (menu.gridViewMarkup.SelectedItems.FirstOrDefault() as IKCOM.MarkupInfoItem).UserID != App.ViewInfo.UserID)
2626
                            {
2627

    
2628
                            }
2629
                            else
2630
                            {
2631
                                (Application.Current.MainWindow as MainWindow).dzTopMenu.RefactoryCommentReact(menu);
2632
                            }
2633
                        }*/
2634

    
2635
                        //Common.ViewerDataModel.Instance.CheckList_ID = ((e.Source as Telerik.Windows.Controls.RadButton).DataContext as Customer).ID;
2636
                        //Common.ViewerDataModel.Instance.CheckList_ID = ((e.Source as Image).DataContext as Customer).ID;
2637
                        //Common.ViewerDataModel.Instance.PageNumber = ((e.Source as Image).DataContext as Customer).PAGENUMBER;
2638
                        Application.Current.MainWindow.Focus();
2639
                        Common.ViewerDataModel.Instance.Capture_Opacity = 0.49;
2640
                        (Application.Current.MainWindow as MainWindow).dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Capture;
2641
                        break;
2642
                    #endregion
2643
                    #region Cad
2644
                    case "Inside":
2645
                        //instanceMain.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Drawing;
2646
                        //instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = false;
2647
                        Common.ViewerDataModel.Instance.SelectedControl = "InsideWhite";
2648
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.InsideWhite;
2649
                        break;
2650
                    case "Overlap":
2651
                        //instanceMain.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Drawing;
2652
                        //instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = false;
2653
                        Common.ViewerDataModel.Instance.SelectedControl = "OverlapWhite";
2654
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.OverlapWhite;
2655
                        break;
2656
                    case "Clip":
2657
                        //instanceMain.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Drawing;
2658
                        //instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = false;
2659
                        Common.ViewerDataModel.Instance.SelectedControl = "ClipWhite";
2660
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ClipWhite;
2661
                        break;
2662
                    case "CadExport":
2663
                        //if (isClosed)
2664
                        //{
2665
                        //    //토글 및 마우스 상태 초기화
2666
                        //    var toggleList = this.Parent.ChildrenOfType<RadRibbonToggleButton>();
2667
                        //    foreach (var togle in toggleList)
2668
                        //    {
2669
                        //        togle.IsChecked = false;
2670
                        //    }
2671
                        //    this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2672

    
2673
                        //    isClosed = false;
2674
                        //    //Control 파일 먼저 생성
2675
                        //    CollapsedButton_Click();
2676
                        //    CadViewer check = new CadViewer();
2677
                        //    check.WindowStartupLocation = WindowStartupLocation.CenterScreen;
2678
                        //    check.Title = "Export Viewer";
2679
                        //    //check.Topmost = true;
2680
                        //    check.Show();
2681
                        //    check.Closed += Check_Closed;
2682
                        //    instanceToggle.IsChecked = false;
2683
                        //}
2684
                        //break;
2685
                    case "CadViewer":
2686
                        //if (isClosed)
2687
                        //{
2688
                        //    //토글 및 마우스 상태 초기화
2689
                        //    var toggleList = this.Parent.ChildrenOfType<RadRibbonToggleButton>();
2690
                        //    foreach (var togle in toggleList)
2691
                        //    {
2692
                        //        togle.IsChecked = false;
2693
                        //    }
2694
                        //    this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2695

    
2696
                        //    isClosed = false;
2697
                        //    CadResultViewer check = new CadResultViewer();
2698
                        //    check.WindowStartupLocation = WindowStartupLocation.CenterScreen;
2699
                        //    check.Title = "Viewer";
2700
                        //    check.Show();
2701

    
2702
                        //    check.Closed += Check_Closed;
2703

    
2704
                        //}
2705
                        break;
2706
                    #endregion
2707
                    default:
2708
                        break;
2709
                }
2710
                #endregion
2711
            }
2712
            else
2713
            {
2714
                if (Common.ViewerDataModel.Instance.IsMacroCommand)
2715
                {
2716
                    MacroHelper.Clear();
2717
                }
2718

    
2719
                if (!instanceMain.dzMainMenu.IsFreeSelectionMode)
2720
                {
2721
                    instanceMain.dzMainMenu.IsSwingMode = false;
2722
                    Common.ViewerDataModel.Instance.SelectedControl = "";
2723
                    Common.ViewerDataModel.Instance.ControlTag = null;
2724
                    this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2725
                    this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2726
                }
2727
            }
2728

    
2729
        }
2730

    
2731
        private void SyncInit()
2732
        {
2733
            try
2734
            {
2735
                if (!ViewerDataModel.Instance.SystemMain.dzMainMenu.testPanel2.IsHidden)
2736
                {
2737
                    ViewerDataModel.Instance.SystemMain.dzMainMenu.testPanel2.IsHidden = true;
2738
                    ViewerDataModel.Instance.PageBalanceMode = false;
2739
                    ViewerDataModel.Instance.PageBalanceNumber = 0;
2740
                    ViewerDataModel.Instance.SyncPageNumber = 0;
2741
                    ViewerDataModel.Instance.MarkupControls_Sync.Clear();
2742
                    ViewerDataModel.Instance.SystemMain.dzMainMenu.gridViewRevMarkup.Visibility = Visibility.Collapsed;
2743
                    ViewerDataModel.Instance.SystemMain.dzMainMenu.UserList.IsChecked = false;
2744
                    ViewerDataModel.Instance.SystemMain.dzMainMenu.BalanceMode.IsChecked = false;
2745
                }
2746
            }
2747
            catch (Exception ex)
2748
            {
2749
                //Logger.sendResLog("SyncInit", ex.Message, 0);
2750
            }
2751

    
2752
        }
2753

    
2754
        Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
2755
        CommentUserInfo currentControl { get; set; }
2756
        private void Check_Closed(object sender, EventArgs e)
2757
        {
2758
            isClosed = true;
2759
            //this.ParentOfType<MainWindow>().dzMainMenu.PN_Navi.IsEnabled = true;
2760
            //토글 및 마우스 상태 초기화
2761
            var toggleList = this.Parent.ChildrenOfType<RadToggleButton>();
2762
            foreach (var togle in toggleList)
2763
            {
2764
                togle.IsChecked = false;
2765
            }
2766
            this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2767
            ViewerDataModel.Instance.Capture_Opacity = 0;
2768

    
2769
        }
2770

    
2771
        /* public class test 
2772
         {
2773
             public double width { get; set; }
2774
             public double height { get; set; }
2775
         }
2776
         */
2777
        private async void CollapsedButton_Click()
2778
        {
2779
            this.ParentOfType<MainWindow>().dzTopMenu._SaveEvent(null, null); // 저장하지 못한 데이터가 있다면 저장
2780

    
2781
            string[] data = new string[0];
2782

    
2783
            int cnt = 0;
2784
            var menu = this.ParentOfType<MainWindow>().dzMainMenu;
2785

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

    
2788
            foreach (var item in gridSelectionItem)
2789
            {
2790
                if ((item.UserID == App.ViewInfo.UserID) && (ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.CurrentPage != null))
2791
                {
2792
                    var instance = ViewerDataModel.Instance.MyMarkupList.Where(d => d.PageNumber == ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber &&
2793
                    d.MarkupInfoID == item.MarkupInfoID).ToList();
2794
                    data = new string[instance.Count];
2795
                    foreach (var markup in instance)
2796
                    {
2797
                        data[cnt++] = await MarkupToPDF.Serialize.Core.JsonSerializerHelper.UnCompressStringAsync(markup.Data,ViewerDataModel.Instance.CancellationToken());
2798
                    }
2799
                }
2800
            }
2801

    
2802
            if (data != null && KCOM.Properties.Settings.Default.cad == 1)
2803
            {
2804
                string FilePath = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\Cad");
2805
                string FileName = FilePath + "\\commentstring.json"; // Default file name
2806
                if (!File.Exists(FilePath))
2807
                {
2808
                    Directory.CreateDirectory(FilePath);
2809
                }
2810

    
2811
                if (!string.IsNullOrEmpty(FileName))
2812
                {
2813
                    //  File.WriteAllText(SaveDig.FileName, data);
2814
                    File.WriteAllLines(FileName, data);
2815
                }
2816
            }
2817
        }
2818

    
2819
        private double minHeight;
2820
        private double minWidth;
2821

    
2822
        private double maxHeight;
2823
        private double maxWidth;
2824

    
2825
        public bool CanVResize { get; private set; }
2826
        public bool CanHResize { get; private set; }
2827

    
2828
        public void DesignerComponent(FrameworkElement content)
2829
        {
2830
            this.InitializeComponent();
2831

    
2832
            if (!double.IsNaN(content.Width))
2833
            {
2834
                CanHResize = false;
2835
                this.Width = content.Width;
2836
            }
2837
            else
2838
            {
2839
                CanHResize = true;
2840
                this.Width = 23.0;
2841
            }
2842
            if (!double.IsNaN(content.Height))
2843
            {
2844
                CanVResize = false;
2845
                this.Height = content.Height; ;
2846
            }
2847
            else
2848
            {
2849
                CanVResize = true;
2850
                this.Height = 23.0;
2851
            }
2852

    
2853
            minWidth = content.MinWidth < 10.0 ? 10.0 : content.MinWidth;
2854
            minHeight = content.MinHeight < 10.0 ? 10.0 : content.MinHeight;
2855
            maxWidth = content.MaxWidth;
2856
            maxHeight = content.MaxHeight;
2857

    
2858
            double top = (double)content.GetValue(Canvas.TopProperty);
2859
            if (double.IsNaN(top))
2860
                top = 0.0;
2861
            double left = (double)content.GetValue(Canvas.LeftProperty);
2862
            if (double.IsNaN(left))
2863
                left = 0.0;
2864
            SetValue(Canvas.TopProperty, top);
2865
            SetValue(Canvas.LeftProperty, left);
2866

    
2867
            //Set the actual content. Note that "Content" property is a new property. See below
2868
            this.Content = content;
2869
        }
2870
        private void Thumb_DragDelta(object sender, DragDeltaEventArgs e)
2871
        {
2872
            string name = ((Thumb)sender).Name;
2873
            if (name.Contains("Top"))
2874
            {
2875
                double newHeight = this.Height - e.VerticalChange;
2876
                if (newHeight >= minHeight && newHeight <= maxHeight)
2877
                {
2878
                    this.Height = newHeight;
2879
                    SetValue(Canvas.TopProperty,
2880
                (double)GetValue(Canvas.TopProperty) + e.VerticalChange);
2881
                }
2882
            }
2883
            if (name.Contains("Right"))
2884
            {
2885
                double newWidth = this.Width + e.HorizontalChange;
2886
                if (newWidth >= minWidth && newWidth <= maxWidth)
2887
                    this.Width = newWidth;
2888
            }
2889
            if (name.Contains("Bottom"))
2890
            {
2891
                double newHeight = this.Height + e.VerticalChange;
2892
                if (newHeight >= minHeight && newHeight <= maxHeight)
2893
                    this.Height = newHeight;
2894
            }
2895
            if (name.Contains("Left"))
2896
            {
2897
                double newWidth = this.Width - e.HorizontalChange;
2898
                if (newWidth >= minWidth && newWidth <= maxWidth)
2899
                {
2900
                    this.Width = newWidth;
2901
                    SetValue(Canvas.LeftProperty,
2902
                (double)GetValue(Canvas.LeftProperty) + e.HorizontalChange);
2903
                }
2904
            }
2905
        }
2906

    
2907
        private void drawControlBorder(object sender)
2908
        {
2909
            System.Windows.Controls.Control control = (System.Windows.Controls.Control)sender;
2910
        }
2911

    
2912
        private void ResizeThumb_DragDelta(object sender, MouseButtonEventArgs e)
2913
        {
2914
            System.Windows.Controls.Control designerItem = (System.Windows.Controls.Control)sender;
2915
            if (designerItem != null)
2916
            {
2917
                double deltaVertical, deltaHorizontal;
2918

    
2919
                switch (VerticalAlignment)
2920
                {
2921
                    case VerticalAlignment.Bottom:
2922
                        deltaVertical = designerItem.ActualHeight - designerItem.MinHeight;
2923
                        designerItem.Height -= deltaVertical;
2924
                        break;
2925
                    case VerticalAlignment.Top:
2926
                        deltaVertical = designerItem.ActualHeight - designerItem.MinHeight;
2927
                        Canvas.SetTop(designerItem, Canvas.GetTop(designerItem) + deltaVertical);
2928
                        designerItem.Height -= deltaVertical;
2929
                        break;
2930
                    default:
2931
                        break;
2932
                }
2933

    
2934
                switch (HorizontalAlignment)
2935
                {
2936
                    case HorizontalAlignment.Left:
2937
                        deltaHorizontal = designerItem.ActualWidth - designerItem.MinWidth;
2938
                        Canvas.SetLeft(designerItem, Canvas.GetLeft(designerItem) + deltaHorizontal);
2939
                        designerItem.Width -= deltaHorizontal;
2940
                        break;
2941
                    case HorizontalAlignment.Right:
2942
                        deltaHorizontal = designerItem.ActualWidth - designerItem.MinWidth;
2943
                        designerItem.Width -= deltaHorizontal;
2944
                        break;
2945
                    default:
2946
                        break;
2947
                }
2948
            }
2949
            e.Handled = true;
2950
        }
2951

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

    
2954
        void ExportMethod()
2955
        {
2956
            //FileDialogFilter filterImage = new FileDialogFilter("Image Files", "*.jpg", "*.png");
2957
            SaveDig.Filter = "PDF file format|*.pdf";
2958
            SaveDig.Title = "Save an DWG File";
2959
            SaveDig.ShowDialog();
2960
        }
2961

    
2962
        private void cbAutoSave_Checked(object sender, RoutedEventArgs e)
2963
        {            
2964
            if (cbAutoSave.IsChecked == true)
2965
            {
2966
                SaveTime(true, (int)cbSaveInterval.Value);
2967
            }
2968
            else
2969
            {
2970
                SaveTime(false, (int)cbSaveInterval.Value);
2971
            }
2972
        }
2973
        private void cbSaveInterval_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
2974
        {
2975
            if(string.IsNullOrEmpty(cbSaveInterval.Value.ToString()))
2976
            {
2977
                cbSaveInterval.Value = cbSaveInterval.Minimum;
2978
            }
2979
            if (cbAutoSave.IsChecked == true)
2980
            {
2981
                SaveTime(true, (int)cbSaveInterval.Value);
2982
            }
2983

    
2984
            KCOM.Properties.Settings.Default.SaveInterval = (double)cbSaveInterval.Value;
2985
            Properties.Settings.Default.Save();
2986
        }
2987
        //강인구 자동 저장 추가
2988
        private void AutoSave(object sender, RoutedEventArgs e)
2989
        {
2990
            RadToggleButton instanceToggle = sender as RadToggleButton;
2991

    
2992
            if(instanceToggle.IsChecked == true)
2993
            {
2994
                SaveTime(true);
2995
            }
2996
            else
2997
            {
2998
                SaveTime(false);
2999
            }
3000
        }
3001

    
3002
        public void Copy_Start()
3003
        {
3004
            if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
3005
            {
3006
                string MarkupData = "";
3007

    
3008
                foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
3009
                {
3010
                    if (item.GetType().Name == "AdornerFinal")
3011
                    {
3012
                        foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
3013

    
3014
                        {
3015
                            if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
3016
                            {
3017
                                MarkupToPDF.Controls.Parsing.MarkupParser.MarkupReturn res = MarkupParser.MarkupToString(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo, App.ViewInfo.UserID);
3018
                                MarkupData += "|OR|" + res.ConvertData;
3019
                            }
3020
                        }
3021
                        Clipboard.SetDataObject(MarkupData);
3022
                    }
3023
                }
3024
            }
3025
        }
3026

    
3027
        public void Cut_Start()
3028
        {
3029
            if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
3030
            {
3031
                foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
3032
                {
3033
                    string MarkupData = "";
3034

    
3035
                    if (item.GetType().Name == "AdornerFinal")
3036
                    {
3037
                        foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
3038
                        {
3039
                            if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
3040
                            {
3041
                                MarkupToPDF.Controls.Parsing.MarkupParser.MarkupReturn res = MarkupParser.MarkupToString(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo, App.ViewInfo.UserID);
3042
                                MarkupData += "|OR|" + res.ConvertData;
3043
                            }
3044
                        }
3045
                        //클립보드에 넣음
3046
                        Clipboard.SetDataObject(MarkupData);
3047
                    }
3048
                }
3049
                this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Clear();
3050
            }
3051
        }
3052

    
3053
        public async void Paste_Start()
3054
        {
3055
            //마크업 붙여넣기
3056
            if (Clipboard.GetText().Contains("|OR||DZ|"))
3057
            {
3058
                List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>();
3059

    
3060
                string[] delimiterChars = { "|OR|" };
3061
                string[] data = Clipboard.GetText().Split(delimiterChars, StringSplitOptions.RemoveEmptyEntries);
3062

    
3063
                SelectionSet.Instance.UnSelect(this.ParentOfType<MainWindow>().dzMainMenu);
3064

    
3065
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
3066

    
3067
                //강인구 Undo/Redo 보류
3068
                MarkupToPDF.Common.Undo_data UndoData = new Undo_data()
3069
                {
3070
                    IsUndo = false,
3071
                    Event = Event_Type.Create,
3072
                    EventTime = DateTime.Now,
3073
                    Markup_List = new List<Multi_Undo_data>()
3074
                };
3075

    
3076
                ViewerDataModel.Instance.UndoDataList.Where(data1 => data1.IsUndo == true).ToList().ForEach(i =>
3077
                {
3078
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
3079
                });
3080

    
3081
                foreach (string parse in data)
3082
                {
3083
                    if (parse != "")
3084
                    {
3085
                        System.Windows.Controls.Control item = await MarkupParser.ParseExAsync(App.BaseAddress,ViewerDataModel.Instance.CancellationToken(),App.ViewInfo.ProjectNO, parse, ViewerDataModel.Instance.MarkupControls_USER, ViewerDataModel.Instance.PageAngle, string.Empty, string.Empty);
3086
                        (item as MarkupToPDF.Common.CommentUserInfo).CommentID = Commons.shortGuid();
3087

    
3088
                        ViewerDataModel.Instance.MarkupControls.Remove(item as MarkupToPDF.Common.CommentUserInfo);
3089
                        ViewerDataModel.Instance.MarkupControls_USER.Remove(item as MarkupToPDF.Common.CommentUserInfo);
3090

    
3091
                        adornerSet.Add(item as MarkupToPDF.Common.CommentUserInfo);
3092

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

    
3095
                        UndoData.Markup_List.Add(multi_Undo_Data);
3096
                        ViewerDataModel.Instance.UndoDataList.Add(UndoData);                        
3097
                    }
3098
                }
3099
                Controls.AdornerFinal final = new Controls.AdornerFinal(adornerSet);
3100

    
3101
                if(this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.X < 0)
3102
                {
3103
                    Canvas.SetLeft(final, 0);
3104
                    Canvas.SetTop(final, 0);
3105
                }
3106
                else
3107
                {
3108
                    double realPointX = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.X - final.BorderSize.X - (final.BorderSize.Width / 2);
3109
                    double realPointY = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.Y - final.BorderSize.Y - (final.BorderSize.Height / 2);
3110
                    final.TranslateItems(realPointX, realPointY);
3111

    
3112
                    if (final.Members.Where(type => type.Drawingtype == MarkupToPDF.Controls.Common.ControlType.TextControl).FirstOrDefault() != null)
3113
                    {
3114
                        final.TranslateItems(0.001, 0.001); //dummy
3115
                    }
3116
                }
3117

    
3118
                this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Add(final);
3119
            }
3120
            //외부 이미지 붙여넣기
3121
            else if (Clipboard.GetImage() != null)
3122
            {
3123
                try
3124
                {
3125
                    Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
3126

    
3127
                    //강인구 Undo/Redo 보류
3128
                    MarkupToPDF.Common.Undo_data UndoData = new Undo_data()
3129
                    {
3130
                        IsUndo = false,
3131
                        Event = Event_Type.Create,
3132
                        EventTime = DateTime.Now,
3133
                        Markup_List = new List<Multi_Undo_data>()
3134
                    };
3135

    
3136

    
3137
                    string temppath = System.IO.Path.GetTempPath();
3138
                    //string filename = KCOM.Events.Save.shortCommentKey();
3139
                    string filename = Commons.shortFileKey();
3140

    
3141
                    System.Drawing.Image clipboardImage = System.Windows.Forms.Clipboard.GetImage();
3142
                    clipboardImage.Save(temppath + "\\" + filename);
3143

    
3144
                    System.IO.FileInfo fileInfo = new System.IO.FileInfo(temppath + "\\" + filename);
3145
                    String strFile = System.IO.Path.GetFileName(fileInfo.FullName);
3146
                    long numByte = fileInfo.Length;
3147
                    double dLen = Convert.ToDouble(fileInfo.Length / 1000000);
3148
                    kr.co.devdoftech.cloud.FileUpload fileUploader = App.FileUploader;
3149

    
3150
                    if (dLen < 4)
3151
                    {
3152
                        System.IO.FileStream fStream = new System.IO.FileStream(fileInfo.FullName,
3153
                        System.IO.FileMode.Open, System.IO.FileAccess.Read,FileShare.Read);
3154
                        System.IO.BinaryReader br = new System.IO.BinaryReader(fStream);
3155
                        byte[] data = br.ReadBytes((int)numByte);
3156

    
3157
                        filename = fileUploader.Run(App.ViewInfo.ProjectNO, this.ParentOfType<MainWindow>().dzMainMenu._DocItem.DOCUMENT_NO, App.ViewInfo.UserID, strFile + ".png", data);
3158
                        Check_Uri.UriCheck(filename);
3159
                        br.Close();
3160
                        fStream.Close();
3161
                        fStream.Dispose();
3162
                    }
3163
                    else
3164
                    {
3165
                        this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert("Available Memory less than 4 mega byte", "Alert");
3166
                        return;
3167
                    }
3168

    
3169
                    fileInfo.Delete();
3170

    
3171
                    System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(clipboardImage);
3172
                    IntPtr hBitmap = bmp.GetHbitmap();
3173
                    System.Windows.Media.ImageSource WpfBitmap = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(hBitmap, IntPtr.Zero, Int32Rect.Empty, System.Windows.Media.Imaging.BitmapSizeOptions.FromEmptyOptions());
3174
                    Image img = new Image();
3175
                    if (filename.Contains(".svg"))
3176
                    {
3177
                        byte[] imageData = null;
3178
                        DrawingImage image = null;
3179
                        using (System.Net.WebClient web = new System.Net.WebClient())
3180
                        {
3181
                            imageData = web.DownloadData(new Uri(filename));
3182
                            System.IO.Stream stream = new System.IO.MemoryStream(imageData);
3183
                            image = SvgReader.Load(stream);
3184
                        }
3185
                        img.Source = image;
3186
                    }
3187
                    else
3188
                    {
3189
                        img.Source = new BitmapImage(new Uri(filename));
3190
                    }
3191

    
3192
                    var currentControl = new MarkupToPDF.Controls.Etc.ImgControl
3193
                    {
3194
                        PointSet = new List<Point>(),
3195
                        FilePath = filename,
3196
                        ImageData = img.Source,
3197
                        StartPoint = new Point(100, 100),
3198
                        EndPoint = new Point(200, 200),
3199
                        TopRightPoint = new Point(100, 200),
3200
                        LeftBottomPoint = new Point(200, 100)
3201
                    };
3202

    
3203
                    currentControl.TopRightPoint = new Point(currentControl.StartPoint.X + clipboardImage.Width, currentControl.StartPoint.Y);
3204
                    currentControl.LeftBottomPoint = new Point(currentControl.StartPoint.X, currentControl.StartPoint.Y + clipboardImage.Height);
3205
                    currentControl.EndPoint = new Point(currentControl.StartPoint.X + clipboardImage.Width, currentControl.StartPoint.Y + clipboardImage.Height);
3206

    
3207
                    currentControl.PointSet = new List<Point>
3208
                                        {
3209
                                            currentControl.StartPoint,
3210
                                            currentControl.LeftBottomPoint,
3211
                                            currentControl.EndPoint,
3212
                                            currentControl.TopRightPoint,
3213
                                        };
3214

    
3215
                    multi_Undo_Data = this.ParentOfType<MainWindow>().dzMainMenu.Control_Style(currentControl as MarkupToPDF.Common.CommentUserInfo);
3216
                    UndoData.Markup_List.Add(multi_Undo_Data);
3217
                    ViewerDataModel.Instance.UndoDataList.Add(UndoData);
3218

    
3219
                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl as MarkupToPDF.Common.CommentUserInfo);
3220
                    currentControl.CommentID = Commons.shortGuid();
3221

    
3222
                    currentControl.ApplyTemplate();
3223
                    currentControl.SetImage();
3224

    
3225
                    ViewerDataModel.Instance.MarkupControls_USER.Remove(currentControl as MarkupToPDF.Common.CommentUserInfo);
3226
                    Controls.AdornerFinal final = new Controls.AdornerFinal(currentControl as MarkupToPDF.Common.CommentUserInfo);
3227
                    this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Add(final);
3228

    
3229
                    double realPointX = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.X - final.BorderSize.X - (final.BorderSize.Width / 2);
3230
                    double realPointY = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.Y - final.BorderSize.Y - (final.BorderSize.Height / 2);
3231
                    final.TranslateItems(realPointX, realPointY);
3232
                }
3233
                catch(Exception ex)
3234
                {
3235
                    this.ParentOfType<MainWindow>().DialogMessage_Alert("" + ex, "Alert");
3236
                }
3237
            }
3238
        }
3239
    }
3240
}
클립보드 이미지 추가 (최대 크기: 500 MB)