프로젝트

일반

사용자정보

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

markus / KCOM / Events / Implementation / TopMenuEvent.cs @ 2dfbf711

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

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

    
27
namespace KCOM.Views
28
{
29
    public partial class TopMenu : UserControl
30
    {
31
        public int rotateOffSet = 0;
32
        private double[] rotateValue = { 0, 90, 180, 270 };
33
        public System.Windows.Threading.DispatcherTimer SaveTimer { get; set; }
34
        public bool isClosed = true;
35
        public RadWindow CheckPop;
36
        public RadWindow OptionPop;
37
        public MarkupToPDF.Common.Undo_data UndoData;
38
        MarkupToPDF.Controls.Parsing.MarkupParser.MarkupReturn markupReturn = new MarkupToPDF.Controls.Parsing.MarkupParser.MarkupReturn();
39

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

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

    
66
        private void CheckShapeState()
67
        {
68

    
69

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

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

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

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

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

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

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

    
124
            }
125

    
126
        }
127

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

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

    
152
        }
153

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

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

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

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

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

    
239
 		//강인구 추가
240
        private string SetColor(string ID)
241
        {
242
            try
243
            {
244
                return ViewerDataModel.Instance._markupInfoList.Where(info => info.MarkupInfoID == ID).First().DisplayColor;
245
            }
246
            catch (Exception)
247
            {
248
                return "#FFFFFF";
249
            }
250
        }
251

    
252
        void SaveTimer_Tick(object sender, EventArgs e)
253
        {
254
            //if (this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode != IKCOM.MouseHandlingMode.Drawing)
255
            if (this.ParentOfType<MainWindow>().dzMainMenu.currentControl == null && this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count == 0)
256
            {
257
                SaveEvent(null, null);
258
            }
259

    
260
        }
261

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

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

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

    
312
            if (this.ParentOfType<MainWindow>().dzMainMenu.busyIndicator.IsBusy == true) return;
313

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

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

    
335
                this.ParentOfType<MainWindow>().dzMainMenu.InkControl_Convert();
336

    
337
                var menu = this.ParentOfType<MainWindow>().dzMainMenu;
338

    
339
                //코멘트가 없을 경우
340
                if (ViewerDataModel.Instance.MarkupList_USER.Count == 0)
341
                {
342
                    foreach (var item in menu.gridViewMarkup.SelectedItems)
343
                    {
344
                        if ((item as IKCOM.MarkupInfoItem).UserID == App.ViewInfo.UserID)
345
                        {
346
                            this.ParentOfType<MainWindow>().dzMainMenu.DeleteItem((item as IKCOM.MarkupInfoItem));
347
                            return;
348
                        }
349
                    }
350
                }
351

    
352
                menu.ChangeCommentReact();
353

    
354
                if (menu.PreviewUserMarkupInfoItem != null && menu.PreviewUserMarkupInfoItem.IsPreviewUser == true)
355
                {
356
                    RefactoryCommentReact(menu);
357
                }
358
                else if (menu.gridViewMarkup.SelectedItems.Count == 0 && menu.gridViewMarkup.Items.Count > 0)
359
                {
360
                    this.ParentOfType<MainWindow>().DialogMessage_Alert("Please Select Your Comment List Item", "Alert");
361
                    return;
362
                }
363
                else
364
                {
365
                    foreach (var item in menu.gridViewMarkup.SelectedItems)
366
                    {
367
                        if ((item as IKCOM.MarkupInfoItem).UserID == App.ViewInfo.UserID)
368
                        {
369
                            RefactoryCommentReact(menu);
370
                            ViewerDataModel.Instance._markupInfoList.Where(data => data.MarkupInfoID == (item as IKCOM.MarkupInfoItem).MarkupInfoID).FirstOrDefault().UpdateTime = DateTime.Now;
371

    
372

    
373
                            if (ViewerDataModel.Instance.IsConsolidate)
374
                            {
375
                                return;
376
                            }
377
                            menu.gridViewMarkup.ItemsSource = null;
378
                            menu.gridViewMarkup.ItemsSource = ViewerDataModel.Instance._markupInfoList;
379
                            menu.gridViewMarkup.SelectedItem = item;
380
                            GroupDescriptor descriptor = new GroupDescriptor();
381
                            descriptor.Member = "Depatment";
382
                            descriptor.DisplayContent = "DEPT";
383
                            descriptor.SortDirection = ListSortDirection.Ascending;
384
                            menu.gridViewMarkup.GroupDescriptors.Add(descriptor);
385
                            if (sender != null)
386
                            {
387
                                if (ViewerDataModel.Instance.IsPressCtrl)
388
                                {
389
                                    ViewerDataModel.Instance.IsPressCtrl = false;
390
                                }
391
                                this.ParentOfType<MainWindow>().DialogMessage_Alert("Save 가 완료되었습니다.", "Alert");
392
                            }
393
                            return;
394
                        }
395
                    }
396
                }
