프로젝트

일반

사용자정보

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

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

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

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

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

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

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

    
66
        private void CheckShapeState()
67
        {
68

    
69

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

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

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

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

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

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

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

    
124
            }
125

    
126
        }
127

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

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

    
152
        }
153

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

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

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

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

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

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

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

    
260
        }
261

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

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

    
294
            if (IsRun)
295
            {
296
                SaveTimer.Start();
297
            }
298
            else
299
            {
300
                SaveTimer.Stop();
301
            }
302
        }
303
        /// <summary>
304
        /// enable busy indicator and then call _SaveEvent method.
305
        /// </summary>
306
        /// <param name="sender"></param>
307
        /// <param name="e"></param>
308
        public void SaveEvent(object sender, RoutedEventArgs e)
309
        {
310
            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 markup
324
        /// </summary>
325
        /// <param name="sender"></param>
326
        /// <param name="e"></param>
327
        public void _SaveEvent(object sender, RoutedEventArgs e)
328
        {
329
            var menu = this.ParentOfType<MainWindow>().dzMainMenu;
330
            try
331
            {
332
                SelectionSet.Instance.UnSelect(this.ParentOfType<MainWindow>().dzMainMenu);
333

    
334
                // update mylist and gridview
335
                menu.UpdateMyMarkupList();
336

    
337
                this.ParentOfType<MainWindow>().dzMainMenu.ConvertInkControlToPolygon();
338

    
339
                if (menu.PreviewUserMarkupInfoItem != null && menu.PreviewUserMarkupInfoItem.IsPreviewUser == true)
340
                {
341
                    this.ExecuteSaveCommand(menu);
342
                }
343
                else if (menu.gridViewMarkup.SelectedItems.Count == 0 && menu.gridViewMarkup.Items.Count > 0)
344
                {
345
                    this.ParentOfType<MainWindow>().DialogMessage_Alert("Please Select Your Comment List Item", "Alert");
346
                    return;
347
                }
348
                else
349
                {                    
350
                    foreach (var item in menu.gridViewMarkup.SelectedItems)
351
                    {
352
                        if ((item as IKCOM.MarkupInfoItem).UserID == App.ViewInfo.UserID)
353
                        {
354
                            this.ExecuteSaveCommand(menu);
355
                            ViewerDataModel.Instance._markupInfoList.Where(data => data.MarkupInfoID == (item as IKCOM.MarkupInfoItem).MarkupInfoID).FirstOrDefault().UpdateTime = DateTime.Now;
356
                            if (ViewerDataModel.Instance.IsConsolidate)
357
                            {
358
                                return;
359
                            }
360

    
361
                            if (sender != null)
362
                            {
363
                                if (ViewerDataModel.Instance.IsPressCtrl)
364
                                {
365
                                    ViewerDataModel.Instance.IsPressCtrl = false;
366
                                }
367
                                this.ParentOfType<MainWindow>().DialogMessage_Alert("Save 가 완료되었습니다.", "Alert");
368
                            }
369
                            return;
370
                        }
371
                    }
372
                }
373
                if (sender != null)
374
                {
375
                    if (ViewerDataModel.Instance.IsPressCtrl)
376
                    {
377
                        ViewerDataModel.Instance.IsPressCtrl = false;
378
                    }
379
                    this.ParentOfType<MainWindow>().DialogMessage_Alert("Save 가 완료되었습니다.", "Alert");
380
                }
381
            }
382
            catch(Exception ex)
383
            {
384
               
385
            }
386
            finally
387
            {
388
                /*
389
                /// delete markup information when 코멘트가 없을 경우
390
                if (ViewerDataModel.Instance.MyMarkupList.Count == 0)
391
                {
392
                    foreach (var item in menu.gridViewMarkup.SelectedItems)
393
                    {
394
                        if ((item as IKCOM.MarkupInfoItem).UserID == App.ViewInfo.UserID)
395
                        {
396
                            //this.ParentOfType<MainWindow>().dzMainMenu.DeleteItem((item as IKCOM.MarkupInfoItem));
397
                        }
398
                    }
399
                }
400
                */
401
            }
402
        }
403

    
404
        /// <summary>
405
        /// call save command
406
        /// </summary>
407
        /// <param name="menu"></param>
408
		private void ExecuteSaveCommand(MainMenu menu)
409
        {
410
            SaveCommand.Instance.Project_No = App.ViewInfo.ProjectNO;
411
            SaveCommand.Instance.document_id = App.ViewInfo.DocumentItemID;
412
            SaveCommand.Instance.user_id = App.ViewInfo.UserID;
413
            SaveCommand.Instance.page_no = Convert.ToInt32(tlcurrentPage.Text);
414

    
415
            try
416
            {
417
                this.ParentOfType<MainWindow>().dzMainMenu.ConvertInkControlToPolygon();
418

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

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

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

    
457
                }
458
                else
459
                {
460
                    this.SaveEvent(null, null);
461
                }
462
            }
463

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

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

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

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

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

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

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

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

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

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

    
531
            if (this.ParentOfType<MainWindow>() != null)
532
            {
533
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
534
                {
535
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
536
                    {
537
                        if (item.GetType().Name == "AdornerFinal")
538
                        {
539
                            foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
540
                            {
541
                                AdonerList.Add(InnerItem);
542
                            }
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).Members.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).Members.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).Members.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).Members.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).Members.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).Members.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
                    
1234
                    var instanceMain = this.ParentOfType<MainWindow>();
1235
                    var max = instanceMain.dzMainMenu.pageNavigator._thumbnailItems.Max(f => f.PageNumber);
1236
                    if (string.IsNullOrEmpty(tlcurrentPage.Text))
1237
                    {
1238
                        RadWindow.Alert(new DialogParameters
1239
                        {
1240
                            Owner = Application.Current.MainWindow,
1241
                            Theme = new VisualStudio2013Theme(),
1242
                            Header = "안내",
1243
                            Content = "페이지 번호를 정확하게 입력해 주세요",
1244
                        });
1245
                    }
1246
                    else
1247
                    {
1248
                        if (Convert.ToInt32(tlcurrentPage.Text) > max || Convert.ToInt32(tlcurrentPage.Text) == 0)
1249
                        {
1250
                            RadWindow.Alert(new DialogParameters
1251
                            {
1252
                                Owner = Application.Current.MainWindow,
1253
                                Theme = new VisualStudio2013Theme(),
1254
                                Header = "안내",
1255
                                Content = "페이지 번호를 정확하게 입력해 주세요",
1256
                            });
1257
                        }
1258
                        else
1259
                        {
1260
                            instanceMain.dzMainMenu.pageNavigator.GotoPage(Convert.ToInt32(tlcurrentPage.Text));
1261
                        }
1262
                    }
1263
                    
1264
                }
1265
                catch (Exception)
1266
                {
1267
                    RadWindow.Alert(new DialogParameters
1268
                    {
1269
                        Owner = Application.Current.MainWindow,
1270
                        Theme = new VisualStudio2013Theme(),
1271
                        Header = "안내",
1272
                        Content = "페이지 번호를 정확하게 입력해 주세요",
1273
                    });
1274
                }
1275
                
1276
            }
1277
        }
1278
        private string previousText;
1279
        private void TlcurrentPage_PreviewTextInput(object sender, TextCompositionEventArgs e)
1280
        {
1281
            System.Text.RegularExpressions.Regex regex = new System.Text.RegularExpressions.Regex("[^0-9]+");
1282
            e.Handled = regex.IsMatch(e.Text);
1283
        }
1284
        private void TlcurrentPage_TextChanged(object sender, TextChangedEventArgs e)
1285
        {
1286
            double num = 0;
1287
            bool success = double.TryParse(((TextBox)sender).Text, out num);
1288
            if (success & num >= 0)
1289
                previousText = ((TextBox)sender).Text;
1290
            else
1291
            {
1292
                if (string.IsNullOrEmpty(((TextBox)sender).Text))
1293
                {
1294
                    ((TextBox)sender).Text = "";
1295
                }
1296
                else
1297
                {
1298

    
1299
                    ((TextBox)sender).Text = previousText;
1300
                }
1301
            }
1302
        }
1303

    
1304

    
1305
        private void tlcurrentPage_readonly_KeyDown(object sender, KeyEventArgs e)
1306
        {
1307
            //강인구 추가 tlcurrentPage을 이상하게 입력할수 있기때문에 Try Catch
1308
            if (e.Key == Key.Enter)
1309
            {
1310
                try
1311
                {
1312
                    var instanceMain = this.ParentOfType<MainWindow>();
1313
                    instanceMain.dzMainMenu.pageNavigator.GotoPage(Convert.ToInt32(tlcurrentPage_readonly.Text));
1314
                }
1315
                catch (Exception)
1316
                {
1317
                    RadWindow.Alert(new DialogParameters
1318
                    {
1319
                        Owner = Application.Current.MainWindow,
1320
                        Theme = new VisualStudio2013Theme(),
1321
                        Header = "안내",
1322
                        Content = "페이지 번호를 정확하게 입력해 주세요",
1323
                    });
1324
                }
1325

    
1326
            }
1327
        }
