프로젝트

일반

사용자정보

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

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

이력 | 보기 | 이력해설 | 다운로드 (159 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 System;
8
using System.Collections.Generic;
9
using System.Linq;
10
using System.Text;
11
using System.Windows;
12
using System.Windows.Controls;
13
using System.Windows.Input;
14
using System.Windows.Media;
15
using System.Windows.Media.Imaging;
16
using Telerik.Windows.Controls;
17
using IKCOM;
18
using Microsoft.Win32;
19
using System.IO;
20
using System.Reflection;
21
using System.Windows.Controls.Primitives;
22
using MarkupToPDF.Controls.Parsing;
23
using Telerik.Windows.Data;
24
using System.ComponentModel;
25
using System.Web;
26
using Markus.Fonts;
27
using System.Threading.Tasks;
28
using System.Windows.Threading;
29
using System.Text.RegularExpressions;
30
using MarkupToPDF.Controls.Shape;
31
using MarkupToPDF.Controls.Polygon;
32
using MarkupToPDF.Controls.Line;
33

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

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

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

    
73
        private void CheckShapeState()
74
        {
75

    
76

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

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

    
101
            if (adornerMembers.Count() > 0)
102
            {
103
                //UndoCommand.Instance.Push(adornerMembers.Select(x => x.DrawingData).Cast<CommentUserInfo>().ToList(), adnoerFinal.AngleValue);
104
                UndoCommand.Instance.Push(adornerMembers.Select(x => x.DrawingData).Cast<CommentUserInfo>().ToList());
105
            }
106
        }
107

    
108
        //강인구 추가(Undo End)
109
        private void SetPaintEvent()
110
        {
111
            List<AdornerMember> AdonerList = GetAdornerItem();
112

    
113
            if (AdonerList.Count > 0)
114
            {
115
                UndoDataGroup UndoData = new UndoDataGroup()
116
                {
117
                    IsUndo = false,
118
                    Event = EventType.Operation,
119
                    EventTime = DateTime.Now,
120
                    paint = ViewerDataModel.Instance.paintSet,
121
                    MarkupDataColl = new List<UndoData>()
122
                };
123
                UndoData multi_UndoData = new UndoData();
124

    
125
                foreach (AdornerMember InnerItem in AdonerList)
126
                {
127
                    multi_UndoData.PointSet = new List<Point>();
128

    
129
                    if ((InnerItem.DrawingData as MarkupToPDF.Controls.Common.IShapeControl) != null)
130
                    {
131
                        (InnerItem.DrawingData as MarkupToPDF.Controls.Common.IShapeControl).Paint = ViewerDataModel.Instance.paintSet;
132
                    }
133

    
134
                    multi_UndoData.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
135
                    UndoData.MarkupDataColl.Add(multi_UndoData);
136
                    multi_UndoData = new UndoData();
137
                }
138

    
139
                ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
140
                {
141
                    ViewerDataModel.Instance.UndoDataList.Remove(i);                    
142
                });
143
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
144
            }
145
        }
146

    
147
        private void SetHighlightEvent()
148
        {
149
            List<AdornerMember> AdonerList = GetAdornerItem();
150

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

    
170
                ViewerDataModel.Instance.IsMarkupUpdate = true;
171
            }
172

    
173
        }
174

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

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

    
203
            if (ViewerDataModel.Instance.checkFillShape)
204
            {
205
                cbHatchShape.IsChecked = false;
206
                ViewerDataModel.Instance.paintSet = MarkupToPDF.Controls.Common.PaintSet.Fill;
207
            }
208
            else
209
            {
210
                ViewerDataModel.Instance.paintSet = MarkupToPDF.Controls.Common.PaintSet.None;
211
            }
212
            SetPaintEvent();
213
        }
214

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

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

    
260
        void SaveTimer_Tick(object sender, EventArgs e)
261
        {
262
            //if (this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode != IKCOM.MouseHandlingMode.Drawing)
263
            if (this.ParentOfType<MainWindow>().dzMainMenu.currentControl == null && this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count == 0)
264
            {
265
                SaveEventCallback(null, null);
266
            }
267
        }
268

    
269
        private void SaveTime(bool IsRun)
270
        {
271
            if(SaveTimer == null)
272
            {
273
                SaveTimer = new System.Windows.Threading.DispatcherTimer();
274
                SaveTimer.Interval = new TimeSpan(0, 0, 5);
275
                SaveTimer.Tick += new EventHandler(SaveTimer_Tick);
276
            }
277

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

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

    
319
            if (mianMenu.busyIndicator.IsBusy == true)
320
            {
321
                return;
322
            }
323

    
324
            //var result = await Dispatcher.InvokeAsync<bool>(()=>
325
            //{
326
                this.ParentOfType<MainWindow>().dzMainMenu.busyIndicator.IsBusy = true;
327

    
328
                _SaveEvent(sender, e);
329

    
330
                mianMenu.busyIndicator.IsBusy = false;
331
               
332
            //});
333

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

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

    
353
            var mainMenu = this.ParentOfType<MainWindow>().dzMainMenu;
354
            try
355
            {
356
                mainMenu.ConvertInkControlToPolygon();
357

    
358
                //Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.zoomAndPanControl_MouseDown(this, new MouseButtonEventArgs(Mouse.PrimaryDevice, 0, MouseButton.Right));
359

    
360
                //SelectionSet.Instance.UnSelect(this.ParentOfType<MainWindow>().dzMainMenu);
361
                // update mylist and gridview
362
                mainMenu.UpdateMyMarkupList();
363

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

    
377
                            ViewerDataModel.Instance._markupInfoList.Where(data => data.MarkupInfoID == (item as IKCOM.MarkupInfoItem).MarkupInfoID).FirstOrDefault().UpdateTime = DateTime.Now;
378
                            if (!ViewerDataModel.Instance.IsConsolidate && (sender != null))
379
                            {
380
                                this.ParentOfType<MainWindow>().DialogMessage_Alert("Save is complete.", "Info");
381
                                
382
                            }
383

    
384
                            result = true;
385
                        }
386
                    }
387
                }
388

    
389
                mainMenu.SetCommentPages(null);
390

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

    
414
            return result;
415
        }
416

    
417
        public async Task<bool>  SaveEventAsync()
418
        {
419
            bool result = false;
420

    
421
            var mainMenu = this.ParentOfType<MainWindow>().dzMainMenu;
422
            try
423
            {
424
                mainMenu.ConvertInkControlToPolygon();
425

    
426
                SelectionSet.Instance.UnSelect(this.ParentOfType<MainWindow>().dzMainMenu);
427
                // update mylist and gridview
428
                mainMenu.UpdateMyMarkupList();
429

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

    
443
                            ViewerDataModel.Instance._markupInfoList.Where(data => data.MarkupInfoID == (item as IKCOM.MarkupInfoItem).MarkupInfoID).FirstOrDefault().UpdateTime = DateTime.Now;
444
                        }
445
                    }
446
                }
447

    
448
                mainMenu.SetCommentPages(null);
449

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

    
474
            return result;
475
        }
476

    
477
        public bool SaveEvent()
478
        {
479
            bool result = false;
480

    
481
            var mainMenu = this.ParentOfType<MainWindow>().dzMainMenu;
482
            try
483
            {
484
                mainMenu.ConvertInkControlToPolygon();
485

    
486
                SelectionSet.Instance.UnSelect(this.ParentOfType<MainWindow>().dzMainMenu);
487
                // update mylist and gridview
488
                mainMenu.UpdateMyMarkupList();
489

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

    
503
                            ViewerDataModel.Instance._markupInfoList.Where(data => data.MarkupInfoID == (item as IKCOM.MarkupInfoItem).MarkupInfoID).FirstOrDefault().UpdateTime = DateTime.Now;
504
                        }
505
                    }
506
                }
507

    
508
                mainMenu.SetCommentPages(null);
509

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

    
534
            return result;
535
        }
536

    
537
        /// <summary>
538
        /// call save command
539
        /// </summary>
540
        /// <param name="menu"></param>
541
		public void ExecuteSaveCommand2(MainMenu menu)
