프로젝트

일반

사용자정보

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

markus / KCOM / Events / Implementation / TopMenuEvent.cs @ 4c1692a1

이력 | 보기 | 이력해설 | 다운로드 (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
                SaveEvent(null, null);
258
            }
259

    
260
        }
261

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
713

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
1299
                    ((TextBox)sender).Text = previousText;
1300
                }
1301
            }
1302
        }
1303

    
1304

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

    
1326
            }
1327
        }
1328
        
1329

    
1330
        //public event EventHandler<WindowClosedEventArgs> Closed;
1331

    
1332
        //private void CheckEvent(object sender, RoutedEventArgs e)
1333
        //{
1334
        //    RadWindow CheckPop = new RadWindow();
1335
        //    test check = new test();
1336

    
1337
        //    CheckPop = new RadWindow
1338
        //    {
1339
        //        Width = 1700,
1340
        //        Height = 510,
1341
        //        Header = "My Check List",
1342
        //        Content = check,
1343
        //        Owner = this,
1344
        //        ResizeMode = System.Windows.ResizeMode.NoResize,
1345
        //        WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen,
1346
        //    };
1347
        //    StyleManager.SetTheme(CheckPop, new VisualStudio2013Theme());
1348

    
1349
        //    CheckPop.Closed += CheckPop_Closed;
1350
        //    CheckPop.ShowDialog();
1351
        //}
1352

    
1353
        private void PanoramaEvent(object sender, RoutedEventArgs e)
1354
        {
1355
            PanoramaShow();
1356
        }
1357

    
1358
        public void PanoramaShow()
1359
        {
1360
            Panorama check = new Panorama();
1361
            double screenWidth = System.Windows.SystemParameters.PrimaryScreenWidth;
1362
            double screenHeight = System.Windows.SystemParameters.PrimaryScreenHeight;
1363
            //double windowWidth = this.Width;
1364
            //double windowHeight = this.Height;
1365

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

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

    
1404
                isClosed = false;
1405

    
1406
                
1407
                CheckList check = new CheckList();
1408

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

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

    
1438
        private void CheckPop_Closed(object sender, WindowClosedEventArgs e)
1439
        {
1440
            isClosed = true;
1441
            //this.ParentOfType<MainWindow>().dzMainMenu.PN_Navi.IsEnabled = true;
1442
            this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
1443
            ViewerDataModel.Instance.Capture_Opacity = 0;
1444
        }
1445

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

    
1485
        private void viewEvent(object sender, RoutedEventArgs e)
1486
        {
1487
            RadRibbonToggleButton viewButton = sender as RadRibbonToggleButton;
1488
            var instanceMain = this.ParentOfType<MainWindow>();
1489

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

    
1492
            //if ((sender as RadRibbonToggleButton) != null)
1493
            //{
1494
            //    Common.ViewerDataModel.Instance.ControlTag = (sender as RadRibbonToggleButton).Tag.ToString();
1495
            //    instanceToggle = (sender as RadRibbonToggleButton);
1496
            //}
1497

    
1498
            //instanceToggle.IsChecked = false;
1499

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

    
1541
                    }
1542
                    break;
1543
                case "Rotate_M":
1544
                    {
1545
                        drawingPannelRotate(false);
1546
                        viewButton.IsChecked = false;
1547
                    }
1548
                    break;
1549
                case "Rotate_P":
1550
                    {
1551
                        drawingPannelRotate(true);
1552
                        viewButton.IsChecked = false;
1553
                    }
1554
                    break;
1555
                case "Rotate_half":
1556
                    {
1557
                        drawingPannelRotate(true);
1558
                        drawingPannelRotate(true);
1559
                        viewButton.IsChecked = false;
1560
                    }
1561
                    break;
1562
            }
1563
        }
1564

    
1565
        private void Control_Event(object sender, RoutedEventArgs e)
1566
        {
1567

    
1568
        }
1569

    
1570
        #region 대기