1328
        
1329

    
1330
        //public event EventHandler<WindowClosedEventArgs> Closed;
1331

    
1332
        //private void CheckEvent(object sender, RoutedEventArgs e)
1333
        //{
1334
        //    RadWindow CheckPop = new RadWindow();
1335
        //    test check = new test();
1336

    
1337
        //    CheckPop = new RadWindow
1338
        //    {
1339
        //        Width = 1700,
1340
        //        Height = 510,
1341
        //        Header = "My Check List",
1342
        //        Content = check,
1343
        //        Owner = this,
1344
        //        ResizeMode = System.Windows.ResizeMode.NoResize,
1345
        //        WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen,
1346
        //    };
1347
        //    StyleManager.SetTheme(CheckPop, new VisualStudio2013Theme());
1348

    
1349
        //    CheckPop.Closed += CheckPop_Closed;
1350
        //    CheckPop.ShowDialog();
1351
        //}
1352

    
1353
        private void PanoramaEvent(object sender, RoutedEventArgs e)
1354
        {
1355
            PanoramaShow();
1356
        }
1357

    
1358
        public void PanoramaShow()
1359
        {
1360
            Panorama check = new Panorama();
1361
            double screenWidth = System.Windows.SystemParameters.PrimaryScreenWidth;
1362
            double screenHeight = System.Windows.SystemParameters.PrimaryScreenHeight;
1363
            //double windowWidth = this.Width;
1364
            //double windowHeight = this.Height;
1365

    
1366
            var PanoramaPop = new RadWindow
1367
            {
1368
                //MinWidth = 600,
1369
                //MinHeight = 400,
1370
                //Header = "My Check List",
1371
                Header = "Document No : " + this.ParentOfType<MainWindow>().dzMainMenu._DocItem.DOCUMENT_NO + " / Revision :" + this.ParentOfType<MainWindow>().dzMainMenu._DocItem.REVISION,
1372
                Content = check,
1373
                Owner = this,
1374
                ResizeMode = System.Windows.ResizeMode.CanResizeWithGrip,
1375
                //ResizeMode = System.Windows.ResizeMode.NoResize,
1376
                WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen,
1377
                IsTopmost = false,
1378
                //Left = (screenWidth / 2) - (windowWidth / 2),
1379
                //Top = (screenHeight / 2) - (windowHeight / 2),
1380
                //Left = (screenWidth / 2),
1381
                //Top = (screenHeight / 2),
1382
                Width = screenWidth * 0.4,
1383
                Height = screenHeight * 0.4,
1384
            };
1385
            StyleManager.SetTheme(PanoramaPop, new VisualStudio2013Theme());
1386
            //CheckPop.ShowDialog();
1387
            PanoramaPop.Owner = Application.Current.MainWindow;
1388
            PanoramaPop.Show();
1389
        }
1390

    
1391
        private void CheckEvent(object sender, RoutedEventArgs e)
1392
        {
1393
            //창이 떠있을 경우 재 실행 방지
1394
            if (isClosed)
1395
            {
1396
                //토글 및 마우스 상태 초기화
1397
                var toggleList = this.Parent.ChildrenOfType<RadToggleButton>();
1398
                foreach(var togle in toggleList)
1399
                {
1400
                    togle.IsChecked = false;
1401
                }
1402
                this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
1403

    
1404
                isClosed = false;
1405

    
1406
                
1407
                CheckList check = new CheckList();
1408

    
1409
                CheckPop = new RadWindow
1410
                {
1411
                    MinWidth = 1200,
1412
                    MinHeight = 500,
1413
                    //Header = "My Check List",
1414
                    Header = "Document No : " + this.ParentOfType<MainWindow>().dzMainMenu._DocItem.DOCUMENT_NO + " / Revision :" + this.ParentOfType<MainWindow>().dzMainMenu._DocItem.REVISION,
1415
                    Content = check,
1416
                    //Owner = this,
1417
                    //ResizeMode = System.Windows.ResizeMode.CanResizeWithGrip,
1418
                    ResizeMode = System.Windows.ResizeMode.NoResize,
1419
                    WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen,
1420
                    IsTopmost = true,
1421
                };
1422
                StyleManager.SetTheme(CheckPop, new Office2013Theme());
1423
                CheckPop.Closed += CheckPop_Closed;
1424
                
1425
                //CheckPop.ShowDialog();
1426
                CheckPop.Show();
1427
            }
1428
        }
1429

    
1430
        private void OptionPop_Closed(object sender, WindowClosedEventArgs e)
1431
        {
1432
            isClosed = true;
1433
            //this.ParentOfType<MainWindow>().dzMainMenu.PN_Navi.IsEnabled = true;
1434
            this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
1435
            ViewerDataModel.Instance.Capture_Opacity = 0;
1436
        }
1437

    
1438
        private void CheckPop_Closed(object sender, WindowClosedEventArgs e)
1439
        {
1440
            isClosed = true;
1441
            //this.ParentOfType<MainWindow>().dzMainMenu.PN_Navi.IsEnabled = true;
1442
            this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
1443
            ViewerDataModel.Instance.Capture_Opacity = 0;
1444
        }
1445

    
1446
        /// <summary>
1447
        /// 사용자가 선택한 페이지로 이동(썸네일 동기화 시킴)
1448
        /// </summary>
1449
        /// <param name="sender"></param>
1450
        /// <param name="e"></param>
1451
        private void PageGoEvent(object sender, RoutedEventArgs e)
1452
        {
1453
            RadButton button = sender as RadButton;
1454
            var instanceMain = this.ParentOfType<MainWindow>();
1455
            
1456
            //강인구 추가 tlcurrentPage을 이상하게 입력할수 있기때문에 Try Catch
1457
            try
1458
            {
1459
                switch (button.CommandParameter.ToString())
1460
                {
1461
                    case "Down":
1462
                        {
1463
                            instanceMain.dzMainMenu.pageNavigator.GotoPage(Convert.ToInt32(tlcurrentPage.Text) + 1);
1464
                        }
1465
                        break;
1466
                    case "Up":
1467
                        {
1468
                            instanceMain.dzMainMenu.pageNavigator.GotoPage(Convert.ToInt32(tlcurrentPage.Text) - 1);
1469
                        }
1470
                        break;
1471
                }
1472
            }
1473
            catch (Exception)
1474
            {
1475
                RadWindow.Alert(new DialogParameters
1476
                {
1477
                    Owner = Application.Current.MainWindow,
1478
                    Theme = new VisualStudio2013Theme(),
1479
                    Header = "안내",
1480
                    Content = "페이지 번호를 정확하게 입력해 주세요",
1481
                });
1482
            }
1483
        }
1484

    
1485
        private void viewEvent(object sender, RoutedEventArgs e)
1486
        {
1487
            RadRibbonToggleButton viewButton = sender as RadRibbonToggleButton;
1488
            var instanceMain = this.ParentOfType<MainWindow>();
1489

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

    
1492
            //if ((sender as RadRibbonToggleButton) != null)
1493
            //{
1494
            //    Common.ViewerDataModel.Instance.ControlTag = (sender as RadRibbonToggleButton).Tag.ToString();
1495
            //    instanceToggle = (sender as RadRibbonToggleButton);
1496
            //}
1497

    
1498
            //instanceToggle.IsChecked = false;
1499

    
1500
            switch (viewButton.CommandParameter.ToString())
1501
            {
1502
                case "zoomout":
1503
                    {
1504
                        //장원
1505
                        //instanceMain.dzMainMenu.zoomAndPanControl.ZoomTo(new Rect(0, 0, instanceMain.dzMainMenu.zoomAndPanCanvas.ActualWidth, instanceMain.dzMainMenu.zoomAndPanCanvas.ActualHeight));
1506
                        instanceMain.dzMainMenu.zoomAndPanControl.ZoomPointToViewportCenter(ViewerDataModel.Instance.ContentScale -= 0.1, point);
1507
                        viewButton.IsChecked = false;
1508
                        //Common.ViewerDataModel.Instance.zom
1509
                    }
1510
                    break;
1511
                case "zoomin":
1512
                    {
1513
                        instanceMain.dzMainMenu.zoomAndPanControl.ZoomPointToViewportCenter(ViewerDataModel.Instance.ContentScale += 0.1, point);
1514
                        viewButton.IsChecked = false;
1515
                    }
1516
                    break;
1517
                case "fullscreen":
1518
                    {
1519
                        instanceMain.WindowState = WindowState.Maximized;
1520
                        //Sizemode 대기(강인구)
1521
                        //instanceMain.dzMainMenu.imageViewer.SizeMode = Leadtools.Windows.Controls.SizeMode.Fit;
1522
                        instanceMain.dzMainMenu.zoomAndPanControl.ScaleToFit();
1523
                        viewButton.IsChecked = false;
1524
                    }
1525
                    break;
1526
                case "fitWidth":
1527
                    {
1528
                        instanceMain.dzMainMenu.zoomAndPanControl.ScaleToFit();
1529
                        viewButton.IsChecked = false;
1530
                    }
1531
                    break;
1532
                case "fitHeight":
1533
                    {
1534
                        instanceMain.dzMainMenu.zoomAndPanControl.ScaleToFit();
1535
                        viewButton.IsChecked = false;
1536
                    }
1537
                    break;
1538
                case "boundzoom":
1539
                    {
1540

    
1541
                    }
1542
                    break;
1543
                case "Rotate_M":
1544
                    {
1545
                        drawingPannelRotate(false);
1546
                        viewButton.IsChecked = false;
1547
                    }
1548
                    break;
1549
                case "Rotate_P":
1550
                    {
1551
                        drawingPannelRotate(true);
1552
                        viewButton.IsChecked = false;
1553
                    }
1554
                    break;
1555
                case "Rotate_half":
1556
                    {
1557
                        drawingPannelRotate(true);
1558
                        drawingPannelRotate(true);
1559
                        viewButton.IsChecked = false;
1560
                    }
1561
                    break;
1562
            }
1563
        }
