프로젝트

일반

사용자정보

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

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

이력 | 보기 | 이력해설 | 다운로드 (142 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
        public MarkupToPDF.Common.Undo_data UndoData;
38
        MarkupToPDF.Controls.Parsing.MarkupParser.MarkupReturn markupReturn = new MarkupToPDF.Controls.Parsing.MarkupParser.MarkupReturn();
39

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

    
126
        }
127

    
128
        private void SetHighlightEvent()
129
        {
130
            List<AdornerMember> AdonerList = GetAdornerItem();
131

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

    
152
        }
153

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

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

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

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

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

    
239
 		//강인구 추가
240
        private string SetColor(string ID)
241
        {
242
            try
243
            {
244
                return ViewerDataModel.Instance._markupInfoList.Where(info => info.MarkupInfoID == ID).First().DisplayColor;
245
            }
246
            catch (Exception)
247
            {
248
                return "#FFFFFF";
249
            }
250
        }
251

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

    
260
        }
261

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

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

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

    
312
            this.ParentOfType<MainWindow>().dzMainMenu.busyIndicator.IsBusy = true;
313
            System.Threading.Tasks.Task SaveTask = System.Threading.Tasks.Task.Factory.StartNew(() =>
314
            {
315
                Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, new Action<object, RoutedEventArgs>(_SaveEvent), sender, e);
316
            }).ContinueWith(task =>
317
            {
318
                Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate () { this.ParentOfType<MainWindow>().dzMainMenu.busyIndicator.IsBusy = false; }));
319
            });
320
        }
321

    
322
        /// <summary>
323
        /// save markup
324
        /// </summary>
325
        /// <param name="sender"></param>
326
        /// <param name="e"></param>
327
        public void _SaveEvent(object sender, RoutedEventArgs e)
328
        {
329
            var menu = this.ParentOfType<MainWindow>().dzMainMenu;
330
            try
331
            {
332
                SelectionSet.Instance.UnSelect(this.ParentOfType<MainWindow>().dzMainMenu);
333

    
334
                // update mylist and gridview
335
                menu.UpdateMyMarkupList();
336

    
337
                this.ParentOfType<MainWindow>().dzMainMenu.InkControl_Convert();
338

    
339
                if (menu.PreviewUserMarkupInfoItem != null && menu.PreviewUserMarkupInfoItem.IsPreviewUser == true)
340
                {
341
                    this.ExecuteSaveCommand(menu);
342
                }
343
                else if (menu.gridViewMarkup.SelectedItems.Count == 0 && menu.gridViewMarkup.Items.Count > 0)
344
                {
345
                    this.ParentOfType<MainWindow>().DialogMessage_Alert("Please Select Your Comment List Item", "Alert");
346
                    return;
347
                }
348
                else
349
                {                    
350
                    foreach (var item in menu.gridViewMarkup.SelectedItems)
351
                    {
352
                        if ((item as IKCOM.MarkupInfoItem).UserID == App.ViewInfo.UserID)
353
                        {
354
                            this.ExecuteSaveCommand(menu);
355
                            ViewerDataModel.Instance._markupInfoList.Where(data => data.MarkupInfoID == (item as IKCOM.MarkupInfoItem).MarkupInfoID).FirstOrDefault().UpdateTime = DateTime.Now;
356
                            if (ViewerDataModel.Instance.IsConsolidate)
357
                            {
358
                                return;
359
                            }
360

    
361
                            if (sender != null)
362
                            {
363
                                if (ViewerDataModel.Instance.IsPressCtrl)
364
                                {
365
                                    ViewerDataModel.Instance.IsPressCtrl = false;
366
                                }
367
                                this.ParentOfType<MainWindow>().DialogMessage_Alert("Save 가 완료되었습니다.", "Alert");
368
                            }
369
                            return;
370
                        }
371
                    }
372
                }
373
                if (sender != null)
374
                {
375
                    if (ViewerDataModel.Instance.IsPressCtrl)
376
                    {
377
                        ViewerDataModel.Instance.IsPressCtrl = false;
378
                    }
379
                    this.ParentOfType<MainWindow>().DialogMessage_Alert("Save 가 완료되었습니다.", "Alert");
380
                }
381
            }
382
            catch(Exception ex)
383
            {
384
               
385
            }
386
            finally
387
            {
388
                /*
389
                /// delete markup information when 코멘트가 없을 경우
390
                if (ViewerDataModel.Instance.MyMarkupList.Count == 0)
391
                {
392
                    foreach (var item in menu.gridViewMarkup.SelectedItems)
393
                    {
394
                        if ((item as IKCOM.MarkupInfoItem).UserID == App.ViewInfo.UserID)
395
                        {
396
                            //this.ParentOfType<MainWindow>().dzMainMenu.DeleteItem((item as IKCOM.MarkupInfoItem));
397
                        }
398
                    }
399
                }
400
                */
401
            }
402
        }
403

    
404
        /// <summary>
405
        /// call save command
406
        /// </summary>
407
        /// <param name="menu"></param>
408
		private void ExecuteSaveCommand(MainMenu menu)
