프로젝트

일반

사용자정보

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

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

이력 | 보기 | 이력해설 | 다운로드 (145 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
                    
1228
                    var instanceMain = this.ParentOfType<MainWindow>();
1229
                    var max = instanceMain.dzMainMenu.pageNavigator._thumbnailItems.Max(f => f.PageNumber);
1230
                    if (string.IsNullOrEmpty(tlcurrentPage.Text))
1231
                    {
1232
                        RadWindow.Alert(new DialogParameters
1233
                        {
1234
                            Owner = Application.Current.MainWindow,
1235
                            Theme = new VisualStudio2013Theme(),
1236
                            Header = "안내",
1237
                            Content = "페이지 번호를 정확하게 입력해 주세요",
1238
                        });
1239
                    }
1240
                    else
1241
                    {
1242
                        if (Convert.ToInt32(tlcurrentPage.Text) > max || Convert.ToInt32(tlcurrentPage.Text) == 0)
1243
                        {
1244
                            RadWindow.Alert(new DialogParameters
1245
                            {
1246
                                Owner = Application.Current.MainWindow,
1247
                                Theme = new VisualStudio2013Theme(),
1248
                                Header = "안내",
1249
                                Content = "페이지 번호를 정확하게 입력해 주세요",
1250
                            });
1251
                        }
1252
                        else
1253
                        {
1254
                            instanceMain.dzMainMenu.pageNavigator.GotoPage(Convert.ToInt32(tlcurrentPage.Text));
1255
                        }
1256
                    }
1257
                    
1258
                }
1259
                catch (Exception)
1260
                {
1261
                    RadWindow.Alert(new DialogParameters
1262
                    {
1263
                        Owner = Application.Current.MainWindow,
1264
                        Theme = new VisualStudio2013Theme(),
1265
                        Header = "안내",
1266
                        Content = "페이지 번호를 정확하게 입력해 주세요",
1267
                    });
1268
                }
1269
                
1270
            }
1271
        }
1272
        private string previousText;
1273
        private void TlcurrentPage_PreviewTextInput(object sender, TextCompositionEventArgs e)
1274
        {
1275
            System.Text.RegularExpressions.Regex regex = new System.Text.RegularExpressions.Regex("[^0-9]+");
1276
            e.Handled = regex.IsMatch(e.Text);
1277
        }
1278
        private void TlcurrentPage_TextChanged(object sender, TextChangedEventArgs e)
