프로젝트

일반

사용자정보

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

markus / KCOM / Events / Implementation / TopMenuEvent.cs @ 3908a575

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

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

    
27
namespace KCOM.Views
28
{
29
    public partial class TopMenu : UserControl
30
    {
31
        public int rotateOffSet = 0;
32
        private double[] rotateValue = { 0, 90, 180, 270 };
33
        public System.Windows.Threading.DispatcherTimer SaveTimer { get; set; }
34
        public bool isClosed = true;
35
        public RadWindow CheckPop;
36
        public RadWindow OptionPop;
37
        public MarkupToPDF.Common.Undo_data UndoData;
38
        MarkupToPDF.Controls.Parsing.MarkupParser.MarkupReturn markupReturn = new MarkupToPDF.Controls.Parsing.MarkupParser.MarkupReturn();
39

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

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

    
66
        private void CheckShapeState()
67
        {
68

    
69

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

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

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

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

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

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

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

    
124
            }
125

    
126
        }
127

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

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

    
152
        }
153

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

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

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

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

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

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

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

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

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

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

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

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

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

    
338
                if (ViewerDataModel.Instance.UndoDataList.Count == 0) return;
339

    
340
                if (menu.PreviewUserMarkupInfoItem != null && menu.PreviewUserMarkupInfoItem.IsPreviewUser == true)
341
                {
342
                    this.ExecuteSaveCommand(menu);
343
                }
344
                else if (menu.gridViewMarkup.SelectedItems.Count == 0 && menu.gridViewMarkup.Items.Count > 0)
345
                {
346
                    this.ParentOfType<MainWindow>().DialogMessage_Alert("Please Select Your Comment List Item", "Alert");
347
                }
348
                else
349
                {                    
350
                    foreach (var item in menu.gridViewMarkup.SelectedItems)
351
                    {
352
                        if ((item as IKCOM.MarkupInfoItem).UserID == App.ViewInfo.UserID)
353
                        {
354
                            this.ExecuteSaveCommand(menu);
355
                            ViewerDataModel.Instance._markupInfoList.Where(data => data.MarkupInfoID == (item as IKCOM.MarkupInfoItem).MarkupInfoID).FirstOrDefault().UpdateTime = DateTime.Now;
356
                            if (!ViewerDataModel.Instance.IsConsolidate && (sender != null))
357
                            {
358
                                if (ViewerDataModel.Instance.IsPressCtrl)
359
                                {
360
                                    ViewerDataModel.Instance.IsPressCtrl = false;
361
                                }
362
                                this.ParentOfType<MainWindow>().DialogMessage_Alert("Save 가 완료되었습니다.", "Alert");
363
                            }
364
                        }
365
                    }
366
                }
367

    
368
                if (sender != null)
369
                {
370
                    if (ViewerDataModel.Instance.IsPressCtrl) ViewerDataModel.Instance.IsPressCtrl = false;
371
                    this.ParentOfType<MainWindow>().DialogMessage_Alert("Save 가 완료되었습니다.", "Alert");
372
                }
373

    
374
                ViewerDataModel.Instance.UndoDataList.Clear();
375
            }
376
            catch (Exception ex)
377
            {
378
               
379
            }
380
            finally
381
            {
382
                /*
383
                /// delete markup information when 코멘트가 없을 경우
384
                if (ViewerDataModel.Instance.MyMarkupList.Count == 0)
385
                {
386
                    foreach (var item in menu.gridViewMarkup.SelectedItems)
387
                    {
388
                        if ((item as IKCOM.MarkupInfoItem).UserID == App.ViewInfo.UserID)
389
                        {
390
                            //this.ParentOfType<MainWindow>().dzMainMenu.DeleteItem((item as IKCOM.MarkupInfoItem));
391
                        }
392
                    }
393
                }
394
                */
395
            }
396
        }
397

    
398
        /// <summary>
399
        /// call save command
400
        /// </summary>
401
        /// <param name="menu"></param>
402
		private void ExecuteSaveCommand(MainMenu menu)
403
        {
404
            SaveCommand.Instance.Project_No = App.ViewInfo.ProjectNO;
405
            SaveCommand.Instance.document_id = App.ViewInfo.DocumentItemID;
406
            SaveCommand.Instance.user_id = App.ViewInfo.UserID;
407
            SaveCommand.Instance.page_no = Convert.ToInt32(tlcurrentPage.Text);
408

    
409
            try
410
            {
411
                this.ParentOfType<MainWindow>().dzMainMenu.ConvertInkControlToPolygon();
412

    
413
                List<IKCOM.MarkupInfoItem> SelectedMarkupInfos = new List<IKCOM.MarkupInfoItem>();
414
                foreach (var item in menu.gridViewMarkup.SelectedItems)
415
                {
416
                    if ((item as IKCOM.MarkupInfoItem).UserID == App.ViewInfo.UserID)
417
                    {
418
                        SelectedMarkupInfos.Add(item as IKCOM.MarkupInfoItem);
419
                    }
420
                }
421

    
422
                
423
                SaveCommand.Instance.Execute(SelectedMarkupInfos, SaveCommand.Instance.page_no);
424
                SaveCommand.Instance.PageAngleSave(App.ViewInfo.ProjectNO, ViewerDataModel.Instance.RotationDocs);
425
            }
426
            catch (Exception ex)
427
            {
428
                this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert(string.Format("세이브 실패:{0}", ex.Message), "Alert");
429
                throw ex;
430
            }
431
        }
