프로젝트

일반

사용자정보

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

markus / KCOM / Events / Implementation / TopMenuEvent.cs @ 5ba8f2d5

이력 | 보기 | 이력해설 | 다운로드 (151 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.ExecuteSaveCommand(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
        public async Task<bool>  SaveEventAsync()
410
        {
411
            bool result = false;
412

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

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

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

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

    
440
                mainMenu.SetCommentPages(null);
441

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

    
466
            return result;
467
        }
468

    
469
        /// <summary>
470
        /// call save command
471
        /// </summary>
472
        /// <param name="menu"></param>
473
		public void ExecuteSaveCommand2(MainMenu menu)
474
        {
475
            if (menu.pageNavigator.CurrentPage != null)
476
            {
477
                SaveCommand.Instance.Project_No = App.ViewInfo.ProjectNO;
478
                SaveCommand.Instance.document_id = App.ViewInfo.DocumentItemID;
479
                SaveCommand.Instance.user_id = App.ViewInfo.UserID;
480
                SaveCommand.Instance.page_no = menu.pageNavigator.CurrentPage.PageNumber;
481

    
482
                try
483
                {
484
                    if (ViewerDataModel.Instance.UndoDataList.Count > 0)
485
                    {
486
                        List<IKCOM.MarkupInfoItem> SelectedMarkupInfos = new List<IKCOM.MarkupInfoItem>();
487
                        foreach (var item in menu.gridViewMarkup.SelectedItems)
488
                        {
489
                            if ((item as IKCOM.MarkupInfoItem).UserID == App.ViewInfo.UserID)
490
                            {
491
                                SelectedMarkupInfos.Add(item as IKCOM.MarkupInfoItem);
492
                            }
493
                        }
494

    
495
                        SaveCommand.Instance.Execute(SelectedMarkupInfos);
496
                    }
497

    
498
                    if (ViewerDataModel.Instance.RotationDocs.Count > 0)
499
                    {
500
                        SaveCommand.Instance.PageAngleSave(App.ViewInfo.ProjectNO, ViewerDataModel.Instance.RotationDocs);
501
                    }
502
                }
503
                catch (Exception ex)
504
                {
505
                    this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert(string.Format("세이브 실패:{0}", ex.Message), "Alert");
506
                    throw ex;
507
                }
508
            }
509
            else
510
            {
511
                System.Diagnostics.Debug.WriteLine("ExecuteSaveCommand Error - pageNavigator.CurrentPage null");
512
            }
513
        }
514

    
515
        public async Task<bool> ExecuteSaveCommand(MainMenu menu)
516
        {
517
            bool result = false;
518

    
519
            if (menu.pageNavigator.CurrentPage != null)
520
            {
521
                SaveCommand.Instance.Project_No = App.ViewInfo.ProjectNO;
522
                SaveCommand.Instance.document_id = App.ViewInfo.DocumentItemID;
523
                SaveCommand.Instance.user_id = App.ViewInfo.UserID;
524
                SaveCommand.Instance.page_no = menu.pageNavigator.CurrentPage.PageNumber;
525

    
526
                try
527
                {
528
                    if (ViewerDataModel.Instance.UndoDataList.Count > 0 || ViewerDataModel.Instance.IsMarkupUpdate)
529
                    {
530
                        List<IKCOM.MarkupInfoItem> SelectedMarkupInfos = new List<IKCOM.MarkupInfoItem>();
531
                        foreach (var item in menu.gridViewMarkup.SelectedItems)
532
                        {
533
                            if ((item as IKCOM.MarkupInfoItem).UserID == App.ViewInfo.UserID)
534
                            {
535
                                SelectedMarkupInfos.Add(item as IKCOM.MarkupInfoItem);
536
                            }
537
                        }
538

    
539
                        result = await SaveCommand.Instance.Execute(SelectedMarkupInfos);
540
                        ViewerDataModel.Instance.IsMarkupUpdate = false;
541
                    }
542
                    else
543
                    {
544
                        result = true;
545
                    }
546

    
547
                    if (ViewerDataModel.Instance.RotationDocs.Count > 0)
548
                    {
549
                        SaveCommand.Instance.PageAngleSave(App.ViewInfo.ProjectNO, ViewerDataModel.Instance.RotationDocs);
550
                    }
551
                }
552
                catch (Exception ex)
553
                {
554
                    this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert(string.Format("세이브 실패:{0}", ex.Message), "Alert");
555
                    throw ex;
556
                }
557
            }
558
            else
559
            {
560
                System.Diagnostics.Debug.WriteLine("ExecuteSaveCommand Error - pageNavigator.CurrentPage null");
561
            }
562

    
563
            return result;
564
        }
565

    
566
        //강인구 추가
567
        public void Print_Start(string Type)
568
        {
569
            if (ViewerDataModel.Instance.MarkupControls_USER.Count > 0 || this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
570
            {
571
                var menu = this.ParentOfType<MainWindow>().dzMainMenu;
572
                SelectionSet.Instance.UnSelect(menu);
573
                if (menu.PreviewUserMarkupInfoItem != null && menu.PreviewUserMarkupInfoItem.IsPreviewUser == true)
574
                {
575
                    this.SaveEventCallback(null, null);
576
                }
577
                else if (menu.gridViewMarkup.SelectedItems.Count == 0 || (menu.gridViewMarkup.SelectedItems.FirstOrDefault() as IKCOM.MarkupInfoItem).UserID != App.ViewInfo.UserID)
578
                {
579

    
580
                }
581
                else
582
                {
583
                    this.SaveEventCallback(null, null);
584
                }
585
            }
586

    
587
            bool isprint = false;
588
            if (Type == "Print")
589
            {
590
                isprint = true;
591
            }
592

    
593
            RadWindow PrintWindow = new RadWindow();
594
            PrintWindow.Width = 850;
595
            PrintWindow.Height = 600;
596
            PrintWindow.Header = Type;
597

    
598
            List<IKCOM.MarkupInfoItem> markupinfo = new List<IKCOM.MarkupInfoItem>();
599

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

    
602
            if (markupinfo?.Count() > 0)
603
            {
604
                //Logger.sendResLog("GetPrintDocItemList", "TRUE", 1);
605
            }
606
            else
607
            {
608
                //Logger.sendResLog("GetPrintDocItemList", "FALSE", 1);
609
            }
610

    
611
            /// Tile Source URL을 구한다
612

    
613
            string sImageURL = ViewerDataModel.Instance.SystemMain.dzMainMenu.GetImageURL(App.ViewInfo.DocumentItemID, this.ParentOfType<MainWindow>().dzMainMenu.pageNavigator.CurrentPage.PageNumber);
614
            var url = new Uri(sImageURL);
615
            string sFolder = App.ViewInfo.DocumentItemID.All(char.IsDigit) ? (Convert.ToInt64(App.ViewInfo.DocumentItemID) / 100).ToString() : App.ViewInfo.DocumentItemID.Substring(0, 5);
616
            var Tile_Url = string.Format(@"{0}://{1}:{2}/TileSource/{3}_Tile/{4}/{5}/",
617
                url.Scheme, url.Host, url.Port,
618
                App.ViewInfo.ProjectNO,
619
                sFolder,
620
                App.ViewInfo.DocumentItemID
621
                );
622
            /// up to here
623

    
624
            var docitem = this.ParentOfType<MainWindow>().dzMainMenu._DocItem;
625

    
626
            PrintWindow.Content = new KCOM.Control.PrintControl(
627
                      Tile_Url,
628
                      App.ViewInfo.ProjectNO,
629
                      this.ParentOfType<MainWindow>().dzMainMenu._DocInfo,
630
                      markupinfo,
631
                      this.ParentOfType<MainWindow>().dzMainMenu.pageNavigator.CurrentPage.PageNumber,
632
                      docitem.GROUP_NO,
633
                      docitem.DOCUMENT_NO,
634
                      docitem.ORIGINAL_FILE,
635
                      isprint);
636

    
637
            //프린트 팝업 옵션
638
            //PrintWindow.BorderThickness = new Thickness(3);
639
            //PrintWindow.BorderBrush = new SolidColorBrush(Color.FromArgb(255, 37, 160, 218));
640
            PrintWindow.ResizeMode = System.Windows.ResizeMode.NoResize;
641
            PrintWindow.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
642
            PrintWindow.Background = new SolidColorBrush(Colors.Black);
643
            PrintWindow.Background.Opacity = 0.6;
644
            PrintWindow.Owner = Application.Current.MainWindow;
645
            Telerik.Windows.Controls.StyleManager.SetTheme(PrintWindow, new Telerik.Windows.Controls.VisualStudio2013Theme());
646
            PrintWindow.ShowDialog();
647
        }
648

    
649
        //강인구 추가
650
        private void PrintEvent(object sender, RoutedEventArgs e)
651
        {
652
            RadRibbonButton button = sender as RadRibbonButton;
653
            Print_Start(button.Content.ToString());
654
        }
655

    
656
        private List<AdornerMember> GetAdornerItem()
657
        {
658
            List<AdornerMember> AdonerList = new List<AdornerMember>();
659

    
660
            if (this.ParentOfType<MainWindow>() != null)
661
            {
662
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
663
                {
664
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
665
                    {
666
                        if (item.GetType().Name == "AdornerFinal")
667
                        {
668
                            foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
669
                            {
670
                                AdonerList.Add(InnerItem);
671
                            }
672
                        }
673
                    }
674
                }
675
            }
676

    
677
            return AdonerList;
678
        }
679
        /// <summary>
680
        /// 투명도
681
        /// </summary>
682
        /// <param name="sender"></param>
683
        /// <param name="e"></param>
684
        //강인구 추가(Undo End)
685
        private void sdOpacity_ValueChanged(object sender, RoutedEventArgs e)
686
        {
687
            List<AdornerMember> AdonerList = GetAdornerItem();
688
            if(AdonerList.Count > 0)
689
            {
690
                Undo_data UndoData = new Undo_data()
691
                {
692
                    IsUndo = false,
693
                    Event = Event_Type.Option,
694
                    EventTime = DateTime.Now,
695
                    Opacity = ViewerDataModel.Instance.ControlOpacity,
696
                    Markup_List = new List<Multi_Undo_data>()
697
                };
698
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
699

    
700
                foreach (AdornerMember InnerItem in AdonerList)
701
                {
702
                    InnerItem.DrawingData.Opacity = ViewerDataModel.Instance.ControlOpacity;
703
                  
704
                    multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
705
                    UndoData.Markup_List.Add(multi_Undo_Data);
706
                    multi_Undo_Data = new Multi_Undo_data();
707
                }
708

    
709
                ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
710
                {
711
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
712
                });
713
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
714
            }
715
        }
716

    
717
        //강인구 추가(Undo End)
718
        private void cbLineSize_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
719
        {
720
            if (string.IsNullOrEmpty(cbLineSize.Value.ToString()))
721
            {
722
                cbLineSize.Value = cbLineSize.Minimum;
723
            }
724
            List<AdornerMember> AdonerList = GetAdornerItem();
725
            if (AdonerList.Count > 0)
726
            {
727
                Undo_data UndoData = new Undo_data()
728
                {
729
                    IsUndo = false,
730
                    Event = Event_Type.Option,
731
                    EventTime = DateTime.Now,
732
                    LineSize = ViewerDataModel.Instance.LineSize,
733
                    Markup_List = new List<Multi_Undo_data>()
734
                };
735
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
736

    
737
                foreach (AdornerMember InnerItem in AdonerList)
738
                {
739
                    switch (InnerItem.DrawingData.GetType().Name)
740
                    {
741
                        case ("LineControl"):
742
                            {
743
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Line.LineControl).LineSize = ViewerDataModel.Instance.LineSize;
744
                            }
745
                            break;
746
                        case ("ArcControl"):
747
                            {
748
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Line.ArcControl).LineSize = ViewerDataModel.Instance.LineSize;
749
                            }
750
                            break;
751
                        case ("ArrowArcControl"):
752
                            {
753
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Line.ArrowArcControl).LineSize = ViewerDataModel.Instance.LineSize;
754
                            }
755
                            break;
756
                        case ("ArrowControl_Multi"):
757
                            {
758
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Line.ArrowControl_Multi).LineSize = ViewerDataModel.Instance.LineSize;
759
                            }
760
                            break;
761
                        case ("CloudControl"):
762
                            {
763
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Polygon.CloudControl).LineSize = ViewerDataModel.Instance.LineSize;
764
                            }
765
                            break;
766
                        case ("PolygonControl"):
767
                            {
768
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Polygon.PolygonControl).LineSize = ViewerDataModel.Instance.LineSize;
769
                            }
770
                            break;
771
                        case ("RectangleControl"):
772
                            {
773
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.RectangleControl).LineSize = ViewerDataModel.Instance.LineSize;
774
                            }
775
                            break;
776
                        case ("RectCloudControl"):
777
                            {
778
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.RectCloudControl).LineSize = ViewerDataModel.Instance.LineSize;
779
                            }
780
                            break;
781
                        case ("TriControl"):
782
                            {
783
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.TriControl).LineSize = ViewerDataModel.Instance.LineSize;
784
                            }
785
                            break;
786
                        case ("CircleControl"):
787
                            {
788
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.CircleControl).LineSize = ViewerDataModel.Instance.LineSize;
789
                            }
790
                            break;
791
                        case ("ArrowTextControl"):
792
                            {
793
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).LineSize = ViewerDataModel.Instance.LineSize;
794
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).BorderSize = new Thickness(ViewerDataModel.Instance.LineSize);
795
                            }
796
                            break;
797
                        case ("TextControl"):
798
                            {
799
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).LineSize = new Thickness(ViewerDataModel.Instance.LineSize);
800
                            }
801
                            break;
802
                        case ("InsideWhiteControl"):
803
                            {
804
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Cad.InsideWhiteControl).LineSize = ViewerDataModel.Instance.LineSize;
805
                            }
806
                            break;
