프로젝트

일반

사용자정보

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

markus / KCOM / Events / Implementation / TopMenuEvent.cs @ 073f6118

이력 | 보기 | 이력해설 | 다운로드 (144 KB)

1
using KCOM.Common;
2
using KCOM.Common.Converter;
3
using KCOM.Controls;
4
using KCOM.Events;
5
using KCOMDataModel.DataModel;
6
using MarkupToPDF.Common;
7
using Svg2Xaml;
8
using System;
9
using System.Collections.Generic;
10
using System.Linq;
11
using System.Text;
12
using System.Windows;
13
using System.Windows.Controls;
14
using System.Windows.Input;
15
using System.Windows.Media;
16
using System.Windows.Media.Imaging;
17
using Telerik.Windows.Controls;
18
using IKCOM;
19
using Microsoft.Win32;
20
using System.IO;
21
using System.Reflection;
22
using System.Windows.Controls.Primitives;
23
using MarkupToPDF.Controls.Parsing;
24
using Telerik.Windows.Data;
25
using System.ComponentModel;
26

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

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

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

    
66
        private void CheckShapeState()
67
        {
68

    
69

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

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

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

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

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

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

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

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

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

    
149
        }
150

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

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

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

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

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

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

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

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

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

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

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

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

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

    
343
                if (sender != null)
344
                {
345
                    if (ViewerDataModel.Instance.IsPressCtrl) ViewerDataModel.Instance.IsPressCtrl = false;
346
                    this.ParentOfType<MainWindow>().DialogMessage_Alert("Save 가 완료되었습니다.", "Alert");
347
                }
348

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

    
373
        /// <summary>
374
        /// call save command
375
        /// </summary>
376
        /// <param name="menu"></param>
377
		private void ExecuteSaveCommand(MainMenu menu)
378
        {
379
            SaveCommand.Instance.Project_No = App.ViewInfo.ProjectNO;
380
            SaveCommand.Instance.document_id = App.ViewInfo.DocumentItemID;
381
            SaveCommand.Instance.user_id = App.ViewInfo.UserID;
382
            SaveCommand.Instance.page_no = menu.pageNavigator.CurrentPage.PageNumber;
383

    
384
            try
385
            {
386
                if (ViewerDataModel.Instance.UndoDataList.Count > 0)
387
                {
388
                    List<IKCOM.MarkupInfoItem> SelectedMarkupInfos = new List<IKCOM.MarkupInfoItem>();
389
                    foreach (var item in menu.gridViewMarkup.SelectedItems)
390
                    {
391
                        if ((item as IKCOM.MarkupInfoItem).UserID == App.ViewInfo.UserID)
392
                        {
393
                            SelectedMarkupInfos.Add(item as IKCOM.MarkupInfoItem);
394
                        }
395
                    }
396

    
397
                    SaveCommand.Instance.Execute(SelectedMarkupInfos);
398
                }
399

    
400
                if(ViewerDataModel.Instance.RotationDocs.Count > 0)
401
                    SaveCommand.Instance.PageAngleSave(App.ViewInfo.ProjectNO, ViewerDataModel.Instance.RotationDocs);
402
            }
403
            catch (Exception ex)
404
            {
405
                this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert(string.Format("세이브 실패:{0}", ex.Message), "Alert");
406
                throw ex;
407
            }
408
        }
409

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

    
428
                }
429
                else
430
                {
431
                    this.SaveEventCallback(null, null);
432
                }
433
            }
434

    
435
            bool isprint = false;
436
            if (Type == "Print")
437
            {
438
                isprint = true;
439
            }
440

    
441
            RadWindow PrintWindow = new RadWindow();
442
            //IKCOM.MarkupInfoItem _result = null;
443
            PrintWindow.Width = 850;
444
            PrintWindow.Height = 600;
445
            //PrintWindow.Width = 650;
446
            //PrintWindow.Height = 550;
447
            PrintWindow.Header = Type;
448

    
449
            List<IKCOM.MarkupInfoItem> markupinfo = new List<IKCOM.MarkupInfoItem>();
450

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

    
454
            if (markupinfo.Count() > 0)
455
            {
456
                Logger.sendResLog("GetPrintDocItemList", "TRUE", 1);
457
            }
458
            else