432

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

    
451
                }
452
                else
453
                {
454
                    this.SaveEventCallback(null, null);
455
                }
456
            }
457

    
458
            bool isprint = false;
459
            if (Type == "Print")
460
            {
461
                isprint = true;
462
            }
463

    
464
            RadWindow PrintWindow = new RadWindow();
465
            //IKCOM.MarkupInfoItem _result = null;
466
            PrintWindow.Width = 850;
467
            PrintWindow.Height = 600;
468
            //PrintWindow.Width = 650;
469
            //PrintWindow.Height = 550;
470
            PrintWindow.Header = Type;
471

    
472
            List<IKCOM.MarkupInfoItem> markupinfo = new List<IKCOM.MarkupInfoItem>();
473

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

    
477
            if (markupinfo.Count() > 0)
478
            {
479
                Logger.sendResLog("GetPrintDocItemList", "TRUE", 1);
480
            }
481
            else
482
            {
483
                Logger.sendResLog("GetPrintDocItemList", "FALSE", 1);
484
            }
485

    
486
            var Tile_Url = string.Format(@"{0}/TileSource/{1}_Tile/{2}/{3}/",
487
                App.SystemInfo.HostName,
488
                App.ViewInfo.ProjectNO,
489
                (Convert.ToInt64(App.ViewInfo.DocumentItemID) / 100).ToString(),
490
                App.ViewInfo.DocumentItemID
491
                );
492

    
493
            PrintWindow.Content = new KCOM.Control.PrintControl(
494
                      Tile_Url,
495
                      App.ViewInfo.ProjectNO,
496
                      this.ParentOfType<MainWindow>().dzMainMenu._DocInfo, markupinfo,
497
                      this.ParentOfType<MainWindow>().dzMainMenu.pageNavigator.CurrentPage.PageNumber,
498
                      App.ViewInfo.DocumentItemID,
499
                      this.ParentOfType<MainWindow>().dzMainMenu._DocItem.DOCUMENT_NO,
500
                      this.ParentOfType<MainWindow>().dzMainMenu._DocItem.ORIGINAL_FILE, isprint);
501

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

    
514
        //강인구 추가
515
        private void PrintEvent(object sender, RoutedEventArgs e)
516
        {
517
            RadRibbonButton button = sender as RadRibbonButton;
518
            Print_Start(button.Content.ToString());
519
        }
520

    
521
        private List<AdornerMember> GetAdornerItem()
522
        {
523
            List<AdornerMember> AdonerList = new List<AdornerMember>();
524

    
525
            if (this.ParentOfType<MainWindow>() != null)
526
            {
527
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
528
                {
529
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
530
                    {
531
                        if (item.GetType().Name == "AdornerFinal")
532
                        {
533
                            foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
534
                            {
535
                                AdonerList.Add(InnerItem);
536
                            }
537
                        }
538
                    }
539
                }
540
            }
541

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

    
565
                foreach (AdornerMember InnerItem in AdonerList)
566
                {
567
                    InnerItem.DrawingData.Opacity = ViewerDataModel.Instance.ControlOpacity;
568
                  
569
                    multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
570
                    UndoData.Markup_List.Add(multi_Undo_Data);
571
                    multi_Undo_Data = new Multi_Undo_data();
572
                }
573

    
574
                ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
575
                {
576
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
577
                });
578
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
579
            }
580
        }
581

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

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

    
690
                    multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
691
                    UndoData.Markup_List.Add(multi_Undo_Data);
692
                    multi_Undo_Data = new Multi_Undo_data();
693
                }
694

    
695
                ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
696
                {
697
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
698
                });
699
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
700

    
701
                
702
            }
703
            KCOM.Properties.Settings.Default.LineSize = (double)cbLineSize.Value;
704
            Properties.Settings.Default.Save();
705
        }
706

    
707

    
708
        private void cbIntervalSize_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
709
        {
710
            if (string.IsNullOrEmpty(cbIntervalSize.Value.ToString()))
711
            {
712
                cbIntervalSize.Value = cbIntervalSize.Minimum;
713
            }
714
            List<AdornerMember> AdonerList = GetAdornerItem();
715
            if (AdonerList.Count > 0)
716
            {
717

    
718
                Undo_data UndoData = new Undo_data()
719
                {
720
                    IsUndo = false,
721
                    Event = Event_Type.Option,
722
                    EventTime = DateTime.Now,
723
                    Interval = ViewerDataModel.Instance.Interval,
724
                    Markup_List = new List<Multi_Undo_data>()
725
                };
726
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
727

    
728
                foreach (AdornerMember InnerItem in AdonerList)
729
                {
730
                    switch (InnerItem.DrawingData.GetType().Name)
731
                    {
732
                        case ("LineControl"):
733
                            {
734
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Line.LineControl).Interval = ViewerDataModel.Instance.Interval;
735

    
736
                                multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
737
                                UndoData.Markup_List.Add(multi_Undo_Data);
738
                                multi_Undo_Data = new Multi_Undo_data();
739
                            }
740
                            break;
741
                    }
742
                }
743

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

    
764
                //Undo_data UndoData = new Undo_data()
765
                //{
766
                //    IsUndo = false,
767
                //    Event = Event_Type.Option,
768
                //    EventTime = DateTime.Now,
769
                //    Interval = ViewerDataModel.Instance.Interval,
770
                //    Markup_List = new List<Multi_Undo_data>()
771
                //};
772
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
773

    
774
                foreach (AdornerMember InnerItem in AdonerList)
775
                {
776
                    switch (InnerItem.DrawingData.GetType().Name)
777
                    {
778
                        case ("RectCloudControl"):
779
                            {
780
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.RectCloudControl).ArcLength = ViewerDataModel.Instance.ArcLength;
781

    
782
                                //multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
783
                                //UndoData.Markup_List.Add(multi_Undo_Data);
784
                                //multi_Undo_Data = new Multi_Undo_data();
785
                            }
786
                            break;
787
                        case ("CloudControl"):
788
                            {
789
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Polygon.CloudControl).ArcLength = ViewerDataModel.Instance.ArcLength;
790

    
791
                                //multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
792
                                //UndoData.Markup_List.Add(multi_Undo_Data);
793
                                //multi_Undo_Data = new Multi_Undo_data();
794
                            }
795
                            break;
796
                    }