409
        {
410
            SaveCommand.Instance.Project_No = App.ViewInfo.ProjectNO;
411
            SaveCommand.Instance.document_id = App.ViewInfo.DocumentItemID;
412
            SaveCommand.Instance.user_id = App.ViewInfo.UserID;
413
            SaveCommand.Instance.page_no = Convert.ToInt32(tlcurrentPage.Text);
414

    
415
            try
416
            {
417
                this.ParentOfType<MainWindow>().dzMainMenu.InkControl_Convert();
418

    
419
                List<IKCOM.MarkupInfoItem> SelectedMarkupInfos = new List<IKCOM.MarkupInfoItem>();
420
                foreach (var item in menu.gridViewMarkup.SelectedItems)
421
                {
422
                    if ((item as IKCOM.MarkupInfoItem).UserID == App.ViewInfo.UserID)
423
                    {
424
                        SelectedMarkupInfos.Add(item as IKCOM.MarkupInfoItem);
425
                    }
426
                }
427

    
428
                
429
                SaveCommand.Instance.Execute(SelectedMarkupInfos, SaveCommand.Instance.page_no);
430
                SaveCommand.Instance.PageAngleSave(App.ViewInfo.ProjectNO, ViewerDataModel.Instance.RotationDocs);
431
            }
432
            catch (Exception ex)
433
            {
434
                this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert(string.Format("세이브 실패:{0}", ex.Message), "Alert");
435
                throw ex;
436
            }
437
        }
438

    
439
        //강인구 추가
440
        public void Print_Start(string Type)
441
        {
442
            if (ViewerDataModel.Instance.IsPressCtrl)
443
            {
444
                ViewerDataModel.Instance.IsPressCtrl = false;
445
            }
446
            if (ViewerDataModel.Instance.MarkupControls_USER.Count > 0 || this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
447
            {
448
                var menu = this.ParentOfType<MainWindow>().dzMainMenu;
449
                SelectionSet.Instance.UnSelect(menu);
450
                if (menu.PreviewUserMarkupInfoItem != null && menu.PreviewUserMarkupInfoItem.IsPreviewUser == true)
451
                {
452
                    this.SaveEvent(null, null);
453
                }
454
                else if (menu.gridViewMarkup.SelectedItems.Count == 0 || (menu.gridViewMarkup.SelectedItems.FirstOrDefault() as IKCOM.MarkupInfoItem).UserID != App.ViewInfo.UserID)
455
                {
456

    
457
                }
458
                else
459
                {
460
                    this.SaveEvent(null, null);
461
                }
462
            }
463

    
464
            bool isprint = false;
465
            if (Type == "Print")
466
            {
467
                isprint = true;
468
            }
469

    
470
            RadWindow PrintWindow = new RadWindow();
471
            //IKCOM.MarkupInfoItem _result = null;
472
            PrintWindow.Width = 850;
473
            PrintWindow.Height = 600;
474
            //PrintWindow.Width = 650;
475
            //PrintWindow.Height = 550;
476
            PrintWindow.Header = Type;
477

    
478
            List<IKCOM.MarkupInfoItem> markupinfo = new List<IKCOM.MarkupInfoItem>();
479

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

    
483
            if (markupinfo.Count() > 0)
484
            {
485
                Logger.sendResLog("GetPrintDocItemList", "TRUE", 1);
486
            }
487
            else
488
            {
489
                Logger.sendResLog("GetPrintDocItemList", "FALSE", 1);
490
            }
491

    
492
            var Tile_Url = string.Format(@"{0}/TileSource/{1}_Tile/{2}/{3}/",
493
                App.SystemInfo.HostName,
494
                App.ViewInfo.ProjectNO,
495
                (Convert.ToInt64(App.ViewInfo.DocumentItemID) / 100).ToString(),
496
                App.ViewInfo.DocumentItemID
497
                );
498

    
499
            PrintWindow.Content = new KCOM.Control.PrintControl(
500
                      Tile_Url,
501
                      App.ViewInfo.ProjectNO,
502
                      this.ParentOfType<MainWindow>().dzMainMenu._DocInfo, markupinfo,
503
                      this.ParentOfType<MainWindow>().dzMainMenu.pageNavigator.CurrentPage.PageNumber,
504
                      App.ViewInfo.DocumentItemID,
505
                      this.ParentOfType<MainWindow>().dzMainMenu._DocItem.DOCUMENT_NO,
506
                      this.ParentOfType<MainWindow>().dzMainMenu._DocItem.ORIGINAL_FILE, isprint);
507

    
508
            //프린트 팝업 옵션
509
            //PrintWindow.BorderThickness = new Thickness(3);
510
            //PrintWindow.BorderBrush = new SolidColorBrush(Color.FromArgb(255, 37, 160, 218));
511
            PrintWindow.ResizeMode = System.Windows.ResizeMode.NoResize;
512
            PrintWindow.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
513
            PrintWindow.Background = new SolidColorBrush(Colors.Black);
514
            PrintWindow.Background.Opacity = 0.6;
515
            PrintWindow.Owner = Application.Current.MainWindow;
516
            Telerik.Windows.Controls.StyleManager.SetTheme(PrintWindow, new Telerik.Windows.Controls.VisualStudio2013Theme());
517
            PrintWindow.ShowDialog();
518
        }
519

    
520
        //강인구 추가
521
        private void PrintEvent(object sender, RoutedEventArgs e)
522
        {
523
            RadRibbonButton button = sender as RadRibbonButton;
524
            Print_Start(button.Content.ToString());
525
        }
526

    
527
        private List<AdornerMember> GetAdornerItem()
528
        {
529
            List<AdornerMember> AdonerList = new List<AdornerMember>();
530

    
531
            if (this.ParentOfType<MainWindow>() != null)
532
            {
533
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
534
                {
535
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
536
                    {
537
                        if (item.GetType().Name == "AdornerFinal")
538
                        {
539
                            foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
540
                            {
541
                                AdonerList.Add(InnerItem);
542
                            }
543
                        }
544
                    }
545
                }
546
            }
547

    
548
            return AdonerList;
549
        }
550
        /// <summary>
551
        /// 투명도
552
        /// </summary>
553
        /// <param name="sender"></param>
554
        /// <param name="e"></param>
555
        //강인구 추가(Undo End)
556
        private void sdOpacity_ValueChanged(object sender, RoutedEventArgs e)
557
        {
558
            List<AdornerMember> AdonerList = GetAdornerItem();
559
            if(AdonerList.Count > 0)
560
            {
561
                Undo_data UndoData = new Undo_data()
562
                {
563
                    IsUndo = false,
564
                    Event = Event_Type.Option,
565
                    EventTime = DateTime.Now,
566
                    Opacity = ViewerDataModel.Instance.ControlOpacity,
567
                    Markup_List = new List<Multi_Undo_data>()
568
                };
569
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
570

    
571
                foreach (AdornerMember InnerItem in AdonerList)
572
                {
573
                    InnerItem.DrawingData.Opacity = ViewerDataModel.Instance.ControlOpacity;
574
                  
575
                    multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
576
                    UndoData.Markup_List.Add(multi_Undo_Data);
577
                    multi_Undo_Data = new Multi_Undo_data();
578
                }
579

    
580
                ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
581
                {
582
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
583
                });
584
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
585
            }
586
        }