397
                if (sender != null)
398
                {
399
                    if (ViewerDataModel.Instance.IsPressCtrl)
400
                    {
401
                        ViewerDataModel.Instance.IsPressCtrl = false;
402
                    }
403
                    this.ParentOfType<MainWindow>().DialogMessage_Alert("Save 가 완료되었습니다.", "Alert");
404
                }
405
            }
406
            catch(Exception ex)
407
            {
408
               
409
            }
410
            finally
411
            {
412
            }
413
        }
414

    
415
		public void RefactoryCommentReact(MainMenu menu)
416
        {
417
            this.ParentOfType<MainWindow>().dzMainMenu.InkControl_Convert();
418

    
419
            SaveCommand.Instance.Project_No = App.ViewInfo.ProjectNO;
420
            SaveCommand.Instance.document_id = App.ViewInfo.DocumentItemID;
421
            SaveCommand.Instance.user_id = App.ViewInfo.UserID;
422
            SaveCommand.Instance.page_no = Convert.ToInt32(tlcurrentPage.Text);
423

    
424
            try
425
            {
426
                List<IKCOM.MarkupInfoItem> MySelectItem = new List<IKCOM.MarkupInfoItem>();
427
                foreach (var item in menu.gridViewMarkup.SelectedItems)
428
                {
429
                    if ((item as IKCOM.MarkupInfoItem).UserID == App.ViewInfo.UserID)
430
                    {
431
                        MySelectItem.Add(item as IKCOM.MarkupInfoItem);
432
                    }
433
                }
434

    
435
                menu.ChangeCommentReact();
436
                SaveCommand.Instance.Execute(MySelectItem, SaveCommand.Instance.page_no);
437
                SaveCommand.Instance.PageAngleSave(App.ViewInfo.ProjectNO, ViewerDataModel.Instance.RotationDocs);
438
            }
439
            catch (Exception ex)
440
            {
441
                this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert(string.Format("세이브 실패:{0}", ex.Message), "Alert");
442
                throw ex;
443
            }
444
        }
445

    
446
        //강인구 추가
447
        public void Print_Start(string Type)