797
                }
798

    
799
                //ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
800
                //{
801
                //    ViewerDataModel.Instance.UndoDataList.Remove(i);
802
                //});
803
                //ViewerDataModel.Instance.UndoDataList.Add(UndoData);
804
            }
805

    
806
            KCOM.Properties.Settings.Default.ArcLength = (double)cbArcLength.Value;
807
            Properties.Settings.Default.Save();
808
        }
809

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

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

    
909
                                multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
910
                                UndoData.Markup_List.Add(multi_Undo_Data);
911
                                multi_Undo_Data = new Multi_Undo_data();
912
                            }
913

    
914
                            ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
915
                            {
916
                                ViewerDataModel.Instance.UndoDataList.Remove(i);
917
                            });
918
                            ViewerDataModel.Instance.UndoDataList.Add(UndoData);
919
                        }
920
                    }
921
                }
922
            }
923
        }
924

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

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

    
984
                                        }
985
                                        break;
986
                                    case ("ArrowTextControl"):
987
                                        {
988
                                            if ((InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextWeight == FontWeights.Bold)
989
                                            {
990
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextWeight = FontWeights.Normal;
991
                                            }
992
                                            else
993
                                            {
994
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextWeight = FontWeights.Bold;
995
                                            }
996
                                        }
997
                                        break;
998
                                }
999
                            }
1000
                        }
1001
                    }
1002
                }
1003
            }
1004
        }
1005

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

    
1032
                                        }
1033
                                        break;
1034
                                    case ("ArrowTextControl"):
1035
                                        {
1036
                                            if((InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextStyle == FontStyles.Italic)
1037
                                            {
1038
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextStyle = FontStyles.Normal;
1039
                                            }
1040
                                            else
1041
                                            {
1042
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextStyle = FontStyles.Italic;
1043
                                            }
1044
                                        }
1045
                                        break;
1046
                                }
1047
                            }
1048
                        }
1049
                    }
1050
                }
1051
            }
1052
        }
1053

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

    
1101
        private void AxisLockEvent(object sender, RoutedEventArgs e)
1102
        {
1103
            ViewerDataModel.Instance.checkAxis = cbAxisLock.IsChecked.Value;
1104
        }
1105

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

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

    
1193
        /// <summary>
1194
        /// 텍스트 컨트롤 하일라이트 처리
1195
        /// </summary>
1196
        /// <param name="sender"></param>
1197
        /// <param name="e"></param>
1198
        private void HighlightEvent(object sender, RoutedEventArgs e)
1199
        {
1200

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

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

    
1292
                    ((TextBox)sender).Text = previousText;
1293
                }
1294
            }
1295
        }
1296

    
1297
        /// <summary>
1298
        /// 입력한 페이지로 이동한다
1299
        /// </summary>
1300
        /// <param name="sender"></param>
1301
        /// <param name="e"></param>
1302
        private void tlcurrentPage_readonly_KeyDown(object sender, KeyEventArgs e)
1303
        {
1304
            if (e.Key == Key.Enter)
1305
            {
1306
                try
1307
                {
1308
                    var instanceMain = this.ParentOfType<MainWindow>();
1309
                    instanceMain.dzMainMenu.pageNavigator.GotoPage(Convert.ToInt32(tlcurrentPage_readonly.Text));
1310
                }
1311
                catch (Exception)
1312
                {
1313
                    RadWindow.Alert(new DialogParameters
1314
                    {
1315
                        Owner = Application.Current.MainWindow,
1316
                        Theme = new VisualStudio2013Theme(),
1317
                        Header = "안내",
1318
                        Content = "페이지 번호를 정확하게 입력해 주세요",
1319
                    });
1320
                }
1321
            }
1322
        }
1323
        
1324
        private void PanoramaEvent(object sender, RoutedEventArgs e)
1325
        {
1326
            PanoramaShow();
1327
        }
1328

    
1329
        public void PanoramaShow()
