프로젝트

일반

사용자정보

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

markus / KCOM / Events / Implementation / TopMenuEvent.cs @ 33df85e7

이력 | 보기 | 이력해설 | 다운로드 (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

    
38
        /// <summary>
39
        /// TaskBar에 메시지를 입력합니다
40
        /// </summary>
41
        /// <param name="message"></param>
42
        /// <param name="type"></param>
43
        public void TaskMessage(string message, TaskMessageType type)
44
        {
45
            /*
46
            if (taskBar != null)
47
            {
48
                string color = "";
49
                taskBar.Content = message;
50
                DicTaskMessage.TryGetValue(type, out color);
51
                taskBar.Foreground = new SolidColorBrush(StringToColorConverter.Parse(color));
52
            }
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
        private void SetHighlightEvent()
126
        {
127
            List<AdornerMember> AdonerList = GetAdornerItem();
128

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

    
149
        }
150

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

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

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

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

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

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

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

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

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

    
295
            this.ParentOfType<MainWindow>().dzMainMenu.busyIndicator.IsBusy = true;
296
            System.Threading.Tasks.Task SaveTask = System.Threading.Tasks.Task.Factory.StartNew(() =>
297
            {
298
                Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, new Action<object, RoutedEventArgs>(_SaveEvent), sender, e);
299
            }).ContinueWith(task =>
300
            {
301
                Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate () { this.ParentOfType<MainWindow>().dzMainMenu.busyIndicator.IsBusy = false; }));
302
            });
303
        }
304

    
305
        /// <summary>
306
        /// save markup
307
        ///  - convert ink control to polygon control if ink control exists
308
        ///  - unselect and update my markup list
309
        /// <param name="sender"></param>
310
        /// <param name="e"></param>
311
        public void _SaveEvent(object sender, RoutedEventArgs e)
312
        {
313
            var menu = this.ParentOfType<MainWindow>().dzMainMenu;
314
            try
315
            {
316
                menu.ConvertInkControlToPolygon();
317

    
318
                SelectionSet.Instance.UnSelect(this.ParentOfType<MainWindow>().dzMainMenu);
319
                // update mylist and gridview
320
                menu.UpdateMyMarkupList();
321

    
322
                if (menu.gridViewMarkup.SelectedItems.Count == 0 && menu.gridViewMarkup.Items.Count > 0)
323
                {
324
                    this.ParentOfType<MainWindow>().DialogMessage_Alert("Please Select Your Comment List Item", "Alert");
325
                }
326
                else
327
                {                    
328
                    foreach (var item in menu.gridViewMarkup.SelectedItems)
329
                    {
330
                        if ((item as IKCOM.MarkupInfoItem).UserID == App.ViewInfo.UserID)
331
                        {
332
                            this.ExecuteSaveCommand(menu);
333
                            ViewerDataModel.Instance._markupInfoList.Where(data => data.MarkupInfoID == (item as IKCOM.MarkupInfoItem).MarkupInfoID).FirstOrDefault().UpdateTime = DateTime.Now;
334
                            if (!ViewerDataModel.Instance.IsConsolidate && (sender != null))
335
                            {
336
                                if (ViewerDataModel.Instance.IsPressCtrl) ViewerDataModel.Instance.IsPressCtrl = false;
337
                                this.ParentOfType<MainWindow>().DialogMessage_Alert("Save 가 완료되었습니다.", "Alert");
338
                            }
339
                        }
340
                    }
341
                }
342

    
343
                ViewerDataModel.Instance.UndoDataList.Clear();
344
            }
345
            catch (Exception ex)
346
            {
347
               
348
            }
349
            finally
350
            {
351
                /*
352
                /// delete markup information when 코멘트가 없을 경우
353
                if (ViewerDataModel.Instance.MyMarkupList.Count == 0)
354
                {
355
                    foreach (var item in menu.gridViewMarkup.SelectedItems)
356
                    {
357
                        if ((item as IKCOM.MarkupInfoItem).UserID == App.ViewInfo.UserID)
358
                        {
359
                            //this.ParentOfType<MainWindow>().dzMainMenu.DeleteItem((item as IKCOM.MarkupInfoItem));
360
                        }
361
                    }
362
                }
363
                */
364
            }
365
        }
366

    
367
        /// <summary>
368
        /// call save command
369
        /// </summary>
370
        /// <param name="menu"></param>
371
		private void ExecuteSaveCommand(MainMenu menu)
372
        {
373
            SaveCommand.Instance.Project_No = App.ViewInfo.ProjectNO;
374
            SaveCommand.Instance.document_id = App.ViewInfo.DocumentItemID;
375
            SaveCommand.Instance.user_id = App.ViewInfo.UserID;
376
            SaveCommand.Instance.page_no = menu.pageNavigator.CurrentPage.PageNumber;
377

    
378
            try
379
            {
380
                if (ViewerDataModel.Instance.UndoDataList.Count > 0)
381
                {
382
                    List<IKCOM.MarkupInfoItem> SelectedMarkupInfos = new List<IKCOM.MarkupInfoItem>();
383
                    foreach (var item in menu.gridViewMarkup.SelectedItems)
384
                    {
385
                        if ((item as IKCOM.MarkupInfoItem).UserID == App.ViewInfo.UserID)
386
                        {
387
                            SelectedMarkupInfos.Add(item as IKCOM.MarkupInfoItem);
388
                        }
389
                    }
390

    
391
                    SaveCommand.Instance.Execute(SelectedMarkupInfos);
392
                }
393

    
394
                if(ViewerDataModel.Instance.RotationDocs.Count > 0)
395
                    SaveCommand.Instance.PageAngleSave(App.ViewInfo.ProjectNO, ViewerDataModel.Instance.RotationDocs);
396
            }
397
            catch (Exception ex)
398
            {
399
                this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert(string.Format("세이브 실패:{0}", ex.Message), "Alert");
400
                throw ex;
401
            }
402
        }