448
        {
449
            if (ViewerDataModel.Instance.IsPressCtrl)
450
            {
451
                ViewerDataModel.Instance.IsPressCtrl = false;
452
            }
453
            if (ViewerDataModel.Instance.MarkupControls_USER.Count > 0 || this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
454
            {
455
                var menu = this.ParentOfType<MainWindow>().dzMainMenu;
456
                SelectionSet.Instance.UnSelect(menu);
457
                if (menu.PreviewUserMarkupInfoItem != null && menu.PreviewUserMarkupInfoItem.IsPreviewUser == true)
458
                {
459
                    RefactoryCommentReact(menu);
460
                }
461
                else if (menu.gridViewMarkup.SelectedItems.Count == 0 || (menu.gridViewMarkup.SelectedItems.FirstOrDefault() as IKCOM.MarkupInfoItem).UserID != App.ViewInfo.UserID)
462
                {
463

    
464
                }
465
                else
466
                {
467
                    RefactoryCommentReact(menu);
468
                }
469
            }
470

    
471
            bool isprint = false;
472
            if (Type == "Print")
473
            {
474
                isprint = true;
475
            }
476

    
477
            RadWindow PrintWindow = new RadWindow();
478
            //IKCOM.MarkupInfoItem _result = null;
479
            PrintWindow.Width = 850;
480
            PrintWindow.Height = 600;
481
            //PrintWindow.Width = 650;
482
            //PrintWindow.Height = 550;
483
            PrintWindow.Header = Type;
484

    
485
            List<IKCOM.MarkupInfoItem> markupinfo = new List<IKCOM.MarkupInfoItem>();
486

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

    
490
            if (markupinfo.Count() > 0)
491
            {
492
                Logger.sendResLog("GetPrintDocItemList", "TRUE", 1);
493
            }
494
            else
495
            {
496
                Logger.sendResLog("GetPrintDocItemList", "FALSE", 1);
497
            }
498

    
499
            var Tile_Url = string.Format(@"{0}/TileSource/{1}_Tile/{2}/{3}/",
500
                App.SystemInfo.HostName,
501
                App.ViewInfo.ProjectNO,
502
                (Convert.ToInt64(App.ViewInfo.DocumentItemID) / 100).ToString(),
503
                App.ViewInfo.DocumentItemID
504
                );
505

    
506
            PrintWindow.Content = new KCOM.Control.PrintControl(
507
                      Tile_Url,
508
                      App.ViewInfo.ProjectNO,
509
                      this.ParentOfType<MainWindow>().dzMainMenu._DocInfo, markupinfo,
510
                      this.ParentOfType<MainWindow>().dzMainMenu.pageNavigator.CurrentPage.PageNumber,
511
                      App.ViewInfo.DocumentItemID,
512
                      this.ParentOfType<MainWindow>().dzMainMenu._DocItem.DOCUMENT_NO,
513
                      this.ParentOfType<MainWindow>().dzMainMenu._DocItem.ORIGINAL_FILE, isprint);
514

    
515
            //프린트 팝업 옵션
516
            //PrintWindow.BorderThickness = new Thickness(3);
517
            //PrintWindow.BorderBrush = new SolidColorBrush(Color.FromArgb(255, 37, 160, 218));
518
            PrintWindow.ResizeMode = System.Windows.ResizeMode.NoResize;
519
            PrintWindow.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
520
            PrintWindow.Background = new SolidColorBrush(Colors.Black);
521
            PrintWindow.Background.Opacity = 0.6;
522
            PrintWindow.Owner = Application.Current.MainWindow;
523
            Telerik.Windows.Controls.StyleManager.SetTheme(PrintWindow, new Telerik.Windows.Controls.VisualStudio2013Theme());
524
            PrintWindow.ShowDialog();
525
        }
526

    
527
        //강인구 추가
528
        private void PrintEvent(object sender, RoutedEventArgs e)
529
        {
530
            RadRibbonButton button = sender as RadRibbonButton;
531
            Print_Start(button.Content.ToString());
532
        }
533

    
534
        private List<AdornerMember> GetAdornerItem()
535
        {
536
            List<AdornerMember> AdonerList = new List<AdornerMember>();
537

    
538
            if (this.ParentOfType<MainWindow>() != null)
539
            {
540
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
541
                {
542
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
543
                    {
544
                        if (item.GetType().Name == "AdornerFinal")
545
                        {
546
                            foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
547
                            {
548
                                AdonerList.Add(InnerItem);
549
                            }
550
                        }
551
                    }
552
                }
553
            }
554
            return AdonerList;
555
        }
556
        /// <summary>
557
        /// 투명도
558
        /// </summary>
559
        /// <param name="sender"></param>
560
        /// <param name="e"></param>
561
        //강인구 추가(Undo End)
562
        private void sdOpacity_ValueChanged(object sender, RoutedEventArgs e)
563
        {
564
            List<AdornerMember> AdonerList = GetAdornerItem();
565
            if(AdonerList.Count > 0)
566
            {
567
                Undo_data UndoData = new Undo_data()
568
                {
569
                    IsUndo = false,
570
                    Event = Event_Type.Option,
571
                    EventTime = DateTime.Now,
572
                    Opacity = ViewerDataModel.Instance.ControlOpacity,
573
                    Markup_List = new List<Multi_Undo_data>()
574
                };
575
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
576

    
577
                foreach (AdornerMember InnerItem in AdonerList)
578
                {
579
                    InnerItem.DrawingData.Opacity = ViewerDataModel.Instance.ControlOpacity;
580
                  
581
                    multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
582
                    UndoData.Markup_List.Add(multi_Undo_Data);
583
                    multi_Undo_Data = new Multi_Undo_data();
584
                }
585

    
586
                ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
587
                {
588
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
589
                });
590
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
591
            }
592
        }
