프로젝트

일반

사용자정보

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

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

이력 | 보기 | 이력해설 | 다운로드 (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
                                this.ParentOfType<MainWindow>().DialogMessage_Alert("Save 가 완료되었습니다.", "Alert");
337
                            }
338
                        }
339
                    }
340
                }
341

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

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

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

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

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

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

    
417
                }
418
                else
419
                {
420
                    this.SaveEventCallback(null, null);
421
                }
422
            }
423

    
424
            bool isprint = false;
425
            if (Type == "Print")
426
            {
427
                isprint = true;
428
            }
429

    
430
            RadWindow PrintWindow = new RadWindow();
431
            //IKCOM.MarkupInfoItem _result = null;
432
            PrintWindow.Width = 850;
433
            PrintWindow.Height = 600;
434
            //PrintWindow.Width = 650;
435
            //PrintWindow.Height = 550;
436
            PrintWindow.Header = Type;
437

    
438
            List<IKCOM.MarkupInfoItem> markupinfo = new List<IKCOM.MarkupInfoItem>();
439

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

    
443
            if (markupinfo.Count() > 0)
444
            {
445
                Logger.sendResLog("GetPrintDocItemList", "TRUE", 1);
446
            }
447
            else
448
            {
449
                Logger.sendResLog("GetPrintDocItemList", "FALSE", 1);
450
            }
451

    
452
            var Tile_Url = string.Format(@"{0}/TileSource/{1}_Tile/{2}/{3}/",
453
                App.SystemInfo.HostName,
454
                App.ViewInfo.ProjectNO,
455
                (Convert.ToInt64(App.ViewInfo.DocumentItemID) / 100).ToString(),
456
                App.ViewInfo.DocumentItemID
457
                );
458

    
459
            PrintWindow.Content = new KCOM.Control.PrintControl(
460
                      Tile_Url,
461
                      App.ViewInfo.ProjectNO,
462
                      this.ParentOfType<MainWindow>().dzMainMenu._DocInfo, markupinfo,
463
                      this.ParentOfType<MainWindow>().dzMainMenu.pageNavigator.CurrentPage.PageNumber,
464
                      App.ViewInfo.DocumentItemID,
465
                      this.ParentOfType<MainWindow>().dzMainMenu._DocItem.DOCUMENT_NO,
466
                      this.ParentOfType<MainWindow>().dzMainMenu._DocItem.ORIGINAL_FILE, isprint);
467

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

    
480
        //강인구 추가
481
        private void PrintEvent(object sender, RoutedEventArgs e)
482
        {
483
            RadRibbonButton button = sender as RadRibbonButton;
484
            Print_Start(button.Content.ToString());
485
        }
486

    
487
        private List<AdornerMember> GetAdornerItem()
488
        {
489
            List<AdornerMember> AdonerList = new List<AdornerMember>();
490

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

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

    
531
                foreach (AdornerMember InnerItem in AdonerList)
532
                {
533
                    InnerItem.DrawingData.Opacity = ViewerDataModel.Instance.ControlOpacity;
534
                  
535
                    multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
536
                    UndoData.Markup_List.Add(multi_Undo_Data);
537
                    multi_Undo_Data = new Multi_Undo_data();
538
                }
539

    
540
                ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
541
                {
542
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
543
                });
544
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
545
            }
546
        }
547

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

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

    
656
                    multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
657
                    UndoData.Markup_List.Add(multi_Undo_Data);
658
                    multi_Undo_Data = new Multi_Undo_data();
659
                }
660

    
661
                ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
662
                {
663
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
664
                });
665
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
666

    
667
                
668
            }
669
            KCOM.Properties.Settings.Default.LineSize = (double)cbLineSize.Value;
670
            Properties.Settings.Default.Save();
671
        }
672

    
673

    
674
        private void cbIntervalSize_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