587

    
588
        //강인구 추가(Undo End)
589
        private void cbLineSize_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
590
        {
591
            if (string.IsNullOrEmpty(cbLineSize.Value.ToString()))
592
            {
593
                cbLineSize.Value = cbLineSize.Minimum;
594
            }
595
            List<AdornerMember> AdonerList = GetAdornerItem();
596
            if (AdonerList.Count > 0)
597
            {
598
                Undo_data UndoData = new Undo_data()
599
                {
600
                    IsUndo = false,
601
                    Event = Event_Type.Option,
602
                    EventTime = DateTime.Now,
603
                    LineSize = ViewerDataModel.Instance.LineSize,
604
                    Markup_List = new List<Multi_Undo_data>()
605
                };
606
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
607

    
608
                foreach (AdornerMember InnerItem in AdonerList)
609
                {
610
                    switch (InnerItem.DrawingData.GetType().Name)
611
                    {
612
                        case ("LineControl"):
613
                            {
614
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Line.LineControl).LineSize = ViewerDataModel.Instance.LineSize;
615
                            }
616
                            break;
617
                        case ("ArcControl"):
618
                            {
619
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Line.ArcControl).LineSize = ViewerDataModel.Instance.LineSize;
620
                            }
621
                            break;
622
                        case ("ArrowArcControl"):
623
                            {
624
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Line.ArrowArcControl).LineSize = ViewerDataModel.Instance.LineSize;
625
                            }
626
                            break;
627
                        case ("ArrowControl_Multi"):
628
                            {
629
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Line.ArrowControl_Multi).LineSize = ViewerDataModel.Instance.LineSize;
630
                            }
631
                            break;
632
                        case ("CloudControl"):
633
                            {
634
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Polygon.CloudControl).LineSize = ViewerDataModel.Instance.LineSize;
635
                            }
636
                            break;
637
                        case ("PolygonControl"):
638
                            {
639
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Polygon.PolygonControl).LineSize = ViewerDataModel.Instance.LineSize;
640
                            }
641
                            break;
642
                        case ("RectangleControl"):
643
                            {
644
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.RectangleControl).LineSize = ViewerDataModel.Instance.LineSize;
645
                            }
646
                            break;
647
                        case ("RectCloudControl"):
648
                            {
649
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.RectCloudControl).LineSize = ViewerDataModel.Instance.LineSize;
650
                            }
651
                            break;
652
                        case ("TriControl"):
653
                            {
654
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.TriControl).LineSize = ViewerDataModel.Instance.LineSize;
655
                            }
656
                            break;
657
                        case ("CircleControl"):
658
                            {
659
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.CircleControl).LineSize = ViewerDataModel.Instance.LineSize;
660
                            }
661
                            break;
662
                        case ("ArrowTextControl"):