1564

    
1565
        private void Control_Event(object sender, RoutedEventArgs e)
1566
        {
1567

    
1568
        }
1569

    
1570
        #region 대기
1571

    
1572
        public void drawingPannelRotate(bool Flag)
1573
        {
1574
            var instanceMain = this.ParentOfType<MainWindow>();
1575

    
1576
            //if (rotateOffSet > 3)
1577
            //    rotateOffSet = 0;
1578

    
1579
            //if (rotateOffSet < 0)
1580
            //    rotateOffSet = 3;
1581

    
1582
            if(Flag)
1583
            {
1584
                if (instanceMain.dzMainMenu.rotate.Angle == 270)
1585
                {
1586
                    instanceMain.dzMainMenu.rotate.Angle = 0;
1587
                }
1588
                else
1589
                {
1590
                    instanceMain.dzMainMenu.rotate.Angle += 90;
1591
                }
1592
            }
1593
            else
1594
            {
1595
                if(instanceMain.dzMainMenu.rotate.Angle == 0)
1596
                {
1597
                    instanceMain.dzMainMenu.rotate.Angle = 270;
1598
                }
1599
                else
1600
                {
1601
                    instanceMain.dzMainMenu.rotate.Angle -= 90;
1602
                }
1603
            }
1604
            //double angle = (double)rotateValue.GetValue(rotateOffSet);
1605
            //instanceMain.dzMainMenu.rotate.Angle = angle;
1606
            var rotationNum = Math.Abs((instanceMain.dzMainMenu.rotate.Angle / 90));
1607

    
1608
            if (instanceMain.dzMainMenu.zoomAndPanCanvas.Width == ViewerDataModel.Instance.ContentWidth)
1609
            {
1610
                double emptySize = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
1611
                instanceMain.dzMainMenu.zoomAndPanCanvas.Width = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
1612
                instanceMain.dzMainMenu.zoomAndPanCanvas.Height = emptySize;
1613
            }
1614
            if (instanceMain.dzMainMenu.rotate.Angle == 0)
1615
            {
1616
                instanceMain.dzMainMenu.translate.X = 0;
1617
                instanceMain.dzMainMenu.translate.Y = 0;
1618
            }
1619
            else if (instanceMain.dzMainMenu.rotate.Angle == 90)
1620
            {
1621
                instanceMain.dzMainMenu.translate.X = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
1622
                instanceMain.dzMainMenu.translate.Y = 0;
1623
            }
1624
            else if (instanceMain.dzMainMenu.rotate.Angle == 180)
1625
            {
1626
                instanceMain.dzMainMenu.translate.X = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
1627
                instanceMain.dzMainMenu.translate.Y = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
1628
            }
1629
            else
1630
            {
1631
                instanceMain.dzMainMenu.translate.X = 0;
1632
                instanceMain.dzMainMenu.translate.Y = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
1633
            }
1634

    
1635
            //instanceMain.dzMainMenu.zoomAndPanControl.RenderTransformOrigin = new Point(0.5, 0.5);
1636
            instanceMain.dzMainMenu.zoomAndPanControl.RotationAngle = instanceMain.dzMainMenu.rotate.Angle;
1637
            //대기(강인구)
1638
            //instanceMain.dzMainMenu.imageViewer.RotateAngle = instanceMain.dzMainMenu.rotate.Angle;
1639

    
1640

    
1641
            //instanceMain.dzMainMenu.imageViewer.RenderTransformOrigin = new Point(0.5, 0.5);
1642
            //RotateTransform rotateTransform = new RotateTransform(instanceMain.dzMainMenu.rotate.Angle);
1643
            //instanceMain.dzMainMenu.imageViewer.RenderTransform = rotateTransform;
1644

    
1645

    
1646
            ViewerDataModel.Instance.ContentWidth = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
1647
            ViewerDataModel.Instance.ContentHeight = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
1648
            ViewerDataModel.Instance.AngleOffsetX = instanceMain.dzMainMenu.translate.X;
1649
            ViewerDataModel.Instance.AngleOffsetY = instanceMain.dzMainMenu.translate.Y;
1650
            ViewerDataModel.Instance.Angle = instanceMain.dzMainMenu.rotate.Angle;
1651
            //ViewerDataModel.Instance.Document_Info.Clear();
1652
            //ViewerDataModel.Instance.Document_Info.Where(i => i.PAGE_NUMBER == instanceMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber).ToList().ForEach(value =>
1653
            //{
1654
            //    value.PAGE_ANGLE = int.Parse(instanceMain.dzMainMenu.rotate.Angle.ToString());
1655
            //});
1656

    
1657

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

    
1663
                instanceMain.dzMainMenu.pageNavigator.ImgListbox.ItemsSource = instanceMain.dzMainMenu.pageNavigator._thumbnailItems;
1664
                var instance = instanceMain.dzMainMenu.CurrentDoc.docInfo.DOCPAGE.Where(p => p.PAGE_NUMBER == instanceMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber).FirstOrDefault();
1665
                instance.PAGE_ANGLE = int.Parse(instanceMain.dzMainMenu.rotate.Angle.ToString());
1666

    
1667
                instanceMain.dzMainMenu.pageNavigator.setPageChange(data);
1668

    
1669
                //rotation page add or update
1670
                var rotationdoc = ViewerDataModel.Instance.RotationDocs.Where(d => d.ID == instance.ID).FirstOrDefault();
1671
                if (rotationdoc != null)
1672
                {
1673
                    rotationdoc.PAGE_ANGLE = instance.PAGE_ANGLE;
1674
                }
1675
                else
1676
                {
1677
                    ViewerDataModel.Instance.RotationDocs.Add(instance);
1678
                }
1679
            });
1680
        }
1681
        #endregion
1682

    
1683
        private void ImageConverter(RadToggleButton instanceToggle)
1684
        {
1685
            try
1686
            {           
1687
                var instanceMain = this.ParentOfType<MainWindow>();
1688
                //http://cloud.devdoftech.co.kr:5977/ImageUpload/FileUpload.asmx
1689

    
1690
                Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
1691
                dlg.Filter = "All files (*.*)|*.*|PNG Images (*.png)|*.png";
1692
                Nullable<bool> result = dlg.ShowDialog();
1693
                if (result == true)
1694
                {
1695
                    instanceMain.dzMainMenu.filename = dlg.FileName;
1696
                    instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ImgControl;
1697

    
1698
                    System.IO.FileInfo fileInfo = new System.IO.FileInfo(instanceMain.dzMainMenu.filename);
1699
                    String strFile = System.IO.Path.GetFileName(instanceMain.dzMainMenu.filename);
1700
                    long numByte = fileInfo.Length;
1701
                    double dLen = Convert.ToDouble(fileInfo.Length / 1000000);
1702
                    kr.co.devdoftech.cloud.FileUpload fileUploader = new kr.co.devdoftech.cloud.FileUpload();
1703

    
1704
                    if (dLen < 4)
1705
                    {
1706
                        System.IO.FileStream fStream = new System.IO.FileStream(instanceMain.dzMainMenu.filename, System.IO.FileMode.Open, System.IO.FileAccess.Read);
1707
                        System.IO.BinaryReader br = new System.IO.BinaryReader(fStream);
1708
                        byte[] data = br.ReadBytes((int)numByte);
1709
                        br.Close();
1710

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

    
1713
                        Check_Uri.UriCheck(filepath);
1714

    
1715
                        instanceMain.dzMainMenu.filename = filepath;
1716

    
1717
                        fStream.Close();
1718
                        fStream.Dispose();
1719
                    }
1720
                    else
1721
                    {
1722
                        this.ParentOfType<MainWindow>().DialogMessage_Alert("Available Memory less than 4 mega byte", "Alert");
1723
                    }
1724
                }
1725
            }
1726
            catch(Exception ex)
1727
            {
1728
                instanceToggle.IsChecked = false;
1729
                Common.ViewerDataModel.Instance.SelectedControl = "";
1730
                Common.ViewerDataModel.Instance.ControlTag = null;
1731
                this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
1732
                this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
1733
                this.ParentOfType<MainWindow>().DialogMessage_Alert(""+ ex , "Alert");
1734
            }
1735
        }