807
                        case ("OverlapWhiteControl"):
808
                            {
809
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Cad.OverlapWhiteControl).LineSize = ViewerDataModel.Instance.LineSize;
810
                            }
811
                            break;
812
                        case ("ClipWhiteControl"):
813
                            {
814
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Cad.ClipWhiteControl).LineSize = ViewerDataModel.Instance.LineSize;
815
                            }
816
                            break;
817
                        case ("CoordinateControl"):
818
                            {
819
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Cad.CoordinateControl).LineSize = 10; //ViewerDataModel.Instance.LineSize
820
                            }
821
                            break;
822
                    }
823
                    
824

    
825
                    multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
826
                    UndoData.Markup_List.Add(multi_Undo_Data);
827
                    multi_Undo_Data = new Multi_Undo_data();
828
                }
829

    
830
                ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
831
                {
832
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
833
                });
834
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
835

    
836
                
837
            }
838
            KCOM.Properties.Settings.Default.LineSize = (double)cbLineSize.Value;
839
            Properties.Settings.Default.Save();
840
        }
841

    
842

    
843
        private void cbIntervalSize_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
844
        {
845
            if (string.IsNullOrEmpty(cbIntervalSize.Value.ToString()))
846
            {
847
                cbIntervalSize.Value = cbIntervalSize.Minimum;
848
            }
849
            List<AdornerMember> AdonerList = GetAdornerItem();
850
            if (AdonerList.Count > 0)
851
            {
852

    
853
                Undo_data UndoData = new Undo_data()
854
                {
855
                    IsUndo = false,
856
                    Event = Event_Type.Option,
857
                    EventTime = DateTime.Now,
858
                    Interval = ViewerDataModel.Instance.Interval,
859
                    Markup_List = new List<Multi_Undo_data>()
860
                };
861
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
862

    
863
                foreach (AdornerMember InnerItem in AdonerList)
864
                {
865
                    switch (InnerItem.DrawingData.GetType().Name)
866
                    {
867
                        case ("LineControl"):
868
                            {
869
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Line.LineControl).Interval = ViewerDataModel.Instance.Interval;
870

    
871
                                multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
872
                                UndoData.Markup_List.Add(multi_Undo_Data);
873
                                multi_Undo_Data = new Multi_Undo_data();
874
                            }
875
                            break;
876
                    }
877
                }
878

    
879
                ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
880
                {
881
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
882
                });
883
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
884
            }
885
            KCOM.Properties.Settings.Default.Interval = (double)cbIntervalSize.Value;
886
            Properties.Settings.Default.Save();
887
        }
888
        
889
        private void cbArcLength_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
890
        {
891
            if (string.IsNullOrEmpty(cbArcLength.Value.ToString()))
892
            {
893
                cbArcLength.Value = cbArcLength.Minimum;
894
            }
895
            List<AdornerMember> AdonerList = GetAdornerItem();
896
            if (AdonerList.Count > 0)
897
            {
898

    
899
                //Undo_data UndoData = new Undo_data()
900
                //{
901
                //    IsUndo = false,
902
                //    Event = Event_Type.Option,
903
                //    EventTime = DateTime.Now,
904
                //    Interval = ViewerDataModel.Instance.Interval,
905
                //    Markup_List = new List<Multi_Undo_data>()
906
                //};
907
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
908

    
909
                foreach (AdornerMember InnerItem in AdonerList)
910
                {
911
                    switch (InnerItem.DrawingData.GetType().Name)
912
                    {
913
                        case ("RectCloudControl"):
914
                            {
915
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.RectCloudControl).ArcLength = ViewerDataModel.Instance.ArcLength;
916

    
917
                                //multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
918
                                //UndoData.Markup_List.Add(multi_Undo_Data);
919
                                //multi_Undo_Data = new Multi_Undo_data();
920
                            }
921
                            break;
922
                        case ("CloudControl"):
923
                            {
924
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Polygon.CloudControl).ArcLength = ViewerDataModel.Instance.ArcLength;
925

    
926
                                //multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
927
                                //UndoData.Markup_List.Add(multi_Undo_Data);
928
                                //multi_Undo_Data = new Multi_Undo_data();
929
                            }
930
                            break;
931
                    }
932
                }
933

    
934
                //ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
935
                //{
936
                //    ViewerDataModel.Instance.UndoDataList.Remove(i);
937
                //});
938
                //ViewerDataModel.Instance.UndoDataList.Add(UndoData);
939
            }
940

    
941
            KCOM.Properties.Settings.Default.ArcLength = (double)cbArcLength.Value;
942
            Properties.Settings.Default.Save();
943
        }
944

    
945
        //강인구 추가(Undo End)
946
        private void cbDashStyle_SelectionChanged(object sender, SelectionChangedEventArgs e)
947
        {
948
            //강인구 추가
949
            if (this.ParentOfType<MainWindow>() != null)
950
            {
951
                ViewerDataModel.Instance.DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
952
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
953
                {
954
                    Undo_data UndoData = new Undo_data()
955
                    {
956
                        IsUndo = false,
957
                        Event = Event_Type.Option,
958
                        EventTime = DateTime.Now,
959
                        DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData,
960
                        Markup_List = new List<Multi_Undo_data>()
961
                    };
962
                    Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
963

    
964
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
965
                    {
966
                        if (item.GetType().Name == "AdornerFinal")
967
                        {
968
                            foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
969
                            {
970
                                switch (InnerItem.DrawingData.GetType().Name)
971
                                {
972
                                    case ("LineControl"):
973
                                        {
974
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Line.LineControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
975
                                        }
976
                                        break;
977
                                    case ("ArcControl"):
978
                                        {
979
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Line.ArcControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
980
                                        }
981
                                        break;
982
                                    case ("ArrowArcControl"):
983
                                        {
984
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Line.ArrowArcControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
985
                                        }
986
                                        break;
987
                                    case ("ArrowControl_Multi"):
988
                                        {
989
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Line.ArrowControl_Multi).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
990
                                        }
991
                                        break;
992
                                    case ("CloudControl"):
993
                                        {
994
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Polygon.CloudControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
995
                                        }
996
                                        break;
997
                                    case ("PolygonControl"):
998
                                        {
999
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Polygon.PolygonControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
1000
                                        }
1001
                                        break;
1002
                                    case ("RectangleControl"):
1003
                                        {
1004
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.RectangleControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
1005
                                        }
1006
                                        break;
1007
                                    case ("RectCloudControl"):
1008
                                        {
1009
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.RectCloudControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
1010
                                        }
1011
                                        break;
1012
                                    case ("TriControl"):
1013
                                        {
1014
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.TriControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
1015
                                        }
1016
                                        break;
1017
                                    case ("CircleControl"):
1018
                                        {
1019
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.CircleControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
1020
                                        }
1021
                                        break;
1022
                                    case ("InsideWhiteControl"):
1023
                                        {
1024
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Cad.InsideWhiteControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
1025
                                        }
1026
                                        break;
1027
                                    case ("OverlapWhiteControl"):
1028
                                        {
1029
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Cad.OverlapWhiteControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
1030
                                        }
1031
                                        break;
1032
                                    case ("ClipWhiteControl"):
1033
                                        {
1034
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Cad.ClipWhiteControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
1035
                                        }
1036
                                        break;
1037
                                    case ("CoordinateControl"):
1038
                                        {
1039
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Cad.CoordinateControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
1040
                                        }
1041
                                        break;
1042
                                }
1043

    
1044
                                multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
1045
                                UndoData.Markup_List.Add(multi_Undo_Data);
1046
                                multi_Undo_Data = new Multi_Undo_data();
1047
                            }
1048

    
1049
                            ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
1050
                            {
1051
                                ViewerDataModel.Instance.UndoDataList.Remove(i);
1052
                            });
1053
                            ViewerDataModel.Instance.UndoDataList.Add(UndoData);
1054
                        }
1055
                    }
1056
                }
1057
            }
1058
        }
1059

    
1060
        //강인구 추가
1061
        private void comboFontSize_SelectionChanged(object sender, SelectionChangedEventArgs e)
1062
        {
1063
            //if (this.ParentOfType<MainWindow>() != null)
1064
            //{
1065
            //    if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
1066
            //    {
1067
            //        foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
1068
            //        {
1069
            //            if (item.GetType().Name == "AdornerFinal")
1070
            //            {
1071
            //                foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
1072
            //                {
1073
            //                    switch (InnerItem.DrawingData.GetType().Name)
1074
            //                    {
1075
            //                        case ("TextControl"):
1076
            //                            {
1077
            //                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextSize = int.Parse(comboFontSize.Text);
1078
            //                            }
1079
            //                            break;
1080
            //                        case ("ArrowTextControl"):
1081
            //                            {
1082
            //                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextSize = int.Parse(comboFontSize.Text);
1083
            //                            }
1084
            //                            break;
1085
            //                    }
1086
            //                }
1087
            //            }
1088
            //        }
1089
            //    }
1090
            //}
1091
        }
1092

    
1093
        //강인구 추가
1094
        private void btnBold_Checked(object sender, RoutedEventArgs e)
1095
        {
1096
            if (this.ParentOfType<MainWindow>() != null)
1097
            {
1098
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
1099
                {
1100
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
1101
                    {
1102
                        if (item.GetType().Name == "AdornerFinal")
1103
                        {
1104
                            foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
1105
                            {
1106
                                switch (InnerItem.DrawingData.GetType().Name)
1107
                                {
1108
                                    case ("TextControl"):
1109
                                        {
1110
                                            if((InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextWeight == FontWeights.Bold)
1111
                                            {
1112
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextWeight = FontWeights.Normal;
1113
                                                ViewerDataModel.Instance.IsMarkupUpdate = true;
1114
                                            }
1115
                                            else
1116
                                            {
1117
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextWeight = FontWeights.Bold;
1118
                                                ViewerDataModel.Instance.IsMarkupUpdate = true;
1119
                                            }
1120

    
1121
                                        }
1122
                                        break;
1123
                                    case ("ArrowTextControl"):
1124
                                        {
1125
                                            if ((InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextWeight == FontWeights.Bold)
1126
                                            {
1127
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextWeight = FontWeights.Normal;
1128
                                                ViewerDataModel.Instance.IsMarkupUpdate = true;
1129
                                            }
1130
                                            else
1131
                                            {
1132
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextWeight = FontWeights.Bold;
1133
                                                ViewerDataModel.Instance.IsMarkupUpdate = true;
1134
                                            }
1135
                                        }
1136
                                        break;
1137
                                }
1138
                            }
1139
                        }
1140
                    }
1141
                }
1142
            }
1143
        }
1144

    
1145
        //강인구 추가
1146
        private void btnItalic_Checked(object sender, RoutedEventArgs e)
1147
        {
1148
            if (this.ParentOfType<MainWindow>() != null)
1149
            {
1150
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
1151
                {
1152
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
1153
                    {
1154
                        if (item.GetType().Name == "AdornerFinal")
1155
                        {
1156
                            foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
1157
                            {
1158
                                switch (InnerItem.DrawingData.GetType().Name)
1159
                                {
1160
                                    case ("TextControl"):
1161
                                        {
1162
                                            if((InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextStyle == FontStyles.Italic)
1163
                                            {
1164
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextStyle = System.Windows.FontStyles.Normal;
1165
                                                ViewerDataModel.Instance.IsMarkupUpdate = true;
1166
                                            }
1167
                                            else
1168
                                            {
1169
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextStyle = FontStyles.Italic;
1170
                                                ViewerDataModel.Instance.IsMarkupUpdate = true;
1171
                                            }
1172

    
1173
                                        }
1174
                                        break;
1175
                                    case ("ArrowTextControl"):
1176
                                        {
1177
                                            if((InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextStyle == FontStyles.Italic)
1178
                                            {
1179
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextStyle = FontStyles.Normal;
1180
                                                ViewerDataModel.Instance.IsMarkupUpdate = true;
1181
                                            }
1182
                                            else
1183
                                            {
1184
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextStyle = FontStyles.Italic;
1185
                                                ViewerDataModel.Instance.IsMarkupUpdate = true;
1186
                                            }
1187
                                        }
1188
                                        break;
1189
                                }
1190
                            }
1191
                        }
1192
                    }
1193
                }
1194
            }
1195
        }
1196

    
1197
        //강인구 추가
1198
        private void btnUnderLine_Checked(object sender, RoutedEventArgs e)
1199
        {
1200
            if (this.ParentOfType<MainWindow>() != null)
1201
            {
1202
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
1203
                {
1204
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
1205
                    {
1206
                        if (item.GetType().Name == "AdornerFinal")
1207
                        {
1208
                            foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
1209
                            {
1210
                                switch (InnerItem.DrawingData.GetType().Name)
1211
                                {
1212
                                    case ("TextControl"):
1213
                                        {
1214
                                            if ((InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).UnderLine == TextDecorations.Underline)
1215
                                            {
1216
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).UnderLine = null;
1217
                                            }
1218
                                            else
1219
                                            {
1220
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).UnderLine = TextDecorations.Underline;
1221
                                            }
1222
                                        }
1223
                                        break;
1224
                                    case ("ArrowTextControl"):
1225
                                        {
1226
                                            if ((InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).UnderLine == TextDecorations.Underline)
1227
                                            {
1228
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).UnderLine = null;
1229
                                            }
1230
                                            else
1231
                                            {
1232
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).UnderLine = TextDecorations.Underline;
1233
                                            }
1234
                                        }
1235
                                        break;
1236
                                }
1237

    
1238
                                ViewerDataModel.Instance.IsMarkupUpdate = true;
1239
                            }
1240
                        }
1241
                    }
1242
                }
1243
            }
1244
        }
1245

    
1246
        private void comboFontSize_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