1571

    
1572
        public void drawingPannelRotate(bool Flag)
1573
        {
1574
            var instanceMain = this.ParentOfType<MainWindow>();
1575

    
1576
            //if (rotateOffSet > 3)
1577
            //    rotateOffSet = 0;
1578

    
1579
            //if (rotateOffSet < 0)
1580
            //    rotateOffSet = 3;
1581

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

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

    
1635
            //instanceMain.dzMainMenu.zoomAndPanControl.RenderTransformOrigin = new Point(0.5, 0.5);
1636
            instanceMain.dzMainMenu.zoomAndPanControl.RotationAngle = instanceMain.dzMainMenu.rotate.Angle;
1637
            //대기(강인구)
1638
            //instanceMain.dzMainMenu.imageViewer.RotateAngle = instanceMain.dzMainMenu.rotate.Angle;
1639

    
1640

    
1641
            //instanceMain.dzMainMenu.imageViewer.RenderTransformOrigin = new Point(0.5, 0.5);
1642
            //RotateTransform rotateTransform = new RotateTransform(instanceMain.dzMainMenu.rotate.Angle);
1643
            //instanceMain.dzMainMenu.imageViewer.RenderTransform = rotateTransform;
1644

    
1645

    
1646
            ViewerDataModel.Instance.ContentWidth = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
1647
            ViewerDataModel.Instance.ContentHeight = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
1648
            ViewerDataModel.Instance.AngleOffsetX = instanceMain.dzMainMenu.translate.X;
1649
            ViewerDataModel.Instance.AngleOffsetY = instanceMain.dzMainMenu.translate.Y;
1650
            ViewerDataModel.Instance.Angle = instanceMain.dzMainMenu.rotate.Angle;
1651
            //ViewerDataModel.Instance.Document_Info.Clear();
1652
            //ViewerDataModel.Instance.Document_Info.Where(i => i.PAGE_NUMBER == instanceMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber).ToList().ForEach(value =>
1653
            //{
1654
            //    value.PAGE_ANGLE = int.Parse(instanceMain.dzMainMenu.rotate.Angle.ToString());
1655
            //});
1656

    
1657

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

    
1663
                instanceMain.dzMainMenu.pageNavigator.ImgListbox.ItemsSource = instanceMain.dzMainMenu.pageNavigator._thumbnailItems;
1664
                var instance = instanceMain.dzMainMenu.CurrentDoc.docInfo.DOCPAGE.Where(p => p.PAGE_NUMBER == instanceMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber).FirstOrDefault();
1665
                instance.PAGE_ANGLE = int.Parse(instanceMain.dzMainMenu.rotate.Angle.ToString());
1666

    
1667
                instanceMain.dzMainMenu.pageNavigator.setPageChange(data);
1668

    
1669
                //rotation page add or update
1670
                var rotationdoc = ViewerDataModel.Instance.RotationDocs.Where(d => d.ID == instance.ID).FirstOrDefault();
1671
                if (rotationdoc != null)
1672
                {
1673
                    rotationdoc.PAGE_ANGLE = instance.PAGE_ANGLE;
1674
                }
1675
                else
1676
                {
1677
                    ViewerDataModel.Instance.RotationDocs.Add(instance);
1678
                }
1679
            });
1680
        }
1681
        #endregion
1682

    
1683
        private void ImageConverter(RadToggleButton instanceToggle)