403

    
404
        //강인구 추가
405
        public void Print_Start(string Type)
406
        {
407
            if (ViewerDataModel.Instance.IsPressCtrl)
408
            {
409
                ViewerDataModel.Instance.IsPressCtrl = false;
410
            }
411
            if (ViewerDataModel.Instance.MarkupControls_USER.Count > 0 || this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
412
            {
413
                var menu = this.ParentOfType<MainWindow>().dzMainMenu;
414
                SelectionSet.Instance.UnSelect(menu);
415
                if (menu.PreviewUserMarkupInfoItem != null && menu.PreviewUserMarkupInfoItem.IsPreviewUser == true)
416
                {
417
                    this.SaveEventCallback(null, null);
418
                }
419
                else if (menu.gridViewMarkup.SelectedItems.Count == 0 || (menu.gridViewMarkup.SelectedItems.FirstOrDefault() as IKCOM.MarkupInfoItem).UserID != App.ViewInfo.UserID)
420
                {
421

    
422
                }
423
                else
424
                {
425
                    this.SaveEventCallback(null, null);
426
                }
427
            }
428

    
429
            bool isprint = false;
430
            if (Type == "Print")
431
            {
432
                isprint = true;
433
            }
434

    
435
            RadWindow PrintWindow = new RadWindow();
436
            //IKCOM.MarkupInfoItem _result = null;
437
            PrintWindow.Width = 850;
438
            PrintWindow.Height = 600;
439
            //PrintWindow.Width = 650;
440
            //PrintWindow.Height = 550;
441
            PrintWindow.Header = Type;
442

    
443
            List<IKCOM.MarkupInfoItem> markupinfo = new List<IKCOM.MarkupInfoItem>();
444

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

    
448
            if (markupinfo.Count() > 0)
449
            {
450
                Logger.sendResLog("GetPrintDocItemList", "TRUE", 1);
451
            }
452
            else
453
            {
454
                Logger.sendResLog("GetPrintDocItemList", "FALSE", 1);
455
            }
456

    
457
            var Tile_Url = string.Format(@"{0}/TileSource/{1}_Tile/{2}/{3}/",
458
                App.SystemInfo.HostName,
459
                App.ViewInfo.ProjectNO,
460
                (Convert.ToInt64(App.ViewInfo.DocumentItemID) / 100).ToString(),
461
                App.ViewInfo.DocumentItemID
462
                );
463

    
464
            PrintWindow.Content = new KCOM.Control.PrintControl(
465
                      Tile_Url,
466
                      App.ViewInfo.ProjectNO,
467
                      this.ParentOfType<MainWindow>().dzMainMenu._DocInfo, markupinfo,
468
                      this.ParentOfType<MainWindow>().dzMainMenu.pageNavigator.CurrentPage.PageNumber,
469
                      App.ViewInfo.DocumentItemID,
470
                      this.ParentOfType<MainWindow>().dzMainMenu._DocItem.DOCUMENT_NO,
471
                      this.ParentOfType<MainWindow>().dzMainMenu._DocItem.ORIGINAL_FILE, isprint);
472

    
473
            //프린트 팝업 옵션
474
            //PrintWindow.BorderThickness = new Thickness(3);
475
            //PrintWindow.BorderBrush = new SolidColorBrush(Color.FromArgb(255, 37, 160, 218));
476
            PrintWindow.ResizeMode = System.Windows.ResizeMode.NoResize;
477
            PrintWindow.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
478
            PrintWindow.Background = new SolidColorBrush(Colors.Black);
479
            PrintWindow.Background.Opacity = 0.6;
480
            PrintWindow.Owner = Application.Current.MainWindow;
481
            Telerik.Windows.Controls.StyleManager.SetTheme(PrintWindow, new Telerik.Windows.Controls.VisualStudio2013Theme());
482
            PrintWindow.ShowDialog();
483
        }
484

    
485
        //강인구 추가
486
        private void PrintEvent(object sender, RoutedEventArgs e)
487
        {
488
            RadRibbonButton button = sender as RadRibbonButton;
489
            Print_Start(button.Content.ToString());
490
        }
491

    
492
        private List<AdornerMember> GetAdornerItem()
493
        {
494
            List<AdornerMember> AdonerList = new List<AdornerMember>();
495

    
496
            if (this.ParentOfType<MainWindow>() != null)
497
            {
498
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
499
                {
500
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
501
                    {
502
                        if (item.GetType().Name == "AdornerFinal")
503
                        {
504
                            foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
505
                            {
506
                                AdonerList.Add(InnerItem);
507
                            }
508
                        }
509
                    }
510
                }
511
            }
512

    
513
            return AdonerList;
514
        }
515
        /// <summary>
516
        /// 투명도
517
        /// </summary>
518
        /// <param name="sender"></param>
519
        /// <param name="e"></param>
520
        //강인구 추가(Undo End)
521
        private void sdOpacity_ValueChanged(object sender, RoutedEventArgs e)
522
        {
523
            List<AdornerMember> AdonerList = GetAdornerItem();
524
            if(AdonerList.Count > 0)
525
            {
526
                Undo_data UndoData = new Undo_data()
527
                {
528
                    IsUndo = false,
529
                    Event = Event_Type.Option,
530
                    EventTime = DateTime.Now,
531
                    Opacity = ViewerDataModel.Instance.ControlOpacity,
532
                    Markup_List = new List<Multi_Undo_data>()
533
                };
534
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
535

    
536
                foreach (AdornerMember InnerItem in AdonerList)
537
                {
538
                    InnerItem.DrawingData.Opacity = ViewerDataModel.Instance.ControlOpacity;
539
                  
540
                    multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
541
                    UndoData.Markup_List.Add(multi_Undo_Data);
542
                    multi_Undo_Data = new Multi_Undo_data();
543
                }
544

    
545
                ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
546
                {
547
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
548
                });
549
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
550
            }
551
        }