1330
        {
1331
            Panorama check = new Panorama();
1332
            double screenWidth = System.Windows.SystemParameters.PrimaryScreenWidth;
1333
            double screenHeight = System.Windows.SystemParameters.PrimaryScreenHeight;
1334
            //double windowWidth = this.Width;
1335
            //double windowHeight = this.Height;
1336

    
1337
            var PanoramaPop = new RadWindow
1338
            {
1339
                //MinWidth = 600,
1340
                //MinHeight = 400,
1341
                //Header = "My Check List",
1342
                Header = "Document No : " + this.ParentOfType<MainWindow>().dzMainMenu._DocItem.DOCUMENT_NO + " / Revision :" + this.ParentOfType<MainWindow>().dzMainMenu._DocItem.REVISION,
1343
                Content = check,
1344
                Owner = this,
1345
                ResizeMode = System.Windows.ResizeMode.CanResizeWithGrip,
1346
                //ResizeMode = System.Windows.ResizeMode.NoResize,
1347
                WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen,
1348
                IsTopmost = false,
1349
                //Left = (screenWidth / 2) - (windowWidth / 2),
1350
                //Top = (screenHeight / 2) - (windowHeight / 2),
1351
                //Left = (screenWidth / 2),
1352
                //Top = (screenHeight / 2),
1353
                Width = screenWidth * 0.4,
1354
                Height = screenHeight * 0.4,
1355
            };
1356
            StyleManager.SetTheme(PanoramaPop, new VisualStudio2013Theme());
1357
            //CheckPop.ShowDialog();
1358
            PanoramaPop.Owner = Application.Current.MainWindow;
1359
            PanoramaPop.Show();
1360
        }
1361

    
1362
        private void CheckEvent(object sender, RoutedEventArgs e)
1363
        {
1364
            //창이 떠있을 경우 재 실행 방지
1365
            if (isClosed)
1366
            {
1367
                //토글 및 마우스 상태 초기화
1368
                var toggleList = this.Parent.ChildrenOfType<RadToggleButton>();
1369
                foreach(var togle in toggleList)
1370
                {
1371
                    togle.IsChecked = false;
1372
                }
1373
                this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
1374

    
1375
                isClosed = false;
1376

    
1377
                
1378
                CheckList check = new CheckList();
1379

    
1380
                CheckPop = new RadWindow
1381
                {
1382
                    MinWidth = 1200,
1383
                    MinHeight = 500,
1384
                    //Header = "My Check List",
1385
                    Header = "Document No : " + this.ParentOfType<MainWindow>().dzMainMenu._DocItem.DOCUMENT_NO + " / Revision :" + this.ParentOfType<MainWindow>().dzMainMenu._DocItem.REVISION,
1386
                    Content = check,
1387
                    //Owner = this,
1388
                    //ResizeMode = System.Windows.ResizeMode.CanResizeWithGrip,
1389
                    ResizeMode = System.Windows.ResizeMode.NoResize,
1390
                    WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen,
1391
                    IsTopmost = true,
1392
                };
1393
                StyleManager.SetTheme(CheckPop, new Office2013Theme());
1394
                CheckPop.Closed += CheckPop_Closed;
1395
                
1396
                //CheckPop.ShowDialog();
1397
                CheckPop.Show();
1398
            }
1399
        }
1400

    
1401
        private void OptionPop_Closed(object sender, WindowClosedEventArgs e)
1402
        {
1403
            isClosed = true;
1404
            //this.ParentOfType<MainWindow>().dzMainMenu.PN_Navi.IsEnabled = true;
1405
            this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
1406
            ViewerDataModel.Instance.Capture_Opacity = 0;
1407
        }
1408

    
1409
        private void CheckPop_Closed(object sender, WindowClosedEventArgs e)
1410
        {
1411
            isClosed = true;
1412
            //this.ParentOfType<MainWindow>().dzMainMenu.PN_Navi.IsEnabled = true;
1413
            this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
1414
            ViewerDataModel.Instance.Capture_Opacity = 0;
1415
        }
1416

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

    
1456
        private void viewEvent(object sender, RoutedEventArgs e)
1457
        {
1458
            RadRibbonToggleButton viewButton = sender as RadRibbonToggleButton;
1459
            var instanceMain = this.ParentOfType<MainWindow>();
1460

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

    
1463
            //if ((sender as RadRibbonToggleButton) != null)
1464
            //{
1465
            //    Common.ViewerDataModel.Instance.ControlTag = (sender as RadRibbonToggleButton).Tag.ToString();
1466
            //    instanceToggle = (sender as RadRibbonToggleButton);
1467
            //}
1468

    
1469
            //instanceToggle.IsChecked = false;
1470

    
1471
            switch (viewButton.CommandParameter.ToString())
1472
            {
1473
                case "zoomout":
1474
                    {
1475
                        //장원
1476
                        //instanceMain.dzMainMenu.zoomAndPanControl.ZoomTo(new Rect(0, 0, instanceMain.dzMainMenu.zoomAndPanCanvas.ActualWidth, instanceMain.dzMainMenu.zoomAndPanCanvas.ActualHeight));
1477
                        instanceMain.dzMainMenu.zoomAndPanControl.ZoomPointToViewportCenter(ViewerDataModel.Instance.ContentScale -= 0.1, point);
1478
                        viewButton.IsChecked = false;
1479
                        //Common.ViewerDataModel.Instance.zom
1480
                    }
1481
                    break;
1482
                case "zoomin":
1483
                    {
1484
                        instanceMain.dzMainMenu.zoomAndPanControl.ZoomPointToViewportCenter(ViewerDataModel.Instance.ContentScale += 0.1, point);
1485
                        viewButton.IsChecked = false;
1486
                    }
1487
                    break;
1488
                case "fullscreen":
1489
                    {
1490
                        instanceMain.WindowState = WindowState.Maximized;
1491
                        //Sizemode 대기(강인구)
1492
                        //instanceMain.dzMainMenu.imageViewer.SizeMode = Leadtools.Windows.Controls.SizeMode.Fit;
1493
                        instanceMain.dzMainMenu.zoomAndPanControl.ScaleToFit();
1494
                        viewButton.IsChecked = false;
1495
                    }
1496
                    break;
1497
                case "fitWidth":
1498
                    {
1499
                        instanceMain.dzMainMenu.zoomAndPanControl.ScaleToFit();
1500
                        viewButton.IsChecked = false;
1501
                    }
1502
                    break;
1503
                case "fitHeight":
1504
                    {
1505
                        instanceMain.dzMainMenu.zoomAndPanControl.ScaleToFit();
1506
                        viewButton.IsChecked = false;
1507
                    }
1508
                    break;
1509
                case "boundzoom":
1510
                    {
1511

    
1512
                    }
1513
                    break;
1514
                case "Rotate_M":
1515
                    {
1516
                        drawingPannelRotate(false);
1517
                        viewButton.IsChecked = false;
1518
                    }
1519
                    break;
1520
                case "Rotate_P":
1521
                    {
1522
                        drawingPannelRotate(true);
1523
                        viewButton.IsChecked = false;
1524
                    }
1525
                    break;
1526
                case "Rotate_half":
1527
                    {
1528
                        drawingPannelRotate(true);
1529
                        drawingPannelRotate(true);
1530
                        viewButton.IsChecked = false;
1531
                    }
1532
                    break;
1533
            }
1534
        }
