프로젝트

일반

사용자정보

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

markus / KCOM / Events / Implementation / TopMenuEvent.cs @ 20ef6ffe

이력 | 보기 | 이력해설 | 다운로드 (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
using System.Web;
27

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

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

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

    
67
        private void CheckShapeState()
68
        {
69

    
70

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

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

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

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

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

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

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

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

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

    
150
        }
151

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

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

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

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

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

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

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

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

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

    
296
            if (mianMenu.busyIndicator.IsBusy == true)
297
            {
298
                return;
299
            }
300

    
301
            var result = await Dispatcher.InvokeAsync<bool>(()=>
302
            {
303
                this.ParentOfType<MainWindow>().dzMainMenu.busyIndicator.IsBusy = true;
304

    
305
                _SaveEvent(sender, e);
306

    
307
                mianMenu.busyIndicator.IsBusy = false;
308
                return true;
309
            });
310

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

    
320
        /// <summary>
321
        /// save markup
322
        ///  - convert ink control to polygon control if ink control exists
323
        ///  - unselect and update my markup list
324
        /// <param name="sender"></param>
325
        /// <param name="e"></param>
326
        public void _SaveEvent(object sender, RoutedEventArgs e)
327
        {
328
            var mainMenu = this.ParentOfType<MainWindow>().dzMainMenu;
329
            try
330
            {
331
                mainMenu.ConvertInkControlToPolygon();
332

    
333
                SelectionSet.Instance.UnSelect(this.ParentOfType<MainWindow>().dzMainMenu);
334
                // update mylist and gridview
335
                mainMenu.UpdateMyMarkupList();
336

    
337
                if (mainMenu.gridViewMarkup.SelectedItems.Count == 0 && mainMenu.gridViewMarkup.Items.Count > 0)
338
                {
339
                    this.ParentOfType<MainWindow>().DialogMessage_Alert("Please Select Your Comment List Item", "Alert");
340
                }
341
                else
342
                {                    
343
                    foreach (var item in mainMenu.gridViewMarkup.SelectedItems)
344
                    {
345
                        if ((item as IKCOM.MarkupInfoItem).UserID == App.ViewInfo.UserID)
346
                        {
347
                            this.ExecuteSaveCommand(mainMenu);
348
                            ViewerDataModel.Instance._markupInfoList.Where(data => data.MarkupInfoID == (item as IKCOM.MarkupInfoItem).MarkupInfoID).FirstOrDefault().UpdateTime = DateTime.Now;
349
                            if (!ViewerDataModel.Instance.IsConsolidate && (sender != null))
350
                            {
351
                                this.ParentOfType<MainWindow>().DialogMessage_Alert("Save 가 완료되었습니다.", "Alert");
352
                            }
353
                        }
354
                    }
355
                }
356

    
357
                mainMenu.SetCommentPages();
358

    
359
                ViewerDataModel.Instance.UndoDataList.Clear();
360
            }
361
            catch (Exception ex)
362
            {
363
               
364
            }
365
            finally
366
            {
367
                /*
368
                /// delete markup information when 코멘트가 없을 경우
369
                if (ViewerDataModel.Instance.MyMarkupList.Count == 0)
370
                {
371
                    foreach (var item in menu.gridViewMarkup.SelectedItems)
372
                    {
373
                        if ((item as IKCOM.MarkupInfoItem).UserID == App.ViewInfo.UserID)
374
                        {
375
                            //this.ParentOfType<MainWindow>().dzMainMenu.DeleteItem((item as IKCOM.MarkupInfoItem));
376
                        }
377
                    }
378
                }
379
                */
380
            }
381
        }
382

    
383
        /// <summary>
384
        /// call save command
385
        /// </summary>
386
        /// <param name="menu"></param>
387
		private void ExecuteSaveCommand(MainMenu menu)
388
        {
389
            SaveCommand.Instance.Project_No = App.ViewInfo.ProjectNO;
390
            SaveCommand.Instance.document_id = App.ViewInfo.DocumentItemID;
391
            SaveCommand.Instance.user_id = App.ViewInfo.UserID;
392
            SaveCommand.Instance.page_no = menu.pageNavigator.CurrentPage.PageNumber;
393

    
394
            try
395
            {
396
                if (ViewerDataModel.Instance.UndoDataList.Count > 0)
397
                {
398
                    List<IKCOM.MarkupInfoItem> SelectedMarkupInfos = new List<IKCOM.MarkupInfoItem>();
399
                    foreach (var item in menu.gridViewMarkup.SelectedItems)
400
                    {
401
                        if ((item as IKCOM.MarkupInfoItem).UserID == App.ViewInfo.UserID)
402
                        {
403
                            SelectedMarkupInfos.Add(item as IKCOM.MarkupInfoItem);
404
                        }
405
                    }
406

    
407
                    SaveCommand.Instance.Execute(SelectedMarkupInfos);
408
                }
409

    
410
                if(ViewerDataModel.Instance.RotationDocs.Count > 0)
411
                    SaveCommand.Instance.PageAngleSave(App.ViewInfo.ProjectNO, ViewerDataModel.Instance.RotationDocs);
412
            }
413
            catch (Exception ex)
414
            {
415
                this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert(string.Format("세이브 실패:{0}", ex.Message), "Alert");
416
                throw ex;
417
            }
418
        }
419

    
420
        //강인구 추가
421
        public void Print_Start(string Type)
422
        {
423
            if (ViewerDataModel.Instance.MarkupControls_USER.Count > 0 || this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
424
            {
425
                var menu = this.ParentOfType<MainWindow>().dzMainMenu;
426
                SelectionSet.Instance.UnSelect(menu);
427
                if (menu.PreviewUserMarkupInfoItem != null && menu.PreviewUserMarkupInfoItem.IsPreviewUser == true)
428
                {
429
                    this.SaveEventCallback(null, null);
430
                }
431
                else if (menu.gridViewMarkup.SelectedItems.Count == 0 || (menu.gridViewMarkup.SelectedItems.FirstOrDefault() as IKCOM.MarkupInfoItem).UserID != App.ViewInfo.UserID)
432
                {
433

    
434
                }
435
                else
436
                {
437
                    this.SaveEventCallback(null, null);
438
                }
439
            }
440

    
441
            bool isprint = false;
442
            if (Type == "Print")
443
            {
444
                isprint = true;
445
            }
446

    
447
            RadWindow PrintWindow = new RadWindow();
448
            PrintWindow.Width = 850;
449
            PrintWindow.Height = 600;
450
            PrintWindow.Header = Type;
451

    
452
            List<IKCOM.MarkupInfoItem> markupinfo = new List<IKCOM.MarkupInfoItem>();
453

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

    
456
            if (markupinfo.Count() > 0)
457
            {
458
                Logger.sendResLog("GetPrintDocItemList", "TRUE", 1);
459
            }
460
            else
461
            {
462
                Logger.sendResLog("GetPrintDocItemList", "FALSE", 1);
463
            }
464

    
465
            /// Tile Source URL을 구한다
466

    
467
            string sImageURL = ViewerDataModel.Instance.SystemMain.dzMainMenu.GetImageURL(App.ViewInfo.DocumentItemID, this.ParentOfType<MainWindow>().dzMainMenu.pageNavigator.CurrentPage.PageNumber);
468
            var url = new Uri(sImageURL);
469
            string sFolder = App.ViewInfo.DocumentItemID.All(char.IsDigit) ? (Convert.ToInt64(App.ViewInfo.DocumentItemID) / 100).ToString() : App.ViewInfo.DocumentItemID.Substring(0, 5);
470
            var Tile_Url = string.Format(@"{0}://{1}:{2}/TileSource/{3}_Tile/{4}/{5}/",
471
                url.Scheme, url.Host, url.Port,
472
                App.ViewInfo.ProjectNO,
473
                sFolder,
474
                App.ViewInfo.DocumentItemID
475
                );
476
            /// up to here
477

    
478
            PrintWindow.Content = new KCOM.Control.PrintControl(
479
                      Tile_Url,
480
                      App.ViewInfo.ProjectNO,
481
                      this.ParentOfType<MainWindow>().dzMainMenu._DocInfo, markupinfo,
482
                      this.ParentOfType<MainWindow>().dzMainMenu.pageNavigator.CurrentPage.PageNumber,
483
                      App.ViewInfo.DocumentItemID,
484
                      this.ParentOfType<MainWindow>().dzMainMenu._DocItem.DOCUMENT_NO,
485
                      this.ParentOfType<MainWindow>().dzMainMenu._DocItem.ORIGINAL_FILE, isprint);
486

    
487
            //프린트 팝업 옵션
488
            //PrintWindow.BorderThickness = new Thickness(3);
489
            //PrintWindow.BorderBrush = new SolidColorBrush(Color.FromArgb(255, 37, 160, 218));
490
            PrintWindow.ResizeMode = System.Windows.ResizeMode.NoResize;
491
            PrintWindow.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
492
            PrintWindow.Background = new SolidColorBrush(Colors.Black);
493
            PrintWindow.Background.Opacity = 0.6;
494
            PrintWindow.Owner = Application.Current.MainWindow;
495
            Telerik.Windows.Controls.StyleManager.SetTheme(PrintWindow, new Telerik.Windows.Controls.VisualStudio2013Theme());
496
            PrintWindow.ShowDialog();
497
        }
498

    
499
        //강인구 추가
500
        private void PrintEvent(object sender, RoutedEventArgs e)
501
        {
502
            RadRibbonButton button = sender as RadRibbonButton;
503
            Print_Start(button.Content.ToString());
504
        }
505

    
506
        private List<AdornerMember> GetAdornerItem()
507
        {
508
            List<AdornerMember> AdonerList = new List<AdornerMember>();
509

    
510
            if (this.ParentOfType<MainWindow>() != null)
511
            {
512
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
513
                {
514
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
515
                    {
516
                        if (item.GetType().Name == "AdornerFinal")
517
                        {
518
                            foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
519
                            {
520
                                AdonerList.Add(InnerItem);
521
                            }
522
                        }
523
                    }
524
                }
525
            }
526

    
527
            return AdonerList;
528
        }
529
        /// <summary>
530
        /// 투명도
531
        /// </summary>
532
        /// <param name="sender"></param>
533
        /// <param name="e"></param>
534
        //강인구 추가(Undo End)
535
        private void sdOpacity_ValueChanged(object sender, RoutedEventArgs e)
536
        {
537
            List<AdornerMember> AdonerList = GetAdornerItem();
538
            if(AdonerList.Count > 0)
539
            {
540
                Undo_data UndoData = new Undo_data()
541
                {
542
                    IsUndo = false,
543
                    Event = Event_Type.Option,
544
                    EventTime = DateTime.Now,
545
                    Opacity = ViewerDataModel.Instance.ControlOpacity,
546
                    Markup_List = new List<Multi_Undo_data>()
547
                };
548
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
549

    
550
                foreach (AdornerMember InnerItem in AdonerList)
551
                {
552
                    InnerItem.DrawingData.Opacity = ViewerDataModel.Instance.ControlOpacity;
553
                  
554
                    multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
555
                    UndoData.Markup_List.Add(multi_Undo_Data);
556
                    multi_Undo_Data = new Multi_Undo_data();
557
                }
558

    
559
                ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
560
                {
561
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
562
                });
563
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
564
            }
565
        }
566

    
567
        //강인구 추가(Undo End)
568
        private void cbLineSize_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
569
        {
570
            if (string.IsNullOrEmpty(cbLineSize.Value.ToString()))
571
            {
572
                cbLineSize.Value = cbLineSize.Minimum;
573
            }
574
            List<AdornerMember> AdonerList = GetAdornerItem();
575
            if (AdonerList.Count > 0)
576
            {
577
                Undo_data UndoData = new Undo_data()
578
                {
579
                    IsUndo = false,
580
                    Event = Event_Type.Option,
581
                    EventTime = DateTime.Now,
582
                    LineSize = ViewerDataModel.Instance.LineSize,
583
                    Markup_List = new List<Multi_Undo_data>()
584
                };
585
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
586

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

    
675
                    multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
676
                    UndoData.Markup_List.Add(multi_Undo_Data);
677
                    multi_Undo_Data = new Multi_Undo_data();
678
                }
679

    
680
                ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
681
                {
682
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
683
                });
684
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
685

    
686
                
687
            }