593

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

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

    
702
                    multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
703
                    UndoData.Markup_List.Add(multi_Undo_Data);
704
                    multi_Undo_Data = new Multi_Undo_data();
705
                }
706

    
707
                ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
708
                {
709
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
710
                });
711
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
712

    
713
                
714
            }
715
            KCOM.Properties.Settings.Default.LineSize = (double)cbLineSize.Value;
716
            Properties.Settings.Default.Save();
717
        }
718

    
719

    
720
        private void cbIntervalSize_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
721
        {
722
            if (string.IsNullOrEmpty(cbIntervalSize.Value.ToString()))
723
            {
724
                cbIntervalSize.Value = cbIntervalSize.Minimum;
725
            }
726
            List<AdornerMember> AdonerList = GetAdornerItem();
727
            if (AdonerList.Count > 0)
728
            {
729

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

    
740
                foreach (AdornerMember InnerItem in AdonerList)
741
                {
742
                    switch (InnerItem.DrawingData.GetType().Name)
743
                    {
744
                        case ("LineControl"):
745
                            {
746
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Line.LineControl).Interval = ViewerDataModel.Instance.Interval;
747

    
748
                                multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
749
                                UndoData.Markup_List.Add(multi_Undo_Data);
750
                                multi_Undo_Data = new Multi_Undo_data();
751
                            }
752
                            break;
753
                    }
754
                }
755

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

    
776
                //Undo_data UndoData = new Undo_data()
777
                //{
778
                //    IsUndo = false,
779
                //    Event = Event_Type.Option,
780
                //    EventTime = DateTime.Now,
781
                //    Interval = ViewerDataModel.Instance.Interval,
782
                //    Markup_List = new List<Multi_Undo_data>()
783
                //};
784
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
785

    
786
                foreach (AdornerMember InnerItem in AdonerList)
787
                {
788
                    switch (InnerItem.DrawingData.GetType().Name)
789
                    {
790
                        case ("RectCloudControl"):
791
                            {
792
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.RectCloudControl).ArcLength = ViewerDataModel.Instance.ArcLength;
793

    
794
                                //multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
795
                                //UndoData.Markup_List.Add(multi_Undo_Data);
796
                                //multi_Undo_Data = new Multi_Undo_data();
797
                            }
798
                            break;
799
                        case ("CloudControl"):
800
                            {
801
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Polygon.CloudControl).ArcLength = ViewerDataModel.Instance.ArcLength;
802

    
803
                                //multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
804
                                //UndoData.Markup_List.Add(multi_Undo_Data);
805
                                //multi_Undo_Data = new Multi_Undo_data();
806
                            }
807
                            break;
808
                    }
809
                }
810

    
811
                //ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
812
                //{
813
                //    ViewerDataModel.Instance.UndoDataList.Remove(i);
814
                //});
815
                //ViewerDataModel.Instance.UndoDataList.Add(UndoData);
816
            }
817

    
818
            KCOM.Properties.Settings.Default.ArcLength = (double)cbArcLength.Value;
819
            Properties.Settings.Default.Save();
820
        }
821

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

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

    
921
                                multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
922
                                UndoData.Markup_List.Add(multi_Undo_Data);
923
                                multi_Undo_Data = new Multi_Undo_data();
924
                            }
925

    
926
                            ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
927
                            {
928
                                ViewerDataModel.Instance.UndoDataList.Remove(i);
929
                            });
930
                            ViewerDataModel.Instance.UndoDataList.Add(UndoData);
931
                        }
932
                    }
933
                }
934
            }
935
        }
936

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

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

    
996
                                        }
997
                                        break;
998
                                    case ("ArrowTextControl"):
999
                                        {
1000
                                            if ((InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextWeight == FontWeights.Bold)
1001
                                            {
1002
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextWeight = FontWeights.Normal;
1003
                                            }
1004
                                            else
1005
                                            {
1006
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextWeight = FontWeights.Bold;
1007
                                            }
1008
                                        }
1009
                                        break;
1010
                                }
1011
                            }
1012
                        }
1013
                    }
1014
                }
1015
            }
1016
        }