1736

    
1737
        private void Control_Init(RadToggleButton instanceToggle, object sender)
1738
        {
1739

    
1740
        }
1741

    
1742
        private void ControlEvent(object sender, RoutedEventArgs e)
1743
        {
1744
            RadToggleButton instanceToggle = sender as RadToggleButton;
1745
            var instanceMain = this.ParentOfType<MainWindow>();
1746

    
1747
            #region Ctrl + A 눌렀을 때 대처 방법 
1748
            //원인 : Ctrl + A를 누르면 UIElementSet에 등록을 시키지 않는다(이유는 한꺼번에 많은 양의 컨트롤의 동작이 유입되기 때문에
1749
            //       시스템의 성능저하를 불러올 수 있기 때문이다. 그래서 선택 후 다른 컨트롤을 누르면 등록되지 않은 컨트롤이기 때문에 삭제된다
1750
            //       이를 대처하는 방법으로 아래 코드를 사용한다.
1751
            if (Common.ViewerDataModel.Instance.MarkupControls.Count == 0 && Common.ViewerDataModel.Instance.MarkupControls.Count >= 1)
1752
            {
1753
                //var lstItem = instanceMain.DeepLayer._SelectLayer.ChildrenOfType<AdornerFinal>().ToList();
1754
                //foreach (var item in lstItem)
1755
                //{
1756
                //    foreach (var member in item.MemberSet)
1757
                //    {
1758
                //        if (!instanceMain.DeepLayer.UIElementSet.Contains(member.DrawingData))
1759
                //        {
1760
                //            instanceMain.DeepLayer.UIElementSet.Add(member.DrawingData);
1761
                //        }
1762
                //    }
1763
                //}
1764
            }
1765
            #endregion
1766

    
1767
            //if (!instanceMain.IsFreeSelectionMode)
1768
            //{
1769
            //    instanceMain.IsSwingMode = true;
1770
            //}
1771

    
1772
            #region 다른 컨트롤 버튼 선택 해제
1773
            System.Reactive.Linq.Observable2.FromPropertyChangedPattern(Common.ViewerDataModel.Instance, temp => temp.SelectedControl).Subscribe(ControlState =>
1774
            {
1775
                if (ControlState == null)
1776
                {
1777
                    instanceToggle.IsChecked = false;
1778
                    HiddenControlHide();
1779
                }
1780
            });
1781
            #endregion
1782

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

    
1785
            if (instanceToggle != null)
1786
            {
1787
                Common.ViewerDataModel.Instance.ControlTag = instanceToggle.Tag.ToString();
1788
            }
1789
            else if ((sender as RadRibbonToggleButton) != null)
1790
            {
1791
                Common.ViewerDataModel.Instance.ControlTag = (sender as RadRibbonToggleButton).Tag.ToString();
1792
                instanceToggle = (sender as RadRibbonToggleButton);
1793
            }
1794
            else if ((sender as RadRibbonButton) != null)
1795
            {
1796
                RadRibbonButton instanceButton = sender as RadRibbonButton;
1797
                Common.ViewerDataModel.Instance.ControlTag = instanceButton.Tag.ToString();
1798
            }
1799
            else
1800
            {
1801
                RadButton instanceButton = sender as RadButton;
1802
                Common.ViewerDataModel.Instance.ControlTag = instanceButton.Tag.ToString();
1803
            }
1804

    
1805

    
1806

    
1807
            System.Reactive.Linq.Observable2.FromPropertyChangedPattern(Common.ViewerDataModel.Instance, temp => temp.AngleVisibility).Subscribe(isSee =>
1808
            {
1809
                instanceMain.dzMainMenu.MainAngle.Visibility = isSee;
1810
                System.Reactive.Linq.Observable2.FromPropertyChangedPattern(Common.ViewerDataModel.Instance, temp => temp.AngleValue).Subscribe(p =>
1811
                {
1812
                    instanceMain.dzMainMenu.MainAngle.AngleValue = p;
1813
                });
1814
            });
1815
            instanceMain.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Drawing;
1816

    
1817
            instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = false;
1818

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

    
2044
                        //instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = true;
2045

    
2046
                        Common.ViewerDataModel.Instance.SelectedControl = "Ink";
2047
                        Common.ViewerDataModel.Instance.LineSize = (double)cbLineSize.Value;
2048
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.PenControl;
2049
                        break;
2050
                    #endregion
2051
                    #region Select
2052
                    case "Select":
2053
                        if(this.ParentOfType<MainWindow>().dzMainMenu.currentControl != null)
2054
                        {
2055
                            ViewerDataModel.Instance.MarkupControls_USER.Remove(this.ParentOfType<MainWindow>().dzMainMenu.currentControl);
2056
                            this.ParentOfType<MainWindow>().dzMainMenu.currentControl = null;
2057
                        }
2058
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Selecting;
2059
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2060
                        instanceMain.dzMainMenu.isLeftMouseButtonDownOnWindow = false;
2061
                        break;
2062
                    #endregion
2063
                    #region Image
2064
                    case "Image":
2065
                        Common.ViewerDataModel.Instance.SelectedControl = "ImgControl";
2066
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ImgControl;
2067
                        ImageConverter(instanceToggle);
2068
                        break;
2069
                    #endregion
2070
                    #region Sign
2071
                    case "Sign":
2072
                        Common.ViewerDataModel.Instance.SelectedControl = "Sign";
2073
                        Common.ViewerDataModel.Instance.ControlTag = instanceMain.dzMainMenu._ViewInfo.UserID; //사번
2074
                        //강인구 추가
2075
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Sign;
2076
                        //instanceMain.BaseClient.GetUserSignCompleted += (sen, ea) =>
2077
                        //{
2078
                        //    if (ea.Result == null)
2079
                        //    {
2080

    
2081
                        //        this.ParentOfType<MainPage>().DialogMessage_Alert("You Don't Have Sign Data", "Alert");
2082
                        //    }
2083
                        //    else
2084
                        //    {
2085
                        //        byte[] imageBytes = System.Convert.FromBase64String(ea.Result);
2086
                        //        using (MemoryStream ms = new MemoryStream(imageBytes))
2087
                        //        {
2088
                        //            BitmapImage im = new BitmapImage();
2089
                        //            im.SetSource(ms);
2090
                        //            instanceMain.DeepLayer.SignImage = im;
2091
                        //            ms.Close();
2092
                        //        }
2093
                        //    }
2094
                        //};
2095
                        //instanceMain.BaseClient.GetUserSignAsync(instanceMain._ViewInfo.UserID);
2096
                        break;
2097
                    #endregion
2098
                    #region Check
2099
                    case "Check":
2100
                        Common.ViewerDataModel.Instance.SelectedControl = "Check";
2101
                        Common.ViewerDataModel.Instance.ControlTag = instanceMain.dzMainMenu._ViewInfo.UserID; //사번
2102
                        //강인구 추가
2103
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Symbol;
2104
                        break;
2105
                    #endregion
2106
                    #region Batch
2107
                    case "Batch":
2108
                        Common.ViewerDataModel.Instance.SelectedControl = "Batch";
2109
                        Common.ViewerDataModel.Instance.ControlTag = instanceMain.dzMainMenu._ViewInfo.UserID; //사번
2110
                        //강인구 추가
2111
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Mark;
2112
                        instanceMain.dzMainMenu.txtBatch.Visibility = Visibility.Visible;
2113
                        instanceMain.dzMainMenu.txtBatch.Text = "Place Mark";
2114
                        break;
2115
                    #endregion
2116
                    #region Copy
2117
                    case "Copy":
2118
                        Copy_Start();
2119
                        instanceToggle.IsChecked = false;
2120
                        ViewerDataModel.Instance.SelectedControl = "";
2121
                        ViewerDataModel.Instance.ControlTag = null;
2122
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2123
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2124
                        break;
2125
                    #endregion
2126
                    #region Cut
2127
                    case "Cut":
2128
                        Cut_Start();
2129
                        instanceToggle.IsChecked = false;
2130
                        ViewerDataModel.Instance.SelectedControl = "";
2131
                        ViewerDataModel.Instance.ControlTag = null;
2132
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2133
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2134
                        break;
2135
                    #endregion
2136
                    #region Paste
2137
                    case "Paste":
2138
                        Paste_Start();
2139
                        instanceToggle.IsChecked = false;
2140
                        ViewerDataModel.Instance.SelectedControl = "";
2141
                        ViewerDataModel.Instance.ControlTag = null;
2142
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2143
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;                        
2144
                        break;
2145
                    #endregion
2146
                    #region Delete
2147
                    case "Delete":
2148
                        DeleteCommand.Instance.Execute(SelectionSet.Instance.SelectedItems);
2149
                        this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Clear();
2150

    
2151
                        instanceToggle.IsChecked = false;
2152
                        ViewerDataModel.Instance.SelectedControl = "";
2153
                        ViewerDataModel.Instance.ControlTag = null;
2154
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2155
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2156
                        break;
2157
                    #endregion
2158
                    #region Undo
2159
                    case "Undo":
2160
                        UndoCommand.Instance.Execute();
2161
                        instanceToggle.IsChecked = false;
2162
                        ViewerDataModel.Instance.SelectedControl = "";
2163
                        ViewerDataModel.Instance.ControlTag = null;
2164
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2165
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2166
                        break;
2167
                    #endregion
2168
                    #region Redo
2169
                    case "Redo":
2170
                        RedoCommand.Instance.Execute();
2171
                        instanceToggle.IsChecked = false;
2172
                        ViewerDataModel.Instance.SelectedControl = "";
2173
                        ViewerDataModel.Instance.ControlTag = null;
2174
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2175
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2176
                        break;
2177
                    #endregion
2178
                    #region DragZoom
2179
                    case "DragZoom":
2180
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.DragZoom;
2181
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2182
                        instanceMain.dzMainMenu.isLeftMouseButtonDownOnWindow = false;
2183
                        break;
2184
                    #endregion
2185
                    #region Grouping
2186
                    case "Group":
2187
                        //var GrouptoggleList = this.Parent.ChildrenOfType<RadRibbonToggleButton>();
2188
                        //foreach (var togle in GrouptoggleList)
2189
                        //{
2190
                        //    togle.IsChecked = false;
2191
                        //}
2192

    
2193
                        //if (this.ParentOfType<MainWindow>().dzMainMenu.currentControl != null)
2194
                        //{
2195
                        //    ViewerDataModel.Instance.MarkupControls_USER.Remove(this.ParentOfType<MainWindow>().dzMainMenu.currentControl);
2196
                        //    this.ParentOfType<MainWindow>().dzMainMenu.currentControl = null;
2197
                        //}
2198
                        //this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2199
                        //instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2200
                        //instanceMain.dzMainMenu.isLeftMouseButtonDownOnWindow = false;
2201
                        //if (ViewerDataModel.Instance.SystemMain.dzMainMenu.SelectLayer.Children.Count < 1) //선택된 것이 없으면
2202
                        //{
2203
                        //    this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert("Please Select Controls", "Alert");
2204
                        //}
2205
                        //else//if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
2206
                        //{
2207
                        //    // string MarkupData = "";
2208
                        //    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
2209
                        //    {
2210
                        //        if (item.GetType().Name == "AdornerFinal" && (item as AdornerFinal).MemberSet.Count >= 2) // 얘가 2개 이상이여야 그룹가능 버튼도 막을거긴하지만 일단..
2211
                        //        {
2212
                        //            //MARKUP_DATA_GROUP INSERT
2213
                        //            MARKUP_DATA_GROUP mARKUP_DATA_GROUP = new MARKUP_DATA_GROUP
2214
                        //            {
2215
                        //                SYMBOL_ID = null,//InnerItem.Symbol_ID
2216
                        //                STATE = 0,
2217
                        //            };
2218
                        //            long group_id = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.AddMarkupDataGroup(mARKUP_DATA_GROUP, App.ViewInfo.ProjectNO);
2219
                        //            Logger.sendReqLog("AddMarkupDataGroup: ", "", 1);
2220
                        //            if (group_id > 0)
2221
                        //            {
2222
                        //                foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
2223
                        //                {
2224
                        //                    if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
2225
                        //                    {
2226
                        //                        //MARKUP_DATA UPDATE
2227
                        //                        //Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.UpdateMarkupData((InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo).CommentID, group_id, App.ViewInfo.ProjectNO);
2228
                        //                        //Logger.sendReqLog("UpdateMarkupData: ", "", 1);
2229
                        //                        ViewerDataModel.Instance.MyMarkupList.Where(d => d.ID == (InnerItem.DrawingData as CommentUserInfo).CommentID).FirstOrDefault().Group_ID = group_id;
2230
                        //                        ViewerDataModel.Instance.MyMarkupList.Where(d => d.ID == (InnerItem.DrawingData as CommentUserInfo).CommentID).FirstOrDefault().IsUpdate = true;
2231
                        //                    }
2232
                        //                }
2233
                        //            }
2234
                        //        }
2235
                        //    }
2236
                        //}
2237
                        break;
2238
                    case "UnGroup":
2239
                        //var UnGrouptoggleList = this.Parent.ChildrenOfType<RadRibbonToggleButton>();
2240
                        //foreach (var togle in UnGrouptoggleList)
2241
                        //{
2242
                        //    togle.IsChecked = false;
2243
                        //}
2244
                        //if (this.ParentOfType<MainWindow>().dzMainMenu.currentControl != null)
2245
                        //{
2246
                        //    ViewerDataModel.Instance.MarkupControls_USER.Remove(this.ParentOfType<MainWindow>().dzMainMenu.currentControl);
2247
                        //    this.ParentOfType<MainWindow>().dzMainMenu.currentControl = null;
2248
                        //}
2249
                        //this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2250
                        //instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2251
                        //instanceMain.dzMainMenu.isLeftMouseButtonDownOnWindow = false;
2252

    
2253
                        //if (ViewerDataModel.Instance.SystemMain.dzMainMenu.SelectLayer.Children.Count < 1) //선택된 것이 없으면
2254
                        //{
2255
                        //    this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert("Please Select Controls", "Alert");
2256
                        //}
2257
                        //else//if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
2258
                        //{
2259
                        //    // string MarkupData = "";
2260
                        //    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
2261
                        //    {
2262
                        //        if (item.GetType().Name == "AdornerFinal" && (item as AdornerFinal).MemberSet.Count >= 1) // 1개 이상 
2263
                        //        {
2264
                        //            //MARKUP_DATA UPDATE
2265
                        //            foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
2266
                        //            {
2267
                        //                if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
2268
                        //                {
2269
                        //                    long group_id = ViewerDataModel.Instance.MyMarkupList.Where(d => d.ID == (InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo).CommentID).FirstOrDefault().Group_ID;
2270
                        //                    //MARKUP_DATA UPDATE
2271
                        //                    //Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.UpdateMarkupData((InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo).CommentID, 0, App.ViewInfo.ProjectNO);
2272
                        //                    //Logger.sendReqLog("UpdateMarkupData: ", "", 1);
2273
                        //                    ViewerDataModel.Instance.MyMarkupList.Where(d => d.ID == (InnerItem.DrawingData as CommentUserInfo).CommentID).FirstOrDefault().Group_ID = 0;
2274
                        //                    ViewerDataModel.Instance.MyMarkupList.Where(d => d.ID == (InnerItem.DrawingData as CommentUserInfo).CommentID).FirstOrDefault().IsUpdate = true;
2275

    
2276

    
2277
                        //                    //MARKUP_DATA_GROUP UPDATE
2278
                        //                    //bool value = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.UpdateMarkupDataGroup(group_id, App.ViewInfo.ProjectNO);
2279
                        //                    //Logger.sendReqLog("AddMarkupDataGroup: ", value.ToString(), 1);
2280
                        //                }
2281
                        //            }
2282
                        //        }
2283
                        //    }
2284
                        //}
2285
                        break;
2286
                    #endregion
2287
                    #region Capture
2288
                    case "Capture":
2289
                        SyncInit();
2290
                        //   instanceToggle.IsChecked = false;
2291
                        var CaptureList = this.Parent.ChildrenOfType<RadRibbonToggleButton>();
2292
                        foreach (var togle in CaptureList)
2293
                        {
2294
                            togle.IsChecked = false;
2295
                        }
2296

    
2297
                        if (this.ParentOfType<MainWindow>().dzMainMenu.currentControl != null)
2298
                        {
2299
                            ViewerDataModel.Instance.MarkupControls_USER.Remove(this.ParentOfType<MainWindow>().dzMainMenu.currentControl);
2300
                            this.ParentOfType<MainWindow>().dzMainMenu.currentControl = null;
2301
                        }
2302

    
2303
                        ViewerDataModel.Instance.SelectedControl = "ImgControl";
2304
                   //     ViewerDataModel.Instance.ControlTag = null;
2305
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ImgControl;
2306

    
2307
                        /*
2308
                        //캡쳐 하기 전에 코멘트 저장
2309
                        if (Common.ViewerDataModel.Instance.MarkupControls_USER.Count > 0 || (Application.Current.MainWindow as MainWindow).dzMainMenu.SelectLayer.Children.Count > 0)
2310
                        {
2311
                            var menu = (Application.Current.MainWindow as MainWindow).dzMainMenu;
2312
                            menu.ReleaseAdorner();
2313
                            if (menu.PreviewUserMarkupInfoItem != null && menu.PreviewUserMarkupInfoItem.IsPreviewUser == true)
2314
                            {
2315
                                (Application.Current.MainWindow as MainWindow).dzTopMenu.RefactoryCommentReact(menu);
2316
                            }
2317
                            else if (menu.gridViewMarkup.SelectedItems.Count == 0 || (menu.gridViewMarkup.SelectedItems.FirstOrDefault() as IKCOM.MarkupInfoItem).UserID != App.ViewInfo.UserID)
2318
                            {
2319

    
2320
                            }
2321
                            else
2322
                            {
2323
                                (Application.Current.MainWindow as MainWindow).dzTopMenu.RefactoryCommentReact(menu);
2324
                            }
2325
                        }*/
2326

    
2327
                        //Common.ViewerDataModel.Instance.CheckList_ID = ((e.Source as Telerik.Windows.Controls.RadButton).DataContext as Customer).ID;
2328
                        //Common.ViewerDataModel.Instance.CheckList_ID = ((e.Source as Image).DataContext as Customer).ID;
2329
                        //Common.ViewerDataModel.Instance.PageNumber = ((e.Source as Image).DataContext as Customer).PAGENUMBER;
2330
                        Application.Current.MainWindow.Focus();
2331
                        Common.ViewerDataModel.Instance.Capture_Opacity = 0.49;
2332
                        (Application.Current.MainWindow as MainWindow).dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Capture;
2333
                        break;
2334
                    #endregion
2335
                    #region Cad
2336
                    case "Inside":
2337
                        //instanceMain.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Drawing;
2338
                        //instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = false;
2339
                        Common.ViewerDataModel.Instance.SelectedControl = "InsideWhite";
2340
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.InsideWhite;
2341
                        break;
2342
                    case "Overlap":
2343
                        //instanceMain.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Drawing;
2344
                        //instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = false;
2345
                        Common.ViewerDataModel.Instance.SelectedControl = "OverlapWhite";
2346
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.OverlapWhite;
2347
                        break;
2348
                    case "Clip":
2349
                        //instanceMain.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Drawing;
2350
                        //instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = false;
2351
                        Common.ViewerDataModel.Instance.SelectedControl = "ClipWhite";
2352
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ClipWhite;
2353
                        break;
2354
                    case "CadExport":
2355
                        if (isClosed)
2356
                        {
2357
                            //토글 및 마우스 상태 초기화
2358
                            var toggleList = this.Parent.ChildrenOfType<RadRibbonToggleButton>();
2359
                            foreach (var togle in toggleList)
2360
                            {
2361
                                togle.IsChecked = false;
2362
                            }
2363
                            this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2364

    
2365
                            isClosed = false;
2366
                            //Control 파일 먼저 생성
2367
                            CollapsedButton_Click();
2368
                            CadViewer check = new CadViewer();
2369
                            check.WindowStartupLocation = WindowStartupLocation.CenterScreen;
2370
                            check.Title = "Export Viewer";
2371
                            //check.Topmost = true;
2372
                            check.Show();
2373
                            check.Closed += Check_Closed;
2374
                            instanceToggle.IsChecked = false;
2375
                        }
2376
                        break;
2377
                    case "CadViewer":
2378
                        if (isClosed)
2379
                        {
2380
                            //토글 및 마우스 상태 초기화
2381
                            var toggleList = this.Parent.ChildrenOfType<RadRibbonToggleButton>();
2382
                            foreach (var togle in toggleList)
2383
                            {
2384
                                togle.IsChecked = false;
2385
                            }
2386
                            this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2387

    
2388
                            isClosed = false;
2389
                            CadResultViewer check = new CadResultViewer();
2390
                            check.WindowStartupLocation = WindowStartupLocation.CenterScreen;
2391
                            check.Title = "Viewer";
2392
                            check.Show();
2393

    
2394
                            check.Closed += Check_Closed;
2395

    
2396
                        }
2397
                        break;
2398
                    #endregion
2399
                    default:
2400
                        break;
2401
                }
