프로젝트

일반

사용자정보

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

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

이력 | 보기 | 이력해설 | 다운로드 (143 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
                // update mylist and gridview
333
                menu.UpdateMyMarkupList();
334

    
335
                SelectionSet.Instance.UnSelect(this.ParentOfType<MainWindow>().dzMainMenu);
336

    
337
                this.ParentOfType<MainWindow>().dzMainMenu.InkControl_Convert();
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.InkControl_Convert();
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).MemberSet.Cast<Controls.AdornerMember>())
540
                            {
541
                                AdonerList.Add(InnerItem);
542
                            }
543
                        }
544
                    }
545
                }
546
            }
547
            return AdonerList;
548
        }
549
        /// <summary>
550
        /// 투명도
551
        /// </summary>
552
        /// <param name="sender"></param>
553
        /// <param name="e"></param>
554
        //강인구 추가(Undo End)
555
        private void sdOpacity_ValueChanged(object sender, RoutedEventArgs e)
556
        {
557
            List<AdornerMember> AdonerList = GetAdornerItem();
558
            if(AdonerList.Count > 0)
559
            {
560
                Undo_data UndoData = new Undo_data()
561
                {
562
                    IsUndo = false,
563
                    Event = Event_Type.Option,
564
                    EventTime = DateTime.Now,
565
                    Opacity = ViewerDataModel.Instance.ControlOpacity,
566
                    Markup_List = new List<Multi_Undo_data>()
567
                };
568
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
569

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

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

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

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

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

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

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

    
712

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
1224
        //추가페이지 이동 엔터
1225
        private void tlcurrentPage_KeyDown(object sender, KeyEventArgs e)
1226
        {
1227
            //강인구 추가 tlcurrentPage을 이상하게 입력할수 있기때문에 Try Catch
1228
            if (e.Key == Key.Enter)
1229
            {
1230
                try
1231
                {
1232
                    var instanceMain = this.ParentOfType<MainWindow>();
1233
                    instanceMain.dzMainMenu.pageNavigator.GotoPage(Convert.ToInt32(tlcurrentPage.Text));
1234
                }
1235
                catch (Exception)
1236
                {
1237
                    RadWindow.Alert(new DialogParameters
1238
                    {
1239
                        Owner = Application.Current.MainWindow,
1240
                        Theme = new VisualStudio2013Theme(),
1241
                        Header = "안내",
1242
                        Content = "페이지 번호를 정확하게 입력해 주세요",
1243
                    });
1244
                }
1245
                
1246
            }
1247
        }
1248

    
1249
        private void tlcurrentPage_readonly_KeyDown(object sender, KeyEventArgs e)
1250
        {
1251
            //강인구 추가 tlcurrentPage을 이상하게 입력할수 있기때문에 Try Catch
1252
            if (e.Key == Key.Enter)
1253
            {
1254
                try
1255
                {
1256
                    var instanceMain = this.ParentOfType<MainWindow>();
1257
                    instanceMain.dzMainMenu.pageNavigator.GotoPage(Convert.ToInt32(tlcurrentPage_readonly.Text));
1258
                }
1259
                catch (Exception)
1260
                {
1261
                    RadWindow.Alert(new DialogParameters
1262
                    {
1263
                        Owner = Application.Current.MainWindow,
1264
                        Theme = new VisualStudio2013Theme(),
1265
                        Header = "안내",
1266
                        Content = "페이지 번호를 정확하게 입력해 주세요",
1267
                    });
1268
                }
1269

    
1270
            }
1271
        }
1272
        
1273

    
1274
        //public event EventHandler<WindowClosedEventArgs> Closed;
1275

    
1276
        //private void CheckEvent(object sender, RoutedEventArgs e)
1277
        //{
1278
        //    RadWindow CheckPop = new RadWindow();
1279
        //    test check = new test();
1280

    
1281
        //    CheckPop = new RadWindow
1282
        //    {
1283
        //        Width = 1700,
1284
        //        Height = 510,
1285
        //        Header = "My Check List",
1286
        //        Content = check,
1287
        //        Owner = this,
1288
        //        ResizeMode = System.Windows.ResizeMode.NoResize,
1289
        //        WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen,
1290
        //    };
1291
        //    StyleManager.SetTheme(CheckPop, new VisualStudio2013Theme());
1292

    
1293
        //    CheckPop.Closed += CheckPop_Closed;
1294
        //    CheckPop.ShowDialog();
1295
        //}
1296

    
1297
        private void PanoramaEvent(object sender, RoutedEventArgs e)
1298
        {
1299
            PanoramaShow();
1300
        }
1301

    
1302
        public void PanoramaShow()
1303
        {
1304
            Panorama check = new Panorama();
1305
            double screenWidth = System.Windows.SystemParameters.PrimaryScreenWidth;
1306
            double screenHeight = System.Windows.SystemParameters.PrimaryScreenHeight;
1307
            //double windowWidth = this.Width;
1308
            //double windowHeight = this.Height;
1309

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

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

    
1348
                isClosed = false;
1349

    
1350
                
1351
                CheckList check = new CheckList();
1352

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

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

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

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

    
1429
        private void viewEvent(object sender, RoutedEventArgs e)
1430
        {
1431
            RadRibbonToggleButton viewButton = sender as RadRibbonToggleButton;
1432
            var instanceMain = this.ParentOfType<MainWindow>();
1433

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

    
1436
            //if ((sender as RadRibbonToggleButton) != null)
1437
            //{
1438
            //    Common.ViewerDataModel.Instance.ControlTag = (sender as RadRibbonToggleButton).Tag.ToString();
1439
            //    instanceToggle = (sender as RadRibbonToggleButton);
1440
            //}
1441

    
1442
            //instanceToggle.IsChecked = false;
1443

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

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

    
1509
        private void Control_Event(object sender, RoutedEventArgs e)
1510
        {
1511

    
1512
        }
1513

    
1514
        #region 대기
1515

    
1516
        public void drawingPannelRotate(bool Flag)
1517
        {
1518
            var instanceMain = this.ParentOfType<MainWindow>();
1519

    
1520
            //if (rotateOffSet > 3)
1521
            //    rotateOffSet = 0;
1522

    
1523
            //if (rotateOffSet < 0)
1524
            //    rotateOffSet = 3;
1525

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

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

    
1579
            //instanceMain.dzMainMenu.zoomAndPanControl.RenderTransformOrigin = new Point(0.5, 0.5);
1580
            instanceMain.dzMainMenu.zoomAndPanControl.RotationAngle = instanceMain.dzMainMenu.rotate.Angle;
1581
            //대기(강인구)
1582
            //instanceMain.dzMainMenu.imageViewer.RotateAngle = instanceMain.dzMainMenu.rotate.Angle;
1583

    
1584

    
1585
            //instanceMain.dzMainMenu.imageViewer.RenderTransformOrigin = new Point(0.5, 0.5);
1586
            //RotateTransform rotateTransform = new RotateTransform(instanceMain.dzMainMenu.rotate.Angle);
1587
            //instanceMain.dzMainMenu.imageViewer.RenderTransform = rotateTransform;
1588

    
1589

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

    
1601

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

    
1607
                instanceMain.dzMainMenu.pageNavigator.ImgListbox.ItemsSource = instanceMain.dzMainMenu.pageNavigator._thumbnailItems;
1608
                var instance = instanceMain.dzMainMenu.CurrentDoc.docInfo.DOCPAGE.Where(p => p.PAGE_NUMBER == instanceMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber).FirstOrDefault();
1609
                instance.PAGE_ANGLE = int.Parse(instanceMain.dzMainMenu.rotate.Angle.ToString());
1610

    
1611
                instanceMain.dzMainMenu.pageNavigator.setPageChange(data);
1612

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

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

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

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

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

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

    
1657
                        Check_Uri.UriCheck(filepath);
1658

    
1659
                        instanceMain.dzMainMenu.filename = filepath;
1660

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

    
1681
        private void Control_Init(RadToggleButton instanceToggle, object sender)
1682
        {
1683

    
1684
        }
1685

    
1686
        private void ControlEvent(object sender, RoutedEventArgs e)
1687
        {
1688
            RadToggleButton instanceToggle = sender as RadToggleButton;
1689
            var instanceMain = this.ParentOfType<MainWindow>();
1690

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

    
1711
            //if (!instanceMain.IsFreeSelectionMode)
1712
            //{
1713
            //    instanceMain.IsSwingMode = true;
1714
            //}
1715

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

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

    
1729
            if (instanceToggle != null)
1730
            {
1731
                Common.ViewerDataModel.Instance.ControlTag = instanceToggle.Tag.ToString();
1732
            }
1733
            else if ((sender as RadRibbonToggleButton) != null)
1734
            {
1735
                Common.ViewerDataModel.Instance.ControlTag = (sender as RadRibbonToggleButton).Tag.ToString();
1736
                instanceToggle = (sender as RadRibbonToggleButton);
1737
            }
1738
            else if ((sender as RadRibbonButton) != null)
1739
            {
1740
                RadRibbonButton instanceButton = sender as RadRibbonButton;
1741
                Common.ViewerDataModel.Instance.ControlTag = instanceButton.Tag.ToString();
1742
            }
1743
            else
1744
            {
1745
                RadButton instanceButton = sender as RadButton;
1746
                Common.ViewerDataModel.Instance.ControlTag = instanceButton.Tag.ToString();
1747
            }
1748

    
1749

    
1750

    
1751
            System.Reactive.Linq.Observable2.FromPropertyChangedPattern(Common.ViewerDataModel.Instance, temp => temp.AngleVisibility).Subscribe(isSee =>
1752
            {
1753
                instanceMain.dzMainMenu.MainAngle.Visibility = isSee;
1754
                System.Reactive.Linq.Observable2.FromPropertyChangedPattern(Common.ViewerDataModel.Instance, temp => temp.AngleValue).Subscribe(p =>
1755
                {
1756
                    instanceMain.dzMainMenu.MainAngle.AngleValue = p;
1757
                });
1758
            });
1759
            instanceMain.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Drawing;
1760

    
1761
            instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = false;
1762

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

    
1988
                        //instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = true;
1989

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

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

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

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

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

    
2220

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

    
2241
                        if (this.ParentOfType<MainWindow>().dzMainMenu.currentControl != null)
2242
                        {
2243
                            ViewerDataModel.Instance.MarkupControls_USER.Remove(this.ParentOfType<MainWindow>().dzMainMenu.currentControl);
2244
                            this.ParentOfType<MainWindow>().dzMainMenu.currentControl = null;
2245
                        }
2246

    
2247
                        ViewerDataModel.Instance.SelectedControl = "ImgControl";
2248
                   //     ViewerDataModel.Instance.ControlTag = null;
2249
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ImgControl;
2250

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

    
2264
                            }
2265
                            else
2266
                            {
2267
                                (Application.Current.MainWindow as MainWindow).dzTopMenu.RefactoryCommentReact(menu);
2268
                            }
2269
                        }*/
2270

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

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

    
2332
                            isClosed = false;
2333
                            CadResultViewer check = new CadResultViewer();
2334
                            check.WindowStartupLocation = WindowStartupLocation.CenterScreen;
2335
                            check.Title = "Viewer";
2336
                            check.Show();
2337

    
2338
                            check.Closed += Check_Closed;
2339

    
2340
                        }
2341
                        break;
2342
                    #endregion
2343
                    default:
2344
                        break;
2345
                }
2346
                #endregion
2347
            }
2348
            else
2349
            {
2350

    
2351
                if (!instanceMain.dzMainMenu.IsFreeSelectionMode)
2352
                {
2353
                    instanceMain.dzMainMenu.IsSwingMode = false;
2354
                    Common.ViewerDataModel.Instance.SelectedControl = "";
2355
                    Common.ViewerDataModel.Instance.ControlTag = null;
2356
                    this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2357
                    this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2358
                }
2359
            }
2360
        }