1684
        {
1685
            try
1686
            {           
1687
                var instanceMain = this.ParentOfType<MainWindow>();
1688
                //http://cloud.devdoftech.co.kr:5977/ImageUpload/FileUpload.asmx
1689

    
1690
                Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
1691
                dlg.Filter = "All files (*.*)|*.*|PNG Images (*.png)|*.png";
1692
                Nullable<bool> result = dlg.ShowDialog();
1693
                if (result == true)
1694
                {
1695
                    instanceMain.dzMainMenu.filename = dlg.FileName;
1696
                    instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ImgControl;
1697

    
1698
                    System.IO.FileInfo fileInfo = new System.IO.FileInfo(instanceMain.dzMainMenu.filename);
1699
                    String strFile = System.IO.Path.GetFileName(instanceMain.dzMainMenu.filename);
1700
                    long numByte = fileInfo.Length;
1701
                    double dLen = Convert.ToDouble(fileInfo.Length / 1000000);
1702
                    kr.co.devdoftech.cloud.FileUpload fileUploader = new kr.co.devdoftech.cloud.FileUpload();
1703

    
1704
                    if (dLen < 4)
1705
                    {
1706
                        System.IO.FileStream fStream = new System.IO.FileStream(instanceMain.dzMainMenu.filename, System.IO.FileMode.Open, System.IO.FileAccess.Read);
1707
                        System.IO.BinaryReader br = new System.IO.BinaryReader(fStream);
1708
                        byte[] data = br.ReadBytes((int)numByte);
1709
                        br.Close();
1710

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

    
1713
                        Check_Uri.UriCheck(filepath);
1714

    
1715
                        instanceMain.dzMainMenu.filename = filepath;
1716

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

    
1746
        private void Control_Init(RadToggleButton instanceToggle, object sender)
1747
        {
1748

    
1749
        }
1750

    
1751
        private void ControlEvent(object sender, RoutedEventArgs e)
1752
        {
1753
            RadToggleButton instanceToggle = sender as RadToggleButton;
1754
            var instanceMain = this.ParentOfType<MainWindow>();
1755

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

    
1776
            //if (!instanceMain.IsFreeSelectionMode)
1777
            //{
1778
            //    instanceMain.IsSwingMode = true;
1779
            //}
1780

    
1781
            #region 다른 컨트롤 버튼 선택 해제
1782
            System.Reactive.Linq.Observable2.FromPropertyChangedPattern(Common.ViewerDataModel.Instance, temp => temp.SelectedControl).Subscribe(ControlState =>
1783
            {
1784
                if (ControlState == null)
1785
                {
1786
                    instanceToggle.IsChecked = false;
1787
                    HiddenControlHide();
1788
                }
1789
            });
1790
            #endregion
1791

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

    
1794
            if (instanceToggle != null)
1795
            {
1796
                Common.ViewerDataModel.Instance.ControlTag = instanceToggle.Tag.ToString();
1797
            }
1798
            else if ((sender as RadRibbonToggleButton) != null)
1799
            {
1800
                Common.ViewerDataModel.Instance.ControlTag = (sender as RadRibbonToggleButton).Tag.ToString();
1801
                instanceToggle = (sender as RadRibbonToggleButton);
1802
            }
1803
            else if ((sender as RadRibbonButton) != null)
1804
            {
1805
                RadRibbonButton instanceButton = sender as RadRibbonButton;
1806
                Common.ViewerDataModel.Instance.ControlTag = instanceButton.Tag.ToString();
1807
            }
1808
            else
1809
            {
1810
                RadButton instanceButton = sender as RadButton;
1811
                Common.ViewerDataModel.Instance.ControlTag = instanceButton.Tag.ToString();
1812
            }
1813

    
1814

    
1815

    
1816
            System.Reactive.Linq.Observable2.FromPropertyChangedPattern(Common.ViewerDataModel.Instance, temp => temp.AngleVisibility).Subscribe(isSee =>
1817
            {
1818
                instanceMain.dzMainMenu.MainAngle.Visibility = isSee;
1819
                System.Reactive.Linq.Observable2.FromPropertyChangedPattern(Common.ViewerDataModel.Instance, temp => temp.AngleValue).Subscribe(p =>
1820
                {
1821
                    instanceMain.dzMainMenu.MainAngle.AngleValue = p;
1822
                });
1823
            });
1824
            instanceMain.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Drawing;
1825

    
1826
            instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = false;
1827

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

    
2053
                        //instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = true;
2054

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

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

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

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

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

    
2285

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

    
2306
                        if (this.ParentOfType<MainWindow>().dzMainMenu.currentControl != null)
2307
                        {
2308
                            ViewerDataModel.Instance.MarkupControls_USER.Remove(this.ParentOfType<MainWindow>().dzMainMenu.currentControl);
2309
                            this.ParentOfType<MainWindow>().dzMainMenu.currentControl = null;
2310
                        }
2311

    
2312
                        ViewerDataModel.Instance.SelectedControl = "ImgControl";
2313
                   //     ViewerDataModel.Instance.ControlTag = null;
2314
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ImgControl;
2315

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

    
2329
                            }
2330
                            else
2331
                            {
2332
                                (Application.Current.MainWindow as MainWindow).dzTopMenu.RefactoryCommentReact(menu);
2333
                            }
2334
                        }*/
2335

    
2336
                        //Common.ViewerDataModel.Instance.CheckList_ID = ((e.Source as Telerik.Windows.Controls.RadButton).DataContext as Customer).ID;
2337
                        //Common.ViewerDataModel.Instance.CheckList_ID = ((e.Source as Image).DataContext as Customer).ID;
2338
                        //Common.ViewerDataModel.Instance.PageNumber = ((e.Source as Image).DataContext as Customer).PAGENUMBER;
2339
                        Application.Current.MainWindow.Focus();
2340
                        Common.ViewerDataModel.Instance.Capture_Opacity = 0.49;
2341
                        (Application.Current.MainWindow as MainWindow).dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Capture;
2342
                        break;
2343
                    #endregion
2344
                    #region Cad
2345
                    case "Inside":
2346
                        //instanceMain.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Drawing;
2347
                        //instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = false;
2348
                        Common.ViewerDataModel.Instance.SelectedControl = "InsideWhite";
2349
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.InsideWhite;
2350
                        break;
2351
                    case "Overlap":
2352
                        //instanceMain.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Drawing;
2353
                        //instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = false;
2354
                        Common.ViewerDataModel.Instance.SelectedControl = "OverlapWhite";
2355
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.OverlapWhite;
2356
                        break;
2357
                    case "Clip":
2358
                        //instanceMain.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Drawing;
2359
                        //instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = false;
2360
                        Common.ViewerDataModel.Instance.SelectedControl = "ClipWhite";
2361
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ClipWhite;
2362
                        break;
2363
                    case "CadExport":
2364
                        if (isClosed)
2365
                        {
2366
                            //토글 및 마우스 상태 초기화
2367
                            var toggleList = this.Parent.ChildrenOfType<RadRibbonToggleButton>();
2368
                            foreach (var togle in toggleList)
2369
                            {
2370
                                togle.IsChecked = false;
2371
                            }
2372
                            this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2373

    
2374
                            isClosed = false;
2375
                            //Control 파일 먼저 생성
2376
                            CollapsedButton_Click();
2377
                            CadViewer check = new CadViewer();
2378
                            check.WindowStartupLocation = WindowStartupLocation.CenterScreen;
2379
                            check.Title = "Export Viewer";
2380
                            //check.Topmost = true;
2381
                            check.Show();
2382
                            check.Closed += Check_Closed;
2383
                            instanceToggle.IsChecked = false;
2384
                        }
2385
                        break;
2386
                    case "CadViewer":
2387
                        if (isClosed)
2388
                        {
2389
                            //토글 및 마우스 상태 초기화
2390
                            var toggleList = this.Parent.ChildrenOfType<RadRibbonToggleButton>();
2391
                            foreach (var togle in toggleList)
2392
                            {
2393
                                togle.IsChecked = false;
2394
                            }
2395
                            this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2396

    
2397
                            isClosed = false;
2398
                            CadResultViewer check = new CadResultViewer();
2399
                            check.WindowStartupLocation = WindowStartupLocation.CenterScreen;
2400
                            check.Title = "Viewer";
2401
                            check.Show();
2402

    
2403
                            check.Closed += Check_Closed;
2404

    
2405
                        }
2406
                        break;
2407
                    #endregion
2408
                    default:
2409
                        break;
2410
                }
2411
                #endregion
2412
            }
2413
            else
2414
            {
2415

    
2416
                if (!instanceMain.dzMainMenu.IsFreeSelectionMode)
2417
                {
2418
                    instanceMain.dzMainMenu.IsSwingMode = false;
2419
                    Common.ViewerDataModel.Instance.SelectedControl = "";
2420
                    Common.ViewerDataModel.Instance.ControlTag = null;
2421
                    this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2422
                    this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2423
                }
2424
            }
2425
        }