552

    
553
        //강인구 추가(Undo End)
554
        private void cbLineSize_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
555
        {
556
            if (string.IsNullOrEmpty(cbLineSize.Value.ToString()))
557
            {
558
                cbLineSize.Value = cbLineSize.Minimum;
559
            }
560
            List<AdornerMember> AdonerList = GetAdornerItem();
561
            if (AdonerList.Count > 0)
562
            {
563
                Undo_data UndoData = new Undo_data()
564
                {
565
                    IsUndo = false,
566
                    Event = Event_Type.Option,
567
                    EventTime = DateTime.Now,
568
                    LineSize = ViewerDataModel.Instance.LineSize,
569
                    Markup_List = new List<Multi_Undo_data>()
570
                };
571
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
572

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

    
661
                    multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
662
                    UndoData.Markup_List.Add(multi_Undo_Data);
663
                    multi_Undo_Data = new Multi_Undo_data();
664
                }
665

    
666
                ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
667
                {
668
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
669
                });
670
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
671

    
672
                
673
            }
674
            KCOM.Properties.Settings.Default.LineSize = (double)cbLineSize.Value;
675
            Properties.Settings.Default.Save();
676
        }
677

    
678

    
679
        private void cbIntervalSize_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
680
        {
681
            if (string.IsNullOrEmpty(cbIntervalSize.Value.ToString()))
682
            {
683
                cbIntervalSize.Value = cbIntervalSize.Minimum;
684
            }
685
            List<AdornerMember> AdonerList = GetAdornerItem();
686
            if (AdonerList.Count > 0)
687
            {
688

    
689
                Undo_data UndoData = new Undo_data()
690
                {
691
                    IsUndo = false,
692
                    Event = Event_Type.Option,
693
                    EventTime = DateTime.Now,
694
                    Interval = ViewerDataModel.Instance.Interval,
695
                    Markup_List = new List<Multi_Undo_data>()
696
                };
697
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
698

    
699
                foreach (AdornerMember InnerItem in AdonerList)
700
                {
701
                    switch (InnerItem.DrawingData.GetType().Name)
702
                    {
703
                        case ("LineControl"):
704
                            {
705
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Line.LineControl).Interval = ViewerDataModel.Instance.Interval;
706

    
707
                                multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
708
                                UndoData.Markup_List.Add(multi_Undo_Data);
709
                                multi_Undo_Data = new Multi_Undo_data();
710
                            }
711
                            break;
712
                    }
713
                }
714

    
715
                ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
716
                {
717
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
718
                });
719
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
720
            }
721
            KCOM.Properties.Settings.Default.Interval = (double)cbIntervalSize.Value;
722
            Properties.Settings.Default.Save();
723
        }
724
        
725
        private void cbArcLength_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
726
        {
727
            if (string.IsNullOrEmpty(cbArcLength.Value.ToString()))
728
            {
729
                cbArcLength.Value = cbArcLength.Minimum;
730
            }
731
            List<AdornerMember> AdonerList = GetAdornerItem();
732
            if (AdonerList.Count > 0)
733
            {
734

    
735
                //Undo_data UndoData = new Undo_data()
736
                //{
737
                //    IsUndo = false,
738
                //    Event = Event_Type.Option,
739
                //    EventTime = DateTime.Now,
740
                //    Interval = ViewerDataModel.Instance.Interval,
741
                //    Markup_List = new List<Multi_Undo_data>()
742
                //};
743
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
744

    
745
                foreach (AdornerMember InnerItem in AdonerList)
746
                {
747
                    switch (InnerItem.DrawingData.GetType().Name)
748
                    {
749
                        case ("RectCloudControl"):
750
                            {
751
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.RectCloudControl).ArcLength = ViewerDataModel.Instance.ArcLength;
752

    
753
                                //multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
754
                                //UndoData.Markup_List.Add(multi_Undo_Data);
755
                                //multi_Undo_Data = new Multi_Undo_data();
756
                            }
757
                            break;
758
                        case ("CloudControl"):
759
                            {
760
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Polygon.CloudControl).ArcLength = ViewerDataModel.Instance.ArcLength;
761

    
762
                                //multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
763
                                //UndoData.Markup_List.Add(multi_Undo_Data);
764
                                //multi_Undo_Data = new Multi_Undo_data();
765
                            }
766
                            break;
767
                    }
768
                }
769

    
770
                //ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
771
                //{
772
                //    ViewerDataModel.Instance.UndoDataList.Remove(i);
773
                //});
774
                //ViewerDataModel.Instance.UndoDataList.Add(UndoData);
775
            }
776

    
777
            KCOM.Properties.Settings.Default.ArcLength = (double)cbArcLength.Value;
778
            Properties.Settings.Default.Save();
779
        }
780

    
781
        //강인구 추가(Undo End)
782
        private void cbDashStyle_SelectionChanged(object sender, SelectionChangedEventArgs e)