1279
        {
1280
            double num = 0;
1281
            bool success = double.TryParse(((TextBox)sender).Text, out num);
1282
            if (success & num >= 0)
1283
                previousText = ((TextBox)sender).Text;
1284
            else
1285
            {
1286
                if (string.IsNullOrEmpty(((TextBox)sender).Text))
1287
                {
1288
                    ((TextBox)sender).Text = "";
1289
                }
1290
                else
1291
                {
1292

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

    
1298

    
1299
        private void tlcurrentPage_readonly_KeyDown(object sender, KeyEventArgs e)
1300
        {
1301
            //강인구 추가 tlcurrentPage을 이상하게 입력할수 있기때문에 Try Catch
1302
            if (e.Key == Key.Enter)
1303
            {
1304
                try
1305
                {
1306
                    var instanceMain = this.ParentOfType<MainWindow>();
1307
                    instanceMain.dzMainMenu.pageNavigator.GotoPage(Convert.ToInt32(tlcurrentPage_readonly.Text));
1308
                }
1309
                catch (Exception)
1310
                {
1311
                    RadWindow.Alert(new DialogParameters
1312
                    {
1313
                        Owner = Application.Current.MainWindow,
1314
                        Theme = new VisualStudio2013Theme(),
1315
                        Header = "안내",
1316
                        Content = "페이지 번호를 정확하게 입력해 주세요",
1317
                    });
1318
                }
1319

    
1320
            }
1321
        }
1322
        
1323

    
1324
        //public event EventHandler<WindowClosedEventArgs> Closed;
1325

    
1326
        //private void CheckEvent(object sender, RoutedEventArgs e)
1327
        //{
1328
        //    RadWindow CheckPop = new RadWindow();
1329
        //    test check = new test();
1330

    
1331
        //    CheckPop = new RadWindow
1332
        //    {
1333
        //        Width = 1700,
1334
        //        Height = 510,
1335
        //        Header = "My Check List",
1336
        //        Content = check,
1337
        //        Owner = this,
1338
        //        ResizeMode = System.Windows.ResizeMode.NoResize,
1339
        //        WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen,
1340
        //    };
1341
        //    StyleManager.SetTheme(CheckPop, new VisualStudio2013Theme());
1342

    
1343
        //    CheckPop.Closed += CheckPop_Closed;
1344
        //    CheckPop.ShowDialog();
1345
        //}
1346

    
1347
        private void PanoramaEvent(object sender, RoutedEventArgs e)
1348
        {
1349
            PanoramaShow();
1350
        }
1351

    
1352
        public void PanoramaShow()
1353
        {
1354
            Panorama check = new Panorama();
1355
            double screenWidth = System.Windows.SystemParameters.PrimaryScreenWidth;
1356
            double screenHeight = System.Windows.SystemParameters.PrimaryScreenHeight;
1357
            //double windowWidth = this.Width;
1358
            //double windowHeight = this.Height;
1359

    
1360
            var PanoramaPop = new RadWindow
1361
            {
1362
                //MinWidth = 600,
1363
                //MinHeight = 400,
1364
                //Header = "My Check List",
1365
                Header = "Document No : " + this.ParentOfType<MainWindow>().dzMainMenu._DocItem.DOCUMENT_NO + " / Revision :" + this.ParentOfType<MainWindow>().dzMainMenu._DocItem.REVISION,
1366
                Content = check,
1367
                Owner = this,
1368
                ResizeMode = System.Windows.ResizeMode.CanResizeWithGrip,
1369
                //ResizeMode = System.Windows.ResizeMode.NoResize,
1370
                WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen,
1371
                IsTopmost = false,
1372
                //Left = (screenWidth / 2) - (windowWidth / 2),
1373
                //Top = (screenHeight / 2) - (windowHeight / 2),
1374
                //Left = (screenWidth / 2),
1375
                //Top = (screenHeight / 2),
1376
                Width = screenWidth * 0.4,
1377
                Height = screenHeight * 0.4,
1378
            };
1379
            StyleManager.SetTheme(PanoramaPop, new VisualStudio2013Theme());
1380
            //CheckPop.ShowDialog();
1381
            PanoramaPop.Owner = Application.Current.MainWindow;
1382
            PanoramaPop.Show();
1383
        }
1384

    
1385
        private void CheckEvent(object sender, RoutedEventArgs e)
1386
        {
1387
            //창이 떠있을 경우 재 실행 방지
1388
            if (isClosed)
1389
            {
1390
                //토글 및 마우스 상태 초기화
1391
                var toggleList = this.Parent.ChildrenOfType<RadToggleButton>();
1392
                foreach(var togle in toggleList)
1393
                {
1394
                    togle.IsChecked = false;
1395
                }
1396
                this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
1397

    
1398
                isClosed = false;
1399

    
1400
                
1401
                CheckList check = new CheckList();
1402

    
1403
                CheckPop = new RadWindow
1404
                {
1405
                    MinWidth = 1200,
1406
                    MinHeight = 500,
1407
                    //Header = "My Check List",
1408
                    Header = "Document No : " + this.ParentOfType<MainWindow>().dzMainMenu._DocItem.DOCUMENT_NO + " / Revision :" + this.ParentOfType<MainWindow>().dzMainMenu._DocItem.REVISION,
1409
                    Content = check,
1410
                    //Owner = this,
1411
                    //ResizeMode = System.Windows.ResizeMode.CanResizeWithGrip,
1412
                    ResizeMode = System.Windows.ResizeMode.NoResize,
1413
                    WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen,
1414
                    IsTopmost = true,
1415
                };
1416
                StyleManager.SetTheme(CheckPop, new Office2013Theme());
1417
                CheckPop.Closed += CheckPop_Closed;
1418
                
1419
                //CheckPop.ShowDialog();
1420
                CheckPop.Show();
1421
            }
1422
        }
1423

    
1424
        private void OptionPop_Closed(object sender, WindowClosedEventArgs e)
1425
        {
1426
            isClosed = true;
1427
            //this.ParentOfType<MainWindow>().dzMainMenu.PN_Navi.IsEnabled = true;
1428
            this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
1429
            ViewerDataModel.Instance.Capture_Opacity = 0;
1430
        }
1431

    
1432
        private void CheckPop_Closed(object sender, WindowClosedEventArgs e)
1433
        {
1434
            isClosed = true;
1435
            //this.ParentOfType<MainWindow>().dzMainMenu.PN_Navi.IsEnabled = true;
1436
            this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
1437
            ViewerDataModel.Instance.Capture_Opacity = 0;
1438
        }
1439

    
1440
        /// <summary>
1441
        /// 사용자가 선택한 페이지로 이동(썸네일 동기화 시킴)
1442
        /// </summary>
1443
        /// <param name="sender"></param>
1444
        /// <param name="e"></param>
1445
        private void PageGoEvent(object sender, RoutedEventArgs e)
1446
        {
1447
            RadButton button = sender as RadButton;
1448
            var instanceMain = this.ParentOfType<MainWindow>();
1449
            
1450
            //강인구 추가 tlcurrentPage을 이상하게 입력할수 있기때문에 Try Catch
1451
            try
1452
            {
1453
                switch (button.CommandParameter.ToString())
1454
                {
1455
                    case "Down":
1456
                        {
1457
                            instanceMain.dzMainMenu.pageNavigator.GotoPage(Convert.ToInt32(tlcurrentPage.Text) + 1);
1458
                        }
1459
                        break;
1460
                    case "Up":
1461
                        {
1462
                            instanceMain.dzMainMenu.pageNavigator.GotoPage(Convert.ToInt32(tlcurrentPage.Text) - 1);
1463
                        }
1464
                        break;
1465
                }
1466
            }
1467
            catch (Exception)
1468
            {
1469
                RadWindow.Alert(new DialogParameters
1470
                {
1471
                    Owner = Application.Current.MainWindow,
1472
                    Theme = new VisualStudio2013Theme(),
1473
                    Header = "안내",
1474
                    Content = "페이지 번호를 정확하게 입력해 주세요",
1475
                });
1476
            }
1477
        }
1478

    
1479
        private void viewEvent(object sender, RoutedEventArgs e)
1480
        {
1481
            RadRibbonToggleButton viewButton = sender as RadRibbonToggleButton;
1482
            var instanceMain = this.ParentOfType<MainWindow>();
1483

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

    
1486
            //if ((sender as RadRibbonToggleButton) != null)
1487
            //{
1488
            //    Common.ViewerDataModel.Instance.ControlTag = (sender as RadRibbonToggleButton).Tag.ToString();
1489
            //    instanceToggle = (sender as RadRibbonToggleButton);
1490
            //}
1491

    
1492
            //instanceToggle.IsChecked = false;
1493

    
1494
            switch (viewButton.CommandParameter.ToString())
1495
            {
1496
                case "zoomout":
1497
                    {
1498
                        //장원
1499
                        //instanceMain.dzMainMenu.zoomAndPanControl.ZoomTo(new Rect(0, 0, instanceMain.dzMainMenu.zoomAndPanCanvas.ActualWidth, instanceMain.dzMainMenu.zoomAndPanCanvas.ActualHeight));
1500
                        instanceMain.dzMainMenu.zoomAndPanControl.ZoomPointToViewportCenter(ViewerDataModel.Instance.ContentScale -= 0.1, point);
1501
                        viewButton.IsChecked = false;
1502
                        //Common.ViewerDataModel.Instance.zom
1503
                    }
1504
                    break;
1505
                case "zoomin":
1506
                    {
1507
                        instanceMain.dzMainMenu.zoomAndPanControl.ZoomPointToViewportCenter(ViewerDataModel.Instance.ContentScale += 0.1, point);
1508
                        viewButton.IsChecked = false;
1509
                    }
1510
                    break;
1511
                case "fullscreen":
1512
                    {
1513
                        instanceMain.WindowState = WindowState.Maximized;
1514
                        //Sizemode 대기(강인구)
1515
                        //instanceMain.dzMainMenu.imageViewer.SizeMode = Leadtools.Windows.Controls.SizeMode.Fit;
1516
                        instanceMain.dzMainMenu.zoomAndPanControl.ScaleToFit();
1517
                        viewButton.IsChecked = false;
1518
                    }
1519
                    break;
1520
                case "fitWidth":
1521
                    {
1522
                        instanceMain.dzMainMenu.zoomAndPanControl.ScaleToFit();
1523
                        viewButton.IsChecked = false;
1524
                    }
1525
                    break;
1526
                case "fitHeight":
1527
                    {
1528
                        instanceMain.dzMainMenu.zoomAndPanControl.ScaleToFit();
1529
                        viewButton.IsChecked = false;
1530
                    }
1531
                    break;
1532
                case "boundzoom":
1533
                    {
1534

    
1535
                    }
1536
                    break;
1537
                case "Rotate_M":
1538
                    {
1539
                        drawingPannelRotate(false);
1540
                        viewButton.IsChecked = false;
1541
                    }
1542
                    break;
1543
                case "Rotate_P":
1544
                    {
1545
                        drawingPannelRotate(true);
1546
                        viewButton.IsChecked = false;
1547
                    }
1548
                    break;
1549
                case "Rotate_half":
1550
                    {
1551
                        drawingPannelRotate(true);
1552
                        drawingPannelRotate(true);
1553
                        viewButton.IsChecked = false;
1554
                    }
1555
                    break;
1556
            }
1557
        }
1558

    
1559
        private void Control_Event(object sender, RoutedEventArgs e)
1560
        {
1561

    
1562
        }
1563

    
1564
        #region 대기
1565

    
1566
        public void drawingPannelRotate(bool Flag)
1567
        {
1568
            var instanceMain = this.ParentOfType<MainWindow>();
1569

    
1570
            //if (rotateOffSet > 3)
1571
            //    rotateOffSet = 0;
1572

    
1573
            //if (rotateOffSet < 0)
1574
            //    rotateOffSet = 3;
1575

    
1576
            if(Flag)
1577
            {
1578
                if (instanceMain.dzMainMenu.rotate.Angle == 270)
1579
                {
1580
                    instanceMain.dzMainMenu.rotate.Angle = 0;
1581
                }
1582
                else
1583
                {
1584
                    instanceMain.dzMainMenu.rotate.Angle += 90;
1585
                }
1586
            }
1587
            else
1588
            {
1589
                if(instanceMain.dzMainMenu.rotate.Angle == 0)
1590
                {
1591
                    instanceMain.dzMainMenu.rotate.Angle = 270;
1592
                }
1593
                else
1594
                {
1595
                    instanceMain.dzMainMenu.rotate.Angle -= 90;
1596
                }
1597
            }
1598
            //double angle = (double)rotateValue.GetValue(rotateOffSet);
1599
            //instanceMain.dzMainMenu.rotate.Angle = angle;
1600
            var rotationNum = Math.Abs((instanceMain.dzMainMenu.rotate.Angle / 90));
1601

    
1602
            if (instanceMain.dzMainMenu.zoomAndPanCanvas.Width == ViewerDataModel.Instance.ContentWidth)
1603
            {
1604
                double emptySize = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
1605
                instanceMain.dzMainMenu.zoomAndPanCanvas.Width = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
1606
                instanceMain.dzMainMenu.zoomAndPanCanvas.Height = emptySize;
1607
            }
1608
            if (instanceMain.dzMainMenu.rotate.Angle == 0)
1609
            {
1610
                instanceMain.dzMainMenu.translate.X = 0;
1611
                instanceMain.dzMainMenu.translate.Y = 0;
1612
            }
1613
            else if (instanceMain.dzMainMenu.rotate.Angle == 90)
1614
            {
1615
                instanceMain.dzMainMenu.translate.X = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
1616
                instanceMain.dzMainMenu.translate.Y = 0;
1617
            }
1618
            else if (instanceMain.dzMainMenu.rotate.Angle == 180)
1619
            {
1620
                instanceMain.dzMainMenu.translate.X = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
1621
                instanceMain.dzMainMenu.translate.Y = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
1622
            }
1623
            else
1624
            {
1625
                instanceMain.dzMainMenu.translate.X = 0;
1626
                instanceMain.dzMainMenu.translate.Y = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
1627
            }
1628

    
1629
            //instanceMain.dzMainMenu.zoomAndPanControl.RenderTransformOrigin = new Point(0.5, 0.5);
1630
            instanceMain.dzMainMenu.zoomAndPanControl.RotationAngle = instanceMain.dzMainMenu.rotate.Angle;
1631
            //대기(강인구)
1632
            //instanceMain.dzMainMenu.imageViewer.RotateAngle = instanceMain.dzMainMenu.rotate.Angle;
1633

    
1634

    
1635
            //instanceMain.dzMainMenu.imageViewer.RenderTransformOrigin = new Point(0.5, 0.5);
1636
            //RotateTransform rotateTransform = new RotateTransform(instanceMain.dzMainMenu.rotate.Angle);
1637
            //instanceMain.dzMainMenu.imageViewer.RenderTransform = rotateTransform;
1638

    
1639

    
1640
            ViewerDataModel.Instance.ContentWidth = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
1641
            ViewerDataModel.Instance.ContentHeight = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
1642
            ViewerDataModel.Instance.AngleOffsetX = instanceMain.dzMainMenu.translate.X;
1643
            ViewerDataModel.Instance.AngleOffsetY = instanceMain.dzMainMenu.translate.Y;
1644
            ViewerDataModel.Instance.Angle = instanceMain.dzMainMenu.rotate.Angle;
1645
            //ViewerDataModel.Instance.Document_Info.Clear();
1646
            //ViewerDataModel.Instance.Document_Info.Where(i => i.PAGE_NUMBER == instanceMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber).ToList().ForEach(value =>
1647
            //{
1648
            //    value.PAGE_ANGLE = int.Parse(instanceMain.dzMainMenu.rotate.Angle.ToString());
1649
            //});
1650

    
1651

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

    
1657
                instanceMain.dzMainMenu.pageNavigator.ImgListbox.ItemsSource = instanceMain.dzMainMenu.pageNavigator._thumbnailItems;
1658
                var instance = instanceMain.dzMainMenu.CurrentDoc.docInfo.DOCPAGE.Where(p => p.PAGE_NUMBER == instanceMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber).FirstOrDefault();
1659
                instance.PAGE_ANGLE = int.Parse(instanceMain.dzMainMenu.rotate.Angle.ToString());
1660

    
1661
                instanceMain.dzMainMenu.pageNavigator.setPageChange(data);
1662

    
1663
                //rotation page add or update
1664
                var rotationdoc = ViewerDataModel.Instance.RotationDocs.Where(d => d.ID == instance.ID).FirstOrDefault();
1665
                if (rotationdoc != null)
1666
                {
1667
                    rotationdoc.PAGE_ANGLE = instance.PAGE_ANGLE;
1668
                }
1669
                else
1670
                {
1671
                    ViewerDataModel.Instance.RotationDocs.Add(instance);
1672
                }
1673
            });
1674
        }
1675
        #endregion
1676

    
1677
        private void ImageConverter(RadToggleButton instanceToggle)
1678
        {
1679
            try
1680
            {           
1681
                var instanceMain = this.ParentOfType<MainWindow>();
1682
                //http://cloud.devdoftech.co.kr:5977/ImageUpload/FileUpload.asmx
1683

    
1684
                Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
1685
                dlg.Filter = "All files (*.*)|*.*|PNG Images (*.png)|*.png";
1686
                Nullable<bool> result = dlg.ShowDialog();
1687
                if (result == true)
1688
                {
1689
                    instanceMain.dzMainMenu.filename = dlg.FileName;
1690
                    instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ImgControl;
1691

    
1692
                    System.IO.FileInfo fileInfo = new System.IO.FileInfo(instanceMain.dzMainMenu.filename);
1693
                    String strFile = System.IO.Path.GetFileName(instanceMain.dzMainMenu.filename);
1694
                    long numByte = fileInfo.Length;
1695
                    double dLen = Convert.ToDouble(fileInfo.Length / 1000000);
1696
                    kr.co.devdoftech.cloud.FileUpload fileUploader = new kr.co.devdoftech.cloud.FileUpload();
1697

    
1698
                    if (dLen < 4)
1699
                    {
1700
                        System.IO.FileStream fStream = new System.IO.FileStream(instanceMain.dzMainMenu.filename, System.IO.FileMode.Open, System.IO.FileAccess.Read);
1701
                        System.IO.BinaryReader br = new System.IO.BinaryReader(fStream);
1702
                        byte[] data = br.ReadBytes((int)numByte);
1703
                        br.Close();
1704

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

    
1707
                        Check_Uri.UriCheck(filepath);
1708

    
1709
                        instanceMain.dzMainMenu.filename = filepath;
1710

    
1711
                        fStream.Close();
1712
                        fStream.Dispose();
1713
                    }
1714
                    else
1715
                    {
1716
                        this.ParentOfType<MainWindow>().DialogMessage_Alert("Available Memory less than 4 mega byte", "Alert");
1717
                    }
1718
                }
1719
                else
1720
                {
1721
                    instanceToggle.IsChecked = false;
1722
                    Common.ViewerDataModel.Instance.SelectedControl = "";
1723
                    Common.ViewerDataModel.Instance.ControlTag = null;
1724
                    this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
1725
                    this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
1726
                    this.ParentOfType<MainWindow>().DialogMessage_Alert("No Image selected.", "Alert");
1727
                }
1728
            }
1729
            catch(Exception ex)
1730
            {
1731
                instanceToggle.IsChecked = false;
1732
                Common.ViewerDataModel.Instance.SelectedControl = "";
1733
                Common.ViewerDataModel.Instance.ControlTag = null;
1734
                this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
1735
                this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
1736
                this.ParentOfType<MainWindow>().DialogMessage_Alert(""+ ex , "Alert");
1737
            }
1738
        }
1739

    
1740
        private void Control_Init(RadToggleButton instanceToggle, object sender)
1741
        {
1742

    
1743
        }
1744

    
1745
        private void ControlEvent(object sender, RoutedEventArgs e)
1746
        {
1747
            RadToggleButton instanceToggle = sender as RadToggleButton;
1748
            var instanceMain = this.ParentOfType<MainWindow>();
1749

    
1750
            #region Ctrl + A 눌렀을 때 대처 방법 
1751
            //원인 : Ctrl + A를 누르면 UIElementSet에 등록을 시키지 않는다(이유는 한꺼번에 많은 양의 컨트롤의 동작이 유입되기 때문에
1752
            //       시스템의 성능저하를 불러올 수 있기 때문이다. 그래서 선택 후 다른 컨트롤을 누르면 등록되지 않은 컨트롤이기 때문에 삭제된다
1753
            //       이를 대처하는 방법으로 아래 코드를 사용한다.
1754
            if (Common.ViewerDataModel.Instance.MarkupControls.Count == 0 && Common.ViewerDataModel.Instance.MarkupControls.Count >= 1)
1755
            {
1756
                //var lstItem = instanceMain.DeepLayer._SelectLayer.ChildrenOfType<AdornerFinal>().ToList();
1757
                //foreach (var item in lstItem)
1758
                //{
1759
                //    foreach (var member in item.MemberSet)
1760
                //    {
1761
                //        if (!instanceMain.DeepLayer.UIElementSet.Contains(member.DrawingData))
1762
                //        {
1763
                //            instanceMain.DeepLayer.UIElementSet.Add(member.DrawingData);
1764
                //        }
1765
                //    }
1766
                //}
1767
            }
1768
            #endregion
1769

    
1770
            //if (!instanceMain.IsFreeSelectionMode)
1771
            //{
1772
            //    instanceMain.IsSwingMode = true;
1773
            //}
1774

    
1775
            #region 다른 컨트롤 버튼 선택 해제
1776
            System.Reactive.Linq.Observable2.FromPropertyChangedPattern(Common.ViewerDataModel.Instance, temp => temp.SelectedControl).Subscribe(ControlState =>
1777
            {
1778
                if (ControlState == null)
1779
                {
1780
                    instanceToggle.IsChecked = false;
1781
                    HiddenControlHide();
1782
                }
1783
            });
1784
            #endregion
1785

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

    
1788
            if (instanceToggle != null)
1789
            {
1790
                Common.ViewerDataModel.Instance.ControlTag = instanceToggle.Tag.ToString();
1791
            }
1792
            else if ((sender as RadRibbonToggleButton) != null)
1793
            {
1794
                Common.ViewerDataModel.Instance.ControlTag = (sender as RadRibbonToggleButton).Tag.ToString();
1795
                instanceToggle = (sender as RadRibbonToggleButton);
1796
            }
1797
            else if ((sender as RadRibbonButton) != null)
1798
            {
1799
                RadRibbonButton instanceButton = sender as RadRibbonButton;
1800
                Common.ViewerDataModel.Instance.ControlTag = instanceButton.Tag.ToString();
1801
            }
1802
            else
1803
            {
1804
                RadButton instanceButton = sender as RadButton;
1805
                Common.ViewerDataModel.Instance.ControlTag = instanceButton.Tag.ToString();
1806
            }
1807

    
1808

    
1809

    
1810
            System.Reactive.Linq.Observable2.FromPropertyChangedPattern(Common.ViewerDataModel.Instance, temp => temp.AngleVisibility).Subscribe(isSee =>
1811
            {
1812
                instanceMain.dzMainMenu.MainAngle.Visibility = isSee;
1813
                System.Reactive.Linq.Observable2.FromPropertyChangedPattern(Common.ViewerDataModel.Instance, temp => temp.AngleValue).Subscribe(p =>
1814
                {
1815
                    instanceMain.dzMainMenu.MainAngle.AngleValue = p;
1816
                });
1817
            });
1818
            instanceMain.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Drawing;
1819

    
1820
            instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = false;
1821

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

    
2047
                        //instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = true;
2048

    
2049
                        Common.ViewerDataModel.Instance.SelectedControl = "Ink";
2050
                        Common.ViewerDataModel.Instance.LineSize = (double)cbLineSize.Value;
2051
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.PenControl;
2052
                        break;
2053
                    #endregion
2054
                    #region Select
2055
                    case "Select":
2056
                        if(this.ParentOfType<MainWindow>().dzMainMenu.currentControl != null)
2057
                        {
2058
                            ViewerDataModel.Instance.MarkupControls_USER.Remove(this.ParentOfType<MainWindow>().dzMainMenu.currentControl);
2059
                            this.ParentOfType<MainWindow>().dzMainMenu.currentControl = null;
2060
                        }
2061
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Selecting;
2062
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2063
                        instanceMain.dzMainMenu.isLeftMouseButtonDownOnWindow = false;
2064
                        break;
2065
                    #endregion
2066
                    #region Image
2067
                    case "Image":
2068
                        Common.ViewerDataModel.Instance.SelectedControl = "ImgControl";
2069
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ImgControl;
2070
                        ImageConverter(instanceToggle);
2071
                        break;
2072
                    #endregion
2073
                    #region Sign
2074
                    case "Sign":
2075
                        Common.ViewerDataModel.Instance.SelectedControl = "Sign";
2076
                        Common.ViewerDataModel.Instance.ControlTag = instanceMain.dzMainMenu._ViewInfo.UserID; //사번
2077
                        //강인구 추가
2078
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Sign;
2079
                        //instanceMain.BaseClient.GetUserSignCompleted += (sen, ea) =>
2080
                        //{
2081
                        //    if (ea.Result == null)
2082
                        //    {
2083

    
2084
                        //        this.ParentOfType<MainPage>().DialogMessage_Alert("You Don't Have Sign Data", "Alert");
2085
                        //    }
2086
                        //    else
2087
                        //    {
2088
                        //        byte[] imageBytes = System.Convert.FromBase64String(ea.Result);
2089
                        //        using (MemoryStream ms = new MemoryStream(imageBytes))
2090
                        //        {
2091
                        //            BitmapImage im = new BitmapImage();
2092
                        //            im.SetSource(ms);
2093
                        //            instanceMain.DeepLayer.SignImage = im;
2094
                        //            ms.Close();
2095
                        //        }
2096
                        //    }
2097
                        //};
2098
                        //instanceMain.BaseClient.GetUserSignAsync(instanceMain._ViewInfo.UserID);
2099
                        break;
2100
                    #endregion
2101
                    #region Check
2102
                    case "Check":
2103
                        Common.ViewerDataModel.Instance.SelectedControl = "Check";
2104
                        Common.ViewerDataModel.Instance.ControlTag = instanceMain.dzMainMenu._ViewInfo.UserID; //사번
2105
                        //강인구 추가
2106
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Symbol;
2107
                        break;
2108
                    #endregion
2109
                    #region Batch
2110
                    case "Batch":
2111
                        Common.ViewerDataModel.Instance.SelectedControl = "Batch";
2112
                        Common.ViewerDataModel.Instance.ControlTag = instanceMain.dzMainMenu._ViewInfo.UserID; //사번
2113
                        //강인구 추가
2114
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Mark;
2115
                        instanceMain.dzMainMenu.txtBatch.Visibility = Visibility.Visible;
2116
                        instanceMain.dzMainMenu.txtBatch.Text = "Place Mark";
2117
                        break;
2118
                    #endregion
2119
                    #region Copy
2120
                    case "Copy":
2121
                        Copy_Start();
2122
                        instanceToggle.IsChecked = false;
2123
                        ViewerDataModel.Instance.SelectedControl = "";
2124
                        ViewerDataModel.Instance.ControlTag = null;
2125
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2126
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2127
                        break;
2128
                    #endregion
2129
                    #region Cut
2130
                    case "Cut":
2131
                        Cut_Start();
2132
                        instanceToggle.IsChecked = false;
2133
                        ViewerDataModel.Instance.SelectedControl = "";
2134
                        ViewerDataModel.Instance.ControlTag = null;
2135
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2136
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2137
                        break;
2138
                    #endregion
2139
                    #region Paste
2140
                    case "Paste":
2141
                        Paste_Start();
2142
                        instanceToggle.IsChecked = false;
2143
                        ViewerDataModel.Instance.SelectedControl = "";
2144
                        ViewerDataModel.Instance.ControlTag = null;
2145
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2146
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;                        
2147
                        break;
2148
                    #endregion
2149
                    #region Delete
2150
                    case "Delete":
2151
                        DeleteCommand.Instance.Execute(SelectionSet.Instance.SelectedItems);
2152
                        this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Clear();
2153

    
2154
                        instanceToggle.IsChecked = false;
2155
                        ViewerDataModel.Instance.SelectedControl = "";
2156
                        ViewerDataModel.Instance.ControlTag = null;
2157
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2158
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2159
                        break;
2160
                    #endregion
2161
                    #region Undo
2162
                    case "Undo":
2163
                        UndoCommand.Instance.Execute();
2164
                        instanceToggle.IsChecked = false;
2165
                        ViewerDataModel.Instance.SelectedControl = "";
2166
                        ViewerDataModel.Instance.ControlTag = null;
2167
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2168
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2169
                        break;
2170
                    #endregion
2171
                    #region Redo
2172
                    case "Redo":
2173
                        RedoCommand.Instance.Execute();
2174
                        instanceToggle.IsChecked = false;
2175
                        ViewerDataModel.Instance.SelectedControl = "";
2176
                        ViewerDataModel.Instance.ControlTag = null;
2177
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2178
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2179
                        break;
2180
                    #endregion
2181
                    #region DragZoom
2182
                    case "DragZoom":
2183
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.DragZoom;
2184
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2185
                        instanceMain.dzMainMenu.isLeftMouseButtonDownOnWindow = false;
2186
                        break;
2187
                    #endregion
2188
                    #region Grouping
2189
                    case "Group":
2190
                        //var GrouptoggleList = this.Parent.ChildrenOfType<RadRibbonToggleButton>();
2191
                        //foreach (var togle in GrouptoggleList)
2192
                        //{
2193
                        //    togle.IsChecked = false;
2194
                        //}
2195

    
2196
                        //if (this.ParentOfType<MainWindow>().dzMainMenu.currentControl != null)
2197
                        //{
2198
                        //    ViewerDataModel.Instance.MarkupControls_USER.Remove(this.ParentOfType<MainWindow>().dzMainMenu.currentControl);
2199
                        //    this.ParentOfType<MainWindow>().dzMainMenu.currentControl = null;
2200
                        //}
2201
                        //this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2202
                        //instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2203
                        //instanceMain.dzMainMenu.isLeftMouseButtonDownOnWindow = false;
2204
                        //if (ViewerDataModel.Instance.SystemMain.dzMainMenu.SelectLayer.Children.Count < 1) //선택된 것이 없으면
2205
                        //{
2206
                        //    this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert("Please Select Controls", "Alert");
2207
                        //}
2208
                        //else//if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
2209
                        //{
2210
                        //    // string MarkupData = "";
2211
                        //    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
2212
                        //    {
2213
                        //        if (item.GetType().Name == "AdornerFinal" && (item as AdornerFinal).MemberSet.Count >= 2) // 얘가 2개 이상이여야 그룹가능 버튼도 막을거긴하지만 일단..
2214
                        //        {
2215
                        //            //MARKUP_DATA_GROUP INSERT
2216
                        //            MARKUP_DATA_GROUP mARKUP_DATA_GROUP = new MARKUP_DATA_GROUP
2217
                        //            {
2218
                        //                SYMBOL_ID = null,//InnerItem.Symbol_ID
2219
                        //                STATE = 0,
2220
                        //            };
2221
                        //            long group_id = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.AddMarkupDataGroup(mARKUP_DATA_GROUP, App.ViewInfo.ProjectNO);
2222
                        //            Logger.sendReqLog("AddMarkupDataGroup: ", "", 1);
2223
                        //            if (group_id > 0)
2224
                        //            {
2225
                        //                foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
2226
                        //                {
2227
                        //                    if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
2228
                        //                    {
2229
                        //                        //MARKUP_DATA UPDATE
2230
                        //                        //Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.UpdateMarkupData((InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo).CommentID, group_id, App.ViewInfo.ProjectNO);
2231
                        //                        //Logger.sendReqLog("UpdateMarkupData: ", "", 1);
2232
                        //                        ViewerDataModel.Instance.MyMarkupList.Where(d => d.ID == (InnerItem.DrawingData as CommentUserInfo).CommentID).FirstOrDefault().Group_ID = group_id;
2233
                        //                        ViewerDataModel.Instance.MyMarkupList.Where(d => d.ID == (InnerItem.DrawingData as CommentUserInfo).CommentID).FirstOrDefault().IsUpdate = true;
2234
                        //                    }
2235
                        //                }
2236
                        //            }
2237
                        //        }
2238
                        //    }
2239
                        //}
2240
                        break;
2241
                    case "UnGroup":
2242
                        //var UnGrouptoggleList = this.Parent.ChildrenOfType<RadRibbonToggleButton>();
2243
                        //foreach (var togle in UnGrouptoggleList)
2244
                        //{
2245
                        //    togle.IsChecked = false;
2246
                        //}
2247
                        //if (this.ParentOfType<MainWindow>().dzMainMenu.currentControl != null)
2248
                        //{
2249
                        //    ViewerDataModel.Instance.MarkupControls_USER.Remove(this.ParentOfType<MainWindow>().dzMainMenu.currentControl);
2250
                        //    this.ParentOfType<MainWindow>().dzMainMenu.currentControl = null;
2251
                        //}
2252
                        //this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2253
                        //instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2254
                        //instanceMain.dzMainMenu.isLeftMouseButtonDownOnWindow = false;
2255

    
2256
                        //if (ViewerDataModel.Instance.SystemMain.dzMainMenu.SelectLayer.Children.Count < 1) //선택된 것이 없으면
2257
                        //{
2258
                        //    this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert("Please Select Controls", "Alert");
2259
                        //}
2260
                        //else//if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
2261
                        //{
2262
                        //    // string MarkupData = "";
2263
                        //    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
2264
                        //    {
2265
                        //        if (item.GetType().Name == "AdornerFinal" && (item as AdornerFinal).MemberSet.Count >= 1) // 1개 이상 
2266
                        //        {
2267
                        //            //MARKUP_DATA UPDATE
2268
                        //            foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
2269
                        //            {
2270
                        //                if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
2271
                        //                {
2272
                        //                    long group_id = ViewerDataModel.Instance.MyMarkupList.Where(d => d.ID == (InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo).CommentID).FirstOrDefault().Group_ID;
2273
                        //                    //MARKUP_DATA UPDATE
2274
                        //                    //Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.UpdateMarkupData((InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo).CommentID, 0, App.ViewInfo.ProjectNO);
2275
                        //                    //Logger.sendReqLog("UpdateMarkupData: ", "", 1);
2276
                        //                    ViewerDataModel.Instance.MyMarkupList.Where(d => d.ID == (InnerItem.DrawingData as CommentUserInfo).CommentID).FirstOrDefault().Group_ID = 0;
2277
                        //                    ViewerDataModel.Instance.MyMarkupList.Where(d => d.ID == (InnerItem.DrawingData as CommentUserInfo).CommentID).FirstOrDefault().IsUpdate = true;
2278

    
2279

    
2280
                        //                    //MARKUP_DATA_GROUP UPDATE
2281
                        //                    //bool value = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.UpdateMarkupDataGroup(group_id, App.ViewInfo.ProjectNO);
2282
                        //                    //Logger.sendReqLog("AddMarkupDataGroup: ", value.ToString(), 1);
2283
                        //                }
2284
                        //            }
2285
                        //        }
2286
                        //    }
2287
                        //}
2288
                        break;
2289
                    #endregion
2290
                    #region Capture
2291
                    case "Capture":
2292
                        SyncInit();
2293
                        //   instanceToggle.IsChecked = false;
2294
                        var CaptureList = this.Parent.ChildrenOfType<RadRibbonToggleButton>();
2295
                        foreach (var togle in CaptureList)
2296
                        {
2297
                            togle.IsChecked = false;
2298
                        }
2299

    
2300
                        if (this.ParentOfType<MainWindow>().dzMainMenu.currentControl != null)
2301
                        {
2302
                            ViewerDataModel.Instance.MarkupControls_USER.Remove(this.ParentOfType<MainWindow>().dzMainMenu.currentControl);
2303
                            this.ParentOfType<MainWindow>().dzMainMenu.currentControl = null;
2304
                        }
2305

    
2306
                        ViewerDataModel.Instance.SelectedControl = "ImgControl";
2307
                   //     ViewerDataModel.Instance.ControlTag = null;
2308
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ImgControl;
2309

    
2310
                        /*
2311
                        //캡쳐 하기 전에 코멘트 저장
2312
                        if (Common.ViewerDataModel.Instance.MarkupControls_USER.Count > 0 || (Application.Current.MainWindow as MainWindow).dzMainMenu.SelectLayer.Children.Count > 0)
2313
                        {
2314
                            var menu = (Application.Current.MainWindow as MainWindow).dzMainMenu;
2315
                            menu.ReleaseAdorner();
2316
                            if (menu.PreviewUserMarkupInfoItem != null && menu.PreviewUserMarkupInfoItem.IsPreviewUser == true)
2317
                            {
2318
                                (Application.Current.MainWindow as MainWindow).dzTopMenu.RefactoryCommentReact(menu);
2319
                            }
2320
                            else if (menu.gridViewMarkup.SelectedItems.Count == 0 || (menu.gridViewMarkup.SelectedItems.FirstOrDefault() as IKCOM.MarkupInfoItem).UserID != App.ViewInfo.UserID)
2321
                            {
2322

    
2323
                            }
2324
                            else
2325
                            {
2326
                                (Application.Current.MainWindow as MainWindow).dzTopMenu.RefactoryCommentReact(menu);
2327
                            }
2328
                        }*/
2329

    
2330
                        //Common.ViewerDataModel.Instance.CheckList_ID = ((e.Source as Telerik.Windows.Controls.RadButton).DataContext as Customer).ID;
2331
                        //Common.ViewerDataModel.Instance.CheckList_ID = ((e.Source as Image).DataContext as Customer).ID;
2332
                        //Common.ViewerDataModel.Instance.PageNumber = ((e.Source as Image).DataContext as Customer).PAGENUMBER;
2333
                        Application.Current.MainWindow.Focus();
2334
                        Common.ViewerDataModel.Instance.Capture_Opacity = 0.49;
2335
                        (Application.Current.MainWindow as MainWindow).dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Capture;
2336
                        break;
2337
                    #endregion
2338
                    #region Cad
2339
                    case "Inside":
2340
                        //instanceMain.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Drawing;
2341
                        //instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = false;
2342
                        Common.ViewerDataModel.Instance.SelectedControl = "InsideWhite";
2343
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.InsideWhite;
2344
                        break;
2345
                    case "Overlap":
2346
                        //instanceMain.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Drawing;
2347
                        //instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = false;
2348
                        Common.ViewerDataModel.Instance.SelectedControl = "OverlapWhite";
2349
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.OverlapWhite;
2350
                        break;
2351
                    case "Clip":
2352
                        //instanceMain.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Drawing;
2353
                        //instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = false;
2354
                        Common.ViewerDataModel.Instance.SelectedControl = "ClipWhite";
2355
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ClipWhite;
2356
                        break;
2357
                    case "CadExport":
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
                            //Control 파일 먼저 생성
2370
                            CollapsedButton_Click();
2371
                            CadViewer check = new CadViewer();
2372
                            check.WindowStartupLocation = WindowStartupLocation.CenterScreen;
2373
                            check.Title = "Export Viewer";
2374
                            //check.Topmost = true;
2375
                            check.Show();
2376
                            check.Closed += Check_Closed;
2377
                            instanceToggle.IsChecked = false;
2378
                        }
2379
                        break;
2380
                    case "CadViewer":
2381
                        if (isClosed)
2382
                        {
2383
                            //토글 및 마우스 상태 초기화
2384
                            var toggleList = this.Parent.ChildrenOfType<RadRibbonToggleButton>();
2385
                            foreach (var togle in toggleList)
2386
                            {
2387
                                togle.IsChecked = false;
2388
                            }
2389
                            this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2390

    
2391
                            isClosed = false;
2392
                            CadResultViewer check = new CadResultViewer();
2393
                            check.WindowStartupLocation = WindowStartupLocation.CenterScreen;
2394
                            check.Title = "Viewer";
2395
                            check.Show();
2396

    
2397
                            check.Closed += Check_Closed;
2398

    
2399
                        }
2400
                        break;
2401
                    #endregion
2402
                    default:
2403
                        break;
2404
                }