2402
                #endregion
2403
            }
2404
            else
2405
            {
2406

    
2407
                if (!instanceMain.dzMainMenu.IsFreeSelectionMode)
2408
                {
2409
                    instanceMain.dzMainMenu.IsSwingMode = false;
2410
                    Common.ViewerDataModel.Instance.SelectedControl = "";
2411
                    Common.ViewerDataModel.Instance.ControlTag = null;
2412
                    this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2413
                    this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2414
                }
2415
            }
2416
        }
2417

    
2418
        private void SyncInit()
2419
        {
2420
            try
2421
            {
2422
                if (!ViewerDataModel.Instance.SystemMain.dzMainMenu.testPanel2.IsHidden)
2423
                {
2424
                    ViewerDataModel.Instance.SystemMain.dzMainMenu.testPanel2.IsHidden = true;
2425
                    ViewerDataModel.Instance.PageBalanceMode = false;
2426
                    ViewerDataModel.Instance.PageBalanceNumber = 0;
2427
                    ViewerDataModel.Instance.PageNumber = 0;
2428
                    ViewerDataModel.Instance.MarkupControls_Sync.Clear();
2429
                    ViewerDataModel.Instance.SystemMain.dzMainMenu.gridViewRevMarkup.Visibility = Visibility.Collapsed;
2430
                    ViewerDataModel.Instance.SystemMain.dzMainMenu.UserList.IsChecked = false;
2431
                    ViewerDataModel.Instance.SystemMain.dzMainMenu.BalanceMode.IsChecked = false;
2432
                }
2433
            }
2434
            catch (Exception ex)
2435
            {
2436
                Logger.sendResLog("SyncInit", ex.Message, 0);
2437
            }
2438

    
2439
        }
