프로젝트

일반

사용자정보

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

markus / KCOM / Events / Implementation / TopMenuEvent.cs @ 77cdac33

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

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

    
166
        }
167

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

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

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

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

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

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

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

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

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

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

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

    
321
                _SaveEvent(sender, e);
322

    
323
                mianMenu.busyIndicator.IsBusy = false;
324
               
325
            //});
326

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

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

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

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

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

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

    
375
                            result = true;
376
                        }
377
                    }
378
                }
379

    
380
                mainMenu.SetCommentPages(null);
381

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

    
405
            return result;
406
        }
407
        public async Task<bool>  SaveEventAsync()
408
        {
409
            bool result = false;
410

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

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

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

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

    
438
                mainMenu.SetCommentPages(null);
439

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

    
464
            return result;
465
        }
466

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

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

    
493
                        SaveCommand.Instance.Execute(SelectedMarkupInfos);
494
                    }
495

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

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

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

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

    
537
                        result = await SaveCommand.Instance.Execute(SelectedMarkupInfos);
538
                    }
539
                    else
540
                    {
541
                        result = true;
542
                    }
543

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

    
560
            return result;
561
        }
562

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

    
577
                }
578
                else
579
                {
580
                    this.SaveEventCallback(null, null);
581
                }
582
            }
583

    
584
            bool isprint = false;
585
            if (Type == "Print")
586
            {
587
                isprint = true;
588
            }
589

    
590
            RadWindow PrintWindow = new RadWindow();
591
            PrintWindow.Width = 850;
592
            PrintWindow.Height = 600;
593
            PrintWindow.Header = Type;
594

    
595
            List<IKCOM.MarkupInfoItem> markupinfo = new List<IKCOM.MarkupInfoItem>();
596

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

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

    
608
            /// Tile Source URL을 구한다
609

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

    
621
            var docitem = this.ParentOfType<MainWindow>().dzMainMenu._DocItem;
622

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

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

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

    
653
        private List<AdornerMember> GetAdornerItem()
654
        {
655
            List<AdornerMember> AdonerList = new List<AdornerMember>();
656

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

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

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

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

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

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

    
822
                    multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
823
                    UndoData.Markup_List.Add(multi_Undo_Data);
824
                    multi_Undo_Data = new Multi_Undo_data();
825
                }
826

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

    
833
                
834
            }
835
            KCOM.Properties.Settings.Default.LineSize = (double)cbLineSize.Value;
836
            Properties.Settings.Default.Save();
837
        }
838

    
839

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

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

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

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

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

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

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

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

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

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

    
938
            KCOM.Properties.Settings.Default.ArcLength = (double)cbArcLength.Value;
939
            Properties.Settings.Default.Save();
940
        }
941

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

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

    
1041
                                multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
1042
                                UndoData.Markup_List.Add(multi_Undo_Data);
1043
                                multi_Undo_Data = new Multi_Undo_data();
1044
                            }
1045

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

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

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

    
1116
                                        }
1117
                                        break;
1118
                                    case ("ArrowTextControl"):
1119
                                        {
1120
                                            if ((InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextWeight == FontWeights.Bold)
1121
                                            {
1122
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextWeight = FontWeights.Normal;
1123
                                            }
1124
                                            else
1125
                                            {
1126
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextWeight = FontWeights.Bold;
1127
                                            }
1128
                                        }
1129
                                        break;
1130
                                }
1131
                            }
1132
                        }
1133
                    }
1134
                }
1135
            }
1136
        }
1137

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

    
1164
                                        }
1165
                                        break;
1166
                                    case ("ArrowTextControl"):
1167
                                        {
1168
                                            if((InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextStyle == FontStyles.Italic)
1169
                                            {
1170
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextStyle = FontStyles.Normal;
1171
                                            }
1172
                                            else
1173
                                            {
1174
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextStyle = FontStyles.Italic;
1175
                                            }
1176
                                        }
1177
                                        break;
1178
                                }
1179
                            }
1180
                        }
1181
                    }
1182
                }
1183
            }
1184
        }
1185

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

    
1233
        private void comboFontSize_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
1234
        {
1235
            if (string.IsNullOrEmpty(comboFontSize.Value.ToString()))
1236
            {
1237
                comboFontSize.Value = comboFontSize.Minimum;
1238
            }
1239
            if (this.ParentOfType<MainWindow>() != null)
1240
            {
1241
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
1242
                {
1243
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
1244
                    {
1245
                        if (item.GetType().Name == "AdornerFinal")
1246
                        {
1247
                            foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
1248
                            {
1249
                                switch (InnerItem.DrawingData.GetType().Name)
1250
                                {
1251
                                    case ("TextControl"):
1252
                                        {
1253
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextSize = int.Parse(comboFontSize.Value.ToString());
1254
                                        }
1255
                                        break;
1256
                                    case ("ArrowTextControl"):
1257
                                        {
1258
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextSize = int.Parse(comboFontSize.Value.ToString());
1259
                                        }
1260
                                        break;
1261
                                }
1262
                            }
1263

    
1264
                            ChangeComment(item as Controls.AdornerFinal);
1265
                        }
1266
                    }
1267
                }
1268
            }
1269

    
1270
            KCOM.Properties.Settings.Default.TextSize = (double)comboFontSize.Value;
1271
            Properties.Settings.Default.Save();
1272
        }
1273

    
1274
        //강인구 추가
1275
        private void RadRibbonComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
1276
        {
1277
            if (comboFontFamily.SelectedItem != null)
1278
            {
1279
                var font = comboFontFamily.SelectedItem as Markus.Fonts.MarkusFont;
1280

    
1281
                if (this.ParentOfType<MainWindow>()?.dzMainMenu.SelectLayer.Children.Count > 0)
1282
                {
1283
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
1284
                    {
1285
                        if (item.GetType().Name == "AdornerFinal")
1286
                        {
1287
                            var adnoerFinal = (item as Controls.AdornerFinal);
1288

    
1289
                            var adornerMembers = adnoerFinal.Members.Cast<Controls.AdornerMember>();
1290

    
1291
                            foreach (var InnerItem in adornerMembers)
1292
                            {
1293
                                switch (InnerItem.DrawingData.GetType().Name)
1294
                                {
1295
                                    case ("TextControl"):
1296
                                        (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).SetFontFamily(font.FontFamily);
1297
                                        break;
1298
                                    case ("ArrowTextControl"):
1299
                                        (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).SetFontFamily(font.FontFamily);
1300
                                        break;
1301
                                }
1302
                            }
1303

    
1304
                            ChangeComment(adnoerFinal);
1305
                        }
1306
                    }
1307
                }
1308

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

    
1314

    
1315
        /// <summary>
1316
        /// 텍스트 컨트롤 하일라이트 처리
1317
        /// </summary>
1318
        /// <param name="sender"></param>
1319
        /// <param name="e"></param>
1320
        private void HighlightEvent(object sender, RoutedEventArgs e)
1321
        {
1322

    
1323
            ViewerDataModel.Instance.checkHighShape = (sender as CheckBox).IsChecked.Value;
1324
            SetHighlightEvent();
1325
            //if ((sender as CheckBox).IsChecked.Value)
1326
            //{
1327
            //    TaskMessage("HighLight가 설정되었습니다", TaskMessageType.Normal);
1328
            //}
1329
            //else
1330
            //{
1331
            //    TaskMessage("HighLight가 해제되었습니다", TaskMessageType.Caption);
1332
            //}
1333
            //if (ViewerDataModel.Instance.SelectedEditor as MarkupToPDF.Controls.Text.TextControl != null)
1334
            //{
1335
            //    MarkupToPDF.Controls.Text.TextControl instance = (ViewerDataModel.Instance.SelectedEditor as MarkupToPDF.Controls.Text.TextControl);
1336
            //    instance.IsHighLight = ViewerDataModel.Instance.checkHighShape;
1337
            //    instance.SetText();
1338
            //}
1339
        }
1340

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

    
1414
                    ((TextBox)sender).Text = previousText;
1415
                }
1416
            }
1417
        }
1418

    
1419
        /// <summary>
1420
        /// 입력한 페이지로 이동한다
1421
        /// </summary>
1422
        /// <param name="sender"></param>
1423
        /// <param name="e"></param>
1424
        private void tlcurrentPage_readonly_KeyDown(object sender, KeyEventArgs e)
1425
        {
1426
            if (e.Key == Key.Enter)
1427
            {
1428
                try
1429
                {
1430
                    var instanceMain = this.ParentOfType<MainWindow>();
1431
                    instanceMain.dzMainMenu.pageNavigator.GotoPage(Convert.ToInt32(tlcurrentPage_readonly.Text));
1432
                }
1433
                catch (Exception)
1434
                {
1435
                    RadWindow.Alert(new DialogParameters
1436
                    {
1437
                        Owner = Application.Current.MainWindow,
1438
                        Theme = new VisualStudio2013Theme(),
1439
                        Header = "Info",
1440
                        Content = "Enter the correct page number.",
1441
                    });
1442
                }
1443
            }
1444
        }