1017

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

    
1044
                                        }
1045
                                        break;
1046
                                    case ("ArrowTextControl"):
1047
                                        {
1048
                                            if((InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextStyle == FontStyles.Italic)
1049
                                            {
1050
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextStyle = FontStyles.Normal;
1051
                                            }
1052
                                            else
1053
                                            {
1054
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextStyle = FontStyles.Italic;
1055
                                            }
1056
                                        }
1057
                                        break;
1058
                                }
1059
                            }
1060
                        }
1061
                    }
1062
                }
1063
            }
1064
        }
1065

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

    
1113
        private void AxisLockEvent(object sender, RoutedEventArgs e)
1114
        {
1115
            ViewerDataModel.Instance.checkAxis = cbAxisLock.IsChecked.Value;
1116
        }
1117

    
1118
        private void comboFontSize_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
1119
        {
1120
            if (string.IsNullOrEmpty(comboFontSize.Value.ToString()))
1121
            {
1122
                comboFontSize.Value = comboFontSize.Minimum;
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).MemberSet.Cast<Controls.AdornerMember>())
1133
                            {
1134
                                switch (InnerItem.DrawingData.GetType().Name)
1135
                                {
1136
                                    case ("TextControl"):
1137
                                        {
1138
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextSize = int.Parse(comboFontSize.Value.ToString());
1139
                                        }
1140
                                        break;
1141
                                    case ("ArrowTextControl"):
1142
                                        {
1143
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextSize = int.Parse(comboFontSize.Value.ToString());
1144
                                        }
1145
                                        break;
1146
                                }
1147
                            }
1148
                        }
1149
                    }
1150
                }
1151
            }
1152
            KCOM.Properties.Settings.Default.TextSize = (double)comboFontSize.Value;
1153
            Properties.Settings.Default.Save();
1154
        }
1155

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

    
1205
        /// <summary>
1206
        /// 텍스트 컨트롤 하일라이트 처리
1207
        /// </summary>
1208
        /// <param name="sender"></param>
1209
        /// <param name="e"></param>
1210
        private void HighlightEvent(object sender, RoutedEventArgs e)
1211
        {
1212

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

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

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

    
1277
            }
1278
        }
1279
        
1280

    
1281
        //public event EventHandler<WindowClosedEventArgs> Closed;
1282

    
1283
        //private void CheckEvent(object sender, RoutedEventArgs e)
1284
        //{
1285
        //    RadWindow CheckPop = new RadWindow();
1286
        //    test check = new test();
1287

    
1288
        //    CheckPop = new RadWindow
1289
        //    {
1290
        //        Width = 1700,
1291
        //        Height = 510,
1292
        //        Header = "My Check List",
1293
        //        Content = check,
1294
        //        Owner = this,
1295
        //        ResizeMode = System.Windows.ResizeMode.NoResize,
1296
        //        WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen,
1297
        //    };
1298
        //    StyleManager.SetTheme(CheckPop, new VisualStudio2013Theme());
1299

    
1300
        //    CheckPop.Closed += CheckPop_Closed;
1301
        //    CheckPop.ShowDialog();
1302
        //}
1303

    
1304
        private void PanoramaEvent(object sender, RoutedEventArgs e)
1305
        {
1306
            PanoramaShow();
1307
        }
1308

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

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

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

    
1355
                isClosed = false;
1356

    
1357
                
1358
                CheckList check = new CheckList();
1359

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

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

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

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

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

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

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

    
1449
            //instanceToggle.IsChecked = false;
1450

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

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

    
1516
        private void Control_Event(object sender, RoutedEventArgs e)
1517
        {
1518

    
1519
        }
1520

    
1521
        #region 대기
1522

    
1523
        public void drawingPannelRotate(bool Flag)
1524
        {
1525
            var instanceMain = this.ParentOfType<MainWindow>();
1526

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

    
1530
            //if (rotateOffSet < 0)
1531
            //    rotateOffSet = 3;
1532

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

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

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

    
1591

    
1592
            //instanceMain.dzMainMenu.imageViewer.RenderTransformOrigin = new Point(0.5, 0.5);
1593
            //RotateTransform rotateTransform = new RotateTransform(instanceMain.dzMainMenu.rotate.Angle);
1594
            //instanceMain.dzMainMenu.imageViewer.RenderTransform = rotateTransform;
1595

    
1596

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

    
1608

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

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

    
1618
                instanceMain.dzMainMenu.pageNavigator.setPageChange(data);
1619

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

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

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

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

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

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

    
1664
                        Check_Uri.UriCheck(filepath);
1665

    
1666
                        instanceMain.dzMainMenu.filename = filepath;
1667

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

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

    
1691
        }