675
        {
676
            if (string.IsNullOrEmpty(cbIntervalSize.Value.ToString()))
677
            {
678
                cbIntervalSize.Value = cbIntervalSize.Minimum;
679
            }
680
            List<AdornerMember> AdonerList = GetAdornerItem();
681
            if (AdonerList.Count > 0)
682
            {
683

    
684
                Undo_data UndoData = new Undo_data()
685
                {
686
                    IsUndo = false,
687
                    Event = Event_Type.Option,
688
                    EventTime = DateTime.Now,
689
                    Interval = ViewerDataModel.Instance.Interval,
690
                    Markup_List = new List<Multi_Undo_data>()
691
                };
692
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
693

    
694
                foreach (AdornerMember InnerItem in AdonerList)
695
                {
696
                    switch (InnerItem.DrawingData.GetType().Name)
697
                    {
698
                        case ("LineControl"):
699
                            {
700
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Line.LineControl).Interval = ViewerDataModel.Instance.Interval;
701

    
702
                                multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
703
                                UndoData.Markup_List.Add(multi_Undo_Data);
704
                                multi_Undo_Data = new Multi_Undo_data();
705
                            }
706
                            break;
707
                    }
708
                }
709

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

    
730
                //Undo_data UndoData = new Undo_data()
731
                //{
732
                //    IsUndo = false,
733
                //    Event = Event_Type.Option,
734
                //    EventTime = DateTime.Now,
735
                //    Interval = ViewerDataModel.Instance.Interval,
736
                //    Markup_List = new List<Multi_Undo_data>()
737
                //};
738
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
739

    
740
                foreach (AdornerMember InnerItem in AdonerList)
741
                {
742
                    switch (InnerItem.DrawingData.GetType().Name)
743
                    {
744
                        case ("RectCloudControl"):
745
                            {
746
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.RectCloudControl).ArcLength = ViewerDataModel.Instance.ArcLength;
747

    
748
                                //multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
749
                                //UndoData.Markup_List.Add(multi_Undo_Data);
750
                                //multi_Undo_Data = new Multi_Undo_data();
751
                            }
752
                            break;
753
                        case ("CloudControl"):
754
                            {
755
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Polygon.CloudControl).ArcLength = ViewerDataModel.Instance.ArcLength;
756

    
757
                                //multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
758
                                //UndoData.Markup_List.Add(multi_Undo_Data);
759
                                //multi_Undo_Data = new Multi_Undo_data();
760
                            }
761
                            break;
762
                    }
763
                }
764

    
765
                //ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
766
                //{
767
                //    ViewerDataModel.Instance.UndoDataList.Remove(i);
768
                //});
769
                //ViewerDataModel.Instance.UndoDataList.Add(UndoData);
770
            }
771

    
772
            KCOM.Properties.Settings.Default.ArcLength = (double)cbArcLength.Value;
773
            Properties.Settings.Default.Save();
774
        }
775

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

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

    
875
                                multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
876
                                UndoData.Markup_List.Add(multi_Undo_Data);
877
                                multi_Undo_Data = new Multi_Undo_data();
878
                            }
879

    
880
                            ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
881
                            {
882
                                ViewerDataModel.Instance.UndoDataList.Remove(i);
883
                            });
884
                            ViewerDataModel.Instance.UndoDataList.Add(UndoData);
885
                        }
886
                    }
887
                }
888
            }
889
        }
890

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

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

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

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

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

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

    
1067
        private void AxisLockEvent(object sender, RoutedEventArgs e)
1068
        {
1069
            ViewerDataModel.Instance.checkAxis = cbAxisLock.IsChecked.Value;
1070
        }
1071

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

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

    
1159
        /// <summary>
1160
        /// 텍스트 컨트롤 하일라이트 처리
1161
        /// </summary>
1162
        /// <param name="sender"></param>
1163
        /// <param name="e"></param>
1164
        private void HighlightEvent(object sender, RoutedEventArgs e)
1165
        {
1166

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

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

    
1258
                    ((TextBox)sender).Text = previousText;
1259
                }
1260
            }
1261
        }
1262

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

    
1295
        public void PanoramaShow()