542
        {
543
            if (menu.pageNavigator.CurrentPage != null)
544
            {
545
                SaveCommand.Instance.Project_No = App.ViewInfo.ProjectNO;
546
                SaveCommand.Instance.document_id = App.ViewInfo.DocumentItemID;
547
                SaveCommand.Instance.user_id = App.ViewInfo.UserID;
548
                SaveCommand.Instance.page_no = menu.pageNavigator.CurrentPage.PageNumber;
549

    
550
                try
551
                {
552
                    if (ViewerDataModel.Instance.UndoDataList.Count > 0)
553
                    {
554
                        List<IKCOM.MarkupInfoItem> SelectedMarkupInfos = new List<IKCOM.MarkupInfoItem>();
555
                        foreach (var item in menu.gridViewMarkup.SelectedItems)
556
                        {
557
                            if ((item as IKCOM.MarkupInfoItem).UserID == App.ViewInfo.UserID)
558
                            {
559
                                SelectedMarkupInfos.Add(item as IKCOM.MarkupInfoItem);
560
                            }
561
                        }
562

    
563
                        SaveCommand.Instance.Execute(SelectedMarkupInfos);
564
                    }
565

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

    
586
            if (menu.pageNavigator.CurrentPage != null)
587
            {
588
                SaveCommand.Instance.Project_No = App.ViewInfo.ProjectNO;
589
                SaveCommand.Instance.document_id = App.ViewInfo.DocumentItemID;
590
                SaveCommand.Instance.user_id = App.ViewInfo.UserID;
591
                SaveCommand.Instance.page_no = menu.pageNavigator.CurrentPage.PageNumber;
592

    
593
                try
594
                {
595
                    if (ViewerDataModel.Instance.UndoDataList.Count > 0 || ViewerDataModel.Instance.IsMarkupUpdate)
596
                    {
597
                        List<IKCOM.MarkupInfoItem> SelectedMarkupInfos = new List<IKCOM.MarkupInfoItem>();
598
                        foreach (var item in menu.gridViewMarkup.SelectedItems)
599
                        {
600
                            if ((item as IKCOM.MarkupInfoItem).UserID == App.ViewInfo.UserID)
601
                            {
602
                                SelectedMarkupInfos.Add(item as IKCOM.MarkupInfoItem);
603
                            }
604
                        }
605

    
606
                        result = await SaveCommand.Instance.Execute(SelectedMarkupInfos);
607
                        ViewerDataModel.Instance.IsMarkupUpdate = false;
608
                    }
609
                    else
610
                    {
611
                        result = true;
612
                    }
613

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

    
630
            return result;
631
        }
632

    
633
        public bool ExecuteSaveCommand(MainMenu menu)
634
        {
635
            bool result = false;
636

    
637
            if (menu.pageNavigator.CurrentPage != null)
638
            {
639
                SaveCommand.Instance.Project_No = App.ViewInfo.ProjectNO;
640
                SaveCommand.Instance.document_id = App.ViewInfo.DocumentItemID;
641
                SaveCommand.Instance.user_id = App.ViewInfo.UserID;
642
                SaveCommand.Instance.page_no = menu.pageNavigator.CurrentPage.PageNumber;
643

    
644
                try
645
                {
646
                    if (ViewerDataModel.Instance.UndoDataList.Count > 0 || ViewerDataModel.Instance.IsMarkupUpdate)
647
                    {
648
                        List<IKCOM.MarkupInfoItem> SelectedMarkupInfos = new List<IKCOM.MarkupInfoItem>();
649
                        foreach (var item in menu.gridViewMarkup.SelectedItems)
650
                        {
651
                            if ((item as IKCOM.MarkupInfoItem).UserID == App.ViewInfo.UserID)
652
                            {
653
                                SelectedMarkupInfos.Add(item as IKCOM.MarkupInfoItem);
654
                            }
655
                        }
656

    
657
                        result = SaveCommand.Instance.Execute(SelectedMarkupInfos).GetAwaiter().GetResult();
658
                        ViewerDataModel.Instance.IsMarkupUpdate = false;
659
                    }
660
                    else
661
                    {
662
                        result = true;
663
                    }
664

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

    
681
            return result;
682
        }
683

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

    
698
                }
699
                else
700
                {
701
                    this.SaveEventCallback(null, null);
702
                }
703
            }
704

    
705
            bool isprint = false;
706
            if (Type == "Print")
707
            {
708
                isprint = true;
709
            }
710

    
711
            RadWindow PrintWindow = new RadWindow();
712
            PrintWindow.Width = 850;
713
            PrintWindow.Height = 600;
714
            PrintWindow.Header = Type;
715

    
716
            List<IKCOM.MarkupInfoItem> markupinfo = new List<IKCOM.MarkupInfoItem>();
717

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

    
720
            if (markupinfo?.Count() > 0)
721
            {
722
                //Logger.sendResLog("GetPrintDocItemList", "TRUE", 1);
723
            }
724
            else
725
            {
726
                //Logger.sendResLog("GetPrintDocItemList", "FALSE", 1);
727
            }
728

    
729
            /// Tile Source URL을 구한다
730

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

    
742
            var docitem = this.ParentOfType<MainWindow>().dzMainMenu._DocItem;
743

    
744
            PrintWindow.Content = new KCOM.Control.PrintControl(
745
                      Tile_Url,
746
                      App.ViewInfo.ProjectNO,
747
                      this.ParentOfType<MainWindow>().dzMainMenu._DocInfo,
748
                      markupinfo,
749
                      this.ParentOfType<MainWindow>().dzMainMenu.pageNavigator.CurrentPage.PageNumber,
750
                      docitem.GROUP_NO,
751
                      docitem.DOCUMENT_NO,
752
                      docitem.ORIGINAL_FILE,
753
                      isprint);
754

    
755
            //프린트 팝업 옵션
756
            //PrintWindow.BorderThickness = new Thickness(3);
757
            //PrintWindow.BorderBrush = new SolidColorBrush(Color.FromArgb(255, 37, 160, 218));
758
            PrintWindow.ResizeMode = System.Windows.ResizeMode.NoResize;
759
            PrintWindow.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
760
            PrintWindow.Background = new SolidColorBrush(Colors.Black);
761
            PrintWindow.Background.Opacity = 0.6;
762
            PrintWindow.Owner = Application.Current.MainWindow;
763
            Telerik.Windows.Controls.StyleManager.SetTheme(PrintWindow, new Telerik.Windows.Controls.VisualStudio2013Theme());
764
            PrintWindow.ShowDialog();
765
        }
766

    
767
        //강인구 추가
768
        private void PrintEvent(object sender, RoutedEventArgs e)
769
        {
770
            RadRibbonButton button = sender as RadRibbonButton;
771
            Print_Start(button.Content.ToString());
772
        }
773

    
774
        private List<AdornerMember> GetAdornerItem()
775
        {
776
            List<AdornerMember> AdonerList = new List<AdornerMember>();
777

    
778
            if (this.ParentOfType<MainWindow>() != null)
779
            {
780
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
781
                {
782
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
783
                    {
784
                        if (item.GetType().Name == "AdornerFinal")
785
                        {
786
                            foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
787
                            {
788
                                AdonerList.Add(InnerItem);
789
                            }
790
                        }
791
                    }
792
                }
793
            }
794

    
795
            return AdonerList;
796
        }
797
        /// <summary>
798
        /// 투명도
799
        /// </summary>
800
        /// <param name="sender"></param>
801
        /// <param name="e"></param>
802
        //강인구 추가(Undo End)
803
        private void sdOpacity_ValueChanged(object sender, RoutedEventArgs e)
804
        {
805
            List<AdornerMember> AdonerList = GetAdornerItem();
806
            if(AdonerList.Count > 0)
807
            {
808
                UndoDataGroup UndoData = new UndoDataGroup()
809
                {
810
                    IsUndo = false,
811
                    Event = EventType.Operation,
812
                    EventTime = DateTime.Now,
813
                    Opacity = ViewerDataModel.Instance.ControlOpacity,
814
                    MarkupDataColl = new List<UndoData>()
815
                };
816
                UndoData multi_UndoData = new UndoData();
817

    
818
                foreach (AdornerMember InnerItem in AdonerList)
819
                {
820
                    InnerItem.DrawingData.Opacity = ViewerDataModel.Instance.ControlOpacity;
821
                  
822
                    multi_UndoData.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
823
                    UndoData.MarkupDataColl.Add(multi_UndoData);
824
                    multi_UndoData = new UndoData();
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
        //강인구 추가(Undo End)
836
        private void cbLineSize_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
837
        {
838
            if (string.IsNullOrEmpty(cbLineSize.Value.ToString()))
839
            {
840
                cbLineSize.Value = cbLineSize.Minimum;
841
            }
842
            List<AdornerMember> AdonerList = GetAdornerItem();
843
            if (AdonerList.Count > 0)
844
            {
845
                UndoDataGroup UndoData = new UndoDataGroup()
846
                {
847
                    IsUndo = false,
848
                    Event = EventType.Operation,
849
                    EventTime = DateTime.Now,
850
                    LineSize = ViewerDataModel.Instance.LineSize,
851
                    MarkupDataColl = new List<UndoData>()
852
                };
853
                UndoData multi_UndoData = new UndoData();
854

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

    
943
                    multi_UndoData.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
944
                    UndoData.MarkupDataColl.Add(multi_UndoData);
945
                    multi_UndoData = new UndoData();
946
                }
947

    
948
                ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
949
                {
950
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
951
                });
952
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
953

    
954
                
955
            }
956
            KCOM.Properties.Settings.Default.LineSize = (double)cbLineSize.Value;
957
            Properties.Settings.Default.Save();
958
        }
959

    
960

    
961
        private void cbIntervalSize_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
962
        {
963
            if (string.IsNullOrEmpty(cbIntervalSize.Value.ToString()))
964
            {
965
                cbIntervalSize.Value = cbIntervalSize.Minimum;
966
            }
967
            List<AdornerMember> AdonerList = GetAdornerItem();
968
            if (AdonerList.Count > 0)
969
            {
970

    
971
                UndoDataGroup UndoData = new UndoDataGroup()
972
                {
973
                    IsUndo = false,
974
                    Event = EventType.Operation,
975
                    EventTime = DateTime.Now,
976
                    Interval = ViewerDataModel.Instance.Interval,
977
                    MarkupDataColl = new List<UndoData>()
978
                };
979
                UndoData multi_UndoData = new UndoData();
980

    
981
                foreach (AdornerMember InnerItem in AdonerList)
982
                {
983
                    switch (InnerItem.DrawingData.GetType().Name)
984
                    {
985
                        case ("LineControl"):
986
                            {
987
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Line.LineControl).Interval = ViewerDataModel.Instance.Interval;
988

    
989
                                multi_UndoData.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
990
                                UndoData.MarkupDataColl.Add(multi_UndoData);
991
                                multi_UndoData = new UndoData();
992
                            }
993
                            break;
994
                    }
995
                }
996

    
997
                ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
998
                {
999
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
1000
                });
1001
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
1002
            }
1003
            KCOM.Properties.Settings.Default.Interval = (double)cbIntervalSize.Value;
1004
            Properties.Settings.Default.Save();
1005
        }
1006
        
1007
        /// <summary>
1008
        /// ArcLength가 수정되었을때
1009
        /// </summary>
1010
        /// <param name="sender"></param>
1011
        /// <param name="e"></param>
1012
        private void cbArcLength_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
1013
        {
1014
            if (string.IsNullOrEmpty(cbArcLength.Value.ToString()))
1015
            {
1016
                cbArcLength.Value = cbArcLength.Minimum;
1017
            }
1018

    
1019
            List<AdornerMember> AdonerList = GetAdornerItem();
1020
            if (AdonerList.Count > 0)
1021
            {
1022
                var comments = (from drawing in AdonerList
1023
                                select drawing.DrawingData as CommentUserInfo)
1024
                                .Where(x => x is RectCloudControl || x is CloudControl ||
1025
                                x is MarkupToPDF.Controls.Text.TextControl || x is MarkupToPDF.Controls.Text.ArrowTextControl)
1026
                                .ToList();
1027
                UndoCommand.Instance.Push(comments);
1028

    
1029
                foreach (AdornerMember InnerItem in AdonerList)
1030
                {
1031
                    switch (InnerItem.DrawingData.GetType().Name)
1032
                    {
1033
                        case ("RectCloudControl"):
1034
                            {
1035
                                var item = InnerItem.DrawingData as MarkupToPDF.Controls.Shape.RectCloudControl;
1036
                                item.ArcLength = ViewerDataModel.Instance.ArcLength;
1037
                            }
1038
                        break;
1039
                        case ("CloudControl"):
1040
                        {
1041
                                var item = InnerItem.DrawingData as MarkupToPDF.Controls.Polygon.CloudControl;
1042
                                item.ArcLength = ViewerDataModel.Instance.ArcLength;
1043
                        }
1044
                        break;
1045
                        case ("TextControl"):
1046
                        {
1047
                                var item = InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl;
1048
                                item.ArcLength = ViewerDataModel.Instance.ArcLength;
1049
                        }
1050
                        break;
1051
                        case ("ArrowTextControl"):
1052
                        {
1053
                                var item = InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl;
1054
                                item.ArcLength = ViewerDataModel.Instance.ArcLength;
1055
                        }
1056
                        break;
1057
                    }
1058
                }
1059
            }
1060

    
1061
            KCOM.Properties.Settings.Default.ArcLength = (double)cbArcLength.Value;
1062
            Properties.Settings.Default.Save();
1063
        }
1064

    
1065
        //강인구 추가(Undo End)
1066
        private void cbDashStyle_SelectionChanged(object sender, SelectionChangedEventArgs e)
1067
        {
1068
            //강인구 추가
1069
            if (this.ParentOfType<MainWindow>() != null)
1070
            {
1071
                ViewerDataModel.Instance.DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
1072
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
1073
                {
1074
                    UndoDataGroup UndoData = new UndoDataGroup()
1075
                    {
1076
                        IsUndo = false,
1077
                        Event = EventType.Operation,
1078
                        EventTime = DateTime.Now,
1079
                        DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData,
1080
                        MarkupDataColl = new List<UndoData>()
1081
                    };
1082
                    UndoData multi_UndoData = new UndoData();
1083

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

    
1164
                                multi_UndoData.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
1165
                                UndoData.MarkupDataColl.Add(multi_UndoData);
1166
                                multi_UndoData = new UndoData();
1167
                            }
1168

    
1169
                            ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
1170
                            {
1171
                                ViewerDataModel.Instance.UndoDataList.Remove(i);
1172
                            });
1173
                            ViewerDataModel.Instance.UndoDataList.Add(UndoData);
1174
                        }
1175
                    }
1176
                }
1177
            }
1178
        }
1179

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

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

    
1241
                                        }
1242
                                        break;
1243
                                    case ("ArrowTextControl"):
1244
                                        {
1245
                                            if ((InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextWeight == FontWeights.Bold)
1246
                                            {
1247
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextWeight = FontWeights.Normal;
1248
                                                ViewerDataModel.Instance.IsMarkupUpdate = true;
1249
                                            }
1250
                                            else
1251
                                            {
1252
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextWeight = FontWeights.Bold;
1253
                                                ViewerDataModel.Instance.IsMarkupUpdate = true;
1254
                                            }
1255
                                        }
1256
                                        break;
1257
                                }
1258
                            }
1259
                        }
1260
                    }
1261
                }
1262
            }
1263
        }
1264

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

    
1293
                                        }
1294
                                        break;
1295
                                    case ("ArrowTextControl"):
1296
                                        {
1297
                                            if((InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextStyle == FontStyles.Italic)
1298
                                            {
1299
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextStyle = FontStyles.Normal;
1300
                                                ViewerDataModel.Instance.IsMarkupUpdate = true;
1301
                                            }
1302
                                            else
1303
                                            {
1304
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextStyle = FontStyles.Italic;
1305
                                                ViewerDataModel.Instance.IsMarkupUpdate = true;
1306
                                            }
1307
                                        }
1308
                                        break;
1309
                                }
1310
                            }
1311
                        }
1312
                    }
1313
                }
1314
            }
1315
        }
1316

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

    
1358
                                ViewerDataModel.Instance.IsMarkupUpdate = true;
1359
                            }
1360
                        }
1361
                    }
1362
                }
1363
            }
1364
        }
1365

    
1366

    
1367
        private void cbLineSize_PreviewKeyDown(object sender, System.Windows.Input.KeyEventArgs e)
1368
        {
1369
            if (e.Key == Key.Space || e.Key == Key.ImeProcessed)
1370
            {
1371
                e.Handled = true;
1372
            }
1373

    
1374
        }
1375

    
1376
        private void cbLineSize_PreviewTextInput(object sender, System.Windows.Input.TextCompositionEventArgs e)
1377
        {
1378
            var regex = new Regex(@"[^a-zA-Z0-9\s]");
1379
            if (regex.IsMatch(e.Text))
1380
            {
1381
                e.Handled = true;
1382
            }
1383

    
1384
        }
1385

    
1386
        private void cbArcLength_PreviewKeyDown(object sender, System.Windows.Input.KeyEventArgs e)
1387
        {
1388
            if (e.Key == Key.Space || e.Key == Key.ImeProcessed)
1389
            {
1390
                e.Handled = true;
1391
            }
1392
        }
1393

    
1394
        private void cbArcLength_PreviewTextInput(object sender, System.Windows.Input.TextCompositionEventArgs e)
1395
        {
1396
            var regex = new Regex(@"[^a-zA-Z0-9\s]");
1397
            if (regex.IsMatch(e.Text))
1398
            {
1399
                e.Handled = true;
1400
            }
1401
        }
1402

    
1403
        private void comboFontSize_PreviewKeyDown(object sender, System.Windows.Input.KeyEventArgs e)
1404
        {
1405
            if (e.Key == Key.Space || e.Key == Key.ImeProcessed)
1406
            {
1407
                e.Handled = true;
1408
            }
1409
        }
1410

    
1411
        private void cbIntervalSize_PreviewKeyDown(object sender, System.Windows.Input.KeyEventArgs e)
1412
        {
1413
            if (e.Key == Key.Space || e.Key == Key.ImeProcessed)
1414
            {
1415
                e.Handled = true;
1416
            }
1417
        }
1418

    
1419
        private void cbIntervalSize_PreviewTextInput(object sender, System.Windows.Input.TextCompositionEventArgs e)
1420
        {
1421
            var regex = new Regex(@"[^a-zA-Z0-9\s]");
1422
            if (regex.IsMatch(e.Text))
1423
            {
1424
                e.Handled = true;
1425
            }
1426
        }
1427

    
1428
        private void comboFontSize_PreviewTextInput(object sender, System.Windows.Input.TextCompositionEventArgs e)
1429
        {
1430
            var regex = new Regex(@"[^a-zA-Z0-9\s]");
1431
            if (regex.IsMatch(e.Text))
1432
            {
1433
                e.Handled = true;
1434
            }
1435
        }
1436

    
1437
        private void comboFontSize_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
1438
        {
1439
            if (string.IsNullOrEmpty(comboFontSize.Value.ToString()))
1440
            {
1441
                comboFontSize.Value = comboFontSize.Minimum;
1442
            }
1443
            if (this.ParentOfType<MainWindow>() != null)
1444
            {
1445
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
1446
                {
1447
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
1448
                    {
1449
                        if (item.GetType().Name == "AdornerFinal")
1450
                        {
1451
                            foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
1452
                            {
1453
                                switch (InnerItem.DrawingData.GetType().Name)
1454
                                {
1455
                                    case ("TextControl"):
1456
                                        {
1457
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextSize = int.Parse(comboFontSize.Value.ToString());
1458
                                        }
1459
                                        break;
1460
                                    case ("ArrowTextControl"):
1461
                                        {
1462
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextSize = int.Parse(comboFontSize.Value.ToString());
1463
                                        }
1464
                                        break;
1465
                                }
1466
                            }
1467

    
1468
                            ChangeComment(item as Controls.AdornerFinal);
1469
                        }
1470
                    }
1471
                }
1472
            }
1473

    
1474
            KCOM.Properties.Settings.Default.TextSize = (double)comboFontSize.Value;
1475
            Properties.Settings.Default.Save();
1476
        }