1247
        {
1248
            if (string.IsNullOrEmpty(comboFontSize.Value.ToString()))
1249
            {
1250
                comboFontSize.Value = comboFontSize.Minimum;
1251
            }
1252
            if (this.ParentOfType<MainWindow>() != null)
1253
            {
1254
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
1255
                {
1256
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
1257
                    {
1258
                        if (item.GetType().Name == "AdornerFinal")
1259
                        {
1260
                            foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
1261
                            {
1262
                                switch (InnerItem.DrawingData.GetType().Name)
1263
                                {
1264
                                    case ("TextControl"):
1265
                                        {
1266
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextSize = int.Parse(comboFontSize.Value.ToString());
1267
                                        }
1268
                                        break;
1269
                                    case ("ArrowTextControl"):
1270
                                        {
1271
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextSize = int.Parse(comboFontSize.Value.ToString());
1272
                                        }
1273
                                        break;
1274
                                }
1275
                            }
1276

    
1277
                            ChangeComment(item as Controls.AdornerFinal);
1278
                        }
1279
                    }
1280
                }
1281
            }
1282

    
1283
            KCOM.Properties.Settings.Default.TextSize = (double)comboFontSize.Value;
1284
            Properties.Settings.Default.Save();
1285
        }
1286

    
1287
        //강인구 추가
1288
        private void comboFontFamily_SelectionChanged(object sender, SelectionChangedEventArgs e)
1289
        {
1290
            
1291
            if (comboFontFamily.SelectedItem != null && !IsSuspendChange)
1292
            {
1293
                var main = this.ParentOfType<MainWindow>()?.dzMainMenu;
1294
                var font = comboFontFamily.SelectedItem as Markus.Fonts.MarkusFont;
1295
                var lstTextCtrl = SelectTextControl();
1296

    
1297
                foreach (var item in lstTextCtrl)
1298
                {
1299
                    if (item is MarkupToPDF.Controls.Text.ArrowTextControl ctrl1)
1300
                    {
1301
                        ViewerDataModel.Instance.IsMarkupUpdate = true;
1302
                        ctrl1.SetFontFamily(font.FontFamily);
1303
                    }
1304
                    else if (item is MarkupToPDF.Controls.Text.TextControl ctrl2)
1305
                    {
1306
                        ViewerDataModel.Instance.IsMarkupUpdate = true;
1307
                        ctrl2.SetFontFamily(font.FontFamily);
1308
                    }
1309
                }
1310

    
1311
                KCOM.Properties.Settings.Default.FontFamily = font.FontFamily.FontName();
1312
                Properties.Settings.Default.Save();
1313
            }
1314
        }
1315

    
1316
        private List<UIElement> SelectTextControl()
1317
        {
1318
            List<UIElement> lstTextCtrl = new List<UIElement>();
1319

    
1320
            var main = this.ParentOfType<MainWindow>()?.dzMainMenu;
1321
            var font = comboFontFamily.SelectedItem as Markus.Fonts.MarkusFont;
1322

    
1323

    
1324
            if (main.SelectLayer.FindChildByType<AdornerFinal>() != null)
1325
            {
1326
                lstTextCtrl.AddRange(main.SelectLayer.FindChildByType<AdornerFinal>().Members.Where(x => x.DrawingData is MarkupToPDF.Controls.Common.ITextControl).Select(x => x.DrawingData));
1327
            }
1328

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

    
1331
            return lstTextCtrl;
1332
        }
1333

    
1334

    
1335
        /// <summary>
1336
        /// 텍스트 컨트롤 하일라이트 처리
1337
        /// </summary>
1338
        /// <param name="sender"></param>
1339
        /// <param name="e"></param>
1340
        private void HighlightEvent(object sender, RoutedEventArgs e)
1341
        {
1342

    
1343
            ViewerDataModel.Instance.checkHighShape = (sender as CheckBox).IsChecked.Value;
1344
            SetHighlightEvent();
1345
            //if ((sender as CheckBox).IsChecked.Value)
1346
            //{
1347
            //    TaskMessage("HighLight가 설정되었습니다", TaskMessageType.Normal);
1348
            //}
1349
            //else
1350
            //{
1351
            //    TaskMessage("HighLight가 해제되었습니다", TaskMessageType.Caption);
1352
            //}
1353
            //if (ViewerDataModel.Instance.SelectedEditor as MarkupToPDF.Controls.Text.TextControl != null)
1354
            //{
1355
            //    MarkupToPDF.Controls.Text.TextControl instance = (ViewerDataModel.Instance.SelectedEditor as MarkupToPDF.Controls.Text.TextControl);
1356
            //    instance.IsHighLight = ViewerDataModel.Instance.checkHighShape;
1357
            //    instance.SetText();
1358
            //}
1359
        }
1360

    
1361
        //추가페이지 이동 엔터
1362
        private void tlcurrentPage_KeyDown(object sender, KeyEventArgs e)
1363
        {
1364
            //강인구 추가 tlcurrentPage을 이상하게 입력할수 있기때문에 Try Catch
1365
            if (e.Key == Key.Enter)
1366
            {
1367
                try
1368
                {
1369
                    var instanceMain = this.ParentOfType<MainWindow>();
1370
                    var max = instanceMain.dzMainMenu.pageNavigator._thumbnailItems.Max(f => f.PageNumber);
1371
                    if (string.IsNullOrEmpty(tlcurrentPage.Text))
1372
                    {
1373
                        RadWindow.Alert(new DialogParameters
1374
                        {
1375
                            Owner = Application.Current.MainWindow,
1376
                            Theme = new VisualStudio2013Theme(),
1377
                            Header = "Info",
1378
                            Content = "Enter the correct page number.",
1379
                        });
1380
                    }
1381
                    else
1382
                    {
1383
                        if (Convert.ToInt32(tlcurrentPage.Text) > max || Convert.ToInt32(tlcurrentPage.Text) == 0)
1384
                        {
1385
                            RadWindow.Alert(new DialogParameters
1386
                            {
1387
                                Owner = Application.Current.MainWindow,
1388
                                Theme = new VisualStudio2013Theme(),
1389
                                Header = "Info",
1390
                                Content = "Enter the correct page number.",
1391
                            });
1392
                        }
1393
                        else
1394
                        {
1395
                            instanceMain.dzMainMenu.pageNavigator.GotoPage(Convert.ToInt32(tlcurrentPage.Text));
1396
                        }
1397
                    }
1398
                    
1399
                }
1400
                catch (Exception)
1401
                {
1402
                    RadWindow.Alert(new DialogParameters
1403
                    {
1404
                        Owner = Application.Current.MainWindow,
1405
                        Theme = new VisualStudio2013Theme(),
1406
                        Header = "Info",
1407
                        Content = "Enter the correct page number.",
1408
                    });
1409
                }
1410
                
1411
            }
1412
        }
1413
        private string previousText;
1414
        private void TlcurrentPage_PreviewTextInput(object sender, TextCompositionEventArgs e)
1415
        {
1416
            System.Text.RegularExpressions.Regex regex = new System.Text.RegularExpressions.Regex("[^0-9]+");
1417
            e.Handled = regex.IsMatch(e.Text);
1418
        }
1419
        private void TlcurrentPage_TextChanged(object sender, TextChangedEventArgs e)
1420
        {
1421
            double num = 0;
1422
            bool success = double.TryParse(((TextBox)sender).Text, out num);
1423
            if (success & num >= 0)
1424
                previousText = ((TextBox)sender).Text;
1425
            else
1426
            {
1427
                if (string.IsNullOrEmpty(((TextBox)sender).Text))
1428
                {
1429
                    ((TextBox)sender).Text = "";
1430
                }
1431
                else
1432
                {
1433

    
1434
                    ((TextBox)sender).Text = previousText;
1435
                }
1436
            }
1437
        }
1438

    
1439
        /// <summary>
1440
        /// 입력한 페이지로 이동한다
1441
        /// </summary>
1442
        /// <param name="sender"></param>
1443
        /// <param name="e"></param>
1444
        private void tlcurrentPage_readonly_KeyDown(object sender, KeyEventArgs e)
1445
        {
1446
            if (e.Key == Key.Enter)
1447
            {
1448
                try
1449
                {
1450
                    var instanceMain = this.ParentOfType<MainWindow>();
1451
                    instanceMain.dzMainMenu.pageNavigator.GotoPage(Convert.ToInt32(tlcurrentPage_readonly.Text));
1452
                }
1453
                catch (Exception)
1454
                {
1455
                    RadWindow.Alert(new DialogParameters
1456
                    {
1457
                        Owner = Application.Current.MainWindow,
1458
                        Theme = new VisualStudio2013Theme(),
1459
                        Header = "Info",
1460
                        Content = "Enter the correct page number.",
1461
                    });
1462
                }
1463
            }
1464
        }
1465
        
1466
        private void PanoramaEvent(object sender, RoutedEventArgs e)
1467
        {
1468
            PanoramaShow();
1469
        }
1470

    
1471
        public void PanoramaShow()
1472
        {
1473
            Panorama check = new Panorama();
1474
            double screenWidth = System.Windows.SystemParameters.PrimaryScreenWidth;
1475
            double screenHeight = System.Windows.SystemParameters.PrimaryScreenHeight;
1476
            //double windowWidth = this.Width;
1477
            //double windowHeight = this.Height;
1478

    
1479
            var PanoramaPop = new RadWindow
1480
            {
1481
                //MinWidth = 600,
1482
                //MinHeight = 400,
1483
                //Header = "My Check List",
1484
                Header = "Document No : " + this.ParentOfType<MainWindow>().dzMainMenu._DocItem.DOCUMENT_NO + " / Revision :" + this.ParentOfType<MainWindow>().dzMainMenu._DocItem.REVISION,
1485
                Content = check,
1486
                Owner = this,
1487
                ResizeMode = System.Windows.ResizeMode.CanResizeWithGrip,
1488
                //ResizeMode = System.Windows.ResizeMode.NoResize,
1489
                WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen,
1490
                IsTopmost = false,
1491
                //Left = (screenWidth / 2) - (windowWidth / 2),
1492
                //Top = (screenHeight / 2) - (windowHeight / 2),
1493
                //Left = (screenWidth / 2),
1494
                //Top = (screenHeight / 2),
1495
                Width = screenWidth * 0.4,
1496
                Height = screenHeight * 0.4,
1497
            };
1498
            StyleManager.SetTheme(PanoramaPop, new VisualStudio2013Theme());
1499
            //CheckPop.ShowDialog();
1500
            PanoramaPop.Owner = Application.Current.MainWindow;
1501
            PanoramaPop.Show();
1502
        }
1503

    
1504
        private void CheckEvent(object sender, RoutedEventArgs e)
1505
        {
1506
            //창이 떠있을 경우 재 실행 방지
1507
            if (isClosed)
1508
            {
1509
                //토글 및 마우스 상태 초기화
1510
                var toggleList = this.Parent.ChildrenOfType<RadToggleButton>();
1511
                foreach(var togle in toggleList)
1512
                {
1513
                    togle.IsChecked = false;
1514
                }
1515
                this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
1516

    
1517
                isClosed = false;
1518

    
1519
                
1520
                CheckList check = new CheckList(this.ParentOfType<MainWindow>());
1521

    
1522
                CheckPop = new RadWindow
1523
                {
1524
                    MinWidth = 1200,
1525
                    MinHeight = 500,
1526
                    //Header = "My Check List",
1527
                    Header = "Document No : " + this.ParentOfType<MainWindow>().dzMainMenu._DocItem.DOCUMENT_NO + " / Revision :" + this.ParentOfType<MainWindow>().dzMainMenu._DocItem.REVISION,
1528
                    Content = check,
1529
                    //Owner = this,
1530
                    //ResizeMode = System.Windows.ResizeMode.CanResizeWithGrip,
1531
                    ResizeMode = System.Windows.ResizeMode.NoResize,
1532
                    WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen,
1533
                    IsTopmost = true,
1534
                };
1535
                StyleManager.SetTheme(CheckPop, new Office2013Theme());
1536
                CheckPop.Closed += CheckPop_Closed;
1537
                
1538
                //CheckPop.ShowDialog();
1539
                CheckPop.Show();
1540
            }
1541
        }
1542

    
1543
        private void SignManagerEvent(object sender,RoutedEventArgs e)
1544
        {
1545
            SignManager signManager = new SignManager();
1546

    
1547
            RadWindow signManagerPop = new RadWindow
1548
            {
1549
                MinWidth = 1200,
1550
                MinHeight = 500,
1551
                //Header = "My Check List",
1552
                Header = "",
1553
                Content = signManager,
1554
                Owner = this,
1555
                //ResizeMode = System.Windows.ResizeMode.CanResizeWithGrip,
1556
                ResizeMode = System.Windows.ResizeMode.CanResize,
1557
                WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen,
1558
            };
1559
            StyleManager.SetTheme(signManagerPop, new Office2013Theme());
1560

    
1561
            //CheckPop.ShowDialog();
1562
            signManagerPop.ShowDialog();
1563
        }
1564

    
1565
        private void OptionPop_Closed(object sender, WindowClosedEventArgs e)
1566
        {
1567
            isClosed = true;
1568
            //this.ParentOfType<MainWindow>().dzMainMenu.PN_Navi.IsEnabled = true;
1569
            this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
1570
            ViewerDataModel.Instance.Capture_Opacity = 0;
1571
        }
1572

    
1573
        private void CheckPop_Closed(object sender, WindowClosedEventArgs e)
1574
        {
1575
            isClosed = true;
1576
            //this.ParentOfType<MainWindow>().dzMainMenu.PN_Navi.IsEnabled = true;
1577
            this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
1578
            ViewerDataModel.Instance.Capture_Opacity = 0;
1579
        }
1580

    
1581
        /// <summary>
1582
        /// 사용자가 선택한 페이지로 이동(썸네일 동기화 시킴)
1583
        /// </summary>
1584
        /// <param name="sender"></param>
1585
        /// <param name="e"></param>
1586
        private void PageGoEvent(object sender, RoutedEventArgs e)
