프로젝트

일반

사용자정보

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

markus / KCOM / Events / Implementation / TopMenuEvent.cs @ 4eb052e4

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

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

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

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

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

    
66
        private void CheckShapeState()
67
        {
68

    
69

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

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

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

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

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

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

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

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

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

    
149
        }
150

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

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

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

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

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

    
236
        void SaveTimer_Tick(object sender, EventArgs e)
237
        {
238
            //if (this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode != IKCOM.MouseHandlingMode.Drawing)
239
            if (this.ParentOfType<MainWindow>().dzMainMenu.currentControl == null && this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count == 0)
240
            {
241
                SaveEventCallback(null, null);
242
            }
243
        }
244

    
245
        private void SaveTime(bool IsRun)
246
        {
247
            if(SaveTimer == null)
248
            {
249
                SaveTimer = new System.Windows.Threading.DispatcherTimer();
250
                SaveTimer.Interval = new TimeSpan(0, 0, 5);
251
                SaveTimer.Tick += new EventHandler(SaveTimer_Tick);
252
            }
253

    
254
            if (IsRun)
255
            {
256
                SaveTimer.Start();
257
            }
258
            else
259
            {
260
                SaveTimer.Stop();
261
            }
262
        }
263
        private void SaveTime(bool IsRun,int timeinterval)
264
        {
265
            if (SaveTimer == null)
266
            {
267
                SaveTimer = new System.Windows.Threading.DispatcherTimer();
268
                SaveTimer.Interval = new TimeSpan(0, timeinterval, 0);
269
                SaveTimer.Tick += new EventHandler(SaveTimer_Tick);
270
            }
271
            else
272
            {
273
                SaveTimer.Stop();
274
                SaveTimer.Interval = new TimeSpan(0, timeinterval, 0);
275
            }
276

    
277
            if (IsRun)
278
            {
279
                SaveTimer.Start();
280
            }
281
            else
282
            {
283
                SaveTimer.Stop();
284
            }
285
        }
286
        /// <summary>
287
        /// enable busy indicator and then call _SaveEvent method.
288
        /// </summary>
289
        /// <param name="sender"></param>
290
        /// <param name="e"></param>
291
        public void SaveEventCallback(object sender, RoutedEventArgs e)
292
        {
293
            if (this.ParentOfType<MainWindow>().dzMainMenu.busyIndicator.IsBusy == true) return;
294

    
295
            this.ParentOfType<MainWindow>().dzMainMenu.busyIndicator.IsBusy = true;
296
            System.Threading.Tasks.Task SaveTask = System.Threading.Tasks.Task.Factory.StartNew(() =>
297
            {
298
                Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, new Action<object, RoutedEventArgs>(_SaveEvent), sender, e);
299
            }).ContinueWith(task =>
300
            {
301
                Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate () { this.ParentOfType<MainWindow>().dzMainMenu.busyIndicator.IsBusy = false; }));
302
            });
303
        }
304

    
305
        /// <summary>
306
        /// save markup
307
        ///  - convert ink control to polygon control if ink control exists
308
        ///  - unselect and update my markup list
309
        /// <param name="sender"></param>
310
        /// <param name="e"></param>
311
        public void _SaveEvent(object sender, RoutedEventArgs e)
312
        {
313
            var menu = this.ParentOfType<MainWindow>().dzMainMenu;
314
            try
315
            {
316
                menu.ConvertInkControlToPolygon();
317

    
318
                SelectionSet.Instance.UnSelect(this.ParentOfType<MainWindow>().dzMainMenu);
319
                // update mylist and gridview
320
                menu.UpdateMyMarkupList();
321

    
322
                if (menu.gridViewMarkup.SelectedItems.Count == 0 && menu.gridViewMarkup.Items.Count > 0)
323
                {
324
                    this.ParentOfType<MainWindow>().DialogMessage_Alert("Please Select Your Comment List Item", "Alert");
325
                }
326
                else
327
                {                    
328
                    foreach (var item in menu.gridViewMarkup.SelectedItems)
329
                    {
330
                        if ((item as IKCOM.MarkupInfoItem).UserID == App.ViewInfo.UserID)
331
                        {
332
                            this.ExecuteSaveCommand(menu);
333
                            ViewerDataModel.Instance._markupInfoList.Where(data => data.MarkupInfoID == (item as IKCOM.MarkupInfoItem).MarkupInfoID).FirstOrDefault().UpdateTime = DateTime.Now;
334
                            if (!ViewerDataModel.Instance.IsConsolidate && (sender != null))
335
                            {
336
                                if (ViewerDataModel.Instance.IsPressCtrl) ViewerDataModel.Instance.IsPressCtrl = false;
337
                                this.ParentOfType<MainWindow>().DialogMessage_Alert("Save 가 완료되었습니다.", "Alert");
338
                            }
339
                        }
340
                    }
341
                }
342

    
343
                ViewerDataModel.Instance.UndoDataList.Clear();
344
            }
345
            catch (Exception ex)
346
            {
347
               
348
            }
349
            finally
350
            {
351
                /*
352
                /// delete markup information when 코멘트가 없을 경우
353
                if (ViewerDataModel.Instance.MyMarkupList.Count == 0)
354
                {
355
                    foreach (var item in menu.gridViewMarkup.SelectedItems)
356
                    {
357
                        if ((item as IKCOM.MarkupInfoItem).UserID == App.ViewInfo.UserID)
358
                        {
359
                            //this.ParentOfType<MainWindow>().dzMainMenu.DeleteItem((item as IKCOM.MarkupInfoItem));
360
                        }
361
                    }
362
                }
363
                */
364
            }
365
        }
366

    
367
        /// <summary>
368
        /// call save command
369
        /// </summary>
370
        /// <param name="menu"></param>
371
		private void ExecuteSaveCommand(MainMenu menu)
372
        {
373
            SaveCommand.Instance.Project_No = App.ViewInfo.ProjectNO;
374
            SaveCommand.Instance.document_id = App.ViewInfo.DocumentItemID;
375
            SaveCommand.Instance.user_id = App.ViewInfo.UserID;
376
            SaveCommand.Instance.page_no = menu.pageNavigator.CurrentPage.PageNumber;
377

    
378
            try
379
            {
380
                if (ViewerDataModel.Instance.UndoDataList.Count > 0)
381
                {
382
                    List<IKCOM.MarkupInfoItem> SelectedMarkupInfos = new List<IKCOM.MarkupInfoItem>();
383
                    foreach (var item in menu.gridViewMarkup.SelectedItems)
384
                    {
385
                        if ((item as IKCOM.MarkupInfoItem).UserID == App.ViewInfo.UserID)
386
                        {
387
                            SelectedMarkupInfos.Add(item as IKCOM.MarkupInfoItem);
388
                        }
389
                    }
390

    
391
                    SaveCommand.Instance.Execute(SelectedMarkupInfos);
392
                }
393

    
394
                if(ViewerDataModel.Instance.RotationDocs.Count > 0)
395
                    SaveCommand.Instance.PageAngleSave(App.ViewInfo.ProjectNO, ViewerDataModel.Instance.RotationDocs);
396
            }
397
            catch (Exception ex)
398
            {
399
                this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert(string.Format("세이브 실패:{0}", ex.Message), "Alert");
400
                throw ex;
401
            }
402
        }
403

    
404
        //강인구 추가
405
        public void Print_Start(string Type)
406
        {
407
            if (ViewerDataModel.Instance.IsPressCtrl)
408
            {
409
                ViewerDataModel.Instance.IsPressCtrl = false;
410
            }
411
            if (ViewerDataModel.Instance.MarkupControls_USER.Count > 0 || this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
412
            {
413
                var menu = this.ParentOfType<MainWindow>().dzMainMenu;
414
                SelectionSet.Instance.UnSelect(menu);
415
                if (menu.PreviewUserMarkupInfoItem != null && menu.PreviewUserMarkupInfoItem.IsPreviewUser == true)
416
                {
417
                    this.SaveEventCallback(null, null);
418
                }
419
                else if (menu.gridViewMarkup.SelectedItems.Count == 0 || (menu.gridViewMarkup.SelectedItems.FirstOrDefault() as IKCOM.MarkupInfoItem).UserID != App.ViewInfo.UserID)
420
                {
421

    
422
                }
423
                else
424
                {
425
                    this.SaveEventCallback(null, null);
426
                }
427
            }
428

    
429
            bool isprint = false;
430
            if (Type == "Print")
431
            {
432
                isprint = true;
433
            }
434

    
435
            RadWindow PrintWindow = new RadWindow();
436
            //IKCOM.MarkupInfoItem _result = null;
437
            PrintWindow.Width = 850;
438
            PrintWindow.Height = 600;
439
            //PrintWindow.Width = 650;
440
            //PrintWindow.Height = 550;
441
            PrintWindow.Header = Type;
442

    
443
            List<IKCOM.MarkupInfoItem> markupinfo = new List<IKCOM.MarkupInfoItem>();
444

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

    
448
            if (markupinfo.Count() > 0)
449
            {
450
                Logger.sendResLog("GetPrintDocItemList", "TRUE", 1);
451
            }
452
            else
453
            {
454
                Logger.sendResLog("GetPrintDocItemList", "FALSE", 1);
455
            }
456

    
457
            var Tile_Url = string.Format(@"{0}/TileSource/{1}_Tile/{2}/{3}/",
458
                App.SystemInfo.HostName,
459
                App.ViewInfo.ProjectNO,
460
                (Convert.ToInt64(App.ViewInfo.DocumentItemID) / 100).ToString(),
461
                App.ViewInfo.DocumentItemID
462
                );
463

    
464
            PrintWindow.Content = new KCOM.Control.PrintControl(
465
                      Tile_Url,
466
                      App.ViewInfo.ProjectNO,
467
                      this.ParentOfType<MainWindow>().dzMainMenu._DocInfo, markupinfo,
468
                      this.ParentOfType<MainWindow>().dzMainMenu.pageNavigator.CurrentPage.PageNumber,
469
                      App.ViewInfo.DocumentItemID,
470
                      this.ParentOfType<MainWindow>().dzMainMenu._DocItem.DOCUMENT_NO,
471
                      this.ParentOfType<MainWindow>().dzMainMenu._DocItem.ORIGINAL_FILE, isprint);
472

    
473
            //프린트 팝업 옵션
474
            //PrintWindow.BorderThickness = new Thickness(3);
475
            //PrintWindow.BorderBrush = new SolidColorBrush(Color.FromArgb(255, 37, 160, 218));
476
            PrintWindow.ResizeMode = System.Windows.ResizeMode.NoResize;
477
            PrintWindow.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
478
            PrintWindow.Background = new SolidColorBrush(Colors.Black);
479
            PrintWindow.Background.Opacity = 0.6;
480
            PrintWindow.Owner = Application.Current.MainWindow;
481
            Telerik.Windows.Controls.StyleManager.SetTheme(PrintWindow, new Telerik.Windows.Controls.VisualStudio2013Theme());
482
            PrintWindow.ShowDialog();
483
        }
484

    
485
        //강인구 추가
486
        private void PrintEvent(object sender, RoutedEventArgs e)
487
        {
488
            RadRibbonButton button = sender as RadRibbonButton;
489
            Print_Start(button.Content.ToString());
490
        }
491

    
492
        private List<AdornerMember> GetAdornerItem()
493
        {
494
            List<AdornerMember> AdonerList = new List<AdornerMember>();
495

    
496
            if (this.ParentOfType<MainWindow>() != null)
497
            {
498
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
499
                {
500
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
501
                    {
502
                        if (item.GetType().Name == "AdornerFinal")
503
                        {
504
                            foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
505
                            {
506
                                AdonerList.Add(InnerItem);
507
                            }
508
                        }
509
                    }
510
                }
511
            }
512

    
513
            return AdonerList;
514
        }
515
        /// <summary>
516
        /// 투명도
517
        /// </summary>
518
        /// <param name="sender"></param>
519
        /// <param name="e"></param>
520
        //강인구 추가(Undo End)
521
        private void sdOpacity_ValueChanged(object sender, RoutedEventArgs e)
522
        {
523
            List<AdornerMember> AdonerList = GetAdornerItem();
524
            if(AdonerList.Count > 0)
525
            {
526
                Undo_data UndoData = new Undo_data()
527
                {
528
                    IsUndo = false,
529
                    Event = Event_Type.Option,
530
                    EventTime = DateTime.Now,
531
                    Opacity = ViewerDataModel.Instance.ControlOpacity,
532
                    Markup_List = new List<Multi_Undo_data>()
533
                };
534
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
535

    
536
                foreach (AdornerMember InnerItem in AdonerList)
537
                {
538
                    InnerItem.DrawingData.Opacity = ViewerDataModel.Instance.ControlOpacity;
539
                  
540
                    multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
541
                    UndoData.Markup_List.Add(multi_Undo_Data);
542
                    multi_Undo_Data = new Multi_Undo_data();
543
                }
544

    
545
                ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
546
                {
547
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
548
                });
549
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
550
            }
551
        }
552

    
553
        //강인구 추가(Undo End)
554
        private void cbLineSize_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