1296
        {
1297
            Panorama check = new Panorama();
1298
            double screenWidth = System.Windows.SystemParameters.PrimaryScreenWidth;
1299
            double screenHeight = System.Windows.SystemParameters.PrimaryScreenHeight;
1300
            //double windowWidth = this.Width;
1301
            //double windowHeight = this.Height;
1302

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

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

    
1341
                isClosed = false;
1342

    
1343
                
1344
                CheckList check = new CheckList();
1345

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

    
1367
        private void OptionPop_Closed(object sender, WindowClosedEventArgs e)
1368
        {
1369
            isClosed = true;
1370
            //this.ParentOfType<MainWindow>().dzMainMenu.PN_Navi.IsEnabled = true;
1371
            this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
1372
            ViewerDataModel.Instance.Capture_Opacity = 0;
1373
        }
1374

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

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

    
1422
        private void viewEvent(object sender, RoutedEventArgs e)
1423
        {
1424
            RadRibbonToggleButton viewButton = sender as RadRibbonToggleButton;
1425
            var instanceMain = this.ParentOfType<MainWindow>();
1426

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

    
1429
            //if ((sender as RadRibbonToggleButton) != null)
1430
            //{
1431
            //    Common.ViewerDataModel.Instance.ControlTag = (sender as RadRibbonToggleButton).Tag.ToString();
1432
            //    instanceToggle = (sender as RadRibbonToggleButton);
1433
            //}
1434

    
1435
            //instanceToggle.IsChecked = false;
1436

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

    
1478
                    }
1479
                    break;
1480
                case "Rotate_M":
1481
                    {
1482
                        drawingPannelRotate(false);
1483
                        viewButton.IsChecked = false;
1484
                    }
1485
                    break;
1486
                case "Rotate_P":
1487
                    {
1488
                        drawingPannelRotate(true);
1489
                        viewButton.IsChecked = false;
1490
                    }
1491
                    break;
1492
                case "Rotate_half":
1493
                    {
1494
                        drawingPannelRotate(true);
1495
                        drawingPannelRotate(true);
1496
                        viewButton.IsChecked = false;
1497
                    }
1498
                    break;
1499
            }
1500
        }
1501

    
1502
        private void Control_Event(object sender, RoutedEventArgs e)
1503
        {
1504

    
1505
        }
1506

    
1507
        #region 대기
1508

    
1509
        public void drawingPannelRotate(bool Flag)