1477

    
1478
        //강인구 추가
1479
        private void comboFontFamily_SelectionChanged(object sender, SelectionChangedEventArgs e)
1480
        {
1481
            
1482
            if (comboFontFamily.SelectedItem != null && !IsSuspendChange)
1483
            {
1484
                var main = this.ParentOfType<MainWindow>()?.dzMainMenu;
1485
                var font = comboFontFamily.SelectedItem as Markus.Fonts.MarkusFont;
1486
                var lstTextCtrl = SelectTextControl();
1487

    
1488
                foreach (var item in lstTextCtrl)
1489
                {
1490
                    if (item is MarkupToPDF.Controls.Text.ArrowTextControl ctrl1)
1491
                    {
1492
                        ViewerDataModel.Instance.IsMarkupUpdate = true;
1493
                        ctrl1.SetFontFamily(font.FontFamily);
1494
                    }
1495
                    else if (item is MarkupToPDF.Controls.Text.TextControl ctrl2)
1496
                    {
1497
                        ViewerDataModel.Instance.IsMarkupUpdate = true;
1498
                        ctrl2.SetFontFamily(font.FontFamily);
1499
                    }
1500
                }
1501

    
1502
                KCOM.Properties.Settings.Default.FontFamily = font.FontFamily.FontName();
1503
                Properties.Settings.Default.Save();
1504
            }
1505
        }
1506

    
1507
        private List<UIElement> SelectTextControl()
1508
        {
1509
            List<UIElement> lstTextCtrl = new List<UIElement>();
1510

    
1511
            var main = this.ParentOfType<MainWindow>()?.dzMainMenu;
1512
            var font = comboFontFamily.SelectedItem as Markus.Fonts.MarkusFont;
1513

    
1514

    
1515
            if (main.SelectLayer.FindChildByType<AdornerFinal>() != null)
1516
            {
1517
                lstTextCtrl.AddRange(main.SelectLayer.FindChildByType<AdornerFinal>().Members.Where(x => x.DrawingData is MarkupToPDF.Controls.Common.ITextControl).Select(x => x.DrawingData));
1518
            }
1519

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

    
1522
            return lstTextCtrl;
1523
        }
1524

    
1525

    
1526
        /// <summary>
1527
        /// 텍스트 컨트롤 하일라이트 처리
1528
        /// </summary>
1529
        /// <param name="sender"></param>
1530
        /// <param name="e"></param>
1531
        private void HighlightEvent(object sender, RoutedEventArgs e)
1532
        {
1533

    
1534
            ViewerDataModel.Instance.checkHighShape = (sender as CheckBox).IsChecked.Value;
1535
            SetHighlightEvent();
1536
            //if ((sender as CheckBox).IsChecked.Value)
1537
            //{
1538
            //    TaskMessage("HighLight가 설정되었습니다", TaskMessageType.Normal);
1539
            //}
1540
            //else
1541
            //{
1542
            //    TaskMessage("HighLight가 해제되었습니다", TaskMessageType.Caption);
1543
            //}
1544
            //if (ViewerDataModel.Instance.SelectedEditor as MarkupToPDF.Controls.Text.TextControl != null)
1545
            //{
1546
            //    MarkupToPDF.Controls.Text.TextControl instance = (ViewerDataModel.Instance.SelectedEditor as MarkupToPDF.Controls.Text.TextControl);
1547
            //    instance.IsHighLight = ViewerDataModel.Instance.checkHighShape;
1548
            //    instance.SetText();
1549
            //}
1550
        }
1551

    
1552
        //추가페이지 이동 엔터
1553
        private void tlcurrentPage_KeyDown(object sender, KeyEventArgs e)
1554
        {
1555
            //강인구 추가 tlcurrentPage을 이상하게 입력할수 있기때문에 Try Catch
1556
            if (e.Key == Key.Enter)
1557
            {
1558
                try
1559
                {
1560
                    var instanceMain = this.ParentOfType<MainWindow>();
1561
                    var max = instanceMain.dzMainMenu.pageNavigator._thumbnailItems.Max(f => f.PageNumber);
1562
                    if (string.IsNullOrEmpty(tlcurrentPage.Text))
1563
                    {
1564
                        RadWindow.Alert(new DialogParameters
1565
                        {
1566
                            Owner = Application.Current.MainWindow,
1567
                            Theme = new VisualStudio2013Theme(),
1568
                            Header = "Info",
1569
                            Content = "Enter the correct page number.",
1570
                        });
1571
                    }
1572
                    else
1573
                    {
1574
                        if (Convert.ToInt32(tlcurrentPage.Text) > max || Convert.ToInt32(tlcurrentPage.Text) == 0)
1575
                        {
1576
                            RadWindow.Alert(new DialogParameters
1577
                            {
1578
                                Owner = Application.Current.MainWindow,
1579
                                Theme = new VisualStudio2013Theme(),
1580
                                Header = "Info",
1581
                                Content = "Enter the correct page number.",
1582
                            });
1583
                        }
1584
                        else
1585
                        {
1586
                            instanceMain.dzMainMenu.pageNavigator.GotoPage(Convert.ToInt32(tlcurrentPage.Text));
1587
                        }
1588
                    }
1589
                    
1590
                }
1591
                catch (Exception)
1592
                {
1593
                    RadWindow.Alert(new DialogParameters
1594
                    {
1595
                        Owner = Application.Current.MainWindow,
1596
                        Theme = new VisualStudio2013Theme(),
1597
                        Header = "Info",
1598
                        Content = "Enter the correct page number.",
1599
                    });
1600
                }
1601
                
1602
            }
1603
        }
1604
        private string previousText;
1605
        private void TlcurrentPage_PreviewTextInput(object sender, TextCompositionEventArgs e)
1606
        {
1607
            System.Text.RegularExpressions.Regex regex = new System.Text.RegularExpressions.Regex("[^0-9]+");
1608
            e.Handled = regex.IsMatch(e.Text);
1609
        }
1610
        private void TlcurrentPage_TextChanged(object sender, TextChangedEventArgs e)
1611
        {
1612
            double num = 0;
1613
            bool success = double.TryParse(((TextBox)sender).Text, out num);
1614
            if (success & num >= 0)
1615
                previousText = ((TextBox)sender).Text;
1616
            else
1617
            {
1618
                if (string.IsNullOrEmpty(((TextBox)sender).Text))
1619
                {
1620
                    ((TextBox)sender).Text = "";
1621
                }
1622
                else
1623
                {
1624

    
1625
                    ((TextBox)sender).Text = previousText;
1626
                }
1627
            }
1628
        }
1629

    
1630
        /// <summary>
1631
        /// 입력한 페이지로 이동한다
1632
        /// </summary>
1633
        /// <param name="sender"></param>
1634
        /// <param name="e"></param>
1635
        private void tlcurrentPage_readonly_KeyDown(object sender, KeyEventArgs e)
1636
        {
1637
            if (e.Key == Key.Enter)
1638
            {
1639
                try
1640
                {
1641
                    var instanceMain = this.ParentOfType<MainWindow>();
1642
                    instanceMain.dzMainMenu.pageNavigator.GotoPage(Convert.ToInt32(tlcurrentPage_readonly.Text));
1643
                }
1644
                catch (Exception)
1645
                {
1646
                    RadWindow.Alert(new DialogParameters
1647
                    {
1648
                        Owner = Application.Current.MainWindow,
1649
                        Theme = new VisualStudio2013Theme(),
1650
                        Header = "Info",
1651
                        Content = "Enter the correct page number.",
1652
                    });
1653
                }
1654
            }
1655
        }
1656
        
1657
        private void PanoramaEvent(object sender, RoutedEventArgs e)
1658
        {
1659
            PanoramaShow();
1660
        }
1661

    
1662
        public void PanoramaShow()
1663
        {
1664
            Panorama check = new Panorama();
1665
            double screenWidth = System.Windows.SystemParameters.PrimaryScreenWidth;
1666
            double screenHeight = System.Windows.SystemParameters.PrimaryScreenHeight;
1667
            //double windowWidth = this.Width;
1668
            //double windowHeight = this.Height;
1669

    
1670
            var PanoramaPop = new RadWindow
1671
            {
1672
                //MinWidth = 600,
1673
                //MinHeight = 400,
1674
                //Header = "My Check List",
1675
                Header = "Document No : " + this.ParentOfType<MainWindow>().dzMainMenu._DocItem.DOCUMENT_NO + " / Revision :" + this.ParentOfType<MainWindow>().dzMainMenu._DocItem.REVISION,
1676
                Content = check,
1677
                Owner = this,
1678
                ResizeMode = System.Windows.ResizeMode.CanResizeWithGrip,
1679
                //ResizeMode = System.Windows.ResizeMode.NoResize,
1680
                WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen,
1681
                IsTopmost = false,
1682
                //Left = (screenWidth / 2) - (windowWidth / 2),
1683
                //Top = (screenHeight / 2) - (windowHeight / 2),
1684
                //Left = (screenWidth / 2),
1685
                //Top = (screenHeight / 2),
1686
                Width = screenWidth * 0.4,
1687
                Height = screenHeight * 0.4,
1688
            };
1689
            StyleManager.SetTheme(PanoramaPop, new VisualStudio2013Theme());
1690
            //CheckPop.ShowDialog();
1691
            PanoramaPop.Owner = Application.Current.MainWindow;
1692
            PanoramaPop.Show();
1693
        }
1694

    
1695
        private void CheckEvent(object sender, RoutedEventArgs e)
1696
        {
1697
            //창이 떠있을 경우 재 실행 방지
1698
            if (isClosed)
1699
            {
1700
                //토글 및 마우스 상태 초기화
1701
                var toggleList = this.Parent.ChildrenOfType<RadToggleButton>();
1702
                foreach(var togle in toggleList)
1703
                {
1704
                    togle.IsChecked = false;
1705
                }
1706
                this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
1707

    
1708
                isClosed = false;
1709

    
1710
                
1711
                CheckList check = new CheckList(this.ParentOfType<MainWindow>());
1712

    
1713
                CheckPop = new RadWindow
1714
                {
1715
                    MinWidth = 1200,
1716
                    MinHeight = 500,
1717
                    //Header = "My Check List",
1718
                    Header = "Document No : " + this.ParentOfType<MainWindow>().dzMainMenu._DocItem.DOCUMENT_NO + " / Revision :" + this.ParentOfType<MainWindow>().dzMainMenu._DocItem.REVISION,
1719
                    Content = check,
1720
                    //Owner = this,
1721
                    //ResizeMode = System.Windows.ResizeMode.CanResizeWithGrip,
1722
                    ResizeMode = System.Windows.ResizeMode.NoResize,
1723
                    WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen,
1724
                    IsTopmost = true,
1725
                };
1726
                StyleManager.SetTheme(CheckPop, new Office2013Theme());
1727
                CheckPop.Closed += CheckPop_Closed;
1728
                
1729
                //CheckPop.ShowDialog();
1730
                CheckPop.Show();
1731
            }
1732
        }
1733

    
1734
        private void SignManagerEvent(object sender,RoutedEventArgs e)
1735
        {
1736
            SignManager signManager = new SignManager();
1737

    
1738
            RadWindow signManagerPop = new RadWindow
1739
            {
1740
                MinWidth = 1200,
1741
                MinHeight = 500,
1742
                //Header = "My Check List",
1743
                Header = "",
1744
                Content = signManager,
1745
                Owner = this,
1746
                //ResizeMode = System.Windows.ResizeMode.CanResizeWithGrip,
1747
                ResizeMode = System.Windows.ResizeMode.CanResize,
1748
                WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen,
1749
            };
1750
            StyleManager.SetTheme(signManagerPop, new Office2013Theme());
1751

    
1752
            //CheckPop.ShowDialog();
1753
            signManagerPop.ShowDialog();
1754
        }
1755

    
1756
        private void OptionPop_Closed(object sender, WindowClosedEventArgs e)
1757
        {
1758
            isClosed = true;
1759
            //this.ParentOfType<MainWindow>().dzMainMenu.PN_Navi.IsEnabled = true;
1760
            this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
1761
            ViewerDataModel.Instance.Capture_Opacity = 0;
1762
        }
1763

    
1764
        private void CheckPop_Closed(object sender, WindowClosedEventArgs e)
1765
        {
1766
            isClosed = true;
1767
            //this.ParentOfType<MainWindow>().dzMainMenu.PN_Navi.IsEnabled = true;
1768
            this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
1769
            ViewerDataModel.Instance.Capture_Opacity = 0;
1770
        }
1771

    
1772
        /// <summary>
1773
        /// 사용자가 선택한 페이지로 이동(썸네일 동기화 시킴)
1774
        /// </summary>
1775
        /// <param name="sender"></param>
1776
        /// <param name="e"></param>
1777
        private void PageGoEvent(object sender, RoutedEventArgs e)
1778
        {
1779
            RadButton button = sender as RadButton;
1780
            var instanceMain = this.ParentOfType<MainWindow>();
1781
            
1782
            //강인구 추가 tlcurrentPage을 이상하게 입력할수 있기때문에 Try Catch
1783
            try
1784
            {
1785
                switch (button.CommandParameter.ToString())
1786
                {
1787
                    case "Down":
1788
                        {
1789
                            instanceMain.dzMainMenu.pageNavigator.GotoPage(Convert.ToInt32(tlcurrentPage.Text) + 1);
1790
                        }
1791
                        break;
1792
                    case "Up":
1793
                        {
1794
                            instanceMain.dzMainMenu.pageNavigator.GotoPage(Convert.ToInt32(tlcurrentPage.Text) - 1);
1795
                        }
1796
                        break;
1797
                }
1798
            }
1799
            catch (Exception)
1800
            {
1801
                RadWindow.Alert(new DialogParameters
1802
                {
1803
                    Owner = Application.Current.MainWindow,
1804
                    Theme = new VisualStudio2013Theme(),
1805
                    Header = "Info",
1806
                    Content = "Enter the correct page number.",
1807
                });
1808
            }
1809
        }