1535

    
1536
        private void Control_Event(object sender, RoutedEventArgs e)
1537
        {
1538

    
1539
        }
1540

    
1541
        #region 대기
1542

    
1543
        public void drawingPannelRotate(bool Flag)
1544
        {
1545
            var instanceMain = this.ParentOfType<MainWindow>();
1546

    
1547
            //if (rotateOffSet > 3)
1548
            //    rotateOffSet = 0;
1549

    
1550
            //if (rotateOffSet < 0)
1551
            //    rotateOffSet = 3;
1552

    
1553
            if(Flag)
1554
            {
1555
                if (instanceMain.dzMainMenu.rotate.Angle == 270)
1556
                {
1557
                    instanceMain.dzMainMenu.rotate.Angle = 0;
1558
                }
1559
                else
1560
                {
1561
                    instanceMain.dzMainMenu.rotate.Angle += 90;
1562
                }
1563
            }
1564
            else
1565
            {
1566
                if(instanceMain.dzMainMenu.rotate.Angle == 0)
1567
                {
1568
                    instanceMain.dzMainMenu.rotate.Angle = 270;
1569
                }
1570
                else
1571
                {
1572
                    instanceMain.dzMainMenu.rotate.Angle -= 90;
1573
                }
1574
            }
1575
            //double angle = (double)rotateValue.GetValue(rotateOffSet);
1576
            //instanceMain.dzMainMenu.rotate.Angle = angle;
1577
            var rotationNum = Math.Abs((instanceMain.dzMainMenu.rotate.Angle / 90));
1578

    
1579
            if (instanceMain.dzMainMenu.zoomAndPanCanvas.Width == ViewerDataModel.Instance.ContentWidth)
1580
            {
1581
                double emptySize = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
1582
                instanceMain.dzMainMenu.zoomAndPanCanvas.Width = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
1583
                instanceMain.dzMainMenu.zoomAndPanCanvas.Height = emptySize;
1584
            }
1585
            if (instanceMain.dzMainMenu.rotate.Angle == 0)
1586
            {
1587
                instanceMain.dzMainMenu.translate.X = 0;
1588
                instanceMain.dzMainMenu.translate.Y = 0;
1589
            }
1590
            else if (instanceMain.dzMainMenu.rotate.Angle == 90)
1591
            {
1592
                instanceMain.dzMainMenu.translate.X = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
1593
                instanceMain.dzMainMenu.translate.Y = 0;
1594
            }
1595
            else if (instanceMain.dzMainMenu.rotate.Angle == 180)
1596
            {
1597
                instanceMain.dzMainMenu.translate.X = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
1598
                instanceMain.dzMainMenu.translate.Y = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
1599
            }
1600
            else
1601
            {
1602
                instanceMain.dzMainMenu.translate.X = 0;
1603
                instanceMain.dzMainMenu.translate.Y = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
1604
            }
1605

    
1606
            //instanceMain.dzMainMenu.zoomAndPanControl.RenderTransformOrigin = new Point(0.5, 0.5);
1607
            instanceMain.dzMainMenu.zoomAndPanControl.RotationAngle = instanceMain.dzMainMenu.rotate.Angle;
1608
            //대기(강인구)
1609
            //instanceMain.dzMainMenu.imageViewer.RotateAngle = instanceMain.dzMainMenu.rotate.Angle;
1610

    
1611

    
1612
            //instanceMain.dzMainMenu.imageViewer.RenderTransformOrigin = new Point(0.5, 0.5);
1613
            //RotateTransform rotateTransform = new RotateTransform(instanceMain.dzMainMenu.rotate.Angle);
1614
            //instanceMain.dzMainMenu.imageViewer.RenderTransform = rotateTransform;
1615

    
1616

    
1617
            ViewerDataModel.Instance.ContentWidth = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
1618
            ViewerDataModel.Instance.ContentHeight = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
1619
            ViewerDataModel.Instance.AngleOffsetX = instanceMain.dzMainMenu.translate.X;
1620
            ViewerDataModel.Instance.AngleOffsetY = instanceMain.dzMainMenu.translate.Y;
1621
            ViewerDataModel.Instance.Angle = instanceMain.dzMainMenu.rotate.Angle;
1622
            //ViewerDataModel.Instance.Document_Info.Clear();
1623
            //ViewerDataModel.Instance.Document_Info.Where(i => i.PAGE_NUMBER == instanceMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber).ToList().ForEach(value =>
1624
            //{
1625
            //    value.PAGE_ANGLE = int.Parse(instanceMain.dzMainMenu.rotate.Angle.ToString());
1626
            //});
1627

    
1628

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

    
1634
                instanceMain.dzMainMenu.pageNavigator.ImgListbox.ItemsSource = instanceMain.dzMainMenu.pageNavigator._thumbnailItems;
1635
                var instance = instanceMain.dzMainMenu.CurrentDoc.docInfo.DOCPAGE.Where(p => p.PAGE_NUMBER == instanceMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber).FirstOrDefault();
1636
                instance.PAGE_ANGLE = int.Parse(instanceMain.dzMainMenu.rotate.Angle.ToString());
1637

    
1638
                instanceMain.dzMainMenu.pageNavigator.GotoPage(data.PageNumber);
1639

    
1640
                //rotation page add or update
1641
                var rotationdoc = ViewerDataModel.Instance.RotationDocs.Where(d => d.ID == instance.ID).FirstOrDefault();
1642
                if (rotationdoc != null)
1643
                {
1644
                    rotationdoc.PAGE_ANGLE = instance.PAGE_ANGLE;
1645
                }
1646
                else
1647
                {
1648
                    ViewerDataModel.Instance.RotationDocs.Add(instance);
1649
                }
1650
            });