2361

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

    
2383
        }
2384

    
2385
        Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
2386
        CommentUserInfo currentControl { get; set; }
2387
        private Point GetSquareEndPoint(Point StartP, Point EndP)
2388
        {
2389
            Point Return_Point = new Point();
2390
            double dx = EndP.X - StartP.X;
2391
            double dy = EndP.Y - StartP.Y;
2392
            double length;
2393
            length = Math.Max(Math.Abs(dx), Math.Abs(dy));
2394
            Return_Point.X = (dx > 0) ? StartP.X + length : StartP.X - length;
2395
            Return_Point.Y = (dy > 0) ? StartP.Y + length : StartP.Y - length;
2396
            return Return_Point;
2397
        }
2398
        private void Check_Closed(object sender, EventArgs e)
2399
        {
2400
            isClosed = true;
2401
            //this.ParentOfType<MainWindow>().dzMainMenu.PN_Navi.IsEnabled = true;
2402
            //토글 및 마우스 상태 초기화
2403
            var toggleList = this.Parent.ChildrenOfType<RadToggleButton>();
2404
            foreach (var togle in toggleList)
2405
            {
2406
                togle.IsChecked = false;
2407
            }
2408
            this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2409
            ViewerDataModel.Instance.Capture_Opacity = 0;
2410

    
2411
        }