688
            KCOM.Properties.Settings.Default.LineSize = (double)cbLineSize.Value;
689
            Properties.Settings.Default.Save();
690
        }
691

    
692

    
693
        private void cbIntervalSize_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
694
        {
695
            if (string.IsNullOrEmpty(cbIntervalSize.Value.ToString()))
696
            {
697
                cbIntervalSize.Value = cbIntervalSize.Minimum;
698
            }
699
            List<AdornerMember> AdonerList = GetAdornerItem();
700
            if (AdonerList.Count > 0)
701
            {
702

    
703
                Undo_data UndoData = new Undo_data()
704
                {
705
                    IsUndo = false,
706
                    Event = Event_Type.Option,
707
                    EventTime = DateTime.Now,
708
                    Interval = ViewerDataModel.Instance.Interval,
709
                    Markup_List = new List<Multi_Undo_data>()
710
                };
711
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
712

    
713
                foreach (AdornerMember InnerItem in AdonerList)
714
                {
715
                    switch (InnerItem.DrawingData.GetType().Name)
716
                    {
717
                        case ("LineControl"):
718
                            {
719
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Line.LineControl).Interval = ViewerDataModel.Instance.Interval;
720

    
721
                                multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
722
                                UndoData.Markup_List.Add(multi_Undo_Data);
723
                                multi_Undo_Data = new Multi_Undo_data();
724
                            }
725
                            break;
726
                    }
727
                }
728

    
729
                ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
730
                {
731
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
732
                });
733
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
734
            }
735
            KCOM.Properties.Settings.Default.Interval = (double)cbIntervalSize.Value;
736
            Properties.Settings.Default.Save();
737
        }
738
        
739
        private void cbArcLength_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
740
        {
741
            if (string.IsNullOrEmpty(cbArcLength.Value.ToString()))
742
            {
743
                cbArcLength.Value = cbArcLength.Minimum;
744
            }
745
            List<AdornerMember> AdonerList = GetAdornerItem();
746
            if (AdonerList.Count > 0)
747
            {
748

    
749
                //Undo_data UndoData = new Undo_data()
750
                //{
751
                //    IsUndo = false,
752
                //    Event = Event_Type.Option,
753
                //    EventTime = DateTime.Now,
754
                //    Interval = ViewerDataModel.Instance.Interval,
755
                //    Markup_List = new List<Multi_Undo_data>()
756
                //};
757
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
758

    
759
                foreach (AdornerMember InnerItem in AdonerList)
760
                {
761
                    switch (InnerItem.DrawingData.GetType().Name)
762
                    {
763
                        case ("RectCloudControl"):
764
                            {
765
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.RectCloudControl).ArcLength = ViewerDataModel.Instance.ArcLength;
766

    
767
                                //multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
768
                                //UndoData.Markup_List.Add(multi_Undo_Data);
769
                                //multi_Undo_Data = new Multi_Undo_data();
770
                            }
771
                            break;
772
                        case ("CloudControl"):
773
                            {
774
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Polygon.CloudControl).ArcLength = ViewerDataModel.Instance.ArcLength;
775

    
776
                                //multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
777
                                //UndoData.Markup_List.Add(multi_Undo_Data);
778
                                //multi_Undo_Data = new Multi_Undo_data();
779
                            }
780
                            break;
781
                    }
782
                }
783

    
784
                //ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
785
                //{
786
                //    ViewerDataModel.Instance.UndoDataList.Remove(i);
787
                //});
788
                //ViewerDataModel.Instance.UndoDataList.Add(UndoData);
789
            }
790

    
791
            KCOM.Properties.Settings.Default.ArcLength = (double)cbArcLength.Value;
792
            Properties.Settings.Default.Save();
793
        }
794

    
795
        //강인구 추가(Undo End)
796
        private void cbDashStyle_SelectionChanged(object sender, SelectionChangedEventArgs e)
797
        {
798
            //강인구 추가
799
            if (this.ParentOfType<MainWindow>() != null)
800
            {
801
                ViewerDataModel.Instance.DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
802
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
803
                {
804
                    Undo_data UndoData = new Undo_data()
805
                    {
806
                        IsUndo = false,
807
                        Event = Event_Type.Option,
808
                        EventTime = DateTime.Now,
809
                        DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData,
810
                        Markup_List = new List<Multi_Undo_data>()
811
                    };
812
                    Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
813

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

    
894
                                multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
895
                                UndoData.Markup_List.Add(multi_Undo_Data);
896
                                multi_Undo_Data = new Multi_Undo_data();
897
                            }
898

    
899
                            ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
900
                            {
901
                                ViewerDataModel.Instance.UndoDataList.Remove(i);
902
                            });
903
                            ViewerDataModel.Instance.UndoDataList.Add(UndoData);
904
                        }
905
                    }
906
                }
907
            }
908
        }
909

    
910
        //강인구 추가
911
        private void comboFontSize_SelectionChanged(object sender, SelectionChangedEventArgs e)
912
        {
913
            //if (this.ParentOfType<MainWindow>() != null)
914
            //{
915
            //    if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
916
            //    {
917
            //        foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
918
            //        {
919
            //            if (item.GetType().Name == "AdornerFinal")
920
            //            {
921
            //                foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
922
            //                {
923
            //                    switch (InnerItem.DrawingData.GetType().Name)
924
            //                    {
925
            //                        case ("TextControl"):
926
            //                            {
927
            //                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextSize = int.Parse(comboFontSize.Text);
928
            //                            }
929
            //                            break;
930
            //                        case ("ArrowTextControl"):
931
            //                            {
932
            //                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextSize = int.Parse(comboFontSize.Text);
933
            //                            }
934
            //                            break;
935
            //                    }
936
            //                }
937
            //            }
938
            //        }
939
            //    }
940
            //}
941
        }
942

    
943
        //강인구 추가
944
        private void btnBold_Checked(object sender, RoutedEventArgs e)
945
        {
946
            if (this.ParentOfType<MainWindow>() != null)
947
            {
948
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
949
                {
950
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
951
                    {
952
                        if (item.GetType().Name == "AdornerFinal")
953
                        {
954
                            foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
955
                            {
956
                                switch (InnerItem.DrawingData.GetType().Name)
957
                                {
958
                                    case ("TextControl"):
959
                                        {
960
                                            if((InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextWeight == FontWeights.Bold)
961
                                            {
962
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextWeight = FontWeights.Normal;
963
                                            }
964
                                            else
965
                                            {
966
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextWeight = FontWeights.Bold;
967
                                            }
968

    
969
                                        }
970
                                        break;
971
                                    case ("ArrowTextControl"):
972
                                        {
973
                                            if ((InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextWeight == FontWeights.Bold)
974
                                            {
975
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextWeight = FontWeights.Normal;
976
                                            }
977
                                            else
978
                                            {
979
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextWeight = FontWeights.Bold;
980
                                            }
981
                                        }
982
                                        break;
983
                                }
984
                            }
985
                        }
986
                    }
987
                }
988
            }
989
        }
990

    
991
        //강인구 추가
992
        private void btnItalic_Checked(object sender, RoutedEventArgs e)
993
        {
994
            if (this.ParentOfType<MainWindow>() != null)
995
            {
996
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
997
                {
998
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
999
                    {
1000
                        if (item.GetType().Name == "AdornerFinal")
1001
                        {
1002
                            foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
1003
                            {
1004
                                switch (InnerItem.DrawingData.GetType().Name)
1005
                                {
1006
                                    case ("TextControl"):
1007
                                        {
1008
                                            if((InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextStyle == FontStyles.Italic)
1009
                                            {
1010
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextStyle = System.Windows.FontStyles.Normal;
1011
                                            }
1012
                                            else
1013
                                            {
1014
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextStyle = FontStyles.Italic;
1015
                                            }
1016

    
1017
                                        }
1018
                                        break;
1019
                                    case ("ArrowTextControl"):
1020
                                        {
1021
                                            if((InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextStyle == FontStyles.Italic)
1022
                                            {
1023
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextStyle = FontStyles.Normal;
1024
                                            }
1025
                                            else
1026
                                            {
1027
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextStyle = FontStyles.Italic;
1028
                                            }
1029
                                        }
1030
                                        break;
1031
                                }
1032
                            }
1033
                        }
1034
                    }
1035
                }
1036
            }
1037
        }
1038

    
1039
        //강인구 추가
1040
        private void btnUnderLine_Checked(object sender, RoutedEventArgs e)
1041
        {
1042
            if (this.ParentOfType<MainWindow>() != null)
1043
            {
1044
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
1045
                {
1046
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
1047
                    {
1048
                        if (item.GetType().Name == "AdornerFinal")
1049
                        {
1050
                            foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
1051
                            {
1052
                                switch (InnerItem.DrawingData.GetType().Name)
1053
                                {
1054
                                    case ("TextControl"):
1055
                                        {
1056
                                            if ((InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).UnderLine == TextDecorations.Underline)
1057
                                            {
1058
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).UnderLine = null;
1059
                                            }
1060
                                            else
1061
                                            {
1062
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).UnderLine = TextDecorations.Underline;
1063
                                            }
1064
                                        }
1065
                                        break;
1066
                                    case ("ArrowTextControl"):
1067
                                        {
1068
                                            if ((InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).UnderLine == TextDecorations.Underline)
1069
                                            {
1070
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).UnderLine = null;
1071
                                            }
1072
                                            else
1073
                                            {
1074
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).UnderLine = TextDecorations.Underline;
1075
                                            }
1076
                                        }
1077
                                        break;
1078
                                }
1079
                            }
1080
                        }
1081
                    }
1082
                }
1083
            }
1084
        }