459
            {
460
                Logger.sendResLog("GetPrintDocItemList", "FALSE", 1);
461
            }
462

    
463
            var Tile_Url = string.Format(@"{0}/TileSource/{1}_Tile/{2}/{3}/",
464
                App.SystemInfo.HostName,
465
                App.ViewInfo.ProjectNO,
466
                (Convert.ToInt64(App.ViewInfo.DocumentItemID) / 100).ToString(),
467
                App.ViewInfo.DocumentItemID
468
                );
469

    
470
            PrintWindow.Content = new KCOM.Control.PrintControl(
471
                      Tile_Url,
472
                      App.ViewInfo.ProjectNO,
473
                      this.ParentOfType<MainWindow>().dzMainMenu._DocInfo, markupinfo,
474
                      this.ParentOfType<MainWindow>().dzMainMenu.pageNavigator.CurrentPage.PageNumber,
475
                      App.ViewInfo.DocumentItemID,
476
                      this.ParentOfType<MainWindow>().dzMainMenu._DocItem.DOCUMENT_NO,
477
                      this.ParentOfType<MainWindow>().dzMainMenu._DocItem.ORIGINAL_FILE, isprint);
478

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

    
491
        //강인구 추가
492
        private void PrintEvent(object sender, RoutedEventArgs e)
493
        {
494
            RadRibbonButton button = sender as RadRibbonButton;
495
            Print_Start(button.Content.ToString());
496
        }
497

    
498
        private List<AdornerMember> GetAdornerItem()
499
        {
500
            List<AdornerMember> AdonerList = new List<AdornerMember>();
501

    
502
            if (this.ParentOfType<MainWindow>() != null)
503
            {
504
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
505
                {
506
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
507
                    {
508
                        if (item.GetType().Name == "AdornerFinal")
509
                        {
510
                            foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
511
                            {
512
                                AdonerList.Add(InnerItem);
513
                            }
514
                        }
515
                    }
516
                }
517
            }
518

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

    
542
                foreach (AdornerMember InnerItem in AdonerList)
543
                {
544
                    InnerItem.DrawingData.Opacity = ViewerDataModel.Instance.ControlOpacity;
545
                  
546
                    multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
547
                    UndoData.Markup_List.Add(multi_Undo_Data);
548
                    multi_Undo_Data = new Multi_Undo_data();
549
                }
550

    
551
                ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
552
                {
553
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
554
                });
555
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
556
            }
557
        }
558

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

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

    
667
                    multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
668
                    UndoData.Markup_List.Add(multi_Undo_Data);
669
                    multi_Undo_Data = new Multi_Undo_data();
670
                }
671

    
672
                ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
673
                {
674
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
675
                });
676
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
677

    
678
                
679
            }
680
            KCOM.Properties.Settings.Default.LineSize = (double)cbLineSize.Value;
681
            Properties.Settings.Default.Save();
682
        }
683

    
684

    
685
        private void cbIntervalSize_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
686
        {
687
            if (string.IsNullOrEmpty(cbIntervalSize.Value.ToString()))
688
            {
689
                cbIntervalSize.Value = cbIntervalSize.Minimum;
690
            }
691
            List<AdornerMember> AdonerList = GetAdornerItem();
692
            if (AdonerList.Count > 0)
693
            {
694

    
695
                Undo_data UndoData = new Undo_data()
696
                {
697
                    IsUndo = false,
698
                    Event = Event_Type.Option,
699
                    EventTime = DateTime.Now,
700
                    Interval = ViewerDataModel.Instance.Interval,
701
                    Markup_List = new List<Multi_Undo_data>()
702
                };
703
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
704

    
705
                foreach (AdornerMember InnerItem in AdonerList)
706
                {
707
                    switch (InnerItem.DrawingData.GetType().Name)
708
                    {
709
                        case ("LineControl"):
710
                            {
711
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Line.LineControl).Interval = ViewerDataModel.Instance.Interval;
712

    
713
                                multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
714
                                UndoData.Markup_List.Add(multi_Undo_Data);
715
                                multi_Undo_Data = new Multi_Undo_data();
716
                            }
717
                            break;
718
                    }
719
                }
720

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

    
741
                //Undo_data UndoData = new Undo_data()
742
                //{
743
                //    IsUndo = false,
744
                //    Event = Event_Type.Option,
745
                //    EventTime = DateTime.Now,
746
                //    Interval = ViewerDataModel.Instance.Interval,
747
                //    Markup_List = new List<Multi_Undo_data>()
748
                //};
749
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
750

    
751
                foreach (AdornerMember InnerItem in AdonerList)
752
                {
753
                    switch (InnerItem.DrawingData.GetType().Name)
754
                    {
755
                        case ("RectCloudControl"):
756
                            {
757
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.RectCloudControl).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
                        case ("CloudControl"):
765
                            {
766
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Polygon.CloudControl).ArcLength = ViewerDataModel.Instance.ArcLength;
767

    
768
                                //multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
769
                                //UndoData.Markup_List.Add(multi_Undo_Data);
770
                                //multi_Undo_Data = new Multi_Undo_data();
771
                            }
772
                            break;
773
                    }
774
                }