1445
        
1446
        private void PanoramaEvent(object sender, RoutedEventArgs e)
1447
        {
1448
            PanoramaShow();
1449
        }
1450

    
1451
        public void PanoramaShow()
1452
        {
1453
            Panorama check = new Panorama();
1454
            double screenWidth = System.Windows.SystemParameters.PrimaryScreenWidth;
1455
            double screenHeight = System.Windows.SystemParameters.PrimaryScreenHeight;
1456
            //double windowWidth = this.Width;
1457
            //double windowHeight = this.Height;
1458

    
1459
            var PanoramaPop = new RadWindow
1460
            {
1461
                //MinWidth = 600,
1462
                //MinHeight = 400,
1463
                //Header = "My Check List",
1464
                Header = "Document No : " + this.ParentOfType<MainWindow>().dzMainMenu._DocItem.DOCUMENT_NO + " / Revision :" + this.ParentOfType<MainWindow>().dzMainMenu._DocItem.REVISION,
1465
                Content = check,
1466
                Owner = this,
1467
                ResizeMode = System.Windows.ResizeMode.CanResizeWithGrip,
1468
                //ResizeMode = System.Windows.ResizeMode.NoResize,
1469
                WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen,
1470
                IsTopmost = false,
1471
                //Left = (screenWidth / 2) - (windowWidth / 2),
1472
                //Top = (screenHeight / 2) - (windowHeight / 2),
1473
                //Left = (screenWidth / 2),
1474
                //Top = (screenHeight / 2),
1475
                Width = screenWidth * 0.4,
1476
                Height = screenHeight * 0.4,
1477
            };
1478
            StyleManager.SetTheme(PanoramaPop, new VisualStudio2013Theme());
1479
            //CheckPop.ShowDialog();
1480
            PanoramaPop.Owner = Application.Current.MainWindow;
1481
            PanoramaPop.Show();
1482
        }
1483

    
1484
        private void CheckEvent(object sender, RoutedEventArgs e)
1485
        {
1486
            //창이 떠있을 경우 재 실행 방지
1487
            if (isClosed)
1488
            {
1489
                //토글 및 마우스 상태 초기화
1490
                var toggleList = this.Parent.ChildrenOfType<RadToggleButton>();
1491
                foreach(var togle in toggleList)
1492
                {
1493
                    togle.IsChecked = false;
1494
                }
1495
                this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
1496

    
1497
                isClosed = false;
1498

    
1499
                
1500
                CheckList check = new CheckList(this.ParentOfType<MainWindow>());
1501

    
1502
                CheckPop = new RadWindow
1503
                {
1504
                    MinWidth = 1200,
1505
                    MinHeight = 500,
1506
                    //Header = "My Check List",
1507
                    Header = "Document No : " + this.ParentOfType<MainWindow>().dzMainMenu._DocItem.DOCUMENT_NO + " / Revision :" + this.ParentOfType<MainWindow>().dzMainMenu._DocItem.REVISION,
1508
                    Content = check,
1509
                    //Owner = this,
1510
                    //ResizeMode = System.Windows.ResizeMode.CanResizeWithGrip,
1511
                    ResizeMode = System.Windows.ResizeMode.NoResize,
1512
                    WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen,
1513
                    IsTopmost = true,
1514
                };
1515
                StyleManager.SetTheme(CheckPop, new Office2013Theme());
1516
                CheckPop.Closed += CheckPop_Closed;
1517
                
1518
                //CheckPop.ShowDialog();
1519
                CheckPop.Show();
1520
            }
1521
        }
1522

    
1523
        private void SignManagerEvent(object sender,RoutedEventArgs e)
1524
        {
1525
            SignManager signManager = new SignManager();
1526

    
1527
            RadWindow signManagerPop = new RadWindow
1528
            {
1529
                MinWidth = 1200,
1530
                MinHeight = 500,
1531
                //Header = "My Check List",
1532
                Header = "",
1533
                Content = signManager,
1534
                Owner = this,
1535
                //ResizeMode = System.Windows.ResizeMode.CanResizeWithGrip,
1536
                ResizeMode = System.Windows.ResizeMode.CanResize,
1537
                WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen,
1538
            };
1539
            StyleManager.SetTheme(signManagerPop, new Office2013Theme());
1540

    
1541
            //CheckPop.ShowDialog();
1542
            signManagerPop.ShowDialog();
1543
        }
1544

    
1545
        private void OptionPop_Closed(object sender, WindowClosedEventArgs e)
1546
        {
1547
            isClosed = true;
1548
            //this.ParentOfType<MainWindow>().dzMainMenu.PN_Navi.IsEnabled = true;
1549
            this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
1550
            ViewerDataModel.Instance.Capture_Opacity = 0;
1551
        }
1552

    
1553
        private void CheckPop_Closed(object sender, WindowClosedEventArgs e)
1554
        {
1555
            isClosed = true;
1556
            //this.ParentOfType<MainWindow>().dzMainMenu.PN_Navi.IsEnabled = true;
1557
            this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
1558
            ViewerDataModel.Instance.Capture_Opacity = 0;
1559
        }
1560

    
1561
        /// <summary>
1562
        /// 사용자가 선택한 페이지로 이동(썸네일 동기화 시킴)
1563
        /// </summary>
1564
        /// <param name="sender"></param>
1565
        /// <param name="e"></param>
1566
        private void PageGoEvent(object sender, RoutedEventArgs e)
1567
        {
1568
            RadButton button = sender as RadButton;
1569
            var instanceMain = this.ParentOfType<MainWindow>();
1570
            
1571
            //강인구 추가 tlcurrentPage을 이상하게 입력할수 있기때문에 Try Catch
1572
            try
1573
            {
1574
                switch (button.CommandParameter.ToString())
1575
                {
1576
                    case "Down":
1577
                        {
1578
                            instanceMain.dzMainMenu.pageNavigator.GotoPage(Convert.ToInt32(tlcurrentPage.Text) + 1);
1579
                        }
1580
                        break;
1581
                    case "Up":
1582
                        {
1583
                            instanceMain.dzMainMenu.pageNavigator.GotoPage(Convert.ToInt32(tlcurrentPage.Text) - 1);
1584
                        }
1585
                        break;
1586
                }
1587
            }
1588
            catch (Exception)
1589
            {
1590
                RadWindow.Alert(new DialogParameters
1591
                {
1592
                    Owner = Application.Current.MainWindow,
1593
                    Theme = new VisualStudio2013Theme(),
1594
                    Header = "Info",
1595
                    Content = "Enter the correct page number.",
1596
                });
1597
            }
1598
        }
1599

    
1600
        private void viewEvent(object sender, RoutedEventArgs e)
1601
        {
1602
            RadRibbonToggleButton viewButton = sender as RadRibbonToggleButton;
1603
            var instanceMain = this.ParentOfType<MainWindow>();
1604

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

    
1607
            //if ((sender as RadRibbonToggleButton) != null)
1608
            //{
1609
            //    Common.ViewerDataModel.Instance.ControlTag = (sender as RadRibbonToggleButton).Tag.ToString();
1610
            //    instanceToggle = (sender as RadRibbonToggleButton);
1611
            //}
1612

    
1613
            //instanceToggle.IsChecked = false;
1614

    
1615
            switch (viewButton.CommandParameter.ToString())
1616
            {
1617
                case "zoomout":
1618
                    {
1619
                        //장원
1620
                        //instanceMain.dzMainMenu.zoomAndPanControl.ZoomTo(new Rect(0, 0, instanceMain.dzMainMenu.zoomAndPanCanvas.ActualWidth, instanceMain.dzMainMenu.zoomAndPanCanvas.ActualHeight));
1621
                        instanceMain.dzMainMenu.zoomAndPanControl.ZoomPointToViewportCenter(ViewerDataModel.Instance.ContentScale -= 0.1, point);
1622
                        viewButton.IsChecked = false;
1623
                        //Common.ViewerDataModel.Instance.zom
1624
                    }
1625
                    break;
1626
                case "zoomin":
1627
                    {
1628
                        instanceMain.dzMainMenu.zoomAndPanControl.ZoomPointToViewportCenter(ViewerDataModel.Instance.ContentScale += 0.1, point);
1629
                        viewButton.IsChecked = false;
1630
                    }
1631
                    break;
1632
                case "fullscreen":
1633
                    {
1634
                        instanceMain.WindowState = WindowState.Maximized;
1635
                        //Sizemode 대기(강인구)
1636
                        //instanceMain.dzMainMenu.imageViewer.SizeMode = Leadtools.Windows.Controls.SizeMode.Fit;
1637
                        instanceMain.dzMainMenu.zoomAndPanControl.ScaleToFit();
1638
                        viewButton.IsChecked = false;
1639
                    }
1640
                    break;
1641
                case "fitWidth":
1642
                    {
1643
                        instanceMain.dzMainMenu.zoomAndPanControl.ScaleToFit();
1644
                        viewButton.IsChecked = false;
1645
                    }
1646
                    break;
1647
                case "fitHeight":
1648
                    {
1649
                        instanceMain.dzMainMenu.zoomAndPanControl.ScaleToFit();
1650
                        viewButton.IsChecked = false;
1651
                    }
1652
                    break;
1653
                case "boundzoom":
1654
                    {
1655

    
1656
                    }
1657
                    break;
1658
                case "Rotate_M":
1659
                    {
1660
                        drawingPannelRotate(false);
1661
                        viewButton.IsChecked = false;
1662
                    }
1663
                    break;
1664
                case "Rotate_P":
1665
                    {
1666
                        drawingPannelRotate(true);
1667
                        viewButton.IsChecked = false;
1668
                    }
1669
                    break;
1670
                case "Rotate_half":
1671
                    {
1672
                        drawingPannelRotate(true);
1673
                        drawingPannelRotate(true);
1674
                        viewButton.IsChecked = false;
1675
                    }
1676
                    break;
1677
            }
1678
        }