2405
                #endregion
2406
            }
2407
            else
2408
            {
2409

    
2410
                if (!instanceMain.dzMainMenu.IsFreeSelectionMode)
2411
                {
2412
                    instanceMain.dzMainMenu.IsSwingMode = false;
2413
                    Common.ViewerDataModel.Instance.SelectedControl = "";
2414
                    Common.ViewerDataModel.Instance.ControlTag = null;
2415
                    this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2416
                    this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2417
                }
2418
            }
2419
        }
2420

    
2421
        private void SyncInit()
2422
        {
2423
            try
2424
            {
2425
                if (!ViewerDataModel.Instance.SystemMain.dzMainMenu.testPanel2.IsHidden)
2426
                {
2427
                    ViewerDataModel.Instance.SystemMain.dzMainMenu.testPanel2.IsHidden = true;
2428
                    ViewerDataModel.Instance.PageBalanceMode = false;
2429
                    ViewerDataModel.Instance.PageBalanceNumber = 0;
2430
                    ViewerDataModel.Instance.PageNumber = 0;
2431
                    ViewerDataModel.Instance.MarkupControls_Sync.Clear();
2432
                    ViewerDataModel.Instance.SystemMain.dzMainMenu.gridViewRevMarkup.Visibility = Visibility.Collapsed;
2433
                    ViewerDataModel.Instance.SystemMain.dzMainMenu.UserList.IsChecked = false;
2434
                    ViewerDataModel.Instance.SystemMain.dzMainMenu.BalanceMode.IsChecked = false;
2435
                }
2436
            }
2437
            catch (Exception ex)
2438
            {
2439
                Logger.sendResLog("SyncInit", ex.Message, 0);
2440
            }
2441

    
2442
        }