555
        {
556
            if (string.IsNullOrEmpty(cbLineSize.Value.ToString()))
557
            {
558
                cbLineSize.Value = cbLineSize.Minimum;
559
            }
560
            List<AdornerMember> AdonerList = GetAdornerItem();
561
            if (AdonerList.Count > 0)
562
            {
563
                Undo_data UndoData = new Undo_data()
564
                {
565
                    IsUndo = false,
566
                    Event = Event_Type.Option,
567
                    EventTime = DateTime.Now,
568
                    LineSize = ViewerDataModel.Instance.LineSize,
569
                    Markup_List = new List<Multi_Undo_data>()
570
                };
571
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
572

    
573
                foreach (AdornerMember InnerItem in AdonerList)
574
                {
575
                    switch (InnerItem.DrawingData.GetType().Name)
576
                    {
577
                        case ("LineControl"):
578
                            {
579
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Line.LineControl).LineSize = ViewerDataModel.Instance.LineSize;
580
                            }
581
                            break;
582
                        case ("ArcControl"):
583
                            {
584
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Line.ArcControl).LineSize = ViewerDataModel.Instance.LineSize;
585
                            }
586
                            break;
587
                        case ("ArrowArcControl"):
588
                            {
589
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Line.ArrowArcControl).LineSize = ViewerDataModel.Instance.LineSize;
590
                            }
591
                            break;
592
                        case ("ArrowControl_Multi"):
593
                            {
594
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Line.ArrowControl_Multi).LineSize = ViewerDataModel.Instance.LineSize;
595
                            }
596
                            break;
597
                        case ("CloudControl"):
598
                            {
599
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Polygon.CloudControl).LineSize = ViewerDataModel.Instance.LineSize;
600
                            }
601
                            break;
602
                        case ("PolygonControl"):
603
                            {
604
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Polygon.PolygonControl).LineSize = ViewerDataModel.Instance.LineSize;
605
                            }
606
                            break;
607
                        case ("RectangleControl"):
608
                            {
609
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.RectangleControl).LineSize = ViewerDataModel.Instance.LineSize;
610
                            }
611
                            break;
612
                        case ("RectCloudControl"):
613
                            {
614
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.RectCloudControl).LineSize = ViewerDataModel.Instance.LineSize;
615
                            }
616
                            break;
617
                        case ("TriControl"):
618
                            {
619
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.TriControl).LineSize = ViewerDataModel.Instance.LineSize;
620
                            }
621
                            break;
622
                        case ("CircleControl"):
623
                            {
624
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.CircleControl).LineSize = ViewerDataModel.Instance.LineSize;
625
                            }
626
                            break;
627
                        case ("ArrowTextControl"):
628
                            {
629
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).LineSize = ViewerDataModel.Instance.LineSize;
630
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).BorderSize = new Thickness(ViewerDataModel.Instance.LineSize);
631
                            }
632
                            break;
633
                        case ("TextControl"):
634
                            {
635
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).LineSize = new Thickness(ViewerDataModel.Instance.LineSize);
636
                            }
637
                            break;
638
                        case ("InsideWhiteControl"):
639
                            {
640
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Cad.InsideWhiteControl).LineSize = ViewerDataModel.Instance.LineSize;
641
                            }
642
                            break;
643
                        case ("OverlapWhiteControl"):
644
                            {
645
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Cad.OverlapWhiteControl).LineSize = ViewerDataModel.Instance.LineSize;
646
                            }
647
                            break;
648
                        case ("ClipWhiteControl"):
649
                            {
650
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Cad.ClipWhiteControl).LineSize = ViewerDataModel.Instance.LineSize;
651
                            }
652
                            break;
653
                        case ("CoordinateControl"):
654
                            {
655
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Cad.CoordinateControl).LineSize = 10; //ViewerDataModel.Instance.LineSize
656
                            }
657
                            break;
658
                    }
659
                    
660

    
661
                    multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
662
                    UndoData.Markup_List.Add(multi_Undo_Data);
663
                    multi_Undo_Data = new Multi_Undo_data();
664
                }
665

    
666
                ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
667
                {
668
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
669
                });
670
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
671

    
672
                
673
            }
674
            KCOM.Properties.Settings.Default.LineSize = (double)cbLineSize.Value;
675
            Properties.Settings.Default.Save();
676
        }
677

    
678

    
679
        private void cbIntervalSize_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
680
        {
681
            if (string.IsNullOrEmpty(cbIntervalSize.Value.ToString()))
682
            {
683
                cbIntervalSize.Value = cbIntervalSize.Minimum;
684
            }
685
            List<AdornerMember> AdonerList = GetAdornerItem();
686
            if (AdonerList.Count > 0)
687
            {
688

    
689
                Undo_data UndoData = new Undo_data()
690
                {
691
                    IsUndo = false,
692
                    Event = Event_Type.Option,
693
                    EventTime = DateTime.Now,
694
                    Interval = ViewerDataModel.Instance.Interval,
695
                    Markup_List = new List<Multi_Undo_data>()
696
                };
697
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
698

    
699
                foreach (AdornerMember InnerItem in AdonerList)
700
                {
701
                    switch (InnerItem.DrawingData.GetType().Name)
702
                    {
703
                        case ("LineControl"):
704
                            {
705
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Line.LineControl).Interval = ViewerDataModel.Instance.Interval;
706

    
707
                                multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
708
                                UndoData.Markup_List.Add(multi_Undo_Data);
709
                                multi_Undo_Data = new Multi_Undo_data();
710
                            }
711
                            break;
712
                    }
713
                }
714

    
715
                ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
716
                {
717
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
718
                });
719
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
720
            }
721
            KCOM.Properties.Settings.Default.Interval = (double)cbIntervalSize.Value;
722
            Properties.Settings.Default.Save();
723
        }
724
        
725
        private void cbArcLength_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
726
        {
727
            if (string.IsNullOrEmpty(cbArcLength.Value.ToString()))
728
            {
729
                cbArcLength.Value = cbArcLength.Minimum;
730
            }
731
            List<AdornerMember> AdonerList = GetAdornerItem();
732
            if (AdonerList.Count > 0)
733
            {
734

    
735
                //Undo_data UndoData = new Undo_data()
736
                //{
737
                //    IsUndo = false,
738
                //    Event = Event_Type.Option,
739
                //    EventTime = DateTime.Now,
740
                //    Interval = ViewerDataModel.Instance.Interval,
741
                //    Markup_List = new List<Multi_Undo_data>()
742
                //};
743
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
744

    
745
                foreach (AdornerMember InnerItem in AdonerList)
746
                {
747
                    switch (InnerItem.DrawingData.GetType().Name)
748
                    {
749
                        case ("RectCloudControl"):
750
                            {
751
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.RectCloudControl).ArcLength = ViewerDataModel.Instance.ArcLength;
752

    
753
                                //multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
754
                                //UndoData.Markup_List.Add(multi_Undo_Data);
755
                                //multi_Undo_Data = new Multi_Undo_data();
756
                            }
757
                            break;
758
                        case ("CloudControl"):
759
                            {
760
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Polygon.CloudControl).ArcLength = ViewerDataModel.Instance.ArcLength;
761

    
762
                                //multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
763
                                //UndoData.Markup_List.Add(multi_Undo_Data);
764
                                //multi_Undo_Data = new Multi_Undo_data();
765
                            }
766
                            break;
767
                    }
768
                }
769

    
770
                //ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
771
                //{
772
                //    ViewerDataModel.Instance.UndoDataList.Remove(i);
773
                //});
774
                //ViewerDataModel.Instance.UndoDataList.Add(UndoData);
775
            }
776

    
777
            KCOM.Properties.Settings.Default.ArcLength = (double)cbArcLength.Value;
778
            Properties.Settings.Default.Save();
779
        }
780

    
781
        //강인구 추가(Undo End)
782
        private void cbDashStyle_SelectionChanged(object sender, SelectionChangedEventArgs e)
783
        {
784
            //강인구 추가
785
            if (this.ParentOfType<MainWindow>() != null)
786
            {
787
                ViewerDataModel.Instance.DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
788
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
789
                {
790
                    Undo_data UndoData = new Undo_data()
791
                    {
792
                        IsUndo = false,
793
                        Event = Event_Type.Option,
794
                        EventTime = DateTime.Now,
795
                        DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData,
796
                        Markup_List = new List<Multi_Undo_data>()
797
                    };
798
                    Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
799

    
800
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
801
                    {
802
                        if (item.GetType().Name == "AdornerFinal")
803
                        {
804
                            foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
805
                            {
806
                                switch (InnerItem.DrawingData.GetType().Name)
807
                                {
808
                                    case ("LineControl"):
809
                                        {
810
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Line.LineControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
811
                                        }
812
                                        break;
813
                                    case ("ArcControl"):
814
                                        {
815
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Line.ArcControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
816
                                        }
817
                                        break;
818
                                    case ("ArrowArcControl"):
819
                                        {
820
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Line.ArrowArcControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
821
                                        }
822
                                        break;
823
                                    case ("ArrowControl_Multi"):
824
                                        {
825
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Line.ArrowControl_Multi).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
826
                                        }
827
                                        break;
828
                                    case ("CloudControl"):
829
                                        {
830
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Polygon.CloudControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
831
                                        }
832
                                        break;
833
                                    case ("PolygonControl"):
834
                                        {
835
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Polygon.PolygonControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
836
                                        }
837
                                        break;
838
                                    case ("RectangleControl"):
839
                                        {
840
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.RectangleControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
841
                                        }
842
                                        break;
843
                                    case ("RectCloudControl"):
844
                                        {
845
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.RectCloudControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
846
                                        }
847
                                        break;
848
                                    case ("TriControl"):
849
                                        {
850
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.TriControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
851
                                        }
852
                                        break;
853
                                    case ("CircleControl"):
854
                                        {
855
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.CircleControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
856
                                        }
857
                                        break;
858
                                    case ("InsideWhiteControl"):
859
                                        {
860
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Cad.InsideWhiteControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
861
                                        }
862
                                        break;
863
                                    case ("OverlapWhiteControl"):
864
                                        {
865
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Cad.OverlapWhiteControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
866
                                        }
867
                                        break;
868
                                    case ("ClipWhiteControl"):
869
                                        {
870
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Cad.ClipWhiteControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
871
                                        }
872
                                        break;
873
                                    case ("CoordinateControl"):
874
                                        {
875
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Cad.CoordinateControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
876
                                        }
877
                                        break;
878
                                }
879

    
880
                                multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
881
                                UndoData.Markup_List.Add(multi_Undo_Data);
882
                                multi_Undo_Data = new Multi_Undo_data();
883
                            }
884

    
885
                            ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
886
                            {
887
                                ViewerDataModel.Instance.UndoDataList.Remove(i);
888
                            });
889
                            ViewerDataModel.Instance.UndoDataList.Add(UndoData);
890
                        }
891
                    }
892
                }
893
            }
894
        }
895

    
896
        //강인구 추가
897
        private void comboFontSize_SelectionChanged(object sender, SelectionChangedEventArgs e)
898
        {
899
            //if (this.ParentOfType<MainWindow>() != null)
900
            //{
901
            //    if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
902
            //    {
903
            //        foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
904
            //        {
905
            //            if (item.GetType().Name == "AdornerFinal")
906
            //            {
907
            //                foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
908
            //                {
909
            //                    switch (InnerItem.DrawingData.GetType().Name)
910
            //                    {
911
            //                        case ("TextControl"):
912
            //                            {
913
            //                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextSize = int.Parse(comboFontSize.Text);
914
            //                            }
915
            //                            break;
916
            //                        case ("ArrowTextControl"):
917
            //                            {
918
            //                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextSize = int.Parse(comboFontSize.Text);
919
            //                            }
920
            //                            break;
921
            //                    }
922
            //                }
923
            //            }
924
            //        }
925
            //    }
926
            //}
927
        }
928

    
929
        //강인구 추가
930
        private void btnBold_Checked(object sender, RoutedEventArgs e)
931
        {
932
            if (this.ParentOfType<MainWindow>() != null)
933
            {
934
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
935
                {
936
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
937
                    {
938
                        if (item.GetType().Name == "AdornerFinal")
939
                        {
940
                            foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
941
                            {
942
                                switch (InnerItem.DrawingData.GetType().Name)
943
                                {
944
                                    case ("TextControl"):
945
                                        {
946
                                            if((InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextWeight == FontWeights.Bold)
947
                                            {
948
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextWeight = FontWeights.Normal;
949
                                            }
950
                                            else
951
                                            {
952
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextWeight = FontWeights.Bold;
953
                                            }
954

    
955
                                        }
956
                                        break;
957
                                    case ("ArrowTextControl"):
958
                                        {
959
                                            if ((InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextWeight == FontWeights.Bold)
960
                                            {
961
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextWeight = FontWeights.Normal;
962
                                            }
963
                                            else
964
                                            {
965
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextWeight = FontWeights.Bold;
966
                                            }
967
                                        }
968
                                        break;
969
                                }
970
                            }
971
                        }
972
                    }
973
                }
974
            }
975
        }
976

    
977
        //강인구 추가
978
        private void btnItalic_Checked(object sender, RoutedEventArgs e)
979
        {
980
            if (this.ParentOfType<MainWindow>() != null)
981
            {
982
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
983
                {
984
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
985
                    {
986
                        if (item.GetType().Name == "AdornerFinal")
987
                        {
988
                            foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
989
                            {
990
                                switch (InnerItem.DrawingData.GetType().Name)
991
                                {
992
                                    case ("TextControl"):
993
                                        {
994
                                            if((InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextStyle == FontStyles.Italic)
995
                                            {
996
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextStyle = System.Windows.FontStyles.Normal;
997
                                            }
998
                                            else
999
                                            {
1000
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextStyle = FontStyles.Italic;
1001
                                            }
1002

    
1003
                                        }
1004
                                        break;
1005
                                    case ("ArrowTextControl"):
1006
                                        {
1007
                                            if((InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextStyle == FontStyles.Italic)
1008
                                            {
1009
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextStyle = FontStyles.Normal;
1010
                                            }
1011
                                            else
1012
                                            {
1013
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextStyle = FontStyles.Italic;
1014
                                            }
1015
                                        }
1016
                                        break;
1017
                                }
1018
                            }
1019
                        }
1020
                    }
1021
                }
1022
            }
1023
        }
1024

    
1025
        //강인구 추가
1026
        private void btnUnderLine_Checked(object sender, RoutedEventArgs e)
1027
        {
1028
            if (this.ParentOfType<MainWindow>() != null)
1029
            {
1030
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
1031
                {
1032
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
1033
                    {
1034
                        if (item.GetType().Name == "AdornerFinal")
1035
                        {
1036
                            foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
1037
                            {
1038
                                switch (InnerItem.DrawingData.GetType().Name)
1039
                                {
1040
                                    case ("TextControl"):
1041
                                        {
1042
                                            if ((InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).UnderLine == TextDecorations.Underline)
1043
                                            {
1044
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).UnderLine = null;
1045
                                            }
1046
                                            else
1047
                                            {
1048
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).UnderLine = TextDecorations.Underline;
1049
                                            }
1050
                                        }
1051
                                        break;
1052
                                    case ("ArrowTextControl"):
1053
                                        {
1054
                                            if ((InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).UnderLine == TextDecorations.Underline)
1055
                                            {
1056
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).UnderLine = null;
1057
                                            }
1058
                                            else
1059
                                            {
1060
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).UnderLine = TextDecorations.Underline;
1061
                                            }
1062
                                        }
1063
                                        break;
1064
                                }
1065
                            }
1066
                        }
1067
                    }
1068
                }
1069
            }
1070
        }