1085

    
1086
        private void AxisLockEvent(object sender, RoutedEventArgs e)
1087
        {
1088
            ViewerDataModel.Instance.checkAxis = cbAxisLock.IsChecked.Value;
1089
        }
1090

    
1091
        private void comboFontSize_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
1092
        {
1093
            if (string.IsNullOrEmpty(comboFontSize.Value.ToString()))
1094
            {
1095
                comboFontSize.Value = comboFontSize.Minimum;
1096
            }
1097
            if (this.ParentOfType<MainWindow>() != null)
1098
            {
1099
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
1100
                {
1101
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
1102
                    {
1103
                        if (item.GetType().Name == "AdornerFinal")
1104
                        {
1105
                            foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
1106
                            {
1107
                                switch (InnerItem.DrawingData.GetType().Name)
1108
                                {
1109
                                    case ("TextControl"):
1110
                                        {
1111
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextSize = int.Parse(comboFontSize.Value.ToString());
1112
                                        }
1113
                                        break;
1114
                                    case ("ArrowTextControl"):
1115
                                        {
1116
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextSize = int.Parse(comboFontSize.Value.ToString());
1117
                                        }
1118
                                        break;
1119
                                }
1120
                            }
1121
                        }
1122
                    }
1123
                }
1124
            }
1125
            KCOM.Properties.Settings.Default.TextSize = (double)comboFontSize.Value;
1126
            Properties.Settings.Default.Save();
1127
        }
1128

    
1129
        //강인구 추가
1130
        private void RadRibbonComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
1131
        {
1132
            if (this.ParentOfType<MainWindow>() != null)
1133
            {
1134
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
1135
                {
1136
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
1137
                    {
1138
                        if (item.GetType().Name == "AdornerFinal")
1139
                        {
1140
                            foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
1141
                            {
1142
                                switch (InnerItem.DrawingData.GetType().Name)
1143
                                {
1144
                                    case ("TextControl"):
1145
                                        {
1146
                                            //if ((InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).FontFamily == TextDecorations.Underline)
1147
                                            //{
1148
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).SetFontFamily(new FontFamily(comboFontFamily.Text));
1149
                                            //(InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).Base_TextBlock.FontFamily = new FontFamily(comboFontFamily.Text);
1150
                                            //(InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).Base_TextBox.FontFamily = new FontFamily(comboFontFamily.Text);
1151
                                            //(InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextFamily = new FontFamily(comboFontFamily.Text);
1152
                                            //}
1153
                                            //else
1154
                                            //{
1155
                                            //    (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).UnderLine = TextDecorations.Underline;
1156
                                            //}
1157
                                        }
1158
                                        break;
1159
                                    case ("ArrowTextControl"):
1160
                                        {
1161
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).SetFontFamily(new FontFamily(comboFontFamily.Text));
1162
                                            //if ((InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).UnderLine == TextDecorations.Underline)
1163
                                            //{
1164
                                            //    (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).UnderLine = null;
1165
                                            //}
1166
                                            //else
1167
                                            //{
1168
                                            //    (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).UnderLine = TextDecorations.Underline;
1169
                                            //}
1170
                                        }
1171
                                        break;
1172
                                }
1173
                            }
1174
                        }
1175
                    }
1176
                }
1177
            }
1178
        }
1179

    
1180
        /// <summary>
1181
        /// 텍스트 컨트롤 하일라이트 처리
1182
        /// </summary>
1183
        /// <param name="sender"></param>
1184
        /// <param name="e"></param>
1185
        private void HighlightEvent(object sender, RoutedEventArgs e)
1186
        {
1187

    
1188
            ViewerDataModel.Instance.checkHighShape = (sender as CheckBox).IsChecked.Value;
1189
            SetHighlightEvent();
1190
            //if ((sender as CheckBox).IsChecked.Value)
1191
            //{
1192
            //    TaskMessage("HighLight가 설정되었습니다", TaskMessageType.Normal);
1193
            //}
1194
            //else
1195
            //{
1196
            //    TaskMessage("HighLight가 해제되었습니다", TaskMessageType.Caption);
1197
            //}
1198
            //if (ViewerDataModel.Instance.SelectedEditor as MarkupToPDF.Controls.Text.TextControl != null)
1199
            //{
1200
            //    MarkupToPDF.Controls.Text.TextControl instance = (ViewerDataModel.Instance.SelectedEditor as MarkupToPDF.Controls.Text.TextControl);
1201
            //    instance.IsHighLight = ViewerDataModel.Instance.checkHighShape;
1202
            //    instance.SetText();
1203
            //}
1204
        }
1205

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

    
1279
                    ((TextBox)sender).Text = previousText;
1280
                }
1281
            }
1282
        }
1283

    
1284
        /// <summary>
1285
        /// 입력한 페이지로 이동한다
1286
        /// </summary>
1287
        /// <param name="sender"></param>
1288
        /// <param name="e"></param>
1289
        private void tlcurrentPage_readonly_KeyDown(object sender, KeyEventArgs e)
1290
        {
1291
            if (e.Key == Key.Enter)
1292
            {
1293
                try
1294
                {
1295
                    var instanceMain = this.ParentOfType<MainWindow>();
1296
                    instanceMain.dzMainMenu.pageNavigator.GotoPage(Convert.ToInt32(tlcurrentPage_readonly.Text));
1297
                }
1298
                catch (Exception)
1299
                {
1300
                    RadWindow.Alert(new DialogParameters
1301
                    {
1302
                        Owner = Application.Current.MainWindow,
1303
                        Theme = new VisualStudio2013Theme(),
1304
                        Header = "안내",
1305
                        Content = "페이지 번호를 정확하게 입력해 주세요",
1306
                    });
1307
                }
1308
            }
1309
        }
1310
        
1311
        private void PanoramaEvent(object sender, RoutedEventArgs e)
1312
        {
1313
            PanoramaShow();
1314
        }
1315

    
1316
        public void PanoramaShow()
1317
        {
1318
            Panorama check = new Panorama();
1319
            double screenWidth = System.Windows.SystemParameters.PrimaryScreenWidth;
1320
            double screenHeight = System.Windows.SystemParameters.PrimaryScreenHeight;
1321
            //double windowWidth = this.Width;
1322
            //double windowHeight = this.Height;
1323

    
1324
            var PanoramaPop = new RadWindow
1325
            {
1326
                //MinWidth = 600,
1327
                //MinHeight = 400,
1328
                //Header = "My Check List",
1329
                Header = "Document No : " + this.ParentOfType<MainWindow>().dzMainMenu._DocItem.DOCUMENT_NO + " / Revision :" + this.ParentOfType<MainWindow>().dzMainMenu._DocItem.REVISION,
1330
                Content = check,
1331
                Owner = this,
1332
                ResizeMode = System.Windows.ResizeMode.CanResizeWithGrip,
1333
                //ResizeMode = System.Windows.ResizeMode.NoResize,
1334
                WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen,
1335
                IsTopmost = false,
1336
                //Left = (screenWidth / 2) - (windowWidth / 2),
1337
                //Top = (screenHeight / 2) - (windowHeight / 2),
1338
                //Left = (screenWidth / 2),
1339
                //Top = (screenHeight / 2),
1340
                Width = screenWidth * 0.4,
1341
                Height = screenHeight * 0.4,
1342
            };
1343
            StyleManager.SetTheme(PanoramaPop, new VisualStudio2013Theme());
1344
            //CheckPop.ShowDialog();
1345
            PanoramaPop.Owner = Application.Current.MainWindow;
1346
            PanoramaPop.Show();
1347
        }
1348

    
1349
        private void CheckEvent(object sender, RoutedEventArgs e)
1350
        {
1351
            //창이 떠있을 경우 재 실행 방지
1352
            if (isClosed)
1353
            {
1354
                //토글 및 마우스 상태 초기화
1355
                var toggleList = this.Parent.ChildrenOfType<RadToggleButton>();
1356
                foreach(var togle in toggleList)
1357
                {
1358
                    togle.IsChecked = false;
1359
                }
1360
                this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
1361

    
1362
                isClosed = false;
1363

    
1364
                
1365
                CheckList check = new CheckList(this.ParentOfType<MainWindow>());
1366

    
1367
                CheckPop = new RadWindow
1368
                {
1369
                    MinWidth = 1200,
1370
                    MinHeight = 500,
1371
                    //Header = "My Check List",
1372
                    Header = "Document No : " + this.ParentOfType<MainWindow>().dzMainMenu._DocItem.DOCUMENT_NO + " / Revision :" + this.ParentOfType<MainWindow>().dzMainMenu._DocItem.REVISION,
1373
                    Content = check,
1374
                    //Owner = this,
1375
                    //ResizeMode = System.Windows.ResizeMode.CanResizeWithGrip,
1376
                    ResizeMode = System.Windows.ResizeMode.NoResize,
1377
                    WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen,
1378
                    IsTopmost = true,
1379
                };
1380
                StyleManager.SetTheme(CheckPop, new Office2013Theme());
1381
                CheckPop.Closed += CheckPop_Closed;
1382
                
1383
                //CheckPop.ShowDialog();
1384
                CheckPop.Show();
1385
            }
1386
        }
1387

    
1388
        private void OptionPop_Closed(object sender, WindowClosedEventArgs e)
1389
        {
1390
            isClosed = true;
1391
            //this.ParentOfType<MainWindow>().dzMainMenu.PN_Navi.IsEnabled = true;
1392
            this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
1393
            ViewerDataModel.Instance.Capture_Opacity = 0;
1394
        }
1395

    
1396
        private void CheckPop_Closed(object sender, WindowClosedEventArgs e)
1397
        {
1398
            isClosed = true;
1399
            //this.ParentOfType<MainWindow>().dzMainMenu.PN_Navi.IsEnabled = true;
1400
            this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
1401
            ViewerDataModel.Instance.Capture_Opacity = 0;
1402
        }
1403

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

    
1443
        private void viewEvent(object sender, RoutedEventArgs e)