2443

    
2444
        Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
2445
        CommentUserInfo currentControl { get; set; }
2446
        private void Check_Closed(object sender, EventArgs e)
2447
        {
2448
            isClosed = true;
2449
            //this.ParentOfType<MainWindow>().dzMainMenu.PN_Navi.IsEnabled = true;
2450
            //토글 및 마우스 상태 초기화
2451
            var toggleList = this.Parent.ChildrenOfType<RadToggleButton>();
2452
            foreach (var togle in toggleList)
2453
            {
2454
                togle.IsChecked = false;
2455
            }
2456
            this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2457
            ViewerDataModel.Instance.Capture_Opacity = 0;
2458

    
2459
        }
2460

    
2461
        /* public class test 
2462
         {
2463
             public double width { get; set; }
2464
             public double height { get; set; }
2465
         }
2466
         */
2467
        private void CollapsedButton_Click()
2468
        {
2469
            this.ParentOfType<MainWindow>().dzTopMenu._SaveEvent(null, null); // 저장하지 못한 데이터가 있다면 저장
2470

    
2471
            string[] data = new string[0];
2472

    
2473
            int cnt = 0;
2474
            var menu = this.ParentOfType<MainWindow>().dzMainMenu;
2475

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

    
2478
            foreach (var item in gridSelectionItem)
2479
            {
2480
                if ((item.UserID == App.ViewInfo.UserID) && (ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.CurrentPage != null))
2481
                {
2482
                    var instance = ViewerDataModel.Instance.MyMarkupList.Where(d => d.PageNumber == ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber &&
2483
                    d.MarkupInfoID == item.MarkupInfoID).ToList();
2484
                    data = new string[instance.Count];
2485
                    foreach (var markup in instance)
2486
                    {
2487
                        data[cnt++] = MarkupToPDF.Serialize.Core.JsonSerializerHelper.UnCompressString(markup.Data);
2488
                    }
2489
                }
2490
            }
2491

    
2492
            if (data != null && KCOM.Properties.Settings.Default.cad == 1)
2493
            {
2494
                string FilePath = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\Cad");
2495
                string FileName = FilePath + "\\commentstring.json"; // Default file name
2496
                if (!File.Exists(FilePath))
2497
                {
2498
                    Directory.CreateDirectory(FilePath);
2499
                }
2500

    
2501
                if (!string.IsNullOrEmpty(FileName))
2502
                {
2503
                    //  File.WriteAllText(SaveDig.FileName, data);
2504
                    File.WriteAllLines(FileName, data);
2505
                }
2506
            }
2507
        }