1071

    
1072
        private void AxisLockEvent(object sender, RoutedEventArgs e)
1073
        {
1074
            ViewerDataModel.Instance.checkAxis = cbAxisLock.IsChecked.Value;
1075
        }
1076

    
1077
        private void comboFontSize_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
1078
        {
1079
            if (string.IsNullOrEmpty(comboFontSize.Value.ToString()))
1080
            {
1081
                comboFontSize.Value = comboFontSize.Minimum;
1082
            }
1083
            if (this.ParentOfType<MainWindow>() != null)
1084
            {
1085
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
1086
                {
1087
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
1088
                    {
1089
                        if (item.GetType().Name == "AdornerFinal")
1090
                        {
1091
                            foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
1092
                            {
1093
                                switch (InnerItem.DrawingData.GetType().Name)
1094
                                {
1095
                                    case ("TextControl"):
1096
                                        {
1097
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextSize = int.Parse(comboFontSize.Value.ToString());
1098
                                        }
1099
                                        break;
1100
                                    case ("ArrowTextControl"):
1101
                                        {
1102
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextSize = int.Parse(comboFontSize.Value.ToString());
1103
                                        }
1104
                                        break;
1105
                                }
1106
                            }
1107
                        }
1108
                    }
1109
                }
1110
            }
1111
            KCOM.Properties.Settings.Default.TextSize = (double)comboFontSize.Value;
1112
            Properties.Settings.Default.Save();
1113
        }
1114

    
1115
        //강인구 추가
1116
        private void RadRibbonComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
1117
        {
1118
            if (this.ParentOfType<MainWindow>() != null)
1119
            {
1120
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
1121
                {
1122
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
1123
                    {
1124
                        if (item.GetType().Name == "AdornerFinal")
1125
                        {
1126
                            foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
1127
                            {
1128
                                switch (InnerItem.DrawingData.GetType().Name)
1129
                                {
1130
                                    case ("TextControl"):
1131
                                        {
1132
                                            //if ((InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).FontFamily == TextDecorations.Underline)
1133
                                            //{
1134
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).FontFamily = new FontFamily(comboFontFamily.Text);
1135
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).Base_TextBlock.FontFamily = new FontFamily(comboFontFamily.Text);
1136
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).Base_TextBox.FontFamily = new FontFamily(comboFontFamily.Text);
1137
                                            //}
1138
                                            //else
1139
                                            //{
1140
                                            //    (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).UnderLine = TextDecorations.Underline;
1141
                                            //}
1142
                                        }
1143
                                        break;
1144
                                    case ("ArrowTextControl"):
1145
                                        {
1146
                                            //if ((InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).UnderLine == TextDecorations.Underline)
1147
                                            //{
1148
                                            //    (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).UnderLine = null;
1149
                                            //}
1150
                                            //else
1151
                                            //{
1152
                                            //    (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).UnderLine = TextDecorations.Underline;
1153
                                            //}
1154
                                        }
1155
                                        break;
1156
                                }
1157
                            }
1158
                        }
1159
                    }
1160
                }
1161
            }
1162
        }
1163

    
1164
        /// <summary>
1165
        /// 텍스트 컨트롤 하일라이트 처리
1166
        /// </summary>
1167
        /// <param name="sender"></param>
1168
        /// <param name="e"></param>
1169
        private void HighlightEvent(object sender, RoutedEventArgs e)
1170
        {
1171

    
1172
            ViewerDataModel.Instance.checkHighShape = (sender as CheckBox).IsChecked.Value;
1173
            SetHighlightEvent();
1174
            //if ((sender as CheckBox).IsChecked.Value)
1175
            //{
1176
            //    TaskMessage("HighLight가 설정되었습니다", TaskMessageType.Normal);
1177
            //}
1178
            //else
1179
            //{
1180
            //    TaskMessage("HighLight가 해제되었습니다", TaskMessageType.Caption);
1181
            //}
1182
            //if (ViewerDataModel.Instance.SelectedEditor as MarkupToPDF.Controls.Text.TextControl != null)
1183
            //{
1184
            //    MarkupToPDF.Controls.Text.TextControl instance = (ViewerDataModel.Instance.SelectedEditor as MarkupToPDF.Controls.Text.TextControl);
1185
            //    instance.IsHighLight = ViewerDataModel.Instance.checkHighShape;
1186
            //    instance.SetText();
1187
            //}
1188
        }
1189

    
1190
        //추가페이지 이동 엔터
1191
        private void tlcurrentPage_KeyDown(object sender, KeyEventArgs e)
1192
        {
1193
            //강인구 추가 tlcurrentPage을 이상하게 입력할수 있기때문에 Try Catch
1194
            if (e.Key == Key.Enter)
1195
            {
1196
                try
1197
                {
1198
                    var instanceMain = this.ParentOfType<MainWindow>();
1199
                    var max = instanceMain.dzMainMenu.pageNavigator._thumbnailItems.Max(f => f.PageNumber);
1200
                    if (string.IsNullOrEmpty(tlcurrentPage.Text))
1201
                    {
1202
                        RadWindow.Alert(new DialogParameters
1203
                        {
1204
                            Owner = Application.Current.MainWindow,
1205
                            Theme = new VisualStudio2013Theme(),
1206
                            Header = "안내",
1207
                            Content = "페이지 번호를 정확하게 입력해 주세요",
1208
                        });
1209
                    }
1210
                    else
1211
                    {
1212
                        if (Convert.ToInt32(tlcurrentPage.Text) > max || Convert.ToInt32(tlcurrentPage.Text) == 0)
1213
                        {
1214
                            RadWindow.Alert(new DialogParameters
1215
                            {
1216
                                Owner = Application.Current.MainWindow,
1217
                                Theme = new VisualStudio2013Theme(),
1218
                                Header = "안내",
1219
                                Content = "페이지 번호를 정확하게 입력해 주세요",
1220
                            });
1221
                        }
1222
                        else
1223
                        {
1224
                            instanceMain.dzMainMenu.pageNavigator.GotoPage(Convert.ToInt32(tlcurrentPage.Text));
1225
                        }
1226
                    }
1227
                    
1228
                }
1229
                catch (Exception)
1230
                {
1231
                    RadWindow.Alert(new DialogParameters
1232
                    {
1233
                        Owner = Application.Current.MainWindow,
1234
                        Theme = new VisualStudio2013Theme(),
1235
                        Header = "안내",
1236
                        Content = "페이지 번호를 정확하게 입력해 주세요",
1237
                    });
1238
                }
1239
                
1240
            }
1241
        }
1242
        private string previousText;
1243
        private void TlcurrentPage_PreviewTextInput(object sender, TextCompositionEventArgs e)
1244
        {
1245
            System.Text.RegularExpressions.Regex regex = new System.Text.RegularExpressions.Regex("[^0-9]+");
1246
            e.Handled = regex.IsMatch(e.Text);
1247
        }
1248
        private void TlcurrentPage_TextChanged(object sender, TextChangedEventArgs e)
1249
        {
1250
            double num = 0;
1251
            bool success = double.TryParse(((TextBox)sender).Text, out num);
1252
            if (success & num >= 0)
1253
                previousText = ((TextBox)sender).Text;
1254
            else
1255
            {
1256
                if (string.IsNullOrEmpty(((TextBox)sender).Text))
1257
                {
1258
                    ((TextBox)sender).Text = "";
1259
                }
1260
                else
1261
                {
1262

    
1263
                    ((TextBox)sender).Text = previousText;
1264
                }
1265
            }
1266
        }
1267

    
1268
        /// <summary>
1269
        /// 입력한 페이지로 이동한다
1270
        /// </summary>
1271
        /// <param name="sender"></param>
1272
        /// <param name="e"></param>
1273
        private void tlcurrentPage_readonly_KeyDown(object sender, KeyEventArgs e)
1274
        {
1275
            if (e.Key == Key.Enter)
1276
            {
1277
                try
1278
                {
1279
                    var instanceMain = this.ParentOfType<MainWindow>();
1280
                    instanceMain.dzMainMenu.pageNavigator.GotoPage(Convert.ToInt32(tlcurrentPage_readonly.Text));
1281
                }
1282
                catch (Exception)
1283
                {
1284
                    RadWindow.Alert(new DialogParameters
1285
                    {
1286
                        Owner = Application.Current.MainWindow,
1287
                        Theme = new VisualStudio2013Theme(),
1288
                        Header = "안내",
1289
                        Content = "페이지 번호를 정확하게 입력해 주세요",
1290
                    });
1291
                }
1292
            }
1293
        }
1294
        
1295
        private void PanoramaEvent(object sender, RoutedEventArgs e)
1296
        {
1297
            PanoramaShow();
1298
        }
1299

    
1300
        public void PanoramaShow()
1301
        {
1302
            Panorama check = new Panorama();
1303
            double screenWidth = System.Windows.SystemParameters.PrimaryScreenWidth;
1304
            double screenHeight = System.Windows.SystemParameters.PrimaryScreenHeight;
1305
            //double windowWidth = this.Width;
1306
            //double windowHeight = this.Height;
1307

    
1308
            var PanoramaPop = new RadWindow
1309
            {
1310
                //MinWidth = 600,
1311
                //MinHeight = 400,
1312
                //Header = "My Check List",
1313
                Header = "Document No : " + this.ParentOfType<MainWindow>().dzMainMenu._DocItem.DOCUMENT_NO + " / Revision :" + this.ParentOfType<MainWindow>().dzMainMenu._DocItem.REVISION,
1314
                Content = check,
1315
                Owner = this,
1316
                ResizeMode = System.Windows.ResizeMode.CanResizeWithGrip,
1317
                //ResizeMode = System.Windows.ResizeMode.NoResize,
1318
                WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen,
1319
                IsTopmost = false,
1320
                //Left = (screenWidth / 2) - (windowWidth / 2),
1321
                //Top = (screenHeight / 2) - (windowHeight / 2),
1322
                //Left = (screenWidth / 2),
1323
                //Top = (screenHeight / 2),
1324
                Width = screenWidth * 0.4,
1325
                Height = screenHeight * 0.4,
1326
            };
1327
            StyleManager.SetTheme(PanoramaPop, new VisualStudio2013Theme());
1328
            //CheckPop.ShowDialog();
1329
            PanoramaPop.Owner = Application.Current.MainWindow;
1330
            PanoramaPop.Show();
1331
        }
1332

    
1333
        private void CheckEvent(object sender, RoutedEventArgs e)
1334
        {
1335
            //창이 떠있을 경우 재 실행 방지
1336
            if (isClosed)
1337
            {
1338
                //토글 및 마우스 상태 초기화
1339
                var toggleList = this.Parent.ChildrenOfType<RadToggleButton>();
1340
                foreach(var togle in toggleList)
1341
                {
1342
                    togle.IsChecked = false;
1343
                }
1344
                this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
1345

    
1346
                isClosed = false;
1347

    
1348
                
1349
                CheckList check = new CheckList();
1350

    
1351
                CheckPop = new RadWindow
1352
                {
1353
                    MinWidth = 1200,
1354
                    MinHeight = 500,
1355
                    //Header = "My Check List",
1356
                    Header = "Document No : " + this.ParentOfType<MainWindow>().dzMainMenu._DocItem.DOCUMENT_NO + " / Revision :" + this.ParentOfType<MainWindow>().dzMainMenu._DocItem.REVISION,
1357
                    Content = check,
1358
                    //Owner = this,
1359
                    //ResizeMode = System.Windows.ResizeMode.CanResizeWithGrip,
1360
                    ResizeMode = System.Windows.ResizeMode.NoResize,
1361
                    WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen,
1362
                    IsTopmost = true,
1363
                };
1364
                StyleManager.SetTheme(CheckPop, new Office2013Theme());
1365
                CheckPop.Closed += CheckPop_Closed;
1366
                
1367
                //CheckPop.ShowDialog();
1368
                CheckPop.Show();
1369
            }
1370
        }
1371

    
1372
        private void OptionPop_Closed(object sender, WindowClosedEventArgs e)