1510
        {
1511
            var instanceMain = this.ParentOfType<MainWindow>();
1512

    
1513
            //if (rotateOffSet > 3)
1514
            //    rotateOffSet = 0;
1515

    
1516
            //if (rotateOffSet < 0)
1517
            //    rotateOffSet = 3;
1518

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

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

    
1572
            //instanceMain.dzMainMenu.zoomAndPanControl.RenderTransformOrigin = new Point(0.5, 0.5);
1573
            instanceMain.dzMainMenu.zoomAndPanControl.RotationAngle = instanceMain.dzMainMenu.rotate.Angle;
1574
            //대기(강인구)
1575
            //instanceMain.dzMainMenu.imageViewer.RotateAngle = instanceMain.dzMainMenu.rotate.Angle;
1576

    
1577

    
1578
            //instanceMain.dzMainMenu.imageViewer.RenderTransformOrigin = new Point(0.5, 0.5);
1579
            //RotateTransform rotateTransform = new RotateTransform(instanceMain.dzMainMenu.rotate.Angle);
1580
            //instanceMain.dzMainMenu.imageViewer.RenderTransform = rotateTransform;
1581

    
1582

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

    
1594

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

    
1600
                instanceMain.dzMainMenu.pageNavigator.ImgListbox.ItemsSource = instanceMain.dzMainMenu.pageNavigator._thumbnailItems;
1601
                var instance = instanceMain.dzMainMenu.CurrentDoc.docInfo.DOCPAGE.Where(p => p.PAGE_NUMBER == instanceMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber).FirstOrDefault();
1602
                instance.PAGE_ANGLE = int.Parse(instanceMain.dzMainMenu.rotate.Angle.ToString());
1603

    
1604
                instanceMain.dzMainMenu.pageNavigator.GotoPage(data.PageNumber);
1605

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

    
1620
        private void ImageConverter(RadToggleButton instanceToggle)
1621
        {
1622
            try
1623
            {           
1624
                var instanceMain = this.ParentOfType<MainWindow>();
1625
                //http://cloud.devdoftech.co.kr:5977/ImageUpload/FileUpload.asmx
1626

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

    
1635
                    System.IO.FileInfo fileInfo = new System.IO.FileInfo(instanceMain.dzMainMenu.filename);
1636
                    String strFile = System.IO.Path.GetFileName(instanceMain.dzMainMenu.filename);
1637
                    long numByte = fileInfo.Length;
1638
                    double dLen = Convert.ToDouble(fileInfo.Length / 1000000);
1639
                    kr.co.devdoftech.cloud.FileUpload fileUploader = new kr.co.devdoftech.cloud.FileUpload();
1640

    
1641
                    if (dLen < 4)
1642
                    {
1643
                        System.IO.FileStream fStream = new System.IO.FileStream(instanceMain.dzMainMenu.filename, System.IO.FileMode.Open, System.IO.FileAccess.Read);
1644
                        System.IO.BinaryReader br = new System.IO.BinaryReader(fStream);
1645
                        byte[] data = br.ReadBytes((int)numByte);
1646
                        br.Close();
1647

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

    
1650
                        Check_Uri.UriCheck(filepath);
1651

    
1652
                        instanceMain.dzMainMenu.filename = filepath;
1653

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

    
1683
        private void Control_Init(RadToggleButton instanceToggle, object sender)
1684
        {
1685

    
1686
        }
1687

    
1688
        private void ControlEvent(object sender, RoutedEventArgs e)
1689
        {
1690
            RadToggleButton instanceToggle = sender as RadToggleButton;
1691
            var instanceMain = this.ParentOfType<MainWindow>();
1692

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

    
1713
            //if (!instanceMain.IsFreeSelectionMode)
1714
            //{
1715
            //    instanceMain.IsSwingMode = true;
1716
            //}
1717

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

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

    
1731
            if (instanceToggle != null)
1732
            {
1733
                Common.ViewerDataModel.Instance.ControlTag = instanceToggle.Tag.ToString();
1734
            }
1735
            else if ((sender as RadRibbonToggleButton) != null)
1736
            {
1737
                Common.ViewerDataModel.Instance.ControlTag = (sender as RadRibbonToggleButton).Tag.ToString();
1738
                instanceToggle = (sender as RadRibbonToggleButton);
1739
            }
1740
            else if ((sender as RadRibbonButton) != null)
1741
            {
1742
                RadRibbonButton instanceButton = sender as RadRibbonButton;
1743
                Common.ViewerDataModel.Instance.ControlTag = instanceButton.Tag.ToString();
1744
            }
1745
            else
1746
            {
1747
                RadButton instanceButton = sender as RadButton;
1748
                Common.ViewerDataModel.Instance.ControlTag = instanceButton.Tag.ToString();
1749
            }
1750

    
1751

    
1752

    
1753
            System.Reactive.Linq.Observable2.FromPropertyChangedPattern(Common.ViewerDataModel.Instance, temp => temp.AngleVisibility).Subscribe(isSee =>
1754
            {
1755
                instanceMain.dzMainMenu.MainAngle.Visibility = isSee;
1756
                System.Reactive.Linq.Observable2.FromPropertyChangedPattern(Common.ViewerDataModel.Instance, temp => temp.AngleValue).Subscribe(p =>
1757
                {
1758
                    instanceMain.dzMainMenu.MainAngle.AngleValue = p;
1759
                });
1760
            });
1761
            instanceMain.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Drawing;
1762

    
1763
            instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = false;
1764

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

    
1990
                        //instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = true;
1991

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

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

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

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

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

    
2223

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

    
2244
                        if (this.ParentOfType<MainWindow>().dzMainMenu.currentControl != null)
2245
                        {
2246
                            ViewerDataModel.Instance.MarkupControls_USER.Remove(this.ParentOfType<MainWindow>().dzMainMenu.currentControl);
2247
                            this.ParentOfType<MainWindow>().dzMainMenu.currentControl = null;
2248
                        }
2249

    
2250
                        ViewerDataModel.Instance.SelectedControl = "ImgControl";
2251
                   //     ViewerDataModel.Instance.ControlTag = null;
2252
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ImgControl;
2253

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

    
2267
                            }
2268
                            else
2269
                            {
2270
                                (Application.Current.MainWindow as MainWindow).dzTopMenu.RefactoryCommentReact(menu);
2271
                            }
2272
                        }*/
2273

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

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

    
2335
                    //        isClosed = false;
2336
                    //        CadResultViewer check = new CadResultViewer();
2337
                    //        check.WindowStartupLocation = WindowStartupLocation.CenterScreen;
2338
                    //        check.Title = "Viewer";
2339
                    //        check.Show();
2340

    
2341
                    //        check.Closed += Check_Closed;
2342

    
2343
                    //    }
2344
                    //    break;
2345
                    //#endregion
2346
                    default:
2347
                        break;
2348
                }
2349
                #endregion
2350
            }
2351
            else
2352
            {
2353

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

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

    
2386
        }
2387

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

    
2403
        }