1587
        {
1588
            RadButton button = sender as RadButton;
1589
            var instanceMain = this.ParentOfType<MainWindow>();
1590
            
1591
            //강인구 추가 tlcurrentPage을 이상하게 입력할수 있기때문에 Try Catch
1592
            try
1593
            {
1594
                switch (button.CommandParameter.ToString())
1595
                {
1596
                    case "Down":
1597
                        {
1598
                            instanceMain.dzMainMenu.pageNavigator.GotoPage(Convert.ToInt32(tlcurrentPage.Text) + 1);
1599
                        }
1600
                        break;
1601
                    case "Up":
1602
                        {
1603
                            instanceMain.dzMainMenu.pageNavigator.GotoPage(Convert.ToInt32(tlcurrentPage.Text) - 1);
1604
                        }
1605
                        break;
1606
                }
1607
            }
1608
            catch (Exception)
1609
            {
1610
                RadWindow.Alert(new DialogParameters
1611
                {
1612
                    Owner = Application.Current.MainWindow,
1613
                    Theme = new VisualStudio2013Theme(),
1614
                    Header = "Info",
1615
                    Content = "Enter the correct page number.",
1616
                });
1617
            }
1618
        }
1619

    
1620
        private void viewEvent(object sender, RoutedEventArgs e)
1621
        {
1622
            RadRibbonToggleButton viewButton = sender as RadRibbonToggleButton;
1623
            var instanceMain = this.ParentOfType<MainWindow>();
1624

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

    
1627
            //if ((sender as RadRibbonToggleButton) != null)
1628
            //{
1629
            //    Common.ViewerDataModel.Instance.ControlTag = (sender as RadRibbonToggleButton).Tag.ToString();
1630
            //    instanceToggle = (sender as RadRibbonToggleButton);
1631
            //}
1632

    
1633
            //instanceToggle.IsChecked = false;
1634

    
1635
            switch (viewButton.CommandParameter.ToString())
1636
            {
1637
                case "zoomout":
1638
                    {
1639
                        //장원
1640
                        //instanceMain.dzMainMenu.zoomAndPanControl.ZoomTo(new Rect(0, 0, instanceMain.dzMainMenu.zoomAndPanCanvas.ActualWidth, instanceMain.dzMainMenu.zoomAndPanCanvas.ActualHeight));
1641
                        instanceMain.dzMainMenu.zoomAndPanControl.ZoomPointToViewportCenter(ViewerDataModel.Instance.ContentScale -= 0.1, point);
1642
                        viewButton.IsChecked = false;
1643
                        //Common.ViewerDataModel.Instance.zom
1644
                    }
1645
                    break;
1646
                case "zoomin":
1647
                    {
1648
                        instanceMain.dzMainMenu.zoomAndPanControl.ZoomPointToViewportCenter(ViewerDataModel.Instance.ContentScale += 0.1, point);
1649
                        viewButton.IsChecked = false;
1650
                    }
1651
                    break;
1652
                case "fullscreen":
1653
                    {
1654
                        instanceMain.WindowState = WindowState.Maximized;
1655
                        //Sizemode 대기(강인구)
1656
                        //instanceMain.dzMainMenu.imageViewer.SizeMode = Leadtools.Windows.Controls.SizeMode.Fit;
1657
                        instanceMain.dzMainMenu.zoomAndPanControl.ScaleToFit();
1658
                        viewButton.IsChecked = false;
1659
                    }
1660
                    break;
1661
                case "fitWidth":
1662
                    {
1663
                        instanceMain.dzMainMenu.zoomAndPanControl.ScaleToFit();
1664
                        viewButton.IsChecked = false;
1665
                    }
1666
                    break;
1667
                case "fitHeight":
1668
                    {
1669
                        instanceMain.dzMainMenu.zoomAndPanControl.ScaleToFit();
1670
                        viewButton.IsChecked = false;
1671
                    }
1672
                    break;
1673
                case "boundzoom":
1674
                    {
1675

    
1676
                    }
1677
                    break;
1678
                case "Rotate_M":
1679
                    {
1680
                        drawingPannelRotate(false);
1681
                        viewButton.IsChecked = false;
1682
                    }
1683
                    break;
1684
                case "Rotate_P":
1685
                    {
1686
                        drawingPannelRotate(true);
1687
                        viewButton.IsChecked = false;
1688
                    }
1689
                    break;
1690
                case "Rotate_half":
1691
                    {
1692
                        drawingPannelRotate(true);
1693
                        drawingPannelRotate(true);
1694
                        viewButton.IsChecked = false;
1695
                    }
1696
                    break;
1697
            }
1698
        }
1699

    
1700
        private void Control_Event(object sender, RoutedEventArgs e)
1701
        {
1702

    
1703
        }
1704

    
1705
        #region 대기
1706

    
1707
        public void drawingPannelRotate(bool Flag)
1708
        {
1709
            var instanceMain = this.ParentOfType<MainWindow>();
1710

    
1711
            //if (rotateOffSet > 3)
1712
            //    rotateOffSet = 0;
1713

    
1714
            //if (rotateOffSet < 0)
1715
            //    rotateOffSet = 3;
1716

    
1717
            if(Flag)
1718
            {
1719
                if (instanceMain.dzMainMenu.rotate.Angle == 270)
1720
                {
1721
                    instanceMain.dzMainMenu.rotate.Angle = 0;
1722
                }
1723
                else
1724
                {
1725
                    instanceMain.dzMainMenu.rotate.Angle += 90;
1726
                }
1727
            }
1728
            else
1729
            {
1730
                if(instanceMain.dzMainMenu.rotate.Angle == 0)
1731
                {
1732
                    instanceMain.dzMainMenu.rotate.Angle = 270;
1733
                }
1734
                else
1735
                {
1736
                    instanceMain.dzMainMenu.rotate.Angle -= 90;
1737
                }
1738
            }
1739
            //double angle = (double)rotateValue.GetValue(rotateOffSet);
1740
            //instanceMain.dzMainMenu.rotate.Angle = angle;
1741
            var rotationNum = Math.Abs((instanceMain.dzMainMenu.rotate.Angle / 90));
1742

    
1743
            if (instanceMain.dzMainMenu.zoomAndPanCanvas.Width == ViewerDataModel.Instance.ContentWidth)
1744
            {
1745
                double emptySize = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
1746
                instanceMain.dzMainMenu.zoomAndPanCanvas.Width = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
1747
                instanceMain.dzMainMenu.zoomAndPanCanvas.Height = emptySize;
1748
            }
1749
            if (instanceMain.dzMainMenu.rotate.Angle == 0)
1750
            {
1751
                instanceMain.dzMainMenu.translate.X = 0;
1752
                instanceMain.dzMainMenu.translate.Y = 0;
1753
            }
1754
            else if (instanceMain.dzMainMenu.rotate.Angle == 90)
1755
            {
1756
                instanceMain.dzMainMenu.translate.X = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
1757
                instanceMain.dzMainMenu.translate.Y = 0;
1758
            }
1759
            else if (instanceMain.dzMainMenu.rotate.Angle == 180)
1760
            {
1761
                instanceMain.dzMainMenu.translate.X = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
1762
                instanceMain.dzMainMenu.translate.Y = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
1763
            }
1764
            else
1765
            {
1766
                instanceMain.dzMainMenu.translate.X = 0;
1767
                instanceMain.dzMainMenu.translate.Y = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
1768
            }
1769

    
1770
            //instanceMain.dzMainMenu.zoomAndPanControl.RenderTransformOrigin = new Point(0.5, 0.5);
1771
            instanceMain.dzMainMenu.zoomAndPanControl.RotationAngle = instanceMain.dzMainMenu.rotate.Angle;
1772
            //대기(강인구)
1773
            //instanceMain.dzMainMenu.imageViewer.RotateAngle = instanceMain.dzMainMenu.rotate.Angle;
1774

    
1775

    
1776
            //instanceMain.dzMainMenu.imageViewer.RenderTransformOrigin = new Point(0.5, 0.5);
1777
            //RotateTransform rotateTransform = new RotateTransform(instanceMain.dzMainMenu.rotate.Angle);
1778
            //instanceMain.dzMainMenu.imageViewer.RenderTransform = rotateTransform;
1779

    
1780

    
1781
            ViewerDataModel.Instance.ContentWidth = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
1782
            ViewerDataModel.Instance.ContentHeight = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
1783
            ViewerDataModel.Instance.AngleOffsetX = instanceMain.dzMainMenu.translate.X;
1784
            ViewerDataModel.Instance.AngleOffsetY = instanceMain.dzMainMenu.translate.Y;
1785
            ViewerDataModel.Instance.PageAngle = instanceMain.dzMainMenu.rotate.Angle;
1786
            //ViewerDataModel.Instance.Document_Info.Clear();
1787
            //ViewerDataModel.Instance.Document_Info.Where(i => i.PAGE_NUMBER == instanceMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber).ToList().ForEach(value =>
1788
            //{
1789
            //    value.PAGE_ANGLE = int.Parse(instanceMain.dzMainMenu.rotate.Angle.ToString());
1790
            //});
1791

    
1792

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

    
1796
            foreach (var data in thumbnaillist)
1797
            {
1798
                data.Angle = int.Parse(instanceMain.dzMainMenu.rotate.Angle.ToString());
1799

    
1800
                //instanceMain.dzMainMenu.pageNavigator.ImgListbox.ItemsSource = instanceMain.dzMainMenu.pageNavigator._thumbnailItems;
1801
                var instance = instanceMain.dzMainMenu.CurrentDoc.docInfo.DOCPAGE.Where(p => p.PAGE_NUMBER == instanceMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber).FirstOrDefault();
1802
                instance.PAGE_ANGLE = int.Parse(instanceMain.dzMainMenu.rotate.Angle.ToString());
1803

    
1804
                instanceMain.dzMainMenu.pageNavigator.GotoPage(data.PageNumber);
1805

    
1806
                //rotation page add or update
1807
                var rotationdoc = ViewerDataModel.Instance.RotationDocs.Where(d => d.ID == instance.ID).FirstOrDefault();
1808
                if (rotationdoc != null)
1809
                {
1810
                    rotationdoc.PAGE_ANGLE = instance.PAGE_ANGLE;
1811
                }
1812
                else
1813
                {
1814
                    ViewerDataModel.Instance.RotationDocs.Add(instance);
1815
                }
1816
            }
1817
        }
1818
        #endregion
1819

    
1820
        private void ImageConverter(RadToggleButton instanceToggle)
1821
        {
1822
            try
1823
            {           
1824
                var instanceMain = this.ParentOfType<MainWindow>();
1825

    
1826
                Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
1827
                dlg.Filter = "All files (*.*)|*.*|PNG Images (*.png)|*.png";
1828
                Nullable<bool> result = dlg.ShowDialog();
1829
                if (result == true)
1830
                {
1831
                    instanceMain.dzMainMenu.filename = dlg.FileName;
1832
                    instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ImgControl;
1833

    
1834
                    System.IO.FileInfo fileInfo = new System.IO.FileInfo(instanceMain.dzMainMenu.filename);
1835
                    String strFile = System.IO.Path.GetFileName(instanceMain.dzMainMenu.filename);
1836
                    long numByte = fileInfo.Length;
1837
                    double dLen = Convert.ToDouble(fileInfo.Length / 1000000);
1838
                    kr.co.devdoftech.cloud.FileUpload fileUploader = App.FileUploader;
1839
             
1840
                    if (dLen < 4)
1841
                    {
1842
                        System.IO.FileStream fStream = new System.IO.FileStream(instanceMain.dzMainMenu.filename, System.IO.FileMode.Open, System.IO.FileAccess.Read);
1843
                        System.IO.BinaryReader br = new System.IO.BinaryReader(fStream);
1844
                        byte[] data = br.ReadBytes((int)numByte);
1845
                        br.Close();
1846

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

    
1849
                        Check_Uri.UriCheck(filepath);
1850

    
1851
                        instanceMain.dzMainMenu.filename = filepath;
1852

    
1853
                        fStream.Close();
1854
                        fStream.Dispose();
1855
                    }
1856
                    else
1857
                    {
1858
                        this.ParentOfType<MainWindow>().DialogMessage_Alert("Available Memory less than 4 mega byte", "Alert");
1859
                    }
1860
                }
1861
                else
1862
                {
1863
                    instanceToggle.IsChecked = false;
1864
                    Common.ViewerDataModel.Instance.SelectedControl = "";
1865
                    Common.ViewerDataModel.Instance.ControlTag = null;
1866
                    this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
1867
                    this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
1868
                    this.ParentOfType<MainWindow>().DialogMessage_Alert("No Image selected.", "Alert");
1869
                }
1870
            }
1871
            catch(Exception ex)
1872
            {
1873
                instanceToggle.IsChecked = false;
1874
                Common.ViewerDataModel.Instance.SelectedControl = "";
1875
                Common.ViewerDataModel.Instance.ControlTag = null;
1876
                this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
1877
                this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
1878
                App.FileLogger.Error("Image Converter ",ex);
1879

    
1880
                this.ParentOfType<MainWindow>().DialogMessage_Alert("System Error" , "Alert");
1881
            }
1882
        }
1883

    
1884
        private void Control_Init(RadToggleButton instanceToggle, object sender)
1885
        {
1886

    
1887
        }
1888

    
1889
        private void ControlEvent(object sender, RoutedEventArgs e)