1444
        {
1445
            RadRibbonToggleButton viewButton = sender as RadRibbonToggleButton;
1446
            var instanceMain = this.ParentOfType<MainWindow>();
1447

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

    
1450
            //if ((sender as RadRibbonToggleButton) != null)
1451
            //{
1452
            //    Common.ViewerDataModel.Instance.ControlTag = (sender as RadRibbonToggleButton).Tag.ToString();
1453
            //    instanceToggle = (sender as RadRibbonToggleButton);
1454
            //}
1455

    
1456
            //instanceToggle.IsChecked = false;
1457

    
1458
            switch (viewButton.CommandParameter.ToString())
1459
            {
1460
                case "zoomout":
1461
                    {
1462
                        //장원
1463
                        //instanceMain.dzMainMenu.zoomAndPanControl.ZoomTo(new Rect(0, 0, instanceMain.dzMainMenu.zoomAndPanCanvas.ActualWidth, instanceMain.dzMainMenu.zoomAndPanCanvas.ActualHeight));
1464
                        instanceMain.dzMainMenu.zoomAndPanControl.ZoomPointToViewportCenter(ViewerDataModel.Instance.ContentScale -= 0.1, point);
1465
                        viewButton.IsChecked = false;
1466
                        //Common.ViewerDataModel.Instance.zom
1467
                    }
1468
                    break;
1469
                case "zoomin":
1470
                    {
1471
                        instanceMain.dzMainMenu.zoomAndPanControl.ZoomPointToViewportCenter(ViewerDataModel.Instance.ContentScale += 0.1, point);
1472
                        viewButton.IsChecked = false;
1473
                    }
1474
                    break;
1475
                case "fullscreen":
1476
                    {
1477
                        instanceMain.WindowState = WindowState.Maximized;
1478
                        //Sizemode 대기(강인구)
1479
                        //instanceMain.dzMainMenu.imageViewer.SizeMode = Leadtools.Windows.Controls.SizeMode.Fit;
1480
                        instanceMain.dzMainMenu.zoomAndPanControl.ScaleToFit();
1481
                        viewButton.IsChecked = false;
1482
                    }
1483
                    break;
1484
                case "fitWidth":
1485
                    {
1486
                        instanceMain.dzMainMenu.zoomAndPanControl.ScaleToFit();
1487
                        viewButton.IsChecked = false;
1488
                    }
1489
                    break;
1490
                case "fitHeight":
1491
                    {
1492
                        instanceMain.dzMainMenu.zoomAndPanControl.ScaleToFit();
1493
                        viewButton.IsChecked = false;
1494
                    }
1495
                    break;
1496
                case "boundzoom":
1497
                    {
1498

    
1499
                    }
1500
                    break;
1501
                case "Rotate_M":
1502
                    {
1503
                        drawingPannelRotate(false);
1504
                        viewButton.IsChecked = false;
1505
                    }
1506
                    break;
1507
                case "Rotate_P":
1508
                    {
1509
                        drawingPannelRotate(true);
1510
                        viewButton.IsChecked = false;
1511
                    }
1512
                    break;
1513
                case "Rotate_half":
1514
                    {
1515
                        drawingPannelRotate(true);
1516
                        drawingPannelRotate(true);
1517
                        viewButton.IsChecked = false;
1518
                    }
1519
                    break;
1520
            }
1521
        }
1522

    
1523
        private void Control_Event(object sender, RoutedEventArgs e)
1524
        {
1525

    
1526
        }
1527

    
1528
        #region 대기
1529

    
1530
        public void drawingPannelRotate(bool Flag)
1531
        {
1532
            var instanceMain = this.ParentOfType<MainWindow>();
1533

    
1534
            //if (rotateOffSet > 3)
1535
            //    rotateOffSet = 0;
1536

    
1537
            //if (rotateOffSet < 0)
1538
            //    rotateOffSet = 3;
1539

    
1540
            if(Flag)
1541
            {
1542
                if (instanceMain.dzMainMenu.rotate.Angle == 270)
1543
                {
1544
                    instanceMain.dzMainMenu.rotate.Angle = 0;
1545
                }
1546
                else
1547
                {
1548
                    instanceMain.dzMainMenu.rotate.Angle += 90;
1549
                }
1550
            }
1551
            else
1552
            {
1553
                if(instanceMain.dzMainMenu.rotate.Angle == 0)
1554
                {
1555
                    instanceMain.dzMainMenu.rotate.Angle = 270;
1556
                }
1557
                else
1558
                {
1559
                    instanceMain.dzMainMenu.rotate.Angle -= 90;
1560
                }
1561
            }
1562
            //double angle = (double)rotateValue.GetValue(rotateOffSet);
1563
            //instanceMain.dzMainMenu.rotate.Angle = angle;
1564
            var rotationNum = Math.Abs((instanceMain.dzMainMenu.rotate.Angle / 90));
1565

    
1566
            if (instanceMain.dzMainMenu.zoomAndPanCanvas.Width == ViewerDataModel.Instance.ContentWidth)
1567
            {
1568
                double emptySize = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
1569
                instanceMain.dzMainMenu.zoomAndPanCanvas.Width = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
1570
                instanceMain.dzMainMenu.zoomAndPanCanvas.Height = emptySize;
1571
            }
1572
            if (instanceMain.dzMainMenu.rotate.Angle == 0)
1573
            {
1574
                instanceMain.dzMainMenu.translate.X = 0;
1575
                instanceMain.dzMainMenu.translate.Y = 0;
1576
            }
1577
            else if (instanceMain.dzMainMenu.rotate.Angle == 90)
1578
            {
1579
                instanceMain.dzMainMenu.translate.X = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
1580
                instanceMain.dzMainMenu.translate.Y = 0;
1581
            }
1582
            else if (instanceMain.dzMainMenu.rotate.Angle == 180)
1583
            {
1584
                instanceMain.dzMainMenu.translate.X = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
1585
                instanceMain.dzMainMenu.translate.Y = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
1586
            }
1587
            else
1588
            {
1589
                instanceMain.dzMainMenu.translate.X = 0;
1590
                instanceMain.dzMainMenu.translate.Y = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
1591
            }
1592

    
1593
            //instanceMain.dzMainMenu.zoomAndPanControl.RenderTransformOrigin = new Point(0.5, 0.5);
1594
            instanceMain.dzMainMenu.zoomAndPanControl.RotationAngle = instanceMain.dzMainMenu.rotate.Angle;
1595
            //대기(강인구)
1596
            //instanceMain.dzMainMenu.imageViewer.RotateAngle = instanceMain.dzMainMenu.rotate.Angle;
1597

    
1598

    
1599
            //instanceMain.dzMainMenu.imageViewer.RenderTransformOrigin = new Point(0.5, 0.5);
1600
            //RotateTransform rotateTransform = new RotateTransform(instanceMain.dzMainMenu.rotate.Angle);
1601
            //instanceMain.dzMainMenu.imageViewer.RenderTransform = rotateTransform;
1602

    
1603

    
1604
            ViewerDataModel.Instance.ContentWidth = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
1605
            ViewerDataModel.Instance.ContentHeight = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
1606
            ViewerDataModel.Instance.AngleOffsetX = instanceMain.dzMainMenu.translate.X;
1607
            ViewerDataModel.Instance.AngleOffsetY = instanceMain.dzMainMenu.translate.Y;
1608
            ViewerDataModel.Instance.Angle = instanceMain.dzMainMenu.rotate.Angle;
1609
            //ViewerDataModel.Instance.Document_Info.Clear();
1610
            //ViewerDataModel.Instance.Document_Info.Where(i => i.PAGE_NUMBER == instanceMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber).ToList().ForEach(value =>
1611
            //{
1612
            //    value.PAGE_ANGLE = int.Parse(instanceMain.dzMainMenu.rotate.Angle.ToString());
1613
            //});
1614

    
1615

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

    
1621
                instanceMain.dzMainMenu.pageNavigator.ImgListbox.ItemsSource = instanceMain.dzMainMenu.pageNavigator._thumbnailItems;
1622
                var instance = instanceMain.dzMainMenu.CurrentDoc.docInfo.DOCPAGE.Where(p => p.PAGE_NUMBER == instanceMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber).FirstOrDefault();
1623
                instance.PAGE_ANGLE = int.Parse(instanceMain.dzMainMenu.rotate.Angle.ToString());
1624

    
1625
                instanceMain.dzMainMenu.pageNavigator.GotoPage(data.PageNumber);
1626

    
1627
                //rotation page add or update
1628
                var rotationdoc = ViewerDataModel.Instance.RotationDocs.Where(d => d.ID == instance.ID).FirstOrDefault();
1629
                if (rotationdoc != null)
1630
                {
1631
                    rotationdoc.PAGE_ANGLE = instance.PAGE_ANGLE;
1632
                }
1633
                else
1634
                {
1635
                    ViewerDataModel.Instance.RotationDocs.Add(instance);
1636
                }
1637
            });
1638
        }
1639
        #endregion
1640

    
1641
        private void ImageConverter(RadToggleButton instanceToggle)
1642
        {
1643
            try
1644
            {           
1645
                var instanceMain = this.ParentOfType<MainWindow>();
1646
                //http://cloud.devdoftech.co.kr:5977/ImageUpload/FileUpload.asmx
1647

    
1648
                Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
1649
                dlg.Filter = "All files (*.*)|*.*|PNG Images (*.png)|*.png";
1650
                Nullable<bool> result = dlg.ShowDialog();
1651
                if (result == true)
1652
                {
1653
                    instanceMain.dzMainMenu.filename = dlg.FileName;
1654
                    instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ImgControl;
1655

    
1656
                    System.IO.FileInfo fileInfo = new System.IO.FileInfo(instanceMain.dzMainMenu.filename);
1657
                    String strFile = System.IO.Path.GetFileName(instanceMain.dzMainMenu.filename);
1658
                    long numByte = fileInfo.Length;
1659
                    double dLen = Convert.ToDouble(fileInfo.Length / 1000000);
1660
                    kr.co.devdoftech.cloud.FileUpload fileUploader = new kr.co.devdoftech.cloud.FileUpload();
1661

    
1662
                    if (dLen < 4)
1663
                    {
1664
                        System.IO.FileStream fStream = new System.IO.FileStream(instanceMain.dzMainMenu.filename, System.IO.FileMode.Open, System.IO.FileAccess.Read);
1665
                        System.IO.BinaryReader br = new System.IO.BinaryReader(fStream);
1666
                        byte[] data = br.ReadBytes((int)numByte);
1667
                        br.Close();
1668

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

    
1671
                        Check_Uri.UriCheck(filepath);
1672

    
1673
                        instanceMain.dzMainMenu.filename = filepath;
1674

    
1675
                        fStream.Close();
1676
                        fStream.Dispose();
1677
                    }
1678
                    else
1679
                    {
1680
                        this.ParentOfType<MainWindow>().DialogMessage_Alert("Available Memory less than 4 mega byte", "Alert");
1681
                    }
1682
                }
1683
                else
1684
                {
1685
                    instanceToggle.IsChecked = false;
1686
                    Common.ViewerDataModel.Instance.SelectedControl = "";
1687
                    Common.ViewerDataModel.Instance.ControlTag = null;
1688
                    this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
1689
                    this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
1690
                    this.ParentOfType<MainWindow>().DialogMessage_Alert("No Image selected.", "Alert");
1691
                }
1692
            }
1693
            catch(Exception ex)
1694
            {
1695
                instanceToggle.IsChecked = false;
1696
                Common.ViewerDataModel.Instance.SelectedControl = "";
1697
                Common.ViewerDataModel.Instance.ControlTag = null;
1698
                this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
1699
                this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
1700
                this.ParentOfType<MainWindow>().DialogMessage_Alert(""+ ex , "Alert");
1701
            }
1702
        }
1703

    
1704
        private void Control_Init(RadToggleButton instanceToggle, object sender)
1705
        {
1706

    
1707
        }