1373
        {
1374
            isClosed = true;
1375
            //this.ParentOfType<MainWindow>().dzMainMenu.PN_Navi.IsEnabled = true;
1376
            this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
1377
            ViewerDataModel.Instance.Capture_Opacity = 0;
1378
        }
1379

    
1380
        private void CheckPop_Closed(object sender, WindowClosedEventArgs e)
1381
        {
1382
            isClosed = true;
1383
            //this.ParentOfType<MainWindow>().dzMainMenu.PN_Navi.IsEnabled = true;
1384
            this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
1385
            ViewerDataModel.Instance.Capture_Opacity = 0;
1386
        }
1387

    
1388
        /// <summary>
1389
        /// 사용자가 선택한 페이지로 이동(썸네일 동기화 시킴)
1390
        /// </summary>
1391
        /// <param name="sender"></param>
1392
        /// <param name="e"></param>
1393
        private void PageGoEvent(object sender, RoutedEventArgs e)
1394
        {
1395
            RadButton button = sender as RadButton;
1396
            var instanceMain = this.ParentOfType<MainWindow>();
1397
            
1398
            //강인구 추가 tlcurrentPage을 이상하게 입력할수 있기때문에 Try Catch
1399
            try
1400
            {
1401
                switch (button.CommandParameter.ToString())
1402
                {
1403
                    case "Down":
1404
                        {
1405
                            instanceMain.dzMainMenu.pageNavigator.GotoPage(Convert.ToInt32(tlcurrentPage.Text) + 1);
1406
                        }
1407
                        break;
1408
                    case "Up":
1409
                        {
1410
                            instanceMain.dzMainMenu.pageNavigator.GotoPage(Convert.ToInt32(tlcurrentPage.Text) - 1);
1411
                        }
1412
                        break;
1413
                }
1414
            }
1415
            catch (Exception)
1416
            {
1417
                RadWindow.Alert(new DialogParameters
1418
                {
1419
                    Owner = Application.Current.MainWindow,
1420
                    Theme = new VisualStudio2013Theme(),
1421
                    Header = "안내",
1422
                    Content = "페이지 번호를 정확하게 입력해 주세요",
1423
                });
1424
            }
1425
        }
1426

    
1427
        private void viewEvent(object sender, RoutedEventArgs e)
1428
        {
1429
            RadRibbonToggleButton viewButton = sender as RadRibbonToggleButton;
1430
            var instanceMain = this.ParentOfType<MainWindow>();
1431

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

    
1434
            //if ((sender as RadRibbonToggleButton) != null)
1435
            //{
1436
            //    Common.ViewerDataModel.Instance.ControlTag = (sender as RadRibbonToggleButton).Tag.ToString();
1437
            //    instanceToggle = (sender as RadRibbonToggleButton);
1438
            //}
1439

    
1440
            //instanceToggle.IsChecked = false;
1441

    
1442
            switch (viewButton.CommandParameter.ToString())
1443
            {
1444
                case "zoomout":
1445
                    {
1446
                        //장원
1447
                        //instanceMain.dzMainMenu.zoomAndPanControl.ZoomTo(new Rect(0, 0, instanceMain.dzMainMenu.zoomAndPanCanvas.ActualWidth, instanceMain.dzMainMenu.zoomAndPanCanvas.ActualHeight));
1448
                        instanceMain.dzMainMenu.zoomAndPanControl.ZoomPointToViewportCenter(ViewerDataModel.Instance.ContentScale -= 0.1, point);
1449
                        viewButton.IsChecked = false;
1450
                        //Common.ViewerDataModel.Instance.zom
1451
                    }
1452
                    break;
1453
                case "zoomin":
1454
                    {
1455
                        instanceMain.dzMainMenu.zoomAndPanControl.ZoomPointToViewportCenter(ViewerDataModel.Instance.ContentScale += 0.1, point);
1456
                        viewButton.IsChecked = false;
1457
                    }
1458
                    break;
1459
                case "fullscreen":
1460
                    {
1461
                        instanceMain.WindowState = WindowState.Maximized;
1462
                        //Sizemode 대기(강인구)
1463
                        //instanceMain.dzMainMenu.imageViewer.SizeMode = Leadtools.Windows.Controls.SizeMode.Fit;
1464
                        instanceMain.dzMainMenu.zoomAndPanControl.ScaleToFit();
1465
                        viewButton.IsChecked = false;
1466
                    }
1467
                    break;
1468
                case "fitWidth":
1469
                    {
1470
                        instanceMain.dzMainMenu.zoomAndPanControl.ScaleToFit();
1471
                        viewButton.IsChecked = false;
1472
                    }
1473
                    break;
1474
                case "fitHeight":
1475
                    {
1476
                        instanceMain.dzMainMenu.zoomAndPanControl.ScaleToFit();
1477
                        viewButton.IsChecked = false;
1478
                    }
1479
                    break;
1480
                case "boundzoom":
1481
                    {
1482

    
1483
                    }
1484
                    break;
1485
                case "Rotate_M":
1486
                    {
1487
                        drawingPannelRotate(false);
1488
                        viewButton.IsChecked = false;
1489
                    }
1490
                    break;
1491
                case "Rotate_P":
1492
                    {
1493
                        drawingPannelRotate(true);
1494
                        viewButton.IsChecked = false;
1495
                    }
1496
                    break;
1497
                case "Rotate_half":
1498
                    {
1499
                        drawingPannelRotate(true);
1500
                        drawingPannelRotate(true);
1501
                        viewButton.IsChecked = false;
1502
                    }
1503
                    break;
1504
            }
1505
        }
1506

    
1507
        private void Control_Event(object sender, RoutedEventArgs e)
1508
        {
1509

    
1510
        }
1511

    
1512
        #region 대기
1513

    
1514
        public void drawingPannelRotate(bool Flag)
1515
        {
1516
            var instanceMain = this.ParentOfType<MainWindow>();
1517

    
1518
            //if (rotateOffSet > 3)
1519
            //    rotateOffSet = 0;
1520

    
1521
            //if (rotateOffSet < 0)
1522
            //    rotateOffSet = 3;
1523

    
1524
            if(Flag)
1525
            {
1526
                if (instanceMain.dzMainMenu.rotate.Angle == 270)
1527
                {
1528
                    instanceMain.dzMainMenu.rotate.Angle = 0;
1529
                }
1530
                else
1531
                {
1532
                    instanceMain.dzMainMenu.rotate.Angle += 90;
1533
                }
1534
            }
1535
            else
1536
            {
1537
                if(instanceMain.dzMainMenu.rotate.Angle == 0)
1538
                {
1539
                    instanceMain.dzMainMenu.rotate.Angle = 270;
1540
                }
1541
                else
1542
                {
1543
                    instanceMain.dzMainMenu.rotate.Angle -= 90;
1544
                }
1545
            }
1546
            //double angle = (double)rotateValue.GetValue(rotateOffSet);
1547
            //instanceMain.dzMainMenu.rotate.Angle = angle;
1548
            var rotationNum = Math.Abs((instanceMain.dzMainMenu.rotate.Angle / 90));
1549

    
1550
            if (instanceMain.dzMainMenu.zoomAndPanCanvas.Width == ViewerDataModel.Instance.ContentWidth)
1551
            {
1552
                double emptySize = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
1553
                instanceMain.dzMainMenu.zoomAndPanCanvas.Width = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
1554
                instanceMain.dzMainMenu.zoomAndPanCanvas.Height = emptySize;
1555
            }
1556
            if (instanceMain.dzMainMenu.rotate.Angle == 0)
1557
            {
1558
                instanceMain.dzMainMenu.translate.X = 0;
1559
                instanceMain.dzMainMenu.translate.Y = 0;
1560
            }
1561
            else if (instanceMain.dzMainMenu.rotate.Angle == 90)
1562
            {
1563
                instanceMain.dzMainMenu.translate.X = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
1564
                instanceMain.dzMainMenu.translate.Y = 0;
1565
            }
1566
            else if (instanceMain.dzMainMenu.rotate.Angle == 180)
1567
            {
1568
                instanceMain.dzMainMenu.translate.X = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
1569
                instanceMain.dzMainMenu.translate.Y = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
1570
            }
1571
            else
1572
            {
1573
                instanceMain.dzMainMenu.translate.X = 0;
1574
                instanceMain.dzMainMenu.translate.Y = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
1575
            }
1576

    
1577
            //instanceMain.dzMainMenu.zoomAndPanControl.RenderTransformOrigin = new Point(0.5, 0.5);
1578
            instanceMain.dzMainMenu.zoomAndPanControl.RotationAngle = instanceMain.dzMainMenu.rotate.Angle;
1579
            //대기(강인구)
1580
            //instanceMain.dzMainMenu.imageViewer.RotateAngle = instanceMain.dzMainMenu.rotate.Angle;
1581

    
1582

    
1583
            //instanceMain.dzMainMenu.imageViewer.RenderTransformOrigin = new Point(0.5, 0.5);
1584
            //RotateTransform rotateTransform = new RotateTransform(instanceMain.dzMainMenu.rotate.Angle);
1585
            //instanceMain.dzMainMenu.imageViewer.RenderTransform = rotateTransform;
1586

    
1587

    
1588
            ViewerDataModel.Instance.ContentWidth = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
1589
            ViewerDataModel.Instance.ContentHeight = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
1590
            ViewerDataModel.Instance.AngleOffsetX = instanceMain.dzMainMenu.translate.X;
1591
            ViewerDataModel.Instance.AngleOffsetY = instanceMain.dzMainMenu.translate.Y;
1592
            ViewerDataModel.Instance.Angle = instanceMain.dzMainMenu.rotate.Angle;
1593
            //ViewerDataModel.Instance.Document_Info.Clear();
1594
            //ViewerDataModel.Instance.Document_Info.Where(i => i.PAGE_NUMBER == instanceMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber).ToList().ForEach(value =>
1595
            //{
1596
            //    value.PAGE_ANGLE = int.Parse(instanceMain.dzMainMenu.rotate.Angle.ToString());
1597
            //});
1598

    
1599

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

    
1605
                instanceMain.dzMainMenu.pageNavigator.ImgListbox.ItemsSource = instanceMain.dzMainMenu.pageNavigator._thumbnailItems;
1606
                var instance = instanceMain.dzMainMenu.CurrentDoc.docInfo.DOCPAGE.Where(p => p.PAGE_NUMBER == instanceMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber).FirstOrDefault();
1607
                instance.PAGE_ANGLE = int.Parse(instanceMain.dzMainMenu.rotate.Angle.ToString());
1608

    
1609
                instanceMain.dzMainMenu.pageNavigator.GotoPage(data.PageNumber);
1610

    
1611
                //rotation page add or update
1612
                var rotationdoc = ViewerDataModel.Instance.RotationDocs.Where(d => d.ID == instance.ID).FirstOrDefault();
1613
                if (rotationdoc != null)
1614
                {
1615
                    rotationdoc.PAGE_ANGLE = instance.PAGE_ANGLE;
1616
                }
1617
                else
1618
                {
1619
                    ViewerDataModel.Instance.RotationDocs.Add(instance);
1620
                }
1621
            });
1622
        }
1623
        #endregion
1624

    
1625
        private void ImageConverter(RadToggleButton instanceToggle)
1626
        {
1627
            try
1628
            {           
1629
                var instanceMain = this.ParentOfType<MainWindow>();
1630
                //http://cloud.devdoftech.co.kr:5977/ImageUpload/FileUpload.asmx
1631

    
1632
                Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
1633
                dlg.Filter = "All files (*.*)|*.*|PNG Images (*.png)|*.png";
1634
                Nullable<bool> result = dlg.ShowDialog();
1635
                if (result == true)
1636
                {
1637
                    instanceMain.dzMainMenu.filename = dlg.FileName;
1638
                    instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ImgControl;
1639

    
1640
                    System.IO.FileInfo fileInfo = new System.IO.FileInfo(instanceMain.dzMainMenu.filename);
1641
                    String strFile = System.IO.Path.GetFileName(instanceMain.dzMainMenu.filename);
1642
                    long numByte = fileInfo.Length;
1643
                    double dLen = Convert.ToDouble(fileInfo.Length / 1000000);
1644
                    kr.co.devdoftech.cloud.FileUpload fileUploader = new kr.co.devdoftech.cloud.FileUpload();
1645

    
1646
                    if (dLen < 4)
1647
                    {
1648
                        System.IO.FileStream fStream = new System.IO.FileStream(instanceMain.dzMainMenu.filename, System.IO.FileMode.Open, System.IO.FileAccess.Read);
1649
                        System.IO.BinaryReader br = new System.IO.BinaryReader(fStream);
1650
                        byte[] data = br.ReadBytes((int)numByte);
1651
                        br.Close();
1652

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

    
1655
                        Check_Uri.UriCheck(filepath);
1656

    
1657
                        instanceMain.dzMainMenu.filename = filepath;
1658

    
1659
                        fStream.Close();
1660
                        fStream.Dispose();
1661
                    }
1662
                    else
1663
                    {
1664
                        this.ParentOfType<MainWindow>().DialogMessage_Alert("Available Memory less than 4 mega byte", "Alert");
1665
                    }
1666
                }
1667
                else
1668
                {
1669
                    instanceToggle.IsChecked = false;
1670
                    Common.ViewerDataModel.Instance.SelectedControl = "";
1671
                    Common.ViewerDataModel.Instance.ControlTag = null;
1672
                    this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
1673
                    this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
1674
                    this.ParentOfType<MainWindow>().DialogMessage_Alert("No Image selected.", "Alert");
1675
                }
1676
            }
1677
            catch(Exception ex)
1678
            {
1679
                instanceToggle.IsChecked = false;
1680
                Common.ViewerDataModel.Instance.SelectedControl = "";
1681
                Common.ViewerDataModel.Instance.ControlTag = null;
1682
                this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
1683
                this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
1684
                this.ParentOfType<MainWindow>().DialogMessage_Alert(""+ ex , "Alert");
1685
            }
1686
        }