2440

    
2441
        Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
2442
        CommentUserInfo currentControl { get; set; }
2443
        private void Check_Closed(object sender, EventArgs e)
2444
        {
2445
            isClosed = true;
2446
            //this.ParentOfType<MainWindow>().dzMainMenu.PN_Navi.IsEnabled = true;
2447
            //토글 및 마우스 상태 초기화
2448
            var toggleList = this.Parent.ChildrenOfType<RadToggleButton>();
2449
            foreach (var togle in toggleList)
2450
            {
2451
                togle.IsChecked = false;
2452
            }
2453
            this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2454
            ViewerDataModel.Instance.Capture_Opacity = 0;
2455

    
2456
        }
2457

    
2458
        /* public class test 
2459
         {
2460
             public double width { get; set; }
2461
             public double height { get; set; }
2462
         }
2463
         */
2464
        private void CollapsedButton_Click()
2465
        {
2466
            this.ParentOfType<MainWindow>().dzTopMenu._SaveEvent(null, null); // 저장하지 못한 데이터가 있다면 저장
2467

    
2468
            string[] data = new string[0];
2469

    
2470
            int cnt = 0;
2471
            var menu = this.ParentOfType<MainWindow>().dzMainMenu;
2472

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

    
2475
            foreach (var item in gridSelectionItem)
2476
            {
2477
                if ((item.UserID == App.ViewInfo.UserID) && (ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.CurrentPage != null))
2478
                {
2479
                    var instance = ViewerDataModel.Instance.MyMarkupList.Where(d => d.PageNumber == ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber &&
2480
                    d.MarkupInfoID == item.MarkupInfoID).ToList();
2481
                    data = new string[instance.Count];
2482
                    foreach (var markup in instance)
2483
                    {
2484
                        data[cnt++] = MarkupToPDF.Serialize.Core.JsonSerializerHelper.UnCompressString(markup.Data);
2485
                    }
2486
                }
2487
            }
2488

    
2489
            if (data != null && KCOM.Properties.Settings.Default.cad == 1)
2490
            {
2491
                string FilePath = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\Cad");
2492
                string FileName = FilePath + "\\commentstring.json"; // Default file name
2493
                if (!File.Exists(FilePath))
2494
                {
2495
                    Directory.CreateDirectory(FilePath);
2496
                }
2497

    
2498
                if (!string.IsNullOrEmpty(FileName))
2499
                {
2500
                    //  File.WriteAllText(SaveDig.FileName, data);
2501
                    File.WriteAllLines(FileName, data);
2502
                }
2503
            }
2504
        }
2505

    
2506
        private double minHeight;
2507
        private double minWidth;
2508

    
2509
        private double maxHeight;
2510
        private double maxWidth;
2511

    
2512
        public bool CanVResize { get; private set; }
2513
        public bool CanHResize { get; private set; }
2514

    
2515
        public void DesignerComponent(FrameworkElement content)
