프로젝트

일반

사용자정보

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

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

이력 | 보기 | 이력해설 | 다운로드 (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
using System.Web;
27

    
28
namespace KCOM.Views
29
{
30
    public partial class TopMenu : UserControl
31
    {
32
        public int rotateOffSet = 0;
33
        private double[] rotateValue = { 0, 90, 180, 270 };
34
        public System.Windows.Threading.DispatcherTimer SaveTimer { get; set; }
35
        public bool isClosed = true;
36
        public RadWindow CheckPop;
37
        public RadWindow OptionPop;
38

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

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

    
67
        private void CheckShapeState()
68
        {
69

    
70

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

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

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

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

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

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

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

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

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

    
150
        }
151

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

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

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

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

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

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

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

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

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

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

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

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

    
323
                if (menu.gridViewMarkup.SelectedItems.Count == 0 && menu.gridViewMarkup.Items.Count > 0)
324
                {
325
                    this.ParentOfType<MainWindow>().DialogMessage_Alert("Please Select Your Comment List Item", "Alert");
326
                }
327
                else
328
                {                    
329
                    foreach (var item in menu.gridViewMarkup.SelectedItems)
330
                    {
331
                        if ((item as IKCOM.MarkupInfoItem).UserID == App.ViewInfo.UserID)
332
                        {
333
                            this.ExecuteSaveCommand(menu);
334
                            ViewerDataModel.Instance._markupInfoList.Where(data => data.MarkupInfoID == (item as IKCOM.MarkupInfoItem).MarkupInfoID).FirstOrDefault().UpdateTime = DateTime.Now;
335
                            if (!ViewerDataModel.Instance.IsConsolidate && (sender != null))
336
                            {
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.MarkupControls_USER.Count > 0 || this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
408
            {
409
                var menu = this.ParentOfType<MainWindow>().dzMainMenu;
410
                SelectionSet.Instance.UnSelect(menu);
411
                if (menu.PreviewUserMarkupInfoItem != null && menu.PreviewUserMarkupInfoItem.IsPreviewUser == true)
412
                {
413
                    this.SaveEventCallback(null, null);
414
                }
415
                else if (menu.gridViewMarkup.SelectedItems.Count == 0 || (menu.gridViewMarkup.SelectedItems.FirstOrDefault() as IKCOM.MarkupInfoItem).UserID != App.ViewInfo.UserID)
416
                {
417

    
418
                }
419
                else
420
                {
421
                    this.SaveEventCallback(null, null);
422
                }
423
            }
424

    
425
            bool isprint = false;
426
            if (Type == "Print")
427
            {
428
                isprint = true;
429
            }
430

    
431
            RadWindow PrintWindow = new RadWindow();
432
            PrintWindow.Width = 850;
433
            PrintWindow.Height = 600;
434
            PrintWindow.Header = Type;
435

    
436
            List<IKCOM.MarkupInfoItem> markupinfo = new List<IKCOM.MarkupInfoItem>();
437

    
438
            markupinfo = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.GetPrintDocItemList(App.ViewInfo.ProjectNO, App.ViewInfo.DocumentItemID, ViewerDataModel.Instance._markupInfoList.ToList());
439

    
440
            if (markupinfo.Count() > 0)
441
            {
442
                Logger.sendResLog("GetPrintDocItemList", "TRUE", 1);
443
            }
444
            else
445
            {
446
                Logger.sendResLog("GetPrintDocItemList", "FALSE", 1);
447
            }
448

    
449
            /// Tile Source URL을 구한다
450
            string sImageURL = ViewerDataModel.Instance.SystemMain.dzMainMenu.GetImageURL(App.ViewInfo.DocumentItemID, this.ParentOfType<MainWindow>().dzMainMenu.pageNavigator.CurrentPage.PageNumber);
451
            var url = new Uri(sImageURL);
452
            string sFolder = App.ViewInfo.DocumentItemID.All(char.IsDigit) ? (Convert.ToInt64(App.ViewInfo.DocumentItemID) / 100).ToString() : App.ViewInfo.DocumentItemID.Substring(0, 5);
453
            var Tile_Url = string.Format(@"{0}://{1}:{2}/TileSource/{3}_Tile/{4}/{5}/",
454
                url.Scheme, url.Host, url.Port,
455
                App.ViewInfo.ProjectNO,
456
                sFolder,
457
                App.ViewInfo.DocumentItemID
458
                );
459
            /// up to here
460

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

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

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

    
489
        private List<AdornerMember> GetAdornerItem()
490
        {
491
            List<AdornerMember> AdonerList = new List<AdornerMember>();
492

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

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

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

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

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

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

    
658
                    multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
659
                    UndoData.Markup_List.Add(multi_Undo_Data);
660
                    multi_Undo_Data = new Multi_Undo_data();
661
                }
662

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

    
669
                
670
            }
671
            KCOM.Properties.Settings.Default.LineSize = (double)cbLineSize.Value;
672
            Properties.Settings.Default.Save();
673
        }
674

    
675

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

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

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

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

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

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

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

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

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

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

    
774
            KCOM.Properties.Settings.Default.ArcLength = (double)cbArcLength.Value;
775
            Properties.Settings.Default.Save();
776
        }
777

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

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

    
877
                                multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
878
                                UndoData.Markup_List.Add(multi_Undo_Data);
879
                                multi_Undo_Data = new Multi_Undo_data();
880
                            }
881

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

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

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

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

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

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

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

    
1069
        private void AxisLockEvent(object sender, RoutedEventArgs e)
1070
        {
1071
            ViewerDataModel.Instance.checkAxis = cbAxisLock.IsChecked.Value;
1072
        }
1073

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

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

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

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

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

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

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

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

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

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

    
1345
                isClosed = false;
1346

    
1347
                
1348
                CheckList check = new CheckList(this.ParentOfType<MainWindow>());
1349

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

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

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

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

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

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

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

    
1439
            //instanceToggle.IsChecked = false;
1440

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

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

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

    
1509
        }
1510

    
1511
        #region 대기
1512

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

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

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

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

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

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

    
1581

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

    
1586

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

    
1598

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

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

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

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

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

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

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

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

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

    
1654
                        Check_Uri.UriCheck(filepath);
1655

    
1656
                        instanceMain.dzMainMenu.filename = filepath;
1657

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

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

    
1690
        }
1691

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

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

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

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

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

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

    
1755

    
1756

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

    
1770
            instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = false;
1771

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

    
1997
                        //instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = true;
1998

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

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

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

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

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

    
2230

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

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

    
2257
                        ViewerDataModel.Instance.SelectedControl = "ImgControl";
2258
                   //     ViewerDataModel.Instance.ControlTag = null;
2259
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ImgControl;
2260

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

    
2274
                            }