1810

    
1811
        private void viewEvent(object sender, RoutedEventArgs e)
1812
        {
1813
            RadRibbonToggleButton viewButton = sender as RadRibbonToggleButton;
1814
            var instanceMain = this.ParentOfType<MainWindow>();
1815

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

    
1818
            //if ((sender as RadRibbonToggleButton) != null)
1819
            //{
1820
            //    Common.ViewerDataModel.Instance.ControlTag = (sender as RadRibbonToggleButton).Tag.ToString();
1821
            //    instanceToggle = (sender as RadRibbonToggleButton);
1822
            //}
1823

    
1824
            //instanceToggle.IsChecked = false;
1825

    
1826
            switch (viewButton.CommandParameter.ToString())
1827
            {
1828
                case "zoomout":
1829
                    {
1830
                        //장원
1831
                        //instanceMain.dzMainMenu.zoomAndPanControl.ZoomTo(new Rect(0, 0, instanceMain.dzMainMenu.zoomAndPanCanvas.ActualWidth, instanceMain.dzMainMenu.zoomAndPanCanvas.ActualHeight));
1832
                        instanceMain.dzMainMenu.zoomAndPanControl.ZoomPointToViewportCenter(ViewerDataModel.Instance.ContentScale -= 0.1, point);
1833
                        viewButton.IsChecked = false;
1834
                        //Common.ViewerDataModel.Instance.zom
1835
                    }
1836
                    break;
1837
                case "zoomin":
1838
                    {
1839
                        instanceMain.dzMainMenu.zoomAndPanControl.ZoomPointToViewportCenter(ViewerDataModel.Instance.ContentScale += 0.1, point);
1840
                        viewButton.IsChecked = false;
1841
                    }
1842
                    break;
1843
                case "fullscreen":
1844
                    {
1845
                        instanceMain.WindowStyle = WindowStyle.None;
1846
                        instanceMain.WindowState = WindowState.Maximized;
1847
                        instanceMain.dzMainMenu.zoomAndPanControl.ScaleToFit();
1848
                        viewButton.IsChecked = false;
1849
                    }
1850
                    break;
1851
                case "fitWidth":
1852
                    {
1853
                        instanceMain.dzMainMenu.zoomAndPanControl.ScaleToFit();
1854
                        viewButton.IsChecked = false;
1855
                    }
1856
                    break;
1857
                case "fitHeight":
1858
                    {
1859
                        instanceMain.dzMainMenu.zoomAndPanControl.ScaleToFit();
1860
                        viewButton.IsChecked = false;
1861
                    }
1862
                    break;
1863
                case "boundzoom":
1864
                    {
1865

    
1866
                    }
1867
                    break;
1868
                case "Rotate_M":
1869
                    {
1870
                        drawingPannelRotate(false);
1871
                        viewButton.IsChecked = false;
1872
                    }
1873
                    break;
1874
                case "Rotate_P":
1875
                    {
1876
                        drawingPannelRotate(true);
1877
                        viewButton.IsChecked = false;
1878
                    }
1879
                    break;
1880
                case "Rotate_half":
1881
                    {
1882
                        drawingPannelRotate(true);
1883
                        drawingPannelRotate(true);
1884
                        viewButton.IsChecked = false;
1885
                    }
1886
                    break;
1887
            }
1888
        }
1889

    
1890
        private void Control_Event(object sender, RoutedEventArgs e)
1891
        {
1892

    
1893
        }
1894

    
1895
        #region 대기
1896

    
1897
        public void drawingPannelRotate(bool Flag)
1898
        {
1899
            var instanceMain = this.ParentOfType<MainWindow>();
1900

    
1901
            //if (rotateOffSet > 3)
1902
            //    rotateOffSet = 0;
1903

    
1904
            //if (rotateOffSet < 0)
1905
            //    rotateOffSet = 3;
1906

    
1907
            if(Flag)
1908
            {
1909
                if (instanceMain.dzMainMenu.rotate.Angle == 270)
1910
                {
1911
                    instanceMain.dzMainMenu.rotate.Angle = 0;
1912
                }
1913
                else
1914
                {
1915
                    instanceMain.dzMainMenu.rotate.Angle += 90;
1916
                }
1917
            }
1918
            else
1919
            {
1920
                if(instanceMain.dzMainMenu.rotate.Angle == 0)
1921
                {
1922
                    instanceMain.dzMainMenu.rotate.Angle = 270;
1923
                }
1924
                else
1925
                {
1926
                    instanceMain.dzMainMenu.rotate.Angle -= 90;
1927
                }
1928
            }
1929
            //double angle = (double)rotateValue.GetValue(rotateOffSet);
1930
            //instanceMain.dzMainMenu.rotate.Angle = angle;
1931
            var rotationNum = Math.Abs((instanceMain.dzMainMenu.rotate.Angle / 90));
1932

    
1933
            if (instanceMain.dzMainMenu.zoomAndPanCanvas.Width == ViewerDataModel.Instance.ContentWidth)
1934
            {
1935
                double emptySize = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
1936
                instanceMain.dzMainMenu.zoomAndPanCanvas.Width = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
1937
                instanceMain.dzMainMenu.zoomAndPanCanvas.Height = emptySize;
1938
            }
1939
            if (instanceMain.dzMainMenu.rotate.Angle == 0)
1940
            {
1941
                instanceMain.dzMainMenu.translate.X = 0;
1942
                instanceMain.dzMainMenu.translate.Y = 0;
1943
            }
1944
            else if (instanceMain.dzMainMenu.rotate.Angle == 90)
1945
            {
1946
                instanceMain.dzMainMenu.translate.X = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
1947
                instanceMain.dzMainMenu.translate.Y = 0;
1948
            }
1949
            else if (instanceMain.dzMainMenu.rotate.Angle == 180)
1950
            {
1951
                instanceMain.dzMainMenu.translate.X = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
1952
                instanceMain.dzMainMenu.translate.Y = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
1953
            }
1954
            else
1955
            {
1956
                instanceMain.dzMainMenu.translate.X = 0;
1957
                instanceMain.dzMainMenu.translate.Y = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
1958
            }
1959

    
1960
            //instanceMain.dzMainMenu.zoomAndPanControl.RenderTransformOrigin = new Point(0.5, 0.5);
1961
            instanceMain.dzMainMenu.zoomAndPanControl.RotationAngle = instanceMain.dzMainMenu.rotate.Angle;
1962
            //대기(강인구)
1963
            //instanceMain.dzMainMenu.imageViewer.RotateAngle = instanceMain.dzMainMenu.rotate.Angle;
1964

    
1965

    
1966
            //instanceMain.dzMainMenu.imageViewer.RenderTransformOrigin = new Point(0.5, 0.5);
1967
            //RotateTransform rotateTransform = new RotateTransform(instanceMain.dzMainMenu.rotate.Angle);
1968
            //instanceMain.dzMainMenu.imageViewer.RenderTransform = rotateTransform;
1969

    
1970

    
1971
            ViewerDataModel.Instance.ContentWidth = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
1972
            ViewerDataModel.Instance.ContentHeight = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
1973
            ViewerDataModel.Instance.AngleOffsetX = instanceMain.dzMainMenu.translate.X;
1974
            ViewerDataModel.Instance.AngleOffsetY = instanceMain.dzMainMenu.translate.Y;
1975
            ViewerDataModel.Instance.PageAngle = instanceMain.dzMainMenu.rotate.Angle;
1976
            //ViewerDataModel.Instance.Document_Info.Clear();
1977
            //ViewerDataModel.Instance.Document_Info.Where(i => i.PAGE_NUMBER == instanceMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber).ToList().ForEach(value =>
1978
            //{
1979
            //    value.PAGE_ANGLE = int.Parse(instanceMain.dzMainMenu.rotate.Angle.ToString());
1980
            //});
1981

    
1982

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

    
1986
            foreach (var data in thumbnaillist)
1987
            {
1988
                data.Angle = int.Parse(instanceMain.dzMainMenu.rotate.Angle.ToString());
1989

    
1990
                //instanceMain.dzMainMenu.pageNavigator.ImgListbox.ItemsSource = instanceMain.dzMainMenu.pageNavigator._thumbnailItems;
1991
                var instance = instanceMain.dzMainMenu.CurrentDoc.docInfo.DOCPAGE.Where(p => p.PAGE_NUMBER == instanceMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber).FirstOrDefault();
1992
                instance.PAGE_ANGLE = int.Parse(instanceMain.dzMainMenu.rotate.Angle.ToString());
1993

    
1994
                instanceMain.dzMainMenu.pageNavigator.GotoPage(data.PageNumber);
1995

    
1996
                //rotation page add or update
1997
                var rotationdoc = ViewerDataModel.Instance.RotationDocs.Where(d => d.ID == instance.ID).FirstOrDefault();
1998
                if (rotationdoc != null)
1999
                {
2000
                    rotationdoc.PAGE_ANGLE = instance.PAGE_ANGLE;
2001
                }
2002
                else
2003
                {
2004
                    ViewerDataModel.Instance.RotationDocs.Add(instance);
2005
                }
2006
            }
2007
        }
2008
        #endregion
2009

    
2010
        private void ImageConverter(RadToggleButton instanceToggle)
2011
        {
2012
            try
2013
            {           
2014
                var instanceMain = this.ParentOfType<MainWindow>();
2015

    
2016
                Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
2017
                dlg.Filter = "All files (*.*)|*.*|PNG Images (*.png)|*.png";
2018
                Nullable<bool> result = dlg.ShowDialog();
2019
                if (result == true)
2020
                {
2021
                    instanceMain.dzMainMenu.filename = dlg.FileName;
2022
                    instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ImgControl;
2023

    
2024
                    System.IO.FileInfo fileInfo = new System.IO.FileInfo(instanceMain.dzMainMenu.filename);
2025
                    String strFile = System.IO.Path.GetFileName(instanceMain.dzMainMenu.filename);
2026
                    long numByte = fileInfo.Length;
2027
                    double dLen = Convert.ToDouble(fileInfo.Length / 1000000);
2028
                    kr.co.devdoftech.cloud.FileUpload fileUploader = App.FileUploader;
2029
             
2030
                    if (dLen < 4)
2031
                    {
2032
                        System.IO.FileStream fStream = new System.IO.FileStream(instanceMain.dzMainMenu.filename, System.IO.FileMode.Open, System.IO.FileAccess.Read);
2033
                        System.IO.BinaryReader br = new System.IO.BinaryReader(fStream);
2034
                        byte[] data = br.ReadBytes((int)numByte);
2035
                        br.Close();
2036

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

    
2039
                        Check_Uri.UriCheck(filepath);
2040

    
2041
                        instanceMain.dzMainMenu.filename = filepath;
2042

    
2043
                        fStream.Close();
2044
                        fStream.Dispose();
2045
                    }
2046
                    else
2047
                    {
2048
                        this.ParentOfType<MainWindow>().DialogMessage_Alert("Available Memory less than 4 mega byte", "Alert");
2049
                    }
2050
                }
2051
                else
2052
                {
2053
                    instanceToggle.IsChecked = false;
2054
                    Common.ViewerDataModel.Instance.SelectedControl = "";
2055
                    Common.ViewerDataModel.Instance.ControlTag = null;
2056
                    this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2057
                    this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2058
                    this.ParentOfType<MainWindow>().DialogMessage_Alert("No Image selected.", "Alert");
2059
                }
2060
            }
2061
            catch(Exception ex)
2062
            {
2063
                instanceToggle.IsChecked = false;
2064
                Common.ViewerDataModel.Instance.SelectedControl = "";
2065
                Common.ViewerDataModel.Instance.ControlTag = null;
2066
                this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2067
                this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2068
                App.FileLogger.Error("Image Converter ",ex);
2069

    
2070
                this.ParentOfType<MainWindow>().DialogMessage_Alert(ex.Message, "Alert");
2071
            }
2072
        }
2073

    
2074
        private void Control_Init(RadToggleButton instanceToggle, object sender)
2075
        {
2076

    
2077
        }
2078

    
2079
        private void ControlEvent(object sender, RoutedEventArgs e)