1687

    
1688
        private void Control_Init(RadToggleButton instanceToggle, object sender)
1689
        {
1690

    
1691
        }
1692

    
1693
        private void ControlEvent(object sender, RoutedEventArgs e)
1694
        {
1695
            RadToggleButton instanceToggle = sender as RadToggleButton;
1696
            var instanceMain = this.ParentOfType<MainWindow>();
1697

    
1698
            #region Ctrl + A 눌렀을 때 대처 방법 
1699
            //원인 : Ctrl + A를 누르면 UIElementSet에 등록을 시키지 않는다(이유는 한꺼번에 많은 양의 컨트롤의 동작이 유입되기 때문에
1700
            //       시스템의 성능저하를 불러올 수 있기 때문이다. 그래서 선택 후 다른 컨트롤을 누르면 등록되지 않은 컨트롤이기 때문에 삭제된다
1701
            //       이를 대처하는 방법으로 아래 코드를 사용한다.
1702
            if (Common.ViewerDataModel.Instance.MarkupControls.Count == 0 && Common.ViewerDataModel.Instance.MarkupControls.Count >= 1)
1703
            {
1704
                //var lstItem = instanceMain.DeepLayer._SelectLayer.ChildrenOfType<AdornerFinal>().ToList();
1705
                //foreach (var item in lstItem)
1706
                //{
1707
                //    foreach (var member in item.MemberSet)
1708
                //    {
1709
                //        if (!instanceMain.DeepLayer.UIElementSet.Contains(member.DrawingData))
1710
                //        {
1711
                //            instanceMain.DeepLayer.UIElementSet.Add(member.DrawingData);
1712
                //        }
1713
                //    }
1714
                //}
1715
            }
1716
            #endregion
1717

    
1718
            //if (!instanceMain.IsFreeSelectionMode)
1719
            //{
1720
            //    instanceMain.IsSwingMode = true;
1721
            //}
1722

    
1723
            #region 다른 컨트롤 버튼 선택 해제
1724
            System.Reactive.Linq.Observable2.FromPropertyChangedPattern(Common.ViewerDataModel.Instance, temp => temp.SelectedControl).Subscribe(ControlState =>
1725
            {
1726
                if (ControlState == null)
1727
                {
1728
                    instanceToggle.IsChecked = false;
1729
                    HiddenControlHide();
1730
                }
1731
            });
1732
            #endregion
1733

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

    
1736
            if (instanceToggle != null)
1737
            {
1738
                Common.ViewerDataModel.Instance.ControlTag = instanceToggle.Tag.ToString();
1739
            }
1740
            else if ((sender as RadRibbonToggleButton) != null)
1741
            {
1742
                Common.ViewerDataModel.Instance.ControlTag = (sender as RadRibbonToggleButton).Tag.ToString();
1743
                instanceToggle = (sender as RadRibbonToggleButton);
1744
            }
1745
            else if ((sender as RadRibbonButton) != null)
1746
            {
1747
                RadRibbonButton instanceButton = sender as RadRibbonButton;
1748
                Common.ViewerDataModel.Instance.ControlTag = instanceButton.Tag.ToString();
1749
            }
1750
            else
1751
            {
1752
                RadButton instanceButton = sender as RadButton;
1753
                Common.ViewerDataModel.Instance.ControlTag = instanceButton.Tag.ToString();
1754
            }
1755

    
1756

    
1757

    
1758
            System.Reactive.Linq.Observable2.FromPropertyChangedPattern(Common.ViewerDataModel.Instance, temp => temp.AngleVisibility).Subscribe(isSee =>
1759
            {
1760
                instanceMain.dzMainMenu.MainAngle.Visibility = isSee;
1761
                System.Reactive.Linq.Observable2.FromPropertyChangedPattern(Common.ViewerDataModel.Instance, temp => temp.AngleValue).Subscribe(p =>
1762
                {
1763
                    instanceMain.dzMainMenu.MainAngle.AngleValue = p;
1764
                });
1765
            });
1766
            instanceMain.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Drawing;
1767

    
1768
            instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = false;
1769

    
1770
            if (instanceToggle.IsChecked != false)
1771
            {
1772
                #region 컨트롤이 체크되었다면
1773
                switch (instanceToggle.CommandParameter.ToString())
1774
                {
1775
                    #region Line
1776
                    case "Line":
1777
                        Common.ViewerDataModel.Instance.SelectedControl = "Line";
1778
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1779
                        if (instanceToggle.Tag.ToString() == "LineDelete")
1780
                        {
1781
                            //HiddenInterval.Visibility = Visibility.Visible;
1782
                        }
1783
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.SingleLine;
1784
                        break;
1785
                    #endregion
1786
                    #region ChainLine
1787
                    case "ChainLine":
1788
                        Common.ViewerDataModel.Instance.SelectedControl = "ChainLine";
1789
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1790
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ChainLine;
1791
                        break;
1792
                    #endregion
1793
                    #region DimLine
1794
                    case "DimLine":
1795
                        Common.ViewerDataModel.Instance.SelectedControl = "DimLine";
1796
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1797
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.DimLine;
1798
                        break;
1799
                    #endregion
1800
                    #region TwinLine
1801
                    case "TwinLine":
1802
                        Common.ViewerDataModel.Instance.SelectedControl = "TwinLine";
1803
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1804
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.TwinLine;
1805
                        break;
1806
                    #endregion
1807
                    #region CancelLine
1808
                    case "CancelLine":
1809
                        Common.ViewerDataModel.Instance.SelectedControl = "CancelLine";
1810
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1811
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.CancelLine;
1812
                        break;
1813
                    #endregion
1814
                    #region PolygonCloud
1815
                    case "PolygonCloud":
1816
                        Common.ViewerDataModel.Instance.SelectedControl = "PolygonCloud";
1817
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1818
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.PolygonCloud;
1819
                        break;
1820
                    #endregion
1821
                    #region RectCloud
1822
                    case "RectCloud":
1823
                        Common.ViewerDataModel.Instance.SelectedControl = "RectCloud";
1824
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1825
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.RectCloud;
1826
                        break;
1827
                    #endregion
1828
                    #region Rectangle
1829
                    case "Rectangle":
1830
                        Common.ViewerDataModel.Instance.SelectedControl = "Rectangle";
1831
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1832
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Rectangle;
1833
                        break;
1834
                    #endregion
1835
                    #region Triangle
1836
                    case "Triangle":
1837
                        Common.ViewerDataModel.Instance.SelectedControl = "Triangle";
1838
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1839
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Triangle;
1840
                        break;
1841
                    #endregion
1842
                    #region RectCloud
1843
                    case "Circle":
1844
                        Common.ViewerDataModel.Instance.SelectedControl = "Circle";
1845
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1846
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Circle;
1847
                        break;
1848
                    #endregion
1849
                    #region Symbol
1850
                    case "Symbol":
1851
                        Common.ViewerDataModel.Instance.SelectedControl = "Symbol";
1852
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
1853
                        break;
1854
                    #endregion
1855
                    #region SymbolN
1856
                    case "SymbolN":
1857
                        Common.ViewerDataModel.Instance.SelectedControl = "SymbolN";
1858
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Stamp;
1859
                        break;
1860
                    #endregion
1861
                    #region Text
1862
                    case "Text":
1863
                        Common.ViewerDataModel.Instance.SelectedControl = "Text";
1864
                        TaskMessage("Text 도구는 텍스트 영역을 더블 클릭하여 텍스트를 재 편집 할 수 있습니다", TaskMessageType.Normal);
1865
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.TextControl;
1866
                        break;
1867
                    #endregion
1868
                    #region TextBorder
1869
                    case "TextBorder":
1870
                        Common.ViewerDataModel.Instance.SelectedControl = "TextBorder";
1871
                        TaskMessage("Text 도구는 텍스트 영역을 더블 클릭하여 텍스트를 재 편집 할 수 있습니다", TaskMessageType.Normal);
1872
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.TextBorder;
1873
                        break;
1874
                    #endregion
1875
                    #region TextCloud
1876
                    case "TextCloud":
1877
                        Common.ViewerDataModel.Instance.SelectedControl = "TextCloud";
1878
                        TaskMessage("Text 도구는 텍스트 영역을 더블 클릭하여 텍스트를 재 편집 할 수 있습니다", TaskMessageType.Normal);
1879
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.TextCloud;
1880
                        break;
1881
                    #endregion
1882
                    #region Date
1883
                    case "Date":
1884
                        Common.ViewerDataModel.Instance.SelectedControl = "Date";
1885
                        TaskMessage("날짜 컨트롤을 더블 클릭하면 날짜를 변경할 수 있습니다", TaskMessageType.Normal);
1886
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Date;
1887
                        break;
1888
                    #endregion
1889
                    #region ArrowText
1890
                    case "ArrowText":
1891
                        TaskMessage("ArrowText 컨트롤은 그린 후 컨트롤을 선택하였을 시 중간점을 조정할 수 있습니다", TaskMessageType.Normal);
1892
                        if (instanceToggle.Tag.ToString() == "ArrowText_Cloud")
1893
                        {
1894
                            Common.ViewerDataModel.Instance.SelectedControl = "ArrowText_Cloud";
1895
                            instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowTextCloudControl;
1896
                        }
1897
                        else if (instanceToggle.Tag.ToString() == "ArrowText_Border")
1898
                        {
1899
                            Common.ViewerDataModel.Instance.SelectedControl = "ArrowTextBorderControl";
1900
                            instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowTextBorderControl;
1901
                        }
1902
                        else if (instanceToggle.Tag.ToString() == "ArrowTextFix_Normal")
1903
                        {
1904
                            Common.ViewerDataModel.Instance.SelectedControl = "ArrowTransTextControl";
1905
                            instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowTransTextControl;
1906
                        }
1907
                        else if (instanceToggle.Tag.ToString() == "ArrowTextFix_Border")
1908
                        {
1909
                            Common.ViewerDataModel.Instance.SelectedControl = "ArrowTransTextBorderControl";
1910
                            instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowTransTextBorderControl;
1911
                        }
1912
                        else if (instanceToggle.Tag.ToString() == "ArrowTextFix_Cloud")
1913
                        {
1914
                            Common.ViewerDataModel.Instance.SelectedControl = "ArrowTransTextCloudControl";
1915
                            instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowTransTextCloudControl;
1916
                        }
1917
                        else
1918
                        {
1919
                            Common.ViewerDataModel.Instance.SelectedControl = "ArrowText";
1920
                            instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowTextControl;
1921
                            //HiddenAxisLock.Visibility = Visibility.Visible;
1922
                        }
1923
                        break;
1924
                    #endregion
1925
                    #region Arrow
1926
                    case "Arrow":
1927
                        Common.ViewerDataModel.Instance.SelectedControl = "Arrow";
1928
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1929
                        //HiddenDimSize.Visibility = Visibility.Visible;
1930
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowLine;
1931
                        break;
1932
                    #endregion
1933
                    #region Shape
1934
                    case "Shape":
1935
                        Common.ViewerDataModel.Instance.SelectedControl = "Shape";
1936
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Mark;
1937
                        break;
1938
                    #endregion
1939
                    #region Polygon
1940
                    case "Polygon":
1941
                        Common.ViewerDataModel.Instance.SelectedControl = "Polygon";
1942
                        TaskMessage("자유형 코멘트 도구는 오른쪽 마우스 클릭을 통해 그리기를 마칠 수 있습니다", TaskMessageType.Normal);
1943
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1944
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.PolygonControl;
1945
                        break;
1946
                    #endregion
1947
                    #region Arc
1948
                    case "Arc":
1949
                        Common.ViewerDataModel.Instance.SelectedControl = "Arc";
1950
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArcLine;
1951
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1952
                        TaskMessage("Arc 코멘트 도구는 오른쪽 마우스를 사용해 좌우 반전을 사용하실 수 있습니다", TaskMessageType.Normal);
1953
                        break;
1954
                    #endregion
1955
                    #region ArrowArc
1956
                    case "ArrowArc":
1957
                        Common.ViewerDataModel.Instance.SelectedControl = "ArrowArc";
1958
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArcArrow;
1959
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1960
                        TaskMessage("ArcArrow 코멘트 도구는 오른쪽 마우스를 사용해 좌우 반전을 사용하실 수 있습니다", TaskMessageType.Normal);
1961
                        break;
1962
                    #endregion
1963
                    #region ArrowMulti
1964
                    case "ArrowMulti":
1965
                        Common.ViewerDataModel.Instance.SelectedControl = "ArrowMulti";
1966
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowMultiLine;
1967
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1968
                        break;
1969
                    #endregion
1970
                    #region Etc
1971
                    case "Etc":
1972
                        Common.ViewerDataModel.Instance.SelectedControl = "Etc";
1973
                        break;
1974
                    #endregion
1975
                    #region Ink
1976
                    case "Ink":
1977
                        if (instanceToggle.Tag.ToString() == "EraserClear")
1978
                        {
1979
                            TaskMessage("해당 컨트롤은 점 단위로 그려진 펜을 지웁니다", TaskMessageType.Normal);
1980
                            //instanceMain.dzMainMenu.inkDrawingCanvas.EditingMode = InkCanvasEditingMode.EraseByPoint;
1981
                            instanceMain.dzMainMenu.inkBoard.Tag = "EraseByPoint";
1982
                        }
1983
                        else if (instanceToggle.Tag.ToString() == "Eraser")
1984
                        {
1985
                            TaskMessage("해당 컨트롤은 선 단위로 그려진 펜을 지웁니다", TaskMessageType.Normal);
1986
                            instanceMain.dzMainMenu.inkBoard.Tag = "EraseByStroke";
1987
                            //instanceMain.dzMainMenu.inkDrawingCanvas.EditingMode = InkCanvasEditingMode.EraseByStroke;
1988
                        }
1989
                        else
1990
                        {
1991
                            instanceMain.dzMainMenu.inkBoard.Tag = "Ink";
1992
                            //instanceMain.dzMainMenu.inkDrawingCanvas.EditingMode = InkCanvasEditingMode.Ink;
1993
                        }
1994

    
1995
                        //instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = true;
1996

    
1997
                        Common.ViewerDataModel.Instance.SelectedControl = "Ink";
1998
                        Common.ViewerDataModel.Instance.LineSize = (double)cbLineSize.Value;
1999
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.PenControl;
2000
                        break;
2001
                    #endregion
2002
                    #region Select
2003
                    case "Select":
2004
                        if(this.ParentOfType<MainWindow>().dzMainMenu.currentControl != null)
2005
                        {
2006
                            ViewerDataModel.Instance.MarkupControls_USER.Remove(this.ParentOfType<MainWindow>().dzMainMenu.currentControl);
2007
                            this.ParentOfType<MainWindow>().dzMainMenu.currentControl = null;
2008
                        }
2009
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Selecting;
2010
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2011
                        instanceMain.dzMainMenu.isLeftMouseButtonDownOnWindow = false;
2012
                        break;
2013
                    #endregion
2014
                    #region Image
2015
                    case "Image":
2016
                        Common.ViewerDataModel.Instance.SelectedControl = "ImgControl";
2017
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ImgControl;
2018
                        ImageConverter(instanceToggle);
2019
                        break;
2020
                    #endregion
2021
                    #region Sign
2022
                    case "Sign":
2023
                        Common.ViewerDataModel.Instance.SelectedControl = "Sign";
2024
                        Common.ViewerDataModel.Instance.ControlTag = instanceMain.dzMainMenu._ViewInfo.UserID; //사번
2025
                        //강인구 추가
2026
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Sign;
2027
                        //instanceMain.BaseClient.GetUserSignCompleted += (sen, ea) =>
2028
                        //{
2029
                        //    if (ea.Result == null)
2030
                        //    {
2031

    
2032
                        //        this.ParentOfType<MainPage>().DialogMessage_Alert("You Don't Have Sign Data", "Alert");
2033
                        //    }
2034
                        //    else
2035
                        //    {
2036
                        //        byte[] imageBytes = System.Convert.FromBase64String(ea.Result);
2037
                        //        using (MemoryStream ms = new MemoryStream(imageBytes))
2038
                        //        {
2039
                        //            BitmapImage im = new BitmapImage();
2040
                        //            im.SetSource(ms);
2041
                        //            instanceMain.DeepLayer.SignImage = im;
2042
                        //            ms.Close();
2043
                        //        }
2044
                        //    }
2045
                        //};
2046
                        //instanceMain.BaseClient.GetUserSignAsync(instanceMain._ViewInfo.UserID);
2047
                        break;
2048
                    #endregion
2049
                    #region Check
2050
                    case "Check":
2051
                        Common.ViewerDataModel.Instance.SelectedControl = "Check";
2052
                        Common.ViewerDataModel.Instance.ControlTag = instanceMain.dzMainMenu._ViewInfo.UserID; //사번
2053
                        //강인구 추가
2054
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Symbol;
2055
                        break;
2056
                    #endregion
2057
                    #region Batch
2058
                    case "Batch":
2059
                        Common.ViewerDataModel.Instance.SelectedControl = "Batch";
2060
                        Common.ViewerDataModel.Instance.ControlTag = instanceMain.dzMainMenu._ViewInfo.UserID; //사번
2061
                        //강인구 추가
2062
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Mark;
2063
                        instanceMain.dzMainMenu.txtBatch.Visibility = Visibility.Visible;
2064
                        instanceMain.dzMainMenu.txtBatch.Text = "Place Mark";
2065
                        break;
2066
                    #endregion
2067
                    #region Copy
2068
                    case "Copy":
2069
                        Copy_Start();
2070
                        instanceToggle.IsChecked = false;
2071
                        ViewerDataModel.Instance.SelectedControl = "";
2072
                        ViewerDataModel.Instance.ControlTag = null;
2073
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2074
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2075
                        break;
2076
                    #endregion
2077
                    #region Cut
2078
                    case "Cut":
2079
                        //Cut_Start();
2080
                        CutCommand.Instance.Execute();
2081
                        instanceToggle.IsChecked = false;
2082
                        ViewerDataModel.Instance.SelectedControl = "";
2083
                        ViewerDataModel.Instance.ControlTag = null;
2084
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2085
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2086
                        break;
2087
                    #endregion
2088
                    #region Paste
2089
                    case "Paste":
2090
                        Paste_Start();
2091
                        instanceToggle.IsChecked = false;
2092
                        ViewerDataModel.Instance.SelectedControl = "";
2093
                        ViewerDataModel.Instance.ControlTag = null;
2094
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2095
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;                        
2096
                        break;
2097
                    #endregion
2098
                    #region Delete
2099
                    case "Delete":
2100
                        DeleteCommand.Instance.Execute(SelectionSet.Instance.SelectedItems);
2101
                        this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Clear();
2102

    
2103
                        instanceToggle.IsChecked = false;
2104
                        ViewerDataModel.Instance.SelectedControl = "";
2105
                        ViewerDataModel.Instance.ControlTag = null;
2106
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2107
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2108
                        break;
2109
                    #endregion
2110
                    #region Undo
2111
                    case "Undo":
2112
                        UndoCommand.Instance.Execute();
2113
                        instanceToggle.IsChecked = false;
2114
                        ViewerDataModel.Instance.SelectedControl = "";
2115
                        ViewerDataModel.Instance.ControlTag = null;
2116
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2117
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2118
                        break;
2119
                    #endregion
2120
                    #region Redo
2121
                    case "Redo":
2122
                        RedoCommand.Instance.Execute();
2123
                        instanceToggle.IsChecked = false;
2124
                        ViewerDataModel.Instance.SelectedControl = "";
2125
                        ViewerDataModel.Instance.ControlTag = null;
2126
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2127
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2128
                        break;
2129
                    #endregion
2130
                    #region DragZoom
2131
                    case "DragZoom":
2132
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.DragZoom;
2133
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2134
                        instanceMain.dzMainMenu.isLeftMouseButtonDownOnWindow = false;
2135
                        break;
2136
                    #endregion
2137
                    #region Grouping
2138
                    case "Group":
2139
                        //var GrouptoggleList = this.Parent.ChildrenOfType<RadRibbonToggleButton>();
2140
                        //foreach (var togle in GrouptoggleList)
2141
                        //{
2142
                        //    togle.IsChecked = false;
2143
                        //}
2144

    
2145
                        //if (this.ParentOfType<MainWindow>().dzMainMenu.currentControl != null)
2146
                        //{
2147
                        //    ViewerDataModel.Instance.MarkupControls_USER.Remove(this.ParentOfType<MainWindow>().dzMainMenu.currentControl);
2148
                        //    this.ParentOfType<MainWindow>().dzMainMenu.currentControl = null;
2149
                        //}
2150
                        //this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2151
                        //instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2152
                        //instanceMain.dzMainMenu.isLeftMouseButtonDownOnWindow = false;
2153
                        //if (ViewerDataModel.Instance.SystemMain.dzMainMenu.SelectLayer.Children.Count < 1) //선택된 것이 없으면
2154
                        //{
2155
                        //    this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert("Please Select Controls", "Alert");
2156
                        //}
2157
                        //else//if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
2158
                        //{
2159
                        //    // string MarkupData = "";
2160
                        //    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
2161
                        //    {
2162
                        //        if (item.GetType().Name == "AdornerFinal" && (item as AdornerFinal).MemberSet.Count >= 2) // 얘가 2개 이상이여야 그룹가능 버튼도 막을거긴하지만 일단..
2163
                        //        {
2164
                        //            //MARKUP_DATA_GROUP INSERT
2165
                        //            MARKUP_DATA_GROUP mARKUP_DATA_GROUP = new MARKUP_DATA_GROUP
2166
                        //            {
2167
                        //                SYMBOL_ID = null,//InnerItem.Symbol_ID
2168
                        //                STATE = 0,
2169
                        //            };
2170
                        //            long group_id = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.AddMarkupDataGroup(mARKUP_DATA_GROUP, App.ViewInfo.ProjectNO);
2171
                        //            Logger.sendReqLog("AddMarkupDataGroup: ", "", 1);
2172
                        //            if (group_id > 0)
2173
                        //            {
2174
                        //                foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
2175
                        //                {
2176
                        //                    if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
2177
                        //                    {
2178
                        //                        //MARKUP_DATA UPDATE
2179
                        //                        //Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.UpdateMarkupData((InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo).CommentID, group_id, App.ViewInfo.ProjectNO);
2180
                        //                        //Logger.sendReqLog("UpdateMarkupData: ", "", 1);
2181
                        //                        ViewerDataModel.Instance.MyMarkupList.Where(d => d.ID == (InnerItem.DrawingData as CommentUserInfo).CommentID).FirstOrDefault().Group_ID = group_id;
2182
                        //                        ViewerDataModel.Instance.MyMarkupList.Where(d => d.ID == (InnerItem.DrawingData as CommentUserInfo).CommentID).FirstOrDefault().IsUpdate = true;
2183
                        //                    }
2184
                        //                }
2185
                        //            }
2186
                        //        }
2187
                        //    }
2188
                        //}
2189
                        break;
2190
                    case "UnGroup":
2191
                        //var UnGrouptoggleList = this.Parent.ChildrenOfType<RadRibbonToggleButton>();
2192
                        //foreach (var togle in UnGrouptoggleList)
2193
                        //{
2194
                        //    togle.IsChecked = false;
2195
                        //}
2196
                        //if (this.ParentOfType<MainWindow>().dzMainMenu.currentControl != null)
2197
                        //{
2198
                        //    ViewerDataModel.Instance.MarkupControls_USER.Remove(this.ParentOfType<MainWindow>().dzMainMenu.currentControl);
2199
                        //    this.ParentOfType<MainWindow>().dzMainMenu.currentControl = null;
2200
                        //}
2201
                        //this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2202
                        //instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2203
                        //instanceMain.dzMainMenu.isLeftMouseButtonDownOnWindow = false;
2204

    
2205
                        //if (ViewerDataModel.Instance.SystemMain.dzMainMenu.SelectLayer.Children.Count < 1) //선택된 것이 없으면
2206
                        //{
2207
                        //    this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert("Please Select Controls", "Alert");
2208
                        //}
2209
                        //else//if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
2210
                        //{
2211
                        //    // string MarkupData = "";
2212
                        //    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
2213
                        //    {
2214
                        //        if (item.GetType().Name == "AdornerFinal" && (item as AdornerFinal).MemberSet.Count >= 1) // 1개 이상 
2215
                        //        {
2216
                        //            //MARKUP_DATA UPDATE
2217
                        //            foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
2218
                        //            {
2219
                        //                if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
2220
                        //                {
2221
                        //                    long group_id = ViewerDataModel.Instance.MyMarkupList.Where(d => d.ID == (InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo).CommentID).FirstOrDefault().Group_ID;
2222
                        //                    //MARKUP_DATA UPDATE
2223
                        //                    //Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.UpdateMarkupData((InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo).CommentID, 0, App.ViewInfo.ProjectNO);
2224
                        //                    //Logger.sendReqLog("UpdateMarkupData: ", "", 1);
2225
                        //                    ViewerDataModel.Instance.MyMarkupList.Where(d => d.ID == (InnerItem.DrawingData as CommentUserInfo).CommentID).FirstOrDefault().Group_ID = 0;
2226
                        //                    ViewerDataModel.Instance.MyMarkupList.Where(d => d.ID == (InnerItem.DrawingData as CommentUserInfo).CommentID).FirstOrDefault().IsUpdate = true;
2227

    
2228

    
2229
                        //                    //MARKUP_DATA_GROUP UPDATE
2230
                        //                    //bool value = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.UpdateMarkupDataGroup(group_id, App.ViewInfo.ProjectNO);
2231
                        //                    //Logger.sendReqLog("AddMarkupDataGroup: ", value.ToString(), 1);
2232
                        //                }
2233
                        //            }
2234
                        //        }
2235
                        //    }
2236
                        //}
2237
                        break;
2238
                    #endregion
2239
                    #region Capture
2240
                    case "Capture":
2241
                        SyncInit();
2242
                        //   instanceToggle.IsChecked = false;
2243
                        var CaptureList = this.Parent.ChildrenOfType<RadRibbonToggleButton>();
2244
                        foreach (var togle in CaptureList)
2245
                        {
2246
                            togle.IsChecked = false;
2247
                        }
2248

    
2249
                        if (this.ParentOfType<MainWindow>().dzMainMenu.currentControl != null)
2250
                        {
2251
                            ViewerDataModel.Instance.MarkupControls_USER.Remove(this.ParentOfType<MainWindow>().dzMainMenu.currentControl);
2252
                            this.ParentOfType<MainWindow>().dzMainMenu.currentControl = null;
2253
                        }
2254

    
2255
                        ViewerDataModel.Instance.SelectedControl = "ImgControl";
2256
                   //     ViewerDataModel.Instance.ControlTag = null;
2257
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ImgControl;
2258

    
2259
                        /*
2260
                        //캡쳐 하기 전에 코멘트 저장
2261
                        if (Common.ViewerDataModel.Instance.MarkupControls_USER.Count > 0 || (Application.Current.MainWindow as MainWindow).dzMainMenu.SelectLayer.Children.Count > 0)
2262
                        {
2263
                            var menu = (Application.Current.MainWindow as MainWindow).dzMainMenu;
2264
                            menu.ReleaseAdorner();
2265
                            if (menu.PreviewUserMarkupInfoItem != null && menu.PreviewUserMarkupInfoItem.IsPreviewUser == true)
2266
                            {
2267
                                (Application.Current.MainWindow as MainWindow).dzTopMenu.RefactoryCommentReact(menu);
2268
                            }
2269
                            else if (menu.gridViewMarkup.SelectedItems.Count == 0 || (menu.gridViewMarkup.SelectedItems.FirstOrDefault() as IKCOM.MarkupInfoItem).UserID != App.ViewInfo.UserID)
2270
                            {
2271

    
2272
                            }
2273
                            else
2274
                            {
2275
                                (Application.Current.MainWindow as MainWindow).dzTopMenu.RefactoryCommentReact(menu);
2276
                            }
2277
                        }*/
2278

    
2279
                        //Common.ViewerDataModel.Instance.CheckList_ID = ((e.Source as Telerik.Windows.Controls.RadButton).DataContext as Customer).ID;
2280
                        //Common.ViewerDataModel.Instance.CheckList_ID = ((e.Source as Image).DataContext as Customer).ID;
2281
                        //Common.ViewerDataModel.Instance.PageNumber = ((e.Source as Image).DataContext as Customer).PAGENUMBER;
2282
                        Application.Current.MainWindow.Focus();
2283
                        Common.ViewerDataModel.Instance.Capture_Opacity = 0.49;
2284
                        (Application.Current.MainWindow as MainWindow).dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Capture;
2285
                        break;
2286
                    #endregion
2287
                    #region Cad
2288
                    case "Inside":
2289
                        //instanceMain.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Drawing;
2290
                        //instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = false;
2291
                        Common.ViewerDataModel.Instance.SelectedControl = "InsideWhite";
2292
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.InsideWhite;
2293
                        break;
2294
                    case "Overlap":
2295
                        //instanceMain.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Drawing;
2296
                        //instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = false;
2297
                        Common.ViewerDataModel.Instance.SelectedControl = "OverlapWhite";
2298
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.OverlapWhite;
2299
                        break;
2300
                    case "Clip":
2301
                        //instanceMain.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Drawing;
2302
                        //instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = false;
2303
                        Common.ViewerDataModel.Instance.SelectedControl = "ClipWhite";
2304
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ClipWhite;
2305
                        break;
2306
                    case "CadExport":
2307
                        if (isClosed)
2308
                        {
2309
                            //토글 및 마우스 상태 초기화
2310
                            var toggleList = this.Parent.ChildrenOfType<RadRibbonToggleButton>();
2311
                            foreach (var togle in toggleList)
2312
                            {
2313
                                togle.IsChecked = false;
2314
                            }
2315
                            this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2316

    
2317
                            isClosed = false;
2318
                            //Control 파일 먼저 생성
2319
                            CollapsedButton_Click();
2320
                            CadViewer check = new CadViewer();
2321
                            check.WindowStartupLocation = WindowStartupLocation.CenterScreen;
2322
                            check.Title = "Export Viewer";
2323
                            //check.Topmost = true;
2324
                            check.Show();
2325
                            check.Closed += Check_Closed;
2326
                            instanceToggle.IsChecked = false;
2327
                        }
2328
                        break;
2329
                    case "CadViewer":
2330
                        if (isClosed)
2331
                        {
2332
                            //토글 및 마우스 상태 초기화
2333
                            var toggleList = this.Parent.ChildrenOfType<RadRibbonToggleButton>();
2334
                            foreach (var togle in toggleList)
2335
                            {
2336
                                togle.IsChecked = false;
2337
                            }
2338
                            this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2339

    
2340
                            isClosed = false;
2341
                            CadResultViewer check = new CadResultViewer();
2342
                            check.WindowStartupLocation = WindowStartupLocation.CenterScreen;
2343
                            check.Title = "Viewer";
2344
                            check.Show();
2345

    
2346
                            check.Closed += Check_Closed;
2347

    
2348
                        }
2349
                        break;
2350
                    #endregion
2351
                    default:
2352
                        break;
2353
                }
2354
                #endregion
2355
            }
2356
            else
2357
            {
2358

    
2359
                if (!instanceMain.dzMainMenu.IsFreeSelectionMode)
2360
                {
2361
                    instanceMain.dzMainMenu.IsSwingMode = false;
2362
                    Common.ViewerDataModel.Instance.SelectedControl = "";
2363
                    Common.ViewerDataModel.Instance.ControlTag = null;
2364
                    this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2365
                    this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2366
                }
2367
            }
2368
        }