2516
        {
2517
            this.InitializeComponent();
2518

    
2519
            if (!double.IsNaN(content.Width))
2520
            {
2521
                CanHResize = false;
2522
                this.Width = content.Width;
2523
            }
2524
            else
2525
            {
2526
                CanHResize = true;
2527
                this.Width = 23.0;
2528
            }
2529
            if (!double.IsNaN(content.Height))
2530
            {
2531
                CanVResize = false;
2532
                this.Height = content.Height; ;
2533
            }
2534
            else
2535
            {
2536
                CanVResize = true;
2537
                this.Height = 23.0;
2538
            }
2539

    
2540
            minWidth = content.MinWidth < 10.0 ? 10.0 : content.MinWidth;
2541
            minHeight = content.MinHeight < 10.0 ? 10.0 : content.MinHeight;
2542
            maxWidth = content.MaxWidth;
2543
            maxHeight = content.MaxHeight;
2544

    
2545
            double top = (double)content.GetValue(Canvas.TopProperty);
2546
            if (double.IsNaN(top))
2547
                top = 0.0;
2548
            double left = (double)content.GetValue(Canvas.LeftProperty);
2549
            if (double.IsNaN(left))
2550
                left = 0.0;
2551
            SetValue(Canvas.TopProperty, top);
2552
            SetValue(Canvas.LeftProperty, left);
2553

    
2554
            //Set the actual content. Note that "Content" property is a new property. See below
2555
            this.Content = content;
2556
        }
2557
        private void Thumb_DragDelta(object sender, DragDeltaEventArgs e)
2558
        {
2559
            string name = ((Thumb)sender).Name;
2560
            if (name.Contains("Top"))
2561
            {
2562
                double newHeight = this.Height - e.VerticalChange;
2563
                if (newHeight >= minHeight && newHeight <= maxHeight)
2564
                {
2565
                    this.Height = newHeight;
2566
                    SetValue(Canvas.TopProperty,
2567
                (double)GetValue(Canvas.TopProperty) + e.VerticalChange);
2568
                }
2569
            }
2570
            if (name.Contains("Right"))
2571
            {
2572
                double newWidth = this.Width + e.HorizontalChange;
2573
                if (newWidth >= minWidth && newWidth <= maxWidth)
2574
                    this.Width = newWidth;
2575
            }
2576
            if (name.Contains("Bottom"))
2577
            {
2578
                double newHeight = this.Height + e.VerticalChange;
2579
                if (newHeight >= minHeight && newHeight <= maxHeight)
2580
                    this.Height = newHeight;
2581
            }
2582
            if (name.Contains("Left"))
2583
            {
2584
                double newWidth = this.Width - e.HorizontalChange;
2585
                if (newWidth >= minWidth && newWidth <= maxWidth)
2586
                {
2587
                    this.Width = newWidth;
2588
                    SetValue(Canvas.LeftProperty,
2589
                (double)GetValue(Canvas.LeftProperty) + e.HorizontalChange);
2590
                }
2591
            }
2592
        }
2593

    
2594
        private void drawControlBorder(object sender)
2595
        {
2596
            System.Windows.Controls.Control control = (System.Windows.Controls.Control)sender;
2597
        }
2598

    
2599
        private void ResizeThumb_DragDelta(object sender, MouseButtonEventArgs e)
2600
        {
2601
            System.Windows.Controls.Control designerItem = (System.Windows.Controls.Control)sender;
2602
            if (designerItem != null)
2603
            {
2604
                double deltaVertical, deltaHorizontal;
2605

    
2606
                switch (VerticalAlignment)
2607
                {
2608
                    case VerticalAlignment.Bottom:
2609
                        deltaVertical = designerItem.ActualHeight - designerItem.MinHeight;
2610
                        designerItem.Height -= deltaVertical;
2611
                        break;
2612
                    case VerticalAlignment.Top:
2613
                        deltaVertical = designerItem.ActualHeight - designerItem.MinHeight;
2614
                        Canvas.SetTop(designerItem, Canvas.GetTop(designerItem) + deltaVertical);
2615
                        designerItem.Height -= deltaVertical;
2616
                        break;
2617
                    default:
2618
                        break;
2619
                }
2620

    
2621
                switch (HorizontalAlignment)
2622
                {
2623
                    case HorizontalAlignment.Left:
2624
                        deltaHorizontal = designerItem.ActualWidth - designerItem.MinWidth;
2625
                        Canvas.SetLeft(designerItem, Canvas.GetLeft(designerItem) + deltaHorizontal);
2626
                        designerItem.Width -= deltaHorizontal;
2627
                        break;
2628
                    case HorizontalAlignment.Right:
2629
                        deltaHorizontal = designerItem.ActualWidth - designerItem.MinWidth;
2630
                        designerItem.Width -= deltaHorizontal;
2631
                        break;
2632
                    default:
2633
                        break;
2634
                }
2635
            }
2636
            e.Handled = true;
2637
        }
2638

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

    
2641
        void ExportMethod()
2642
        {
2643
            //FileDialogFilter filterImage = new FileDialogFilter("Image Files", "*.jpg", "*.png");
2644
            SaveDig.Filter = "PDF file format|*.pdf";
2645
            SaveDig.Title = "Save an DWG File";
2646
            SaveDig.ShowDialog();
2647
        }
2648

    
2649
        private void cbAutoSave_Checked(object sender, RoutedEventArgs e)
2650
        {            
2651
            if (cbAutoSave.IsChecked == true)
2652
            {
2653
                SaveTime(true, (int)cbSaveInterval.Value);
2654
            }
2655
            else
2656
            {
2657
                SaveTime(false, (int)cbSaveInterval.Value);
2658
            }
2659
        }
2660
        private void cbSaveInterval_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
2661
        {
2662
            if(string.IsNullOrEmpty(cbSaveInterval.Value.ToString()))
2663
            {
2664
                cbSaveInterval.Value = cbSaveInterval.Minimum;
2665
            }
2666
            if (cbAutoSave.IsChecked == true)
2667
            {
2668
                SaveTime(true, (int)cbSaveInterval.Value);
2669
            }
2670

    
2671
            KCOM.Properties.Settings.Default.SaveInterval = (double)cbSaveInterval.Value;
2672
            Properties.Settings.Default.Save();
2673
        }
2674
        //강인구 자동 저장 추가
2675
        private void AutoSave(object sender, RoutedEventArgs e)
2676
        {
2677
            RadToggleButton instanceToggle = sender as RadToggleButton;
2678

    
2679
            if(instanceToggle.IsChecked == true)
2680
            {
2681
                SaveTime(true);
2682
            }
2683
            else
2684
            {
2685
                SaveTime(false);
2686
            }
2687
        }
2688

    
2689
        public void Copy_Start()
2690
        {
2691
            if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
2692
            {
2693
                string MarkupData = "";
2694

    
2695
                foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
2696
                {
2697
                    if (item.GetType().Name == "AdornerFinal")
2698
                    {
2699
                        foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
2700

    
2701
                        {
2702
                            if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
2703
                            {
2704
                                markupReturn = MarkupParser.MarkupToString(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo, App.ViewInfo.UserID);
2705
                                MarkupData += "|OR|" + markupReturn.ConvertData;
2706
                            }
2707
                        }
2708
                        Clipboard.SetText(MarkupData);
2709
                    }
2710
                }
2711
            }
2712
        }
2713

    
2714
        public void Cut_Start()
2715
        {
2716
            if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
2717
            {
2718
                foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
2719
                {
2720
                    string MarkupData = "";
2721

    
2722
                    if (item.GetType().Name == "AdornerFinal")
2723
                    {
2724
                        foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
2725
                        {
2726
                            if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
2727
                            {
2728
                                markupReturn = MarkupParser.MarkupToString(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo, App.ViewInfo.UserID);
2729
                                MarkupData += "|OR|" + markupReturn.ConvertData;
2730
                            }
2731
                        }
2732
                        //클립보드에 넣음
2733
                        Clipboard.SetText(MarkupData);
2734
                    }
2735
                }
2736
                this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Clear();
2737
            }
2738
        }
2739

    
2740
        public void Paste_Start()