2508

    
2509
        private double minHeight;
2510
        private double minWidth;
2511

    
2512
        private double maxHeight;
2513
        private double maxWidth;
2514

    
2515
        public bool CanVResize { get; private set; }
2516
        public bool CanHResize { get; private set; }
2517

    
2518
        public void DesignerComponent(FrameworkElement content)
2519
        {
2520
            this.InitializeComponent();
2521

    
2522
            if (!double.IsNaN(content.Width))
2523
            {
2524
                CanHResize = false;
2525
                this.Width = content.Width;
2526
            }
2527
            else
2528
            {
2529
                CanHResize = true;
2530
                this.Width = 23.0;
2531
            }
2532
            if (!double.IsNaN(content.Height))
2533
            {
2534
                CanVResize = false;
2535
                this.Height = content.Height; ;
2536
            }
2537
            else
2538
            {
2539
                CanVResize = true;
2540
                this.Height = 23.0;
2541
            }
2542

    
2543
            minWidth = content.MinWidth < 10.0 ? 10.0 : content.MinWidth;
2544
            minHeight = content.MinHeight < 10.0 ? 10.0 : content.MinHeight;
2545
            maxWidth = content.MaxWidth;
2546
            maxHeight = content.MaxHeight;
2547

    
2548
            double top = (double)content.GetValue(Canvas.TopProperty);
2549
            if (double.IsNaN(top))
2550
                top = 0.0;
2551
            double left = (double)content.GetValue(Canvas.LeftProperty);
2552
            if (double.IsNaN(left))
2553
                left = 0.0;
2554
            SetValue(Canvas.TopProperty, top);
2555
            SetValue(Canvas.LeftProperty, left);
2556

    
2557
            //Set the actual content. Note that "Content" property is a new property. See below
2558
            this.Content = content;
2559
        }