2369

    
2370
        private void SyncInit()
2371
        {
2372
            try
2373
            {
2374
                if (!ViewerDataModel.Instance.SystemMain.dzMainMenu.testPanel2.IsHidden)
2375
                {
2376
                    ViewerDataModel.Instance.SystemMain.dzMainMenu.testPanel2.IsHidden = true;
2377
                    ViewerDataModel.Instance.PageBalanceMode = false;
2378
                    ViewerDataModel.Instance.PageBalanceNumber = 0;
2379
                    ViewerDataModel.Instance.PageNumber = 0;
2380
                    ViewerDataModel.Instance.MarkupControls_Sync.Clear();
2381
                    ViewerDataModel.Instance.SystemMain.dzMainMenu.gridViewRevMarkup.Visibility = Visibility.Collapsed;
2382
                    ViewerDataModel.Instance.SystemMain.dzMainMenu.UserList.IsChecked = false;
2383
                    ViewerDataModel.Instance.SystemMain.dzMainMenu.BalanceMode.IsChecked = false;
2384
                }
2385
            }
2386
            catch (Exception ex)
2387
            {
2388
                Logger.sendResLog("SyncInit", ex.Message, 0);
2389
            }
2390

    
2391
        }
2392

    
2393
        Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
2394
        CommentUserInfo currentControl { get; set; }