663
                            {
664
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).LineSize = ViewerDataModel.Instance.LineSize;
665
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).BorderSize = new Thickness(ViewerDataModel.Instance.LineSize);
666
                            }
667
                            break;
668
                        case ("TextControl"):
669
                            {
670
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).LineSize = new Thickness(ViewerDataModel.Instance.LineSize);
671
                            }
672
                            break;
673
                        case ("InsideWhiteControl"):
674
                            {
675
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Cad.InsideWhiteControl).LineSize = ViewerDataModel.Instance.LineSize;
676
                            }
677
                            break;
678
                        case ("OverlapWhiteControl"):
679
                            {
680
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Cad.OverlapWhiteControl).LineSize = ViewerDataModel.Instance.LineSize;
681
                            }
682
                            break;
683
                        case ("ClipWhiteControl"):
684
                            {
685
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Cad.ClipWhiteControl).LineSize = ViewerDataModel.Instance.LineSize;
686
                            }
687
                            break;
688
                        case ("CoordinateControl"):
689
                            {
690
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Cad.CoordinateControl).LineSize = 10; //ViewerDataModel.Instance.LineSize
691
                            }
692
                            break;
693
                    }
694
                    
695

    
696
                    multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
697
                    UndoData.Markup_List.Add(multi_Undo_Data);
698
                    multi_Undo_Data = new Multi_Undo_data();
699
                }
700

    
701
                ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
702
                {
703
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
704
                });
705
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
706

    
707
                
708
            }
709
            KCOM.Properties.Settings.Default.LineSize = (double)cbLineSize.Value;
710
            Properties.Settings.Default.Save();
711
        }
712

    
713

    
714
        private void cbIntervalSize_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
715
        {
716
            if (string.IsNullOrEmpty(cbIntervalSize.Value.ToString()))
717
            {
718
                cbIntervalSize.Value = cbIntervalSize.Minimum;
719
            }
720
            List<AdornerMember> AdonerList = GetAdornerItem();
721
            if (AdonerList.Count > 0)
722
            {
723

    
724
                Undo_data UndoData = new Undo_data()
725
                {
726
                    IsUndo = false,
727
                    Event = Event_Type.Option,
728
                    EventTime = DateTime.Now,
729
                    Interval = ViewerDataModel.Instance.Interval,
730
                    Markup_List = new List<Multi_Undo_data>()
731
                };
732
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
733

    
734
                foreach (AdornerMember InnerItem in AdonerList)
735
                {
736
                    switch (InnerItem.DrawingData.GetType().Name)
737
                    {
738
                        case ("LineControl"):
739
                            {
740
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Line.LineControl).Interval = ViewerDataModel.Instance.Interval;
741

    
742
                                multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
743
                                UndoData.Markup_List.Add(multi_Undo_Data);
744
                                multi_Undo_Data = new Multi_Undo_data();
745
                            }
746
                            break;
747
                    }
748
                }
749

    
750
                ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
751
                {
752
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
753
                });
754
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
755
            }
756
            KCOM.Properties.Settings.Default.Interval = (double)cbIntervalSize.Value;
757
            Properties.Settings.Default.Save();
758
        }
759
        
760
        private void cbArcLength_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
761
        {
762
            if (string.IsNullOrEmpty(cbArcLength.Value.ToString()))
763
            {
764
                cbArcLength.Value = cbArcLength.Minimum;
765
            }
766
            List<AdornerMember> AdonerList = GetAdornerItem();
767
            if (AdonerList.Count > 0)
768
            {
769

    
770
                //Undo_data UndoData = new Undo_data()
771
                //{
772
                //    IsUndo = false,
773
                //    Event = Event_Type.Option,
774
                //    EventTime = DateTime.Now,
775
                //    Interval = ViewerDataModel.Instance.Interval,
776
                //    Markup_List = new List<Multi_Undo_data>()
777
                //};
778
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
779

    
780
                foreach (AdornerMember InnerItem in AdonerList)
781
                {
782
                    switch (InnerItem.DrawingData.GetType().Name)
783
                    {
784
                        case ("RectCloudControl"):
785
                            {
786
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.RectCloudControl).ArcLength = ViewerDataModel.Instance.ArcLength;
787

    
788
                                //multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
789
                                //UndoData.Markup_List.Add(multi_Undo_Data);
790
                                //multi_Undo_Data = new Multi_Undo_data();
791
                            }
792
                            break;
793
                        case ("CloudControl"):
794
                            {
795
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Polygon.CloudControl).ArcLength = ViewerDataModel.Instance.ArcLength;
796

    
797
                                //multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
798
                                //UndoData.Markup_List.Add(multi_Undo_Data);
799
                                //multi_Undo_Data = new Multi_Undo_data();
800
                            }
801
                            break;
802
                    }
803
                }
804

    
805
                //ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
806
                //{
807
                //    ViewerDataModel.Instance.UndoDataList.Remove(i);
808
                //});
809
                //ViewerDataModel.Instance.UndoDataList.Add(UndoData);
810
            }
811

    
812
            KCOM.Properties.Settings.Default.ArcLength = (double)cbArcLength.Value;
