프로젝트

일반

사용자정보

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

markus / KCOM / Events / Implementation / TopMenuEvent.cs @ 35a96e24

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

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

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

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

    
64
        private void CheckShapeState()
65
        {
66

    
67

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

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

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

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

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

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

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

    
122
            }
123

    
124
        }
125

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

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

    
150
        }
151

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

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

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

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

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

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

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

    
258
        }
259

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

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

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

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

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

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

    
333
                this.ParentOfType<MainWindow>().dzMainMenu.InkControl_Convert();
334

    
335
                var menu = this.ParentOfType<MainWindow>().dzMainMenu;
336

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

    
350
                menu.ChangeCommentReact();
351

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

    
370

    
371
                            if (ViewerDataModel.Instance.IsConsolidate)
372
                            {
373
                                return;
374
                            }
375
                            menu.gridViewMarkup.ItemsSource = null;
376
                            menu.gridViewMarkup.ItemsSource = ViewerDataModel.Instance._markupInfoList;
377
                            menu.gridViewMarkup.SelectedItem = item;
378

    
379
                            if (sender != null)
380
                            {
381
                                if (ViewerDataModel.Instance.IsPressCtrl)
382
                                {
383
                                    ViewerDataModel.Instance.IsPressCtrl = false;
384
                                }
385
                                this.ParentOfType<MainWindow>().DialogMessage_Alert("Save 가 완료되었습니다.", "Alert");
386
                            }
387
                            return;
388
                        }
389
                    }
390
                }
391
                if (sender != null)
392
                {
393
                    if (ViewerDataModel.Instance.IsPressCtrl)
394
                    {
395
                        ViewerDataModel.Instance.IsPressCtrl = false;
396
                    }
397
                    this.ParentOfType<MainWindow>().DialogMessage_Alert("Save 가 완료되었습니다.", "Alert");
398
                }
399
            }
400
            catch(Exception ex)
401
            {
402
               
403
            }
404
            finally
405
            {
406
            }
407
        }
408

    
409
		public void RefactoryCommentReact(MainMenu menu)
410
        {
411
            this.ParentOfType<MainWindow>().dzMainMenu.InkControl_Convert();
412

    
413
            SaveCommand.Instance.Project_No = App.ViewInfo.ProjectNO;
414
            SaveCommand.Instance.document_id = App.ViewInfo.DocumentItemID;
415
            SaveCommand.Instance.user_id = App.ViewInfo.UserID;
416
            SaveCommand.Instance.page_no = Convert.ToInt32(tlcurrentPage.Text);
417

    
418
            try
419
            {
420
                List<IKCOM.MarkupInfoItem> MySelectItem = new List<IKCOM.MarkupInfoItem>();
421
                foreach (var item in menu.gridViewMarkup.SelectedItems)
422
                {
423
                    if ((item as IKCOM.MarkupInfoItem).UserID == App.ViewInfo.UserID)
424
                    {
425
                        MySelectItem.Add(item as IKCOM.MarkupInfoItem);
426
                    }
427
                }
428

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

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

    
458
                }
459
                else
460
                {
461
                    RefactoryCommentReact(menu);
462
                }
463
            }
464

    
465
            bool isprint = false;
466
            if (Type == "Print")
467
            {
468
                isprint = true;
469
            }
470

    
471
            RadWindow PrintWindow = new RadWindow();
472
            //IKCOM.MarkupInfoItem _result = null;
473
            PrintWindow.Width = 850;
474
            PrintWindow.Height = 600;
475
            //PrintWindow.Width = 650;
476
            //PrintWindow.Height = 550;
477
            PrintWindow.Header = Type;
478

    
479
            List<IKCOM.MarkupInfoItem> markupinfo = new List<IKCOM.MarkupInfoItem>();
480

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

    
484
            if (markupinfo.Count() > 0)
485
            {
486
                Logger.sendResLog("GetPrintDocItemList", "TRUE", 1);
487
            }
488
            else
489
            {
490
                Logger.sendResLog("GetPrintDocItemList", "FALSE", 1);
491
            }
492

    
493
            var Tile_Url = string.Format(@"{0}/TileSource/{1}_Tile/{2}/{3}/",
494
                App.SystemInfo.HostName,
495
                App.ViewInfo.ProjectNO,
496
                (Convert.ToInt64(App.ViewInfo.DocumentItemID) / 100).ToString(),
497
                App.ViewInfo.DocumentItemID
498
                );
499

    
500
            PrintWindow.Content = new KCOM.Control.PrintControl(
501
                      Tile_Url,
502
                      App.ViewInfo.ProjectNO,
503
                      this.ParentOfType<MainWindow>().dzMainMenu._DocInfo, markupinfo,
504
                      this.ParentOfType<MainWindow>().dzMainMenu.pageNavigator.CurrentPage.PageNumber,
505
                      App.ViewInfo.DocumentItemID,
506
                      this.ParentOfType<MainWindow>().dzMainMenu._DocItem.DOCUMENT_NO,
507
                      this.ParentOfType<MainWindow>().dzMainMenu._DocItem.ORIGINAL_FILE, isprint);
508

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

    
521
        //강인구 추가
522
        private void PrintEvent(object sender, RoutedEventArgs e)
523
        {
524
            RadRibbonButton button = sender as RadRibbonButton;
525
            Print_Start(button.Content.ToString());
526
        }
527

    
528
        private List<AdornerMember> GetAdornerItem()
529
        {
530
            List<AdornerMember> AdonerList = new List<AdornerMember>();
531

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

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

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

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

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

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

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

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

    
713

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
1271
            }
1272
        }
1273
        
1274

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

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

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

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

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

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

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

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

    
1349
                isClosed = false;
1350

    
1351
                
1352
                CheckList check = new CheckList();
1353

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

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

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

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

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

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

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

    
1443
            //instanceToggle.IsChecked = false;
1444

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

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

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

    
1513
        }
1514

    
1515
        #region 대기
1516

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

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

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

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

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

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

    
1585

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

    
1590

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

    
1602

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

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

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

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

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

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

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

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

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

    
1658
                        Check_Uri.UriCheck(filepath);
1659

    
1660
                        instanceMain.dzMainMenu.filename = filepath;
1661

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

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

    
1685
        }
1686

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

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

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

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

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

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

    
1750

    
1751

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

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

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

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

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

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

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

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

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

    
2221

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

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

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

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

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

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

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

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

    
2339
                            check.Closed += Check_Closed;
2340

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

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

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

    
2384
        }
2385

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

    
2412
        }
2413

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

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

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

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

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

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

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

    
2462
        private double minHeight;
2463
        private double minWidth;
2464

    
2465
        private double maxHeight;
2466
        private double maxWidth;
2467

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
2709
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
2710

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

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

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

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

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

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

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

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

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

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

    
2764
                }
2765
                
2766

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

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

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

    
2789

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

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

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

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

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

    
2822
                    fileInfo.Delete();
2823

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

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

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

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

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

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

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

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

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