1679

    
1680
        private void Control_Event(object sender, RoutedEventArgs e)
1681
        {
1682

    
1683
        }
1684

    
1685
        #region 대기
1686

    
1687
        public void drawingPannelRotate(bool Flag)
1688
        {
1689
            var instanceMain = this.ParentOfType<MainWindow>();
1690

    
1691
            //if (rotateOffSet > 3)
1692
            //    rotateOffSet = 0;
1693

    
1694
            //if (rotateOffSet < 0)
1695
            //    rotateOffSet = 3;
1696

    
1697
            if(Flag)
1698
            {
1699
                if (instanceMain.dzMainMenu.rotate.Angle == 270)
1700
                {
1701
                    instanceMain.dzMainMenu.rotate.Angle = 0;
1702
                }
1703
                else
1704
                {
1705
                    instanceMain.dzMainMenu.rotate.Angle += 90;
1706
                }
1707
            }
1708
            else
1709
            {
1710
                if(instanceMain.dzMainMenu.rotate.Angle == 0)
1711
                {
1712
                    instanceMain.dzMainMenu.rotate.Angle = 270;
1713
                }
1714
                else
1715
                {
1716
                    instanceMain.dzMainMenu.rotate.Angle -= 90;
1717
                }
1718
            }
1719
            //double angle = (double)rotateValue.GetValue(rotateOffSet);
1720
            //instanceMain.dzMainMenu.rotate.Angle = angle;
1721
            var rotationNum = Math.Abs((instanceMain.dzMainMenu.rotate.Angle / 90));
1722

    
1723
            if (instanceMain.dzMainMenu.zoomAndPanCanvas.Width == ViewerDataModel.Instance.ContentWidth)
1724
            {
1725
                double emptySize = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
1726
                instanceMain.dzMainMenu.zoomAndPanCanvas.Width = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
1727
                instanceMain.dzMainMenu.zoomAndPanCanvas.Height = emptySize;
1728
            }
1729
            if (instanceMain.dzMainMenu.rotate.Angle == 0)
1730
            {
1731
                instanceMain.dzMainMenu.translate.X = 0;
1732
                instanceMain.dzMainMenu.translate.Y = 0;
1733
            }
1734
            else if (instanceMain.dzMainMenu.rotate.Angle == 90)
1735
            {
1736
                instanceMain.dzMainMenu.translate.X = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
1737
                instanceMain.dzMainMenu.translate.Y = 0;
1738
            }
1739
            else if (instanceMain.dzMainMenu.rotate.Angle == 180)
1740
            {
1741
                instanceMain.dzMainMenu.translate.X = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
1742
                instanceMain.dzMainMenu.translate.Y = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
1743
            }
1744
            else
1745
            {
1746
                instanceMain.dzMainMenu.translate.X = 0;
1747
                instanceMain.dzMainMenu.translate.Y = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
1748
            }
1749

    
1750
            //instanceMain.dzMainMenu.zoomAndPanControl.RenderTransformOrigin = new Point(0.5, 0.5);
1751
            instanceMain.dzMainMenu.zoomAndPanControl.RotationAngle = instanceMain.dzMainMenu.rotate.Angle;
1752
            //대기(강인구)
1753
            //instanceMain.dzMainMenu.imageViewer.RotateAngle = instanceMain.dzMainMenu.rotate.Angle;
1754

    
1755

    
1756
            //instanceMain.dzMainMenu.imageViewer.RenderTransformOrigin = new Point(0.5, 0.5);
1757
            //RotateTransform rotateTransform = new RotateTransform(instanceMain.dzMainMenu.rotate.Angle);
1758
            //instanceMain.dzMainMenu.imageViewer.RenderTransform = rotateTransform;
1759

    
1760

    
1761
            ViewerDataModel.Instance.ContentWidth = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
1762
            ViewerDataModel.Instance.ContentHeight = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
1763
            ViewerDataModel.Instance.AngleOffsetX = instanceMain.dzMainMenu.translate.X;
1764
            ViewerDataModel.Instance.AngleOffsetY = instanceMain.dzMainMenu.translate.Y;
1765
            ViewerDataModel.Instance.PageAngle = instanceMain.dzMainMenu.rotate.Angle;
1766
            //ViewerDataModel.Instance.Document_Info.Clear();
1767
            //ViewerDataModel.Instance.Document_Info.Where(i => i.PAGE_NUMBER == instanceMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber).ToList().ForEach(value =>
1768
            //{
1769
            //    value.PAGE_ANGLE = int.Parse(instanceMain.dzMainMenu.rotate.Angle.ToString());
1770
            //});
1771

    
1772

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

    
1776
            foreach (var data in thumbnaillist)
1777
            {
1778
                data.Angle = int.Parse(instanceMain.dzMainMenu.rotate.Angle.ToString());
1779

    
1780
                //instanceMain.dzMainMenu.pageNavigator.ImgListbox.ItemsSource = instanceMain.dzMainMenu.pageNavigator._thumbnailItems;
1781
                var instance = instanceMain.dzMainMenu.CurrentDoc.docInfo.DOCPAGE.Where(p => p.PAGE_NUMBER == instanceMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber).FirstOrDefault();
1782
                instance.PAGE_ANGLE = int.Parse(instanceMain.dzMainMenu.rotate.Angle.ToString());
1783

    
1784
                instanceMain.dzMainMenu.pageNavigator.GotoPage(data.PageNumber);
1785

    
1786
                //rotation page add or update
1787
                var rotationdoc = ViewerDataModel.Instance.RotationDocs.Where(d => d.ID == instance.ID).FirstOrDefault();
1788
                if (rotationdoc != null)
1789
                {
1790
                    rotationdoc.PAGE_ANGLE = instance.PAGE_ANGLE;
1791
                }
1792
                else
1793
                {
1794
                    ViewerDataModel.Instance.RotationDocs.Add(instance);
1795
                }
1796
            }
1797
        }
1798
        #endregion
1799

    
1800
        private void ImageConverter(RadToggleButton instanceToggle)