1708

    
1709
        private void ControlEvent(object sender, RoutedEventArgs e)
1710
        {
1711
            RadToggleButton instanceToggle = sender as RadToggleButton;
1712
            var instanceMain = this.ParentOfType<MainWindow>();
1713

    
1714
            #region Ctrl + A 눌렀을 때 대처 방법 
1715
            //원인 : Ctrl + A를 누르면 UIElementSet에 등록을 시키지 않는다(이유는 한꺼번에 많은 양의 컨트롤의 동작이 유입되기 때문에
1716
            //       시스템의 성능저하를 불러올 수 있기 때문이다. 그래서 선택 후 다른 컨트롤을 누르면 등록되지 않은 컨트롤이기 때문에 삭제된다
1717
            //       이를 대처하는 방법으로 아래 코드를 사용한다.
1718
            if (Common.ViewerDataModel.Instance.MarkupControls.Count == 0 && Common.ViewerDataModel.Instance.MarkupControls.Count >= 1)
1719
            {
1720
                //var lstItem = instanceMain.DeepLayer._SelectLayer.ChildrenOfType<AdornerFinal>().ToList();
1721
                //foreach (var item in lstItem)
1722
                //{
1723
                //    foreach (var member in item.MemberSet)
1724
                //    {
1725
                //        if (!instanceMain.DeepLayer.UIElementSet.Contains(member.DrawingData))
1726
                //        {
1727
                //            instanceMain.DeepLayer.UIElementSet.Add(member.DrawingData);
1728
                //        }
1729
                //    }
1730
                //}
1731
            }
1732
            #endregion
1733

    
1734
            //if (!instanceMain.IsFreeSelectionMode)
1735
            //{
1736
            //    instanceMain.IsSwingMode = true;
1737
            //}
1738

    
1739
            #region 다른 컨트롤 버튼 선택 해제
1740
            System.Reactive.Linq.Observable2.FromPropertyChangedPattern(Common.ViewerDataModel.Instance, temp => temp.SelectedControl).Subscribe(ControlState =>
1741
            {
1742
                if (ControlState == null)
1743
                {
1744
                    instanceToggle.IsChecked = false;
1745
                    HiddenControlHide();
1746
                }
1747
            });
1748
            #endregion
1749

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

    
1752
            if (instanceToggle != null)
1753
            {
1754
                Common.ViewerDataModel.Instance.ControlTag = instanceToggle.Tag.ToString();
1755
            }
1756
            else if ((sender as RadRibbonToggleButton) != null)
1757
            {
1758
                Common.ViewerDataModel.Instance.ControlTag = (sender as RadRibbonToggleButton).Tag.ToString();
1759
                instanceToggle = (sender as RadRibbonToggleButton);
1760
            }
1761
            else if ((sender as RadRibbonButton) != null)
1762
            {
1763
                RadRibbonButton instanceButton = sender as RadRibbonButton;
1764
                Common.ViewerDataModel.Instance.ControlTag = instanceButton.Tag.ToString();
1765
            }
1766
            else
1767
            {
1768
                RadButton instanceButton = sender as RadButton;
1769
                Common.ViewerDataModel.Instance.ControlTag = instanceButton.Tag.ToString();
1770
            }
1771

    
1772

    
1773
            System.Reactive.Linq.Observable2.FromPropertyChangedPattern(Common.ViewerDataModel.Instance, temp => temp.AngleVisibility).Subscribe(isSee =>
1774
            {
1775
                if (instanceToggle.CommandParameter.ToString() == "ChainLine")
1776
                {
1777

    
1778
                }
1779
                else
1780
                {
1781
                    System.Diagnostics.Debug.WriteLine(" instanceMain.dzMainMenu.MainAngle.Visibility   " + isSee);
1782

    
1783
                    if (instanceMain.dzMainMenu.MainAngle.Visibility != isSee)
1784
                    {
1785
                        instanceMain.dzMainMenu.MainAngle.Visibility = isSee;
1786
                    }
1787
                }
1788
                //System.Reactive.Linq.Observable2.FromPropertyChangedPattern(Common.ViewerDataModel.Instance, temp => temp.AngleValue).Subscribe(p =>
1789
                //{
1790
                //    instanceMain.dzMainMenu.MainAngle.AngleValue = p;
1791
                //});
1792
            });
1793
            instanceMain.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Drawing;
1794

    
1795
            instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = false;
1796

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

    
2022
                        //instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = true;
2023

    
2024
                        Common.ViewerDataModel.Instance.SelectedControl = "Ink";
2025
                        Common.ViewerDataModel.Instance.LineSize = (double)cbLineSize.Value;
2026
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.PenControl;
2027
                        break;
2028
                    #endregion
2029
                    #region Select
2030
                    case "Select":
2031
                        if(this.ParentOfType<MainWindow>().dzMainMenu.currentControl != null)
2032
                        {
2033
                            ViewerDataModel.Instance.MarkupControls_USER.Remove(this.ParentOfType<MainWindow>().dzMainMenu.currentControl);
2034
                            this.ParentOfType<MainWindow>().dzMainMenu.currentControl = null;
2035
                        }
2036
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Selecting;
2037
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2038
                        instanceMain.dzMainMenu.isLeftMouseButtonDownOnWindow = false;
2039
                        break;
2040
                    #endregion
2041
                    #region Image
2042
                    case "Image":
2043
                        Common.ViewerDataModel.Instance.SelectedControl = "ImgControl";
2044
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ImgControl;
2045
                        ImageConverter(instanceToggle);
2046
                        break;
2047
                    #endregion
2048
                    #region Sign
2049
                    case "Sign":
2050
                        Common.ViewerDataModel.Instance.SelectedControl = "Sign";
2051
                        Common.ViewerDataModel.Instance.ControlTag = instanceMain.dzMainMenu._ViewInfo.UserID; //사번
2052
                        //강인구 추가
2053
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Sign;
2054
                        //instanceMain.BaseClient.GetUserSignCompleted += (sen, ea) =>
2055
                        //{
2056
                        //    if (ea.Result == null)
2057
                        //    {
2058

    
2059
                        //        this.ParentOfType<MainPage>().DialogMessage_Alert("You Don't Have Sign Data", "Alert");
2060
                        //    }
2061
                        //    else
2062
                        //    {
2063
                        //        byte[] imageBytes = System.Convert.FromBase64String(ea.Result);
2064
                        //        using (MemoryStream ms = new MemoryStream(imageBytes))
2065
                        //        {
2066
                        //            BitmapImage im = new BitmapImage();
2067
                        //            im.SetSource(ms);
2068
                        //            instanceMain.DeepLayer.SignImage = im;
2069
                        //            ms.Close();
2070
                        //        }
2071
                        //    }
2072
                        //};
2073
                        //instanceMain.BaseClient.GetUserSignAsync(instanceMain._ViewInfo.UserID);
2074
                        break;
2075
                    #endregion
2076
                    #region Check
2077
                    case "Check":
2078
                        Common.ViewerDataModel.Instance.SelectedControl = "Check";
2079
                        Common.ViewerDataModel.Instance.ControlTag = instanceMain.dzMainMenu._ViewInfo.UserID; //사번
2080
                        //강인구 추가
2081
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Symbol;
2082
                        break;
2083
                    #endregion
2084
                    #region Batch
2085
                    case "Batch":
2086
                        Common.ViewerDataModel.Instance.SelectedControl = "Batch";
2087
                        Common.ViewerDataModel.Instance.ControlTag = instanceMain.dzMainMenu._ViewInfo.UserID; //사번
2088
                        //강인구 추가
2089
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Mark;
2090
                        instanceMain.dzMainMenu.txtBatch.Visibility = Visibility.Visible;
2091
                        instanceMain.dzMainMenu.txtBatch.Text = "Place Mark";
2092
                        break;
2093
                    #endregion
2094
                    #region Copy
2095
                    case "Copy":
2096
                        Copy_Start();
2097
                        instanceToggle.IsChecked = false;
2098
                        ViewerDataModel.Instance.SelectedControl = "";
2099
                        ViewerDataModel.Instance.ControlTag = null;
2100
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2101
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2102
                        break;
2103
                    #endregion
2104
                    #region Cut
2105
                    case "Cut":
2106
                        //Cut_Start();
2107
                        CutCommand.Instance.Execute();
2108
                        instanceToggle.IsChecked = false;
2109
                        ViewerDataModel.Instance.SelectedControl = "";
2110
                        ViewerDataModel.Instance.ControlTag = null;
2111
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2112
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2113
                        break;
2114
                    #endregion
2115
                    #region Paste
2116
                    case "Paste":
2117
                        Paste_Start();
2118
                        instanceToggle.IsChecked = false;
2119
                        ViewerDataModel.Instance.SelectedControl = "";
2120
                        ViewerDataModel.Instance.ControlTag = null;
2121
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2122
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;                        
2123
                        break;
2124
                    #endregion
2125
                    #region Delete
2126
                    case "Delete":
2127
                        DeleteCommand.Instance.Execute(SelectionSet.Instance.SelectedItems);
2128
                        this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Clear();
2129

    
2130
                        instanceToggle.IsChecked = false;
2131
                        ViewerDataModel.Instance.SelectedControl = "";
2132
                        ViewerDataModel.Instance.ControlTag = null;
2133
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2134
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2135
                        break;
2136
                    #endregion
2137
                    #region Undo
2138
                    case "Undo":
2139
                        UndoCommand.Instance.Execute();
2140
                        instanceToggle.IsChecked = false;
2141
                        ViewerDataModel.Instance.SelectedControl = "";
2142
                        ViewerDataModel.Instance.ControlTag = null;
2143
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2144
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2145
                        break;
2146
                    #endregion
2147
                    #region Redo
2148
                    case "Redo":
2149
                        RedoCommand.Instance.Execute();
2150
                        instanceToggle.IsChecked = false;
2151
                        ViewerDataModel.Instance.SelectedControl = "";
2152
                        ViewerDataModel.Instance.ControlTag = null;
2153
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2154
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2155
                        break;
2156
                    #endregion
2157
                    #region DragZoom
2158
                    case "DragZoom":
2159
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.DragZoom;
2160
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2161
                        instanceMain.dzMainMenu.isLeftMouseButtonDownOnWindow = false;
2162
                        break;
2163
                    #endregion
2164
                    #region Grouping
2165
                    case "Group":
2166
                        //var GrouptoggleList = this.Parent.ChildrenOfType<RadRibbonToggleButton>();
2167
                        //foreach (var togle in GrouptoggleList)
2168
                        //{
2169
                        //    togle.IsChecked = false;
2170
                        //}
2171

    
2172
                        //if (this.ParentOfType<MainWindow>().dzMainMenu.currentControl != null)
2173
                        //{
2174
                        //    ViewerDataModel.Instance.MarkupControls_USER.Remove(this.ParentOfType<MainWindow>().dzMainMenu.currentControl);
2175
                        //    this.ParentOfType<MainWindow>().dzMainMenu.currentControl = null;
2176
                        //}
2177
                        //this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2178
                        //instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2179
                        //instanceMain.dzMainMenu.isLeftMouseButtonDownOnWindow = false;
2180
                        //if (ViewerDataModel.Instance.SystemMain.dzMainMenu.SelectLayer.Children.Count < 1) //선택된 것이 없으면
2181
                        //{
2182
                        //    this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert("Please Select Controls", "Alert");
2183
                        //}
2184
                        //else//if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
2185
                        //{
2186
                        //    // string MarkupData = "";
2187
                        //    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
2188
                        //    {
2189
                        //        if (item.GetType().Name == "AdornerFinal" && (item as AdornerFinal).MemberSet.Count >= 2) // 얘가 2개 이상이여야 그룹가능 버튼도 막을거긴하지만 일단..
2190
                        //        {
2191
                        //            //MARKUP_DATA_GROUP INSERT
2192
                        //            MARKUP_DATA_GROUP mARKUP_DATA_GROUP = new MARKUP_DATA_GROUP
2193
                        //            {
2194
                        //                SYMBOL_ID = null,//InnerItem.Symbol_ID
2195
                        //                STATE = 0,
2196
                        //            };
2197
                        //            long group_id = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.AddMarkupDataGroup(mARKUP_DATA_GROUP, App.ViewInfo.ProjectNO);
2198
                        //            Logger.sendReqLog("AddMarkupDataGroup: ", "", 1);
2199
                        //            if (group_id > 0)
2200
                        //            {
2201
                        //                foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
2202
                        //                {
2203
                        //                    if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
2204
                        //                    {
2205
                        //                        //MARKUP_DATA UPDATE
2206
                        //                        //Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.UpdateMarkupData((InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo).CommentID, group_id, App.ViewInfo.ProjectNO);
2207
                        //                        //Logger.sendReqLog("UpdateMarkupData: ", "", 1);
2208
                        //                        ViewerDataModel.Instance.MyMarkupList.Where(d => d.ID == (InnerItem.DrawingData as CommentUserInfo).CommentID).FirstOrDefault().Group_ID = group_id;
2209
                        //                        ViewerDataModel.Instance.MyMarkupList.Where(d => d.ID == (InnerItem.DrawingData as CommentUserInfo).CommentID).FirstOrDefault().IsUpdate = true;
2210
                        //                    }
2211
                        //                }
2212
                        //            }
2213
                        //        }
2214
                        //    }
2215
                        //}
2216
                        break;
2217
                    case "UnGroup":
2218
                        //var UnGrouptoggleList = this.Parent.ChildrenOfType<RadRibbonToggleButton>();
2219
                        //foreach (var togle in UnGrouptoggleList)
2220
                        //{
2221
                        //    togle.IsChecked = false;
2222
                        //}
2223
                        //if (this.ParentOfType<MainWindow>().dzMainMenu.currentControl != null)
2224
                        //{
2225
                        //    ViewerDataModel.Instance.MarkupControls_USER.Remove(this.ParentOfType<MainWindow>().dzMainMenu.currentControl);
2226
                        //    this.ParentOfType<MainWindow>().dzMainMenu.currentControl = null;
2227
                        //}
2228
                        //this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2229
                        //instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2230
                        //instanceMain.dzMainMenu.isLeftMouseButtonDownOnWindow = false;
2231

    
2232
                        //if (ViewerDataModel.Instance.SystemMain.dzMainMenu.SelectLayer.Children.Count < 1) //선택된 것이 없으면
2233
                        //{
2234
                        //    this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert("Please Select Controls", "Alert");
2235
                        //}
2236
                        //else//if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
2237
                        //{
2238
                        //    // string MarkupData = "";
2239
                        //    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
2240
                        //    {
2241
                        //        if (item.GetType().Name == "AdornerFinal" && (item as AdornerFinal).MemberSet.Count >= 1) // 1개 이상 
2242
                        //        {
2243
                        //            //MARKUP_DATA UPDATE
2244
                        //            foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
2245
                        //            {
2246
                        //                if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
2247
                        //                {
2248
                        //                    long group_id = ViewerDataModel.Instance.MyMarkupList.Where(d => d.ID == (InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo).CommentID).FirstOrDefault().Group_ID;
2249
                        //                    //MARKUP_DATA UPDATE
2250
                        //                    //Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.UpdateMarkupData((InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo).CommentID, 0, App.ViewInfo.ProjectNO);
2251
                        //                    //Logger.sendReqLog("UpdateMarkupData: ", "", 1);
2252
                        //                    ViewerDataModel.Instance.MyMarkupList.Where(d => d.ID == (InnerItem.DrawingData as CommentUserInfo).CommentID).FirstOrDefault().Group_ID = 0;
2253
                        //                    ViewerDataModel.Instance.MyMarkupList.Where(d => d.ID == (InnerItem.DrawingData as CommentUserInfo).CommentID).FirstOrDefault().IsUpdate = true;
2254

    
2255

    
2256
                        //                    //MARKUP_DATA_GROUP UPDATE
2257
                        //                    //bool value = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.UpdateMarkupDataGroup(group_id, App.ViewInfo.ProjectNO);
2258
                        //                    //Logger.sendReqLog("AddMarkupDataGroup: ", value.ToString(), 1);
2259
                        //                }
2260
                        //            }
2261
                        //        }
2262
                        //    }
2263
                        //}
2264
                        break;
2265
                    #endregion
2266
                    #region Capture
2267
                    case "Capture":
2268
                        SyncInit();
2269
                        //   instanceToggle.IsChecked = false;
2270
                        var CaptureList = this.Parent.ChildrenOfType<RadRibbonToggleButton>();
2271
                        foreach (var togle in CaptureList)
2272
                        {
2273
                            togle.IsChecked = false;
2274
                        }
2275

    
2276
                        if (this.ParentOfType<MainWindow>().dzMainMenu.currentControl != null)
2277
                        {
2278
                            ViewerDataModel.Instance.MarkupControls_USER.Remove(this.ParentOfType<MainWindow>().dzMainMenu.currentControl);
2279
                            this.ParentOfType<MainWindow>().dzMainMenu.currentControl = null;
2280
                        }
2281

    
2282
                        ViewerDataModel.Instance.SelectedControl = "ImgControl";
2283
                   //     ViewerDataModel.Instance.ControlTag = null;
2284
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ImgControl;
2285

    
2286
                        /*
2287
                        //캡쳐 하기 전에 코멘트 저장
2288
                        if (Common.ViewerDataModel.Instance.MarkupControls_USER.Count > 0 || (Application.Current.MainWindow as MainWindow).dzMainMenu.SelectLayer.Children.Count > 0)
2289
                        {
2290
                            var menu = (Application.Current.MainWindow as MainWindow).dzMainMenu;
2291
                            menu.ReleaseAdorner();
2292
                            if (menu.PreviewUserMarkupInfoItem != null && menu.PreviewUserMarkupInfoItem.IsPreviewUser == true)
2293
                            {
2294
                                (Application.Current.MainWindow as MainWindow).dzTopMenu.RefactoryCommentReact(menu);
2295
                            }
2296
                            else if (menu.gridViewMarkup.SelectedItems.Count == 0 || (menu.gridViewMarkup.SelectedItems.FirstOrDefault() as IKCOM.MarkupInfoItem).UserID != App.ViewInfo.UserID)
2297
                            {
2298

    
2299
                            }
2300
                            else
2301
                            {
2302
                                (Application.Current.MainWindow as MainWindow).dzTopMenu.RefactoryCommentReact(menu);
2303
                            }
2304
                        }*/
2305

    
2306
                        //Common.ViewerDataModel.Instance.CheckList_ID = ((e.Source as Telerik.Windows.Controls.RadButton).DataContext as Customer).ID;
2307
                        //Common.ViewerDataModel.Instance.CheckList_ID = ((e.Source as Image).DataContext as Customer).ID;
2308
                        //Common.ViewerDataModel.Instance.PageNumber = ((e.Source as Image).DataContext as Customer).PAGENUMBER;
2309
                        Application.Current.MainWindow.Focus();
2310
                        Common.ViewerDataModel.Instance.Capture_Opacity = 0.49;
2311
                        (Application.Current.MainWindow as MainWindow).dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Capture;
2312
                        break;
2313
                    #endregion
2314
                    #region Cad
2315
                    case "Inside":
2316
                        //instanceMain.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Drawing;
2317
                        //instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = false;
2318
                        Common.ViewerDataModel.Instance.SelectedControl = "InsideWhite";
2319
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.InsideWhite;
2320
                        break;
2321
                    case "Overlap":
2322
                        //instanceMain.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Drawing;
2323
                        //instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = false;
2324
                        Common.ViewerDataModel.Instance.SelectedControl = "OverlapWhite";
2325
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.OverlapWhite;
2326
                        break;
2327
                    case "Clip":
2328
                        //instanceMain.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Drawing;
2329
                        //instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = false;
2330
                        Common.ViewerDataModel.Instance.SelectedControl = "ClipWhite";
2331
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ClipWhite;
2332
                        break;
2333
                    case "CadExport":
2334
                        //if (isClosed)
2335
                        //{
2336
                        //    //토글 및 마우스 상태 초기화
2337
                        //    var toggleList = this.Parent.ChildrenOfType<RadRibbonToggleButton>();
2338
                        //    foreach (var togle in toggleList)
2339
                        //    {
2340
                        //        togle.IsChecked = false;
2341
                        //    }
2342
                        //    this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2343

    
2344
                        //    isClosed = false;
2345
                        //    //Control 파일 먼저 생성
2346
                        //    CollapsedButton_Click();
2347
                        //    CadViewer check = new CadViewer();
2348
                        //    check.WindowStartupLocation = WindowStartupLocation.CenterScreen;
2349
                        //    check.Title = "Export Viewer";
2350
                        //    //check.Topmost = true;
2351
                        //    check.Show();
2352
                        //    check.Closed += Check_Closed;
2353
                        //    instanceToggle.IsChecked = false;
2354
                        //}
2355
                        //break;
2356
                    case "CadViewer":
2357
                        //if (isClosed)
2358
                        //{
2359
                        //    //토글 및 마우스 상태 초기화
2360
                        //    var toggleList = this.Parent.ChildrenOfType<RadRibbonToggleButton>();
2361
                        //    foreach (var togle in toggleList)
2362
                        //    {
2363
                        //        togle.IsChecked = false;
2364
                        //    }
2365
                        //    this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2366

    
2367
                        //    isClosed = false;
2368
                        //    CadResultViewer check = new CadResultViewer();
2369
                        //    check.WindowStartupLocation = WindowStartupLocation.CenterScreen;
2370
                        //    check.Title = "Viewer";
2371
                        //    check.Show();
2372

    
2373
                        //    check.Closed += Check_Closed;
2374

    
2375
                        //}
2376
                        break;
2377
                    #endregion
2378
                    default:
2379
                        break;
2380
                }