2560
        private void Thumb_DragDelta(object sender, DragDeltaEventArgs e)
2561
        {
2562
            string name = ((Thumb)sender).Name;
2563
            if (name.Contains("Top"))
2564
            {
2565
                double newHeight = this.Height - e.VerticalChange;
2566
                if (newHeight >= minHeight && newHeight <= maxHeight)
2567
                {
2568
                    this.Height = newHeight;
2569
                    SetValue(Canvas.TopProperty,
2570
                (double)GetValue(Canvas.TopProperty) + e.VerticalChange);
2571
                }
2572
            }
2573
            if (name.Contains("Right"))
2574
            {
2575
                double newWidth = this.Width + e.HorizontalChange;
2576
                if (newWidth >= minWidth && newWidth <= maxWidth)
2577
                    this.Width = newWidth;
2578
            }
2579
            if (name.Contains("Bottom"))
2580
            {
2581
                double newHeight = this.Height + e.VerticalChange;
2582
                if (newHeight >= minHeight && newHeight <= maxHeight)
2583
                    this.Height = newHeight;
2584
            }
2585
            if (name.Contains("Left"))
2586
            {
2587
                double newWidth = this.Width - e.HorizontalChange;
2588
                if (newWidth >= minWidth && newWidth <= maxWidth)
2589
                {
2590
                    this.Width = newWidth;
2591
                    SetValue(Canvas.LeftProperty,
2592
                (double)GetValue(Canvas.LeftProperty) + e.HorizontalChange);
2593
                }
2594
            }
2595
        }