1801
        {
1802
            try
1803
            {           
1804
                var instanceMain = this.ParentOfType<MainWindow>();
1805

    
1806
                Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
1807
                dlg.Filter = "All files (*.*)|*.*|PNG Images (*.png)|*.png";
1808
                Nullable<bool> result = dlg.ShowDialog();
1809
                if (result == true)
1810
                {
1811
                    instanceMain.dzMainMenu.filename = dlg.FileName;
1812
                    instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ImgControl;
1813

    
1814
                    System.IO.FileInfo fileInfo = new System.IO.FileInfo(instanceMain.dzMainMenu.filename);
1815
                    String strFile = System.IO.Path.GetFileName(instanceMain.dzMainMenu.filename);
1816
                    long numByte = fileInfo.Length;
1817
                    double dLen = Convert.ToDouble(fileInfo.Length / 1000000);
1818
                    kr.co.devdoftech.cloud.FileUpload fileUploader = App.FileUploader;
1819
             
1820
                    if (dLen < 4)
1821
                    {
1822
                        System.IO.FileStream fStream = new System.IO.FileStream(instanceMain.dzMainMenu.filename, System.IO.FileMode.Open, System.IO.FileAccess.Read);
1823
                        System.IO.BinaryReader br = new System.IO.BinaryReader(fStream);
1824
                        byte[] data = br.ReadBytes((int)numByte);
1825
                        br.Close();
1826

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

    
1829
                        Check_Uri.UriCheck(filepath);
1830

    
1831
                        instanceMain.dzMainMenu.filename = filepath;
1832

    
1833
                        fStream.Close();
1834
                        fStream.Dispose();
1835
                    }
1836
                    else
1837
                    {
1838
                        this.ParentOfType<MainWindow>().DialogMessage_Alert("Available Memory less than 4 mega byte", "Alert");
1839
                    }
1840
                }
1841
                else
1842
                {
1843
                    instanceToggle.IsChecked = false;
1844
                    Common.ViewerDataModel.Instance.SelectedControl = "";
1845
                    Common.ViewerDataModel.Instance.ControlTag = null;
1846
                    this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
1847
                    this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
1848
                    this.ParentOfType<MainWindow>().DialogMessage_Alert("No Image selected.", "Alert");
1849
                }
1850
            }
1851
            catch(Exception ex)
1852
            {
1853
                instanceToggle.IsChecked = false;
1854
                Common.ViewerDataModel.Instance.SelectedControl = "";
1855
                Common.ViewerDataModel.Instance.ControlTag = null;
1856
                this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
1857
                this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
1858
                App.FileLogger.Error("Image Converter ",ex);
1859

    
1860
                this.ParentOfType<MainWindow>().DialogMessage_Alert("System Error" , "Alert");
1861
            }
1862
        }
1863

    
1864
        private void Control_Init(RadToggleButton instanceToggle, object sender)
1865
        {
1866

    
1867
        }
1868

    
1869
        private void ControlEvent(object sender, RoutedEventArgs e)