2404

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

    
2415
            string[] data = new string[0];
2416

    
2417
            int cnt = 0;
2418
            var menu = this.ParentOfType<MainWindow>().dzMainMenu;
2419

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

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

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

    
2445
                if (!string.IsNullOrEmpty(FileName))
2446
                {
2447
                    //  File.WriteAllText(SaveDig.FileName, data);
2448
                    File.WriteAllLines(FileName, data);
2449
                }
2450
            }
2451
        }
2452

    
2453
        private double minHeight;
2454
        private double minWidth;
2455

    
2456
        private double maxHeight;
2457
        private double maxWidth;
2458

    
2459
        public bool CanVResize { get; private set; }
2460
        public bool CanHResize { get; private set; }
2461

    
2462
        public void DesignerComponent(FrameworkElement content)
2463
        {
2464
            this.InitializeComponent();
2465

    
2466
            if (!double.IsNaN(content.Width))
2467
            {
2468
                CanHResize = false;
2469
                this.Width = content.Width;
2470
            }
2471
            else
2472
            {
2473
                CanHResize = true;
2474
                this.Width = 23.0;
2475
            }
2476
            if (!double.IsNaN(content.Height))
2477
            {
2478
                CanVResize = false;
2479
                this.Height = content.Height; ;
2480
            }
2481
            else
2482
            {
2483
                CanVResize = true;
2484
                this.Height = 23.0;
2485
            }
2486

    
2487
            minWidth = content.MinWidth < 10.0 ? 10.0 : content.MinWidth;
2488
            minHeight = content.MinHeight < 10.0 ? 10.0 : content.MinHeight;
2489
            maxWidth = content.MaxWidth;
2490
            maxHeight = content.MaxHeight;
2491

    
2492
            double top = (double)content.GetValue(Canvas.TopProperty);
2493
            if (double.IsNaN(top))
2494
                top = 0.0;
2495
            double left = (double)content.GetValue(Canvas.LeftProperty);
2496
            if (double.IsNaN(left))
2497
                left = 0.0;
2498
            SetValue(Canvas.TopProperty, top);
2499
            SetValue(Canvas.LeftProperty, left);
2500

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

    
2541
        private void drawControlBorder(object sender)
2542
        {
2543
            System.Windows.Controls.Control control = (System.Windows.Controls.Control)sender;
2544
        }
2545

    
2546
        private void ResizeThumb_DragDelta(object sender, MouseButtonEventArgs e)
2547
        {
2548
            System.Windows.Controls.Control designerItem = (System.Windows.Controls.Control)sender;
2549
            if (designerItem != null)
2550
            {
2551
                double deltaVertical, deltaHorizontal;
2552

    
2553
                switch (VerticalAlignment)
2554
                {
2555
                    case VerticalAlignment.Bottom:
2556
                        deltaVertical = designerItem.ActualHeight - designerItem.MinHeight;
2557
                        designerItem.Height -= deltaVertical;
2558
                        break;
2559
                    case VerticalAlignment.Top:
2560
                        deltaVertical = designerItem.ActualHeight - designerItem.MinHeight;
2561
                        Canvas.SetTop(designerItem, Canvas.GetTop(designerItem) + deltaVertical);
2562
                        designerItem.Height -= deltaVertical;
2563
                        break;
2564
                    default:
2565
                        break;
2566
                }
2567

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

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

    
2588
        void ExportMethod()
2589
        {
2590
            //FileDialogFilter filterImage = new FileDialogFilter("Image Files", "*.jpg", "*.png");
2591
            SaveDig.Filter = "PDF file format|*.pdf";
2592
            SaveDig.Title = "Save an DWG File";
2593
            SaveDig.ShowDialog();
2594
        }
2595

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

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

    
2626
            if(instanceToggle.IsChecked == true)
2627
            {
2628
                SaveTime(true);
2629
            }
2630
            else
2631
            {
2632
                SaveTime(false);
2633
            }
2634
        }
2635

    
2636
        public void Copy_Start()
2637
        {
2638
            if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
2639
            {
2640
                string MarkupData = "";
2641

    
2642
                foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
2643
                {
2644
                    if (item.GetType().Name == "AdornerFinal")
2645
                    {
2646
                        foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
2647

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

    
2661
        public void Cut_Start()
2662
        {
2663
            if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
2664
            {
2665
                foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
2666
                {
2667
                    string MarkupData = "";
2668

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

    
2687
        public void Paste_Start()
2688
        {
2689
            //마크업 붙여넣기
2690
            //if (Clipboard.GetText().Contains("|DZ|"))
2691
            if (Clipboard.GetText().Contains("|OR||DZ|"))
2692
            {
2693
                List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>();
2694

    
2695
                string[] delimiterChars = { "|OR|" };
2696
                string[] data = Clipboard.GetText().Split(delimiterChars, StringSplitOptions.RemoveEmptyEntries);
2697

    
2698
                SelectionSet.Instance.UnSelect(this.ParentOfType<MainWindow>().dzMainMenu);
2699

    
2700
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
2701

    
2702
                //강인구 Undo/Redo 보류
2703
                MarkupToPDF.Common.Undo_data UndoData = new Undo_data()
2704
                {
2705
                    IsUndo = false,
2706
                    Event = Event_Type.Create,
2707
                    EventTime = DateTime.Now,
2708
                    Markup_List = new List<Multi_Undo_data>()
2709
                };
2710

    
2711
                ViewerDataModel.Instance.UndoDataList.Where(data1 => data1.IsUndo == true).ToList().ForEach(i =>
2712
                {
2713
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
2714
                });
2715

    
2716
                foreach (string parse in data)
2717
                {
2718
                    if (parse != "")
2719
                    {
2720
                        System.Windows.Controls.Control item = MarkupParser.ParseEx(App.ViewInfo.ProjectNO, parse, ViewerDataModel.Instance.MarkupControls_USER, string.Empty, string.Empty);
2721
                        (item as MarkupToPDF.Common.CommentUserInfo).CommentID = Commons.shortGuid();
2722

    
2723
                        ViewerDataModel.Instance.MarkupControls.Remove(item as MarkupToPDF.Common.CommentUserInfo);
2724
                        ViewerDataModel.Instance.MarkupControls_USER.Remove(item as MarkupToPDF.Common.CommentUserInfo);
2725

    
2726
                        adornerSet.Add(item as MarkupToPDF.Common.CommentUserInfo);
2727

    
2728
                        //Controls.AdornerFinal final = new Controls.AdornerFinal(item as MarkupToPDF.Common.CommentUserInfo);
2729
                        //this.dzMainMenu.SelectLayer.Children.Add(final);
2730

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

    
2733
                        UndoData.Markup_List.Add(multi_Undo_Data);
2734
                        ViewerDataModel.Instance.UndoDataList.Add(UndoData);                        
2735
                    }
2736
                }
2737
                Controls.AdornerFinal final = new Controls.AdornerFinal(adornerSet);
2738

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

    
2750
                    if (final.Members.Where(type => type.Drawingtype == MarkupToPDF.Controls.Common.ControlType.TextControl).FirstOrDefault() != null)
2751
                    {
2752
                        final.TranslateItems(0.001, 0.001); //dummy
2753
                    }
2754

    
2755
                }
2756
                
2757

    
2758
                this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Add(final);
2759

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

    
2771
                    //강인구 Undo/Redo 보류
2772
                    MarkupToPDF.Common.Undo_data UndoData = new Undo_data()
2773
                    {
2774
                        IsUndo = false,
2775
                        Event = Event_Type.Create,
2776
                        EventTime = DateTime.Now,
2777
                        Markup_List = new List<Multi_Undo_data>()
2778
                    };
2779

    
2780

    
2781
                    string temppath = System.IO.Path.GetTempPath();
2782
                    //string filename = KCOM.Events.Save.shortCommentKey();
2783
                    string filename = Commons.shortFileKey();
2784

    
2785
                    System.Drawing.Image clipboardImage = System.Windows.Forms.Clipboard.GetImage();
2786
                    clipboardImage.Save(temppath + "\\" + filename);
2787

    
2788
                    System.IO.FileInfo fileInfo = new System.IO.FileInfo(temppath + "\\" + filename);
2789
                    String strFile = System.IO.Path.GetFileName(fileInfo.FullName);
2790
                    long numByte = fileInfo.Length;
2791
                    double dLen = Convert.ToDouble(fileInfo.Length / 1000000);
2792
                    kr.co.devdoftech.cloud.FileUpload fileUploader = new kr.co.devdoftech.cloud.FileUpload();
2793

    
2794
                    if (dLen < 4)
2795
                    {
2796
                        System.IO.FileStream fStream = new System.IO.FileStream(fileInfo.FullName,
2797
                        System.IO.FileMode.Open, System.IO.FileAccess.Read);
2798
                        System.IO.BinaryReader br = new System.IO.BinaryReader(fStream);
2799
                        byte[] data = br.ReadBytes((int)numByte);
2800

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

    
2813
                    fileInfo.Delete();
2814

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

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

    
2850
                    currentControl.TopRightPoint = new Point(currentControl.StartPoint.X + clipboardImage.Width, currentControl.StartPoint.Y);
2851
                    currentControl.LeftBottomPoint = new Point(currentControl.StartPoint.X, currentControl.StartPoint.Y + clipboardImage.Height);
2852
                    currentControl.EndPoint = new Point(currentControl.StartPoint.X + clipboardImage.Width, currentControl.StartPoint.Y + clipboardImage.Height);
2853

    
2854
                    currentControl.PointSet = new List<Point>
2855
                                        {
2856
                                            currentControl.StartPoint,
2857
                                            currentControl.LeftBottomPoint,
2858
                                            currentControl.EndPoint,
2859
                                            currentControl.TopRightPoint,
2860
                                        };
2861

    
2862
                    multi_Undo_Data = this.ParentOfType<MainWindow>().dzMainMenu.Control_Style(currentControl as MarkupToPDF.Common.CommentUserInfo);
2863
                    UndoData.Markup_List.Add(multi_Undo_Data);
2864
                    ViewerDataModel.Instance.UndoDataList.Add(UndoData);
2865

    
2866
                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl as MarkupToPDF.Common.CommentUserInfo);
2867
                    currentControl.CommentID = Commons.shortGuid();
2868

    
2869
                    currentControl.ApplyTemplate();
2870
                    currentControl.SetImage();
2871

    
2872
                    ViewerDataModel.Instance.MarkupControls_USER.Remove(currentControl as MarkupToPDF.Common.CommentUserInfo);
2873
                    Controls.AdornerFinal final = new Controls.AdornerFinal(currentControl as MarkupToPDF.Common.CommentUserInfo);
2874
                    this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Add(final);
2875

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