783
        {
784
            //강인구 추가
785
            if (this.ParentOfType<MainWindow>() != null)
786
            {
787
                ViewerDataModel.Instance.DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
788
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
789
                {
790
                    Undo_data UndoData = new Undo_data()
791
                    {
792
                        IsUndo = false,
793
                        Event = Event_Type.Option,
794
                        EventTime = DateTime.Now,
795
                        DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData,
796
                        Markup_List = new List<Multi_Undo_data>()
797
                    };
798
                    Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
799

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

    
880
                                multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
881
                                UndoData.Markup_List.Add(multi_Undo_Data);
882
                                multi_Undo_Data = new Multi_Undo_data();
883
                            }
884

    
885
                            ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
886
                            {
887
                                ViewerDataModel.Instance.UndoDataList.Remove(i);
888
                            });
889
                            ViewerDataModel.Instance.UndoDataList.Add(UndoData);
890
                        }
891
                    }
892
                }
893
            }
894
        }
895

    
896
        //강인구 추가
897
        private void comboFontSize_SelectionChanged(object sender, SelectionChangedEventArgs e)
898
        {
899
            //if (this.ParentOfType<MainWindow>() != null)
900
            //{
901
            //    if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
902
            //    {
903
            //        foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
904
            //        {
905
            //            if (item.GetType().Name == "AdornerFinal")
906
            //            {
907
            //                foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
908
            //                {
909
            //                    switch (InnerItem.DrawingData.GetType().Name)
910
            //                    {
911
            //                        case ("TextControl"):
912
            //                            {
913
            //                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextSize = int.Parse(comboFontSize.Text);
914
            //                            }
915
            //                            break;
916
            //                        case ("ArrowTextControl"):
917
            //                            {
918
            //                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextSize = int.Parse(comboFontSize.Text);
919
            //                            }
920
            //                            break;
921
            //                    }
922
            //                }
923
            //            }
924
            //        }
925
            //    }
926
            //}
927
        }
928

    
929
        //강인구 추가
930
        private void btnBold_Checked(object sender, RoutedEventArgs e)
931
        {
932
            if (this.ParentOfType<MainWindow>() != null)
933
            {
934
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
935
                {
936
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
937
                    {
938
                        if (item.GetType().Name == "AdornerFinal")
939
                        {
940
                            foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
941
                            {
942
                                switch (InnerItem.DrawingData.GetType().Name)
943
                                {
944
                                    case ("TextControl"):
945
                                        {
946
                                            if((InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextWeight == FontWeights.Bold)
947
                                            {
948
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextWeight = FontWeights.Normal;
949
                                            }
950
                                            else
951
                                            {
952
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextWeight = FontWeights.Bold;
953
                                            }
954

    
955
                                        }
956
                                        break;
957
                                    case ("ArrowTextControl"):
958
                                        {
959
                                            if ((InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextWeight == FontWeights.Bold)
960
                                            {
961
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextWeight = FontWeights.Normal;
962
                                            }
963
                                            else
964
                                            {
965
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextWeight = FontWeights.Bold;
966
                                            }
967
                                        }
968
                                        break;
969
                                }
970
                            }
971
                        }
972
                    }
973
                }
974
            }
975
        }
976

    
977
        //강인구 추가
978
        private void btnItalic_Checked(object sender, RoutedEventArgs e)
979
        {
980
            if (this.ParentOfType<MainWindow>() != null)
981
            {
982
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
983
                {
984
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
985
                    {
986
                        if (item.GetType().Name == "AdornerFinal")
987
                        {
988
                            foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
989
                            {
990
                                switch (InnerItem.DrawingData.GetType().Name)
991
                                {
992
                                    case ("TextControl"):
993
                                        {
994
                                            if((InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextStyle == FontStyles.Italic)
995
                                            {
996
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextStyle = System.Windows.FontStyles.Normal;
997
                                            }
998
                                            else
999
                                            {
1000
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextStyle = FontStyles.Italic;
1001
                                            }
1002

    
1003
                                        }
1004
                                        break;
1005
                                    case ("ArrowTextControl"):
1006
                                        {
1007
                                            if((InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextStyle == FontStyles.Italic)
1008
                                            {
1009
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextStyle = FontStyles.Normal;
1010
                                            }
1011
                                            else
1012
                                            {
1013
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextStyle = FontStyles.Italic;
1014
                                            }
1015
                                        }
1016
                                        break;
1017
                                }
1018
                            }
1019
                        }
1020
                    }
1021
                }
1022
            }
1023
        }
1024

    
1025
        //강인구 추가
1026
        private void btnUnderLine_Checked(object sender, RoutedEventArgs e)
1027
        {
1028
            if (this.ParentOfType<MainWindow>() != null)
1029
            {
1030
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
1031
                {
1032
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
1033
                    {
1034
                        if (item.GetType().Name == "AdornerFinal")
1035
                        {
1036
                            foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
1037
                            {
1038
                                switch (InnerItem.DrawingData.GetType().Name)
1039
                                {
1040
                                    case ("TextControl"):
1041
                                        {
1042
                                            if ((InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).UnderLine == TextDecorations.Underline)
1043
                                            {
1044
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).UnderLine = null;
1045
                                            }
1046
                                            else
1047
                                            {
1048
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).UnderLine = TextDecorations.Underline;
1049
                                            }
1050
                                        }
1051
                                        break;
1052
                                    case ("ArrowTextControl"):
1053
                                        {
1054
                                            if ((InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).UnderLine == TextDecorations.Underline)
1055
                                            {
1056
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).UnderLine = null;
1057
                                            }
1058
                                            else
1059
                                            {
1060
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).UnderLine = TextDecorations.Underline;
1061
                                            }
1062
                                        }
1063
                                        break;
1064
                                }
1065
                            }
1066
                        }
1067
                    }
1068
                }
1069
            }
1070
        }
1071

    
1072
        private void AxisLockEvent(object sender, RoutedEventArgs e)