1870
        {
1871
            RadToggleButton instanceToggle = sender as RadToggleButton;
1872
            var instanceMain = this.ParentOfType<MainWindow>();
1873

    
1874
            #region Ctrl + A 눌렀을 때 대처 방법 
1875
            //원인 : Ctrl + A를 누르면 UIElementSet에 등록을 시키지 않는다(이유는 한꺼번에 많은 양의 컨트롤의 동작이 유입되기 때문에
1876
            //       시스템의 성능저하를 불러올 수 있기 때문이다. 그래서 선택 후 다른 컨트롤을 누르면 등록되지 않은 컨트롤이기 때문에 삭제된다
1877
            //       이를 대처하는 방법으로 아래 코드를 사용한다.
1878
            if (Common.ViewerDataModel.Instance.MarkupControls.Count == 0 && Common.ViewerDataModel.Instance.MarkupControls.Count >= 1)
1879
            {
1880
                //var lstItem = instanceMain.DeepLayer._SelectLayer.ChildrenOfType<AdornerFinal>().ToList();
1881
                //foreach (var item in lstItem)
1882
                //{
1883
                //    foreach (var member in item.MemberSet)
1884
                //    {
1885
                //        if (!instanceMain.DeepLayer.UIElementSet.Contains(member.DrawingData))
1886
                //        {
1887
                //            instanceMain.DeepLayer.UIElementSet.Add(member.DrawingData);
1888
                //        }
1889
                //    }
1890
                //}
1891
            }
1892
            #endregion
1893

    
1894
            //if (!instanceMain.IsFreeSelectionMode)
1895
            //{
1896
            //    instanceMain.IsSwingMode = true;
1897
            //}
1898

    
1899
            //#region 다른 컨트롤 버튼 선택 해제
1900
            //System.Reactive.Linq.Observable2.FromPropertyChangedPattern(Common.ViewerDataModel.Instance, temp => temp.SelectedControl).Subscribe(ControlState =>
1901
            //{
1902
            //    if (ControlState == null)
1903
            //    {
1904
            //        instanceToggle.IsChecked = false;
1905
            //        HiddenControlHide();
1906
            //    }
1907
            //});
1908
            //#endregion
1909

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

    
1912
            if (instanceToggle != null)
1913
            {
1914
                Common.ViewerDataModel.Instance.ControlTag = instanceToggle.Tag.ToString();
1915
            }
1916
            else if ((sender as RadRibbonToggleButton) != null)
1917
            {
1918
                Common.ViewerDataModel.Instance.ControlTag = (sender as RadRibbonToggleButton).Tag.ToString();
1919
                instanceToggle = (sender as RadRibbonToggleButton);
1920
            }
1921
            else if ((sender as RadRibbonButton) != null)
1922
            {
1923
                RadRibbonButton instanceButton = sender as RadRibbonButton;
1924
                Common.ViewerDataModel.Instance.ControlTag = instanceButton.Tag.ToString();
1925
            }
1926
            else
1927
            {
1928
                RadButton instanceButton = sender as RadButton;
1929
                Common.ViewerDataModel.Instance.ControlTag = instanceButton.Tag.ToString();
1930
            }
1931

    
1932

    
1933
            //System.Reactive.Linq.Observable2.FromPropertyChangedPattern(Common.ViewerDataModel.Instance, temp => temp.AngleVisibility).Subscribe(isSee =>
1934
            //{
1935
            //    if (instanceToggle.CommandParameter.ToString() == "ChainLine")
1936
            //    {
1937

    
1938
            //    }
1939
            //    else
1940
            //    {
1941
            //        System.Diagnostics.Debug.WriteLine(" instanceMain.dzMainMenu.MainAngle.Visibility   " + isSee);
1942

    
1943
            //        if (instanceMain.dzMainMenu.MainAngle.Visibility != isSee)
1944
            //        {
1945
            //            instanceMain.dzMainMenu.MainAngle.Visibility = isSee;
1946
            //        }
1947
            //    }
1948
            //    //System.Reactive.Linq.Observable2.FromPropertyChangedPattern(Common.ViewerDataModel.Instance, temp => temp.AngleValue).Subscribe(p =>
1949
            //    //{
1950
            //    //    instanceMain.dzMainMenu.MainAngle.AngleValue = p;
1951
            //    //});
1952
            //});
1953

    
1954
            instanceMain.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Drawing;
1955

    
1956
            instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = false;
1957

    
1958
            if (instanceToggle.IsChecked != false)
1959
            {
1960
                string param = instanceToggle.CommandParameter.ToString();
1961
                string MacroIndex = "";
1962

    
1963
                if (param.StartsWith("MACRO"))
1964
                {
1965
                    param = "MACRO";
1966
                    MacroIndex = param.Replace("MACRO;","");
1967

    
1968
                    //Common.ViewerDataModel.Instance.MacroItems = MacroHelper.LoadMacroItems(MacroIndex);
1969
                    //var items = MacroHelper.TopMenuItems();
1970

    
1971
                    Common.ViewerDataModel.Instance.MacroItems = new List<MacroItem>
1972
                    {
1973
                        new MacroItem
1974
                        {
1975
                            Desc = "Cloud Rectangle",
1976
                            ControlType = MarkupToPDF.Controls.Common.ControlType.RectCloud
1977
                        },
1978
                        new MacroItem
1979
                        {
1980
                             Desc = "Arrow TextBox",
1981
                            ControlType = MarkupToPDF.Controls.Common.ControlType.ArrowTextBorderControl
1982
                        }
1983
                    };
1984
                }
1985

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

    
2209
                        //instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = true;
2210

    
2211
                        Common.ViewerDataModel.Instance.SelectedControl = "Ink";
2212
                        Common.ViewerDataModel.Instance.LineSize = (double)cbLineSize.Value;
2213
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.PenControl;
2214
                        break;
2215
                    #endregion
2216
                    #region Select
2217
                    case "Select":
2218
                        if(this.ParentOfType<MainWindow>().dzMainMenu.currentControl != null)
2219
                        {
2220
                            ViewerDataModel.Instance.MarkupControls_USER.Remove(this.ParentOfType<MainWindow>().dzMainMenu.currentControl);
2221
                            this.ParentOfType<MainWindow>().dzMainMenu.currentControl = null;
2222
                        }
2223
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Selecting;
2224
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2225
                        instanceMain.dzMainMenu.isLeftMouseButtonDownOnWindow = false;
2226
                        break;
2227
                    #endregion
2228
                    #region Image
2229
                    case "Image":
2230
                        Common.ViewerDataModel.Instance.SelectedControl = "ImgControl";
2231
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ImgControl;
2232
                        ImageConverter(instanceToggle);
2233
                        break;
2234
                    #endregion
2235
                    #region Sign
2236
                    case "Sign":
2237
                        Common.ViewerDataModel.Instance.SelectedControl = "Sign";
2238
                        Common.ViewerDataModel.Instance.ControlTag = instanceMain.dzMainMenu._ViewInfo.UserID; //사번
2239
                        //강인구 추가
2240
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Sign;
2241
                        //instanceMain.BaseClient.GetUserSignCompleted += (sen, ea) =>
2242
                        //{
2243
                        //    if (ea.Result == null)
2244
                        //    {
2245

    
2246
                        //        this.ParentOfType<MainPage>().DialogMessage_Alert("You Don't Have Sign Data", "Alert");
2247
                        //    }
2248
                        //    else
2249
                        //    {
2250
                        //        byte[] imageBytes = System.Convert.FromBase64String(ea.Result);
2251
                        //        using (MemoryStream ms = new MemoryStream(imageBytes))
2252
                        //        {
2253
                        //            BitmapImage im = new BitmapImage();
2254
                        //            im.SetSource(ms);
2255
                        //            instanceMain.DeepLayer.SignImage = im;
2256
                        //            ms.Close();
2257
                        //        }
2258
                        //    }
2259
                        //};
2260
                        //instanceMain.BaseClient.GetUserSignAsync(instanceMain._ViewInfo.UserID);
2261
                        break;
2262
                    #endregion
2263
                    #region Check
2264
                    case "Check":
2265
                        Common.ViewerDataModel.Instance.SelectedControl = "Check";
2266
                        Common.ViewerDataModel.Instance.ControlTag = instanceMain.dzMainMenu._ViewInfo.UserID; //사번
2267
                        //강인구 추가
2268
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Symbol;
2269
                        break;
2270
                    #endregion
2271
                    #region Batch
2272
                    case "Batch":
2273
                        Common.ViewerDataModel.Instance.SelectedControl = "Batch";
2274
                        Common.ViewerDataModel.Instance.ControlTag = instanceMain.dzMainMenu._ViewInfo.UserID; //사번
2275
                        //강인구 추가
2276
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Mark;
2277
                        instanceMain.dzMainMenu.txtBatch.Visibility = Visibility.Visible;
2278
                        instanceMain.dzMainMenu.txtBatch.Text = "Place Mark";
2279
                        break;
2280
                    #endregion
2281

    
2282
                    #region MACRO -MACRO1
2283
                    case "MACRO":
2284
                        Common.ViewerDataModel.Instance.SelectedControl = "MACRO";
2285
                        Common.ViewerDataModel.Instance.ControlTag = instanceMain.dzMainMenu._ViewInfo.UserID; //사번
2286

    
2287
                        MacroHelper.MacroAction();
2288

    
2289
                        break;
2290
                    #endregion
2291

    
2292
                    #region Copy
2293
                    case "Copy":
2294
                        Copy_Start();
2295
                        instanceToggle.IsChecked = false;
2296
                        ViewerDataModel.Instance.SelectedControl = "";
2297
                        ViewerDataModel.Instance.ControlTag = null;
2298
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2299
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2300
                        break;
2301
                    #endregion
2302
                    #region Cut
2303
                    case "Cut":
2304
                        //Cut_Start();
2305
                        CutCommand.Instance.Execute();
2306
                        instanceToggle.IsChecked = false;
2307
                        ViewerDataModel.Instance.SelectedControl = "";
2308
                        ViewerDataModel.Instance.ControlTag = null;
2309
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2310
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2311
                        break;
2312
                    #endregion
2313
                    #region Paste
2314
                    case "Paste":
2315
                        Paste_Start();
2316
                        instanceToggle.IsChecked = false;
2317
                        ViewerDataModel.Instance.SelectedControl = "";
2318
                        ViewerDataModel.Instance.ControlTag = null;
2319
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2320
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;                        
2321
                        break;
2322
                    #endregion
2323
                    #region Delete
2324
                    case "Delete":
2325
                        DeleteCommand.Instance.Execute(SelectionSet.Instance.SelectedItems);
2326
                        this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Clear();
2327

    
2328
                        instanceToggle.IsChecked = false;
2329
                        ViewerDataModel.Instance.SelectedControl = "";
2330
                        ViewerDataModel.Instance.ControlTag = null;
2331
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2332
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2333
                        break;
2334
                    #endregion
2335
                    #region Undo
2336
                    case "Undo":
2337
                        UndoCommand.Instance.Execute();
2338
                        instanceToggle.IsChecked = false;
2339
                        ViewerDataModel.Instance.SelectedControl = "";
2340
                        ViewerDataModel.Instance.ControlTag = null;
2341
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2342
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2343
                        break;
2344
                    #endregion
2345
                    #region Redo
2346
                    case "Redo":
2347
                        RedoCommand.Instance.Execute();
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 DragZoom
2356
                    case "DragZoom":
2357
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.DragZoom;
2358
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2359
                        instanceMain.dzMainMenu.isLeftMouseButtonDownOnWindow = false;
2360
                        break;
2361
                    #endregion
2362
                    #region Grouping
2363
                    case "Group":
2364
                        //var GrouptoggleList = this.Parent.ChildrenOfType<RadRibbonToggleButton>();
2365
                        //foreach (var togle in GrouptoggleList)
2366
                        //{
2367
                        //    togle.IsChecked = false;
2368
                        //}
2369

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

    
2430
                        //if (ViewerDataModel.Instance.SystemMain.dzMainMenu.SelectLayer.Children.Count < 1) //선택된 것이 없으면
2431
                        //{
2432
                        //    this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert("Please Select Controls", "Alert");
2433
                        //}
2434
                        //else//if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
2435
                        //{
2436
                        //    // string MarkupData = "";
2437
                        //    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
2438
                        //    {
2439
                        //        if (item.GetType().Name == "AdornerFinal" && (item as AdornerFinal).MemberSet.Count >= 1) // 1개 이상 
2440
                        //        {
2441
                        //            //MARKUP_DATA UPDATE
2442
                        //            foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
2443
                        //            {
2444
                        //                if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
2445
                        //                {
2446
                        //                    long group_id = ViewerDataModel.Instance.MyMarkupList.Where(d => d.ID == (InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo).CommentID).FirstOrDefault().Group_ID;
2447
                        //                    //MARKUP_DATA UPDATE
2448
                        //                    //Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.UpdateMarkupData((InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo).CommentID, 0, App.ViewInfo.ProjectNO);
2449
                        //                    ////Logger.sendReqLog("UpdateMarkupData: ", "", 1);
2450
                        //                    ViewerDataModel.Instance.MyMarkupList.Where(d => d.ID == (InnerItem.DrawingData as CommentUserInfo).CommentID).FirstOrDefault().Group_ID = 0;
2451
                        //                    ViewerDataModel.Instance.MyMarkupList.Where(d => d.ID == (InnerItem.DrawingData as CommentUserInfo).CommentID).FirstOrDefault().IsUpdate = true;
2452

    
2453

    
2454
                        //                    //MARKUP_DATA_GROUP UPDATE
2455
                        //                    //bool value = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.UpdateMarkupDataGroup(group_id, App.ViewInfo.ProjectNO);
2456
                        //                    ////Logger.sendReqLog("AddMarkupDataGroup: ", value.ToString(), 1);
2457
                        //                }
2458
                        //            }
2459
                        //        }
2460
                        //    }
2461
                        //}
2462
                        break;
2463
                    #endregion
2464
                    #region Capture
2465
                    case "Capture":
2466
                        SyncInit();
2467
                        //   instanceToggle.IsChecked = false;
2468
                        var CaptureList = this.Parent.ChildrenOfType<RadRibbonToggleButton>();
2469
                        foreach (var togle in CaptureList)
2470
                        {
2471
                            togle.IsChecked = false;
2472
                        }
2473

    
2474
                        if (this.ParentOfType<MainWindow>().dzMainMenu.currentControl != null)
2475
                        {
2476
                            ViewerDataModel.Instance.MarkupControls_USER.Remove(this.ParentOfType<MainWindow>().dzMainMenu.currentControl);
2477
                            this.ParentOfType<MainWindow>().dzMainMenu.currentControl = null;
2478
                        }
2479

    
2480
                        ViewerDataModel.Instance.SelectedControl = "ImgControl";
2481
                   //     ViewerDataModel.Instance.ControlTag = null;
2482
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ImgControl;
2483

    
2484
                        /*
2485
                        //캡쳐 하기 전에 코멘트 저장
2486
                        if (Common.ViewerDataModel.Instance.MarkupControls_USER.Count > 0 || (Application.Current.MainWindow as MainWindow).dzMainMenu.SelectLayer.Children.Count > 0)
2487
                        {
2488
                            var menu = (Application.Current.MainWindow as MainWindow).dzMainMenu;
2489
                            menu.ReleaseAdorner();
2490
                            if (menu.PreviewUserMarkupInfoItem != null && menu.PreviewUserMarkupInfoItem.IsPreviewUser == true)
2491
                            {
2492
                                (Application.Current.MainWindow as MainWindow).dzTopMenu.RefactoryCommentReact(menu);
2493
                            }
2494
                            else if (menu.gridViewMarkup.SelectedItems.Count == 0 || (menu.gridViewMarkup.SelectedItems.FirstOrDefault() as IKCOM.MarkupInfoItem).UserID != App.ViewInfo.UserID)
2495
                            {
2496

    
2497
                            }
2498
                            else
2499
                            {
2500
                                (Application.Current.MainWindow as MainWindow).dzTopMenu.RefactoryCommentReact(menu);
2501
                            }
2502
                        }*/
2503

    
2504
                        //Common.ViewerDataModel.Instance.CheckList_ID = ((e.Source as Telerik.Windows.Controls.RadButton).DataContext as Customer).ID;
2505
                        //Common.ViewerDataModel.Instance.CheckList_ID = ((e.Source as Image).DataContext as Customer).ID;
2506
                        //Common.ViewerDataModel.Instance.PageNumber = ((e.Source as Image).DataContext as Customer).PAGENUMBER;
2507
                        Application.Current.MainWindow.Focus();
2508
                        Common.ViewerDataModel.Instance.Capture_Opacity = 0.49;
2509
                        (Application.Current.MainWindow as MainWindow).dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Capture;
2510
                        break;
2511
                    #endregion
2512
                    #region Cad
2513
                    case "Inside":
2514
                        //instanceMain.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Drawing;
2515
                        //instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = false;
2516
                        Common.ViewerDataModel.Instance.SelectedControl = "InsideWhite";
2517
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.InsideWhite;
2518
                        break;
2519
                    case "Overlap":
2520
                        //instanceMain.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Drawing;
2521
                        //instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = false;
2522
                        Common.ViewerDataModel.Instance.SelectedControl = "OverlapWhite";
2523
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.OverlapWhite;
2524
                        break;
2525
                    case "Clip":
2526
                        //instanceMain.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Drawing;
2527
                        //instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = false;
2528
                        Common.ViewerDataModel.Instance.SelectedControl = "ClipWhite";
2529
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ClipWhite;
2530
                        break;
2531
                    case "CadExport":
2532
                        //if (isClosed)
2533
                        //{
2534
                        //    //토글 및 마우스 상태 초기화
2535
                        //    var toggleList = this.Parent.ChildrenOfType<RadRibbonToggleButton>();
2536
                        //    foreach (var togle in toggleList)
2537
                        //    {
2538
                        //        togle.IsChecked = false;
2539
                        //    }
2540
                        //    this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2541

    
2542
                        //    isClosed = false;
2543
                        //    //Control 파일 먼저 생성
2544
                        //    CollapsedButton_Click();
2545
                        //    CadViewer check = new CadViewer();
2546
                        //    check.WindowStartupLocation = WindowStartupLocation.CenterScreen;
2547
                        //    check.Title = "Export Viewer";
2548
                        //    //check.Topmost = true;
2549
                        //    check.Show();
2550
                        //    check.Closed += Check_Closed;
2551
                        //    instanceToggle.IsChecked = false;
2552
                        //}
2553
                        //break;
2554
                    case "CadViewer":
2555
                        //if (isClosed)
2556
                        //{
2557
                        //    //토글 및 마우스 상태 초기화
2558
                        //    var toggleList = this.Parent.ChildrenOfType<RadRibbonToggleButton>();
2559
                        //    foreach (var togle in toggleList)
2560
                        //    {
2561
                        //        togle.IsChecked = false;
2562
                        //    }
2563
                        //    this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2564

    
2565
                        //    isClosed = false;
2566
                        //    CadResultViewer check = new CadResultViewer();
2567
                        //    check.WindowStartupLocation = WindowStartupLocation.CenterScreen;
2568
                        //    check.Title = "Viewer";
2569
                        //    check.Show();
2570

    
2571
                        //    check.Closed += Check_Closed;
2572

    
2573
                        //}
2574
                        break;
2575
                    #endregion
2576
                    default:
2577
                        break;
2578
                }
2579
                #endregion
2580
            }