2395
        private void Check_Closed(object sender, EventArgs e)
2396
        {
2397
            isClosed = true;
2398
            //this.ParentOfType<MainWindow>().dzMainMenu.PN_Navi.IsEnabled = true;
2399
            //토글 및 마우스 상태 초기화
2400
            var toggleList = this.Parent.ChildrenOfType<RadToggleButton>();
2401
            foreach (var togle in toggleList)
2402
            {
2403
                togle.IsChecked = false;
2404
            }
2405
            this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2406
            ViewerDataModel.Instance.Capture_Opacity = 0;
2407

    
2408
        }
2409

    
2410
        /* public class test 
2411
         {
2412
             public double width { get; set; }
2413
             public double height { get; set; }
2414
         }
2415
         */
2416
        private void CollapsedButton_Click()
2417
        {
2418
            this.ParentOfType<MainWindow>().dzTopMenu._SaveEvent(null, null); // 저장하지 못한 데이터가 있다면 저장
2419

    
2420
            string[] data = new string[0];
2421

    
2422
            int cnt = 0;
2423
            var menu = this.ParentOfType<MainWindow>().dzMainMenu;
2424

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

    
2427
            foreach (var item in gridSelectionItem)
2428
            {
2429
                if ((item.UserID == App.ViewInfo.UserID) && (ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.CurrentPage != null))
2430
                {
2431
                    var instance = ViewerDataModel.Instance.MyMarkupList.Where(d => d.PageNumber == ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber &&
2432
                    d.MarkupInfoID == item.MarkupInfoID).ToList();
2433
                    data = new string[instance.Count];
2434
                    foreach (var markup in instance)
2435
                    {
2436
                        data[cnt++] = MarkupToPDF.Serialize.Core.JsonSerializerHelper.UnCompressString(markup.Data);
2437
                    }
2438
                }
2439
            }
2440

    
2441
            if (data != null && KCOM.Properties.Settings.Default.cad == 1)
2442
            {
2443
                string FilePath = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\Cad");
2444
                string FileName = FilePath + "\\commentstring.json"; // Default file name
2445
                if (!File.Exists(FilePath))
2446
                {
2447
                    Directory.CreateDirectory(FilePath);
2448
                }
2449

    
2450
                if (!string.IsNullOrEmpty(FileName))
2451
                {
2452
                    //  File.WriteAllText(SaveDig.FileName, data);
2453
                    File.WriteAllLines(FileName, data);
2454
                }
2455
            }
2456
        }
2457

    
2458
        private double minHeight;
2459
        private double minWidth;
2460

    
2461
        private double maxHeight;
2462
        private double maxWidth;
2463

    
2464
        public bool CanVResize { get; private set; }
2465
        public bool CanHResize { get; private set; }
2466

    
2467
        public void DesignerComponent(FrameworkElement content)
2468
        {
2469
            this.InitializeComponent();
2470

    
2471
            if (!double.IsNaN(content.Width))
2472
            {
2473
                CanHResize = false;
2474
                this.Width = content.Width;
2475
            }
2476
            else
2477
            {
2478
                CanHResize = true;
2479
                this.Width = 23.0;
2480
            }
2481
            if (!double.IsNaN(content.Height))
2482
            {
2483
                CanVResize = false;
2484
                this.Height = content.Height; ;
2485
            }
2486
            else
2487
            {
2488
                CanVResize = true;
2489
                this.Height = 23.0;
2490
            }
2491

    
2492
            minWidth = content.MinWidth < 10.0 ? 10.0 : content.MinWidth;
2493
            minHeight = content.MinHeight < 10.0 ? 10.0 : content.MinHeight;
2494
            maxWidth = content.MaxWidth;
2495
            maxHeight = content.MaxHeight;
2496

    
2497
            double top = (double)content.GetValue(Canvas.TopProperty);
2498
            if (double.IsNaN(top))
2499
                top = 0.0;
2500
            double left = (double)content.GetValue(Canvas.LeftProperty);
2501
            if (double.IsNaN(left))
2502
                left = 0.0;
2503
            SetValue(Canvas.TopProperty, top);
2504
            SetValue(Canvas.LeftProperty, left);
2505

    
2506
            //Set the actual content. Note that "Content" property is a new property. See below
2507
            this.Content = content;
2508
        }
2509
        private void Thumb_DragDelta(object sender, DragDeltaEventArgs e)
2510
        {
2511
            string name = ((Thumb)sender).Name;
2512
            if (name.Contains("Top"))
2513
            {
2514
                double newHeight = this.Height - e.VerticalChange;
2515
                if (newHeight >= minHeight && newHeight <= maxHeight)
2516
                {
2517
                    this.Height = newHeight;
2518
                    SetValue(Canvas.TopProperty,
2519
                (double)GetValue(Canvas.TopProperty) + e.VerticalChange);
2520
                }
2521
            }
2522
            if (name.Contains("Right"))
2523
            {
2524
                double newWidth = this.Width + e.HorizontalChange;
2525
                if (newWidth >= minWidth && newWidth <= maxWidth)
2526
                    this.Width = newWidth;
2527
            }
2528
            if (name.Contains("Bottom"))
2529
            {
2530
                double newHeight = this.Height + e.VerticalChange;
2531
                if (newHeight >= minHeight && newHeight <= maxHeight)
2532
                    this.Height = newHeight;
2533
            }
2534
            if (name.Contains("Left"))
2535
            {
2536
                double newWidth = this.Width - e.HorizontalChange;
2537
                if (newWidth >= minWidth && newWidth <= maxWidth)
2538
                {
2539
                    this.Width = newWidth;
2540
                    SetValue(Canvas.LeftProperty,
2541
                (double)GetValue(Canvas.LeftProperty) + e.HorizontalChange);
2542
                }
2543
            }
2544
        }
2545

    
2546
        private void drawControlBorder(object sender)
2547
        {
2548
            System.Windows.Controls.Control control = (System.Windows.Controls.Control)sender;
2549
        }
2550

    
2551
        private void ResizeThumb_DragDelta(object sender, MouseButtonEventArgs e)
2552
        {
2553
            System.Windows.Controls.Control designerItem = (System.Windows.Controls.Control)sender;
2554
            if (designerItem != null)
2555
            {
2556
                double deltaVertical, deltaHorizontal;
2557

    
2558
                switch (VerticalAlignment)
2559
                {
2560
                    case VerticalAlignment.Bottom:
2561
                        deltaVertical = designerItem.ActualHeight - designerItem.MinHeight;
2562
                        designerItem.Height -= deltaVertical;
2563
                        break;
2564
                    case VerticalAlignment.Top:
2565
                        deltaVertical = designerItem.ActualHeight - designerItem.MinHeight;
2566
                        Canvas.SetTop(designerItem, Canvas.GetTop(designerItem) + deltaVertical);
2567
                        designerItem.Height -= deltaVertical;
2568
                        break;
2569
                    default:
2570
                        break;
2571
                }
2572

    
2573
                switch (HorizontalAlignment)
2574
                {
2575
                    case HorizontalAlignment.Left:
2576
                        deltaHorizontal = designerItem.ActualWidth - designerItem.MinWidth;
2577
                        Canvas.SetLeft(designerItem, Canvas.GetLeft(designerItem) + deltaHorizontal);
2578
                        designerItem.Width -= deltaHorizontal;
2579
                        break;
2580
                    case HorizontalAlignment.Right:
2581
                        deltaHorizontal = designerItem.ActualWidth - designerItem.MinWidth;
2582
                        designerItem.Width -= deltaHorizontal;
2583
                        break;
2584
                    default:
2585
                        break;
2586
                }
2587
            }
2588
            e.Handled = true;
2589
        }