2080
        {
2081
            RadToggleButton instanceToggle = sender as RadToggleButton;
2082
            var instanceMain = this.ParentOfType<MainWindow>();
2083

    
2084
            #region Ctrl + A 눌렀을 때 대처 방법 
2085
            //원인 : Ctrl + A를 누르면 UIElementSet에 등록을 시키지 않는다(이유는 한꺼번에 많은 양의 컨트롤의 동작이 유입되기 때문에
2086
            //       시스템의 성능저하를 불러올 수 있기 때문이다. 그래서 선택 후 다른 컨트롤을 누르면 등록되지 않은 컨트롤이기 때문에 삭제된다
2087
            //       이를 대처하는 방법으로 아래 코드를 사용한다.
2088
            if (Common.ViewerDataModel.Instance.MarkupControls.Count == 0 && Common.ViewerDataModel.Instance.MarkupControls.Count >= 1)
2089
            {
2090
                //var lstItem = instanceMain.DeepLayer._SelectLayer.ChildrenOfType<AdornerFinal>().ToList();
2091
                //foreach (var item in lstItem)
2092
                //{
2093
                //    foreach (var member in item.MemberSet)
2094
                //    {
2095
                //        if (!instanceMain.DeepLayer.UIElementSet.Contains(member.DrawingData))
2096
                //        {
2097
                //            instanceMain.DeepLayer.UIElementSet.Add(member.DrawingData);
2098
                //        }
2099
                //    }
2100
                //}
2101
            }
2102
            #endregion
2103

    
2104
            //if (!instanceMain.IsFreeSelectionMode)
2105
            //{
2106
            //    instanceMain.IsSwingMode = true;
2107
            //}
2108

    
2109
            //#region 다른 컨트롤 버튼 선택 해제
2110
            //System.Reactive.Linq.Observable2.FromPropertyChangedPattern(Common.ViewerDataModel.Instance, temp => temp.SelectedControl).Subscribe(ControlState =>
2111
            //{
2112
            //    if (ControlState == null)
2113
            //    {
2114
            //        instanceToggle.IsChecked = false;
2115
            //        HiddenControlHide();
2116
            //    }
2117
            //});
2118
            //#endregion
2119

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

    
2122
            if (instanceToggle != null)
2123
            {
2124
                Common.ViewerDataModel.Instance.ControlTag = instanceToggle.Tag.ToString();
2125
            }
2126
            else if ((sender as RadRibbonToggleButton) != null)
2127
            {
2128
                Common.ViewerDataModel.Instance.ControlTag = (sender as RadRibbonToggleButton).Tag.ToString();
2129
                instanceToggle = (sender as RadRibbonToggleButton);
2130
            }
2131
            else if ((sender as RadRibbonButton) != null)
2132
            {
2133
                RadRibbonButton instanceButton = sender as RadRibbonButton;
2134
                Common.ViewerDataModel.Instance.ControlTag = instanceButton.Tag.ToString();
2135
            }
2136
            else
2137
            {
2138
                RadButton instanceButton = sender as RadButton;
2139
                Common.ViewerDataModel.Instance.ControlTag = instanceButton.Tag.ToString();
2140
            }
2141

    
2142

    
2143
            //System.Reactive.Linq.Observable2.FromPropertyChangedPattern(Common.ViewerDataModel.Instance, temp => temp.AngleVisibility).Subscribe(isSee =>
2144
            //{
2145
            //    if (instanceToggle.CommandParameter.ToString() == "ChainLine")
2146
            //    {
2147

    
2148
            //    }
2149
            //    else
2150
            //    {
2151
            //        System.Diagnostics.Debug.WriteLine(" instanceMain.dzMainMenu.MainAngle.Visibility   " + isSee);
2152

    
2153
            //        if (instanceMain.dzMainMenu.MainAngle.Visibility != isSee)
2154
            //        {
2155
            //            instanceMain.dzMainMenu.MainAngle.Visibility = isSee;
2156
            //        }
2157
            //    }
2158
            //    //System.Reactive.Linq.Observable2.FromPropertyChangedPattern(Common.ViewerDataModel.Instance, temp => temp.AngleValue).Subscribe(p =>
2159
            //    //{
2160
            //    //    instanceMain.dzMainMenu.MainAngle.AngleValue = p;
2161
            //    //});
2162
            //});
2163

    
2164
            instanceMain.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Drawing;
2165

    
2166
            instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = false;
2167

    
2168
            if (instanceToggle.IsChecked != false)
2169
            {
2170
                string param = instanceToggle.CommandParameter.ToString();
2171
                string MacroIndex = "";
2172

    
2173
                if (param.StartsWith("MACRO"))
2174
                {
2175
                    param = "MACRO";
2176
                    MacroIndex = param.Replace("MACRO;","");
2177

    
2178
                    //Common.ViewerDataModel.Instance.MacroItems = MacroHelper.LoadMacroItems(MacroIndex);
2179
                    //var items = MacroHelper.TopMenuItems();
2180

    
2181
                    Common.ViewerDataModel.Instance.MacroItems = new List<MacroItem>
2182
                    {
2183
                        new MacroItem
2184
                        {
2185
                            Desc = "Cloud Rectangle",
2186
                            ControlType = MarkupToPDF.Controls.Common.ControlType.RectCloud
2187
                        },
2188
                        new MacroItem
2189
                        {
2190
                             Desc = "Arrow TextBox",
2191
                            ControlType = MarkupToPDF.Controls.Common.ControlType.ArrowTextBorderControl
2192
                        }
2193
                    };
2194
                }
2195

    
2196
                #region 컨트롤이 체크되었다면
2197
                switch (param)
2198
                {
2199
                    #region Line
2200
                    case "Line":
2201
                        Common.ViewerDataModel.Instance.SelectedControl = "Line";
2202
                        //HiddenAxisLock.Visibility = Visibility.Visible;
2203
                        if (instanceToggle.Tag.ToString() == "LineDelete")
2204
                        {
2205
                            //HiddenInterval.Visibility = Visibility.Visible;
2206
                        }
2207
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.SingleLine;
2208
                        break;
2209
                    #endregion
2210
                    #region ChainLine
2211
                    case "ChainLine":
2212
                        Common.ViewerDataModel.Instance.SelectedControl = "ChainLine";
2213
                        //HiddenAxisLock.Visibility = Visibility.Visible;
2214
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ChainLine;
2215
                        break;
2216
                    #endregion
2217
                    #region DimLine
2218
                    case "DimLine":
2219
                        Common.ViewerDataModel.Instance.SelectedControl = "DimLine";
2220
                        //HiddenAxisLock.Visibility = Visibility.Visible;
2221
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.DimLine;
2222
                        break;
2223
                    #endregion
2224
                    #region TwinLine
2225
                    case "TwinLine":
2226
                        Common.ViewerDataModel.Instance.SelectedControl = "TwinLine";
2227
                        //HiddenAxisLock.Visibility = Visibility.Visible;
2228
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.TwinLine;
2229
                        break;
2230
                    #endregion
2231
                    #region CancelLine
2232
                    case "CancelLine":
2233
                        Common.ViewerDataModel.Instance.SelectedControl = "CancelLine";
2234
                        //HiddenAxisLock.Visibility = Visibility.Visible;
2235
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.CancelLine;
2236
                        break;
2237
                    #endregion
2238
                    #region PolygonCloud
2239
                    case "PolygonCloud":
2240
                        Common.ViewerDataModel.Instance.SelectedControl = "PolygonCloud";
2241
                        //HiddenAxisLock.Visibility = Visibility.Visible;
2242
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.PolygonCloud;
2243
                        break;
2244
                    #endregion
2245
                    #region RectCloud
2246
                    case "RectCloud":
2247
                        Common.ViewerDataModel.Instance.SelectedControl = "RectCloud";
2248
                        //HiddenAxisLock.Visibility = Visibility.Visible;
2249
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.RectCloud;
2250
                        break;
2251
                    #endregion
2252
                    #region Rectangle
2253
                    case "Rectangle":
2254
                        Common.ViewerDataModel.Instance.SelectedControl = "Rectangle";
2255
                        //HiddenAxisLock.Visibility = Visibility.Visible;
2256
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Rectangle;
2257
                        break;
2258
                    #endregion
2259
                    #region Triangle
2260
                    case "Triangle":
2261
                        Common.ViewerDataModel.Instance.SelectedControl = "Triangle";
2262
                        //HiddenAxisLock.Visibility = Visibility.Visible;
2263
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Triangle;
2264
                        break;
2265
                    #endregion
2266
                    #region RectCloud
2267
                    case "Circle":
2268
                        Common.ViewerDataModel.Instance.SelectedControl = "Circle";
2269
                        //HiddenAxisLock.Visibility = Visibility.Visible;
2270
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Circle;
2271
                        break;
2272
                    #endregion
2273
                    #region Symbol
2274
                    case "Symbol":
2275
                        Common.ViewerDataModel.Instance.SelectedControl = "Symbol";
2276
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2277
                        break;
2278
                    #endregion
2279
                    #region SymbolN
2280
                    case "SymbolN":
2281
                        Common.ViewerDataModel.Instance.SelectedControl = "SymbolN";
2282
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Stamp;
2283
                        break;
2284
                    #endregion
2285
                    #region Text
2286
                    case "Text":
2287
                        Common.ViewerDataModel.Instance.SelectedControl = "Text";
2288
                        TaskMessage("Text 도구는 텍스트 영역을 더블 클릭하여 텍스트를 재 편집 할 수 있습니다", TaskMessageType.Normal);
2289
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.TextControl;
2290
                        break;
2291
                    #endregion
2292
                    #region TextBorder
2293
                    case "TextBorder":
2294
                        Common.ViewerDataModel.Instance.SelectedControl = "TextBorder";
2295
                        TaskMessage("Text 도구는 텍스트 영역을 더블 클릭하여 텍스트를 재 편집 할 수 있습니다", TaskMessageType.Normal);
2296
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.TextBorder;
2297
                        break;
2298
                    #endregion
2299
                    #region TextCloud
2300
                    case "TextCloud":
2301
                        Common.ViewerDataModel.Instance.SelectedControl = "TextCloud";
2302
                        TaskMessage("Text 도구는 텍스트 영역을 더블 클릭하여 텍스트를 재 편집 할 수 있습니다", TaskMessageType.Normal);
2303
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.TextCloud;
2304
                        break;
2305
                    #endregion
2306
                    #region Date
2307
                    case "Date":
2308
                        Common.ViewerDataModel.Instance.SelectedControl = "Date";
2309
                        TaskMessage("날짜 컨트롤을 더블 클릭하면 날짜를 변경할 수 있습니다", TaskMessageType.Normal);
2310
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Date;
2311
                        break;
2312
                    #endregion
2313
                    #region ArrowText
2314
                    case "ArrowText":
2315
                        TaskMessage("ArrowText 컨트롤은 그린 후 컨트롤을 선택하였을 시 중간점을 조정할 수 있습니다", TaskMessageType.Normal);
2316
                        if (instanceToggle.Tag.ToString() == "ArrowText_Cloud")
2317
                        {
2318
                            Common.ViewerDataModel.Instance.SelectedControl = "ArrowText_Cloud";
2319
                            instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowTextCloudControl;
2320
                        }
2321
                        else if (instanceToggle.Tag.ToString() == "ArrowText_Border")
2322
                        {
2323
                            Common.ViewerDataModel.Instance.SelectedControl = "ArrowTextBorderControl";
2324
                            instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowTextBorderControl;
2325
                        }
2326
                        else if (instanceToggle.Tag.ToString() == "ArrowTextFix_Normal")
2327
                        {
2328
                            Common.ViewerDataModel.Instance.SelectedControl = "ArrowTransTextControl";
2329
                            instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowTransTextControl;
2330
                        }
2331
                        else if (instanceToggle.Tag.ToString() == "ArrowTextFix_Border")
2332
                        {
2333
                            Common.ViewerDataModel.Instance.SelectedControl = "ArrowTransTextBorderControl";
2334
                            instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowTransTextBorderControl;
2335
                        }
2336
                        else if (instanceToggle.Tag.ToString() == "ArrowTextFix_Cloud")
2337
                        {
2338
                            Common.ViewerDataModel.Instance.SelectedControl = "ArrowTransTextCloudControl";
2339
                            instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowTransTextCloudControl;
2340
                        }
2341
                        else
2342
                        {
2343
                            Common.ViewerDataModel.Instance.SelectedControl = "ArrowText";
2344
                            instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowTextControl;
2345
                            //HiddenAxisLock.Visibility = Visibility.Visible;
2346
                        }
2347
                        break;
2348
                    #endregion
2349
                    #region Arrow
2350
                    case "Arrow":
2351
                        Common.ViewerDataModel.Instance.SelectedControl = "Arrow";
2352
                        //HiddenAxisLock.Visibility = Visibility.Visible;
2353
                        //HiddenDimSize.Visibility = Visibility.Visible;
2354
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowLine;
2355
                        break;
2356
                    #endregion
2357
                    #region Shape
2358
                    case "Shape":
2359
                        Common.ViewerDataModel.Instance.SelectedControl = "Shape";
2360
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Mark;
2361
                        break;
2362
                    #endregion
2363
                    #region Polygon
2364
                    case "Polygon":
2365
                        Common.ViewerDataModel.Instance.SelectedControl = "Polygon";
2366
                        TaskMessage("자유형 코멘트 도구는 오른쪽 마우스 클릭을 통해 그리기를 마칠 수 있습니다", TaskMessageType.Normal);
2367
                        //HiddenAxisLock.Visibility = Visibility.Visible;
2368
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.PolygonControl;
2369
                        break;
2370
                    #endregion
2371
                    #region Arc
2372
                    case "Arc":
2373
                        Common.ViewerDataModel.Instance.SelectedControl = "Arc";
2374
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArcLine;
2375
                        //HiddenAxisLock.Visibility = Visibility.Visible;
2376
                        TaskMessage("Arc 코멘트 도구는 오른쪽 마우스를 사용해 좌우 반전을 사용하실 수 있습니다", TaskMessageType.Normal);
2377
                        break;
2378
                    #endregion
2379
                    #region ArrowArc
2380
                    case "ArrowArc":
2381
                        Common.ViewerDataModel.Instance.SelectedControl = "ArrowArc";
2382
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArcArrow;
2383
                        //HiddenAxisLock.Visibility = Visibility.Visible;
2384
                        TaskMessage("ArcArrow 코멘트 도구는 오른쪽 마우스를 사용해 좌우 반전을 사용하실 수 있습니다", TaskMessageType.Normal);
2385
                        break;
2386
                    #endregion
2387
                    #region ArrowMulti
2388
                    case "ArrowMulti":
2389
                        Common.ViewerDataModel.Instance.SelectedControl = "ArrowMulti";
2390
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowMultiLine;
2391
                        //HiddenAxisLock.Visibility = Visibility.Visible;
2392
                        break;
2393
                    #endregion
2394
                    #region Etc
2395
                    case "Etc":
2396
                        Common.ViewerDataModel.Instance.SelectedControl = "Etc";
2397
                        break;
2398
                    #endregion
2399
                    #region Ink
2400
                    case "Ink":
2401
                        if (instanceToggle.Tag.ToString() == "EraserClear")
2402
                        {
2403
                            TaskMessage("해당 컨트롤은 점 단위로 그려진 펜을 지웁니다", TaskMessageType.Normal);
2404
                            //instanceMain.dzMainMenu.inkDrawingCanvas.EditingMode = InkCanvasEditingMode.EraseByPoint;
2405
                            instanceMain.dzMainMenu.inkBoard.Tag = "EraseByPoint";
2406
                        }
2407
                        else if (instanceToggle.Tag.ToString() == "Eraser")
2408
                        {
2409
                            TaskMessage("해당 컨트롤은 선 단위로 그려진 펜을 지웁니다", TaskMessageType.Normal);
2410
                            instanceMain.dzMainMenu.inkBoard.Tag = "EraseByStroke";
2411
                            //instanceMain.dzMainMenu.inkDrawingCanvas.EditingMode = InkCanvasEditingMode.EraseByStroke;
2412
                        }
2413
                        else
2414
                        {
2415
                            instanceMain.dzMainMenu.inkBoard.Tag = "Ink";
2416
                            //instanceMain.dzMainMenu.inkDrawingCanvas.EditingMode = InkCanvasEditingMode.Ink;
2417
                        }
2418

    
2419
                        //instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = true;
2420

    
2421
                        Common.ViewerDataModel.Instance.SelectedControl = "Ink";
2422
                        Common.ViewerDataModel.Instance.LineSize = (double)cbLineSize.Value;
2423
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.PenControl;
2424
                        break;
2425
                    #endregion
2426
                    #region Select
2427
                    case "Select":
2428
                        if (this.ParentOfType<MainWindow>().dzMainMenu.currentControl != null)
2429
                        {
2430
                            if (this.ParentOfType<MainWindow>().dzMainMenu.currentControl is MarkupToPDF.Controls.Text.TextControl
2431
                                && !string.IsNullOrEmpty(((MarkupToPDF.Controls.Text.TextControl)this.ParentOfType<MainWindow>().dzMainMenu.currentControl).Text))
2432
                            {
2433
                                DependencyObject focusScope1 = FocusManager.GetFocusScope((MarkupToPDF.Controls.Text.TextControl)this.ParentOfType<MainWindow>().dzMainMenu.currentControl);
2434
                                FocusManager.SetFocusedElement(focusScope1, (MarkupToPDF.Controls.Text.TextControl)this.ParentOfType<MainWindow>().dzMainMenu.currentControl);
2435

    
2436
                                this.ParentOfType<MainWindow>().dzMainMenu.currentControl = null;
2437
                                Keyboard.ClearFocus();
2438

    
2439
                            }
2440
                            else
2441
                            {
2442
                                ViewerDataModel.Instance.MarkupControls_USER.Remove(this.ParentOfType<MainWindow>().dzMainMenu.currentControl);
2443
                                this.ParentOfType<MainWindow>().dzMainMenu.currentControl = null;
2444
                            }
2445
                        }
2446

    
2447
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Selecting;
2448
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2449
                        instanceMain.dzMainMenu.isLeftMouseButtonDownOnWindow = false;
2450
                        break;
2451
                    #endregion
2452
                    #region Image
2453
                    case "Image":
2454
                        Common.ViewerDataModel.Instance.SelectedControl = "ImgControl";
2455
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ImgControl;
2456
                        ImageConverter(instanceToggle);
2457
                        break;
2458
                    #endregion
2459
                    #region Sign
2460
                    case "Sign":
2461
                        Common.ViewerDataModel.Instance.SelectedControl = "Sign";
2462
                        Common.ViewerDataModel.Instance.ControlTag = instanceMain.dzMainMenu._ViewInfo.UserID; //사번
2463
                        //강인구 추가
2464
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Sign;
2465
                        //instanceMain.BaseClient.GetUserSignCompleted += (sen, ea) =>
2466
                        //{
2467
                        //    if (ea.Result == null)
2468
                        //    {
2469

    
2470
                        //        this.ParentOfType<MainPage>().DialogMessage_Alert("You Don't Have Sign Data", "Alert");
2471
                        //    }
2472
                        //    else
2473
                        //    {
2474
                        //        byte[] imageBytes = System.Convert.FromBase64String(ea.Result);
2475
                        //        using (MemoryStream ms = new MemoryStream(imageBytes))
2476
                        //        {
2477
                        //            BitmapImage im = new BitmapImage();
2478
                        //            im.SetSource(ms);
2479
                        //            instanceMain.DeepLayer.SignImage = im;
2480
                        //            ms.Close();
2481
                        //        }
2482
                        //    }
2483
                        //};
2484
                        //instanceMain.BaseClient.GetUserSignAsync(instanceMain._ViewInfo.UserID);
2485
                        break;
2486
                    #endregion
2487
                    #region Check
2488
                    case "Check":
2489
                        Common.ViewerDataModel.Instance.SelectedControl = "Check";
2490
                        Common.ViewerDataModel.Instance.ControlTag = instanceMain.dzMainMenu._ViewInfo.UserID; //사번
2491
                        //강인구 추가
2492
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Symbol;
2493
                        break;
2494
                    #endregion
2495
                    #region Batch
2496
                    case "Batch":
2497
                        Common.ViewerDataModel.Instance.SelectedControl = "Batch";
2498
                        Common.ViewerDataModel.Instance.ControlTag = instanceMain.dzMainMenu._ViewInfo.UserID; //사번
2499
                        //강인구 추가
2500
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Mark;
2501
                        instanceMain.dzMainMenu.txtBatch.Visibility = Visibility.Visible;
2502
                        instanceMain.dzMainMenu.txtBatch.Text = "Place Mark";
2503
                        break;
2504
                    #endregion
2505

    
2506
                    #region MACRO -MACRO1
2507
                    case "MACRO":
2508
                        Common.ViewerDataModel.Instance.SelectedControl = "MACRO";
2509
                        Common.ViewerDataModel.Instance.ControlTag = instanceMain.dzMainMenu._ViewInfo.UserID; //사번
2510

    
2511
                        MacroHelper.MacroAction();
2512

    
2513
                        break;
2514
                    #endregion
2515

    
2516
                    #region Copy
2517
                    case "Copy":
2518
                        CopyCommand.Instance.Execute();
2519
                        //Copy_Start();
2520
                        instanceToggle.IsChecked = false;
2521
                        ViewerDataModel.Instance.SelectedControl = "";
2522
                        ViewerDataModel.Instance.ControlTag = null;
2523
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2524
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2525
                        break;
2526
                    #endregion
2527
                    #region Cut
2528
                    case "Cut":
2529
                        //Cut_Start();
2530
                        CutCommand.Instance.Execute();
2531
                        instanceToggle.IsChecked = false;
2532
                        ViewerDataModel.Instance.SelectedControl = "";
2533
                        ViewerDataModel.Instance.ControlTag = null;
2534
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2535
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2536
                        break;
2537
                    #endregion
2538
                    #region Paste
2539
                    case "Paste":
2540
                        PasteCommand.Instance.Execute();
2541
                        //Paste_Start();
2542
                        instanceToggle.IsChecked = false;
2543
                        ViewerDataModel.Instance.SelectedControl = "";
2544
                        ViewerDataModel.Instance.ControlTag = null;
2545
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2546
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;                        
2547
                        break;
2548
                    #endregion
2549
                    #region Delete
2550
                    case "Delete":
2551
                        DeleteCommand.Instance.Execute(SelectionSet.Instance.SelectedItems);
2552
                        this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Clear();
2553

    
2554
                        instanceToggle.IsChecked = false;
2555
                        ViewerDataModel.Instance.SelectedControl = "";
2556
                        ViewerDataModel.Instance.ControlTag = null;
2557
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2558
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2559
                        break;
2560
                    #endregion
2561
                    #region Undo
2562
                    case "Undo":
2563
                        UndoCommand.Instance.Execute();
2564
                        instanceToggle.IsChecked = false;
2565
                        ViewerDataModel.Instance.SelectedControl = "";
2566
                        ViewerDataModel.Instance.ControlTag = null;
2567
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2568
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2569
                        break;
2570
                    #endregion
2571
                    #region Redo
2572
                    case "Redo":
2573
                        RedoCommand.Instance.Execute();
2574
                        instanceToggle.IsChecked = false;
2575
                        ViewerDataModel.Instance.SelectedControl = "";
2576
                        ViewerDataModel.Instance.ControlTag = null;
2577
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2578
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2579
                        break;
2580
                    #endregion
2581
                    #region DragZoom
2582
                    case "DragZoom":
2583
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.DragZoom;
2584
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2585
                        instanceMain.dzMainMenu.isLeftMouseButtonDownOnWindow = false;
2586
                        break;
2587
                    #endregion
2588
                    #region Grouping
2589
                    case "Group":
2590
                        //var GrouptoggleList = this.Parent.ChildrenOfType<RadRibbonToggleButton>();
2591
                        //foreach (var togle in GrouptoggleList)
2592
                        //{
2593
                        //    togle.IsChecked = false;
2594
                        //}
2595

    
2596
                        //if (this.ParentOfType<MainWindow>().dzMainMenu.currentControl != null)
2597
                        //{
2598
                        //    ViewerDataModel.Instance.MarkupControls_USER.Remove(this.ParentOfType<MainWindow>().dzMainMenu.currentControl);
2599
                        //    this.ParentOfType<MainWindow>().dzMainMenu.currentControl = null;
2600
                        //}
2601
                        //this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2602
                        //instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2603
                        //instanceMain.dzMainMenu.isLeftMouseButtonDownOnWindow = false;
2604
                        //if (ViewerDataModel.Instance.SystemMain.dzMainMenu.SelectLayer.Children.Count < 1) //선택된 것이 없으면
2605
                        //{
2606
                        //    this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert("Please Select Controls", "Alert");
2607
                        //}
2608
                        //else//if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
2609
                        //{
2610
                        //    // string MarkupData = "";
2611
                        //    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
2612
                        //    {
2613
                        //        if (item.GetType().Name == "AdornerFinal" && (item as AdornerFinal).MemberSet.Count >= 2) // 얘가 2개 이상이여야 그룹가능 버튼도 막을거긴하지만 일단..
2614
                        //        {
2615
                        //            //MARKUP_DATA_GROUP INSERT
2616
                        //            MARKUP_DATA_GROUP mARKUP_DATA_GROUP = new MARKUP_DATA_GROUP
2617
                        //            {
2618
                        //                SYMBOL_ID = null,//InnerItem.Symbol_ID
2619
                        //                STATE = 0,
2620
                        //            };
2621
                        //            long group_id = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.AddMarkupDataGroup(mARKUP_DATA_GROUP, App.ViewInfo.ProjectNO);
2622
                        //            //Logger.sendReqLog("AddMarkupDataGroup: ", "", 1);
2623
                        //            if (group_id > 0)
2624
                        //            {
2625
                        //                foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
2626
                        //                {
2627
                        //                    if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
2628
                        //                    {
2629
                        //                        //MARKUP_DATA UPDATE
2630
                        //                        //Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.UpdateMarkupData((InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo).CommentID, group_id, App.ViewInfo.ProjectNO);
2631
                        //                        ////Logger.sendReqLog("UpdateMarkupData: ", "", 1);
2632
                        //                        ViewerDataModel.Instance.MyMarkupList.Where(d => d.ID == (InnerItem.DrawingData as CommentUserInfo).CommentID).FirstOrDefault().Group_ID = group_id;
2633
                        //                        ViewerDataModel.Instance.MyMarkupList.Where(d => d.ID == (InnerItem.DrawingData as CommentUserInfo).CommentID).FirstOrDefault().IsUpdate = true;
2634
                        //                    }
2635
                        //                }
2636
                        //            }
2637
                        //        }
2638
                        //    }
2639
                        //}
2640
                        break;
2641
                    case "UnGroup":
2642
                        //var UnGrouptoggleList = this.Parent.ChildrenOfType<RadRibbonToggleButton>();
2643
                        //foreach (var togle in UnGrouptoggleList)
2644
                        //{
2645
                        //    togle.IsChecked = false;
2646
                        //}
2647
                        //if (this.ParentOfType<MainWindow>().dzMainMenu.currentControl != null)
2648
                        //{
2649
                        //    ViewerDataModel.Instance.MarkupControls_USER.Remove(this.ParentOfType<MainWindow>().dzMainMenu.currentControl);
2650
                        //    this.ParentOfType<MainWindow>().dzMainMenu.currentControl = null;
2651
                        //}
2652
                        //this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2653
                        //instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2654
                        //instanceMain.dzMainMenu.isLeftMouseButtonDownOnWindow = false;
2655

    
2656
                        //if (ViewerDataModel.Instance.SystemMain.dzMainMenu.SelectLayer.Children.Count < 1) //선택된 것이 없으면
2657
                        //{
2658
                        //    this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert("Please Select Controls", "Alert");
2659
                        //}
2660
                        //else//if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
2661
                        //{
2662
                        //    // string MarkupData = "";
2663
                        //    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
2664
                        //    {
2665
                        //        if (item.GetType().Name == "AdornerFinal" && (item as AdornerFinal).MemberSet.Count >= 1) // 1개 이상 
2666
                        //        {
2667
                        //            //MARKUP_DATA UPDATE
2668
                        //            foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
2669
                        //            {
2670
                        //                if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
2671
                        //                {
2672
                        //                    long group_id = ViewerDataModel.Instance.MyMarkupList.Where(d => d.ID == (InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo).CommentID).FirstOrDefault().Group_ID;
2673
                        //                    //MARKUP_DATA UPDATE
2674
                        //                    //Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.UpdateMarkupData((InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo).CommentID, 0, App.ViewInfo.ProjectNO);
2675
                        //                    ////Logger.sendReqLog("UpdateMarkupData: ", "", 1);
2676
                        //                    ViewerDataModel.Instance.MyMarkupList.Where(d => d.ID == (InnerItem.DrawingData as CommentUserInfo).CommentID).FirstOrDefault().Group_ID = 0;
2677
                        //                    ViewerDataModel.Instance.MyMarkupList.Where(d => d.ID == (InnerItem.DrawingData as CommentUserInfo).CommentID).FirstOrDefault().IsUpdate = true;
2678

    
2679

    
2680
                        //                    //MARKUP_DATA_GROUP UPDATE
2681
                        //                    //bool value = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.UpdateMarkupDataGroup(group_id, App.ViewInfo.ProjectNO);
2682
                        //                    ////Logger.sendReqLog("AddMarkupDataGroup: ", value.ToString(), 1);
2683
                        //                }
2684
                        //            }
2685
                        //        }
2686
                        //    }
2687
                        //}
2688
                        break;
2689
                    #endregion
2690
                    #region Capture
2691
                    case "Capture":
2692
                        SyncInit();
2693
                        //   instanceToggle.IsChecked = false;
2694
                        var CaptureList = this.Parent.ChildrenOfType<RadRibbonToggleButton>();
2695
                        foreach (var togle in CaptureList)
2696
                        {
2697
                            togle.IsChecked = false;
2698
                        }
2699

    
2700
                        if (this.ParentOfType<MainWindow>().dzMainMenu.currentControl != null)
2701
                        {
2702
                            ViewerDataModel.Instance.MarkupControls_USER.Remove(this.ParentOfType<MainWindow>().dzMainMenu.currentControl);
2703
                            this.ParentOfType<MainWindow>().dzMainMenu.currentControl = null;
2704
                        }
2705

    
2706
                        ViewerDataModel.Instance.SelectedControl = "ImgControl";
2707
                   //     ViewerDataModel.Instance.ControlTag = null;
2708
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ImgControl;
2709

    
2710
                        /*
2711
                        //캡쳐 하기 전에 코멘트 저장
2712
                        if (Common.ViewerDataModel.Instance.MarkupControls_USER.Count > 0 || (Application.Current.MainWindow as MainWindow).dzMainMenu.SelectLayer.Children.Count > 0)
2713
                        {
2714
                            var menu = (Application.Current.MainWindow as MainWindow).dzMainMenu;
2715
                            menu.ReleaseAdorner();
2716
                            if (menu.PreviewUserMarkupInfoItem != null && menu.PreviewUserMarkupInfoItem.IsPreviewUser == true)
2717
                            {
2718
                                (Application.Current.MainWindow as MainWindow).dzTopMenu.RefactoryCommentReact(menu);
2719
                            }
2720
                            else if (menu.gridViewMarkup.SelectedItems.Count == 0 || (menu.gridViewMarkup.SelectedItems.FirstOrDefault() as IKCOM.MarkupInfoItem).UserID != App.ViewInfo.UserID)
2721
                            {
2722

    
2723
                            }
2724
                            else
2725
                            {
2726
                                (Application.Current.MainWindow as MainWindow).dzTopMenu.RefactoryCommentReact(menu);
2727
                            }
2728
                        }*/
2729

    
2730
                        //Common.ViewerDataModel.Instance.CheckList_ID = ((e.Source as Telerik.Windows.Controls.RadButton).DataContext as Customer).ID;
2731
                        //Common.ViewerDataModel.Instance.CheckList_ID = ((e.Source as Image).DataContext as Customer).ID;
2732
                        //Common.ViewerDataModel.Instance.PageNumber = ((e.Source as Image).DataContext as Customer).PAGENUMBER;
2733
                        Application.Current.MainWindow.Focus();
2734
                        Common.ViewerDataModel.Instance.Capture_Opacity = 0.49;
2735
                        (Application.Current.MainWindow as MainWindow).dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Capture;
2736
                        break;
2737
                    #endregion
2738
                    #region Cad
2739
                    case "Inside":
2740
                        //instanceMain.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Drawing;
2741
                        //instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = false;
2742
                        Common.ViewerDataModel.Instance.SelectedControl = "InsideWhite";
2743
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.InsideWhite;
2744
                        break;
2745
                    case "Overlap":
2746
                        //instanceMain.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Drawing;
2747
                        //instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = false;
2748
                        Common.ViewerDataModel.Instance.SelectedControl = "OverlapWhite";
2749
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.OverlapWhite;
2750
                        break;
2751
                    case "Clip":
2752
                        //instanceMain.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Drawing;
2753
                        //instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = false;
2754
                        Common.ViewerDataModel.Instance.SelectedControl = "ClipWhite";
2755
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ClipWhite;
2756
                        break;
2757
                    case "CadExport":
2758
                        //if (isClosed)
2759
                        //{
2760
                        //    //토글 및 마우스 상태 초기화
2761
                        //    var toggleList = this.Parent.ChildrenOfType<RadRibbonToggleButton>();
2762
                        //    foreach (var togle in toggleList)
2763
                        //    {
2764
                        //        togle.IsChecked = false;
2765
                        //    }
2766
                        //    this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2767

    
2768
                        //    isClosed = false;
2769
                        //    //Control 파일 먼저 생성
2770
                        //    CollapsedButton_Click();
2771
                        //    CadViewer check = new CadViewer();
2772
                        //    check.WindowStartupLocation = WindowStartupLocation.CenterScreen;
2773
                        //    check.Title = "Export Viewer";
2774
                        //    //check.Topmost = true;
2775
                        //    check.Show();
2776
                        //    check.Closed += Check_Closed;
2777
                        //    instanceToggle.IsChecked = false;
2778
                        //}
2779
                        //break;
2780
                    case "CadViewer":
2781
                        //if (isClosed)
2782
                        //{
2783
                        //    //토글 및 마우스 상태 초기화
2784
                        //    var toggleList = this.Parent.ChildrenOfType<RadRibbonToggleButton>();
2785
                        //    foreach (var togle in toggleList)
2786
                        //    {
2787
                        //        togle.IsChecked = false;
2788
                        //    }
2789
                        //    this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2790

    
2791
                        //    isClosed = false;
2792
                        //    CadResultViewer check = new CadResultViewer();
2793
                        //    check.WindowStartupLocation = WindowStartupLocation.CenterScreen;
2794
                        //    check.Title = "Viewer";
2795
                        //    check.Show();
2796

    
2797
                        //    check.Closed += Check_Closed;
2798

    
2799
                        //}
2800
                        break;
2801
                    #endregion
2802
                    default:
2803
                        break;
2804
                }
2805
                #endregion
2806
            }
2807
            else
2808
            {
2809
                if (Common.ViewerDataModel.Instance.IsMacroCommand)
2810
                {
2811
                    MacroHelper.Clear();
2812
                }
2813

    
2814
                if (!instanceMain.dzMainMenu.IsFreeSelectionMode)
2815
                {
2816
                    instanceMain.dzMainMenu.IsSwingMode = false;
2817
                    Common.ViewerDataModel.Instance.SelectedControl = "";
2818
                    Common.ViewerDataModel.Instance.ControlTag = null;
2819
                    this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2820
                    this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2821
                }
2822
            }
2823

    
2824
        }
