프로젝트

일반

사용자정보

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

markus / KCOM / Events / Implementation / TopMenuEvent.cs @ 71f5a3be

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

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

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

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

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

    
66
        private void CheckShapeState()
67
        {
68

    
69

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

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

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

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

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

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

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

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

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

    
149
        }
150

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
674

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
1261
                    ((TextBox)sender).Text = previousText;
1262
                }
1263
            }
1264
        }
1265

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

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

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

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

    
1344
                isClosed = false;
1345

    
1346
                
1347
                CheckList check = new CheckList(this.ParentOfType<MainWindow>());
1348

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

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

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

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

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

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

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

    
1438
            //instanceToggle.IsChecked = false;
1439

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

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

    
1505
        private void Control_Event(object sender, RoutedEventArgs e)
1506
        {
1507

    
1508
        }
1509

    
1510
        #region 대기
1511

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

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

    
1519
            //if (rotateOffSet < 0)
1520
            //    rotateOffSet = 3;
1521

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

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

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

    
1580

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

    
1585

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

    
1597

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

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

    
1607
                instanceMain.dzMainMenu.pageNavigator.GotoPage(data.PageNumber);
1608

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

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

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

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

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

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

    
1653
                        Check_Uri.UriCheck(filepath);
1654

    
1655
                        instanceMain.dzMainMenu.filename = filepath;
1656

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

    
1686
        private void Control_Init(RadToggleButton instanceToggle, object sender)
1687
        {
1688

    
1689
        }
1690

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

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

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

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

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

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

    
1754

    
1755

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

    
1766
            instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = false;
1767

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

    
1993
                        //instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = true;
1994

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

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

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

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

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

    
2226

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

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

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

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

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

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

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

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

    
2344
                    //        check.Closed += Check_Closed;
2345

    
2346
                    //    }
2347
                    //    break;
2348
                    //#endregion
2349
                    default:
2350
                        break;
2351
                }
2352
                #endregion
2353
            }
2354
            else
2355
            {
2356

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

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

    
2389
        }
2390

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

    
2406
        }
2407

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

    
2418
            string[] data = new string[0];
2419

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

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

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

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

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

    
2456
        private double minHeight;
2457
        private double minWidth;
2458

    
2459
        private double maxHeight;
2460
        private double maxWidth;
2461

    
2462
        public bool CanVResize { get; private set; }
2463
        public bool CanHResize { get; private set; }
2464

    
2465
        public void DesignerComponent(FrameworkElement content)
2466
        {
2467
            this.InitializeComponent();
2468

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
2701
                SelectionSet.Instance.UnSelect(this.ParentOfType<MainWindow>().dzMainMenu);
2702

    
2703
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
2704

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

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

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

    
2726
                        ViewerDataModel.Instance.MarkupControls.Remove(item as MarkupToPDF.Common.CommentUserInfo);
2727
                        ViewerDataModel.Instance.MarkupControls_USER.Remove(item as MarkupToPDF.Common.CommentUserInfo);
2728

    
2729
                        adornerSet.Add(item as MarkupToPDF.Common.CommentUserInfo);
2730

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

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

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

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

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

    
2758
                }
2759
                
2760

    
2761
                this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Add(final);
2762

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

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

    
2783

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

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

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

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

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

    
2816
                    fileInfo.Delete();
2817

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

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

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

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

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

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

    
2872
                    currentControl.ApplyTemplate();
2873
                    currentControl.SetImage();
2874

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

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