1073
        {
1074
            ViewerDataModel.Instance.checkAxis = cbAxisLock.IsChecked.Value;
1075
        }
1076

    
1077
        private void comboFontSize_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
1078
        {
1079
            if (string.IsNullOrEmpty(comboFontSize.Value.ToString()))
1080
            {
1081
                comboFontSize.Value = comboFontSize.Minimum;
1082
            }
1083
            if (this.ParentOfType<MainWindow>() != null)
1084
            {
1085
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
1086
                {
1087
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
1088
                    {
1089
                        if (item.GetType().Name == "AdornerFinal")
1090
                        {
1091
                            foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
1092
                            {
1093
                                switch (InnerItem.DrawingData.GetType().Name)
1094
                                {
1095
                                    case ("TextControl"):
1096
                                        {
1097
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextSize = int.Parse(comboFontSize.Value.ToString());
1098
                                        }
1099
                                        break;
1100
                                    case ("ArrowTextControl"):
1101
                                        {
1102
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextSize = int.Parse(comboFontSize.Value.ToString());
1103
                                        }
1104
                                        break;
1105
                                }
1106
                            }
1107
                        }
1108
                    }
1109
                }
1110
            }
1111
            KCOM.Properties.Settings.Default.TextSize = (double)comboFontSize.Value;
1112
            Properties.Settings.Default.Save();
1113
        }
1114

    
1115
        //강인구 추가
1116
        private void RadRibbonComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
1117
        {
1118
            if (this.ParentOfType<MainWindow>() != null)
1119
            {
1120
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
1121
                {
1122
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
1123
                    {
1124
                        if (item.GetType().Name == "AdornerFinal")
1125
                        {
1126
                            foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
1127
                            {
1128
                                switch (InnerItem.DrawingData.GetType().Name)
1129
                                {
1130
                                    case ("TextControl"):
1131
                                        {
1132
                                            //if ((InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).FontFamily == TextDecorations.Underline)
1133
                                            //{
1134
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).FontFamily = new FontFamily(comboFontFamily.Text);
1135
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).Base_TextBlock.FontFamily = new FontFamily(comboFontFamily.Text);
1136
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).Base_TextBox.FontFamily = new FontFamily(comboFontFamily.Text);
1137
                                            //}
1138
                                            //else
1139
                                            //{
1140
                                            //    (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).UnderLine = TextDecorations.Underline;
1141
                                            //}
1142
                                        }
1143
                                        break;
1144
                                    case ("ArrowTextControl"):
1145
                                        {
1146
                                            //if ((InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).UnderLine == TextDecorations.Underline)
1147
                                            //{
1148
                                            //    (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).UnderLine = null;
1149
                                            //}
1150
                                            //else
1151
                                            //{
1152
                                            //    (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).UnderLine = TextDecorations.Underline;
1153
                                            //}
1154
                                        }
1155
                                        break;
1156
                                }
1157
                            }
1158
                        }
1159
                    }
1160
                }
1161
            }
1162
        }
1163

    
1164
        /// <summary>
1165
        /// 텍스트 컨트롤 하일라이트 처리
1166
        /// </summary>
1167
        /// <param name="sender"></param>
1168
        /// <param name="e"></param>
1169
        private void HighlightEvent(object sender, RoutedEventArgs e)
1170
        {
1171

    
1172
            ViewerDataModel.Instance.checkHighShape = (sender as CheckBox).IsChecked.Value;
1173
            SetHighlightEvent();
1174
            //if ((sender as CheckBox).IsChecked.Value)
1175
            //{
1176
            //    TaskMessage("HighLight가 설정되었습니다", TaskMessageType.Normal);
1177
            //}
1178
            //else
1179
            //{
1180
            //    TaskMessage("HighLight가 해제되었습니다", TaskMessageType.Caption);
1181
            //}
1182
            //if (ViewerDataModel.Instance.SelectedEditor as MarkupToPDF.Controls.Text.TextControl != null)
1183
            //{
1184
            //    MarkupToPDF.Controls.Text.TextControl instance = (ViewerDataModel.Instance.SelectedEditor as MarkupToPDF.Controls.Text.TextControl);
1185
            //    instance.IsHighLight = ViewerDataModel.Instance.checkHighShape;
1186
            //    instance.SetText();
1187
            //}
1188
        }
1189

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

    
1263
                    ((TextBox)sender).Text = previousText;
1264
                }
1265
            }
1266
        }
1267

    
1268
        /// <summary>
1269
        /// 입력한 페이지로 이동한다
1270
        /// </summary>
1271
        /// <param name="sender"></param>
1272
        /// <param name="e"></param>
1273
        private void tlcurrentPage_readonly_KeyDown(object sender, KeyEventArgs e)
1274
        {
1275
            if (e.Key == Key.Enter)
1276
            {
1277
                try
1278
                {
1279
                    var instanceMain = this.ParentOfType<MainWindow>();
1280
                    instanceMain.dzMainMenu.pageNavigator.GotoPage(Convert.ToInt32(tlcurrentPage_readonly.Text));
1281
                }
1282
                catch (Exception)
1283
                {
1284
                    RadWindow.Alert(new DialogParameters
1285
                    {
1286
                        Owner = Application.Current.MainWindow,
1287
                        Theme = new VisualStudio2013Theme(),
1288
                        Header = "안내",
1289
                        Content = "페이지 번호를 정확하게 입력해 주세요",
1290
                    });
1291
                }
1292
            }
1293
        }
1294
        
1295
        private void PanoramaEvent(object sender, RoutedEventArgs e)
1296
        {
1297
            PanoramaShow();
1298
        }
1299

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

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

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

    
1346
                isClosed = false;