2426

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

    
2448
        }
2449

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

    
2465
        }
2466

    
2467
        /* public class test 
2468
         {
2469
             public double width { get; set; }
2470
             public double height { get; set; }
2471
         }
2472
         */
2473
        private void CollapsedButton_Click()
2474
        {
2475
            this.ParentOfType<MainWindow>().dzTopMenu._SaveEvent(null, null); // 저장하지 못한 데이터가 있다면 저장
2476

    
2477
            string[] data = new string[0];
2478

    
2479
            int cnt = 0;
2480
            var menu = this.ParentOfType<MainWindow>().dzMainMenu;
2481

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

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

    
2498
            if (data != null && KCOM.Properties.Settings.Default.cad == 1)
2499
            {
2500
                string FilePath = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\Cad");
2501
                string FileName = FilePath + "\\commentstring.json"; // Default file name
2502
                if (!File.Exists(FilePath))
2503
                {
2504
                    Directory.CreateDirectory(FilePath);
2505
                }
2506

    
2507
                if (!string.IsNullOrEmpty(FileName))
2508
                {
2509
                    //  File.WriteAllText(SaveDig.FileName, data);
2510
                    File.WriteAllLines(FileName, data);
2511
                }
2512
            }
2513
        }
2514

    
2515
        private double minHeight;