2581
            else
2582
            {
2583
                if (Common.ViewerDataModel.Instance.IsMacroCommand)
2584
                {
2585
                    MacroHelper.Clear();
2586
                }
2587

    
2588
                if (!instanceMain.dzMainMenu.IsFreeSelectionMode)
2589
                {
2590
                    instanceMain.dzMainMenu.IsSwingMode = false;
2591
                    Common.ViewerDataModel.Instance.SelectedControl = "";
2592
                    Common.ViewerDataModel.Instance.ControlTag = null;
2593
                    this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2594
                    this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2595
                }
2596
            }
2597

    
2598
        }
2599

    
2600
        private void SyncInit()
2601
        {
2602
            try
2603
            {
2604
                if (!ViewerDataModel.Instance.SystemMain.dzMainMenu.testPanel2.IsHidden)
2605
                {
2606
                    ViewerDataModel.Instance.SystemMain.dzMainMenu.testPanel2.IsHidden = true;
2607
                    ViewerDataModel.Instance.PageBalanceMode = false;
2608
                    ViewerDataModel.Instance.PageBalanceNumber = 0;
2609
                    ViewerDataModel.Instance.SyncPageNumber = 0;
2610
                    ViewerDataModel.Instance.MarkupControls_Sync.Clear();
2611
                    ViewerDataModel.Instance.SystemMain.dzMainMenu.gridViewRevMarkup.Visibility = Visibility.Collapsed;
2612
                    ViewerDataModel.Instance.SystemMain.dzMainMenu.UserList.IsChecked = false;
2613
                    ViewerDataModel.Instance.SystemMain.dzMainMenu.BalanceMode.IsChecked = false;
2614
                }
2615
            }
2616
            catch (Exception ex)
2617
            {
2618
                //Logger.sendResLog("SyncInit", ex.Message, 0);
2619
            }
2620

    
2621
        }
2622

    
2623
        Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
2624
        CommentUserInfo currentControl { get; set; }
2625
        private void Check_Closed(object sender, EventArgs e)
2626
        {
2627
            isClosed = true;
2628
            //this.ParentOfType<MainWindow>().dzMainMenu.PN_Navi.IsEnabled = true;
2629
            //토글 및 마우스 상태 초기화
2630
            var toggleList = this.Parent.ChildrenOfType<RadToggleButton>();
2631
            foreach (var togle in toggleList)
2632
            {
2633
                togle.IsChecked = false;
2634
            }
2635
            this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2636
            ViewerDataModel.Instance.Capture_Opacity = 0;
2637

    
2638
        }
2639

    
2640
        /* public class test 
2641
         {
2642
             public double width { get; set; }
2643
             public double height { get; set; }
2644
         }
2645
         */
2646
        private async void CollapsedButton_Click()
2647
        {
2648
            this.ParentOfType<MainWindow>().dzTopMenu._SaveEvent(null, null); // 저장하지 못한 데이터가 있다면 저장
2649

    
2650
            string[] data = new string[0];
2651

    
2652
            int cnt = 0;
2653
            var menu = this.ParentOfType<MainWindow>().dzMainMenu;
2654

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

    
2657
            foreach (var item in gridSelectionItem)
2658
            {
2659
                if ((item.UserID == App.ViewInfo.UserID) && (ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.CurrentPage != null))
2660
                {
2661
                    var instance = ViewerDataModel.Instance.MyMarkupList.Where(d => d.PageNumber == ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber &&
2662
                    d.MarkupInfoID == item.MarkupInfoID).ToList();
2663
                    data = new string[instance.Count];
2664
                    foreach (var markup in instance)
2665
                    {
2666
                        data[cnt++] = await MarkupToPDF.Serialize.Core.JsonSerializerHelper.UnCompressStringAsync(markup.Data,ViewerDataModel.Instance.CancellationToken());
2667
                    }
2668
                }
2669
            }
2670

    
2671
            if (data != null && KCOM.Properties.Settings.Default.cad == 1)
2672
            {
2673
                string FilePath = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\Cad");
2674
                string FileName = FilePath + "\\commentstring.json"; // Default file name
2675
                if (!File.Exists(FilePath))
2676
                {
2677
                    Directory.CreateDirectory(FilePath);
2678
                }
2679

    
2680
                if (!string.IsNullOrEmpty(FileName))
2681
                {
2682
                    //  File.WriteAllText(SaveDig.FileName, data);
2683
                    File.WriteAllLines(FileName, data);
2684
                }
2685
            }
2686
        }
2687

    
2688
        private double minHeight;
2689
        private double minWidth;
2690

    
2691
        private double maxHeight;
2692
        private double maxWidth;
2693

    
2694
        public bool CanVResize { get; private set; }