2412

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

    
2423
            string[] data = new string[0];
2424

    
2425
            int cnt = 0;
2426
            var menu = this.ParentOfType<MainWindow>().dzMainMenu;
2427

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

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

    
2444
            if (data != null)
2445
            {
2446
                string FilePath = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\Cad");
2447
                string FileName = FilePath + "\\commentstring.json"; // Default file name
2448
                if (!File.Exists(FilePath))
2449
                {
2450
                    Directory.CreateDirectory(FilePath);
2451
                }
2452

    
2453
                if (!string.IsNullOrEmpty(FileName))
2454
                {
2455
                    //  File.WriteAllText(SaveDig.FileName, data);
2456
                    File.WriteAllLines(FileName, data);
2457
                }
2458
            }
2459
        }
2460

    
2461
        private double minHeight;
2462
        private double minWidth;
2463

    
2464
        private double maxHeight;
2465
        private double maxWidth;
2466

    
2467
        public bool CanVResize { get; private set; }
2468
        public bool CanHResize { get; private set; }
2469

    
2470
        public void DesignerComponent(FrameworkElement content)
2471
        {
2472
            this.InitializeComponent();
2473

    
2474
            if (!double.IsNaN(content.Width))
2475
            {
2476
                CanHResize = false;
2477
                this.Width = content.Width;
2478
            }
2479
            else
2480
            {
2481
                CanHResize = true;
2482
                this.Width = 23.0;
2483
            }
2484
            if (!double.IsNaN(content.Height))
2485
            {
2486
                CanVResize = false;
2487
                this.Height = content.Height; ;
2488
            }
2489
            else
2490
            {
2491
                CanVResize = true;
2492
                this.Height = 23.0;
2493
            }
2494

    
2495
            minWidth = content.MinWidth < 10.0 ? 10.0 : content.MinWidth;
2496
            minHeight = content.MinHeight < 10.0 ? 10.0 : content.MinHeight;
2497
            maxWidth = content.MaxWidth;
2498
            maxHeight = content.MaxHeight;
2499

    
2500
            double top = (double)content.GetValue(Canvas.TopProperty);
2501
            if (double.IsNaN(top))
2502
                top = 0.0;
2503
            double left = (double)content.GetValue(Canvas.LeftProperty);
2504
            if (double.IsNaN(left))
2505
                left = 0.0;
2506
            SetValue(Canvas.TopProperty, top);
2507
            SetValue(Canvas.LeftProperty, left);
2508

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

    
2549
        private void drawControlBorder(object sender)
2550
        {
2551
            System.Windows.Controls.Control control = (System.Windows.Controls.Control)sender;
2552
        }
2553

    
2554
        private void ResizeThumb_DragDelta(object sender, MouseButtonEventArgs e)
2555
        {
2556
            System.Windows.Controls.Control designerItem = (System.Windows.Controls.Control)sender;
2557
            if (designerItem != null)
2558
            {
2559
                double deltaVertical, deltaHorizontal;
2560

    
2561
                switch (VerticalAlignment)
2562
                {
2563
                    case VerticalAlignment.Bottom:
2564
                        deltaVertical = designerItem.ActualHeight - designerItem.MinHeight;
2565
                        designerItem.Height -= deltaVertical;
2566
                        break;
2567
                    case VerticalAlignment.Top:
2568
                        deltaVertical = designerItem.ActualHeight - designerItem.MinHeight;
2569
                        Canvas.SetTop(designerItem, Canvas.GetTop(designerItem) + deltaVertical);
2570
                        designerItem.Height -= deltaVertical;
2571
                        break;
2572
                    default:
2573
                        break;
2574
                }
2575

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

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

    
2596
        void ExportMethod()
2597
        {
2598
            //FileDialogFilter filterImage = new FileDialogFilter("Image Files", "*.jpg", "*.png");
2599
            SaveDig.Filter = "PDF file format|*.pdf";
2600
            SaveDig.Title = "Save an DWG File";
2601
            SaveDig.ShowDialog();
2602
        }
2603

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

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

    
2634
            if(instanceToggle.IsChecked == true)
2635
            {
2636
                SaveTime(true);
2637
            }
2638
            else
2639
            {
2640
                SaveTime(false);
2641
            }
2642
        }
2643

    
2644
        public void Copy_Start()
2645
        {
2646
            if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
2647
            {
2648
                string MarkupData = "";
2649

    
2650
                foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
2651
                {
2652
                    if (item.GetType().Name == "AdornerFinal")
2653
                    {
2654
                        foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
2655

    
2656
                        {
2657
                            if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
2658
                            {
2659
                                markupReturn = MarkupParser.MarkupToString(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo, App.ViewInfo.UserID);
2660
                                MarkupData += "|OR|" + markupReturn.ConvertData;
2661
                            }
2662
                        }
2663
                        Clipboard.SetText(MarkupData);
2664
                    }
2665
                }
2666
            }
2667
        }
2668

    
2669
        public void Cut_Start()
2670
        {
2671
            if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
2672
            {
2673
                foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
2674
                {
2675
                    string MarkupData = "";
2676

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

    
2695
        public void Paste_Start()
2696
        {
2697
            //마크업 붙여넣기
2698
            //if (Clipboard.GetText().Contains("|DZ|"))
2699
            if (Clipboard.GetText().Contains("|OR||DZ|"))
2700
            {
2701
                List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>();
2702

    
2703
                string[] delimiterChars = { "|OR|" };
2704
                string[] data = Clipboard.GetText().Split(delimiterChars, StringSplitOptions.RemoveEmptyEntries);
2705

    
2706
                SelectionSet.Instance.UnSelect(this.ParentOfType<MainWindow>().dzMainMenu);
2707

    
2708
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
2709

    
2710
                //강인구 Undo/Redo 보류
2711
                UndoData = new Undo_data()
2712
                {
2713
                    IsUndo = false,
2714
                    Event = Event_Type.Create,
2715
                    EventTime = DateTime.Now,
2716
                    Markup_List = new List<Multi_Undo_data>()
2717
                };
2718

    
2719
                ViewerDataModel.Instance.UndoDataList.Where(data1 => data1.IsUndo == true).ToList().ForEach(i =>
2720
                {
2721
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
2722
                });
2723

    
2724
                foreach (string parse in data)
2725
                {
2726
                    if (parse != "")
2727
                    {
2728
                        System.Windows.Controls.Control item = MarkupParser.ParseEx(App.ViewInfo.ProjectNO, parse, ViewerDataModel.Instance.MarkupControls_USER, string.Empty, string.Empty);
2729
                        (item as MarkupToPDF.Common.CommentUserInfo).CommentID = Commons.shortGuid();
2730

    
2731
                        ViewerDataModel.Instance.MarkupControls.Remove(item as MarkupToPDF.Common.CommentUserInfo);
2732
                        ViewerDataModel.Instance.MarkupControls_USER.Remove(item as MarkupToPDF.Common.CommentUserInfo);
2733

    
2734
                        adornerSet.Add(item as MarkupToPDF.Common.CommentUserInfo);
2735

    
2736
                        //Controls.AdornerFinal final = new Controls.AdornerFinal(item as MarkupToPDF.Common.CommentUserInfo);
2737
                        //this.dzMainMenu.SelectLayer.Children.Add(final);
2738

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

    
2741
                        UndoData.Markup_List.Add(multi_Undo_Data);
2742
                        ViewerDataModel.Instance.UndoDataList.Add(UndoData);                        
2743
                    }
2744
                }
2745
                Controls.AdornerFinal final = new Controls.AdornerFinal(adornerSet);
2746

    
2747
                if(this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.X < 0)
2748
                {
2749
                    Canvas.SetLeft(final, 0);
2750
                    Canvas.SetTop(final, 0);
2751
                }
2752
                else
2753
                {
2754
                    double realPointX = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.X - final.BorderSize.X - (final.BorderSize.Width / 2);
2755
                    double realPointY = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.Y - final.BorderSize.Y - (final.BorderSize.Height / 2);
2756
                    final.MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(realPointX, realPointY));
2757

    
2758
                    if (final.MemberSet.Where(type => type.Drawingtype == MarkupToPDF.Controls.Common.ControlType.TextControl).FirstOrDefault() != null)
2759
                    {
2760
                        final.MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(0.001, 0.001)); //dummy
2761
                    }
2762

    
2763
                }
2764
                
2765

    
2766
                this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Add(final);
2767

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

    
2779
                    //강인구 Undo/Redo 보류
2780
                    UndoData = new Undo_data()
2781
                    {
2782
                        IsUndo = false,
2783
                        Event = Event_Type.Create,
2784
                        EventTime = DateTime.Now,
2785
                        Markup_List = new List<Multi_Undo_data>()
2786
                    };
2787

    
2788

    
2789
                    string temppath = System.IO.Path.GetTempPath();
2790
                    //string filename = KCOM.Events.Save.shortCommentKey();
2791
                    string filename = Commons.shortFileKey();
2792

    
2793
                    System.Drawing.Image clipboardImage = System.Windows.Forms.Clipboard.GetImage();
2794
                    clipboardImage.Save(temppath + "\\" + filename);
2795

    
2796
                    System.IO.FileInfo fileInfo = new System.IO.FileInfo(temppath + "\\" + filename);
2797
                    String strFile = System.IO.Path.GetFileName(fileInfo.FullName);
2798
                    long numByte = fileInfo.Length;
2799
                    double dLen = Convert.ToDouble(fileInfo.Length / 1000000);
2800
                    kr.co.devdoftech.cloud.FileUpload fileUploader = new kr.co.devdoftech.cloud.FileUpload();
2801

    
2802
                    if (dLen < 4)
2803
                    {
2804
                        System.IO.FileStream fStream = new System.IO.FileStream(fileInfo.FullName,
2805
                        System.IO.FileMode.Open, System.IO.FileAccess.Read);
2806
                        System.IO.BinaryReader br = new System.IO.BinaryReader(fStream);
2807
                        byte[] data = br.ReadBytes((int)numByte);
2808

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

    
2821
                    fileInfo.Delete();
2822

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

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

    
2858
                    currentControl.TopRightPoint = new Point(currentControl.StartPoint.X + clipboardImage.Width, currentControl.StartPoint.Y);
2859
                    currentControl.LeftBottomPoint = new Point(currentControl.StartPoint.X, currentControl.StartPoint.Y + clipboardImage.Height);
2860
                    currentControl.EndPoint = new Point(currentControl.StartPoint.X + clipboardImage.Width, currentControl.StartPoint.Y + clipboardImage.Height);
2861

    
2862
                    currentControl.PointSet = new List<Point>
2863
                                        {
2864
                                            currentControl.StartPoint,
2865
                                            currentControl.LeftBottomPoint,
2866
                                            currentControl.EndPoint,
2867
                                            currentControl.TopRightPoint,
2868
                                        };
2869

    
2870
                    multi_Undo_Data = this.ParentOfType<MainWindow>().dzMainMenu.Control_Style(currentControl as MarkupToPDF.Common.CommentUserInfo);
2871
                    UndoData.Markup_List.Add(multi_Undo_Data);
2872
                    ViewerDataModel.Instance.UndoDataList.Add(UndoData);
2873

    
2874
                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl as MarkupToPDF.Common.CommentUserInfo);
2875
                    currentControl.CommentID = Commons.shortGuid();
2876

    
2877
                    currentControl.ApplyTemplate();
2878
                    currentControl.SetImage();
2879

    
2880
                    ViewerDataModel.Instance.MarkupControls_USER.Remove(currentControl as MarkupToPDF.Common.CommentUserInfo);
2881
                    Controls.AdornerFinal final = new Controls.AdornerFinal(currentControl as MarkupToPDF.Common.CommentUserInfo);
2882
                    this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Add(final);
2883

    
2884
                    double realPointX = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.X - final.BorderSize.X - (final.BorderSize.Width / 2);
2885
                    double realPointY = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.Y - final.BorderSize.Y - (final.BorderSize.Height / 2);
2886
                    final.MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(realPointX, realPointY));
2887
                }
2888
                catch(Exception ex)
2889
                {
2890
                    this.ParentOfType<MainWindow>().DialogMessage_Alert("" + ex, "Alert");
2891
                }
2892
            }
2893
        }
2894
    }
2895
}
클립보드 이미지 추가 (최대 크기: 500 MB)