2516
        private double minWidth;
2517

    
2518
        private double maxHeight;
2519
        private double maxWidth;
2520

    
2521
        public bool CanVResize { get; private set; }
2522
        public bool CanHResize { get; private set; }
2523

    
2524
        public void DesignerComponent(FrameworkElement content)
2525
        {
2526
            this.InitializeComponent();
2527

    
2528
            if (!double.IsNaN(content.Width))
2529
            {
2530
                CanHResize = false;
2531
                this.Width = content.Width;
2532
            }
2533
            else
2534
            {
2535
                CanHResize = true;
2536
                this.Width = 23.0;
2537
            }
2538
            if (!double.IsNaN(content.Height))
2539
            {
2540
                CanVResize = false;
2541
                this.Height = content.Height; ;
2542
            }
2543
            else
2544
            {
2545
                CanVResize = true;
2546
                this.Height = 23.0;
2547
            }
2548

    
2549
            minWidth = content.MinWidth < 10.0 ? 10.0 : content.MinWidth;
2550
            minHeight = content.MinHeight < 10.0 ? 10.0 : content.MinHeight;
2551
            maxWidth = content.MaxWidth;
2552
            maxHeight = content.MaxHeight;
2553

    
2554
            double top = (double)content.GetValue(Canvas.TopProperty);
2555
            if (double.IsNaN(top))
2556
                top = 0.0;
2557
            double left = (double)content.GetValue(Canvas.LeftProperty);
2558
            if (double.IsNaN(left))
2559
                left = 0.0;
2560
            SetValue(Canvas.TopProperty, top);
2561
            SetValue(Canvas.LeftProperty, left);
2562

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

    
2603
        private void drawControlBorder(object sender)
2604
        {
2605
            System.Windows.Controls.Control control = (System.Windows.Controls.Control)sender;
2606
        }
2607

    
2608
        private void ResizeThumb_DragDelta(object sender, MouseButtonEventArgs e)
2609
        {
2610
            System.Windows.Controls.Control designerItem = (System.Windows.Controls.Control)sender;
2611
            if (designerItem != null)
2612
            {
2613
                double deltaVertical, deltaHorizontal;
2614

    
2615
                switch (VerticalAlignment)
2616
                {
2617
                    case VerticalAlignment.Bottom:
2618
                        deltaVertical = designerItem.ActualHeight - designerItem.MinHeight;
2619
                        designerItem.Height -= deltaVertical;
2620
                        break;
2621
                    case VerticalAlignment.Top:
2622
                        deltaVertical = designerItem.ActualHeight - designerItem.MinHeight;
2623
                        Canvas.SetTop(designerItem, Canvas.GetTop(designerItem) + deltaVertical);
2624
                        designerItem.Height -= deltaVertical;
2625
                        break;
2626
                    default:
2627
                        break;
2628
                }
2629

    
2630
                switch (HorizontalAlignment)
2631
                {
2632
                    case HorizontalAlignment.Left:
2633
                        deltaHorizontal = designerItem.ActualWidth - designerItem.MinWidth;
2634
                        Canvas.SetLeft(designerItem, Canvas.GetLeft(designerItem) + deltaHorizontal);
2635
                        designerItem.Width -= deltaHorizontal;
2636
                        break;
2637
                    case HorizontalAlignment.Right:
2638
                        deltaHorizontal = designerItem.ActualWidth - designerItem.MinWidth;
2639
                        designerItem.Width -= deltaHorizontal;
2640
                        break;
2641
                    default:
2642
                        break;
2643
                }
2644
            }
2645
            e.Handled = true;
2646
        }
2647

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

    
2650
        void ExportMethod()
2651
        {
2652
            //FileDialogFilter filterImage = new FileDialogFilter("Image Files", "*.jpg", "*.png");
2653
            SaveDig.Filter = "PDF file format|*.pdf";
2654
            SaveDig.Title = "Save an DWG File";
2655
            SaveDig.ShowDialog();
2656
        }
2657

    
2658
        private void cbAutoSave_Checked(object sender, RoutedEventArgs e)
2659
        {            
2660
            if (cbAutoSave.IsChecked == true)
2661
            {
2662
                SaveTime(true, (int)cbSaveInterval.Value);
2663
            }
2664
            else
2665
            {
2666
                SaveTime(false, (int)cbSaveInterval.Value);
2667
            }
2668
        }
2669
        private void cbSaveInterval_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
2670
        {
2671
            if(string.IsNullOrEmpty(cbSaveInterval.Value.ToString()))
2672
            {
2673
                cbSaveInterval.Value = cbSaveInterval.Minimum;
2674
            }
2675
            if (cbAutoSave.IsChecked == true)
2676
            {
2677
                SaveTime(true, (int)cbSaveInterval.Value);
2678
            }
2679

    
2680
            KCOM.Properties.Settings.Default.SaveInterval = (double)cbSaveInterval.Value;
2681
            Properties.Settings.Default.Save();
2682
        }
2683
        //강인구 자동 저장 추가
2684
        private void AutoSave(object sender, RoutedEventArgs e)
2685
        {
2686
            RadToggleButton instanceToggle = sender as RadToggleButton;
2687

    
2688
            if(instanceToggle.IsChecked == true)
2689
            {
2690
                SaveTime(true);
2691
            }
2692
            else
2693
            {
2694
                SaveTime(false);
2695
            }
2696
        }
2697

    
2698
        public void Copy_Start()
2699
        {
2700
            if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
2701
            {
2702
                string MarkupData = "";
2703

    
2704
                foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
2705
                {
2706
                    if (item.GetType().Name == "AdornerFinal")
2707
                    {
2708
                        foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
2709

    
2710
                        {
2711
                            if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
2712
                            {
2713
                                markupReturn = MarkupParser.MarkupToString(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo, App.ViewInfo.UserID);
2714
                                MarkupData += "|OR|" + markupReturn.ConvertData;
2715
                            }
2716
                        }
2717
                        Clipboard.SetText(MarkupData);
2718
                    }
2719
                }
2720
            }
2721
        }
2722

    
2723
        public void Cut_Start()
2724
        {
2725
            if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
2726
            {
2727
                foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
2728
                {
2729
                    string MarkupData = "";
2730

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

    
2749
        public void Paste_Start()
2750
        {
2751
            //마크업 붙여넣기
2752
            //if (Clipboard.GetText().Contains("|DZ|"))
2753
            if (Clipboard.GetText().Contains("|OR||DZ|"))
2754
            {
2755
                List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>();
2756

    
2757
                string[] delimiterChars = { "|OR|" };
2758
                string[] data = Clipboard.GetText().Split(delimiterChars, StringSplitOptions.RemoveEmptyEntries);
2759

    
2760
                SelectionSet.Instance.UnSelect(this.ParentOfType<MainWindow>().dzMainMenu);
2761

    
2762
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
2763

    
2764
                //강인구 Undo/Redo 보류
2765
                UndoData = new Undo_data()
2766
                {
2767
                    IsUndo = false,
2768
                    Event = Event_Type.Create,
2769
                    EventTime = DateTime.Now,
2770
                    Markup_List = new List<Multi_Undo_data>()
2771
                };
2772

    
2773
                ViewerDataModel.Instance.UndoDataList.Where(data1 => data1.IsUndo == true).ToList().ForEach(i =>
2774
                {
2775
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
2776
                });
2777

    
2778
                foreach (string parse in data)
2779
                {
2780
                    if (parse != "")
2781
                    {
2782
                        System.Windows.Controls.Control item = MarkupParser.ParseEx(App.ViewInfo.ProjectNO, parse, ViewerDataModel.Instance.MarkupControls_USER, string.Empty, string.Empty);
2783
                        (item as MarkupToPDF.Common.CommentUserInfo).CommentID = Commons.shortGuid();
2784

    
2785
                        ViewerDataModel.Instance.MarkupControls.Remove(item as MarkupToPDF.Common.CommentUserInfo);
2786
                        ViewerDataModel.Instance.MarkupControls_USER.Remove(item as MarkupToPDF.Common.CommentUserInfo);
2787

    
2788
                        adornerSet.Add(item as MarkupToPDF.Common.CommentUserInfo);
2789

    
2790
                        //Controls.AdornerFinal final = new Controls.AdornerFinal(item as MarkupToPDF.Common.CommentUserInfo);
2791
                        //this.dzMainMenu.SelectLayer.Children.Add(final);
2792

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

    
2795
                        UndoData.Markup_List.Add(multi_Undo_Data);
2796
                        ViewerDataModel.Instance.UndoDataList.Add(UndoData);                        
2797
                    }
2798
                }
2799
                Controls.AdornerFinal final = new Controls.AdornerFinal(adornerSet);
2800

    
2801
                if(this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.X < 0)
2802
                {
2803
                    Canvas.SetLeft(final, 0);
2804
                    Canvas.SetTop(final, 0);
2805
                }
2806
                else
2807
                {
2808
                    double realPointX = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.X - final.BorderSize.X - (final.BorderSize.Width / 2);
2809
                    double realPointY = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.Y - final.BorderSize.Y - (final.BorderSize.Height / 2);
2810
                    final.TranslateItems(realPointX, realPointY);
2811

    
2812
                    if (final.Members.Where(type => type.Drawingtype == MarkupToPDF.Controls.Common.ControlType.TextControl).FirstOrDefault() != null)
2813
                    {
2814
                        final.TranslateItems(0.001, 0.001); //dummy
2815
                    }
2816

    
2817
                }
2818
                
2819

    
2820
                this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Add(final);
2821

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

    
2833
                    //강인구 Undo/Redo 보류
2834
                    UndoData = new Undo_data()
2835
                    {
2836
                        IsUndo = false,
2837
                        Event = Event_Type.Create,
2838
                        EventTime = DateTime.Now,
2839
                        Markup_List = new List<Multi_Undo_data>()
2840
                    };
2841

    
2842

    
2843
                    string temppath = System.IO.Path.GetTempPath();
2844
                    //string filename = KCOM.Events.Save.shortCommentKey();
2845
                    string filename = Commons.shortFileKey();
2846

    
2847
                    System.Drawing.Image clipboardImage = System.Windows.Forms.Clipboard.GetImage();
2848
                    clipboardImage.Save(temppath + "\\" + filename);
2849

    
2850
                    System.IO.FileInfo fileInfo = new System.IO.FileInfo(temppath + "\\" + filename);
2851
                    String strFile = System.IO.Path.GetFileName(fileInfo.FullName);
2852
                    long numByte = fileInfo.Length;
2853
                    double dLen = Convert.ToDouble(fileInfo.Length / 1000000);
2854
                    kr.co.devdoftech.cloud.FileUpload fileUploader = new kr.co.devdoftech.cloud.FileUpload();
2855

    
2856
                    if (dLen < 4)
2857
                    {
2858
                        System.IO.FileStream fStream = new System.IO.FileStream(fileInfo.FullName,
2859
                        System.IO.FileMode.Open, System.IO.FileAccess.Read);
2860
                        System.IO.BinaryReader br = new System.IO.BinaryReader(fStream);
2861
                        byte[] data = br.ReadBytes((int)numByte);
2862

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

    
2875
                    fileInfo.Delete();
2876

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

    
2900
                    var currentControl = new MarkupToPDF.Controls.Etc.ImgControl
2901
                    {
2902
                        PointSet = new List<Point>(),
2903
                        //FilePath = img.Source.ToString(),
2904
                        FilePath = filename,
2905
                        ImageData = img.Source,
2906
                        StartPoint = new Point(100, 100),
2907
                        EndPoint = new Point(200, 200),
2908
                        TopRightPoint = new Point(100, 200),
2909
                        LeftBottomPoint = new Point(200, 100)
2910
                    };
2911

    
2912
                    currentControl.TopRightPoint = new Point(currentControl.StartPoint.X + clipboardImage.Width, currentControl.StartPoint.Y);
2913
                    currentControl.LeftBottomPoint = new Point(currentControl.StartPoint.X, currentControl.StartPoint.Y + clipboardImage.Height);
2914
                    currentControl.EndPoint = new Point(currentControl.StartPoint.X + clipboardImage.Width, currentControl.StartPoint.Y + clipboardImage.Height);
2915

    
2916
                    currentControl.PointSet = new List<Point>
2917
                                        {
2918
                                            currentControl.StartPoint,
2919
                                            currentControl.LeftBottomPoint,
2920
                                            currentControl.EndPoint,
2921
                                            currentControl.TopRightPoint,
2922
                                        };
2923

    
2924
                    multi_Undo_Data = this.ParentOfType<MainWindow>().dzMainMenu.Control_Style(currentControl as MarkupToPDF.Common.CommentUserInfo);
2925
                    UndoData.Markup_List.Add(multi_Undo_Data);
2926
                    ViewerDataModel.Instance.UndoDataList.Add(UndoData);
2927

    
2928
                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl as MarkupToPDF.Common.CommentUserInfo);
2929
                    currentControl.CommentID = Commons.shortGuid();
2930

    
2931
                    currentControl.ApplyTemplate();
2932
                    currentControl.SetImage();
2933

    
2934
                    ViewerDataModel.Instance.MarkupControls_USER.Remove(currentControl as MarkupToPDF.Common.CommentUserInfo);
2935
                    Controls.AdornerFinal final = new Controls.AdornerFinal(currentControl as MarkupToPDF.Common.CommentUserInfo);
2936
                    this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Add(final);
2937

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