1347

    
1348
                
1349
                CheckList check = new CheckList();
1350

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

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

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

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

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

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

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

    
1440
            //instanceToggle.IsChecked = false;
1441

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

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

    
1507
        private void Control_Event(object sender, RoutedEventArgs e)
1508
        {
1509

    
1510
        }
1511

    
1512
        #region 대기
1513

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

    
1518
            //if (rotateOffSet > 3)
1519
            //    rotateOffSet = 0;
1520

    
1521
            //if (rotateOffSet < 0)
1522
            //    rotateOffSet = 3;
1523

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

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

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

    
1582

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

    
1587

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

    
1599

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

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

    
1609
                instanceMain.dzMainMenu.pageNavigator.GotoPage(data.PageNumber);
1610

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

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

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

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

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

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

    
1655
                        Check_Uri.UriCheck(filepath);
1656

    
1657
                        instanceMain.dzMainMenu.filename = filepath;
1658

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

    
1688
        private void Control_Init(RadToggleButton instanceToggle, object sender)
1689
        {
1690

    
1691
        }
1692

    
1693
        private void ControlEvent(object sender, RoutedEventArgs e)
1694
        {
1695
            RadToggleButton instanceToggle = sender as RadToggleButton;
1696
            var instanceMain = this.ParentOfType<MainWindow>();
1697

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

    
1718
            //if (!instanceMain.IsFreeSelectionMode)
1719
            //{
1720
            //    instanceMain.IsSwingMode = true;
1721
            //}
1722

    
1723
            #region 다른 컨트롤 버튼 선택 해제
1724
            System.Reactive.Linq.Observable2.FromPropertyChangedPattern(Common.ViewerDataModel.Instance, temp => temp.SelectedControl).Subscribe(ControlState =>
1725
            {
1726
                if (ControlState == null)
1727
                {
1728
                    instanceToggle.IsChecked = false;
1729
                    HiddenControlHide();
1730
                }
1731
            });
1732
            #endregion
1733

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

    
1736
            if (instanceToggle != null)
1737
            {
1738
                Common.ViewerDataModel.Instance.ControlTag = instanceToggle.Tag.ToString();
1739
            }
1740
            else if ((sender as RadRibbonToggleButton) != null)
1741
            {
1742
                Common.ViewerDataModel.Instance.ControlTag = (sender as RadRibbonToggleButton).Tag.ToString();
1743
                instanceToggle = (sender as RadRibbonToggleButton);
1744
            }
1745
            else if ((sender as RadRibbonButton) != null)
1746
            {
1747
                RadRibbonButton instanceButton = sender as RadRibbonButton;
1748
                Common.ViewerDataModel.Instance.ControlTag = instanceButton.Tag.ToString();
1749
            }
1750
            else
1751
            {
1752
                RadButton instanceButton = sender as RadButton;
1753
                Common.ViewerDataModel.Instance.ControlTag = instanceButton.Tag.ToString();
1754
            }
1755

    
1756

    
1757

    
1758
            System.Reactive.Linq.Observable2.FromPropertyChangedPattern(Common.ViewerDataModel.Instance, temp => temp.AngleVisibility).Subscribe(isSee =>
1759
            {
1760
                instanceMain.dzMainMenu.MainAngle.Visibility = isSee;
1761
                System.Reactive.Linq.Observable2.FromPropertyChangedPattern(Common.ViewerDataModel.Instance, temp => temp.AngleValue).Subscribe(p =>
1762
                {
1763
                    instanceMain.dzMainMenu.MainAngle.AngleValue = p;
1764
                });
1765
            });
1766
            instanceMain.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Drawing;
1767

    
1768
            instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = false;
1769

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

    
1995
                        //instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = true;
1996

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

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

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

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

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

    
2227

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

    
2248
                        if (this.ParentOfType<MainWindow>().dzMainMenu.currentControl != null)
2249
                        {
2250
                            ViewerDataModel.Instance.MarkupControls_USER.Remove(this.ParentOfType<MainWindow>().dzMainMenu.currentControl);
2251
                            this.ParentOfType<MainWindow>().dzMainMenu.currentControl = null;
2252
                        }
2253

    
2254
                        ViewerDataModel.Instance.SelectedControl = "ImgControl";
2255
                   //     ViewerDataModel.Instance.ControlTag = null;
2256
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ImgControl;
2257

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

    
2271
                            }
2272
                            else
2273
                            {
2274
                                (Application.Current.MainWindow as MainWindow).dzTopMenu.RefactoryCommentReact(menu);
2275
                            }
2276
                        }*/
2277

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

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

    
2339
                            isClosed = false;
2340
                            CadResultViewer check = new CadResultViewer();
2341
                            check.WindowStartupLocation = WindowStartupLocation.CenterScreen;
2342
                            check.Title = "Viewer";
2343
                            check.Show();
2344

    
2345
                            check.Closed += Check_Closed;
2346

    
2347
                        }
2348
                        break;
2349
                    #endregion
2350
                    default:
2351
                        break;
2352
                }
2353
                #endregion
2354
            }
2355
            else
2356
            {
2357

    
2358
                if (!instanceMain.dzMainMenu.IsFreeSelectionMode)
2359
                {
2360
                    instanceMain.dzMainMenu.IsSwingMode = false;
2361
                    Common.ViewerDataModel.Instance.SelectedControl = "";
2362
                    Common.ViewerDataModel.Instance.ControlTag = null;
2363
                    this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2364
                    this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2365
                }
2366
            }
2367
        }
2368

    
2369
        private void SyncInit()