2381
                #endregion
2382
            }
2383
            else
2384
            {
2385

    
2386
                if (!instanceMain.dzMainMenu.IsFreeSelectionMode)
2387
                {
2388
                    instanceMain.dzMainMenu.IsSwingMode = false;
2389
                    Common.ViewerDataModel.Instance.SelectedControl = "";
2390
                    Common.ViewerDataModel.Instance.ControlTag = null;
2391
                    this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2392
                    this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2393
                }
2394
            }
2395
        }
2396

    
2397
        private void SyncInit()
2398
        {
2399
            try
2400
            {
2401
                if (!ViewerDataModel.Instance.SystemMain.dzMainMenu.testPanel2.IsHidden)
2402
                {
2403
                    ViewerDataModel.Instance.SystemMain.dzMainMenu.testPanel2.IsHidden = true;
2404
                    ViewerDataModel.Instance.PageBalanceMode = false;
2405
                    ViewerDataModel.Instance.PageBalanceNumber = 0;
2406
                    ViewerDataModel.Instance.PageNumber = 0;
2407
                    ViewerDataModel.Instance.MarkupControls_Sync.Clear();
2408
                    ViewerDataModel.Instance.SystemMain.dzMainMenu.gridViewRevMarkup.Visibility = Visibility.Collapsed;
2409
                    ViewerDataModel.Instance.SystemMain.dzMainMenu.UserList.IsChecked = false;
2410
                    ViewerDataModel.Instance.SystemMain.dzMainMenu.BalanceMode.IsChecked = false;
2411
                }
2412
            }
2413
            catch (Exception ex)
2414
            {
2415
                Logger.sendResLog("SyncInit", ex.Message, 0);
2416
            }
2417

    
2418
        }