1692

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

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

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

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

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

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

    
1756

    
1757

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

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

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

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

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

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

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

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

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

    
2227

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

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

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

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

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

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

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

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

    
2345
                            check.Closed += Check_Closed;
2346

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

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

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

    
2390
        }
2391

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

    
2418
        }
2419

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

    
2430
            string[] data = new string[0];
2431

    
2432
            int cnt = 0;
2433
            var menu = this.ParentOfType<MainWindow>().dzMainMenu;
2434

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

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

    
2451
            if (data != null)
2452
            {
2453
                string FilePath = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\Cad");
2454
                string FileName = FilePath + "\\commentstring.json"; // Default file name
2455
                if (!File.Exists(FilePath))
2456
                {
2457
                    Directory.CreateDirectory(FilePath);
2458
                }
2459

    
2460
                if (!string.IsNullOrEmpty(FileName))
2461
                {
2462
                    //  File.WriteAllText(SaveDig.FileName, data);
2463
                    File.WriteAllLines(FileName, data);
2464
                }
2465
            }
2466
        }
2467

    
2468
        private double minHeight;
2469
        private double minWidth;
2470

    
2471
        private double maxHeight;
2472
        private double maxWidth;
2473

    
2474
        public bool CanVResize { get; private set; }
2475
        public bool CanHResize { get; private set; }
2476

    
2477
        public void DesignerComponent(FrameworkElement content)