2825

    
2826
        private void SyncInit()
2827
        {
2828
            try
2829
            {
2830
                if (!ViewerDataModel.Instance.SystemMain.dzMainMenu.testPanel2.IsHidden)
2831
                {
2832
                    ViewerDataModel.Instance.SystemMain.dzMainMenu.testPanel2.IsHidden = true;
2833
                    ViewerDataModel.Instance.PageBalanceMode = false;
2834
                    ViewerDataModel.Instance.PageBalanceNumber = 0;
2835
                    ViewerDataModel.Instance.SyncPageNumber = 0;
2836
                    ViewerDataModel.Instance.MarkupControls_Sync.Clear();
2837
                    ViewerDataModel.Instance.SystemMain.dzMainMenu.gridViewRevMarkup.Visibility = Visibility.Collapsed;
2838
                    ViewerDataModel.Instance.SystemMain.dzMainMenu.UserList.IsChecked = false;
2839
                    ViewerDataModel.Instance.SystemMain.dzMainMenu.BalanceMode.IsChecked = false;
2840
                }
2841
            }
2842
            catch (Exception ex)
2843
            {
2844
                //Logger.sendResLog("SyncInit", ex.Message, 0);
2845
            }
2846

    
2847
        }
2848

    
2849
        UndoData multi_UndoData = new UndoData();