2275
                            else
2276
                            {
2277
                                (Application.Current.MainWindow as MainWindow).dzTopMenu.RefactoryCommentReact(menu);
2278
                            }
2279
                        }*/
2280

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

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

    
2342
                    //        isClosed = false;
2343
                    //        CadResultViewer check = new CadResultViewer();
2344
                    //        check.WindowStartupLocation = WindowStartupLocation.CenterScreen;
2345
                    //        check.Title = "Viewer";
2346
                    //        check.Show();
2347

    
2348
                    //        check.Closed += Check_Closed;
2349

    
2350
                    //    }
2351
                    //    break;
2352
                    //#endregion
2353
                    default:
2354
                        break;
2355
                }
2356
                #endregion
2357
            }
2358
            else
2359
            {
2360

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

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

    
2393
        }
2394

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

    
2410
        }
2411

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

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

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

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

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

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

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

    
2460
        private double minHeight;
2461
        private double minWidth;
2462

    
2463
        private double maxHeight;
2464
        private double maxWidth;
2465

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
2704
                SelectionSet.Instance.UnSelect(this.ParentOfType<MainWindow>().dzMainMenu);
2705

    
2706
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
2707

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

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

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

    
2729
                        ViewerDataModel.Instance.MarkupControls.Remove(item as MarkupToPDF.Common.CommentUserInfo);
2730
                        ViewerDataModel.Instance.MarkupControls_USER.Remove(item as MarkupToPDF.Common.CommentUserInfo);
2731

    
2732
                        adornerSet.Add(item as MarkupToPDF.Common.CommentUserInfo);
2733

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

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

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

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

    
2759
                this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Add(final);
2760
            }
2761
            //외부 이미지 붙여넣기
2762
            else if (Clipboard.GetImage() != null)