2419

    
2420
        Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
2421
        CommentUserInfo currentControl { get; set; }
2422
        private void Check_Closed(object sender, EventArgs e)
2423
        {
2424
            isClosed = true;
2425
            //this.ParentOfType<MainWindow>().dzMainMenu.PN_Navi.IsEnabled = true;
2426
            //토글 및 마우스 상태 초기화
2427
            var toggleList = this.Parent.ChildrenOfType<RadToggleButton>();
2428
            foreach (var togle in toggleList)
2429
            {
2430
                togle.IsChecked = false;
2431
            }
2432
            this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2433
            ViewerDataModel.Instance.Capture_Opacity = 0;
2434

    
2435
        }
2436

    
2437
        /* public class test 
2438
         {
2439
             public double width { get; set; }
2440
             public double height { get; set; }
2441
         }
2442
         */
2443
        private void CollapsedButton_Click()
2444
        {
2445
            this.ParentOfType<MainWindow>().dzTopMenu._SaveEvent(null, null); // 저장하지 못한 데이터가 있다면 저장
2446

    
2447
            string[] data = new string[0];
2448

    
2449
            int cnt = 0;
2450
            var menu = this.ParentOfType<MainWindow>().dzMainMenu;
2451

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

    
2454
            foreach (var item in gridSelectionItem)
2455
            {
2456
                if ((item.UserID == App.ViewInfo.UserID) && (ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.CurrentPage != null))
2457
                {
2458
                    var instance = ViewerDataModel.Instance.MyMarkupList.Where(d => d.PageNumber == ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber &&
2459
                    d.MarkupInfoID == item.MarkupInfoID).ToList();
2460
                    data = new string[instance.Count];
2461
                    foreach (var markup in instance)
2462
                    {
2463
                        data[cnt++] = MarkupToPDF.Serialize.Core.JsonSerializerHelper.UnCompressString(markup.Data);
2464
                    }
2465
                }
2466
            }
2467

    
2468
            if (data != null && KCOM.Properties.Settings.Default.cad == 1)
2469
            {
2470
                string FilePath = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\Cad");
2471
                string FileName = FilePath + "\\commentstring.json"; // Default file name
2472
                if (!File.Exists(FilePath))
2473
                {
2474
                    Directory.CreateDirectory(FilePath);
2475
                }
2476

    
2477
                if (!string.IsNullOrEmpty(FileName))
2478
                {
2479
                    //  File.WriteAllText(SaveDig.FileName, data);
2480
                    File.WriteAllLines(FileName, data);
2481
                }
2482
            }
2483
        }
2484

    
2485
        private double minHeight;
2486
        private double minWidth;
2487

    
2488
        private double maxHeight;
2489
        private double maxWidth;
2490

    
2491
        public bool CanVResize { get; private set; }
2492
        public bool CanHResize { get; private set; }
2493

    
2494
        public void DesignerComponent(FrameworkElement content)
2495
        {
2496
            this.InitializeComponent();
2497

    
2498
            if (!double.IsNaN(content.Width))
2499
            {
2500
                CanHResize = false;
2501
                this.Width = content.Width;
2502
            }
2503
            else
2504
            {
2505
                CanHResize = true;
2506
                this.Width = 23.0;
2507
            }
2508
            if (!double.IsNaN(content.Height))
2509
            {
2510
                CanVResize = false;
2511
                this.Height = content.Height; ;
2512
            }
2513
            else
2514
            {
2515
                CanVResize = true;
2516
                this.Height = 23.0;
2517
            }
2518

    
2519
            minWidth = content.MinWidth < 10.0 ? 10.0 : content.MinWidth;
2520
            minHeight = content.MinHeight < 10.0 ? 10.0 : content.MinHeight;
2521
            maxWidth = content.MaxWidth;
2522
            maxHeight = content.MaxHeight;
2523

    
2524
            double top = (double)content.GetValue(Canvas.TopProperty);
2525
            if (double.IsNaN(top))
2526
                top = 0.0;
2527
            double left = (double)content.GetValue(Canvas.LeftProperty);
2528
            if (double.IsNaN(left))
2529
                left = 0.0;
2530
            SetValue(Canvas.TopProperty, top);
2531
            SetValue(Canvas.LeftProperty, left);
2532

    
2533
            //Set the actual content. Note that "Content" property is a new property. See below
2534
            this.Content = content;
2535
        }
2536
        private void Thumb_DragDelta(object sender, DragDeltaEventArgs e)
2537
        {
2538
            string name = ((Thumb)sender).Name;
2539
            if (name.Contains("Top"))
2540
            {
2541
                double newHeight = this.Height - e.VerticalChange;
2542
                if (newHeight >= minHeight && newHeight <= maxHeight)
2543
                {
2544
                    this.Height = newHeight;
2545
                    SetValue(Canvas.TopProperty,
2546
                (double)GetValue(Canvas.TopProperty) + e.VerticalChange);
2547
                }
2548
            }
2549
            if (name.Contains("Right"))
2550
            {
2551
                double newWidth = this.Width + e.HorizontalChange;
2552
                if (newWidth >= minWidth && newWidth <= maxWidth)
2553
                    this.Width = newWidth;
2554
            }
2555
            if (name.Contains("Bottom"))
2556
            {
2557
                double newHeight = this.Height + e.VerticalChange;
2558
                if (newHeight >= minHeight && newHeight <= maxHeight)
2559
                    this.Height = newHeight;
2560
            }
2561
            if (name.Contains("Left"))
2562
            {
2563
                double newWidth = this.Width - e.HorizontalChange;
2564
                if (newWidth >= minWidth && newWidth <= maxWidth)
2565
                {
2566
                    this.Width = newWidth;
2567
                    SetValue(Canvas.LeftProperty,
2568
                (double)GetValue(Canvas.LeftProperty) + e.HorizontalChange);
2569
                }
2570
            }
2571
        }
2572

    
2573
        private void drawControlBorder(object sender)
2574
        {
2575
            System.Windows.Controls.Control control = (System.Windows.Controls.Control)sender;
2576
        }
2577

    
2578
        private void ResizeThumb_DragDelta(object sender, MouseButtonEventArgs e)
2579
        {
2580
            System.Windows.Controls.Control designerItem = (System.Windows.Controls.Control)sender;
2581
            if (designerItem != null)
2582
            {
2583
                double deltaVertical, deltaHorizontal;
2584

    
2585
                switch (VerticalAlignment)
2586
                {
2587
                    case VerticalAlignment.Bottom:
2588
                        deltaVertical = designerItem.ActualHeight - designerItem.MinHeight;
2589
                        designerItem.Height -= deltaVertical;
2590
                        break;
2591
                    case VerticalAlignment.Top:
2592
                        deltaVertical = designerItem.ActualHeight - designerItem.MinHeight;
2593
                        Canvas.SetTop(designerItem, Canvas.GetTop(designerItem) + deltaVertical);
2594
                        designerItem.Height -= deltaVertical;
2595
                        break;
2596
                    default:
2597
                        break;
2598
                }
2599

    
2600
                switch (HorizontalAlignment)
2601
                {
2602
                    case HorizontalAlignment.Left:
2603
                        deltaHorizontal = designerItem.ActualWidth - designerItem.MinWidth;
2604
                        Canvas.SetLeft(designerItem, Canvas.GetLeft(designerItem) + deltaHorizontal);
2605
                        designerItem.Width -= deltaHorizontal;
2606
                        break;
2607
                    case HorizontalAlignment.Right:
2608
                        deltaHorizontal = designerItem.ActualWidth - designerItem.MinWidth;
2609
                        designerItem.Width -= deltaHorizontal;
2610
                        break;
2611
                    default:
2612
                        break;
2613
                }
2614
            }
2615
            e.Handled = true;
2616
        }
2617

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

    
2620
        void ExportMethod()
2621
        {
2622
            //FileDialogFilter filterImage = new FileDialogFilter("Image Files", "*.jpg", "*.png");
2623
            SaveDig.Filter = "PDF file format|*.pdf";
2624
            SaveDig.Title = "Save an DWG File";
2625
            SaveDig.ShowDialog();
2626
        }
2627

    
2628
        private void cbAutoSave_Checked(object sender, RoutedEventArgs e)
2629
        {            
2630
            if (cbAutoSave.IsChecked == true)
2631
            {
2632
                SaveTime(true, (int)cbSaveInterval.Value);
2633
            }
2634
            else
2635
            {
2636
                SaveTime(false, (int)cbSaveInterval.Value);
2637
            }
2638
        }
2639
        private void cbSaveInterval_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
2640
        {
2641
            if(string.IsNullOrEmpty(cbSaveInterval.Value.ToString()))
2642
            {
2643
                cbSaveInterval.Value = cbSaveInterval.Minimum;
2644
            }
2645
            if (cbAutoSave.IsChecked == true)
2646
            {
2647
                SaveTime(true, (int)cbSaveInterval.Value);
2648
            }
2649

    
2650
            KCOM.Properties.Settings.Default.SaveInterval = (double)cbSaveInterval.Value;
2651
            Properties.Settings.Default.Save();
2652
        }
2653
        //강인구 자동 저장 추가
2654
        private void AutoSave(object sender, RoutedEventArgs e)
2655
        {
2656
            RadToggleButton instanceToggle = sender as RadToggleButton;
2657

    
2658
            if(instanceToggle.IsChecked == true)
2659
            {
2660
                SaveTime(true);
2661
            }
2662
            else
2663
            {
2664
                SaveTime(false);
2665
            }
2666
        }