2695
        public bool CanHResize { get; private set; }
2696

    
2697
        public void DesignerComponent(FrameworkElement content)
2698
        {
2699
            this.InitializeComponent();
2700

    
2701
            if (!double.IsNaN(content.Width))
2702
            {
2703
                CanHResize = false;
2704
                this.Width = content.Width;
2705
            }
2706
            else
2707
            {
2708
                CanHResize = true;
2709
                this.Width = 23.0;
2710
            }
2711
            if (!double.IsNaN(content.Height))
2712
            {
2713
                CanVResize = false;
2714
                this.Height = content.Height; ;
2715
            }
2716
            else
2717
            {
2718
                CanVResize = true;
2719
                this.Height = 23.0;
2720
            }
2721

    
2722
            minWidth = content.MinWidth < 10.0 ? 10.0 : content.MinWidth;
2723
            minHeight = content.MinHeight < 10.0 ? 10.0 : content.MinHeight;
2724
            maxWidth = content.MaxWidth;
2725
            maxHeight = content.MaxHeight;
2726

    
2727
            double top = (double)content.GetValue(Canvas.TopProperty);
2728
            if (double.IsNaN(top))
2729
                top = 0.0;
2730
            double left = (double)content.GetValue(Canvas.LeftProperty);
2731
            if (double.IsNaN(left))
2732
                left = 0.0;
2733
            SetValue(Canvas.TopProperty, top);
2734
            SetValue(Canvas.LeftProperty, left);
2735

    
2736
            //Set the actual content. Note that "Content" property is a new property. See below
2737
            this.Content = content;
2738
        }
2739
        private void Thumb_DragDelta(object sender, DragDeltaEventArgs e)
2740
        {
2741
            string name = ((Thumb)sender).Name;
2742
            if (name.Contains("Top"))
2743
            {
2744
                double newHeight = this.Height - e.VerticalChange;
2745
                if (newHeight >= minHeight && newHeight <= maxHeight)
2746
                {
2747
                    this.Height = newHeight;
2748
                    SetValue(Canvas.TopProperty,
2749
                (double)GetValue(Canvas.TopProperty) + e.VerticalChange);
2750
                }
2751
            }
2752
            if (name.Contains("Right"))
2753
            {
2754
                double newWidth = this.Width + e.HorizontalChange;
2755
                if (newWidth >= minWidth && newWidth <= maxWidth)
2756
                    this.Width = newWidth;
2757
            }
2758
            if (name.Contains("Bottom"))
2759
            {
2760
                double newHeight = this.Height + e.VerticalChange;
2761
                if (newHeight >= minHeight && newHeight <= maxHeight)
2762
                    this.Height = newHeight;
2763
            }
2764
            if (name.Contains("Left"))
2765
            {
2766
                double newWidth = this.Width - e.HorizontalChange;
2767
                if (newWidth >= minWidth && newWidth <= maxWidth)
2768
                {
2769
                    this.Width = newWidth;
2770
                    SetValue(Canvas.LeftProperty,
2771
                (double)GetValue(Canvas.LeftProperty) + e.HorizontalChange);
2772
                }
2773
            }
2774
        }
2775

    
2776
        private void drawControlBorder(object sender)
2777
        {
2778
            System.Windows.Controls.Control control = (System.Windows.Controls.Control)sender;
2779
        }
2780

    
2781
        private void ResizeThumb_DragDelta(object sender, MouseButtonEventArgs e)
2782
        {
2783
            System.Windows.Controls.Control designerItem = (System.Windows.Controls.Control)sender;
2784
            if (designerItem != null)
2785
            {
2786
                double deltaVertical, deltaHorizontal;
2787

    
2788
                switch (VerticalAlignment)
2789
                {
2790
                    case VerticalAlignment.Bottom:
2791
                        deltaVertical = designerItem.ActualHeight - designerItem.MinHeight;
2792
                        designerItem.Height -= deltaVertical;
2793
                        break;
2794
                    case VerticalAlignment.Top:
2795
                        deltaVertical = designerItem.ActualHeight - designerItem.MinHeight;
2796
                        Canvas.SetTop(designerItem, Canvas.GetTop(designerItem) + deltaVertical);
2797
                        designerItem.Height -= deltaVertical;
2798
                        break;
2799
                    default:
2800
                        break;
2801
                }
2802

    
2803
                switch (HorizontalAlignment)
2804
                {
2805
                    case HorizontalAlignment.Left:
2806
                        deltaHorizontal = designerItem.ActualWidth - designerItem.MinWidth;
2807
                        Canvas.SetLeft(designerItem, Canvas.GetLeft(designerItem) + deltaHorizontal);
2808
                        designerItem.Width -= deltaHorizontal;
2809
                        break;
2810
                    case HorizontalAlignment.Right:
2811
                        deltaHorizontal = designerItem.ActualWidth - designerItem.MinWidth;
2812
                        designerItem.Width -= deltaHorizontal;
2813
                        break;
2814
                    default:
2815
                        break;
2816
                }
2817
            }
2818
            e.Handled = true;
2819
        }
2820

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

    
2823
        void ExportMethod()
2824
        {
2825
            //FileDialogFilter filterImage = new FileDialogFilter("Image Files", "*.jpg", "*.png");
2826
            SaveDig.Filter = "PDF file format|*.pdf";
2827
            SaveDig.Title = "Save an DWG File";
2828
            SaveDig.ShowDialog();
2829
        }
2830

    
2831
        private void cbAutoSave_Checked(object sender, RoutedEventArgs e)
2832
        {            
2833
            if (cbAutoSave.IsChecked == true)
2834
            {
2835
                SaveTime(true, (int)cbSaveInterval.Value);
2836
            }
2837
            else
2838
            {
2839
                SaveTime(false, (int)cbSaveInterval.Value);
2840
            }
2841
        }
2842
        private void cbSaveInterval_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
2843
        {
2844
            if(string.IsNullOrEmpty(cbSaveInterval.Value.ToString()))
2845
            {
2846
                cbSaveInterval.Value = cbSaveInterval.Minimum;
2847
            }
2848
            if (cbAutoSave.IsChecked == true)
2849
            {
2850
                SaveTime(true, (int)cbSaveInterval.Value);
2851
            }
2852

    
2853
            KCOM.Properties.Settings.Default.SaveInterval = (double)cbSaveInterval.Value;
2854
            Properties.Settings.Default.Save();
2855
        }
2856
        //강인구 자동 저장 추가
2857
        private void AutoSave(object sender, RoutedEventArgs e)
2858
        {
2859
            RadToggleButton instanceToggle = sender as RadToggleButton;
2860

    
2861
            if(instanceToggle.IsChecked == true)
2862
            {
2863
                SaveTime(true);
2864
            }
2865
            else
2866
            {
2867
                SaveTime(false);
2868
            }
2869
        }
2870

    
2871
        public void Copy_Start()
2872
        {
2873
            if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
2874
            {
2875
                string MarkupData = "";
2876

    
2877
                foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
2878
                {
2879
                    if (item.GetType().Name == "AdornerFinal")
2880
                    {
2881
                        foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
2882

    
2883
                        {
2884
                            if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
2885
                            {
2886
                                MarkupToPDF.Controls.Parsing.MarkupParser.MarkupReturn res = MarkupParser.MarkupToString(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo, App.ViewInfo.UserID);
2887
                                MarkupData += "|OR|" + res.ConvertData;
2888
                            }
2889
                        }
2890
                        Clipboard.SetDataObject(MarkupData);
2891
                    }
2892
                }
2893
            }
2894
        }
2895

    
2896
        public void Cut_Start()
2897
        {
2898
            if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
2899
            {
2900
                foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
2901
                {
2902
                    string MarkupData = "";
2903

    
2904
                    if (item.GetType().Name == "AdornerFinal")
2905
                    {
2906
                        foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
2907
                        {
2908
                            if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
2909
                            {
2910
                                MarkupToPDF.Controls.Parsing.MarkupParser.MarkupReturn res = MarkupParser.MarkupToString(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo, App.ViewInfo.UserID);
2911
                                MarkupData += "|OR|" + res.ConvertData;
2912
                            }
2913
                        }
2914
                        //클립보드에 넣음
2915
                        Clipboard.SetDataObject(MarkupData);
2916
                    }
2917
                }
2918
                this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Clear();
2919
            }
2920
        }
2921

    
2922
        public async void Paste_Start()