2478
        {
2479
            this.InitializeComponent();
2480

    
2481
            if (!double.IsNaN(content.Width))
2482
            {
2483
                CanHResize = false;
2484
                this.Width = content.Width;
2485
            }
2486
            else
2487
            {
2488
                CanHResize = true;
2489
                this.Width = 23.0;
2490
            }
2491
            if (!double.IsNaN(content.Height))
2492
            {
2493
                CanVResize = false;
2494
                this.Height = content.Height; ;
2495
            }
2496
            else
2497
            {
2498
                CanVResize = true;
2499
                this.Height = 23.0;
2500
            }
2501

    
2502
            minWidth = content.MinWidth < 10.0 ? 10.0 : content.MinWidth;
2503
            minHeight = content.MinHeight < 10.0 ? 10.0 : content.MinHeight;
2504
            maxWidth = content.MaxWidth;
2505
            maxHeight = content.MaxHeight;
2506

    
2507
            double top = (double)content.GetValue(Canvas.TopProperty);
2508
            if (double.IsNaN(top))
2509
                top = 0.0;
2510
            double left = (double)content.GetValue(Canvas.LeftProperty);
2511
            if (double.IsNaN(left))
2512
                left = 0.0;
2513
            SetValue(Canvas.TopProperty, top);
2514
            SetValue(Canvas.LeftProperty, left);
2515

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

    
2556
        private void drawControlBorder(object sender)
2557
        {
2558
            System.Windows.Controls.Control control = (System.Windows.Controls.Control)sender;
2559
        }
2560

    
2561
        private void ResizeThumb_DragDelta(object sender, MouseButtonEventArgs e)
2562
        {
2563
            System.Windows.Controls.Control designerItem = (System.Windows.Controls.Control)sender;
2564
            if (designerItem != null)
2565
            {
2566
                double deltaVertical, deltaHorizontal;
2567

    
2568
                switch (VerticalAlignment)
2569
                {
2570
                    case VerticalAlignment.Bottom:
2571
                        deltaVertical = designerItem.ActualHeight - designerItem.MinHeight;
2572
                        designerItem.Height -= deltaVertical;
2573
                        break;
2574
                    case VerticalAlignment.Top:
2575
                        deltaVertical = designerItem.ActualHeight - designerItem.MinHeight;
2576
                        Canvas.SetTop(designerItem, Canvas.GetTop(designerItem) + deltaVertical);
2577
                        designerItem.Height -= deltaVertical;
2578
                        break;
2579
                    default:
2580
                        break;
2581
                }
2582

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

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

    
2603
        void ExportMethod()
2604
        {
2605
            //FileDialogFilter filterImage = new FileDialogFilter("Image Files", "*.jpg", "*.png");
2606
            SaveDig.Filter = "PDF file format|*.pdf";
2607
            SaveDig.Title = "Save an DWG File";
2608
            SaveDig.ShowDialog();
2609
        }
2610

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

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

    
2641
            if(instanceToggle.IsChecked == true)
2642
            {
2643
                SaveTime(true);
2644
            }
2645
            else
2646
            {
2647
                SaveTime(false);
2648
            }
2649
        }
2650

    
2651
        public void Copy_Start()
2652
        {
2653
            if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
2654
            {
2655
                string MarkupData = "";
2656

    
2657
                foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
2658
                {
2659
                    if (item.GetType().Name == "AdornerFinal")
2660
                    {
2661
                        foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
2662

    
2663
                        {
2664
                            if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
2665
                            {
2666
                                markupReturn = MarkupParser.MarkupToString(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo, App.ViewInfo.UserID);
2667
                                MarkupData += "|OR|" + markupReturn.ConvertData;
2668
                            }
2669
                        }
2670
                        Clipboard.SetText(MarkupData);
2671
                    }
2672
                }
2673
            }
2674
        }
2675

    
2676
        public void Cut_Start()
2677
        {
2678
            if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
2679
            {
2680
                foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
2681
                {
2682
                    string MarkupData = "";
2683

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

    
2702
        public void Paste_Start()
2703
        {
2704
            //마크업 붙여넣기
2705
            //if (Clipboard.GetText().Contains("|DZ|"))
2706
            if (Clipboard.GetText().Contains("|OR||DZ|"))
2707
            {
2708
                List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>();
2709

    
2710
                string[] delimiterChars = { "|OR|" };
2711
                string[] data = Clipboard.GetText().Split(delimiterChars, StringSplitOptions.RemoveEmptyEntries);
2712

    
2713
                SelectionSet.Instance.UnSelect(this.ParentOfType<MainWindow>().dzMainMenu);
2714

    
2715
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
2716

    
2717
                //강인구 Undo/Redo 보류
2718
                UndoData = new Undo_data()
2719
                {
2720
                    IsUndo = false,
2721
                    Event = Event_Type.Create,
2722
                    EventTime = DateTime.Now,
2723
                    Markup_List = new List<Multi_Undo_data>()
2724
                };
2725

    
2726
                ViewerDataModel.Instance.UndoDataList.Where(data1 => data1.IsUndo == true).ToList().ForEach(i =>
2727
                {
2728
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
2729
                });
2730

    
2731
                foreach (string parse in data)
2732
                {
2733
                    if (parse != "")
2734
                    {
2735
                        System.Windows.Controls.Control item = MarkupParser.ParseEx(App.ViewInfo.ProjectNO, parse, ViewerDataModel.Instance.MarkupControls_USER, string.Empty, string.Empty);
2736
                        (item as MarkupToPDF.Common.CommentUserInfo).CommentID = Commons.shortGuid();
2737

    
2738
                        ViewerDataModel.Instance.MarkupControls.Remove(item as MarkupToPDF.Common.CommentUserInfo);
2739
                        ViewerDataModel.Instance.MarkupControls_USER.Remove(item as MarkupToPDF.Common.CommentUserInfo);
2740

    
2741
                        adornerSet.Add(item as MarkupToPDF.Common.CommentUserInfo);
2742

    
2743
                        //Controls.AdornerFinal final = new Controls.AdornerFinal(item as MarkupToPDF.Common.CommentUserInfo);
2744
                        //this.dzMainMenu.SelectLayer.Children.Add(final);
2745

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

    
2748
                        UndoData.Markup_List.Add(multi_Undo_Data);
2749
                        ViewerDataModel.Instance.UndoDataList.Add(UndoData);                        
2750
                    }
2751
                }
2752
                Controls.AdornerFinal final = new Controls.AdornerFinal(adornerSet);
2753

    
2754
                if(this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.X < 0)
2755
                {
2756
                    Canvas.SetLeft(final, 0);
2757
                    Canvas.SetTop(final, 0);
2758
                }
2759
                else
2760
                {
2761
                    double realPointX = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.X - final.BorderSize.X - (final.BorderSize.Width / 2);
2762
                    double realPointY = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.Y - final.BorderSize.Y - (final.BorderSize.Height / 2);
2763
                    final.MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(realPointX, realPointY));
2764

    
2765
                    if (final.MemberSet.Where(type => type.Drawingtype == MarkupToPDF.Controls.Common.ControlType.TextControl).FirstOrDefault() != null)
2766
                    {
2767
                        final.MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(0.001, 0.001)); //dummy
2768
                    }
2769

    
2770
                }
2771
                
2772

    
2773
                this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Add(final);
2774

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

    
2786
                    //강인구 Undo/Redo 보류
2787
                    UndoData = new Undo_data()
2788
                    {
2789
                        IsUndo = false,
2790
                        Event = Event_Type.Create,
2791
                        EventTime = DateTime.Now,
2792
                        Markup_List = new List<Multi_Undo_data>()
2793
                    };
2794

    
2795

    
2796
                    string temppath = System.IO.Path.GetTempPath();
2797
                    //string filename = KCOM.Events.Save.shortCommentKey();
2798
                    string filename = Commons.shortFileKey();
2799

    
2800
                    System.Drawing.Image clipboardImage = System.Windows.Forms.Clipboard.GetImage();
2801
                    clipboardImage.Save(temppath + "\\" + filename);
2802

    
2803
                    System.IO.FileInfo fileInfo = new System.IO.FileInfo(temppath + "\\" + filename);
2804
                    String strFile = System.IO.Path.GetFileName(fileInfo.FullName);
2805
                    long numByte = fileInfo.Length;
2806
                    double dLen = Convert.ToDouble(fileInfo.Length / 1000000);
2807
                    kr.co.devdoftech.cloud.FileUpload fileUploader = new kr.co.devdoftech.cloud.FileUpload();
2808

    
2809
                    if (dLen < 4)
2810
                    {
2811
                        System.IO.FileStream fStream = new System.IO.FileStream(fileInfo.FullName,
2812
                        System.IO.FileMode.Open, System.IO.FileAccess.Read);
2813
                        System.IO.BinaryReader br = new System.IO.BinaryReader(fStream);
2814
                        byte[] data = br.ReadBytes((int)numByte);
2815

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

    
2828
                    fileInfo.Delete();
2829

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

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

    
2865
                    currentControl.TopRightPoint = new Point(currentControl.StartPoint.X + clipboardImage.Width, currentControl.StartPoint.Y);
2866
                    currentControl.LeftBottomPoint = new Point(currentControl.StartPoint.X, currentControl.StartPoint.Y + clipboardImage.Height);
2867
                    currentControl.EndPoint = new Point(currentControl.StartPoint.X + clipboardImage.Width, currentControl.StartPoint.Y + clipboardImage.Height);
2868

    
2869
                    currentControl.PointSet = new List<Point>
2870
                                        {
2871
                                            currentControl.StartPoint,
2872
                                            currentControl.LeftBottomPoint,
2873
                                            currentControl.EndPoint,
2874
                                            currentControl.TopRightPoint,
2875
                                        };
2876

    
2877
                    multi_Undo_Data = this.ParentOfType<MainWindow>().dzMainMenu.Control_Style(currentControl as MarkupToPDF.Common.CommentUserInfo);
2878
                    UndoData.Markup_List.Add(multi_Undo_Data);
2879
                    ViewerDataModel.Instance.UndoDataList.Add(UndoData);
2880

    
2881
                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl as MarkupToPDF.Common.CommentUserInfo);
2882
                    currentControl.CommentID = Commons.shortGuid();
2883

    
2884
                    currentControl.ApplyTemplate();
2885
                    currentControl.SetImage();
2886

    
2887
                    ViewerDataModel.Instance.MarkupControls_USER.Remove(currentControl as MarkupToPDF.Common.CommentUserInfo);
2888
                    Controls.AdornerFinal final = new Controls.AdornerFinal(currentControl as MarkupToPDF.Common.CommentUserInfo);
2889
                    this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Add(final);
2890

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