2763
            {
2764
                try
2765
                {
2766
                    Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
2767

    
2768
                    //강인구 Undo/Redo 보류
2769
                    MarkupToPDF.Common.Undo_data UndoData = new Undo_data()
2770
                    {
2771
                        IsUndo = false,
2772
                        Event = Event_Type.Create,
2773
                        EventTime = DateTime.Now,
2774
                        Markup_List = new List<Multi_Undo_data>()
2775
                    };
2776

    
2777

    
2778
                    string temppath = System.IO.Path.GetTempPath();
2779
                    //string filename = KCOM.Events.Save.shortCommentKey();
2780
                    string filename = Commons.shortFileKey();
2781

    
2782
                    System.Drawing.Image clipboardImage = System.Windows.Forms.Clipboard.GetImage();
2783
                    clipboardImage.Save(temppath + "\\" + filename);
2784

    
2785
                    System.IO.FileInfo fileInfo = new System.IO.FileInfo(temppath + "\\" + filename);
2786
                    String strFile = System.IO.Path.GetFileName(fileInfo.FullName);
2787
                    long numByte = fileInfo.Length;
2788
                    double dLen = Convert.ToDouble(fileInfo.Length / 1000000);
2789
                    kr.co.devdoftech.cloud.FileUpload fileUploader = new kr.co.devdoftech.cloud.FileUpload();
2790

    
2791
                    if (dLen < 4)
2792
                    {
2793
                        System.IO.FileStream fStream = new System.IO.FileStream(fileInfo.FullName,
2794
                        System.IO.FileMode.Open, System.IO.FileAccess.Read);
2795
                        System.IO.BinaryReader br = new System.IO.BinaryReader(fStream);
2796
                        byte[] data = br.ReadBytes((int)numByte);
2797

    
2798
                        filename = fileUploader.Run(App.ViewInfo.ProjectNO, this.ParentOfType<MainWindow>().dzMainMenu._DocItem.DOCUMENT_NO, App.ViewInfo.UserID, strFile + ".png", data);
2799
                        Check_Uri.UriCheck(filename);
2800
                        br.Close();
2801
                        fStream.Close();
2802
                        fStream.Dispose();
2803
                    }
2804
                    else
2805
                    {
2806
                        this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert("Available Memory less than 4 mega byte", "Alert");
2807
                        return;
2808
                    }
2809

    
2810
                    fileInfo.Delete();
2811

    
2812
                    System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(clipboardImage);
2813
                    IntPtr hBitmap = bmp.GetHbitmap();
2814
                    System.Windows.Media.ImageSource WpfBitmap = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(hBitmap, IntPtr.Zero, Int32Rect.Empty, System.Windows.Media.Imaging.BitmapSizeOptions.FromEmptyOptions());
2815
                    Image img = new Image();
2816
                    if (filename.Contains(".svg"))
2817
                    {
2818
                        byte[] imageData = null;
2819
                        DrawingImage image = null;
2820
                        using (System.Net.WebClient web = new System.Net.WebClient())
2821
                        {
2822
                            imageData = web.DownloadData(new Uri(filename));
2823
                            System.IO.Stream stream = new System.IO.MemoryStream(imageData);
2824
                            image = SvgReader.Load(stream);
2825
                        }
2826
                        img.Source = image;
2827
                    }
2828
                    else
2829
                    {
2830
                        img.Source = new BitmapImage(new Uri(filename));
2831
                    }
2832

    
2833
                    var currentControl = new MarkupToPDF.Controls.Etc.ImgControl
2834
                    {
2835
                        PointSet = new List<Point>(),
2836
                        FilePath = filename,
2837
                        ImageData = img.Source,
2838
                        StartPoint = new Point(100, 100),
2839
                        EndPoint = new Point(200, 200),
2840
                        TopRightPoint = new Point(100, 200),
2841
                        LeftBottomPoint = new Point(200, 100)
2842
                    };
2843

    
2844
                    currentControl.TopRightPoint = new Point(currentControl.StartPoint.X + clipboardImage.Width, currentControl.StartPoint.Y);
2845
                    currentControl.LeftBottomPoint = new Point(currentControl.StartPoint.X, currentControl.StartPoint.Y + clipboardImage.Height);
2846
                    currentControl.EndPoint = new Point(currentControl.StartPoint.X + clipboardImage.Width, currentControl.StartPoint.Y + clipboardImage.Height);
2847

    
2848
                    currentControl.PointSet = new List<Point>
2849
                                        {
2850
                                            currentControl.StartPoint,
2851
                                            currentControl.LeftBottomPoint,
2852
                                            currentControl.EndPoint,
2853
                                            currentControl.TopRightPoint,
2854
                                        };
2855

    
2856
                    multi_Undo_Data = this.ParentOfType<MainWindow>().dzMainMenu.Control_Style(currentControl as MarkupToPDF.Common.CommentUserInfo);
2857
                    UndoData.Markup_List.Add(multi_Undo_Data);
2858
                    ViewerDataModel.Instance.UndoDataList.Add(UndoData);
2859

    
2860
                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl as MarkupToPDF.Common.CommentUserInfo);
2861
                    currentControl.CommentID = Commons.shortGuid();
2862

    
2863
                    currentControl.ApplyTemplate();
2864
                    currentControl.SetImage();
2865

    
2866
                    ViewerDataModel.Instance.MarkupControls_USER.Remove(currentControl as MarkupToPDF.Common.CommentUserInfo);
2867
                    Controls.AdornerFinal final = new Controls.AdornerFinal(currentControl as MarkupToPDF.Common.CommentUserInfo);
2868
                    this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Add(final);
2869

    
2870
                    double realPointX = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.X - final.BorderSize.X - (final.BorderSize.Width / 2);
2871
                    double realPointY = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.Y - final.BorderSize.Y - (final.BorderSize.Height / 2);
2872
                    final.TranslateItems(realPointX, realPointY);
2873
                }
2874
                catch(Exception ex)
2875
                {
2876
                    this.ParentOfType<MainWindow>().DialogMessage_Alert("" + ex, "Alert");
2877
                }
2878
            }
2879
        }
2880
    }
2881
}
클립보드 이미지 추가 (최대 크기: 500 MB)