775

    
776
                //ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
777
                //{
778
                //    ViewerDataModel.Instance.UndoDataList.Remove(i);
779
                //});
780
                //ViewerDataModel.Instance.UndoDataList.Add(UndoData);
781
            }
782

    
783
            KCOM.Properties.Settings.Default.ArcLength = (double)cbArcLength.Value;
784
            Properties.Settings.Default.Save();
785
        }
786

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

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

    
886
                                multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
887
                                UndoData.Markup_List.Add(multi_Undo_Data);
888
                                multi_Undo_Data = new Multi_Undo_data();
889
                            }
890

    
891
                            ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
892
                            {
893
                                ViewerDataModel.Instance.UndoDataList.Remove(i);
894
                            });
895
                            ViewerDataModel.Instance.UndoDataList.Add(UndoData);
896
                        }
897
                    }
898
                }
899
            }
900
        }
901

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

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

    
961
                                        }
962
                                        break;
963
                                    case ("ArrowTextControl"):
964
                                        {
965
                                            if ((InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextWeight == FontWeights.Bold)
966
                                            {
967
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextWeight = FontWeights.Normal;
968
                                            }
969
                                            else
970
                                            {
971
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextWeight = FontWeights.Bold;
972
                                            }
973
                                        }
974
                                        break;
975
                                }
976
                            }
977
                        }
978
                    }
979
                }
980
            }
981
        }
982

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

    
1009
                                        }
1010
                                        break;
1011
                                    case ("ArrowTextControl"):
1012
                                        {
1013
                                            if((InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextStyle == FontStyles.Italic)
1014
                                            {
1015
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextStyle = FontStyles.Normal;
1016
                                            }
1017
                                            else
1018
                                            {
1019
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextStyle = FontStyles.Italic;
1020
                                            }
1021
                                        }
1022
                                        break;
1023
                                }
1024
                            }
1025
                        }
1026
                    }
1027
                }
1028
            }
1029
        }
1030

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

    
1078
        private void AxisLockEvent(object sender, RoutedEventArgs e)
1079
        {
1080
            ViewerDataModel.Instance.checkAxis = cbAxisLock.IsChecked.Value;
1081
        }
1082

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

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

    
1170
        /// <summary>
1171
        /// 텍스트 컨트롤 하일라이트 처리
1172
        /// </summary>
1173
        /// <param name="sender"></param>
1174
        /// <param name="e"></param>
1175
        private void HighlightEvent(object sender, RoutedEventArgs e)
1176
        {
1177

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

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

    
1269
                    ((TextBox)sender).Text = previousText;
1270
                }
1271
            }
1272
        }
1273

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

    
1306
        public void PanoramaShow()