813
            Properties.Settings.Default.Save();
814
        }
815

    
816
        //강인구 추가(Undo End)
817
        private void cbDashStyle_SelectionChanged(object sender, SelectionChangedEventArgs e)
818
        {
819
            //강인구 추가
820
            if (this.ParentOfType<MainWindow>() != null)
821
            {
822
                ViewerDataModel.Instance.DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
823
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
824
                {
825
                    Undo_data UndoData = new Undo_data()
826
                    {
827
                        IsUndo = false,
828
                        Event = Event_Type.Option,
829
                        EventTime = DateTime.Now,
830
                        DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData,
831
                        Markup_List = new List<Multi_Undo_data>()
832
                    };
833
                    Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
834

    
835
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
836
                    {
837
                        if (item.GetType().Name == "AdornerFinal")
838
                        {
839
                            foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
840
                            {
841
                                switch (InnerItem.DrawingData.GetType().Name)
842
                                {
843
                                    case ("LineControl"):
844
                                        {
845
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Line.LineControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
846
                                        }
847
                                        break;
848
                                    case ("ArcControl"):
849
                                        {
850
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Line.ArcControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
851
                                        }
852
                                        break;
853
                                    case ("ArrowArcControl"):
854
                                        {
855
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Line.ArrowArcControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
856
                                        }
857
                                        break;
858
                                    case ("ArrowControl_Multi"):
859
                                        {
860
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Line.ArrowControl_Multi).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
861
                                        }
862
                                        break;
863
                                    case ("CloudControl"):
864
                                        {
865
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Polygon.CloudControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
866
                                        }
867
                                        break;
868
                                    case ("PolygonControl"):
869
                                        {
870
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Polygon.PolygonControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
871
                                        }
872
                                        break;
873
                                    case ("RectangleControl"):
874
                                        {
875
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.RectangleControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
876
                                        }
877
                                        break;
878
                                    case ("RectCloudControl"):
879
                                        {
880
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.RectCloudControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
881
                                        }
882
                                        break;
883
                                    case ("TriControl"):
884
                                        {
885
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.TriControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
886
                                        }
887
                                        break;
888
                                    case ("CircleControl"):
889
                                        {
890
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.CircleControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
891
                                        }
892
                                        break;
893
                                    case ("InsideWhiteControl"):
894
                                        {
895
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Cad.InsideWhiteControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
896
                                        }
897
                                        break;
898
                                    case ("OverlapWhiteControl"):
899
                                        {
900
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Cad.OverlapWhiteControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
901
                                        }
902
                                        break;
903
                                    case ("ClipWhiteControl"):
904
                                        {
905
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Cad.ClipWhiteControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
906
                                        }
907
                                        break;
908
                                    case ("CoordinateControl"):
909
                                        {
910
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Cad.CoordinateControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
911
                                        }
912
                                        break;
913
                                }
914

    
915
                                multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
916
                                UndoData.Markup_List.Add(multi_Undo_Data);
917
                                multi_Undo_Data = new Multi_Undo_data();
918
                            }
919

    
920
                            ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
921
                            {
922
                                ViewerDataModel.Instance.UndoDataList.Remove(i);
923
                            });
924
                            ViewerDataModel.Instance.UndoDataList.Add(UndoData);
925
                        }
926
                    }
927
                }
928
            }
929
        }
930

    
931
        //강인구 추가
932
        private void comboFontSize_SelectionChanged(object sender, SelectionChangedEventArgs e)
933
        {
934
            //if (this.ParentOfType<MainWindow>() != null)
935
            //{
936
            //    if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
937
            //    {
938
            //        foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
939
            //        {
940
            //            if (item.GetType().Name == "AdornerFinal")
941
            //            {
942
            //                foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
943
            //                {
944
            //                    switch (InnerItem.DrawingData.GetType().Name)
945
            //                    {
946
            //                        case ("TextControl"):
947
            //                            {
948
            //                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextSize = int.Parse(comboFontSize.Text);
949
            //                            }
950
            //                            break;
951
            //                        case ("ArrowTextControl"):
952
            //                            {
953
            //                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextSize = int.Parse(comboFontSize.Text);
954
            //                            }
955
            //                            break;
956
            //                    }
957
            //                }
958
            //            }
959
            //        }
960
            //    }
961
            //}
962
        }
963

    
964
        //강인구 추가
965
        private void btnBold_Checked(object sender, RoutedEventArgs e)