2850
        CommentUserInfo currentControl { get; set; }
2851
        private void Check_Closed(object sender, EventArgs e)
2852
        {
2853
            isClosed = true;
2854
            //this.ParentOfType<MainWindow>().dzMainMenu.PN_Navi.IsEnabled = true;
2855
            //토글 및 마우스 상태 초기화
2856
            var toggleList = this.Parent.ChildrenOfType<RadToggleButton>();
2857
            foreach (var togle in toggleList)
2858
            {
2859
                togle.IsChecked = false;
2860
            }
2861
            this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2862
            ViewerDataModel.Instance.Capture_Opacity = 0;
2863

    
2864
        }
2865

    
2866
        /* public class test 
2867
         {
2868
             public double width { get; set; }
2869
             public double height { get; set; }
2870
         }
2871
         */
2872
        private async void CollapsedButton_Click()
2873
        {
2874
            this.ParentOfType<MainWindow>().dzTopMenu._SaveEvent(null, null); // 저장하지 못한 데이터가 있다면 저장
2875

    
2876
            string[] data = new string[0];
2877

    
2878
            int cnt = 0;
2879
            var menu = this.ParentOfType<MainWindow>().dzMainMenu;
2880

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

    
2883
            foreach (var item in gridSelectionItem)
2884
            {
2885
                if ((item.UserID == App.ViewInfo.UserID) && (ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.CurrentPage != null))
2886
                {
2887
                    var instance = ViewerDataModel.Instance.MyMarkupList.Where(d => d.PageNumber == ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber &&
2888
                    d.MarkupInfoID == item.MarkupInfoID).ToList();
2889
                    data = new string[instance.Count];
2890
                    foreach (var markup in instance)
2891
                    {
2892
                        data[cnt++] = await MarkupToPDF.Serialize.Core.JsonSerializerHelper.UnCompressStringAsync(markup.Data,ViewerDataModel.Instance.NewMarkupCancelToken());
2893
                    }
2894
                }
2895
            }
2896

    
2897
            if (data != null && KCOM.Properties.Settings.Default.cad == 1)
2898
            {
2899
                string FilePath = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\Cad");
2900
                string FileName = FilePath + "\\commentstring.json"; // Default file name
2901
                if (!File.Exists(FilePath))
2902
                {
2903
                    Directory.CreateDirectory(FilePath);
2904
                }
2905

    
2906
                if (!string.IsNullOrEmpty(FileName))
2907
                {
2908
                    //  File.WriteAllText(SaveDig.FileName, data);
2909
                    File.WriteAllLines(FileName, data);
2910
                }
2911
            }
2912
        }
2913

    
2914
        private double minHeight;
2915
        private double minWidth;
2916

    
2917
        private double maxHeight;
2918
        private double maxWidth;
2919

    
2920
        public bool CanVResize { get; private set; }
2921
        public bool CanHResize { get; private set; }
2922

    
2923
        public void DesignerComponent(FrameworkElement content)
2924
        {
2925
            this.InitializeComponent();
2926

    
2927
            if (!double.IsNaN(content.Width))
2928
            {
2929
                CanHResize = false;
2930
                this.Width = content.Width;
2931
            }
2932
            else
2933
            {
2934
                CanHResize = true;
2935
                this.Width = 23.0;
2936
            }
2937
            if (!double.IsNaN(content.Height))
2938
            {
2939
                CanVResize = false;
2940
                this.Height = content.Height; ;
2941
            }
2942
            else
2943
            {
2944
                CanVResize = true;
2945
                this.Height = 23.0;
2946
            }
2947

    
2948
            minWidth = content.MinWidth < 10.0 ? 10.0 : content.MinWidth;
2949
            minHeight = content.MinHeight < 10.0 ? 10.0 : content.MinHeight;
2950
            maxWidth = content.MaxWidth;
2951
            maxHeight = content.MaxHeight;
2952

    
2953
            double top = (double)content.GetValue(Canvas.TopProperty);
2954
            if (double.IsNaN(top))
2955
                top = 0.0;
2956
            double left = (double)content.GetValue(Canvas.LeftProperty);
2957
            if (double.IsNaN(left))
2958
                left = 0.0;
2959
            SetValue(Canvas.TopProperty, top);
2960
            SetValue(Canvas.LeftProperty, left);
2961

    
2962
            //Set the actual content. Note that "Content" property is a new property. See below
2963
            this.Content = content;
2964
        }
2965
        private void Thumb_DragDelta(object sender, DragDeltaEventArgs e)
2966
        {
2967
            string name = ((Thumb)sender).Name;
2968
            if (name.Contains("Top"))
2969
            {
2970
                double newHeight = this.Height - e.VerticalChange;
2971
                if (newHeight >= minHeight && newHeight <= maxHeight)
2972
                {
2973
                    this.Height = newHeight;
2974
                    SetValue(Canvas.TopProperty,
2975
                (double)GetValue(Canvas.TopProperty) + e.VerticalChange);
2976
                }
2977
            }
2978
            if (name.Contains("Right"))
2979
            {
2980
                double newWidth = this.Width + e.HorizontalChange;
2981
                if (newWidth >= minWidth && newWidth <= maxWidth)
2982
                    this.Width = newWidth;
2983
            }
2984
            if (name.Contains("Bottom"))
2985
            {
2986
                double newHeight = this.Height + e.VerticalChange;
2987
                if (newHeight >= minHeight && newHeight <= maxHeight)
2988
                    this.Height = newHeight;
2989
            }
2990
            if (name.Contains("Left"))
2991
            {
2992
                double newWidth = this.Width - e.HorizontalChange;
2993
                if (newWidth >= minWidth && newWidth <= maxWidth)
2994
                {
2995
                    this.Width = newWidth;
2996
                    SetValue(Canvas.LeftProperty,
2997
                (double)GetValue(Canvas.LeftProperty) + e.HorizontalChange);
2998
                }
2999
            }
3000
        }
3001

    
3002
        private void drawControlBorder(object sender)
3003
        {
3004
            System.Windows.Controls.Control control = (System.Windows.Controls.Control)sender;
3005
        }
3006

    
3007
        private void ResizeThumb_DragDelta(object sender, MouseButtonEventArgs e)