2667

    
2668
        public void Copy_Start()
2669
        {
2670
            if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
2671
            {
2672
                string MarkupData = "";
2673

    
2674
                foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
2675
                {
2676
                    if (item.GetType().Name == "AdornerFinal")
2677
                    {
2678
                        foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
2679

    
2680
                        {
2681
                            if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
2682
                            {
2683
                                MarkupToPDF.Controls.Parsing.MarkupParser.MarkupReturn res = MarkupParser.MarkupToString(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo, App.ViewInfo.UserID);
2684
                                MarkupData += "|OR|" + res.ConvertData;
2685
                            }
2686
                        }
2687
                        Clipboard.SetText(MarkupData);
2688
                    }
2689
                }
2690
            }
2691
        }
2692

    
2693
        public void Cut_Start()
2694
        {
2695
            if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
2696
            {
2697
                foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
2698
                {
2699
                    string MarkupData = "";
2700

    
2701
                    if (item.GetType().Name == "AdornerFinal")
2702
                    {
2703
                        foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
2704
                        {
2705
                            if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
2706
                            {
2707
                                MarkupToPDF.Controls.Parsing.MarkupParser.MarkupReturn res = MarkupParser.MarkupToString(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo, App.ViewInfo.UserID);
2708
                                MarkupData += "|OR|" + res.ConvertData;
2709
                            }
2710
                        }
2711
                        //클립보드에 넣음
2712
                        Clipboard.SetText(MarkupData);
2713
                    }
2714
                }
2715
                this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Clear();
2716
            }
2717
        }
2718

    
2719
        public void Paste_Start()
2720
        {
2721
            //마크업 붙여넣기
2722
            if (Clipboard.GetText().Contains("|OR||DZ|"))
2723
            {
2724
                List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>();
2725

    
2726
                string[] delimiterChars = { "|OR|" };
2727
                string[] data = Clipboard.GetText().Split(delimiterChars, StringSplitOptions.RemoveEmptyEntries);
2728

    
2729
                SelectionSet.Instance.UnSelect(this.ParentOfType<MainWindow>().dzMainMenu);
2730

    
2731
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
2732

    
2733
                //강인구 Undo/Redo 보류
2734
                MarkupToPDF.Common.Undo_data UndoData = new Undo_data()
2735
                {
2736
                    IsUndo = false,
2737
                    Event = Event_Type.Create,
2738
                    EventTime = DateTime.Now,
2739
                    Markup_List = new List<Multi_Undo_data>()
2740
                };
2741

    
2742
                ViewerDataModel.Instance.UndoDataList.Where(data1 => data1.IsUndo == true).ToList().ForEach(i =>
2743
                {
2744
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
2745
                });
2746

    
2747
                foreach (string parse in data)
2748
                {
2749
                    if (parse != "")
2750
                    {
2751
                        System.Windows.Controls.Control item = MarkupParser.ParseEx(App.ViewInfo.ProjectNO, parse, ViewerDataModel.Instance.MarkupControls_USER, string.Empty, string.Empty);
2752
                        (item as MarkupToPDF.Common.CommentUserInfo).CommentID = Commons.shortGuid();
2753

    
2754
                        ViewerDataModel.Instance.MarkupControls.Remove(item as MarkupToPDF.Common.CommentUserInfo);
2755
                        ViewerDataModel.Instance.MarkupControls_USER.Remove(item as MarkupToPDF.Common.CommentUserInfo);
2756

    
2757
                        adornerSet.Add(item as MarkupToPDF.Common.CommentUserInfo);
2758

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

    
2761
                        UndoData.Markup_List.Add(multi_Undo_Data);
2762
                        ViewerDataModel.Instance.UndoDataList.Add(UndoData);                        
2763
                    }
2764
                }
2765
                Controls.AdornerFinal final = new Controls.AdornerFinal(adornerSet);
2766

    
2767
                if(this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.X < 0)
2768
                {
2769
                    Canvas.SetLeft(final, 0);
2770
                    Canvas.SetTop(final, 0);
2771
                }
2772
                else
2773
                {
2774
                    double realPointX = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.X - final.BorderSize.X - (final.BorderSize.Width / 2);
2775
                    double realPointY = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.Y - final.BorderSize.Y - (final.BorderSize.Height / 2);
2776
                    final.TranslateItems(realPointX, realPointY);
2777

    
2778
                    if (final.Members.Where(type => type.Drawingtype == MarkupToPDF.Controls.Common.ControlType.TextControl).FirstOrDefault() != null)
2779
                    {
2780
                        final.TranslateItems(0.001, 0.001); //dummy
2781
                    }
2782
                }
2783

    
2784
                this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Add(final);
2785
            }
2786
            //외부 이미지 붙여넣기
2787
            else if (Clipboard.GetImage() != null)
2788
            {
2789
                try
2790
                {
2791
                    Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
2792

    
2793
                    //강인구 Undo/Redo 보류
2794
                    MarkupToPDF.Common.Undo_data UndoData = new Undo_data()
2795
                    {
2796
                        IsUndo = false,
2797
                        Event = Event_Type.Create,
2798
                        EventTime = DateTime.Now,
2799
                        Markup_List = new List<Multi_Undo_data>()
2800
                    };
2801

    
2802

    
2803
                    string temppath = System.IO.Path.GetTempPath();
2804
                    //string filename = KCOM.Events.Save.shortCommentKey();
2805
                    string filename = Commons.shortFileKey();
2806

    
2807
                    System.Drawing.Image clipboardImage = System.Windows.Forms.Clipboard.GetImage();
2808
                    clipboardImage.Save(temppath + "\\" + filename);
2809

    
2810
                    System.IO.FileInfo fileInfo = new System.IO.FileInfo(temppath + "\\" + filename);
2811
                    String strFile = System.IO.Path.GetFileName(fileInfo.FullName);
2812
                    long numByte = fileInfo.Length;
2813
                    double dLen = Convert.ToDouble(fileInfo.Length / 1000000);
2814
                    kr.co.devdoftech.cloud.FileUpload fileUploader = new kr.co.devdoftech.cloud.FileUpload();
2815

    
2816
                    if (dLen < 4)
2817
                    {
2818
                        System.IO.FileStream fStream = new System.IO.FileStream(fileInfo.FullName,
2819
                        System.IO.FileMode.Open, System.IO.FileAccess.Read);
2820
                        System.IO.BinaryReader br = new System.IO.BinaryReader(fStream);
2821
                        byte[] data = br.ReadBytes((int)numByte);
2822

    
2823
                        filename = fileUploader.Run(App.ViewInfo.ProjectNO, this.ParentOfType<MainWindow>().dzMainMenu._DocItem.DOCUMENT_NO, App.ViewInfo.UserID, strFile + ".png", data);
2824
                        Check_Uri.UriCheck(filename);
2825
                        br.Close();
2826
                        fStream.Close();
2827
                        fStream.Dispose();
2828
                    }
2829
                    else
2830
                    {
2831
                        this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert("Available Memory less than 4 mega byte", "Alert");
2832
                        return;
2833
                    }
2834

    
2835
                    fileInfo.Delete();
2836

    
2837
                    System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(clipboardImage);
2838
                    IntPtr hBitmap = bmp.GetHbitmap();
2839
                    System.Windows.Media.ImageSource WpfBitmap = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(hBitmap, IntPtr.Zero, Int32Rect.Empty, System.Windows.Media.Imaging.BitmapSizeOptions.FromEmptyOptions());
2840
                    Image img = new Image();
2841
                    if (filename.Contains(".svg"))
2842
                    {
2843
                        byte[] imageData = null;
2844
                        DrawingImage image = null;
2845
                        using (System.Net.WebClient web = new System.Net.WebClient())
2846
                        {
2847
                            imageData = web.DownloadData(new Uri(filename));
2848
                            System.IO.Stream stream = new System.IO.MemoryStream(imageData);
2849
                            image = SvgReader.Load(stream);
2850
                        }
2851
                        img.Source = image;
2852
                    }
2853
                    else
2854
                    {
2855
                        img.Source = new BitmapImage(new Uri(filename));
2856
                    }
2857

    
2858
                    var currentControl = new MarkupToPDF.Controls.Etc.ImgControl
2859
                    {
2860
                        PointSet = new List<Point>(),
2861
                        FilePath = filename,
2862
                        ImageData = img.Source,
2863
                        StartPoint = new Point(100, 100),
2864
                        EndPoint = new Point(200, 200),
2865
                        TopRightPoint = new Point(100, 200),
2866
                        LeftBottomPoint = new Point(200, 100)
2867
                    };
2868

    
2869
                    currentControl.TopRightPoint = new Point(currentControl.StartPoint.X + clipboardImage.Width, currentControl.StartPoint.Y);
2870
                    currentControl.LeftBottomPoint = new Point(currentControl.StartPoint.X, currentControl.StartPoint.Y + clipboardImage.Height);
2871
                    currentControl.EndPoint = new Point(currentControl.StartPoint.X + clipboardImage.Width, currentControl.StartPoint.Y + clipboardImage.Height);
2872

    
2873
                    currentControl.PointSet = new List<Point>
2874
                                        {
2875
                                            currentControl.StartPoint,
2876
                                            currentControl.LeftBottomPoint,
2877
                                            currentControl.EndPoint,
2878
                                            currentControl.TopRightPoint,
2879
                                        };
2880

    
2881
                    multi_Undo_Data = this.ParentOfType<MainWindow>().dzMainMenu.Control_Style(currentControl as MarkupToPDF.Common.CommentUserInfo);
2882
                    UndoData.Markup_List.Add(multi_Undo_Data);
2883
                    ViewerDataModel.Instance.UndoDataList.Add(UndoData);
2884

    
2885
                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl as MarkupToPDF.Common.CommentUserInfo);
2886
                    currentControl.CommentID = Commons.shortGuid();
2887

    
2888
                    currentControl.ApplyTemplate();
2889
                    currentControl.SetImage();
2890

    
2891
                    ViewerDataModel.Instance.MarkupControls_USER.Remove(currentControl as MarkupToPDF.Common.CommentUserInfo);
2892
                    Controls.AdornerFinal final = new Controls.AdornerFinal(currentControl as MarkupToPDF.Common.CommentUserInfo);
2893
                    this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Add(final);
2894

    
2895
                    double realPointX = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.X - final.BorderSize.X - (final.BorderSize.Width / 2);
2896
                    double realPointY = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.Y - final.BorderSize.Y - (final.BorderSize.Height / 2);
2897
                    final.TranslateItems(realPointX, realPointY);
2898
                }
2899
                catch(Exception ex)
2900
                {
2901
                    this.ParentOfType<MainWindow>().DialogMessage_Alert("" + ex, "Alert");
2902
                }
2903
            }
2904
        }
2905
    }
2906
}
클립보드 이미지 추가 (최대 크기: 500 MB)