966
        {
967
            if (this.ParentOfType<MainWindow>() != null)
968
            {
969
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
970
                {
971
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
972
                    {
973
                        if (item.GetType().Name == "AdornerFinal")
974
                        {
975
                            foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
976
                            {
977
                                switch (InnerItem.DrawingData.GetType().Name)
978
                                {
979
                                    case ("TextControl"):
980
                                        {
981
                                            if((InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextWeight == FontWeights.Bold)
982
                                            {
983
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextWeight = FontWeights.Normal;
984
                                            }
985
                                            else
986
                                            {
987
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextWeight = FontWeights.Bold;
988
                                            }
989

    
990
                                        }
991
                                        break;
992
                                    case ("ArrowTextControl"):
993
                                        {
994
                                            if ((InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextWeight == FontWeights.Bold)
995
                                            {
996
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextWeight = FontWeights.Normal;
997
                                            }
998
                                            else
999
                                            {
1000
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextWeight = FontWeights.Bold;
1001
                                            }
1002
                                        }
1003
                                        break;
1004
                                }
1005
                            }
1006
                        }
1007
                    }
1008
                }
1009
            }
1010
        }
1011

    
1012
        //강인구 추가
1013
        private void btnItalic_Checked(object sender, RoutedEventArgs e)
1014
        {
1015
            if (this.ParentOfType<MainWindow>() != null)
1016
            {
1017
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
1018
                {
1019
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
1020
                    {
1021
                        if (item.GetType().Name == "AdornerFinal")
1022
                        {
1023
                            foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
1024
                            {
1025
                                switch (InnerItem.DrawingData.GetType().Name)
1026
                                {
1027
                                    case ("TextControl"):
1028
                                        {
1029
                                            if((InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextStyle == FontStyles.Italic)
1030
                                            {
1031
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextStyle = System.Windows.FontStyles.Normal;
1032
                                            }
1033
                                            else
1034
                                            {
1035
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextStyle = FontStyles.Italic;
1036
                                            }
1037

    
1038
                                        }
1039
                                        break;
1040
                                    case ("ArrowTextControl"):
1041
                                        {
1042
                                            if((InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextStyle == FontStyles.Italic)
1043
                                            {
1044
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextStyle = FontStyles.Normal;
1045
                                            }
1046
                                            else
1047
                                            {
1048
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextStyle = FontStyles.Italic;
1049
                                            }
1050
                                        }
1051
                                        break;
1052
                                }
1053
                            }
1054
                        }
1055
                    }
1056
                }
1057
            }
1058
        }
1059

    
1060
        //강인구 추가
1061
        private void btnUnderLine_Checked(object sender, RoutedEventArgs e)
1062
        {
1063
            if (this.ParentOfType<MainWindow>() != null)
1064
            {
1065
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
1066
                {
1067
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
1068
                    {
1069
                        if (item.GetType().Name == "AdornerFinal")
1070
                        {
1071
                            foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
1072
                            {
1073
                                switch (InnerItem.DrawingData.GetType().Name)
1074
                                {
1075
                                    case ("TextControl"):
1076
                                        {
1077
                                            if ((InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).UnderLine == TextDecorations.Underline)
1078
                                            {
1079
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).UnderLine = null;
1080
                                            }
1081
                                            else
1082
                                            {
1083
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).UnderLine = TextDecorations.Underline;
1084
                                            }
1085
                                        }
1086
                                        break;
1087
                                    case ("ArrowTextControl"):
1088
                                        {
1089
                                            if ((InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).UnderLine == TextDecorations.Underline)
1090
                                            {
1091
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).UnderLine = null;
1092
                                            }
1093
                                            else
1094
                                            {
1095
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).UnderLine = TextDecorations.Underline;
1096
                                            }
1097
                                        }
1098
                                        break;
1099
                                }
1100
                            }
1101
                        }
1102
                    }
1103
                }
1104
            }
1105
        }
1106

    
1107
        private void AxisLockEvent(object sender, RoutedEventArgs e)
1108
        {
1109
            ViewerDataModel.Instance.checkAxis = cbAxisLock.IsChecked.Value;
1110
        }
1111

    
1112
        private void comboFontSize_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
1113
        {
1114
            if (string.IsNullOrEmpty(comboFontSize.Value.ToString()))
1115
            {
1116
                comboFontSize.Value = comboFontSize.Minimum;
1117
            }
1118
            if (this.ParentOfType<MainWindow>() != null)
1119
            {
1120
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
1121
                {
1122
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
1123
                    {
1124
                        if (item.GetType().Name == "AdornerFinal")
1125
                        {
1126
                            foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
1127
                            {
1128
                                switch (InnerItem.DrawingData.GetType().Name)
1129
                                {
1130
                                    case ("TextControl"):
1131
                                        {
1132
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextSize = int.Parse(comboFontSize.Value.ToString());
1133
                                        }
1134
                                        break;
1135
                                    case ("ArrowTextControl"):
1136
                                        {
1137
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextSize = int.Parse(comboFontSize.Value.ToString());
1138
                                        }
1139
                                        break;
1140
                                }
1141
                            }
1142
                        }
1143
                    }
1144
                }
1145
            }
1146
            KCOM.Properties.Settings.Default.TextSize = (double)comboFontSize.Value;
1147
            Properties.Settings.Default.Save();
1148
        }
1149

    
1150
        //강인구 추가
1151
        private void RadRibbonComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