1651
        }
1652
        #endregion
1653

    
1654
        private void ImageConverter(RadToggleButton instanceToggle)
1655
        {
1656
            try
1657
            {           
1658
                var instanceMain = this.ParentOfType<MainWindow>();
1659
                //http://cloud.devdoftech.co.kr:5977/ImageUpload/FileUpload.asmx
1660

    
1661
                Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
1662
                dlg.Filter = "All files (*.*)|*.*|PNG Images (*.png)|*.png";
1663
                Nullable<bool> result = dlg.ShowDialog();
1664
                if (result == true)
1665
                {
1666
                    instanceMain.dzMainMenu.filename = dlg.FileName;
1667
                    instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ImgControl;
1668

    
1669
                    System.IO.FileInfo fileInfo = new System.IO.FileInfo(instanceMain.dzMainMenu.filename);
1670
                    String strFile = System.IO.Path.GetFileName(instanceMain.dzMainMenu.filename);
1671
                    long numByte = fileInfo.Length;
1672
                    double dLen = Convert.ToDouble(fileInfo.Length / 1000000);
1673
                    kr.co.devdoftech.cloud.FileUpload fileUploader = new kr.co.devdoftech.cloud.FileUpload();
1674

    
1675
                    if (dLen < 4)
1676
                    {
1677
                        System.IO.FileStream fStream = new System.IO.FileStream(instanceMain.dzMainMenu.filename, System.IO.FileMode.Open, System.IO.FileAccess.Read);
1678
                        System.IO.BinaryReader br = new System.IO.BinaryReader(fStream);
1679
                        byte[] data = br.ReadBytes((int)numByte);
1680
                        br.Close();
1681

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

    
1684
                        Check_Uri.UriCheck(filepath);
1685

    
1686
                        instanceMain.dzMainMenu.filename = filepath;
1687

    
1688
                        fStream.Close();
1689
                        fStream.Dispose();
1690
                    }
1691
                    else
1692
                    {
1693
                        this.ParentOfType<MainWindow>().DialogMessage_Alert("Available Memory less than 4 mega byte", "Alert");
1694
                    }
1695
                }
1696
                else
1697
                {
1698
                    instanceToggle.IsChecked = false;
1699
                    Common.ViewerDataModel.Instance.SelectedControl = "";
1700
                    Common.ViewerDataModel.Instance.ControlTag = null;
1701
                    this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
1702
                    this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
1703
                    this.ParentOfType<MainWindow>().DialogMessage_Alert("No Image selected.", "Alert");
1704
                }
1705
            }
1706
            catch(Exception ex)
1707
            {
1708
                instanceToggle.IsChecked = false;
1709
                Common.ViewerDataModel.Instance.SelectedControl = "";
1710
                Common.ViewerDataModel.Instance.ControlTag = null;
1711
                this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
1712
                this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
1713
                this.ParentOfType<MainWindow>().DialogMessage_Alert(""+ ex , "Alert");
1714
            }
1715
        }
1716

    
1717
        private void Control_Init(RadToggleButton instanceToggle, object sender)
1718
        {
1719

    
1720
        }
1721

    
1722
        private void ControlEvent(object sender, RoutedEventArgs e)