1890
        {
1891
            RadToggleButton instanceToggle = sender as RadToggleButton;
1892
            var instanceMain = this.ParentOfType<MainWindow>();
1893

    
1894
            #region Ctrl + A 눌렀을 때 대처 방법 
1895
            //원인 : Ctrl + A를 누르면 UIElementSet에 등록을 시키지 않는다(이유는 한꺼번에 많은 양의 컨트롤의 동작이 유입되기 때문에
1896
            //       시스템의 성능저하를 불러올 수 있기 때문이다. 그래서 선택 후 다른 컨트롤을 누르면 등록되지 않은 컨트롤이기 때문에 삭제된다
1897
            //       이를 대처하는 방법으로 아래 코드를 사용한다.
1898
            if (Common.ViewerDataModel.Instance.MarkupControls.Count == 0 && Common.ViewerDataModel.Instance.MarkupControls.Count >= 1)
1899
            {
1900
                //var lstItem = instanceMain.DeepLayer._SelectLayer.ChildrenOfType<AdornerFinal>().ToList();
1901
                //foreach (var item in lstItem)
1902
                //{
1903
                //    foreach (var member in item.MemberSet)
1904
                //    {
1905
                //        if (!instanceMain.DeepLayer.UIElementSet.Contains(member.DrawingData))
1906
                //        {
1907
                //            instanceMain.DeepLayer.UIElementSet.Add(member.DrawingData);
1908
                //        }
1909
                //    }
1910
                //}
1911
            }
1912
            #endregion
1913

    
1914
            //if (!instanceMain.IsFreeSelectionMode)
1915
            //{
1916
            //    instanceMain.IsSwingMode = true;
1917
            //}
1918

    
1919
            //#region 다른 컨트롤 버튼 선택 해제
1920
            //System.Reactive.Linq.Observable2.FromPropertyChangedPattern(Common.ViewerDataModel.Instance, temp => temp.SelectedControl).Subscribe(ControlState =>
1921
            //{
1922
            //    if (ControlState == null)
1923
            //    {
1924
            //        instanceToggle.IsChecked = false;
1925
            //        HiddenControlHide();
1926
            //    }
1927
            //});
1928
            //#endregion
1929

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

    
1932
            if (instanceToggle != null)
1933
            {
1934
                Common.ViewerDataModel.Instance.ControlTag = instanceToggle.Tag.ToString();
1935
            }
1936
            else if ((sender as RadRibbonToggleButton) != null)
1937
            {
1938
                Common.ViewerDataModel.Instance.ControlTag = (sender as RadRibbonToggleButton).Tag.ToString();
1939
                instanceToggle = (sender as RadRibbonToggleButton);
1940
            }
1941
            else if ((sender as RadRibbonButton) != null)
1942
            {
1943
                RadRibbonButton instanceButton = sender as RadRibbonButton;
1944
                Common.ViewerDataModel.Instance.ControlTag = instanceButton.Tag.ToString();
1945
            }
1946
            else
1947
            {
1948
                RadButton instanceButton = sender as RadButton;
1949
                Common.ViewerDataModel.Instance.ControlTag = instanceButton.Tag.ToString();
1950
            }
1951

    
1952

    
1953
            //System.Reactive.Linq.Observable2.FromPropertyChangedPattern(Common.ViewerDataModel.Instance, temp => temp.AngleVisibility).Subscribe(isSee =>
1954
            //{
1955
            //    if (instanceToggle.CommandParameter.ToString() == "ChainLine")
1956
            //    {
1957

    
1958
            //    }
1959
            //    else
1960
            //    {
1961
            //        System.Diagnostics.Debug.WriteLine(" instanceMain.dzMainMenu.MainAngle.Visibility   " + isSee);
1962

    
1963
            //        if (instanceMain.dzMainMenu.MainAngle.Visibility != isSee)
1964
            //        {
1965
            //            instanceMain.dzMainMenu.MainAngle.Visibility = isSee;
1966
            //        }
1967
            //    }
1968
            //    //System.Reactive.Linq.Observable2.FromPropertyChangedPattern(Common.ViewerDataModel.Instance, temp => temp.AngleValue).Subscribe(p =>
1969
            //    //{
1970
            //    //    instanceMain.dzMainMenu.MainAngle.AngleValue = p;
1971
            //    //});
1972
            //});
1973

    
1974
            instanceMain.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Drawing;
1975

    
1976
            instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = false;
1977

    
1978
            if (instanceToggle.IsChecked != false)
1979
            {
1980
                string param = instanceToggle.CommandParameter.ToString();
1981
                string MacroIndex = "";
1982

    
1983
                if (param.StartsWith("MACRO"))
1984
                {
1985
                    param = "MACRO";
1986
                    MacroIndex = param.Replace("MACRO;","");
1987

    
1988
                    //Common.ViewerDataModel.Instance.MacroItems = MacroHelper.LoadMacroItems(MacroIndex);
1989
                    //var items = MacroHelper.TopMenuItems();
1990

    
1991
                    Common.ViewerDataModel.Instance.MacroItems = new List<MacroItem>
1992
                    {
1993
                        new MacroItem
1994
                        {
1995
                            Desc = "Cloud Rectangle",
1996
                            ControlType = MarkupToPDF.Controls.Common.ControlType.RectCloud
1997
                        },
1998
                        new MacroItem
1999
                        {
2000
                             Desc = "Arrow TextBox",
2001
                            ControlType = MarkupToPDF.Controls.Common.ControlType.ArrowTextBorderControl
2002
                        }
2003
                    };
2004
                }
2005

    
2006
                #region 컨트롤이 체크되었다면
2007
                switch (param)
2008
                {
2009
                    #region Line
2010
                    case "Line":
2011
                        Common.ViewerDataModel.Instance.SelectedControl = "Line";
2012
                        //HiddenAxisLock.Visibility = Visibility.Visible;
2013
                        if (instanceToggle.Tag.ToString() == "LineDelete")
2014
                        {
2015
                            //HiddenInterval.Visibility = Visibility.Visible;
2016
                        }
2017
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.SingleLine;
2018
                        break;
2019
                    #endregion
2020
                    #region ChainLine
2021
                    case "ChainLine":
2022
                        Common.ViewerDataModel.Instance.SelectedControl = "ChainLine";
2023
                        //HiddenAxisLock.Visibility = Visibility.Visible;
2024
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ChainLine;
2025
                        break;
2026
                    #endregion
2027
                    #region DimLine
2028
                    case "DimLine":
2029
                        Common.ViewerDataModel.Instance.SelectedControl = "DimLine";
2030
                        //HiddenAxisLock.Visibility = Visibility.Visible;
2031
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.DimLine;
2032
                        break;
2033
                    #endregion
2034
                    #region TwinLine
2035
                    case "TwinLine":
2036
                        Common.ViewerDataModel.Instance.SelectedControl = "TwinLine";
2037
                        //HiddenAxisLock.Visibility = Visibility.Visible;
2038
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.TwinLine;
2039
                        break;
2040
                    #endregion
2041
                    #region CancelLine
2042
                    case "CancelLine":
2043
                        Common.ViewerDataModel.Instance.SelectedControl = "CancelLine";
2044
                        //HiddenAxisLock.Visibility = Visibility.Visible;
2045
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.CancelLine;
2046
                        break;
2047
                    #endregion
2048
                    #region PolygonCloud
2049
                    case "PolygonCloud":
2050
                        Common.ViewerDataModel.Instance.SelectedControl = "PolygonCloud";
2051
                        //HiddenAxisLock.Visibility = Visibility.Visible;
2052
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.PolygonCloud;
2053
                        break;
2054
                    #endregion
2055
                    #region RectCloud
2056
                    case "RectCloud":
2057
                        Common.ViewerDataModel.Instance.SelectedControl = "RectCloud";
2058
                        //HiddenAxisLock.Visibility = Visibility.Visible;
2059
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.RectCloud;
2060
                        break;
2061
                    #endregion
2062
                    #region Rectangle
2063
                    case "Rectangle":
2064
                        Common.ViewerDataModel.Instance.SelectedControl = "Rectangle";
2065
                        //HiddenAxisLock.Visibility = Visibility.Visible;
2066
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Rectangle;
2067
                        break;
2068
                    #endregion
2069
                    #region Triangle
2070
                    case "Triangle":
2071
                        Common.ViewerDataModel.Instance.SelectedControl = "Triangle";
2072
                        //HiddenAxisLock.Visibility = Visibility.Visible;
2073
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Triangle;
2074
                        break;
2075
                    #endregion
2076
                    #region RectCloud
2077
                    case "Circle":
2078
                        Common.ViewerDataModel.Instance.SelectedControl = "Circle";
2079
                        //HiddenAxisLock.Visibility = Visibility.Visible;
2080
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Circle;
2081
                        break;
2082
                    #endregion
2083
                    #region Symbol
2084
                    case "Symbol":
2085
                        Common.ViewerDataModel.Instance.SelectedControl = "Symbol";
2086
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2087
                        break;
2088
                    #endregion
2089
                    #region SymbolN
2090
                    case "SymbolN":
2091
                        Common.ViewerDataModel.Instance.SelectedControl = "SymbolN";
2092
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Stamp;
2093
                        break;
2094
                    #endregion
2095
                    #region Text
2096
                    case "Text":
2097
                        Common.ViewerDataModel.Instance.SelectedControl = "Text";
2098
                        TaskMessage("Text 도구는 텍스트 영역을 더블 클릭하여 텍스트를 재 편집 할 수 있습니다", TaskMessageType.Normal);
2099
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.TextControl;
2100
                        break;
2101
                    #endregion
2102
                    #region TextBorder
2103
                    case "TextBorder":
2104
                        Common.ViewerDataModel.Instance.SelectedControl = "TextBorder";
2105
                        TaskMessage("Text 도구는 텍스트 영역을 더블 클릭하여 텍스트를 재 편집 할 수 있습니다", TaskMessageType.Normal);
2106
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.TextBorder;
2107
                        break;
2108
                    #endregion
2109
                    #region TextCloud
2110
                    case "TextCloud":
2111
                        Common.ViewerDataModel.Instance.SelectedControl = "TextCloud";
2112
                        TaskMessage("Text 도구는 텍스트 영역을 더블 클릭하여 텍스트를 재 편집 할 수 있습니다", TaskMessageType.Normal);
2113
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.TextCloud;
2114
                        break;
2115
                    #endregion
2116
                    #region Date
2117
                    case "Date":
2118
                        Common.ViewerDataModel.Instance.SelectedControl = "Date";
2119
                        TaskMessage("날짜 컨트롤을 더블 클릭하면 날짜를 변경할 수 있습니다", TaskMessageType.Normal);
2120
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Date;
2121
                        break;
2122
                    #endregion
2123
                    #region ArrowText
2124
                    case "ArrowText":
2125
                        TaskMessage("ArrowText 컨트롤은 그린 후 컨트롤을 선택하였을 시 중간점을 조정할 수 있습니다", TaskMessageType.Normal);
2126
                        if (instanceToggle.Tag.ToString() == "ArrowText_Cloud")
2127
                        {
2128
                            Common.ViewerDataModel.Instance.SelectedControl = "ArrowText_Cloud";
2129
                            instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowTextCloudControl;
2130
                        }
2131
                        else if (instanceToggle.Tag.ToString() == "ArrowText_Border")
2132
                        {
2133
                            Common.ViewerDataModel.Instance.SelectedControl = "ArrowTextBorderControl";
2134
                            instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowTextBorderControl;
2135
                        }
2136
                        else if (instanceToggle.Tag.ToString() == "ArrowTextFix_Normal")
2137
                        {
2138
                            Common.ViewerDataModel.Instance.SelectedControl = "ArrowTransTextControl";
2139
                            instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowTransTextControl;
2140
                        }
2141
                        else if (instanceToggle.Tag.ToString() == "ArrowTextFix_Border")
2142
                        {
2143
                            Common.ViewerDataModel.Instance.SelectedControl = "ArrowTransTextBorderControl";
2144
                            instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowTransTextBorderControl;
2145
                        }
2146
                        else if (instanceToggle.Tag.ToString() == "ArrowTextFix_Cloud")
2147
                        {
2148
                            Common.ViewerDataModel.Instance.SelectedControl = "ArrowTransTextCloudControl";
2149
                            instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowTransTextCloudControl;
2150
                        }
2151
                        else
2152
                        {
2153
                            Common.ViewerDataModel.Instance.SelectedControl = "ArrowText";
2154
                            instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowTextControl;
2155
                            //HiddenAxisLock.Visibility = Visibility.Visible;
2156
                        }
2157
                        break;
2158
                    #endregion
2159
                    #region Arrow
2160
                    case "Arrow":
2161
                        Common.ViewerDataModel.Instance.SelectedControl = "Arrow";
2162
                        //HiddenAxisLock.Visibility = Visibility.Visible;
2163
                        //HiddenDimSize.Visibility = Visibility.Visible;
2164
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowLine;
2165
                        break;
2166
                    #endregion
2167
                    #region Shape
2168
                    case "Shape":
2169
                        Common.ViewerDataModel.Instance.SelectedControl = "Shape";
2170
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Mark;
2171
                        break;
2172
                    #endregion
2173
                    #region Polygon
2174
                    case "Polygon":
2175
                        Common.ViewerDataModel.Instance.SelectedControl = "Polygon";
2176
                        TaskMessage("자유형 코멘트 도구는 오른쪽 마우스 클릭을 통해 그리기를 마칠 수 있습니다", TaskMessageType.Normal);
2177
                        //HiddenAxisLock.Visibility = Visibility.Visible;
2178
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.PolygonControl;
2179
                        break;
2180
                    #endregion
2181
                    #region Arc
2182
                    case "Arc":
2183
                        Common.ViewerDataModel.Instance.SelectedControl = "Arc";
2184
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArcLine;
2185
                        //HiddenAxisLock.Visibility = Visibility.Visible;
2186
                        TaskMessage("Arc 코멘트 도구는 오른쪽 마우스를 사용해 좌우 반전을 사용하실 수 있습니다", TaskMessageType.Normal);
2187
                        break;
2188
                    #endregion
2189
                    #region ArrowArc
2190
                    case "ArrowArc":
2191
                        Common.ViewerDataModel.Instance.SelectedControl = "ArrowArc";
2192
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArcArrow;
2193
                        //HiddenAxisLock.Visibility = Visibility.Visible;
2194
                        TaskMessage("ArcArrow 코멘트 도구는 오른쪽 마우스를 사용해 좌우 반전을 사용하실 수 있습니다", TaskMessageType.Normal);
2195
                        break;
2196
                    #endregion
2197
                    #region ArrowMulti
2198
                    case "ArrowMulti":
2199
                        Common.ViewerDataModel.Instance.SelectedControl = "ArrowMulti";
2200
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowMultiLine;
2201
                        //HiddenAxisLock.Visibility = Visibility.Visible;
2202
                        break;
2203
                    #endregion
2204
                    #region Etc
2205
                    case "Etc":
2206
                        Common.ViewerDataModel.Instance.SelectedControl = "Etc";
2207
                        break;
2208
                    #endregion
2209
                    #region Ink
2210
                    case "Ink":
2211
                        if (instanceToggle.Tag.ToString() == "EraserClear")
2212
                        {
2213
                            TaskMessage("해당 컨트롤은 점 단위로 그려진 펜을 지웁니다", TaskMessageType.Normal);
2214
                            //instanceMain.dzMainMenu.inkDrawingCanvas.EditingMode = InkCanvasEditingMode.EraseByPoint;
2215
                            instanceMain.dzMainMenu.inkBoard.Tag = "EraseByPoint";
2216
                        }
2217
                        else if (instanceToggle.Tag.ToString() == "Eraser")
2218
                        {
2219
                            TaskMessage("해당 컨트롤은 선 단위로 그려진 펜을 지웁니다", TaskMessageType.Normal);
2220
                            instanceMain.dzMainMenu.inkBoard.Tag = "EraseByStroke";
2221
                            //instanceMain.dzMainMenu.inkDrawingCanvas.EditingMode = InkCanvasEditingMode.EraseByStroke;
2222
                        }
2223
                        else
2224
                        {
2225
                            instanceMain.dzMainMenu.inkBoard.Tag = "Ink";
2226
                            //instanceMain.dzMainMenu.inkDrawingCanvas.EditingMode = InkCanvasEditingMode.Ink;
2227
                        }
2228

    
2229
                        //instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = true;
2230

    
2231
                        Common.ViewerDataModel.Instance.SelectedControl = "Ink";
2232
                        Common.ViewerDataModel.Instance.LineSize = (double)cbLineSize.Value;
2233
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.PenControl;
2234
                        break;
2235
                    #endregion
2236
                    #region Select
2237
                    case "Select":
2238
                        if(this.ParentOfType<MainWindow>().dzMainMenu.currentControl != null)
2239
                        {
2240
                            ViewerDataModel.Instance.MarkupControls_USER.Remove(this.ParentOfType<MainWindow>().dzMainMenu.currentControl);
2241
                            this.ParentOfType<MainWindow>().dzMainMenu.currentControl = null;
2242
                        }
2243
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Selecting;
2244
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2245
                        instanceMain.dzMainMenu.isLeftMouseButtonDownOnWindow = false;
2246
                        break;
2247
                    #endregion
2248
                    #region Image
2249
                    case "Image":
2250
                        Common.ViewerDataModel.Instance.SelectedControl = "ImgControl";
2251
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ImgControl;
2252
                        ImageConverter(instanceToggle);
2253
                        break;
2254
                    #endregion
2255
                    #region Sign
2256
                    case "Sign":
2257
                        Common.ViewerDataModel.Instance.SelectedControl = "Sign";
2258
                        Common.ViewerDataModel.Instance.ControlTag = instanceMain.dzMainMenu._ViewInfo.UserID; //사번
2259
                        //강인구 추가
2260
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Sign;
2261
                        //instanceMain.BaseClient.GetUserSignCompleted += (sen, ea) =>
2262
                        //{
2263
                        //    if (ea.Result == null)
2264
                        //    {
2265

    
2266
                        //        this.ParentOfType<MainPage>().DialogMessage_Alert("You Don't Have Sign Data", "Alert");
2267
                        //    }
2268
                        //    else
2269
                        //    {
2270
                        //        byte[] imageBytes = System.Convert.FromBase64String(ea.Result);
2271
                        //        using (MemoryStream ms = new MemoryStream(imageBytes))
2272
                        //        {
2273
                        //            BitmapImage im = new BitmapImage();
2274
                        //            im.SetSource(ms);
2275
                        //            instanceMain.DeepLayer.SignImage = im;
2276
                        //            ms.Close();
2277
                        //        }
2278
                        //    }
2279
                        //};
2280
                        //instanceMain.BaseClient.GetUserSignAsync(instanceMain._ViewInfo.UserID);
2281
                        break;
2282
                    #endregion
2283
                    #region Check
2284
                    case "Check":
2285
                        Common.ViewerDataModel.Instance.SelectedControl = "Check";
2286
                        Common.ViewerDataModel.Instance.ControlTag = instanceMain.dzMainMenu._ViewInfo.UserID; //사번
2287
                        //강인구 추가
2288
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Symbol;
2289
                        break;
2290
                    #endregion
2291
                    #region Batch
2292
                    case "Batch":
2293
                        Common.ViewerDataModel.Instance.SelectedControl = "Batch";
2294
                        Common.ViewerDataModel.Instance.ControlTag = instanceMain.dzMainMenu._ViewInfo.UserID; //사번
2295
                        //강인구 추가
2296
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Mark;
2297
                        instanceMain.dzMainMenu.txtBatch.Visibility = Visibility.Visible;
2298
                        instanceMain.dzMainMenu.txtBatch.Text = "Place Mark";
2299
                        break;
2300
                    #endregion
2301

    
2302
                    #region MACRO -MACRO1
2303
                    case "MACRO":
2304
                        Common.ViewerDataModel.Instance.SelectedControl = "MACRO";
2305
                        Common.ViewerDataModel.Instance.ControlTag = instanceMain.dzMainMenu._ViewInfo.UserID; //사번
2306

    
2307
                        MacroHelper.MacroAction();
2308

    
2309
                        break;
2310
                    #endregion
2311

    
2312
                    #region Copy
2313
                    case "Copy":
2314
                        Copy_Start();
2315
                        instanceToggle.IsChecked = false;
2316
                        ViewerDataModel.Instance.SelectedControl = "";
2317
                        ViewerDataModel.Instance.ControlTag = null;
2318
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2319
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2320
                        break;
2321
                    #endregion
2322
                    #region Cut
2323
                    case "Cut":
2324
                        //Cut_Start();
2325
                        CutCommand.Instance.Execute();
2326
                        instanceToggle.IsChecked = false;
2327
                        ViewerDataModel.Instance.SelectedControl = "";
2328
                        ViewerDataModel.Instance.ControlTag = null;
2329
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2330
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2331
                        break;
2332
                    #endregion
2333
                    #region Paste
2334
                    case "Paste":
2335
                        Paste_Start();
2336
                        instanceToggle.IsChecked = false;
2337
                        ViewerDataModel.Instance.SelectedControl = "";
2338
                        ViewerDataModel.Instance.ControlTag = null;
2339
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2340
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;                        
2341
                        break;
2342
                    #endregion
2343
                    #region Delete
2344
                    case "Delete":
2345
                        DeleteCommand.Instance.Execute(SelectionSet.Instance.SelectedItems);
2346
                        this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Clear();
2347

    
2348
                        instanceToggle.IsChecked = false;
2349
                        ViewerDataModel.Instance.SelectedControl = "";
2350
                        ViewerDataModel.Instance.ControlTag = null;
2351
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2352
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2353
                        break;
2354
                    #endregion
2355
                    #region Undo
2356
                    case "Undo":
2357
                        UndoCommand.Instance.Execute();
2358
                        instanceToggle.IsChecked = false;
2359
                        ViewerDataModel.Instance.SelectedControl = "";
2360
                        ViewerDataModel.Instance.ControlTag = null;
2361
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2362
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2363
                        break;
2364
                    #endregion
2365
                    #region Redo
2366
                    case "Redo":
2367
                        RedoCommand.Instance.Execute();
2368
                        instanceToggle.IsChecked = false;
2369
                        ViewerDataModel.Instance.SelectedControl = "";
2370
                        ViewerDataModel.Instance.ControlTag = null;
2371
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2372
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2373
                        break;
2374
                    #endregion
2375
                    #region DragZoom
2376
                    case "DragZoom":
2377
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.DragZoom;
2378
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2379
                        instanceMain.dzMainMenu.isLeftMouseButtonDownOnWindow = false;
2380
                        break;
2381
                    #endregion
2382
                    #region Grouping
2383
                    case "Group":
2384
                        //var GrouptoggleList = this.Parent.ChildrenOfType<RadRibbonToggleButton>();
2385
                        //foreach (var togle in GrouptoggleList)
2386
                        //{
2387
                        //    togle.IsChecked = false;
2388
                        //}
2389

    
2390
                        //if (this.ParentOfType<MainWindow>().dzMainMenu.currentControl != null)
2391
                        //{
2392
                        //    ViewerDataModel.Instance.MarkupControls_USER.Remove(this.ParentOfType<MainWindow>().dzMainMenu.currentControl);
2393
                        //    this.ParentOfType<MainWindow>().dzMainMenu.currentControl = null;
2394
                        //}
2395
                        //this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2396
                        //instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2397
                        //instanceMain.dzMainMenu.isLeftMouseButtonDownOnWindow = false;
2398
                        //if (ViewerDataModel.Instance.SystemMain.dzMainMenu.SelectLayer.Children.Count < 1) //선택된 것이 없으면
2399
                        //{
2400
                        //    this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert("Please Select Controls", "Alert");
2401
                        //}
2402
                        //else//if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
2403
                        //{
2404
                        //    // string MarkupData = "";
2405
                        //    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
2406
                        //    {
2407
                        //        if (item.GetType().Name == "AdornerFinal" && (item as AdornerFinal).MemberSet.Count >= 2) // 얘가 2개 이상이여야 그룹가능 버튼도 막을거긴하지만 일단..
2408
                        //        {
2409
                        //            //MARKUP_DATA_GROUP INSERT
2410
                        //            MARKUP_DATA_GROUP mARKUP_DATA_GROUP = new MARKUP_DATA_GROUP
2411
                        //            {
2412
                        //                SYMBOL_ID = null,//InnerItem.Symbol_ID
2413
                        //                STATE = 0,
2414
                        //            };
2415
                        //            long group_id = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.AddMarkupDataGroup(mARKUP_DATA_GROUP, App.ViewInfo.ProjectNO);
2416
                        //            //Logger.sendReqLog("AddMarkupDataGroup: ", "", 1);
2417
                        //            if (group_id > 0)
2418
                        //            {
2419
                        //                foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
2420
                        //                {
2421
                        //                    if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
2422
                        //                    {
2423
                        //                        //MARKUP_DATA UPDATE
2424
                        //                        //Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.UpdateMarkupData((InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo).CommentID, group_id, App.ViewInfo.ProjectNO);
2425
                        //                        ////Logger.sendReqLog("UpdateMarkupData: ", "", 1);
2426
                        //                        ViewerDataModel.Instance.MyMarkupList.Where(d => d.ID == (InnerItem.DrawingData as CommentUserInfo).CommentID).FirstOrDefault().Group_ID = group_id;
2427
                        //                        ViewerDataModel.Instance.MyMarkupList.Where(d => d.ID == (InnerItem.DrawingData as CommentUserInfo).CommentID).FirstOrDefault().IsUpdate = true;
2428
                        //                    }
2429
                        //                }
2430
                        //            }
2431
                        //        }
2432
                        //    }
2433
                        //}
2434
                        break;
2435
                    case "UnGroup":
2436
                        //var UnGrouptoggleList = this.Parent.ChildrenOfType<RadRibbonToggleButton>();
2437
                        //foreach (var togle in UnGrouptoggleList)
2438
                        //{
2439
                        //    togle.IsChecked = false;
2440
                        //}
2441
                        //if (this.ParentOfType<MainWindow>().dzMainMenu.currentControl != null)
2442
                        //{
2443
                        //    ViewerDataModel.Instance.MarkupControls_USER.Remove(this.ParentOfType<MainWindow>().dzMainMenu.currentControl);
2444
                        //    this.ParentOfType<MainWindow>().dzMainMenu.currentControl = null;
2445
                        //}
2446
                        //this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2447
                        //instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2448
                        //instanceMain.dzMainMenu.isLeftMouseButtonDownOnWindow = false;
2449

    
2450
                        //if (ViewerDataModel.Instance.SystemMain.dzMainMenu.SelectLayer.Children.Count < 1) //선택된 것이 없으면
2451
                        //{
2452
                        //    this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert("Please Select Controls", "Alert");
2453
                        //}
2454
                        //else//if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
2455
                        //{
2456
                        //    // string MarkupData = "";
2457
                        //    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
2458
                        //    {
2459
                        //        if (item.GetType().Name == "AdornerFinal" && (item as AdornerFinal).MemberSet.Count >= 1) // 1개 이상 
2460
                        //        {
2461
                        //            //MARKUP_DATA UPDATE
2462
                        //            foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
2463
                        //            {
2464
                        //                if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
2465
                        //                {
2466
                        //                    long group_id = ViewerDataModel.Instance.MyMarkupList.Where(d => d.ID == (InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo).CommentID).FirstOrDefault().Group_ID;
2467
                        //                    //MARKUP_DATA UPDATE
2468
                        //                    //Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.UpdateMarkupData((InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo).CommentID, 0, App.ViewInfo.ProjectNO);
2469
                        //                    ////Logger.sendReqLog("UpdateMarkupData: ", "", 1);
2470
                        //                    ViewerDataModel.Instance.MyMarkupList.Where(d => d.ID == (InnerItem.DrawingData as CommentUserInfo).CommentID).FirstOrDefault().Group_ID = 0;
2471
                        //                    ViewerDataModel.Instance.MyMarkupList.Where(d => d.ID == (InnerItem.DrawingData as CommentUserInfo).CommentID).FirstOrDefault().IsUpdate = true;
2472

    
2473

    
2474
                        //                    //MARKUP_DATA_GROUP UPDATE
2475
                        //                    //bool value = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.UpdateMarkupDataGroup(group_id, App.ViewInfo.ProjectNO);
2476
                        //                    ////Logger.sendReqLog("AddMarkupDataGroup: ", value.ToString(), 1);
2477
                        //                }
2478
                        //            }
2479
                        //        }
2480
                        //    }
2481
                        //}
2482
                        break;
2483
                    #endregion
2484
                    #region Capture
2485
                    case "Capture":
2486
                        SyncInit();
2487
                        //   instanceToggle.IsChecked = false;
2488
                        var CaptureList = this.Parent.ChildrenOfType<RadRibbonToggleButton>();
2489
                        foreach (var togle in CaptureList)
2490
                        {
2491
                            togle.IsChecked = false;
2492
                        }
2493

    
2494
                        if (this.ParentOfType<MainWindow>().dzMainMenu.currentControl != null)
2495
                        {
2496
                            ViewerDataModel.Instance.MarkupControls_USER.Remove(this.ParentOfType<MainWindow>().dzMainMenu.currentControl);
2497
                            this.ParentOfType<MainWindow>().dzMainMenu.currentControl = null;
2498
                        }
2499

    
2500
                        ViewerDataModel.Instance.SelectedControl = "ImgControl";
2501
                   //     ViewerDataModel.Instance.ControlTag = null;
2502
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ImgControl;
2503

    
2504
                        /*
2505
                        //캡쳐 하기 전에 코멘트 저장
2506
                        if (Common.ViewerDataModel.Instance.MarkupControls_USER.Count > 0 || (Application.Current.MainWindow as MainWindow).dzMainMenu.SelectLayer.Children.Count > 0)
2507
                        {
2508
                            var menu = (Application.Current.MainWindow as MainWindow).dzMainMenu;
2509
                            menu.ReleaseAdorner();
2510
                            if (menu.PreviewUserMarkupInfoItem != null && menu.PreviewUserMarkupInfoItem.IsPreviewUser == true)
2511
                            {
2512
                                (Application.Current.MainWindow as MainWindow).dzTopMenu.RefactoryCommentReact(menu);
2513
                            }
2514
                            else if (menu.gridViewMarkup.SelectedItems.Count == 0 || (menu.gridViewMarkup.SelectedItems.FirstOrDefault() as IKCOM.MarkupInfoItem).UserID != App.ViewInfo.UserID)
2515
                            {
2516

    
2517
                            }
2518
                            else
2519
                            {
2520
                                (Application.Current.MainWindow as MainWindow).dzTopMenu.RefactoryCommentReact(menu);
2521
                            }
2522
                        }*/
2523

    
2524
                        //Common.ViewerDataModel.Instance.CheckList_ID = ((e.Source as Telerik.Windows.Controls.RadButton).DataContext as Customer).ID;
2525
                        //Common.ViewerDataModel.Instance.CheckList_ID = ((e.Source as Image).DataContext as Customer).ID;
2526
                        //Common.ViewerDataModel.Instance.PageNumber = ((e.Source as Image).DataContext as Customer).PAGENUMBER;
2527
                        Application.Current.MainWindow.Focus();
2528
                        Common.ViewerDataModel.Instance.Capture_Opacity = 0.49;
2529
                        (Application.Current.MainWindow as MainWindow).dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Capture;
2530
                        break;
2531
                    #endregion
2532
                    #region Cad
2533
                    case "Inside":
2534
                        //instanceMain.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Drawing;
2535
                        //instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = false;
2536
                        Common.ViewerDataModel.Instance.SelectedControl = "InsideWhite";
2537
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.InsideWhite;
2538
                        break;
2539
                    case "Overlap":
2540
                        //instanceMain.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Drawing;
2541
                        //instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = false;
2542
                        Common.ViewerDataModel.Instance.SelectedControl = "OverlapWhite";
2543
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.OverlapWhite;
2544
                        break;
2545
                    case "Clip":
2546
                        //instanceMain.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Drawing;
2547
                        //instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = false;
2548
                        Common.ViewerDataModel.Instance.SelectedControl = "ClipWhite";
2549
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ClipWhite;
2550
                        break;
2551
                    case "CadExport":
2552
                        //if (isClosed)
2553
                        //{
2554
                        //    //토글 및 마우스 상태 초기화
2555
                        //    var toggleList = this.Parent.ChildrenOfType<RadRibbonToggleButton>();
2556
                        //    foreach (var togle in toggleList)
2557
                        //    {
2558
                        //        togle.IsChecked = false;
2559
                        //    }
2560
                        //    this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2561

    
2562
                        //    isClosed = false;
2563
                        //    //Control 파일 먼저 생성
2564
                        //    CollapsedButton_Click();
2565
                        //    CadViewer check = new CadViewer();
2566
                        //    check.WindowStartupLocation = WindowStartupLocation.CenterScreen;
2567
                        //    check.Title = "Export Viewer";
2568
                        //    //check.Topmost = true;
2569
                        //    check.Show();
2570
                        //    check.Closed += Check_Closed;
2571
                        //    instanceToggle.IsChecked = false;
2572
                        //}
2573
                        //break;
2574
                    case "CadViewer":
2575
                        //if (isClosed)
2576
                        //{
2577
                        //    //토글 및 마우스 상태 초기화
2578
                        //    var toggleList = this.Parent.ChildrenOfType<RadRibbonToggleButton>();
2579
                        //    foreach (var togle in toggleList)
2580
                        //    {
2581
                        //        togle.IsChecked = false;
2582
                        //    }
2583
                        //    this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2584

    
2585
                        //    isClosed = false;
2586
                        //    CadResultViewer check = new CadResultViewer();
2587
                        //    check.WindowStartupLocation = WindowStartupLocation.CenterScreen;
2588
                        //    check.Title = "Viewer";
2589
                        //    check.Show();
2590

    
2591
                        //    check.Closed += Check_Closed;
2592

    
2593
                        //}
2594
                        break;
2595
                    #endregion
2596
                    default:
2597
                        break;
2598
                }
2599
                #endregion
2600
            }
2601
            else
2602
            {
2603
                if (Common.ViewerDataModel.Instance.IsMacroCommand)
2604
                {
2605
                    MacroHelper.Clear();
2606
                }
2607

    
2608
                if (!instanceMain.dzMainMenu.IsFreeSelectionMode)
2609
                {
2610
                    instanceMain.dzMainMenu.IsSwingMode = false;
2611
                    Common.ViewerDataModel.Instance.SelectedControl = "";
2612
                    Common.ViewerDataModel.Instance.ControlTag = null;
2613
                    this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2614
                    this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2615
                }
2616
            }
2617

    
2618
        }