1152
        {
1153
            if (this.ParentOfType<MainWindow>() != null)
1154
            {
1155
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
1156
                {
1157
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
1158
                    {
1159
                        if (item.GetType().Name == "AdornerFinal")
1160
                        {
1161
                            foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
1162
                            {
1163
                                switch (InnerItem.DrawingData.GetType().Name)
1164
                                {
1165
                                    case ("TextControl"):
1166
                                        {
1167
                                            //if ((InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).FontFamily == TextDecorations.Underline)
1168
                                            //{
1169
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).FontFamily = new FontFamily(comboFontFamily.Text);
1170
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).Base_TextBlock.FontFamily = new FontFamily(comboFontFamily.Text);
1171
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).Base_TextBox.FontFamily = new FontFamily(comboFontFamily.Text);
1172
                                            //}
1173
                                            //else
1174
                                            //{
1175
                                            //    (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).UnderLine = TextDecorations.Underline;
1176
                                            //}
1177
                                        }
1178
                                        break;
1179
                                    case ("ArrowTextControl"):
1180
                                        {
1181
                                            //if ((InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).UnderLine == TextDecorations.Underline)
1182
                                            //{
1183
                                            //    (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).UnderLine = null;
1184
                                            //}
1185
                                            //else
1186
                                            //{
1187
                                            //    (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).UnderLine = TextDecorations.Underline;
1188
                                            //}
1189
                                        }
1190
                                        break;
1191
                                }
1192
                            }
1193
                        }
1194
                    }
1195
                }
1196
            }
1197
        }
1198

    
1199
        /// <summary>
1200
        /// 텍스트 컨트롤 하일라이트 처리
1201
        /// </summary>
1202
        /// <param name="sender"></param>
1203
        /// <param name="e"></param>
1204
        private void HighlightEvent(object sender, RoutedEventArgs e)
1205
        {
1206

    
1207
            ViewerDataModel.Instance.checkHighShape = (sender as CheckBox).IsChecked.Value;
1208
            SetHighlightEvent();
1209
            //if ((sender as CheckBox).IsChecked.Value)
1210
            //{
1211
            //    TaskMessage("HighLight가 설정되었습니다", TaskMessageType.Normal);
1212
            //}
1213
            //else
1214
            //{
1215
            //    TaskMessage("HighLight가 해제되었습니다", TaskMessageType.Caption);
1216
            //}
1217
            //if (ViewerDataModel.Instance.SelectedEditor as MarkupToPDF.Controls.Text.TextControl != null)
1218
            //{
1219
            //    MarkupToPDF.Controls.Text.TextControl instance = (ViewerDataModel.Instance.SelectedEditor as MarkupToPDF.Controls.Text.TextControl);
1220
            //    instance.IsHighLight = ViewerDataModel.Instance.checkHighShape;
1221
            //    instance.SetText();
1222
            //}
1223
        }
1224

    
1225
        //추가페이지 이동 엔터
1226
        private void tlcurrentPage_KeyDown(object sender, KeyEventArgs e)
1227
        {
1228
            //강인구 추가 tlcurrentPage을 이상하게 입력할수 있기때문에 Try Catch
1229
            if (e.Key == Key.Enter)
1230
            {
1231
                try
1232
                {
1233
                    var instanceMain = this.ParentOfType<MainWindow>();
1234
                    instanceMain.dzMainMenu.pageNavigator.GotoPage(Convert.ToInt32(tlcurrentPage.Text));
1235
                }
1236
                catch (Exception)
1237
                {
1238
                    RadWindow.Alert(new DialogParameters
1239
                    {
1240
                        Owner = Application.Current.MainWindow,
1241
                        Theme = new VisualStudio2013Theme(),
1242
                        Header = "안내",
1243
                        Content = "페이지 번호를 정확하게 입력해 주세요",
1244
                    });
1245
                }
1246
                
1247
            }
1248
        }
1249

    
1250
        private void tlcurrentPage_readonly_KeyDown(object sender, KeyEventArgs e)
1251
        {
1252
            //강인구 추가 tlcurrentPage을 이상하게 입력할수 있기때문에 Try Catch
1253
            if (e.Key == Key.Enter)
1254
            {
1255
                try
1256
                {
1257
                    var instanceMain = this.ParentOfType<MainWindow>();
1258
                    instanceMain.dzMainMenu.pageNavigator.GotoPage(Convert.ToInt32(tlcurrentPage_readonly.Text));
1259
                }
1260
                catch (Exception)
1261
                {
1262
                    RadWindow.Alert(new DialogParameters
1263
                    {
1264
                        Owner = Application.Current.MainWindow,
1265
                        Theme = new VisualStudio2013Theme(),
1266
                        Header = "안내",
1267
                        Content = "페이지 번호를 정확하게 입력해 주세요",
1268
                    });
1269
                }
1270

    
1271
            }
1272
        }
1273
        
1274

    
1275
        //public event EventHandler<WindowClosedEventArgs> Closed;
1276

    
1277
        //private void CheckEvent(object sender, RoutedEventArgs e)
1278
        //{
1279
        //    RadWindow CheckPop = new RadWindow();
1280
        //    test check = new test();
1281

    
1282
        //    CheckPop = new RadWindow
1283
        //    {
1284
        //        Width = 1700,