2741
        {
2742
            //마크업 붙여넣기
2743
            //if (Clipboard.GetText().Contains("|DZ|"))
2744
            if (Clipboard.GetText().Contains("|OR||DZ|"))
2745
            {
2746
                List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>();
2747

    
2748
                string[] delimiterChars = { "|OR|" };
2749
                string[] data = Clipboard.GetText().Split(delimiterChars, StringSplitOptions.RemoveEmptyEntries);
2750

    
2751
                SelectionSet.Instance.UnSelect(this.ParentOfType<MainWindow>().dzMainMenu);
2752

    
2753
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
2754

    
2755
                //강인구 Undo/Redo 보류
2756
                UndoData = new Undo_data()
2757
                {
2758
                    IsUndo = false,
2759
                    Event = Event_Type.Create,
2760
                    EventTime = DateTime.Now,
2761
                    Markup_List = new List<Multi_Undo_data>()
2762
                };
2763

    
2764
                ViewerDataModel.Instance.UndoDataList.Where(data1 => data1.IsUndo == true).ToList().ForEach(i =>
2765
                {
2766
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
2767
                });
2768

    
2769
                foreach (string parse in data)
2770
                {
2771
                    if (parse != "")
2772
                    {
2773
                        System.Windows.Controls.Control item = MarkupParser.ParseEx(App.ViewInfo.ProjectNO, parse, ViewerDataModel.Instance.MarkupControls_USER, string.Empty, string.Empty);
2774
                        (item as MarkupToPDF.Common.CommentUserInfo).CommentID = Commons.shortGuid();
2775

    
2776
                        ViewerDataModel.Instance.MarkupControls.Remove(item as MarkupToPDF.Common.CommentUserInfo);
2777
                        ViewerDataModel.Instance.MarkupControls_USER.Remove(item as MarkupToPDF.Common.CommentUserInfo);
2778

    
2779
                        adornerSet.Add(item as MarkupToPDF.Common.CommentUserInfo);
2780

    
2781
                        //Controls.AdornerFinal final = new Controls.AdornerFinal(item as MarkupToPDF.Common.CommentUserInfo);
2782
                        //this.dzMainMenu.SelectLayer.Children.Add(final);
2783

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

    
2786
                        UndoData.Markup_List.Add(multi_Undo_Data);
2787
                        ViewerDataModel.Instance.UndoDataList.Add(UndoData);                        
2788
                    }
2789
                }
2790
                Controls.AdornerFinal final = new Controls.AdornerFinal(adornerSet);
2791

    
2792
                if(this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.X < 0)
2793
                {
2794
                    Canvas.SetLeft(final, 0);
2795
                    Canvas.SetTop(final, 0);
2796
                }
2797
                else
2798
                {
2799
                    double realPointX = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.X - final.BorderSize.X - (final.BorderSize.Width / 2);
2800
                    double realPointY = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.Y - final.BorderSize.Y - (final.BorderSize.Height / 2);
2801
                    final.TranslateItems(realPointX, realPointY);
2802

    
2803
                    if (final.Members.Where(type => type.Drawingtype == MarkupToPDF.Controls.Common.ControlType.TextControl).FirstOrDefault() != null)
2804
                    {
2805
                        final.TranslateItems(0.001, 0.001); //dummy
2806
                    }
2807

    
2808
                }
2809
                
2810

    
2811
                this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Add(final);
2812

    
2813
                //붙여 넣을때 원본 컨트롤과 겹치지 않도록 설정
2814
                //Canvas.SetLeft(final, 50);
2815
                //Canvas.SetTop(final, 50);
2816
            }
2817
            //외부 이미지 붙여넣기
2818
            else if (Clipboard.GetImage() != null)
2819
            {
2820
                try
2821
                {
2822
                    Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
2823

    
2824
                    //강인구 Undo/Redo 보류
2825
                    UndoData = new Undo_data()
2826
                    {
2827
                        IsUndo = false,
2828
                        Event = Event_Type.Create,
2829
                        EventTime = DateTime.Now,
2830
                        Markup_List = new List<Multi_Undo_data>()
2831
                    };
2832

    
2833

    
2834
                    string temppath = System.IO.Path.GetTempPath();
2835
                    //string filename = KCOM.Events.Save.shortCommentKey();
2836
                    string filename = Commons.shortFileKey();
2837

    
2838
                    System.Drawing.Image clipboardImage = System.Windows.Forms.Clipboard.GetImage();
2839
                    clipboardImage.Save(temppath + "\\" + filename);
2840

    
2841
                    System.IO.FileInfo fileInfo = new System.IO.FileInfo(temppath + "\\" + filename);
2842
                    String strFile = System.IO.Path.GetFileName(fileInfo.FullName);
2843
                    long numByte = fileInfo.Length;
2844
                    double dLen = Convert.ToDouble(fileInfo.Length / 1000000);
2845
                    kr.co.devdoftech.cloud.FileUpload fileUploader = new kr.co.devdoftech.cloud.FileUpload();
2846

    
2847
                    if (dLen < 4)
2848
                    {
2849
                        System.IO.FileStream fStream = new System.IO.FileStream(fileInfo.FullName,
2850
                        System.IO.FileMode.Open, System.IO.FileAccess.Read);
2851
                        System.IO.BinaryReader br = new System.IO.BinaryReader(fStream);
2852
                        byte[] data = br.ReadBytes((int)numByte);
2853

    
2854
                        filename = fileUploader.Run(App.ViewInfo.ProjectNO, this.ParentOfType<MainWindow>().dzMainMenu._DocItem.DOCUMENT_NO, App.ViewInfo.UserID, strFile + ".png", data);
2855
                        Check_Uri.UriCheck(filename);
2856
                        br.Close();
2857
                        fStream.Close();
2858
                        fStream.Dispose();
2859
                    }
2860
                    else
2861
                    {
2862
                        this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert("Available Memory less than 4 mega byte", "Alert");
2863
                        return;
2864
                    }
2865

    
2866
                    fileInfo.Delete();
2867

    
2868
                    //System.Drawing.Image clipboardImage = System.Windows.Forms.Clipboard.GetImage();
2869
                    System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(clipboardImage);
2870
                    IntPtr hBitmap = bmp.GetHbitmap();
2871
                    System.Windows.Media.ImageSource WpfBitmap = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(hBitmap, IntPtr.Zero, Int32Rect.Empty, System.Windows.Media.Imaging.BitmapSizeOptions.FromEmptyOptions());
2872
                    Image img = new Image();
2873
                    //img.Source = new System.Windows.Media.Imaging.BitmapImage(new Uri(filename));
2874
                    if (filename.Contains(".svg"))
2875
                    {
2876
                        byte[] imageData = null;
2877
                        DrawingImage image = null;
2878
                        using (System.Net.WebClient web = new System.Net.WebClient())
2879
                        {
2880
                            imageData = web.DownloadData(new Uri(filename));
2881
                            System.IO.Stream stream = new System.IO.MemoryStream(imageData);
2882
                            image = SvgReader.Load(stream);
2883
                        }
2884
                        img.Source = image;
2885
                    }
2886
                    else
2887
                    {
2888
                        img.Source = new BitmapImage(new Uri(filename));
2889
                    }
2890

    
2891
                    var currentControl = new MarkupToPDF.Controls.Etc.ImgControl
2892
                    {
2893
                        PointSet = new List<Point>(),
2894
                        //FilePath = img.Source.ToString(),
2895
                        FilePath = filename,
2896
                        ImageData = img.Source,
2897
                        StartPoint = new Point(100, 100),
2898
                        EndPoint = new Point(200, 200),
2899
                        TopRightPoint = new Point(100, 200),
2900
                        LeftBottomPoint = new Point(200, 100)
2901
                    };
2902

    
2903
                    currentControl.TopRightPoint = new Point(currentControl.StartPoint.X + clipboardImage.Width, currentControl.StartPoint.Y);
2904
                    currentControl.LeftBottomPoint = new Point(currentControl.StartPoint.X, currentControl.StartPoint.Y + clipboardImage.Height);
2905
                    currentControl.EndPoint = new Point(currentControl.StartPoint.X + clipboardImage.Width, currentControl.StartPoint.Y + clipboardImage.Height);
2906

    
2907
                    currentControl.PointSet = new List<Point>
2908
                                        {
2909
                                            currentControl.StartPoint,
2910
                                            currentControl.LeftBottomPoint,
2911
                                            currentControl.EndPoint,
2912
                                            currentControl.TopRightPoint,
2913
                                        };
2914

    
2915
                    multi_Undo_Data = this.ParentOfType<MainWindow>().dzMainMenu.Control_Style(currentControl as MarkupToPDF.Common.CommentUserInfo);
2916
                    UndoData.Markup_List.Add(multi_Undo_Data);
2917
                    ViewerDataModel.Instance.UndoDataList.Add(UndoData);
2918

    
2919
                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl as MarkupToPDF.Common.CommentUserInfo);
2920
                    currentControl.CommentID = Commons.shortGuid();
2921

    
2922
                    currentControl.ApplyTemplate();
2923
                    currentControl.SetImage();
2924

    
2925
                    ViewerDataModel.Instance.MarkupControls_USER.Remove(currentControl as MarkupToPDF.Common.CommentUserInfo);
2926
                    Controls.AdornerFinal final = new Controls.AdornerFinal(currentControl as MarkupToPDF.Common.CommentUserInfo);
2927
                    this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Add(final);
2928

    
2929
                    double realPointX = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.X - final.BorderSize.X - (final.BorderSize.Width / 2);
2930
                    double realPointY = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.Y - final.BorderSize.Y - (final.BorderSize.Height / 2);
2931
                    final.TranslateItems(realPointX, realPointY);
2932
                }
2933
                catch(Exception ex)
2934
                {
2935
                    this.ParentOfType<MainWindow>().DialogMessage_Alert("" + ex, "Alert");
2936
                }
2937
            }
2938
        }
2939
    }
2940
}
클립보드 이미지 추가 (최대 크기: 500 MB)