3008
        {
3009
            System.Windows.Controls.Control designerItem = (System.Windows.Controls.Control)sender;
3010
            if (designerItem != null)
3011
            {
3012
                double deltaVertical, deltaHorizontal;
3013

    
3014
                switch (VerticalAlignment)
3015
                {
3016
                    case VerticalAlignment.Bottom:
3017
                        deltaVertical = designerItem.ActualHeight - designerItem.MinHeight;
3018
                        designerItem.Height -= deltaVertical;
3019
                        break;
3020
                    case VerticalAlignment.Top:
3021
                        deltaVertical = designerItem.ActualHeight - designerItem.MinHeight;
3022
                        Canvas.SetTop(designerItem, Canvas.GetTop(designerItem) + deltaVertical);
3023
                        designerItem.Height -= deltaVertical;
3024
                        break;
3025
                    default:
3026
                        break;
3027
                }
3028

    
3029
                switch (HorizontalAlignment)
3030
                {
3031
                    case HorizontalAlignment.Left:
3032
                        deltaHorizontal = designerItem.ActualWidth - designerItem.MinWidth;
3033
                        Canvas.SetLeft(designerItem, Canvas.GetLeft(designerItem) + deltaHorizontal);
3034
                        designerItem.Width -= deltaHorizontal;
3035
                        break;
3036
                    case HorizontalAlignment.Right:
3037
                        deltaHorizontal = designerItem.ActualWidth - designerItem.MinWidth;
3038
                        designerItem.Width -= deltaHorizontal;
3039
                        break;
3040
                    default:
3041
                        break;
3042
                }
3043
            }
3044
            e.Handled = true;
3045
        }
3046

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

    
3049
        void ExportMethod()
3050
        {
3051
            //FileDialogFilter filterImage = new FileDialogFilter("Image Files", "*.jpg", "*.png");
3052
            SaveDig.Filter = "PDF file format|*.pdf";
3053
            SaveDig.Title = "Save an DWG File";
3054
            SaveDig.ShowDialog();
3055
        }
3056

    
3057
        private void cbAutoSave_Checked(object sender, RoutedEventArgs e)
3058
        {            
3059
            if (cbAutoSave.IsChecked == true)
3060
            {
3061
                SaveTime(true, (int)cbSaveInterval.Value);
3062
            }
3063
            else
3064
            {
3065
                SaveTime(false, (int)cbSaveInterval.Value);
3066
            }
3067
        }
3068
        private void cbSaveInterval_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
3069
        {
3070
            if(string.IsNullOrEmpty(cbSaveInterval.Value.ToString()))
3071
            {
3072
                cbSaveInterval.Value = cbSaveInterval.Minimum;
3073
            }
3074
            if (cbAutoSave.IsChecked == true)
3075
            {
3076
                SaveTime(true, (int)cbSaveInterval.Value);
3077
            }
3078

    
3079
            KCOM.Properties.Settings.Default.SaveInterval = (double)cbSaveInterval.Value;
3080
            Properties.Settings.Default.Save();
3081
        }
3082
        //강인구 자동 저장 추가
3083
        private void AutoSave(object sender, RoutedEventArgs e)
3084
        {
3085
            RadToggleButton instanceToggle = sender as RadToggleButton;
3086

    
3087
            if(instanceToggle.IsChecked == true)
3088
            {
3089
                SaveTime(true);
3090
            }
3091
            else
3092
            {
3093
                SaveTime(false);
3094
            }
3095
        }
3096

    
3097
        public void Copy_Start()
3098
        {
3099
            if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
3100
            {
3101
                string MarkupData = "";
3102

    
3103
                foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
3104
                {
3105
                    string id = string.Empty;
3106
                    if (item.GetType().Name == "AdornerFinal")
3107
                    {
3108
                        foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
3109

    
3110
                        {
3111
                            if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
3112
                            {
3113
                                MarkupToPDF.Controls.Parsing.MarkupParser.MarkupReturn res = MarkupParser.MarkupToString(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo, App.ViewInfo.UserID);
3114
                                id = (InnerItem.Symbol_ID != null) ? "|SymbolID|" + InnerItem.Symbol_ID : "";
3115
                                MarkupData += "|OR|" + res.ConvertData + id;
3116
                            }
3117
                        }
3118

    
3119
                        this.Dispatcher.Invoke(() =>
3120
                        {
3121
                            Clipboard.SetData(DataFormats.StringFormat, MarkupData);
3122
                        }, DispatcherPriority.Background);
3123
                    }
3124
                }
3125
            }
3126
        }
3127

    
3128
        public void Cut_Start()
3129
        {
3130
            if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
3131
            {
3132
                foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
3133
                {
3134
                    string MarkupData = "";
3135

    
3136
                    if (item.GetType().Name == "AdornerFinal")
3137
                    {
3138
                        foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
3139
                        {
3140
                            if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
3141
                            {
3142
                                MarkupToPDF.Controls.Parsing.MarkupParser.MarkupReturn res = MarkupParser.MarkupToString(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo, App.ViewInfo.UserID);
3143
                                MarkupData += "|OR|" + res.ConvertData;
3144
                            }
3145
                        }
3146
                        //클립보드에 넣음
3147
                        Clipboard.SetDataObject(MarkupData);
3148
                    }
3149
                }
3150
                this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Clear();
3151
            }
3152
        }
3153

    
3154
        public async void Paste_Start()
3155
        {
3156
            //마크업 붙여넣기
3157

    
3158
            var markupData = Clipboard.GetData(DataFormats.StringFormat);
3159

    
3160
            if (markupData.GetType() == typeof(string) && markupData.ToString().Contains("|OR||DZ|"))
3161
            {
3162
                List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>();
3163

    
3164
                string[] delimiterChars = { "|OR|" };
3165
                string[] data = markupData.ToString().Split(delimiterChars, StringSplitOptions.RemoveEmptyEntries);
3166

    
3167
                SelectionSet.Instance.UnSelect(this.ParentOfType<MainWindow>().dzMainMenu);
3168

    
3169
                UndoData multi_UndoData = new UndoData();
3170

    
3171
                //강인구 Undo/Redo 보류
3172
                MarkupToPDF.Common.UndoDataGroup UndoData = new UndoDataGroup()
3173
                {
3174
                    IsUndo = false,
3175
                    Event = EventType.Create,
3176
                    EventTime = DateTime.Now,
3177
                    MarkupDataColl = new List<UndoData>()
3178
                };
3179

    
3180
                ViewerDataModel.Instance.UndoDataList.Where(data1 => data1.IsUndo == true).ToList().ForEach(i =>
3181
                {
3182
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
3183
                });
3184

    
3185
                foreach (string parse in data)
3186
                {
3187
                    if (parse != "")
3188
                    {
3189
                        System.Windows.Controls.Control item = await MarkupParser.ParseExAsync(App.BaseAddress,ViewerDataModel.Instance.NewMarkupCancelToken(),App.ViewInfo.ProjectNO, parse, ViewerDataModel.Instance.MarkupControls_USER, ViewerDataModel.Instance.PageAngle, string.Empty, string.Empty);
3190
                        (item as MarkupToPDF.Common.CommentUserInfo).CommentID = Commons.shortGuid();
3191

    
3192
                        ViewerDataModel.Instance.MarkupControls.Remove(item as MarkupToPDF.Common.CommentUserInfo);
3193
                        ViewerDataModel.Instance.MarkupControls_USER.Remove(item as MarkupToPDF.Common.CommentUserInfo);
3194

    
3195
                        adornerSet.Add(item as MarkupToPDF.Common.CommentUserInfo);
3196

    
3197
                        multi_UndoData = this.ParentOfType<MainWindow>().dzMainMenu.Control_Style(item as MarkupToPDF.Common.CommentUserInfo);
3198

    
3199
                        UndoData.MarkupDataColl.Add(multi_UndoData);
3200
                        ViewerDataModel.Instance.UndoDataList.Add(UndoData);                        
3201
                    }
3202
                }
3203
                Controls.AdornerFinal final = new Controls.AdornerFinal(adornerSet);
3204

    
3205
                if(this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.X < 0)
3206
                {
3207
                    Canvas.SetLeft(final, 0);
3208
                    Canvas.SetTop(final, 0);
3209
                }
3210
                else
3211
                {
3212
                    double realPointX = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.X - final.BorderSize.X - (final.BorderSize.Width / 2);
3213
                    double realPointY = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.Y - final.BorderSize.Y - (final.BorderSize.Height / 2);
3214
                    final.TranslateItems(realPointX, realPointY);
3215

    
3216
                    if (final.Members.Where(type => type.Drawingtype == MarkupToPDF.Controls.Common.ControlType.TextControl).FirstOrDefault() != null)
3217
                    {
3218
                        final.TranslateItems(0.001, 0.001); //dummy
3219
                    }
3220
                }
3221

    
3222
                this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Add(final);
3223
            }
3224
            //외부 이미지 붙여넣기
3225
            else if (Clipboard.GetImage() != null)
3226
            {
3227
                try
3228
                {
3229
                    UndoData multi_UndoData = new UndoData();
3230

    
3231
                    //강인구 Undo/Redo 보류
3232
                    MarkupToPDF.Common.UndoDataGroup UndoData = new UndoDataGroup()
3233
                    {
3234
                        IsUndo = false,
3235
                        Event = EventType.Create,
3236
                        EventTime = DateTime.Now,
3237
                        MarkupDataColl = new List<UndoData>()
3238
                    };
3239

    
3240

    
3241
                    string temppath = System.IO.Path.GetTempPath();
3242
                    //string filename = KCOM.Events.Save.shortCommentKey();
3243
                    string filename = Commons.shortFileKey();
3244

    
3245
                    System.Drawing.Image clipboardImage = System.Windows.Forms.Clipboard.GetImage();
3246
                    clipboardImage.Save(temppath + "\\" + filename);
3247

    
3248
                    System.IO.FileInfo fileInfo = new System.IO.FileInfo(temppath + "\\" + filename);
3249
                    String strFile = System.IO.Path.GetFileName(fileInfo.FullName);
3250
                    long numByte = fileInfo.Length;
3251
                    double dLen = Convert.ToDouble(fileInfo.Length / 1000000);
3252
                    kr.co.devdoftech.cloud.FileUpload fileUploader = App.FileUploader;
3253

    
3254
                    if (dLen < 4)
3255
                    {
3256
                        System.IO.FileStream fStream = new System.IO.FileStream(fileInfo.FullName,
3257
                        System.IO.FileMode.Open, System.IO.FileAccess.Read,FileShare.Read);
3258
                        System.IO.BinaryReader br = new System.IO.BinaryReader(fStream);
3259
                        byte[] data = br.ReadBytes((int)numByte);
3260

    
3261
                        filename = fileUploader.Run(App.ViewInfo.ProjectNO, this.ParentOfType<MainWindow>().dzMainMenu._DocItem.DOCUMENT_NO, App.ViewInfo.UserID, strFile + ".png", data);
3262
                        Check_Uri.UriCheck(filename);
3263
                        br.Close();
3264
                        fStream.Close();
3265
                        fStream.Dispose();
3266
                    }
3267
                    else
3268
                    {
3269
                        this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert("Available Memory less than 4 mega byte", "Alert");
3270
                        return;
3271
                    }
3272

    
3273
                    fileInfo.Delete();
3274

    
3275
                    System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(clipboardImage);
3276
                    IntPtr hBitmap = bmp.GetHbitmap();
3277
                    System.Windows.Media.ImageSource WpfBitmap = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(hBitmap, IntPtr.Zero, Int32Rect.Empty, System.Windows.Media.Imaging.BitmapSizeOptions.FromEmptyOptions());
3278
                    Image img = new Image();
3279
                    if (filename.Contains(".svg"))
3280
                    {
3281
                        SharpVectors.Converters.SvgImageExtension svgImage = new SharpVectors.Converters.SvgImageExtension(filename);
3282
                        img.Source = (DrawingImage)svgImage.ProvideValue(null);
3283
                    }
3284
                    else
3285
                    {
3286
                        img.Source = new BitmapImage(new Uri(filename));
3287
                    }
3288

    
3289
                    var currentControl = new MarkupToPDF.Controls.Etc.ImgControl
3290
                    {
3291
                        PointSet = new List<Point>(),
3292
                        FilePath = filename,
3293
                        ImageData = img.Source,
3294
                        StartPoint = new Point(100, 100),
3295
                        EndPoint = new Point(200, 200),
3296
                        TopRightPoint = new Point(100, 200),
3297
                        LeftBottomPoint = new Point(200, 100)
3298
                    };
3299

    
3300
                    currentControl.TopRightPoint = new Point(currentControl.StartPoint.X + clipboardImage.Width, currentControl.StartPoint.Y);
3301
                    currentControl.LeftBottomPoint = new Point(currentControl.StartPoint.X, currentControl.StartPoint.Y + clipboardImage.Height);
3302
                    currentControl.EndPoint = new Point(currentControl.StartPoint.X + clipboardImage.Width, currentControl.StartPoint.Y + clipboardImage.Height);
3303

    
3304
                    currentControl.PointSet = new List<Point>
3305
                                        {
3306
                                            currentControl.StartPoint,
3307
                                            currentControl.LeftBottomPoint,
3308
                                            currentControl.EndPoint,
3309
                                            currentControl.TopRightPoint,
3310
                                        };
3311

    
3312
                    multi_UndoData = this.ParentOfType<MainWindow>().dzMainMenu.Control_Style(currentControl as MarkupToPDF.Common.CommentUserInfo);
3313
                    UndoData.MarkupDataColl.Add(multi_UndoData);
3314
                    ViewerDataModel.Instance.UndoDataList.Add(UndoData);
3315

    
3316
                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl as MarkupToPDF.Common.CommentUserInfo);
3317
                    currentControl.CommentID = Commons.shortGuid();
3318

    
3319
                    currentControl.ApplyTemplate();
3320
                    currentControl.SetImage();
3321

    
3322
                    ViewerDataModel.Instance.MarkupControls_USER.Remove(currentControl as MarkupToPDF.Common.CommentUserInfo);
3323
                    Controls.AdornerFinal final = new Controls.AdornerFinal(currentControl as MarkupToPDF.Common.CommentUserInfo);
3324
                    this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Add(final);
3325

    
3326
                    double realPointX = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.X - final.BorderSize.X - (final.BorderSize.Width / 2);
3327
                    double realPointY = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.Y - final.BorderSize.Y - (final.BorderSize.Height / 2);
3328
                    final.TranslateItems(realPointX, realPointY);
3329
                }
3330
                catch(Exception ex)
3331
                {
3332
                    this.ParentOfType<MainWindow>().DialogMessage_Alert("" + ex, "Alert");
3333
                }
3334
            }
3335
        }
3336
    }
3337
}
클립보드 이미지 추가 (최대 크기: 500 MB)