1285
        //        Height = 510,
1286
        //        Header = "My Check List",
1287
        //        Content = check,
1288
        //        Owner = this,
1289
        //        ResizeMode = System.Windows.ResizeMode.NoResize,
1290
        //        WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen,
1291
        //    };
1292
        //    StyleManager.SetTheme(CheckPop, new VisualStudio2013Theme());
1293

    
1294
        //    CheckPop.Closed += CheckPop_Closed;
1295
        //    CheckPop.ShowDialog();
1296
        //}
1297

    
1298
        private void PanoramaEvent(object sender, RoutedEventArgs e)
1299
        {
1300
            PanoramaShow();
1301
        }
1302

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

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

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

    
1349
                isClosed = false;
1350

    
1351
                
1352
                CheckList check = new CheckList();
1353

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

    
1375
        private void OptionPop_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
        private void CheckPop_Closed(object sender, WindowClosedEventArgs e)
1384
        {
1385
            isClosed = true;
1386
            //this.ParentOfType<MainWindow>().dzMainMenu.PN_Navi.IsEnabled = true;
1387
            this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
1388
            ViewerDataModel.Instance.Capture_Opacity = 0;
1389
        }
1390

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

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

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

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

    
1443
            //instanceToggle.IsChecked = false;
1444

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

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

    
1510
        private void Control_Event(object sender, RoutedEventArgs e)
1511
        {
1512

    
1513
        }
1514

    
1515
        #region 대기
1516

    
1517
        public void drawingPannelRotate(bool Flag)
1518
        {
1519
            var instanceMain = this.ParentOfType<MainWindow>();
1520

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

    
1524
            //if (rotateOffSet < 0)
1525
            //    rotateOffSet = 3;
1526

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

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

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

    
1585

    
1586
            //instanceMain.dzMainMenu.imageViewer.RenderTransformOrigin = new Point(0.5, 0.5);
1587
            //RotateTransform rotateTransform = new RotateTransform(instanceMain.dzMainMenu.rotate.Angle);
1588
            //instanceMain.dzMainMenu.imageViewer.RenderTransform = rotateTransform;
1589

    
1590

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

    
1602

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

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

    
1612
                instanceMain.dzMainMenu.pageNavigator.setPageChange(data);
1613

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

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

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

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

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

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

    
1658
                        Check_Uri.UriCheck(filepath);
1659

    
1660
                        instanceMain.dzMainMenu.filename = filepath;
1661

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

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

    
1685
        }
1686

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

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

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

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

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

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

    
1750

    
1751

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

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

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

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

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

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

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

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

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

    
2221

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

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

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

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

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

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

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

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

    
2339
                            check.Closed += Check_Closed;
2340

    
2341
                        }
2342
                        break;
2343
                    #endregion
2344
                    default:
2345
                        break;
2346
                }
2347
                #endregion
2348
            }
2349
            else
2350
            {
2351

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

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

    
2384
        }
2385

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

    
2401
        }
2402

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

    
2413
            string[] data = new string[0];
2414

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

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

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

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

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

    
2451
        private double minHeight;
2452
        private double minWidth;
2453

    
2454
        private double maxHeight;
2455
        private double maxWidth;
2456

    
2457
        public bool CanVResize { get; private set; }
2458
        public bool CanHResize { get; private set; }
2459

    
2460
        public void DesignerComponent(FrameworkElement content)
2461
        {
2462
            this.InitializeComponent();
2463

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
2696
                SelectionSet.Instance.UnSelect(this.ParentOfType<MainWindow>().dzMainMenu);
2697

    
2698
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
2699

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

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

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

    
2721
                        ViewerDataModel.Instance.MarkupControls.Remove(item as MarkupToPDF.Common.CommentUserInfo);
2722
                        ViewerDataModel.Instance.MarkupControls_USER.Remove(item as MarkupToPDF.Common.CommentUserInfo);
2723

    
2724
                        adornerSet.Add(item as MarkupToPDF.Common.CommentUserInfo);
2725

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

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

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

    
2737
                if(this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.X < 0)
2738
                {
2739
                    Canvas.SetLeft(final, 0);
2740
                    Canvas.SetTop(final, 0);
2741
                }
2742
                else
2743
                {
2744
                    double realPointX = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.X - final.BorderSize.X - (final.BorderSize.Width / 2);
2745
                    double realPointY = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.Y - final.BorderSize.Y - (final.BorderSize.Height / 2);
2746
                    final.MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(realPointX, realPointY));
2747

    
2748
                    if (final.Members.Where(type => type.Drawingtype == MarkupToPDF.Controls.Common.ControlType.TextControl).FirstOrDefault() != null)
2749
                    {
2750
                        final.MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(0.001, 0.001)); //dummy
2751
                    }
2752

    
2753
                }
2754
                
2755

    
2756
                this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Add(final);
2757

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

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

    
2778

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

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

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

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

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

    
2811
                    fileInfo.Delete();
2812

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

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

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

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

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

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

    
2867
                    currentControl.ApplyTemplate();
2868
                    currentControl.SetImage();
2869

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

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