1307
        {
1308
            Panorama check = new Panorama();
1309
            double screenWidth = System.Windows.SystemParameters.PrimaryScreenWidth;
1310
            double screenHeight = System.Windows.SystemParameters.PrimaryScreenHeight;
1311
            //double windowWidth = this.Width;
1312
            //double windowHeight = this.Height;
1313

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

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

    
1352
                isClosed = false;
1353

    
1354
                
1355
                CheckList check = new CheckList();
1356

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

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

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

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

    
1433
        private void viewEvent(object sender, RoutedEventArgs e)
1434
        {
1435
            RadRibbonToggleButton viewButton = sender as RadRibbonToggleButton;
1436
            var instanceMain = this.ParentOfType<MainWindow>();
1437

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

    
1440
            //if ((sender as RadRibbonToggleButton) != null)
1441
            //{
1442
            //    Common.ViewerDataModel.Instance.ControlTag = (sender as RadRibbonToggleButton).Tag.ToString();
1443
            //    instanceToggle = (sender as RadRibbonToggleButton);
1444
            //}
1445

    
1446
            //instanceToggle.IsChecked = false;
1447

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

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

    
1513
        private void Control_Event(object sender, RoutedEventArgs e)
1514
        {
1515

    
1516
        }
1517

    
1518
        #region 대기
1519

    
1520
        public void drawingPannelRotate(bool Flag)
1521
        {
1522
            var instanceMain = this.ParentOfType<MainWindow>();
1523

    
1524
            //if (rotateOffSet > 3)
1525
            //    rotateOffSet = 0;
1526

    
1527
            //if (rotateOffSet < 0)
1528
            //    rotateOffSet = 3;
1529

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

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

    
1583
            //instanceMain.dzMainMenu.zoomAndPanControl.RenderTransformOrigin = new Point(0.5, 0.5);
1584
            instanceMain.dzMainMenu.zoomAndPanControl.RotationAngle = instanceMain.dzMainMenu.rotate.Angle;
1585
            //대기(강인구)
1586
            //instanceMain.dzMainMenu.imageViewer.RotateAngle = instanceMain.dzMainMenu.rotate.Angle;
1587

    
1588

    
1589
            //instanceMain.dzMainMenu.imageViewer.RenderTransformOrigin = new Point(0.5, 0.5);
1590
            //RotateTransform rotateTransform = new RotateTransform(instanceMain.dzMainMenu.rotate.Angle);
1591
            //instanceMain.dzMainMenu.imageViewer.RenderTransform = rotateTransform;
1592

    
1593

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

    
1605

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

    
1611
                instanceMain.dzMainMenu.pageNavigator.ImgListbox.ItemsSource = instanceMain.dzMainMenu.pageNavigator._thumbnailItems;
1612
                var instance = instanceMain.dzMainMenu.CurrentDoc.docInfo.DOCPAGE.Where(p => p.PAGE_NUMBER == instanceMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber).FirstOrDefault();
1613
                instance.PAGE_ANGLE = int.Parse(instanceMain.dzMainMenu.rotate.Angle.ToString());
1614

    
1615
                instanceMain.dzMainMenu.pageNavigator.GotoPage(data.PageNumber);
1616

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

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

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

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

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

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

    
1661
                        Check_Uri.UriCheck(filepath);
1662

    
1663
                        instanceMain.dzMainMenu.filename = filepath;
1664

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

    
1694
        private void Control_Init(RadToggleButton instanceToggle, object sender)
1695
        {
1696

    
1697
        }
1698

    
1699
        private void ControlEvent(object sender, RoutedEventArgs e)
1700
        {
1701
            RadToggleButton instanceToggle = sender as RadToggleButton;
1702
            var instanceMain = this.ParentOfType<MainWindow>();
1703

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

    
1724
            //if (!instanceMain.IsFreeSelectionMode)
1725
            //{
1726
            //    instanceMain.IsSwingMode = true;
1727
            //}
1728

    
1729
            #region 다른 컨트롤 버튼 선택 해제
1730
            System.Reactive.Linq.Observable2.FromPropertyChangedPattern(Common.ViewerDataModel.Instance, temp => temp.SelectedControl).Subscribe(ControlState =>
1731
            {
1732
                if (ControlState == null)
1733
                {
1734
                    instanceToggle.IsChecked = false;
1735
                    HiddenControlHide();
1736
                }
1737
            });
1738
            #endregion
1739

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

    
1742
            if (instanceToggle != null)
1743
            {
1744
                Common.ViewerDataModel.Instance.ControlTag = instanceToggle.Tag.ToString();
1745
            }
1746
            else if ((sender as RadRibbonToggleButton) != null)
1747
            {
1748
                Common.ViewerDataModel.Instance.ControlTag = (sender as RadRibbonToggleButton).Tag.ToString();
1749
                instanceToggle = (sender as RadRibbonToggleButton);
1750
            }
1751
            else if ((sender as RadRibbonButton) != null)
1752
            {
1753
                RadRibbonButton instanceButton = sender as RadRibbonButton;
1754
                Common.ViewerDataModel.Instance.ControlTag = instanceButton.Tag.ToString();
1755
            }
1756
            else
1757
            {
1758
                RadButton instanceButton = sender as RadButton;
1759
                Common.ViewerDataModel.Instance.ControlTag = instanceButton.Tag.ToString();
1760
            }
1761

    
1762

    
1763

    
1764
            System.Reactive.Linq.Observable2.FromPropertyChangedPattern(Common.ViewerDataModel.Instance, temp => temp.AngleVisibility).Subscribe(isSee =>
1765
            {
1766
                instanceMain.dzMainMenu.MainAngle.Visibility = isSee;
1767
                System.Reactive.Linq.Observable2.FromPropertyChangedPattern(Common.ViewerDataModel.Instance, temp => temp.AngleValue).Subscribe(p =>
1768
                {
1769
                    instanceMain.dzMainMenu.MainAngle.AngleValue = p;
1770
                });
1771
            });
1772
            instanceMain.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Drawing;
1773

    
1774
            instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = false;
1775

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

    
2001
                        //instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = true;
2002

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

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

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

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

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

    
2233

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

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

    
2260
                        ViewerDataModel.Instance.SelectedControl = "ImgControl";
2261
                   //     ViewerDataModel.Instance.ControlTag = null;
2262
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ImgControl;
2263

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

    
2277
                            }
2278
                            else
2279
                            {
2280
                                (Application.Current.MainWindow as MainWindow).dzTopMenu.RefactoryCommentReact(menu);
2281
                            }
2282
                        }*/
2283

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

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

    
2345
                            isClosed = false;
2346
                            CadResultViewer check = new CadResultViewer();
2347
                            check.WindowStartupLocation = WindowStartupLocation.CenterScreen;
2348
                            check.Title = "Viewer";
2349
                            check.Show();
2350

    
2351
                            check.Closed += Check_Closed;
2352

    
2353
                        }
2354
                        break;
2355
                    #endregion
2356
                    default:
2357
                        break;
2358
                }