2596

    
2597
        private void drawControlBorder(object sender)
2598
        {
2599
            System.Windows.Controls.Control control = (System.Windows.Controls.Control)sender;
2600
        }
2601

    
2602
        private void ResizeThumb_DragDelta(object sender, MouseButtonEventArgs e)
2603
        {
2604
            System.Windows.Controls.Control designerItem = (System.Windows.Controls.Control)sender;
2605
            if (designerItem != null)
2606
            {
2607
                double deltaVertical, deltaHorizontal;
2608

    
2609
                switch (VerticalAlignment)
2610
                {
2611
                    case VerticalAlignment.Bottom:
2612
                        deltaVertical = designerItem.ActualHeight - designerItem.MinHeight;
2613
                        designerItem.Height -= deltaVertical;
2614
                        break;
2615
                    case VerticalAlignment.Top:
2616
                        deltaVertical = designerItem.ActualHeight - designerItem.MinHeight;
2617
                        Canvas.SetTop(designerItem, Canvas.GetTop(designerItem) + deltaVertical);
2618
                        designerItem.Height -= deltaVertical;
2619
                        break;
2620
                    default:
2621
                        break;
2622
                }
2623

    
2624
                switch (HorizontalAlignment)
2625
                {
2626
                    case HorizontalAlignment.Left:
2627
                        deltaHorizontal = designerItem.ActualWidth - designerItem.MinWidth;
2628
                        Canvas.SetLeft(designerItem, Canvas.GetLeft(designerItem) + deltaHorizontal);
2629
                        designerItem.Width -= deltaHorizontal;
2630
                        break;
2631
                    case HorizontalAlignment.Right:
2632
                        deltaHorizontal = designerItem.ActualWidth - designerItem.MinWidth;
2633
                        designerItem.Width -= deltaHorizontal;
2634
                        break;
2635
                    default:
2636
                        break;
2637
                }
2638
            }
2639
            e.Handled = true;
2640
        }
2641

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

    
2644
        void ExportMethod()
2645
        {
2646
            //FileDialogFilter filterImage = new FileDialogFilter("Image Files", "*.jpg", "*.png");
2647
            SaveDig.Filter = "PDF file format|*.pdf";
2648
            SaveDig.Title = "Save an DWG File";
2649
            SaveDig.ShowDialog();
2650
        }
2651

    
2652
        private void cbAutoSave_Checked(object sender, RoutedEventArgs e)
2653
        {            
2654
            if (cbAutoSave.IsChecked == true)
2655
            {
2656
                SaveTime(true, (int)cbSaveInterval.Value);
2657
            }
2658
            else
2659
            {
2660
                SaveTime(false, (int)cbSaveInterval.Value);
2661
            }
2662
        }
2663
        private void cbSaveInterval_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
2664
        {
2665
            if(string.IsNullOrEmpty(cbSaveInterval.Value.ToString()))
2666
            {
2667
                cbSaveInterval.Value = cbSaveInterval.Minimum;
2668
            }
2669
            if (cbAutoSave.IsChecked == true)
2670
            {
2671
                SaveTime(true, (int)cbSaveInterval.Value);
2672
            }
2673

    
2674
            KCOM.Properties.Settings.Default.SaveInterval = (double)cbSaveInterval.Value;
2675
            Properties.Settings.Default.Save();
2676
        }
2677
        //강인구 자동 저장 추가
2678
        private void AutoSave(object sender, RoutedEventArgs e)
2679
        {
2680
            RadToggleButton instanceToggle = sender as RadToggleButton;
2681

    
2682
            if(instanceToggle.IsChecked == true)
2683
            {
2684
                SaveTime(true);
2685
            }
2686
            else
2687
            {
2688
                SaveTime(false);
2689
            }
2690
        }
2691

    
2692
        public void Copy_Start()
2693
        {
2694
            if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
2695
            {
2696
                string MarkupData = "";
2697

    
2698
                foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
2699
                {
2700
                    if (item.GetType().Name == "AdornerFinal")
2701
                    {
2702
                        foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
2703

    
2704
                        {
2705
                            if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
2706
                            {
2707
                                markupReturn = MarkupParser.MarkupToString(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo, App.ViewInfo.UserID);
2708
                                MarkupData += "|OR|" + markupReturn.ConvertData;
2709
                            }
2710
                        }
2711
                        Clipboard.SetText(MarkupData);
2712
                    }
2713
                }
2714
            }
2715
        }
2716

    
2717
        public void Cut_Start()
2718
        {
2719
            if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
2720
            {
2721
                foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
2722
                {
2723
                    string MarkupData = "";
2724

    
2725
                    if (item.GetType().Name == "AdornerFinal")
2726
                    {
2727
                        foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
2728
                        {
2729
                            if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
2730
                            {
2731
                                markupReturn = MarkupParser.MarkupToString(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo, App.ViewInfo.UserID);
2732
                                MarkupData += "|OR|" + markupReturn.ConvertData;
2733
                            }
2734
                        }
2735
                        //클립보드에 넣음
2736
                        Clipboard.SetText(MarkupData);
2737
                    }
2738
                }
2739
                this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Clear();
2740
            }
2741
        }
2742

    
2743
        public void Paste_Start()