2370
        {
2371
            try
2372
            {
2373
                if (!ViewerDataModel.Instance.SystemMain.dzMainMenu.testPanel2.IsHidden)
2374
                {
2375
                    ViewerDataModel.Instance.SystemMain.dzMainMenu.testPanel2.IsHidden = true;
2376
                    ViewerDataModel.Instance.PageBalanceMode = false;
2377
                    ViewerDataModel.Instance.PageBalanceNumber = 0;
2378
                    ViewerDataModel.Instance.PageNumber = 0;
2379
                    ViewerDataModel.Instance.MarkupControls_Sync.Clear();
2380
                    ViewerDataModel.Instance.SystemMain.dzMainMenu.gridViewRevMarkup.Visibility = Visibility.Collapsed;
2381
                    ViewerDataModel.Instance.SystemMain.dzMainMenu.UserList.IsChecked = false;
2382
                    ViewerDataModel.Instance.SystemMain.dzMainMenu.BalanceMode.IsChecked = false;
2383
                }
2384
            }
2385
            catch (Exception ex)
2386
            {
2387
                Logger.sendResLog("SyncInit", ex.Message, 0);
2388
            }
2389

    
2390
        }
2391

    
2392
        Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
2393
        CommentUserInfo currentControl { get; set; }
2394
        private void Check_Closed(object sender, EventArgs e)
2395
        {
2396
            isClosed = true;
2397
            //this.ParentOfType<MainWindow>().dzMainMenu.PN_Navi.IsEnabled = true;
2398
            //토글 및 마우스 상태 초기화
2399
            var toggleList = this.Parent.ChildrenOfType<RadToggleButton>();
2400
            foreach (var togle in toggleList)
2401
            {
2402
                togle.IsChecked = false;
2403
            }
2404
            this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2405
            ViewerDataModel.Instance.Capture_Opacity = 0;
2406

    
2407
        }
2408

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

    
2419
            string[] data = new string[0];
2420

    
2421
            int cnt = 0;
2422
            var menu = this.ParentOfType<MainWindow>().dzMainMenu;
2423

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

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

    
2440
            if (data != null && KCOM.Properties.Settings.Default.cad == 1)
2441
            {
2442
                string FilePath = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\Cad");
2443
                string FileName = FilePath + "\\commentstring.json"; // Default file name
2444
                if (!File.Exists(FilePath))
2445
                {
2446
                    Directory.CreateDirectory(FilePath);
2447
                }
2448

    
2449
                if (!string.IsNullOrEmpty(FileName))
2450
                {
2451
                    //  File.WriteAllText(SaveDig.FileName, data);
2452
                    File.WriteAllLines(FileName, data);
2453
                }
2454
            }
2455
        }
2456

    
2457
        private double minHeight;
2458
        private double minWidth;
2459

    
2460
        private double maxHeight;
2461
        private double maxWidth;
2462

    
2463
        public bool CanVResize { get; private set; }
2464
        public bool CanHResize { get; private set; }
2465

    
2466
        public void DesignerComponent(FrameworkElement content)