2923
        {
2924
            //마크업 붙여넣기
2925
            if (Clipboard.GetText().Contains("|OR||DZ|"))
2926
            {
2927
                List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>();
2928

    
2929
                string[] delimiterChars = { "|OR|" };
2930
                string[] data = Clipboard.GetText().Split(delimiterChars, StringSplitOptions.RemoveEmptyEntries);
2931

    
2932
                SelectionSet.Instance.UnSelect(this.ParentOfType<MainWindow>().dzMainMenu);
2933

    
2934
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
2935

    
2936
                //강인구 Undo/Redo 보류
2937
                MarkupToPDF.Common.Undo_data UndoData = new Undo_data()
2938
                {
2939
                    IsUndo = false,
2940
                    Event = Event_Type.Create,
2941
                    EventTime = DateTime.Now,
2942
                    Markup_List = new List<Multi_Undo_data>()
2943
                };
2944

    
2945
                ViewerDataModel.Instance.UndoDataList.Where(data1 => data1.IsUndo == true).ToList().ForEach(i =>
2946
                {
2947
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
2948
                });
2949

    
2950
                foreach (string parse in data)
2951
                {
2952
                    if (parse != "")
2953
                    {
2954
                        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);
2955
                        (item as MarkupToPDF.Common.CommentUserInfo).CommentID = Commons.shortGuid();
2956

    
2957
                        ViewerDataModel.Instance.MarkupControls.Remove(item as MarkupToPDF.Common.CommentUserInfo);
2958
                        ViewerDataModel.Instance.MarkupControls_USER.Remove(item as MarkupToPDF.Common.CommentUserInfo);
2959

    
2960
                        adornerSet.Add(item as MarkupToPDF.Common.CommentUserInfo);
2961

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

    
2964
                        UndoData.Markup_List.Add(multi_Undo_Data);
2965
                        ViewerDataModel.Instance.UndoDataList.Add(UndoData);                        
2966
                    }
2967
                }
2968
                Controls.AdornerFinal final = new Controls.AdornerFinal(adornerSet);
2969

    
2970
                if(this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.X < 0)
2971
                {
2972
                    Canvas.SetLeft(final, 0);
2973
                    Canvas.SetTop(final, 0);
2974
                }
2975
                else
2976
                {
2977
                    double realPointX = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.X - final.BorderSize.X - (final.BorderSize.Width / 2);
2978
                    double realPointY = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.Y - final.BorderSize.Y - (final.BorderSize.Height / 2);
2979
                    final.TranslateItems(realPointX, realPointY);
2980

    
2981
                    if (final.Members.Where(type => type.Drawingtype == MarkupToPDF.Controls.Common.ControlType.TextControl).FirstOrDefault() != null)
2982
                    {
2983
                        final.TranslateItems(0.001, 0.001); //dummy
2984
                    }
2985
                }
2986

    
2987
                this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Add(final);
2988
            }
2989
            //외부 이미지 붙여넣기
2990
            else if (Clipboard.GetImage() != null)
2991
            {
2992
                try
2993
                {
2994
                    Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
2995

    
2996
                    //강인구 Undo/Redo 보류
2997
                    MarkupToPDF.Common.Undo_data UndoData = new Undo_data()
2998
                    {
2999
                        IsUndo = false,
3000
                        Event = Event_Type.Create,
3001
                        EventTime = DateTime.Now,
3002
                        Markup_List = new List<Multi_Undo_data>()
3003
                    };
3004

    
3005

    
3006
                    string temppath = System.IO.Path.GetTempPath();
3007
                    //string filename = KCOM.Events.Save.shortCommentKey();
3008
                    string filename = Commons.shortFileKey();
3009

    
3010
                    System.Drawing.Image clipboardImage = System.Windows.Forms.Clipboard.GetImage();
3011
                    clipboardImage.Save(temppath + "\\" + filename);
3012

    
3013
                    System.IO.FileInfo fileInfo = new System.IO.FileInfo(temppath + "\\" + filename);
3014
                    String strFile = System.IO.Path.GetFileName(fileInfo.FullName);
3015
                    long numByte = fileInfo.Length;
3016
                    double dLen = Convert.ToDouble(fileInfo.Length / 1000000);
3017
                    kr.co.devdoftech.cloud.FileUpload fileUploader = App.FileUploader;
3018

    
3019
                    if (dLen < 4)
3020
                    {
3021
                        System.IO.FileStream fStream = new System.IO.FileStream(fileInfo.FullName,
3022
                        System.IO.FileMode.Open, System.IO.FileAccess.Read);
3023
                        System.IO.BinaryReader br = new System.IO.BinaryReader(fStream);
3024
                        byte[] data = br.ReadBytes((int)numByte);
3025

    
3026
                        filename = fileUploader.Run(App.ViewInfo.ProjectNO, this.ParentOfType<MainWindow>().dzMainMenu._DocItem.DOCUMENT_NO, App.ViewInfo.UserID, strFile + ".png", data);
3027
                        Check_Uri.UriCheck(filename);
3028
                        br.Close();
3029
                        fStream.Close();
3030
                        fStream.Dispose();
3031
                    }
3032
                    else
3033
                    {
3034
                        this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert("Available Memory less than 4 mega byte", "Alert");
3035
                        return;
3036
                    }
3037

    
3038
                    fileInfo.Delete();
3039

    
3040
                    System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(clipboardImage);
3041
                    IntPtr hBitmap = bmp.GetHbitmap();
3042
                    System.Windows.Media.ImageSource WpfBitmap = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(hBitmap, IntPtr.Zero, Int32Rect.Empty, System.Windows.Media.Imaging.BitmapSizeOptions.FromEmptyOptions());
3043
                    Image img = new Image();
3044
                    if (filename.Contains(".svg"))
3045
                    {
3046
                        byte[] imageData = null;
3047
                        DrawingImage image = null;
3048
                        using (System.Net.WebClient web = new System.Net.WebClient())
3049
                        {
3050
                            imageData = web.DownloadData(new Uri(filename));
3051
                            System.IO.Stream stream = new System.IO.MemoryStream(imageData);
3052
                            image = SvgReader.Load(stream);
3053
                        }
3054
                        img.Source = image;
3055
                    }
3056
                    else
3057
                    {
3058
                        img.Source = new BitmapImage(new Uri(filename));
3059
                    }
3060

    
3061
                    var currentControl = new MarkupToPDF.Controls.Etc.ImgControl
3062
                    {
3063
                        PointSet = new List<Point>(),
3064
                        FilePath = filename,
3065
                        ImageData = img.Source,
3066
                        StartPoint = new Point(100, 100),
3067
                        EndPoint = new Point(200, 200),
3068
                        TopRightPoint = new Point(100, 200),
3069
                        LeftBottomPoint = new Point(200, 100)
3070
                    };
3071

    
3072
                    currentControl.TopRightPoint = new Point(currentControl.StartPoint.X + clipboardImage.Width, currentControl.StartPoint.Y);
3073
                    currentControl.LeftBottomPoint = new Point(currentControl.StartPoint.X, currentControl.StartPoint.Y + clipboardImage.Height);
3074
                    currentControl.EndPoint = new Point(currentControl.StartPoint.X + clipboardImage.Width, currentControl.StartPoint.Y + clipboardImage.Height);
3075

    
3076
                    currentControl.PointSet = new List<Point>
3077
                                        {
3078
                                            currentControl.StartPoint,
3079
                                            currentControl.LeftBottomPoint,
3080
                                            currentControl.EndPoint,
3081
                                            currentControl.TopRightPoint,
3082
                                        };
3083

    
3084
                    multi_Undo_Data = this.ParentOfType<MainWindow>().dzMainMenu.Control_Style(currentControl as MarkupToPDF.Common.CommentUserInfo);
3085
                    UndoData.Markup_List.Add(multi_Undo_Data);
3086
                    ViewerDataModel.Instance.UndoDataList.Add(UndoData);
3087

    
3088
                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl as MarkupToPDF.Common.CommentUserInfo);
3089
                    currentControl.CommentID = Commons.shortGuid();
3090

    
3091
                    currentControl.ApplyTemplate();
3092
                    currentControl.SetImage();
3093

    
3094
                    ViewerDataModel.Instance.MarkupControls_USER.Remove(currentControl as MarkupToPDF.Common.CommentUserInfo);
3095
                    Controls.AdornerFinal final = new Controls.AdornerFinal(currentControl as MarkupToPDF.Common.CommentUserInfo);
3096
                    this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Add(final);
3097

    
3098
                    double realPointX = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.X - final.BorderSize.X - (final.BorderSize.Width / 2);
3099
                    double realPointY = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.Y - final.BorderSize.Y - (final.BorderSize.Height / 2);
3100
                    final.TranslateItems(realPointX, realPointY);
3101
                }
3102
                catch(Exception ex)
3103
                {
3104
                    this.ParentOfType<MainWindow>().DialogMessage_Alert("" + ex, "Alert");
3105
                }
3106
            }
3107
        }
3108
    }
3109
}
클립보드 이미지 추가 (최대 크기: 500 MB)