2744
        {
2745
            //마크업 붙여넣기
2746
            //if (Clipboard.GetText().Contains("|DZ|"))
2747
            if (Clipboard.GetText().Contains("|OR||DZ|"))
2748
            {
2749
                List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>();
2750

    
2751
                string[] delimiterChars = { "|OR|" };
2752
                string[] data = Clipboard.GetText().Split(delimiterChars, StringSplitOptions.RemoveEmptyEntries);
2753

    
2754
                SelectionSet.Instance.UnSelect(this.ParentOfType<MainWindow>().dzMainMenu);
2755

    
2756
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
2757

    
2758
                //강인구 Undo/Redo 보류
2759
                UndoData = new Undo_data()
2760
                {
2761
                    IsUndo = false,
2762
                    Event = Event_Type.Create,
2763
                    EventTime = DateTime.Now,
2764
                    Markup_List = new List<Multi_Undo_data>()
2765
                };
2766

    
2767
                ViewerDataModel.Instance.UndoDataList.Where(data1 => data1.IsUndo == true).ToList().ForEach(i =>
2768
                {
2769
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
2770
                });
2771

    
2772
                foreach (string parse in data)
2773
                {
2774
                    if (parse != "")
2775
                    {
2776
                        System.Windows.Controls.Control item = MarkupParser.ParseEx(App.ViewInfo.ProjectNO, parse, ViewerDataModel.Instance.MarkupControls_USER, string.Empty, string.Empty);
2777
                        (item as MarkupToPDF.Common.CommentUserInfo).CommentID = Commons.shortGuid();
2778

    
2779
                        ViewerDataModel.Instance.MarkupControls.Remove(item as MarkupToPDF.Common.CommentUserInfo);
2780
                        ViewerDataModel.Instance.MarkupControls_USER.Remove(item as MarkupToPDF.Common.CommentUserInfo);
2781

    
2782
                        adornerSet.Add(item as MarkupToPDF.Common.CommentUserInfo);
2783

    
2784
                        //Controls.AdornerFinal final = new Controls.AdornerFinal(item as MarkupToPDF.Common.CommentUserInfo);
2785
                        //this.dzMainMenu.SelectLayer.Children.Add(final);
2786

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

    
2789
                        UndoData.Markup_List.Add(multi_Undo_Data);
2790
                        ViewerDataModel.Instance.UndoDataList.Add(UndoData);                        
2791
                    }
2792
                }
2793
                Controls.AdornerFinal final = new Controls.AdornerFinal(adornerSet);
2794

    
2795
                if(this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.X < 0)
2796
                {
2797
                    Canvas.SetLeft(final, 0);
2798
                    Canvas.SetTop(final, 0);
2799
                }
2800
                else
2801
                {
2802
                    double realPointX = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.X - final.BorderSize.X - (final.BorderSize.Width / 2);
2803
                    double realPointY = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.Y - final.BorderSize.Y - (final.BorderSize.Height / 2);
2804
                    final.TranslateItems(realPointX, realPointY);
2805

    
2806
                    if (final.Members.Where(type => type.Drawingtype == MarkupToPDF.Controls.Common.ControlType.TextControl).FirstOrDefault() != null)
2807
                    {
2808
                        final.TranslateItems(0.001, 0.001); //dummy
2809
                    }
2810

    
2811
                }
2812
                
2813

    
2814
                this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Add(final);
2815

    
2816
                //붙여 넣을때 원본 컨트롤과 겹치지 않도록 설정
2817
                //Canvas.SetLeft(final, 50);
2818
                //Canvas.SetTop(final, 50);
2819
            }
2820
            //외부 이미지 붙여넣기
2821
            else if (Clipboard.GetImage() != null)
2822
            {
2823
                try
2824
                {
2825
                    Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
2826

    
2827
                    //강인구 Undo/Redo 보류
2828
                    UndoData = new Undo_data()
2829
                    {
2830
                        IsUndo = false,
2831
                        Event = Event_Type.Create,
2832
                        EventTime = DateTime.Now,
2833
                        Markup_List = new List<Multi_Undo_data>()
2834
                    };
2835

    
2836

    
2837
                    string temppath = System.IO.Path.GetTempPath();
2838
                    //string filename = KCOM.Events.Save.shortCommentKey();
2839
                    string filename = Commons.shortFileKey();
2840

    
2841
                    System.Drawing.Image clipboardImage = System.Windows.Forms.Clipboard.GetImage();
2842
                    clipboardImage.Save(temppath + "\\" + filename);
2843

    
2844
                    System.IO.FileInfo fileInfo = new System.IO.FileInfo(temppath + "\\" + filename);
2845
                    String strFile = System.IO.Path.GetFileName(fileInfo.FullName);
2846
                    long numByte = fileInfo.Length;
2847
                    double dLen = Convert.ToDouble(fileInfo.Length / 1000000);
2848
                    kr.co.devdoftech.cloud.FileUpload fileUploader = new kr.co.devdoftech.cloud.FileUpload();
2849

    
2850
                    if (dLen < 4)
2851
                    {
2852
                        System.IO.FileStream fStream = new System.IO.FileStream(fileInfo.FullName,
2853
                        System.IO.FileMode.Open, System.IO.FileAccess.Read);
2854
                        System.IO.BinaryReader br = new System.IO.BinaryReader(fStream);
2855
                        byte[] data = br.ReadBytes((int)numByte);
2856

    
2857
                        filename = fileUploader.Run(App.ViewInfo.ProjectNO, this.ParentOfType<MainWindow>().dzMainMenu._DocItem.DOCUMENT_NO, App.ViewInfo.UserID, strFile + ".png", data);
2858
                        Check_Uri.UriCheck(filename);
2859
                        br.Close();
2860
                        fStream.Close();
2861
                        fStream.Dispose();
2862
                    }
2863
                    else
2864
                    {
2865
                        this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert("Available Memory less than 4 mega byte", "Alert");
2866
                        return;
2867
                    }
2868

    
2869
                    fileInfo.Delete();
2870

    
2871
                    //System.Drawing.Image clipboardImage = System.Windows.Forms.Clipboard.GetImage();
2872
                    System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(clipboardImage);
2873
                    IntPtr hBitmap = bmp.GetHbitmap();
2874
                    System.Windows.Media.ImageSource WpfBitmap = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(hBitmap, IntPtr.Zero, Int32Rect.Empty, System.Windows.Media.Imaging.BitmapSizeOptions.FromEmptyOptions());
2875
                    Image img = new Image();
2876
                    //img.Source = new System.Windows.Media.Imaging.BitmapImage(new Uri(filename));
2877
                    if (filename.Contains(".svg"))
2878
                    {
2879
                        byte[] imageData = null;
2880
                        DrawingImage image = null;
2881
                        using (System.Net.WebClient web = new System.Net.WebClient())
2882
                        {
2883
                            imageData = web.DownloadData(new Uri(filename));
2884
                            System.IO.Stream stream = new System.IO.MemoryStream(imageData);
2885
                            image = SvgReader.Load(stream);
2886
                        }
2887
                        img.Source = image;
2888
                    }
2889
                    else
2890
                    {
2891
                        img.Source = new BitmapImage(new Uri(filename));
2892
                    }
2893

    
2894
                    var currentControl = new MarkupToPDF.Controls.Etc.ImgControl
2895
                    {
2896
                        PointSet = new List<Point>(),
2897
                        //FilePath = img.Source.ToString(),
2898
                        FilePath = filename,
2899
                        ImageData = img.Source,
2900
                        StartPoint = new Point(100, 100),
2901
                        EndPoint = new Point(200, 200),
2902
                        TopRightPoint = new Point(100, 200),
2903
                        LeftBottomPoint = new Point(200, 100)
2904
                    };
2905

    
2906
                    currentControl.TopRightPoint = new Point(currentControl.StartPoint.X + clipboardImage.Width, currentControl.StartPoint.Y);
2907
                    currentControl.LeftBottomPoint = new Point(currentControl.StartPoint.X, currentControl.StartPoint.Y + clipboardImage.Height);
2908
                    currentControl.EndPoint = new Point(currentControl.StartPoint.X + clipboardImage.Width, currentControl.StartPoint.Y + clipboardImage.Height);
2909

    
2910
                    currentControl.PointSet = new List<Point>
2911
                                        {
2912
                                            currentControl.StartPoint,
2913
                                            currentControl.LeftBottomPoint,
2914
                                            currentControl.EndPoint,
2915
                                            currentControl.TopRightPoint,
2916
                                        };
2917

    
2918
                    multi_Undo_Data = this.ParentOfType<MainWindow>().dzMainMenu.Control_Style(currentControl as MarkupToPDF.Common.CommentUserInfo);
2919
                    UndoData.Markup_List.Add(multi_Undo_Data);
2920
                    ViewerDataModel.Instance.UndoDataList.Add(UndoData);
2921

    
2922
                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl as MarkupToPDF.Common.CommentUserInfo);
2923
                    currentControl.CommentID = Commons.shortGuid();
2924

    
2925
                    currentControl.ApplyTemplate();
2926
                    currentControl.SetImage();
2927

    
2928
                    ViewerDataModel.Instance.MarkupControls_USER.Remove(currentControl as MarkupToPDF.Common.CommentUserInfo);
2929
                    Controls.AdornerFinal final = new Controls.AdornerFinal(currentControl as MarkupToPDF.Common.CommentUserInfo);
2930
                    this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Add(final);
2931

    
2932
                    double realPointX = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.X - final.BorderSize.X - (final.BorderSize.Width / 2);
2933
                    double realPointY = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.Y - final.BorderSize.Y - (final.BorderSize.Height / 2);
2934
                    final.TranslateItems(realPointX, realPointY);
2935
                }
2936
                catch(Exception ex)
2937
                {
2938
                    this.ParentOfType<MainWindow>().DialogMessage_Alert("" + ex, "Alert");
2939
                }
2940
            }
2941
        }
2942
    }
2943
}
클립보드 이미지 추가 (최대 크기: 500 MB)