2619

    
2620
        private void SyncInit()
2621
        {
2622
            try
2623
            {
2624
                if (!ViewerDataModel.Instance.SystemMain.dzMainMenu.testPanel2.IsHidden)
2625
                {
2626
                    ViewerDataModel.Instance.SystemMain.dzMainMenu.testPanel2.IsHidden = true;
2627
                    ViewerDataModel.Instance.PageBalanceMode = false;
2628
                    ViewerDataModel.Instance.PageBalanceNumber = 0;
2629
                    ViewerDataModel.Instance.SyncPageNumber = 0;
2630
                    ViewerDataModel.Instance.MarkupControls_Sync.Clear();
2631
                    ViewerDataModel.Instance.SystemMain.dzMainMenu.gridViewRevMarkup.Visibility = Visibility.Collapsed;
2632
                    ViewerDataModel.Instance.SystemMain.dzMainMenu.UserList.IsChecked = false;
2633
                    ViewerDataModel.Instance.SystemMain.dzMainMenu.BalanceMode.IsChecked = false;
2634
                }
2635
            }
2636
            catch (Exception ex)
2637
            {
2638
                //Logger.sendResLog("SyncInit", ex.Message, 0);
2639
            }
2640

    
2641
        }
2642

    
2643
        Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
2644
        CommentUserInfo currentControl { get; set; }