2359
                #endregion
2360
            }
2361
            else
2362
            {
2363

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

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

    
2396
        }
2397

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

    
2413
        }
2414

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

    
2425
            string[] data = new string[0];
2426

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

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

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

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

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

    
2463
        private double minHeight;
2464
        private double minWidth;
2465

    
2466
        private double maxHeight;
2467
        private double maxWidth;
2468

    
2469
        public bool CanVResize { get; private set; }
2470
        public bool CanHResize { get; private set; }
2471

    
2472
        public void DesignerComponent(FrameworkElement content)
2473
        {
2474
            this.InitializeComponent();
2475

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
2708
                SelectionSet.Instance.UnSelect(this.ParentOfType<MainWindow>().dzMainMenu);
2709

    
2710
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
2711

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

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

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

    
2733
                        ViewerDataModel.Instance.MarkupControls.Remove(item as MarkupToPDF.Common.CommentUserInfo);
2734
                        ViewerDataModel.Instance.MarkupControls_USER.Remove(item as MarkupToPDF.Common.CommentUserInfo);
2735

    
2736
                        adornerSet.Add(item as MarkupToPDF.Common.CommentUserInfo);
2737

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

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

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

    
2749
                if(this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.X < 0)
2750
                {
2751
                    Canvas.SetLeft(final, 0);
2752
                    Canvas.SetTop(final, 0);
2753
                }
2754
                else
2755
                {
2756
                    double realPointX = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.X - final.BorderSize.X - (final.BorderSize.Width / 2);
2757
                    double realPointY = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.Y - final.BorderSize.Y - (final.BorderSize.Height / 2);
2758
                    final.TranslateItems(realPointX, realPointY);
2759

    
2760
                    if (final.Members.Where(type => type.Drawingtype == MarkupToPDF.Controls.Common.ControlType.TextControl).FirstOrDefault() != null)
2761
                    {
2762
                        final.TranslateItems(0.001, 0.001); //dummy
2763
                    }
2764

    
2765
                }
2766
                
2767

    
2768
                this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Add(final);
2769

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

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

    
2790

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

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

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

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

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

    
2823
                    fileInfo.Delete();
2824

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

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

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

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

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

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

    
2879
                    currentControl.ApplyTemplate();
2880
                    currentControl.SetImage();
2881

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

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