1723
        {
1724
            RadToggleButton instanceToggle = sender as RadToggleButton;
1725
            var instanceMain = this.ParentOfType<MainWindow>();
1726

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

    
1747
            //if (!instanceMain.IsFreeSelectionMode)
1748
            //{
1749
            //    instanceMain.IsSwingMode = true;
1750
            //}
1751

    
1752
            #region 다른 컨트롤 버튼 선택 해제
1753
            System.Reactive.Linq.Observable2.FromPropertyChangedPattern(Common.ViewerDataModel.Instance, temp => temp.SelectedControl).Subscribe(ControlState =>
1754
            {
1755
                if (ControlState == null)
1756
                {
1757
                    instanceToggle.IsChecked = false;
1758
                    HiddenControlHide();
1759
                }
1760
            });
1761
            #endregion
1762

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

    
1765
            if (instanceToggle != null)
1766
            {
1767
                Common.ViewerDataModel.Instance.ControlTag = instanceToggle.Tag.ToString();
1768
            }
1769
            else if ((sender as RadRibbonToggleButton) != null)
1770
            {
1771
                Common.ViewerDataModel.Instance.ControlTag = (sender as RadRibbonToggleButton).Tag.ToString();
1772
                instanceToggle = (sender as RadRibbonToggleButton);
1773
            }
1774
            else if ((sender as RadRibbonButton) != null)
1775
            {
1776
                RadRibbonButton instanceButton = sender as RadRibbonButton;
1777
                Common.ViewerDataModel.Instance.ControlTag = instanceButton.Tag.ToString();
1778
            }
1779
            else
1780
            {
1781
                RadButton instanceButton = sender as RadButton;
1782
                Common.ViewerDataModel.Instance.ControlTag = instanceButton.Tag.ToString();
1783
            }
1784

    
1785

    
1786

    
1787
            System.Reactive.Linq.Observable2.FromPropertyChangedPattern(Common.ViewerDataModel.Instance, temp => temp.AngleVisibility).Subscribe(isSee =>
1788
            {
1789
                instanceMain.dzMainMenu.MainAngle.Visibility = isSee;
1790
                System.Reactive.Linq.Observable2.FromPropertyChangedPattern(Common.ViewerDataModel.Instance, temp => temp.AngleValue).Subscribe(p =>
1791
                {
1792
                    instanceMain.dzMainMenu.MainAngle.AngleValue = p;
1793
                });
1794
            });
1795
            instanceMain.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Drawing;
1796

    
1797
            instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = false;
1798

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

    
2024
                        //instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = true;
2025

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

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

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

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

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

    
2256

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

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

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

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

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

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

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

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

    
2374
                            check.Closed += Check_Closed;
2375

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

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

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

    
2419
        }
2420

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

    
2436
        }
2437

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

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

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

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

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

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

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

    
2486
        private double minHeight;
2487
        private double minWidth;
2488

    
2489
        private double maxHeight;
2490
        private double maxWidth;
2491

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
2731
                SelectionSet.Instance.UnSelect(this.ParentOfType<MainWindow>().dzMainMenu);
2732

    
2733
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
2734

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

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

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

    
2756
                        ViewerDataModel.Instance.MarkupControls.Remove(item as MarkupToPDF.Common.CommentUserInfo);
2757
                        ViewerDataModel.Instance.MarkupControls_USER.Remove(item as MarkupToPDF.Common.CommentUserInfo);
2758

    
2759
                        adornerSet.Add(item as MarkupToPDF.Common.CommentUserInfo);
2760

    
2761
                        //Controls.AdornerFinal final = new Controls.AdornerFinal(item as MarkupToPDF.Common.CommentUserInfo);
2762
                        //this.dzMainMenu.SelectLayer.Children.Add(final);
2763

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

    
2766
                        UndoData.Markup_List.Add(multi_Undo_Data);
2767
                        ViewerDataModel.Instance.UndoDataList.Add(UndoData);                        
2768
                    }
2769
                }
2770
                Controls.AdornerFinal final = new Controls.AdornerFinal(adornerSet);
2771

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

    
2783
                    if (final.Members.Where(type => type.Drawingtype == MarkupToPDF.Controls.Common.ControlType.TextControl).FirstOrDefault() != null)
2784
                    {
2785
                        final.TranslateItems(0.001, 0.001); //dummy
2786
                    }
2787

    
2788
                }
2789
                
2790

    
2791
                this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Add(final);
2792

    
2793
                //붙여 넣을때 원본 컨트롤과 겹치지 않도록 설정
2794
                //Canvas.SetLeft(final, 50);
2795
                //Canvas.SetTop(final, 50);
2796
            }
2797
            //외부 이미지 붙여넣기
2798
            else if (Clipboard.GetImage() != null)