2645
        private void Check_Closed(object sender, EventArgs e)
2646
        {
2647
            isClosed = true;
2648
            //this.ParentOfType<MainWindow>().dzMainMenu.PN_Navi.IsEnabled = true;
2649
            //토글 및 마우스 상태 초기화
2650
            var toggleList = this.Parent.ChildrenOfType<RadToggleButton>();
2651
            foreach (var togle in toggleList)
2652
            {
2653
                togle.IsChecked = false;
2654
            }
2655
            this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2656
            ViewerDataModel.Instance.Capture_Opacity = 0;
2657

    
2658
        }
2659

    
2660
        /* public class test 
2661
         {
2662
             public double width { get; set; }
2663
             public double height { get; set; }
2664
         }
2665
         */
2666
        private async void CollapsedButton_Click()
2667
        {
2668
            this.ParentOfType<MainWindow>().dzTopMenu._SaveEvent(null, null); // 저장하지 못한 데이터가 있다면 저장
2669

    
2670
            string[] data = new string[0];
2671

    
2672
            int cnt = 0;
2673
            var menu = this.ParentOfType<MainWindow>().dzMainMenu;
2674

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

    
2677
            foreach (var item in gridSelectionItem)
2678
            {
2679
                if ((item.UserID == App.ViewInfo.UserID) && (ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.CurrentPage != null))
2680
                {
2681
                    var instance = ViewerDataModel.Instance.MyMarkupList.Where(d => d.PageNumber == ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber &&
2682
                    d.MarkupInfoID == item.MarkupInfoID).ToList();
2683
                    data = new string[instance.Count];
2684
                    foreach (var markup in instance)
2685
                    {
2686
                        data[cnt++] = await MarkupToPDF.Serialize.Core.JsonSerializerHelper.UnCompressStringAsync(markup.Data,ViewerDataModel.Instance.CancellationToken());
2687
                    }
2688
                }
2689
            }
2690

    
2691
            if (data != null && KCOM.Properties.Settings.Default.cad == 1)
2692
            {
2693
                string FilePath = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\Cad");
2694
                string FileName = FilePath + "\\commentstring.json"; // Default file name
2695
                if (!File.Exists(FilePath))
2696
                {
2697
                    Directory.CreateDirectory(FilePath);
2698
                }
2699

    
2700
                if (!string.IsNullOrEmpty(FileName))
2701
                {
2702
                    //  File.WriteAllText(SaveDig.FileName, data);
2703
                    File.WriteAllLines(FileName, data);
2704
                }
2705
            }
2706
        }
2707

    
2708
        private double minHeight;
2709
        private double minWidth;
2710

    
2711
        private double maxHeight;
2712
        private double maxWidth;
2713

    
2714
        public bool CanVResize { get; private set; }
2715
        public bool CanHResize { get; private set; }
2716

    
2717
        public void DesignerComponent(FrameworkElement content)
2718
        {
2719
            this.InitializeComponent();
2720

    
2721
            if (!double.IsNaN(content.Width))
2722
            {
2723
                CanHResize = false;
2724
                this.Width = content.Width;
2725
            }
2726
            else
2727
            {
2728
                CanHResize = true;
2729
                this.Width = 23.0;
2730
            }
2731
            if (!double.IsNaN(content.Height))
2732
            {
2733
                CanVResize = false;
2734
                this.Height = content.Height; ;
2735
            }
2736
            else
2737
            {
2738
                CanVResize = true;
2739
                this.Height = 23.0;
2740
            }
2741

    
2742
            minWidth = content.MinWidth < 10.0 ? 10.0 : content.MinWidth;
2743
            minHeight = content.MinHeight < 10.0 ? 10.0 : content.MinHeight;
2744
            maxWidth = content.MaxWidth;
2745
            maxHeight = content.MaxHeight;
2746

    
2747
            double top = (double)content.GetValue(Canvas.TopProperty);
2748
            if (double.IsNaN(top))
2749
                top = 0.0;
2750
            double left = (double)content.GetValue(Canvas.LeftProperty);
2751
            if (double.IsNaN(left))
2752
                left = 0.0;
2753
            SetValue(Canvas.TopProperty, top);
2754
            SetValue(Canvas.LeftProperty, left);
2755

    
2756
            //Set the actual content. Note that "Content" property is a new property. See below
2757
            this.Content = content;
2758
        }
2759
        private void Thumb_DragDelta(object sender, DragDeltaEventArgs e)
2760
        {
2761
            string name = ((Thumb)sender).Name;
2762
            if (name.Contains("Top"))
2763
            {
2764
                double newHeight = this.Height - e.VerticalChange;
2765
                if (newHeight >= minHeight && newHeight <= maxHeight)
2766
                {
2767
                    this.Height = newHeight;
2768
                    SetValue(Canvas.TopProperty,
2769
                (double)GetValue(Canvas.TopProperty) + e.VerticalChange);
2770
                }
2771
            }
2772
            if (name.Contains("Right"))
2773
            {
2774
                double newWidth = this.Width + e.HorizontalChange;
2775
                if (newWidth >= minWidth && newWidth <= maxWidth)
2776
                    this.Width = newWidth;
2777
            }
2778
            if (name.Contains("Bottom"))
2779
            {
2780
                double newHeight = this.Height + e.VerticalChange;
2781
                if (newHeight >= minHeight && newHeight <= maxHeight)
2782
                    this.Height = newHeight;
2783
            }
2784
            if (name.Contains("Left"))
2785
            {
2786
                double newWidth = this.Width - e.HorizontalChange;
2787
                if (newWidth >= minWidth && newWidth <= maxWidth)
2788
                {
2789
                    this.Width = newWidth;
2790
                    SetValue(Canvas.LeftProperty,
2791
                (double)GetValue(Canvas.LeftProperty) + e.HorizontalChange);
2792
                }
2793
            }
2794
        }
2795

    
2796
        private void drawControlBorder(object sender)
2797
        {
2798
            System.Windows.Controls.Control control = (System.Windows.Controls.Control)sender;
2799
        }
2800

    
2801
        private void ResizeThumb_DragDelta(object sender, MouseButtonEventArgs e)