2467
        {
2468
            this.InitializeComponent();
2469

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

    
2491
            minWidth = content.MinWidth < 10.0 ? 10.0 : content.MinWidth;
2492
            minHeight = content.MinHeight < 10.0 ? 10.0 : content.MinHeight;
2493
            maxWidth = content.MaxWidth;
2494
            maxHeight = content.MaxHeight;
2495

    
2496
            double top = (double)content.GetValue(Canvas.TopProperty);
2497
            if (double.IsNaN(top))
2498
                top = 0.0;
2499
            double left = (double)content.GetValue(Canvas.LeftProperty);
2500
            if (double.IsNaN(left))
2501
                left = 0.0;
2502
            SetValue(Canvas.TopProperty, top);
2503
            SetValue(Canvas.LeftProperty, left);
2504

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

    
2545
        private void drawControlBorder(object sender)
2546
        {
2547
            System.Windows.Controls.Control control = (System.Windows.Controls.Control)sender;
2548
        }
2549

    
2550
        private void ResizeThumb_DragDelta(object sender, MouseButtonEventArgs e)
2551
        {
2552
            System.Windows.Controls.Control designerItem = (System.Windows.Controls.Control)sender;
2553
            if (designerItem != null)
2554
            {
2555
                double deltaVertical, deltaHorizontal;
2556

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

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

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

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

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

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

    
2630
            if(instanceToggle.IsChecked == true)
2631
            {
2632
                SaveTime(true);
2633
            }
2634
            else
2635
            {
2636
                SaveTime(false);
2637
            }
2638
        }
2639

    
2640
        public void Copy_Start()
2641
        {
2642
            if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
2643
            {
2644
                string MarkupData = "";
2645

    
2646
                foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
2647
                {
2648
                    if (item.GetType().Name == "AdornerFinal")
2649
                    {
2650
                        foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
2651

    
2652
                        {
2653
                            if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
2654
                            {
2655
                                MarkupToPDF.Controls.Parsing.MarkupParser.MarkupReturn res = MarkupParser.MarkupToString(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo, App.ViewInfo.UserID);
2656
                                MarkupData += "|OR|" + res.ConvertData;
2657
                            }
2658
                        }
2659
                        Clipboard.SetText(MarkupData);
2660
                    }
2661
                }
2662
            }
2663
        }
2664

    
2665
        public void Cut_Start()
2666
        {
2667
            if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
2668
            {
2669
                foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
2670
                {
2671
                    string MarkupData = "";
2672

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

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

    
2699
                string[] delimiterChars = { "|OR|" };
2700
                string[] data = Clipboard.GetText().Split(delimiterChars, StringSplitOptions.RemoveEmptyEntries);
2701

    
2702
                SelectionSet.Instance.UnSelect(this.ParentOfType<MainWindow>().dzMainMenu);
2703

    
2704
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
2705

    
2706
                //강인구 Undo/Redo 보류
2707
                MarkupToPDF.Common.Undo_data UndoData = new Undo_data()
2708
                {
2709
                    IsUndo = false,
2710
                    Event = Event_Type.Create,
2711
                    EventTime = DateTime.Now,
2712
                    Markup_List = new List<Multi_Undo_data>()
2713
                };
2714

    
2715
                ViewerDataModel.Instance.UndoDataList.Where(data1 => data1.IsUndo == true).ToList().ForEach(i =>
2716
                {
2717
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
2718
                });
2719

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

    
2727
                        ViewerDataModel.Instance.MarkupControls.Remove(item as MarkupToPDF.Common.CommentUserInfo);
2728
                        ViewerDataModel.Instance.MarkupControls_USER.Remove(item as MarkupToPDF.Common.CommentUserInfo);
2729

    
2730
                        adornerSet.Add(item as MarkupToPDF.Common.CommentUserInfo);
2731

    
2732
                        //Controls.AdornerFinal final = new Controls.AdornerFinal(item as MarkupToPDF.Common.CommentUserInfo);
2733
                        //this.dzMainMenu.SelectLayer.Children.Add(final);
2734

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

    
2737
                        UndoData.Markup_List.Add(multi_Undo_Data);
2738
                        ViewerDataModel.Instance.UndoDataList.Add(UndoData);                        
2739
                    }
2740
                }
2741
                Controls.AdornerFinal final = new Controls.AdornerFinal(adornerSet);
2742

    
2743
                if(this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.X < 0)
2744
                {
2745
                    Canvas.SetLeft(final, 0);
2746
                    Canvas.SetTop(final, 0);
2747
                }
2748
                else
2749
                {
2750
                    double realPointX = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.X - final.BorderSize.X - (final.BorderSize.Width / 2);
2751
                    double realPointY = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.Y - final.BorderSize.Y - (final.BorderSize.Height / 2);
2752
                    final.TranslateItems(realPointX, realPointY);
2753

    
2754
                    if (final.Members.Where(type => type.Drawingtype == MarkupToPDF.Controls.Common.ControlType.TextControl).FirstOrDefault() != null)
2755
                    {
2756
                        final.TranslateItems(0.001, 0.001); //dummy
2757
                    }
2758

    
2759
                }
2760
                
2761

    
2762
                this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Add(final);
2763

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

    
2775
                    //강인구 Undo/Redo 보류
2776
                    MarkupToPDF.Common.Undo_data UndoData = new Undo_data()
2777
                    {
2778
                        IsUndo = false,
2779
                        Event = Event_Type.Create,
2780
                        EventTime = DateTime.Now,
2781
                        Markup_List = new List<Multi_Undo_data>()
2782
                    };
2783

    
2784

    
2785
                    string temppath = System.IO.Path.GetTempPath();
2786
                    //string filename = KCOM.Events.Save.shortCommentKey();
2787
                    string filename = Commons.shortFileKey();
2788

    
2789
                    System.Drawing.Image clipboardImage = System.Windows.Forms.Clipboard.GetImage();
2790
                    clipboardImage.Save(temppath + "\\" + filename);
2791

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

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

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

    
2817
                    fileInfo.Delete();
2818

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

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

    
2854
                    currentControl.TopRightPoint = new Point(currentControl.StartPoint.X + clipboardImage.Width, currentControl.StartPoint.Y);
2855
                    currentControl.LeftBottomPoint = new Point(currentControl.StartPoint.X, currentControl.StartPoint.Y + clipboardImage.Height);
2856
                    currentControl.EndPoint = new Point(currentControl.StartPoint.X + clipboardImage.Width, currentControl.StartPoint.Y + clipboardImage.Height);
2857

    
2858
                    currentControl.PointSet = new List<Point>
2859
                                        {
2860
                                            currentControl.StartPoint,
2861
                                            currentControl.LeftBottomPoint,
2862
                                            currentControl.EndPoint,
2863
                                            currentControl.TopRightPoint,
2864
                                        };
2865

    
2866
                    multi_Undo_Data = this.ParentOfType<MainWindow>().dzMainMenu.Control_Style(currentControl as MarkupToPDF.Common.CommentUserInfo);
2867
                    UndoData.Markup_List.Add(multi_Undo_Data);
2868
                    ViewerDataModel.Instance.UndoDataList.Add(UndoData);
2869

    
2870
                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl as MarkupToPDF.Common.CommentUserInfo);
2871
                    currentControl.CommentID = Commons.shortGuid();
2872

    
2873
                    currentControl.ApplyTemplate();
2874
                    currentControl.SetImage();
2875

    
2876
                    ViewerDataModel.Instance.MarkupControls_USER.Remove(currentControl as MarkupToPDF.Common.CommentUserInfo);
2877
                    Controls.AdornerFinal final = new Controls.AdornerFinal(currentControl as MarkupToPDF.Common.CommentUserInfo);
2878
                    this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Add(final);
2879

    
2880
                    double realPointX = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.X - final.BorderSize.X - (final.BorderSize.Width / 2);
2881
                    double realPointY = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.Y - final.BorderSize.Y - (final.BorderSize.Height / 2);
2882
                    final.TranslateItems(realPointX, realPointY);
2883
                }
2884
                catch(Exception ex)
2885
                {
2886
                    this.ParentOfType<MainWindow>().DialogMessage_Alert("" + ex, "Alert");
2887
                }
2888
            }
2889
        }
2890
    }
2891
}
클립보드 이미지 추가 (최대 크기: 500 MB)