2799
            {
2800
                try
2801
                {
2802
                    Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
2803

    
2804
                    //강인구 Undo/Redo 보류
2805
                    UndoData = new Undo_data()
2806
                    {
2807
                        IsUndo = false,
2808
                        Event = Event_Type.Create,
2809
                        EventTime = DateTime.Now,
2810
                        Markup_List = new List<Multi_Undo_data>()
2811
                    };
2812

    
2813

    
2814
                    string temppath = System.IO.Path.GetTempPath();
2815
                    //string filename = KCOM.Events.Save.shortCommentKey();
2816
                    string filename = Commons.shortFileKey();
2817

    
2818
                    System.Drawing.Image clipboardImage = System.Windows.Forms.Clipboard.GetImage();
2819
                    clipboardImage.Save(temppath + "\\" + filename);
2820

    
2821
                    System.IO.FileInfo fileInfo = new System.IO.FileInfo(temppath + "\\" + filename);
2822
                    String strFile = System.IO.Path.GetFileName(fileInfo.FullName);
2823
                    long numByte = fileInfo.Length;
2824
                    double dLen = Convert.ToDouble(fileInfo.Length / 1000000);
2825
                    kr.co.devdoftech.cloud.FileUpload fileUploader = new kr.co.devdoftech.cloud.FileUpload();
2826

    
2827
                    if (dLen < 4)
2828
                    {
2829
                        System.IO.FileStream fStream = new System.IO.FileStream(fileInfo.FullName,
2830
                        System.IO.FileMode.Open, System.IO.FileAccess.Read);
2831
                        System.IO.BinaryReader br = new System.IO.BinaryReader(fStream);
2832
                        byte[] data = br.ReadBytes((int)numByte);
2833

    
2834
                        filename = fileUploader.Run(App.ViewInfo.ProjectNO, this.ParentOfType<MainWindow>().dzMainMenu._DocItem.DOCUMENT_NO, App.ViewInfo.UserID, strFile + ".png", data);
2835
                        Check_Uri.UriCheck(filename);
2836
                        br.Close();
2837
                        fStream.Close();
2838
                        fStream.Dispose();
2839
                    }
2840
                    else
2841
                    {
2842
                        this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert("Available Memory less than 4 mega byte", "Alert");
2843
                        return;
2844
                    }
2845

    
2846
                    fileInfo.Delete();
2847

    
2848
                    //System.Drawing.Image clipboardImage = System.Windows.Forms.Clipboard.GetImage();
2849
                    System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(clipboardImage);
2850
                    IntPtr hBitmap = bmp.GetHbitmap();
2851
                    System.Windows.Media.ImageSource WpfBitmap = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(hBitmap, IntPtr.Zero, Int32Rect.Empty, System.Windows.Media.Imaging.BitmapSizeOptions.FromEmptyOptions());
2852
                    Image img = new Image();
2853
                    //img.Source = new System.Windows.Media.Imaging.BitmapImage(new Uri(filename));
2854
                    if (filename.Contains(".svg"))
2855
                    {
2856
                        byte[] imageData = null;
2857
                        DrawingImage image = null;
2858
                        using (System.Net.WebClient web = new System.Net.WebClient())
2859
                        {
2860
                            imageData = web.DownloadData(new Uri(filename));
2861
                            System.IO.Stream stream = new System.IO.MemoryStream(imageData);
2862
                            image = SvgReader.Load(stream);
2863
                        }
2864
                        img.Source = image;
2865
                    }
2866
                    else
2867
                    {
2868
                        img.Source = new BitmapImage(new Uri(filename));
2869
                    }
2870

    
2871
                    var currentControl = new MarkupToPDF.Controls.Etc.ImgControl
2872
                    {
2873
                        PointSet = new List<Point>(),
2874
                        //FilePath = img.Source.ToString(),
2875
                        FilePath = filename,
2876
                        ImageData = img.Source,
2877
                        StartPoint = new Point(100, 100),
2878
                        EndPoint = new Point(200, 200),
2879
                        TopRightPoint = new Point(100, 200),
2880
                        LeftBottomPoint = new Point(200, 100)
2881
                    };
2882

    
2883
                    currentControl.TopRightPoint = new Point(currentControl.StartPoint.X + clipboardImage.Width, currentControl.StartPoint.Y);
2884
                    currentControl.LeftBottomPoint = new Point(currentControl.StartPoint.X, currentControl.StartPoint.Y + clipboardImage.Height);
2885
                    currentControl.EndPoint = new Point(currentControl.StartPoint.X + clipboardImage.Width, currentControl.StartPoint.Y + clipboardImage.Height);
2886

    
2887
                    currentControl.PointSet = new List<Point>
2888
                                        {
2889
                                            currentControl.StartPoint,
2890
                                            currentControl.LeftBottomPoint,
2891
                                            currentControl.EndPoint,
2892
                                            currentControl.TopRightPoint,
2893
                                        };
2894

    
2895
                    multi_Undo_Data = this.ParentOfType<MainWindow>().dzMainMenu.Control_Style(currentControl as MarkupToPDF.Common.CommentUserInfo);
2896
                    UndoData.Markup_List.Add(multi_Undo_Data);
2897
                    ViewerDataModel.Instance.UndoDataList.Add(UndoData);
2898

    
2899
                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl as MarkupToPDF.Common.CommentUserInfo);
2900
                    currentControl.CommentID = Commons.shortGuid();
2901

    
2902
                    currentControl.ApplyTemplate();
2903
                    currentControl.SetImage();
2904

    
2905
                    ViewerDataModel.Instance.MarkupControls_USER.Remove(currentControl as MarkupToPDF.Common.CommentUserInfo);
2906
                    Controls.AdornerFinal final = new Controls.AdornerFinal(currentControl as MarkupToPDF.Common.CommentUserInfo);
2907
                    this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Add(final);
2908

    
2909
                    double realPointX = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.X - final.BorderSize.X - (final.BorderSize.Width / 2);
2910
                    double realPointY = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.Y - final.BorderSize.Y - (final.BorderSize.Height / 2);
2911
                    final.TranslateItems(realPointX, realPointY);
2912
                }
2913
                catch(Exception ex)
2914
                {
2915
                    this.ParentOfType<MainWindow>().DialogMessage_Alert("" + ex, "Alert");
2916
                }
2917
            }
2918
        }
2919
    }
2920
}
클립보드 이미지 추가 (최대 크기: 500 MB)