2802
        {
2803
            System.Windows.Controls.Control designerItem = (System.Windows.Controls.Control)sender;
2804
            if (designerItem != null)
2805
            {
2806
                double deltaVertical, deltaHorizontal;
2807

    
2808
                switch (VerticalAlignment)
2809
                {
2810
                    case VerticalAlignment.Bottom:
2811
                        deltaVertical = designerItem.ActualHeight - designerItem.MinHeight;
2812
                        designerItem.Height -= deltaVertical;
2813
                        break;
2814
                    case VerticalAlignment.Top:
2815
                        deltaVertical = designerItem.ActualHeight - designerItem.MinHeight;
2816
                        Canvas.SetTop(designerItem, Canvas.GetTop(designerItem) + deltaVertical);
2817
                        designerItem.Height -= deltaVertical;
2818
                        break;
2819
                    default:
2820
                        break;
2821
                }
2822

    
2823
                switch (HorizontalAlignment)
2824
                {
2825
                    case HorizontalAlignment.Left:
2826
                        deltaHorizontal = designerItem.ActualWidth - designerItem.MinWidth;
2827
                        Canvas.SetLeft(designerItem, Canvas.GetLeft(designerItem) + deltaHorizontal);
2828
                        designerItem.Width -= deltaHorizontal;
2829
                        break;
2830
                    case HorizontalAlignment.Right:
2831
                        deltaHorizontal = designerItem.ActualWidth - designerItem.MinWidth;
2832
                        designerItem.Width -= deltaHorizontal;
2833
                        break;
2834
                    default:
2835
                        break;
2836
                }
2837
            }
2838
            e.Handled = true;
2839
        }
2840

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

    
2843
        void ExportMethod()
2844
        {
2845
            //FileDialogFilter filterImage = new FileDialogFilter("Image Files", "*.jpg", "*.png");
2846
            SaveDig.Filter = "PDF file format|*.pdf";
2847
            SaveDig.Title = "Save an DWG File";
2848
            SaveDig.ShowDialog();
2849
        }
2850

    
2851
        private void cbAutoSave_Checked(object sender, RoutedEventArgs e)
2852
        {            
2853
            if (cbAutoSave.IsChecked == true)
2854
            {
2855
                SaveTime(true, (int)cbSaveInterval.Value);
2856
            }
2857
            else
2858
            {
2859
                SaveTime(false, (int)cbSaveInterval.Value);
2860
            }
2861
        }
2862
        private void cbSaveInterval_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
2863
        {
2864
            if(string.IsNullOrEmpty(cbSaveInterval.Value.ToString()))
2865
            {
2866
                cbSaveInterval.Value = cbSaveInterval.Minimum;
2867
            }
2868
            if (cbAutoSave.IsChecked == true)
2869
            {
2870
                SaveTime(true, (int)cbSaveInterval.Value);
2871
            }
2872

    
2873
            KCOM.Properties.Settings.Default.SaveInterval = (double)cbSaveInterval.Value;
2874
            Properties.Settings.Default.Save();
2875
        }
2876
        //강인구 자동 저장 추가
2877
        private void AutoSave(object sender, RoutedEventArgs e)
2878
        {
2879
            RadToggleButton instanceToggle = sender as RadToggleButton;
2880

    
2881
            if(instanceToggle.IsChecked == true)
2882
            {
2883
                SaveTime(true);
2884
            }
2885
            else
2886
            {
2887
                SaveTime(false);
2888
            }
2889
        }
2890

    
2891
        public void Copy_Start()
2892
        {
2893
            if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
2894
            {
2895
                string MarkupData = "";
2896

    
2897
                foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
2898
                {
2899
                    if (item.GetType().Name == "AdornerFinal")
2900
                    {
2901
                        foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
2902

    
2903
                        {
2904
                            if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
2905
                            {
2906
                                MarkupToPDF.Controls.Parsing.MarkupParser.MarkupReturn res = MarkupParser.MarkupToString(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo, App.ViewInfo.UserID);
2907
                                MarkupData += "|OR|" + res.ConvertData;
2908
                            }
2909
                        }
2910
                        Clipboard.SetDataObject(MarkupData);
2911
                    }
2912
                }
2913
            }
2914
        }
2915

    
2916
        public void Cut_Start()
2917
        {
2918
            if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
2919
            {
2920
                foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
2921
                {
2922
                    string MarkupData = "";
2923

    
2924
                    if (item.GetType().Name == "AdornerFinal")
2925
                    {
2926
                        foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
2927
                        {
2928
                            if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
2929
                            {
2930
                                MarkupToPDF.Controls.Parsing.MarkupParser.MarkupReturn res = MarkupParser.MarkupToString(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo, App.ViewInfo.UserID);
2931
                                MarkupData += "|OR|" + res.ConvertData;
2932
                            }
2933
                        }
2934
                        //클립보드에 넣음
2935
                        Clipboard.SetDataObject(MarkupData);
2936
                    }
2937
                }
2938
                this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Clear();
2939
            }
2940
        }
2941

    
2942
        public async void Paste_Start()
2943
        {
2944
            //마크업 붙여넣기
2945
            if (Clipboard.GetText().Contains("|OR||DZ|"))
2946
            {
2947
                List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>();
2948

    
2949
                string[] delimiterChars = { "|OR|" };
2950
                string[] data = Clipboard.GetText().Split(delimiterChars, StringSplitOptions.RemoveEmptyEntries);
2951

    
2952
                SelectionSet.Instance.UnSelect(this.ParentOfType<MainWindow>().dzMainMenu);
2953

    
2954
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
2955

    
2956
                //강인구 Undo/Redo 보류
2957
                MarkupToPDF.Common.Undo_data UndoData = new Undo_data()
2958
                {
2959
                    IsUndo = false,
2960
                    Event = Event_Type.Create,
2961
                    EventTime = DateTime.Now,
2962
                    Markup_List = new List<Multi_Undo_data>()
2963
                };
2964

    
2965
                ViewerDataModel.Instance.UndoDataList.Where(data1 => data1.IsUndo == true).ToList().ForEach(i =>
2966
                {
2967
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
2968
                });
2969

    
2970
                foreach (string parse in data)
2971
                {
2972
                    if (parse != "")
2973
                    {
2974
                        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);
2975
                        (item as MarkupToPDF.Common.CommentUserInfo).CommentID = Commons.shortGuid();
2976

    
2977
                        ViewerDataModel.Instance.MarkupControls.Remove(item as MarkupToPDF.Common.CommentUserInfo);
2978
                        ViewerDataModel.Instance.MarkupControls_USER.Remove(item as MarkupToPDF.Common.CommentUserInfo);
2979

    
2980
                        adornerSet.Add(item as MarkupToPDF.Common.CommentUserInfo);
2981

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

    
2984
                        UndoData.Markup_List.Add(multi_Undo_Data);
2985
                        ViewerDataModel.Instance.UndoDataList.Add(UndoData);                        
2986
                    }
2987
                }
2988
                Controls.AdornerFinal final = new Controls.AdornerFinal(adornerSet);
2989

    
2990
                if(this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.X < 0)
2991
                {
2992
                    Canvas.SetLeft(final, 0);
2993
                    Canvas.SetTop(final, 0);
2994
                }
2995
                else
2996
                {
2997
                    double realPointX = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.X - final.BorderSize.X - (final.BorderSize.Width / 2);
2998
                    double realPointY = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.Y - final.BorderSize.Y - (final.BorderSize.Height / 2);
2999
                    final.TranslateItems(realPointX, realPointY);
3000

    
3001
                    if (final.Members.Where(type => type.Drawingtype == MarkupToPDF.Controls.Common.ControlType.TextControl).FirstOrDefault() != null)
3002
                    {
3003
                        final.TranslateItems(0.001, 0.001); //dummy
3004
                    }
3005
                }
3006

    
3007
                this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Add(final);
3008
            }
3009
            //외부 이미지 붙여넣기
3010
            else if (Clipboard.GetImage() != null)
3011
            {
3012
                try
3013
                {
3014
                    Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
3015

    
3016
                    //강인구 Undo/Redo 보류
3017
                    MarkupToPDF.Common.Undo_data UndoData = new Undo_data()
3018
                    {
3019
                        IsUndo = false,
3020
                        Event = Event_Type.Create,
3021
                        EventTime = DateTime.Now,
3022
                        Markup_List = new List<Multi_Undo_data>()
3023
                    };
3024

    
3025

    
3026
                    string temppath = System.IO.Path.GetTempPath();
3027
                    //string filename = KCOM.Events.Save.shortCommentKey();
3028
                    string filename = Commons.shortFileKey();
3029

    
3030
                    System.Drawing.Image clipboardImage = System.Windows.Forms.Clipboard.GetImage();
3031
                    clipboardImage.Save(temppath + "\\" + filename);
3032

    
3033
                    System.IO.FileInfo fileInfo = new System.IO.FileInfo(temppath + "\\" + filename);
3034
                    String strFile = System.IO.Path.GetFileName(fileInfo.FullName);
3035
                    long numByte = fileInfo.Length;
3036
                    double dLen = Convert.ToDouble(fileInfo.Length / 1000000);
3037
                    kr.co.devdoftech.cloud.FileUpload fileUploader = App.FileUploader;
3038

    
3039
                    if (dLen < 4)
3040
                    {
3041
                        System.IO.FileStream fStream = new System.IO.FileStream(fileInfo.FullName,
3042
                        System.IO.FileMode.Open, System.IO.FileAccess.Read);
3043
                        System.IO.BinaryReader br = new System.IO.BinaryReader(fStream);
3044
                        byte[] data = br.ReadBytes((int)numByte);
3045

    
3046
                        filename = fileUploader.Run(App.ViewInfo.ProjectNO, this.ParentOfType<MainWindow>().dzMainMenu._DocItem.DOCUMENT_NO, App.ViewInfo.UserID, strFile + ".png", data);
3047
                        Check_Uri.UriCheck(filename);
3048
                        br.Close();
3049
                        fStream.Close();
3050
                        fStream.Dispose();
3051
                    }
3052
                    else
3053
                    {
3054
                        this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert("Available Memory less than 4 mega byte", "Alert");
3055
                        return;
3056
                    }
3057

    
3058
                    fileInfo.Delete();
3059

    
3060
                    System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(clipboardImage);
3061
                    IntPtr hBitmap = bmp.GetHbitmap();
3062
                    System.Windows.Media.ImageSource WpfBitmap = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(hBitmap, IntPtr.Zero, Int32Rect.Empty, System.Windows.Media.Imaging.BitmapSizeOptions.FromEmptyOptions());
3063
                    Image img = new Image();
3064
                    if (filename.Contains(".svg"))
3065
                    {
3066
                        byte[] imageData = null;
3067
                        DrawingImage image = null;
3068
                        using (System.Net.WebClient web = new System.Net.WebClient())
3069
                        {
3070
                            imageData = web.DownloadData(new Uri(filename));
3071
                            System.IO.Stream stream = new System.IO.MemoryStream(imageData);
3072
                            image = SvgReader.Load(stream);
3073
                        }
3074
                        img.Source = image;
3075
                    }
3076
                    else
3077
                    {
3078
                        img.Source = new BitmapImage(new Uri(filename));
3079
                    }
3080

    
3081
                    var currentControl = new MarkupToPDF.Controls.Etc.ImgControl
3082
                    {
3083
                        PointSet = new List<Point>(),
3084
                        FilePath = filename,
3085
                        ImageData = img.Source,
3086
                        StartPoint = new Point(100, 100),
3087
                        EndPoint = new Point(200, 200),
3088
                        TopRightPoint = new Point(100, 200),
3089
                        LeftBottomPoint = new Point(200, 100)
3090
                    };
3091

    
3092
                    currentControl.TopRightPoint = new Point(currentControl.StartPoint.X + clipboardImage.Width, currentControl.StartPoint.Y);
3093
                    currentControl.LeftBottomPoint = new Point(currentControl.StartPoint.X, currentControl.StartPoint.Y + clipboardImage.Height);
3094
                    currentControl.EndPoint = new Point(currentControl.StartPoint.X + clipboardImage.Width, currentControl.StartPoint.Y + clipboardImage.Height);
3095

    
3096
                    currentControl.PointSet = new List<Point>
3097
                                        {
3098
                                            currentControl.StartPoint,
3099
                                            currentControl.LeftBottomPoint,
3100
                                            currentControl.EndPoint,
3101
                                            currentControl.TopRightPoint,
3102
                                        };
3103

    
3104
                    multi_Undo_Data = this.ParentOfType<MainWindow>().dzMainMenu.Control_Style(currentControl as MarkupToPDF.Common.CommentUserInfo);
3105
                    UndoData.Markup_List.Add(multi_Undo_Data);
3106
                    ViewerDataModel.Instance.UndoDataList.Add(UndoData);
3107

    
3108
                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl as MarkupToPDF.Common.CommentUserInfo);
3109
                    currentControl.CommentID = Commons.shortGuid();
3110

    
3111
                    currentControl.ApplyTemplate();
3112
                    currentControl.SetImage();
3113

    
3114
                    ViewerDataModel.Instance.MarkupControls_USER.Remove(currentControl as MarkupToPDF.Common.CommentUserInfo);
3115
                    Controls.AdornerFinal final = new Controls.AdornerFinal(currentControl as MarkupToPDF.Common.CommentUserInfo);
3116
                    this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Add(final);
3117

    
3118
                    double realPointX = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.X - final.BorderSize.X - (final.BorderSize.Width / 2);
3119
                    double realPointY = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.Y - final.BorderSize.Y - (final.BorderSize.Height / 2);
3120
                    final.TranslateItems(realPointX, realPointY);
3121
                }
3122
                catch(Exception ex)
3123
                {
3124
                    this.ParentOfType<MainWindow>().DialogMessage_Alert("" + ex, "Alert");
3125
                }
3126
            }
3127
        }
3128
    }
3129
}
클립보드 이미지 추가 (최대 크기: 500 MB)