2590

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

    
2593
        void ExportMethod()
2594
        {
2595
            //FileDialogFilter filterImage = new FileDialogFilter("Image Files", "*.jpg", "*.png");
2596
            SaveDig.Filter = "PDF file format|*.pdf";
2597
            SaveDig.Title = "Save an DWG File";
2598
            SaveDig.ShowDialog();
2599
        }
2600

    
2601
        private void cbAutoSave_Checked(object sender, RoutedEventArgs e)
2602
        {            
2603
            if (cbAutoSave.IsChecked == true)
2604
            {
2605
                SaveTime(true, (int)cbSaveInterval.Value);
2606
            }
2607
            else
2608
            {
2609
                SaveTime(false, (int)cbSaveInterval.Value);
2610
            }
2611
        }
2612
        private void cbSaveInterval_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
2613
        {
2614
            if(string.IsNullOrEmpty(cbSaveInterval.Value.ToString()))
2615
            {
2616
                cbSaveInterval.Value = cbSaveInterval.Minimum;
2617
            }
2618
            if (cbAutoSave.IsChecked == true)
2619
            {
2620
                SaveTime(true, (int)cbSaveInterval.Value);
2621
            }
2622

    
2623
            KCOM.Properties.Settings.Default.SaveInterval = (double)cbSaveInterval.Value;
2624
            Properties.Settings.Default.Save();
2625
        }
2626
        //강인구 자동 저장 추가
2627
        private void AutoSave(object sender, RoutedEventArgs e)
2628
        {
2629
            RadToggleButton instanceToggle = sender as RadToggleButton;
2630

    
2631
            if(instanceToggle.IsChecked == true)
2632
            {
2633
                SaveTime(true);
2634
            }
2635
            else
2636
            {
2637
                SaveTime(false);
2638
            }
2639
        }
2640

    
2641
        public void Copy_Start()
2642
        {
2643
            if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
2644
            {
2645
                string MarkupData = "";
2646

    
2647
                foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
2648
                {
2649
                    if (item.GetType().Name == "AdornerFinal")
2650
                    {
2651
                        foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
2652

    
2653
                        {
2654
                            if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
2655
                            {
2656
                                MarkupToPDF.Controls.Parsing.MarkupParser.MarkupReturn res = MarkupParser.MarkupToString(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo, App.ViewInfo.UserID);
2657
                                MarkupData += "|OR|" + res.ConvertData;
2658
                            }
2659
                        }
2660
                        Clipboard.SetText(MarkupData);
2661
                    }
2662
                }
2663
            }
2664
        }
2665

    
2666
        public void Cut_Start()
2667
        {
2668
            if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
2669
            {
2670
                foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
2671
                {
2672
                    string MarkupData = "";
2673

    
2674
                    if (item.GetType().Name == "AdornerFinal")
2675
                    {
2676
                        foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
2677
                        {
2678
                            if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
2679
                            {
2680
                                MarkupToPDF.Controls.Parsing.MarkupParser.MarkupReturn res = MarkupParser.MarkupToString(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo, App.ViewInfo.UserID);
2681
                                MarkupData += "|OR|" + res.ConvertData;
2682
                            }
2683
                        }
2684
                        //클립보드에 넣음
2685
                        Clipboard.SetText(MarkupData);
2686
                    }
2687
                }
2688
                this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Clear();
2689
            }
2690
        }
2691

    
2692
        public void Paste_Start()
2693
        {
2694
            //마크업 붙여넣기
2695
            //if (Clipboard.GetText().Contains("|DZ|"))
2696
            if (Clipboard.GetText().Contains("|OR||DZ|"))
2697
            {
2698
                List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>();
2699

    
2700
                string[] delimiterChars = { "|OR|" };
2701
                string[] data = Clipboard.GetText().Split(delimiterChars, StringSplitOptions.RemoveEmptyEntries);
2702

    
2703
                SelectionSet.Instance.UnSelect(this.ParentOfType<MainWindow>().dzMainMenu);
2704

    
2705
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
2706

    
2707
                //강인구 Undo/Redo 보류
2708
                MarkupToPDF.Common.Undo_data UndoData = new Undo_data()
2709
                {
2710
                    IsUndo = false,
2711
                    Event = Event_Type.Create,
2712
                    EventTime = DateTime.Now,
2713
                    Markup_List = new List<Multi_Undo_data>()
2714
                };
2715

    
2716
                ViewerDataModel.Instance.UndoDataList.Where(data1 => data1.IsUndo == true).ToList().ForEach(i =>
2717
                {
2718
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
2719
                });
2720

    
2721
                foreach (string parse in data)
2722
                {
2723
                    if (parse != "")
2724
                    {
2725
                        System.Windows.Controls.Control item = MarkupParser.ParseEx(App.ViewInfo.ProjectNO, parse, ViewerDataModel.Instance.MarkupControls_USER, string.Empty, string.Empty);
2726
                        (item as MarkupToPDF.Common.CommentUserInfo).CommentID = Commons.shortGuid();
2727

    
2728
                        ViewerDataModel.Instance.MarkupControls.Remove(item as MarkupToPDF.Common.CommentUserInfo);
2729
                        ViewerDataModel.Instance.MarkupControls_USER.Remove(item as MarkupToPDF.Common.CommentUserInfo);
2730

    
2731
                        adornerSet.Add(item as MarkupToPDF.Common.CommentUserInfo);
2732

    
2733
                        //Controls.AdornerFinal final = new Controls.AdornerFinal(item as MarkupToPDF.Common.CommentUserInfo);
2734
                        //this.dzMainMenu.SelectLayer.Children.Add(final);
2735

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

    
2738
                        UndoData.Markup_List.Add(multi_Undo_Data);
2739
                        ViewerDataModel.Instance.UndoDataList.Add(UndoData);                        
2740
                    }
2741
                }
2742
                Controls.AdornerFinal final = new Controls.AdornerFinal(adornerSet);
2743

    
2744
                if(this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.X < 0)
2745
                {
2746
                    Canvas.SetLeft(final, 0);
2747
                    Canvas.SetTop(final, 0);
2748
                }
2749
                else
2750
                {
2751
                    double realPointX = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.X - final.BorderSize.X - (final.BorderSize.Width / 2);
2752
                    double realPointY = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.Y - final.BorderSize.Y - (final.BorderSize.Height / 2);
2753
                    final.TranslateItems(realPointX, realPointY);
2754

    
2755
                    if (final.Members.Where(type => type.Drawingtype == MarkupToPDF.Controls.Common.ControlType.TextControl).FirstOrDefault() != null)
2756
                    {
2757
                        final.TranslateItems(0.001, 0.001); //dummy
2758
                    }
2759

    
2760
                }
2761
                
2762

    
2763
                this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Add(final);
2764

    
2765
                //붙여 넣을때 원본 컨트롤과 겹치지 않도록 설정
2766
                //Canvas.SetLeft(final, 50);
2767
                //Canvas.SetTop(final, 50);
2768
            }
2769
            //외부 이미지 붙여넣기
2770
            else if (Clipboard.GetImage() != null)
2771
            {
2772
                try
2773
                {
2774
                    Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
2775

    
2776
                    //강인구 Undo/Redo 보류
2777
                    MarkupToPDF.Common.Undo_data UndoData = new Undo_data()
2778
                    {
2779
                        IsUndo = false,
2780
                        Event = Event_Type.Create,
2781
                        EventTime = DateTime.Now,
2782
                        Markup_List = new List<Multi_Undo_data>()
2783
                    };
2784

    
2785

    
2786
                    string temppath = System.IO.Path.GetTempPath();
2787
                    //string filename = KCOM.Events.Save.shortCommentKey();
2788
                    string filename = Commons.shortFileKey();
2789

    
2790
                    System.Drawing.Image clipboardImage = System.Windows.Forms.Clipboard.GetImage();
2791
                    clipboardImage.Save(temppath + "\\" + filename);
2792

    
2793
                    System.IO.FileInfo fileInfo = new System.IO.FileInfo(temppath + "\\" + filename);
2794
                    String strFile = System.IO.Path.GetFileName(fileInfo.FullName);
2795
                    long numByte = fileInfo.Length;
2796
                    double dLen = Convert.ToDouble(fileInfo.Length / 1000000);
2797
                    kr.co.devdoftech.cloud.FileUpload fileUploader = new kr.co.devdoftech.cloud.FileUpload();
2798

    
2799
                    if (dLen < 4)
2800
                    {
2801
                        System.IO.FileStream fStream = new System.IO.FileStream(fileInfo.FullName,
2802
                        System.IO.FileMode.Open, System.IO.FileAccess.Read);
2803
                        System.IO.BinaryReader br = new System.IO.BinaryReader(fStream);
2804
                        byte[] data = br.ReadBytes((int)numByte);
2805

    
2806
                        filename = fileUploader.Run(App.ViewInfo.ProjectNO, this.ParentOfType<MainWindow>().dzMainMenu._DocItem.DOCUMENT_NO, App.ViewInfo.UserID, strFile + ".png", data);
2807
                        Check_Uri.UriCheck(filename);
2808
                        br.Close();
2809
                        fStream.Close();
2810
                        fStream.Dispose();
2811
                    }
2812
                    else
2813
                    {
2814
                        this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert("Available Memory less than 4 mega byte", "Alert");
2815
                        return;
2816
                    }
2817

    
2818
                    fileInfo.Delete();
2819

    
2820
                    //System.Drawing.Image clipboardImage = System.Windows.Forms.Clipboard.GetImage();
2821
                    System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(clipboardImage);
2822
                    IntPtr hBitmap = bmp.GetHbitmap();
2823
                    System.Windows.Media.ImageSource WpfBitmap = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(hBitmap, IntPtr.Zero, Int32Rect.Empty, System.Windows.Media.Imaging.BitmapSizeOptions.FromEmptyOptions());
2824
                    Image img = new Image();
2825
                    //img.Source = new System.Windows.Media.Imaging.BitmapImage(new Uri(filename));
2826
                    if (filename.Contains(".svg"))
2827
                    {
2828
                        byte[] imageData = null;
2829
                        DrawingImage image = null;
2830
                        using (System.Net.WebClient web = new System.Net.WebClient())
2831
                        {
2832
                            imageData = web.DownloadData(new Uri(filename));
2833
                            System.IO.Stream stream = new System.IO.MemoryStream(imageData);
2834
                            image = SvgReader.Load(stream);
2835
                        }
2836
                        img.Source = image;
2837
                    }
2838
                    else
2839
                    {
2840
                        img.Source = new BitmapImage(new Uri(filename));
2841
                    }
2842

    
2843
                    var currentControl = new MarkupToPDF.Controls.Etc.ImgControl
2844
                    {
2845
                        PointSet = new List<Point>(),
2846
                        //FilePath = img.Source.ToString(),
2847
                        FilePath = filename,
2848
                        ImageData = img.Source,
2849
                        StartPoint = new Point(100, 100),
2850
                        EndPoint = new Point(200, 200),
2851
                        TopRightPoint = new Point(100, 200),
2852
                        LeftBottomPoint = new Point(200, 100)
2853
                    };
2854

    
2855
                    currentControl.TopRightPoint = new Point(currentControl.StartPoint.X + clipboardImage.Width, currentControl.StartPoint.Y);
2856
                    currentControl.LeftBottomPoint = new Point(currentControl.StartPoint.X, currentControl.StartPoint.Y + clipboardImage.Height);
2857
                    currentControl.EndPoint = new Point(currentControl.StartPoint.X + clipboardImage.Width, currentControl.StartPoint.Y + clipboardImage.Height);
2858

    
2859
                    currentControl.PointSet = new List<Point>
2860
                                        {
2861
                                            currentControl.StartPoint,
2862
                                            currentControl.LeftBottomPoint,
2863
                                            currentControl.EndPoint,
2864
                                            currentControl.TopRightPoint,
2865
                                        };
2866

    
2867
                    multi_Undo_Data = this.ParentOfType<MainWindow>().dzMainMenu.Control_Style(currentControl as MarkupToPDF.Common.CommentUserInfo);
2868
                    UndoData.Markup_List.Add(multi_Undo_Data);
2869
                    ViewerDataModel.Instance.UndoDataList.Add(UndoData);
2870

    
2871
                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl as MarkupToPDF.Common.CommentUserInfo);
2872
                    currentControl.CommentID = Commons.shortGuid();
2873

    
2874
                    currentControl.ApplyTemplate();
2875
                    currentControl.SetImage();
2876

    
2877
                    ViewerDataModel.Instance.MarkupControls_USER.Remove(currentControl as MarkupToPDF.Common.CommentUserInfo);
2878
                    Controls.AdornerFinal final = new Controls.AdornerFinal(currentControl as MarkupToPDF.Common.CommentUserInfo);
2879
                    this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Add(final);
2880

    
2881
                    double realPointX = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.X - final.BorderSize.X - (final.BorderSize.Width / 2);
2882
                    double realPointY = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.Y - final.BorderSize.Y - (final.BorderSize.Height / 2);
2883
                    final.TranslateItems(realPointX, realPointY);
2884
                }
2885
                catch(Exception ex)
2886
                {
2887
                    this.ParentOfType<MainWindow>().DialogMessage_Alert("" + ex, "Alert");
2888
                }
2889
            }
2890
        }
2891
    }
2892
}
클립보드 이미지 추가 (최대 크기: 500 MB)