프로젝트

일반

사용자정보

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

markus / KCOM / Events / Implementation / TopMenuEvent.cs @ 490208bd

이력 | 보기 | 이력해설 | 다운로드 (124 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 System;
8
using System.Collections.Generic;
9
using System.Linq;
10
using System.Text;
11
using System.Windows;
12
using System.Windows.Controls;
13
using System.Windows.Input;
14
using System.Windows.Media;
15
using System.Windows.Media.Imaging;
16
using Telerik.Windows.Controls;
17
using IKCOM;
18
using Microsoft.Win32;
19
using System.IO;
20
using System.Reflection;
21
using System.Windows.Controls.Primitives;
22
using MarkupToPDF.Controls.Parsing;
23
using Telerik.Windows.Data;
24
using System.ComponentModel;
25
using System.Web;
26
using Markus.Fonts;
27
using System.Threading.Tasks;
28
using System.Windows.Threading;
29
using System.Text.RegularExpressions;
30
using MarkupToPDF.Controls.Shape;
31
using MarkupToPDF.Controls.Polygon;
32
using MarkupToPDF.Controls.Line;
33
using MarkupToPDF.Controls.Cad;
34

    
35
namespace KCOM.Views
36
{
37
    public partial class TopMenu : UserControl
38
    {
39
        public System.Windows.Threading.DispatcherTimer SaveTimer { get; set; }
40
        public bool isClosed = true;
41

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

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

    
70
        //강인구 추가(Undo End)
71
        private void SetPaintEvent()
72
        {
73
            List<AdornerMember> AdonerList = GetAdornerItems();
74

    
75
            if (AdonerList.Count > 0)
76
            {
77
                UndoCommand.Instance.Push(EventType.Operation, AdonerList.ConvertAll(x => x.DrawingData as CommentUserInfo));
78

    
79
                #region 속성 변경
80
                foreach (AdornerMember InnerItem in AdonerList)
81
                {
82
                    if ((InnerItem.DrawingData as MarkupToPDF.Controls.Common.IShapeControl) != null)
83
                    {
84
                        (InnerItem.DrawingData as MarkupToPDF.Controls.Common.IShapeControl).Paint = ViewerDataModel.Instance.paintSet;
85
                    }
86
                }
87
                #endregion
88
            }
89
        }
90

    
91
        private void SetHighlightEvent()
92
        {
93
            List<AdornerMember> AdonerList = GetAdornerItems();
94

    
95
            if (AdonerList.Count > 0)
96
            {
97
                foreach (AdornerMember InnerItem in AdonerList)
98
                {
99
                    switch (InnerItem.DrawingData.GetType().Name)
100
                    {
101
                        case ("TextControl"):
102
                            {
103
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).IsHighLight = ViewerDataModel.Instance.checkHighShape;
104
                            }
105
                            break;
106
                        case ("ArrowTextControl"):
107
                            {
108
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape;
109
                            }
110
                            break;
111
                    }
112
                }
113

    
114
                ViewerDataModel.Instance.IsMarkupUpdate = true;
115
            }
116

    
117
        }
118

    
119
        private void FillShapeEvent(object sender, RoutedEventArgs e)
120
        {
121
            #region 주석
122
            //if ((sender as CheckBox).IsChecked.Value)
123
            //{
124
            //    cbHatchShape.IsChecked = false;
125
            //    imgShape_RectCloud.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/RectCloud_Fill.png", UriKind.Relative));
126
            //    imgShape_Cloud.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/Cloud_Fill.png", UriKind.Relative));
127
            //    imgShape_Rect.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/Rectangle_Fill.png", UriKind.Relative));
128
            //    imgShape_Tri.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/triangle-icon.png", UriKind.Relative));
129
            //    imgShape_Cicle.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/circle-icon.png", UriKind.Relative));
130
            //    imgShape_Poly.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/polygon_Fill.png", UriKind.Relative));
131
            //    TaskMessage("채우기 옵션이 적용되었습니다", TaskMessageType.Normal);
132
            //}
133
            //else
134
            //{
135

    
136
            //    imgShape_RectCloud.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/RectCloud.png", UriKind.Relative));
137
            //    imgShape_Cloud.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/Cloud.png", UriKind.Relative));
138
            //    imgShape_Rect.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/Rectangle.png", UriKind.Relative));
139
            //    imgShape_Tri.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/triangle-icon_None.png", UriKind.Relative));
140
            //    imgShape_Cicle.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/circle-icon_None.png", UriKind.Relative));
141
            //    imgShape_Poly.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/polygon.png", UriKind.Relative));
142
            //    TaskMessage("채우기 옵션이 해제되었습니다", TaskMessageType.Caption);
143
            //}
144
            #endregion
145
            ViewerDataModel.Instance.checkFillShape = (sender as CheckBox).IsChecked.Value;
146

    
147
            if (ViewerDataModel.Instance.checkFillShape)
148
            {
149
                cbHatchShape.IsChecked = false;
150
                ViewerDataModel.Instance.paintSet = MarkupToPDF.Controls.Common.PaintSet.Fill;
151
            }
152
            else
153
            {
154
                ViewerDataModel.Instance.paintSet = MarkupToPDF.Controls.Common.PaintSet.None;
155
            }
156
            SetPaintEvent();
157
        }
158

    
159
        /// <summary>
160
        /// 도형 빗금 처리
161
        /// </summary>
162
        /// <param name="sender"></param>
163
        /// <param name="e"></param>
164
        private void HatchShapeEvent(object sender, RoutedEventArgs e)
165
        {
166
			#region 주석
167
            //if ((sender as CheckBox).IsChecked.Value)
168
            //{
169
            //    cbFillShape.IsChecked = false;
170
            //    imgShape_RectCloud.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/RectCloud_Hatch.png", UriKind.Relative));
171
            //    imgShape_Cloud.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/Cloud_Hatch.png", UriKind.Relative));
172
            //    imgShape_Rect.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/rectangle-icon_Hatch.png", UriKind.Relative));
173
            //    imgShape_Tri.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/triangle-icon_Hatch.png", UriKind.Relative));
174
            //    imgShape_Cicle.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/circle-icon_Hatch.png", UriKind.Relative));
175
            //    imgShape_Poly.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/polygon_hatch.png", UriKind.Relative));
176
            //    TaskMessage("무늬 옵션이 적용되었습니다", TaskMessageType.Normal);
177
            //}
178
            //else
179
            //{
180
            //    imgShape_RectCloud.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/RectCloud.png", UriKind.Relative));
181
            //    imgShape_Cloud.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/Cloud.png", UriKind.Relative));
182
            //    imgShape_Rect.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/Rectangle.png", UriKind.Relative));
183
            //    imgShape_Tri.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/triangle-icon_None.png", UriKind.Relative));
184
            //    imgShape_Cicle.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/circle-icon_None.png", UriKind.Relative));
185
            //    imgShape_Poly.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/polygon.png", UriKind.Relative));
186
            //    TaskMessage("무늬 옵션이 해제되었습니다", TaskMessageType.Caption);
187
            //} 
188
            #endregion
189

    
190
            //강인구 추가
191
            ViewerDataModel.Instance.checkHatchShape = (sender as CheckBox).IsChecked.Value;
192
            if (ViewerDataModel.Instance.checkHatchShape)
193
            {
194
                cbFillShape.IsChecked = false;
195
                ViewerDataModel.Instance.paintSet = MarkupToPDF.Controls.Common.PaintSet.Hatch;
196
            }
197
            else
198
            {
199
                ViewerDataModel.Instance.paintSet = MarkupToPDF.Controls.Common.PaintSet.None;  
200
            }
201
            SetPaintEvent();
202
        }
203

    
204
        void SaveTimer_Tick(object sender, EventArgs e)
205
        {
206
            //if (this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode != IKCOM.MouseHandlingMode.Drawing)
207
            if (this.ParentOfType<MainWindow>().dzMainMenu.currentControl == null && this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count == 0)
208
            {
209
                SaveEventCallback(null, null);
210
            }
211
        }
212

    
213
        private void SaveTime(bool IsRun)
214
        {
215
            if(SaveTimer == null)
216
            {
217
                SaveTimer = new System.Windows.Threading.DispatcherTimer();
218
                SaveTimer.Interval = new TimeSpan(0, 0, 5);
219
                SaveTimer.Tick += new EventHandler(SaveTimer_Tick);
220
            }
221

    
222
            if (IsRun)
223
            {
224
                SaveTimer.Start();
225
            }
226
            else
227
            {
228
                SaveTimer.Stop();
229
            }
230
        }
231
        private void SaveTime(bool IsRun,int timeinterval)
232
        {
233
            if (SaveTimer == null)
234
            {
235
                SaveTimer = new System.Windows.Threading.DispatcherTimer();
236
                SaveTimer.Interval = new TimeSpan(0, timeinterval, 0);
237
                SaveTimer.Tick += new EventHandler(SaveTimer_Tick);
238
            }
239
            else
240
            {
241
                SaveTimer.Stop();
242
                SaveTimer.Interval = new TimeSpan(0, timeinterval, 0);
243
            }
244

    
245
            if (IsRun)
246
            {
247
                SaveTimer.Start();
248
            }
249
            else
250
            {
251
                SaveTimer.Stop();
252
            }
253
        }
254
        /// <summary>
255
        /// enable busy indicator and then call _SaveEvent method.
256
        /// </summary>
257
        /// <param name="sender"></param>
258
        /// <param name="e"></param>
259
        public async void SaveEventCallback(object sender, RoutedEventArgs e)
260
        {
261
            var mianMenu = this.ParentOfType<MainWindow>().dzMainMenu;
262

    
263
            if (mianMenu.busyIndicator.IsBusy)
264
            {
265
                return;
266
            }
267

    
268
            //var result = await Dispatcher.InvokeAsync<bool>(()=>
269
            //{
270
                this.ParentOfType<MainWindow>().dzMainMenu.busyIndicator.IsBusy = true;
271

    
272
                await SaveEventAsync(sender, e);
273

    
274
                mianMenu.busyIndicator.IsBusy = false;
275
               
276
            //});
277

    
278
            //System.Threading.Tasks.Task SaveTask = System.Threading.Tasks.Task.Factory.StartNew(() =>
279
            //{
280
            //    Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, new Action<object, RoutedEventArgs>(_SaveEvent), sender, e);
281
            //}).ContinueWith(task =>
282
            //{
283
            //    Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate () { this.ParentOfType<MainWindow>().dzMainMenu.busyIndicator.IsBusy = false; }));
284
            //});
285
        }
286

    
287
        /// <summary>
288
        /// save markup
289
        ///  - convert ink control to polygon control if ink control exists
290
        ///  - unselect and update my markup list
291
        /// <param name="sender"></param>
292
        /// <param name="e"></param>
293
        public async Task<bool> SaveEventAsync(object sender, RoutedEventArgs e)
294
        {
295
            bool result = false;
296

    
297
            var mainMenu = this.ParentOfType<MainWindow>().dzMainMenu;
298
            try
299
            {
300
                mainMenu.ConvertInkControlToPolygon();
301

    
302
                mainMenu.UpdateMyMarkupList();
303

    
304
                if (mainMenu.gridViewMarkup.SelectedItems.Count == 0 && mainMenu.gridViewMarkup.Items.Count > 0)
305
                {
306
                    this.ParentOfType<MainWindow>().DialogMessage_Alert("Please Select Your Comment List Item", "Alert");
307
                }
308
                else
309
                {                    
310
                    foreach (var item in mainMenu.gridViewMarkup.SelectedItems)
311
                    {
312
                        if ((item as IKCOM.MarkupInfoItem).UserID == App.ViewInfo.UserID)
313
                        {
314
                            #region 저장 서비스 호출(저장 완료시까지 대기)
315
                            await this.ExecuteSaveCommandAsync(mainMenu);
316
                            #endregion
317

    
318
                            var info = ViewerDataModel.Instance._markupInfoList.FirstOrDefault(data => data.MarkupInfoID == (item as IKCOM.MarkupInfoItem).MarkupInfoID);
319
                            if(info != null) info.UpdateTime = DateTime.Now;
320
                            if (!ViewerDataModel.Instance.IsConsolidate && (sender != null))
321
                            {
322
                                this.ParentOfType<MainWindow>().DialogMessage_Alert("Save is complete.", "Info");
323
                            }
324

    
325
                            result = true;
326
                        }
327
                    }
328
                }
329

    
330
                mainMenu.SetCommentPages(null);
331

    
332
                ViewerDataModel.Instance.UndoDataList.Clear();
333
            }
334
            catch (Exception ex)
335
            {
336
                System.Diagnostics.Debug.WriteLine("_SaveEvent Error : " + ex.ToString());
337
            }
338
            finally
339
            {
340
                /*
341
                /// delete markup information when 코멘트가 없을 경우
342
                if (ViewerDataModel.Instance.MyMarkupList.Count == 0)
343
                {
344
                    foreach (var item in menu.gridViewMarkup.SelectedItems)
345
                    {
346
                        if ((item as IKCOM.MarkupInfoItem).UserID == App.ViewInfo.UserID)
347
                        {
348
                            //this.ParentOfType<MainWindow>().dzMainMenu.DeleteItem((item as IKCOM.MarkupInfoItem));
349
                        }
350
                    }
351
                }
352
                */
353
            }
354

    
355
            return result;
356
        }
357

    
358
        /// <summary>
359
        /// 마크업 데이터를 저장한다.
360
        /// </summary>
361
        /// <param name="menu"></param>
362
        /// <returns></returns>
363
        public async Task<bool> ExecuteSaveCommandAsync(MainMenu menu)
364
        {
365
            bool result = false;
366

    
367
            if (menu.pageNavigator.CurrentPage != null)
368
            {
369
                SaveCommand.Instance.Project_No = App.ViewInfo.ProjectNO;
370
                SaveCommand.Instance.document_id = App.ViewInfo.DocumentItemID;
371
                SaveCommand.Instance.user_id = App.ViewInfo.UserID;
372
                SaveCommand.Instance.page_no = menu.pageNavigator.CurrentPage.PageNumber;
373

    
374
                try
375
                {
376
                    if (ViewerDataModel.Instance.UndoDataList.Count > 0 || ViewerDataModel.Instance.IsMarkupUpdate)
377
                    {
378
                        List<IKCOM.MarkupInfoItem> SelectedMarkupInfos = new List<IKCOM.MarkupInfoItem>();
379
                        foreach (var item in menu.gridViewMarkup.SelectedItems)
380
                        {
381
                            if ((item as IKCOM.MarkupInfoItem).UserID == App.ViewInfo.UserID)
382
                            {
383
                                SelectedMarkupInfos.Add(item as IKCOM.MarkupInfoItem);
384
                            }
385
                        }
386

    
387
                        result = await SaveCommand.Instance.Execute(SelectedMarkupInfos);
388
                        ViewerDataModel.Instance.IsMarkupUpdate = false;
389
                    }
390
                    else
391
                    {
392
                        result = true;
393
                    }
394

    
395
                    if (ViewerDataModel.Instance.RotationDocs.Count > 0)
396
                    {
397
                        SaveCommand.Instance.PageAngleSave(App.ViewInfo.ProjectNO, ViewerDataModel.Instance.RotationDocs);
398
                    }
399
                }
400
                catch (Exception ex)
401
                {
402
                    this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert(string.Format("세이브 실패:{0}", ex.Message), "Alert");
403
                    throw new InvalidOperationException(ex.Message);
404
                }
405
            }
406
            else
407
            {
408
                System.Diagnostics.Debug.WriteLine("ExecuteSaveCommand Error - pageNavigator.CurrentPage null");
409
            }
410

    
411
            return result;
412
        }
413

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

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

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

    
441
            RadWindow PrintWindow = new RadWindow();
442
            PrintWindow.Width = 850;
443
            PrintWindow.Height = 600;
444
            PrintWindow.Header = Type;
445

    
446
            List<IKCOM.MarkupInfoItem> markupinfo = new List<IKCOM.MarkupInfoItem>();
447

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

    
450
            if (markupinfo?.Count() > 0)
451
            {
452
                //Logger.sendResLog("GetPrintDocItemList", "TRUE", 1);
453
            }
454
            else
455
            {
456
                //Logger.sendResLog("GetPrintDocItemList", "FALSE", 1);
457
            }
458

    
459
            /// Tile Source URL을 구한다
460

    
461
            string sImageURL = ViewerDataModel.Instance.SystemMain.dzMainMenu.GetImageURL(App.ViewInfo.DocumentItemID, this.ParentOfType<MainWindow>().dzMainMenu.pageNavigator.CurrentPage.PageNumber);
462
            var url = new Uri(sImageURL);
463
            string sFolder = App.ViewInfo.DocumentItemID.All(char.IsDigit) ? (Convert.ToInt64(App.ViewInfo.DocumentItemID) / 100).ToString() : App.ViewInfo.DocumentItemID.Substring(0, 5);
464
            var Tile_Url = string.Format(@"{0}://{1}:{2}/TileSource/{3}_Tile/{4}/{5}/",
465
                url.Scheme, url.Host, url.Port,
466
                App.ViewInfo.ProjectNO,
467
                sFolder,
468
                App.ViewInfo.DocumentItemID
469
                );
470
            /// up to here
471

    
472
            var docitem = this.ParentOfType<MainWindow>().dzMainMenu._DocItem;
473

    
474
            PrintWindow.Content = new KCOM.Control.PrintControl(
475
                      Tile_Url,
476
                      App.ViewInfo.ProjectNO,
477
                      this.ParentOfType<MainWindow>().dzMainMenu._DocInfo,
478
                      markupinfo,
479
                      this.ParentOfType<MainWindow>().dzMainMenu.pageNavigator.CurrentPage.PageNumber,
480
                      docitem.GROUP_NO,
481
                      docitem.DOCUMENT_NO,
482
                      docitem.ORIGINAL_FILE,
483
                      isprint);
484

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

    
497
        //강인구 추가
498
        private void PrintEvent(object sender, RoutedEventArgs e)
499
        {
500
            RadRibbonButton button = sender as RadRibbonButton;
501
            Print_Start(button.Content.ToString());
502
        }
503

    
504
        /// <summary>
505
        /// 선택된 AdornerMember들을 리턴한다.
506
        /// </summary>
507
        /// <returns></returns>
508
        public List<AdornerMember> GetAdornerItems()
509
        {
510
            List<AdornerMember> AdonerList = new List<AdornerMember>();
511

    
512
            if (this.ParentOfType<MainWindow>() != null && this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
513
            {
514
                foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
515
                {
516
                    if (item.GetType().Name == "AdornerFinal")
517
                    {
518
                        foreach (var InnerItem in (item as Controls.AdornerFinal).Members)
519
                        {
520
                            AdonerList.Add(InnerItem);
521
                        }
522
                    }
523
                }
524
            }
525

    
526
            return AdonerList;
527
        }
528

    
529
        /// <summary>
530
        /// 투명도 변경
531
        /// </summary>
532
        /// <param name="sender"></param>
533
        /// <param name="e"></param>
534
        //강인구 추가(Undo End)
535
        private void sdOpacity_ValueChanged(object sender, RoutedEventArgs e)
536
        {
537
            List<AdornerMember> AdonerList = GetAdornerItems();
538
            if (!AdonerList.Any()) return;
539

    
540
            UndoCommand.Instance.Push(EventType.Operation, AdonerList.ConvertAll(x => x.DrawingData as CommentUserInfo));
541

    
542
            #region 속성 변경
543
            foreach (AdornerMember InnerItem in AdonerList)
544
            {
545
                InnerItem.DrawingData.Opacity = ViewerDataModel.Instance.ControlOpacity;
546
            }
547
            ViewerDataModel.Instance.IsMarkupUpdate = true;
548
            #endregion
549
        }
550

    
551
        /// <summary>
552
        /// LineSize 변경
553
        /// </summary>
554
        /// <param name="sender"></param>
555
        /// <param name="e"></param>
556
        private void cbLineSize_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
557
        {
558
            if (string.IsNullOrEmpty(cbLineSize.Value.ToString()))
559
            {
560
                cbLineSize.Value = cbLineSize.Minimum;
561
            }
562
            List<AdornerMember> AdonerList = GetAdornerItems();
563
            if (!AdonerList.Any()) return;
564
                
565
            UndoCommand.Instance.Push(EventType.Operation, AdonerList.ConvertAll(x => x.DrawingData as CommentUserInfo));
566

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

    
658
            KCOM.Properties.Settings.Default.LineSize = (double)cbLineSize.Value;
659
            Properties.Settings.Default.Save();
660
        }
661

    
662

    
663
        /// <summary>
664
        /// Interval Size 변경
665
        /// </summary>
666
        /// <param name="sender"></param>
667
        /// <param name="e"></param>
668
        private void cbIntervalSize_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
669
        {
670
            if (string.IsNullOrEmpty(cbIntervalSize.Value.ToString()))
671
            {
672
                cbIntervalSize.Value = cbIntervalSize.Minimum;
673
            }
674
            List<AdornerMember> AdonerList = GetAdornerItems();
675
            if (!AdonerList.Any()) return;
676

    
677
            UndoCommand.Instance.Push(EventType.Operation, AdonerList.ConvertAll(x => x.DrawingData as CommentUserInfo));
678

    
679
            #region 속성 변경
680
            foreach (AdornerMember InnerItem in AdonerList)
681
            {
682
                switch (InnerItem.DrawingData.GetType().Name)
683
                {
684
                    case ("LineControl"):
685
                        {
686
                            (InnerItem.DrawingData as MarkupToPDF.Controls.Line.LineControl).Interval = ViewerDataModel.Instance.Interval;
687
                        }
688
                        break;
689
                }
690
            }
691
            ViewerDataModel.Instance.IsMarkupUpdate = true;
692
            #endregion
693

    
694
            KCOM.Properties.Settings.Default.Interval = (double)cbIntervalSize.Value;
695
            Properties.Settings.Default.Save();
696
        }
697
        
698
        /// <summary>
699
        /// ArcLength가 수정되었을때
700
        /// </summary>
701
        /// <param name="sender"></param>
702
        /// <param name="e"></param>
703
        private void cbArcLength_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
704
        {
705
            if (string.IsNullOrEmpty(cbArcLength.Value.ToString()))
706
            {
707
                cbArcLength.Value = cbArcLength.Minimum;
708
            }
709

    
710
            List<AdornerMember> AdonerList = GetAdornerItems();
711
            if (!AdonerList.Any()) return;
712

    
713
            UndoCommand.Instance.Push(EventType.Operation, AdonerList.ConvertAll(x => x.DrawingData as CommentUserInfo));
714

    
715
            #region 속성 변경
716
            foreach (AdornerMember InnerItem in AdonerList)
717
            {
718
                switch (InnerItem.DrawingData.GetType().Name)
719
                {
720
                    case ("RectCloudControl"):
721
                        {
722
                            var item = InnerItem.DrawingData as MarkupToPDF.Controls.Shape.RectCloudControl;
723
                            item.ArcLength = ViewerDataModel.Instance.ArcLength;
724
                        }
725
                    break;
726
                    case ("CloudControl"):
727
                    {
728
                            var item = InnerItem.DrawingData as MarkupToPDF.Controls.Polygon.CloudControl;
729
                            item.ArcLength = ViewerDataModel.Instance.ArcLength;
730
                    }
731
                    break;
732
                    case ("TextControl"):
733
                    {
734
                            var item = InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl;
735
                            item.ArcLength = ViewerDataModel.Instance.ArcLength;
736
                    }
737
                    break;
738
                    case ("ArrowTextControl"):
739
                    {
740
                            var item = InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl;
741
                            item.ArcLength = ViewerDataModel.Instance.ArcLength;
742
                    }
743
                    break;
744
                }
745
            }
746
            ViewerDataModel.Instance.IsMarkupUpdate = true;
747
            #endregion
748

    
749
            KCOM.Properties.Settings.Default.ArcLength = (double)cbArcLength.Value;
750
            Properties.Settings.Default.Save();
751
        }
752

    
753
        /// <summary>
754
        /// Dash 스타일 변경
755
        /// </summary>
756
        /// <param name="sender"></param>
757
        /// <param name="e"></param>
758
        private void cbDashStyle_SelectionChanged(object sender, SelectionChangedEventArgs e)
759
        {
760
            ViewerDataModel.Instance.DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
761
            List<AdornerMember> AdonerList = GetAdornerItems();
762
            if (!AdonerList.Any()) return;
763

    
764
            UndoCommand.Instance.Push(EventType.Operation, AdonerList.ConvertAll(x => x.DrawingData as CommentUserInfo));
765

    
766
            #region 속성 변경
767
            foreach (AdornerMember InnerItem in AdonerList)
768
            {
769
                switch (InnerItem.DrawingData.GetType().Name)
770
                {
771
                    case ("LineControl"):
772
                        {
773
                            (InnerItem.DrawingData as MarkupToPDF.Controls.Line.LineControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
774
                        }
775
                        break;
776
                    case ("ArcControl"):
777
                        {
778
                            (InnerItem.DrawingData as MarkupToPDF.Controls.Line.ArcControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
779
                        }
780
                        break;
781
                    case ("ArrowArcControl"):
782
                        {
783
                            (InnerItem.DrawingData as MarkupToPDF.Controls.Line.ArrowArcControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
784
                        }
785
                        break;
786
                    case ("ArrowControl_Multi"):
787
                        {
788
                            (InnerItem.DrawingData as MarkupToPDF.Controls.Line.ArrowControl_Multi).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
789
                        }
790
                        break;
791
                    case ("CloudControl"):
792
                        {
793
                            (InnerItem.DrawingData as MarkupToPDF.Controls.Polygon.CloudControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
794
                        }
795
                        break;
796
                    case ("PolygonControl"):
797
                        {
798
                            (InnerItem.DrawingData as MarkupToPDF.Controls.Polygon.PolygonControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
799
                        }
800
                        break;
801
                    case ("RectangleControl"):
802
                        {
803
                            (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.RectangleControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
804
                        }
805
                        break;
806
                    case ("RectCloudControl"):
807
                        {
808
                            (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.RectCloudControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
809
                        }
810
                        break;
811
                    case ("TriControl"):
812
                        {
813
                            (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.TriControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
814
                        }
815
                        break;
816
                    case ("CircleControl"):
817
                        {
818
                            (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.CircleControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
819
                        }
820
                        break;
821
                    case ("InsideWhiteControl"):
822
                        {
823
                            (InnerItem.DrawingData as MarkupToPDF.Controls.Cad.InsideWhiteControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
824
                        }
825
                        break;
826
                    case ("OverlapWhiteControl"):
827
                        {
828
                            (InnerItem.DrawingData as MarkupToPDF.Controls.Cad.OverlapWhiteControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
829
                        }
830
                        break;
831
                    case ("ClipWhiteControl"):
832
                        {
833
                            (InnerItem.DrawingData as MarkupToPDF.Controls.Cad.ClipWhiteControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
834
                        }
835
                        break;
836
                    case ("CoordinateControl"):
837
                        {
838
                            (InnerItem.DrawingData as MarkupToPDF.Controls.Cad.CoordinateControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
839
                        }
840
                        break;
841
                }
842
            }
843
            ViewerDataModel.Instance.IsMarkupUpdate = true;
844
            #endregion
845
        }
846

    
847
        /// <summary>
848
        /// 굵기 속성 변경
849
        /// </summary>
850
        /// <param name="sender"></param>
851
        /// <param name="e"></param>
852
        private void btnBold_Checked(object sender, RoutedEventArgs e)
853
        {
854
            var AdonerList = GetAdornerItems();
855
            if (!AdonerList.Any()) return;
856

    
857
            UndoCommand.Instance.Push(EventType.Operation, AdonerList.ConvertAll(x => x.DrawingData as CommentUserInfo));
858

    
859
            #region 속성 변경
860
            foreach (AdornerMember InnerItem in AdonerList)
861
            {
862
                var element = InnerItem.DrawingData;
863
                if (element is MarkupToPDF.Controls.Text.ArrowTextControl ArrowTextCtrl)
864
                {
865
                    if (ArrowTextCtrl.TextWeight == FontWeights.Bold)
866
                    {
867
                        ArrowTextCtrl.TextWeight = FontWeights.Normal;
868
                    }
869
                    else
870
                    {
871
                        ArrowTextCtrl.TextWeight = FontWeights.Bold;
872
                    }
873
                }
874
                else if (element is MarkupToPDF.Controls.Text.TextControl TextCtrl)
875
                {
876
                    if (TextCtrl.TextWeight == FontWeights.Bold)
877
                    {
878
                        TextCtrl.TextWeight = FontWeights.Normal;
879
                    }
880
                    else
881
                    {
882
                        TextCtrl.TextWeight = FontWeights.Bold;
883
                    }
884
                }
885
            }
886

    
887
            ViewerDataModel.Instance.IsMarkupUpdate = true;
888
            #endregion
889
        }
890

    
891
        /// <summary>
892
        /// 이탤릭 속성 변경
893
        /// </summary>
894
        /// <param name="sender"></param>
895
        /// <param name="e"></param>
896
        private void btnItalic_Checked(object sender, RoutedEventArgs e)
897
        {
898
            var AdonerList = GetAdornerItems();
899
            if (!AdonerList.Any()) return;
900

    
901
            UndoCommand.Instance.Push(EventType.Operation, AdonerList.ConvertAll(x => x.DrawingData as CommentUserInfo));
902

    
903
            #region 속성 변경
904
            foreach (AdornerMember InnerItem in AdonerList)
905
            {
906
                var element = InnerItem.DrawingData;
907
                if (element is MarkupToPDF.Controls.Text.ArrowTextControl ArrowTextCtrl)
908
                {
909
                    if (ArrowTextCtrl.TextStyle == FontStyles.Italic)
910
                    {
911
                        ArrowTextCtrl.TextStyle = System.Windows.FontStyles.Normal;
912
                    }
913
                    else
914
                    {
915
                        ArrowTextCtrl.TextStyle = FontStyles.Italic;
916
                    }
917
                }
918
                else if (element is MarkupToPDF.Controls.Text.TextControl TextCtrl)
919
                {
920
                    if (TextCtrl.TextStyle == FontStyles.Italic)
921
                    {
922
                        TextCtrl.TextStyle = System.Windows.FontStyles.Normal;
923
                    }
924
                    else
925
                    {
926
                        TextCtrl.TextStyle = FontStyles.Italic;
927
                    }
928
                }
929
            }
930
            ViewerDataModel.Instance.IsMarkupUpdate = true;
931
            #endregion
932
        }
933

    
934
        /// <summary>
935
        /// 밑줄 변경
936
        /// </summary>
937
        /// <param name="sender"></param>
938
        /// <param name="e"></param>
939
        private void btnUnderLine_Checked(object sender, RoutedEventArgs e)
940
        {
941
            var AdonerList = GetAdornerItems();
942
            if (!AdonerList.Any()) return;
943

    
944
            UndoCommand.Instance.Push(EventType.Operation, AdonerList.ConvertAll(x => x.DrawingData as CommentUserInfo));
945

    
946
            #region 속성 변경
947
            foreach (AdornerMember InnerItem in AdonerList)
948
            {
949
                var element = InnerItem.DrawingData;
950
                if (element is MarkupToPDF.Controls.Text.ArrowTextControl ArrowTextCtrl)
951
                {
952
                    if (ArrowTextCtrl.UnderLine != null && ArrowTextCtrl.UnderLine == TextDecorations.Underline)
953
                    {
954
                        ArrowTextCtrl.UnderLine = null;
955
                    }
956
                    else
957
                    {
958
                        ArrowTextCtrl.UnderLine = TextDecorations.Underline;
959
                    }
960
                }
961
                else if (element is MarkupToPDF.Controls.Text.TextControl TextCtrl)
962
                {
963
                    if (TextCtrl.UnderLine != null && TextCtrl.UnderLine == TextDecorations.Underline)
964
                    {
965
                        TextCtrl.UnderLine = null;
966
                    }
967
                    else
968
                    {
969
                        TextCtrl.UnderLine = TextDecorations.Underline;
970
                    }
971
                }
972
            }
973
            ViewerDataModel.Instance.IsMarkupUpdate = true;
974
            #endregion
975
        }
976

    
977
        private void cbLineSize_PreviewKeyDown(object sender, System.Windows.Input.KeyEventArgs e)
978
        {
979
            if (e.Key == Key.Space || e.Key == Key.ImeProcessed)
980
            {
981
                e.Handled = true;
982
            }
983

    
984
        }
985

    
986
        private void cbLineSize_PreviewTextInput(object sender, System.Windows.Input.TextCompositionEventArgs e)
987
        {
988
            var regex = new Regex(@"[^a-zA-Z0-9\s]");
989
            if (regex.IsMatch(e.Text))
990
            {
991
                e.Handled = true;
992
            }
993

    
994
        }
995

    
996
        private void cbArcLength_PreviewKeyDown(object sender, System.Windows.Input.KeyEventArgs e)
997
        {
998
            if (e.Key == Key.Space || e.Key == Key.ImeProcessed)
999
            {
1000
                e.Handled = true;
1001
            }
1002
        }
1003

    
1004
        private void cbArcLength_PreviewTextInput(object sender, System.Windows.Input.TextCompositionEventArgs e)
1005
        {
1006
            var regex = new Regex(@"[^a-zA-Z0-9\s]");
1007
            if (regex.IsMatch(e.Text))
1008
            {
1009
                e.Handled = true;
1010
            }
1011
        }
1012

    
1013
        private void comboFontSize_PreviewKeyDown(object sender, System.Windows.Input.KeyEventArgs e)
1014
        {
1015
            if (e.Key == Key.Space || e.Key == Key.ImeProcessed)
1016
            {
1017
                e.Handled = true;
1018
            }
1019
        }
1020

    
1021
        private void cbIntervalSize_PreviewKeyDown(object sender, System.Windows.Input.KeyEventArgs e)
1022
        {
1023
            if (e.Key == Key.Space || e.Key == Key.ImeProcessed)
1024
            {
1025
                e.Handled = true;
1026
            }
1027
        }
1028

    
1029
        private void cbIntervalSize_PreviewTextInput(object sender, System.Windows.Input.TextCompositionEventArgs e)
1030
        {
1031
            var regex = new Regex(@"[^a-zA-Z0-9\s]");
1032
            if (regex.IsMatch(e.Text))
1033
            {
1034
                e.Handled = true;
1035
            }
1036
        }
1037

    
1038
        private void comboFontSize_PreviewTextInput(object sender, System.Windows.Input.TextCompositionEventArgs e)
1039
        {
1040
            var regex = new Regex(@"[^a-zA-Z0-9\s]");
1041
            if (regex.IsMatch(e.Text))
1042
            {
1043
                e.Handled = true;
1044
            }
1045
        }
1046

    
1047
        /// <summary>
1048
        /// 폰트 크기 변경
1049
        /// </summary>
1050
        /// <param name="sender"></param>
1051
        /// <param name="e"></param>
1052
        private void comboFontSize_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
1053
        {
1054
            if (string.IsNullOrEmpty(comboFontSize.Value.ToString()))
1055
            {
1056
                comboFontSize.Value = comboFontSize.Minimum;
1057
            }
1058

    
1059
            var AdonerList = GetAdornerItems();
1060
            if (!AdonerList.Any()) return;
1061
            UndoCommand.Instance.Push(EventType.Operation, AdonerList.ConvertAll(x => x.DrawingData as CommentUserInfo));
1062

    
1063
            #region 속성 변경
1064
            foreach (AdornerMember InnerItem in AdonerList)
1065
            {
1066
                switch (InnerItem.DrawingData.GetType().Name)
1067
                {
1068
                    case ("TextControl"):
1069
                        {
1070
                            (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextSize = int.Parse(comboFontSize.Value.ToString());
1071
                        }
1072
                        break;
1073
                    case ("ArrowTextControl"):
1074
                        {
1075
                            (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextSize = int.Parse(comboFontSize.Value.ToString());
1076
                        }
1077
                        break;
1078
                }
1079
            }
1080
            ViewerDataModel.Instance.IsMarkupUpdate = true;
1081
            #endregion
1082

    
1083
            KCOM.Properties.Settings.Default.TextSize = (double)comboFontSize.Value;
1084
            Properties.Settings.Default.Save();
1085
        }
1086

    
1087
        /// <summary>
1088
        /// 폰트 패밀리 변경
1089
        /// </summary>
1090
        /// <param name="sender"></param>
1091
        /// <param name="e"></param>
1092
        private void comboFontFamily_SelectionChanged(object sender, SelectionChangedEventArgs e)
1093
        {
1094
            if (comboFontFamily.SelectedItem != null && !IsSuspendChange)
1095
            {
1096
                var AdonerList = GetAdornerItems();
1097
                if (!AdonerList.Any()) return;
1098

    
1099
                UndoCommand.Instance.Push(EventType.Operation, AdonerList.ConvertAll(x => x.DrawingData as CommentUserInfo));
1100

    
1101
                #region 속성 변경
1102
                var font = comboFontFamily.SelectedItem as Markus.Fonts.MarkusFont;
1103
                foreach (AdornerMember InnerItem in AdonerList)
1104
                {
1105
                    var element = InnerItem.DrawingData;
1106
                    if (element is MarkupToPDF.Controls.Text.ArrowTextControl ctrl1)
1107
                    {
1108
                        ViewerDataModel.Instance.IsMarkupUpdate = true;
1109
                        ctrl1.SetFontFamily(font.FontFamily);
1110
                    }
1111
                    else if (element is MarkupToPDF.Controls.Text.TextControl ctrl2)
1112
                    {
1113
                        ViewerDataModel.Instance.IsMarkupUpdate = true;
1114
                        ctrl2.SetFontFamily(font.FontFamily);
1115
                    }
1116
                }
1117
                ViewerDataModel.Instance.IsMarkupUpdate = true;
1118
                #endregion
1119

    
1120
                KCOM.Properties.Settings.Default.FontFamily = font.FontFamily.FontName();
1121
                Properties.Settings.Default.Save();
1122
            }
1123
        }
1124

    
1125
        /// <summary>
1126
        /// 텍스트 컨트롤 하일라이트 처리
1127
        /// </summary>
1128
        /// <param name="sender"></param>
1129
        /// <param name="e"></param>
1130
        private void HighlightEvent(object sender, RoutedEventArgs e)
1131
        {
1132

    
1133
            ViewerDataModel.Instance.checkHighShape = (sender as CheckBox).IsChecked.Value;
1134
            SetHighlightEvent();
1135
            //if ((sender as CheckBox).IsChecked.Value)
1136
            //{
1137
            //    TaskMessage("HighLight가 설정되었습니다", TaskMessageType.Normal);
1138
            //}
1139
            //else
1140
            //{
1141
            //    TaskMessage("HighLight가 해제되었습니다", TaskMessageType.Caption);
1142
            //}
1143
            //if (ViewerDataModel.Instance.SelectedEditor as MarkupToPDF.Controls.Text.TextControl != null)
1144
            //{
1145
            //    MarkupToPDF.Controls.Text.TextControl instance = (ViewerDataModel.Instance.SelectedEditor as MarkupToPDF.Controls.Text.TextControl);
1146
            //    instance.IsHighLight = ViewerDataModel.Instance.checkHighShape;
1147
            //    instance.SetText();
1148
            //}
1149
        }
1150

    
1151
        //추가페이지 이동 엔터
1152
        private void tlcurrentPage_KeyDown(object sender, KeyEventArgs e)
1153
        {
1154
            //강인구 추가 tlcurrentPage을 이상하게 입력할수 있기때문에 Try Catch
1155
            if (e.Key == Key.Enter)
1156
            {
1157
                try
1158
                {
1159
                    var instanceMain = this.ParentOfType<MainWindow>();
1160
                    var max = instanceMain.dzMainMenu.pageNavigator._thumbnailItems.Max(f => f.PageNumber);
1161
                    if (string.IsNullOrEmpty(tlcurrentPage.Text))
1162
                    {
1163
                        RadWindow.Alert(new DialogParameters
1164
                        {
1165
                            Owner = Application.Current.MainWindow,
1166
                            Theme = new VisualStudio2013Theme(),
1167
                            Header = "Info",
1168
                            Content = "Enter the correct page number.",
1169
                        });
1170
                    }
1171
                    else
1172
                    {
1173
                        if (Convert.ToInt32(tlcurrentPage.Text) > max || Convert.ToInt32(tlcurrentPage.Text) == 0)
1174
                        {
1175
                            RadWindow.Alert(new DialogParameters
1176
                            {
1177
                                Owner = Application.Current.MainWindow,
1178
                                Theme = new VisualStudio2013Theme(),
1179
                                Header = "Info",
1180
                                Content = "Enter the correct page number.",
1181
                            });
1182
                        }
1183
                        else
1184
                        {
1185
                            instanceMain.dzMainMenu.pageNavigator.GotoPage(Convert.ToInt32(tlcurrentPage.Text));
1186
                        }
1187
                    }
1188
                    
1189
                }
1190
                catch (Exception)
1191
                {
1192
                    RadWindow.Alert(new DialogParameters
1193
                    {
1194
                        Owner = Application.Current.MainWindow,
1195
                        Theme = new VisualStudio2013Theme(),
1196
                        Header = "Info",
1197
                        Content = "Enter the correct page number.",
1198
                    });
1199
                }
1200
                
1201
            }
1202
        }
1203
        private string previousText;
1204
        private void TlcurrentPage_PreviewTextInput(object sender, TextCompositionEventArgs e)
1205
        {
1206
            System.Text.RegularExpressions.Regex regex = new System.Text.RegularExpressions.Regex("[^0-9]+");
1207
            e.Handled = regex.IsMatch(e.Text);
1208
        }
1209
        private void TlcurrentPage_TextChanged(object sender, TextChangedEventArgs e)
1210
        {
1211
            double num = 0;
1212
            bool success = double.TryParse(((TextBox)sender).Text, out num);
1213
            if (success & num >= 0)
1214
                previousText = ((TextBox)sender).Text;
1215
            else
1216
            {
1217
                if (string.IsNullOrEmpty(((TextBox)sender).Text))
1218
                {
1219
                    ((TextBox)sender).Text = "";
1220
                }
1221
                else
1222
                {
1223

    
1224
                    ((TextBox)sender).Text = previousText;
1225
                }
1226
            }
1227
        }
1228

    
1229
        /// <summary>
1230
        /// 입력한 페이지로 이동한다
1231
        /// </summary>
1232
        /// <param name="sender"></param>
1233
        /// <param name="e"></param>
1234
        private void tlcurrentPage_readonly_KeyDown(object sender, KeyEventArgs e)
1235
        {
1236
            if (e.Key == Key.Enter)
1237
            {
1238
                try
1239
                {
1240
                    var instanceMain = this.ParentOfType<MainWindow>();
1241
                    instanceMain.dzMainMenu.pageNavigator.GotoPage(Convert.ToInt32(tlcurrentPage_readonly.Text));
1242
                }
1243
                catch (Exception)
1244
                {
1245
                    RadWindow.Alert(new DialogParameters
1246
                    {
1247
                        Owner = Application.Current.MainWindow,
1248
                        Theme = new VisualStudio2013Theme(),
1249
                        Header = "Info",
1250
                        Content = "Enter the correct page number.",
1251
                    });
1252
                }
1253
            }
1254
        }
1255
        
1256
        private void PanoramaEvent(object sender, RoutedEventArgs e)
1257
        {
1258
            PanoramaShow();
1259
        }
1260

    
1261
        public void PanoramaShow()
1262
        {
1263
            Panorama check = new Panorama();
1264
            double screenWidth = System.Windows.SystemParameters.PrimaryScreenWidth;
1265
            double screenHeight = System.Windows.SystemParameters.PrimaryScreenHeight;
1266
            //double windowWidth = this.Width;
1267
            //double windowHeight = this.Height;
1268

    
1269
            var PanoramaPop = new RadWindow
1270
            {
1271
                //MinWidth = 600,
1272
                //MinHeight = 400,
1273
                //Header = "My Check List",
1274
                Header = "Document No : " + this.ParentOfType<MainWindow>().dzMainMenu._DocItem.DOCUMENT_NO + " / Revision :" + this.ParentOfType<MainWindow>().dzMainMenu._DocItem.REVISION,
1275
                Content = check,
1276
                Owner = this,
1277
                ResizeMode = System.Windows.ResizeMode.CanResizeWithGrip,
1278
                //ResizeMode = System.Windows.ResizeMode.NoResize,
1279
                WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen,
1280
                IsTopmost = false,
1281
                //Left = (screenWidth / 2) - (windowWidth / 2),
1282
                //Top = (screenHeight / 2) - (windowHeight / 2),
1283
                //Left = (screenWidth / 2),
1284
                //Top = (screenHeight / 2),
1285
                Width = screenWidth * 0.4,
1286
                Height = screenHeight * 0.4,
1287
            };
1288
            StyleManager.SetTheme(PanoramaPop, new VisualStudio2013Theme());
1289
            //CheckPop.ShowDialog();
1290
            PanoramaPop.Owner = Application.Current.MainWindow;
1291
            PanoramaPop.Show();
1292
        }
1293

    
1294
        private void CheckEvent(object sender, RoutedEventArgs e)
1295
        {
1296
            //창이 떠있을 경우 재 실행 방지
1297
            if (isClosed)
1298
            {
1299
                //토글 및 마우스 상태 초기화
1300
                var toggleList = this.Parent.ChildrenOfType<RadToggleButton>();
1301
                foreach(var togle in toggleList)
1302
                {
1303
                    togle.IsChecked = false;
1304
                }
1305
                this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
1306

    
1307
                isClosed = false;
1308

    
1309
                
1310
                CheckList check = new CheckList(this.ParentOfType<MainWindow>());
1311

    
1312
                var CheckPop = new RadWindow
1313
                {
1314
                    MinWidth = 1200,
1315
                    MinHeight = 500,
1316
                    //Header = "My Check List",
1317
                    Header = "Document No : " + this.ParentOfType<MainWindow>().dzMainMenu._DocItem.DOCUMENT_NO + " / Revision :" + this.ParentOfType<MainWindow>().dzMainMenu._DocItem.REVISION,
1318
                    Content = check,
1319
                    //Owner = this,
1320
                    //ResizeMode = System.Windows.ResizeMode.CanResizeWithGrip,
1321
                    ResizeMode = System.Windows.ResizeMode.NoResize,
1322
                    WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen,
1323
                    IsTopmost = true,
1324
                };
1325
                StyleManager.SetTheme(CheckPop, new Office2013Theme());
1326
                CheckPop.Closed += CheckPop_Closed;
1327
                
1328
                //CheckPop.ShowDialog();
1329
                CheckPop.Show();
1330
            }
1331
        }
1332

    
1333
        private void SignManagerEvent(object sender, RoutedEventArgs e)
1334
        {
1335
            OpenSignManager();
1336
        }
1337

    
1338
        private void OpenSignManager()
1339
        { 
1340
            SignManager signManager = new SignManager();
1341

    
1342
            RadWindow signManagerPop = new RadWindow
1343
            {
1344
                Width = 1000,
1345
                Height = 500,
1346
                //Header = "My Check List",
1347
                Header = "",
1348
                Content = signManager,
1349
                Owner = this,
1350
                //ResizeMode = System.Windows.ResizeMode.CanResizeWithGrip,
1351
                ResizeMode = System.Windows.ResizeMode.CanResize,
1352
                WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen,
1353
                CanClose =true
1354
            };
1355
            StyleManager.SetTheme(signManagerPop, new Office2013Theme());
1356

    
1357
            //CheckPop.ShowDialog();
1358
            signManagerPop.ShowDialog();
1359
        }
1360

    
1361
        private void CheckPop_Closed(object sender, WindowClosedEventArgs e)
1362
        {
1363
            isClosed = true;
1364
            //this.ParentOfType<MainWindow>().dzMainMenu.PN_Navi.IsEnabled = true;
1365
            this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
1366
            ViewerDataModel.Instance.Capture_Opacity = 0;
1367
        }
1368

    
1369
        /// <summary>
1370
        /// 사용자가 선택한 페이지로 이동(썸네일 동기화 시킴)
1371
        /// </summary>
1372
        /// <param name="sender"></param>
1373
        /// <param name="e"></param>
1374
        private void PageGoEvent(object sender, RoutedEventArgs e)
1375
        {
1376
            RadButton button = sender as RadButton;
1377
            var instanceMain = this.ParentOfType<MainWindow>();
1378
            
1379
            //강인구 추가 tlcurrentPage을 이상하게 입력할수 있기때문에 Try Catch
1380
            try
1381
            {
1382
                switch (button.CommandParameter.ToString())
1383
                {
1384
                    case "Down":
1385
                        {
1386
                            instanceMain.dzMainMenu.pageNavigator.GotoPage(Convert.ToInt32(tlcurrentPage.Text) + 1);
1387
                        }
1388
                        break;
1389
                    case "Up":
1390
                        {
1391
                            instanceMain.dzMainMenu.pageNavigator.GotoPage(Convert.ToInt32(tlcurrentPage.Text) - 1);
1392
                        }
1393
                        break;
1394
                }
1395
            }
1396
            catch (Exception)
1397
            {
1398
                RadWindow.Alert(new DialogParameters
1399
                {
1400
                    Owner = Application.Current.MainWindow,
1401
                    Theme = new VisualStudio2013Theme(),
1402
                    Header = "Info",
1403
                    Content = "Enter the correct page number.",
1404
                });
1405
            }
1406
        }
1407

    
1408
        private void viewEvent(object sender, RoutedEventArgs e)
1409
        {
1410
            RadRibbonToggleButton viewButton = sender as RadRibbonToggleButton;
1411
            var instanceMain = this.ParentOfType<MainWindow>();
1412

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

    
1415
            //if ((sender as RadRibbonToggleButton) != null)
1416
            //{
1417
            //    Common.ViewerDataModel.Instance.ControlTag = (sender as RadRibbonToggleButton).Tag.ToString();
1418
            //    instanceToggle = (sender as RadRibbonToggleButton);
1419
            //}
1420

    
1421
            //instanceToggle.IsChecked = false;
1422

    
1423
            switch (viewButton.CommandParameter.ToString())
1424
            {
1425
                case "zoomout":
1426
                    {
1427
                        //장원
1428
                        //instanceMain.dzMainMenu.zoomAndPanControl.ZoomTo(new Rect(0, 0, instanceMain.dzMainMenu.zoomAndPanCanvas.ActualWidth, instanceMain.dzMainMenu.zoomAndPanCanvas.ActualHeight));
1429
                        instanceMain.dzMainMenu.zoomAndPanControl.ZoomPointToViewportCenter(ViewerDataModel.Instance.ContentScale -= 0.1, point);
1430
                        viewButton.IsChecked = false;
1431
                        //Common.ViewerDataModel.Instance.zom
1432
                    }
1433
                    break;
1434
                case "zoomin":
1435
                    {
1436
                        instanceMain.dzMainMenu.zoomAndPanControl.ZoomPointToViewportCenter(ViewerDataModel.Instance.ContentScale += 0.1, point);
1437
                        viewButton.IsChecked = false;
1438
                    }
1439
                    break;             
1440
                case "fitWidth":
1441
                    {
1442
                        instanceMain.dzMainMenu.zoomAndPanControl.ScaleToFit();
1443
                        viewButton.IsChecked = false;
1444
                    }
1445
                    break;
1446
                case "fitHeight":
1447
                    {
1448
                        instanceMain.dzMainMenu.zoomAndPanControl.ScaleToFit();
1449
                        viewButton.IsChecked = false;
1450
                    }
1451
                    break;
1452
                case "boundzoom":
1453
                    {
1454

    
1455
                    }
1456
                    break;
1457
                case "Rotate_M":
1458
                    {
1459
                        drawingPannelRotate(false);
1460
                        viewButton.IsChecked = false;
1461
                    }
1462
                    break;
1463
                case "Rotate_P":
1464
                    {
1465
                        drawingPannelRotate(true);
1466
                        viewButton.IsChecked = false;
1467
                    }
1468
                    break;
1469
                case "Rotate_half":
1470
                    {
1471
                        drawingPannelRotate(true);
1472
                        drawingPannelRotate(true);
1473
                        viewButton.IsChecked = false;
1474
                    }
1475
                    break;
1476
                    //case "fullscreen":
1477
                    //    {
1478
                    //        instanceMain.WindowStyle = WindowStyle.None;
1479
                    //        instanceMain.WindowState = WindowState.Maximized;
1480
                    //        instanceMain.dzMainMenu.zoomAndPanControl.ScaleToFit();
1481
                    //        viewButton.IsChecked = false;
1482
                    //    }
1483
                    //    break;
1484
            }
1485
        }
1486

    
1487
        private void Control_Event(object sender, RoutedEventArgs e)
1488
        {
1489

    
1490
        }
1491

    
1492
        #region 대기
1493

    
1494
        public void drawingPannelRotate(bool Flag)
1495
        {
1496
            var instanceMain = this.ParentOfType<MainWindow>();
1497

    
1498
            //if (rotateOffSet > 3)
1499
            //    rotateOffSet = 0;
1500

    
1501
            //if (rotateOffSet < 0)
1502
            //    rotateOffSet = 3;
1503

    
1504
            if(Flag)
1505
            {
1506
                if (instanceMain.dzMainMenu.rotate.Angle == 270)
1507
                {
1508
                    instanceMain.dzMainMenu.rotate.Angle = 0;
1509
                }
1510
                else
1511
                {
1512
                    instanceMain.dzMainMenu.rotate.Angle += 90;
1513
                }
1514
            }
1515
            else
1516
            {
1517
                if(instanceMain.dzMainMenu.rotate.Angle == 0)
1518
                {
1519
                    instanceMain.dzMainMenu.rotate.Angle = 270;
1520
                }
1521
                else
1522
                {
1523
                    instanceMain.dzMainMenu.rotate.Angle -= 90;
1524
                }
1525
            }
1526
            //instanceMain.dzMainMenu.rotate.Angle = angle;
1527
            //var rotationNum = Math.Abs((instanceMain.dzMainMenu.rotate.Angle / 90));
1528

    
1529
            if (instanceMain.dzMainMenu.zoomAndPanCanvas.Width == ViewerDataModel.Instance.ContentWidth)
1530
            {
1531
                double emptySize = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
1532
                instanceMain.dzMainMenu.zoomAndPanCanvas.Width = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
1533
                instanceMain.dzMainMenu.zoomAndPanCanvas.Height = emptySize;
1534
            }
1535

    
1536
            if (instanceMain.dzMainMenu.rotate.Angle == 0)
1537
            {
1538
                instanceMain.dzMainMenu.translate.X = 0;
1539
                instanceMain.dzMainMenu.translate.Y = 0;
1540
            }
1541
            else if (instanceMain.dzMainMenu.rotate.Angle == 90)
1542
            {
1543
                instanceMain.dzMainMenu.translate.X = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
1544
                instanceMain.dzMainMenu.translate.Y = 0;
1545
            }
1546
            else if (instanceMain.dzMainMenu.rotate.Angle == 180)
1547
            {
1548
                instanceMain.dzMainMenu.translate.X = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
1549
                instanceMain.dzMainMenu.translate.Y = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
1550
            }
1551
            else
1552
            {
1553
                instanceMain.dzMainMenu.translate.X = 0;
1554
                instanceMain.dzMainMenu.translate.Y = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
1555
            }
1556

    
1557
            //instanceMain.dzMainMenu.zoomAndPanControl.RenderTransformOrigin = new Point(0.5, 0.5);
1558
            instanceMain.dzMainMenu.zoomAndPanControl.RotationAngle = instanceMain.dzMainMenu.rotate.Angle;
1559
            //대기(강인구)
1560
            //instanceMain.dzMainMenu.imageViewer.RotateAngle = instanceMain.dzMainMenu.rotate.Angle;
1561

    
1562

    
1563
            //instanceMain.dzMainMenu.imageViewer.RenderTransformOrigin = new Point(0.5, 0.5);
1564
            //RotateTransform rotateTransform = new RotateTransform(instanceMain.dzMainMenu.rotate.Angle);
1565
            //instanceMain.dzMainMenu.imageViewer.RenderTransform = rotateTransform;
1566

    
1567

    
1568
            ViewerDataModel.Instance.ContentWidth = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
1569
            ViewerDataModel.Instance.ContentHeight = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
1570
            ViewerDataModel.Instance.AngleOffsetX = instanceMain.dzMainMenu.translate.X;
1571
            ViewerDataModel.Instance.AngleOffsetY = instanceMain.dzMainMenu.translate.Y;
1572
            ViewerDataModel.Instance.PageAngle = instanceMain.dzMainMenu.rotate.Angle;
1573
            //ViewerDataModel.Instance.Document_Info.Clear();
1574
            //ViewerDataModel.Instance.Document_Info.Where(i => i.PAGE_NUMBER == instanceMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber).ToList().ForEach(value =>
1575
            //{
1576
            //    value.PAGE_ANGLE = int.Parse(instanceMain.dzMainMenu.rotate.Angle.ToString());
1577
            //});
1578

    
1579

    
1580
            //이미지 각도 변경 시 실시간 Thumbnail 각도 변경(강인구 추가)
1581
            var thumbnaillist = instanceMain.dzMainMenu.pageNavigator._thumbnailItems.Where(info => info.PageNumber == instanceMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber);
1582

    
1583
            foreach (var data in thumbnaillist)
1584
            {
1585
                data.Angle = int.Parse(instanceMain.dzMainMenu.rotate.Angle.ToString());
1586

    
1587
                //instanceMain.dzMainMenu.pageNavigator.ImgListbox.ItemsSource = instanceMain.dzMainMenu.pageNavigator._thumbnailItems;
1588
                var instance = instanceMain.dzMainMenu.CurrentDoc.docInfo.DOCPAGE.Where(p => p.PAGE_NUMBER == instanceMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber).FirstOrDefault();
1589
                instance.PAGE_ANGLE = int.Parse(instanceMain.dzMainMenu.rotate.Angle.ToString());
1590

    
1591
                instanceMain.dzMainMenu.pageNavigator.GotoPage(data.PageNumber);
1592

    
1593
                //rotation page add or update
1594
                var rotationdoc = ViewerDataModel.Instance.RotationDocs.Where(d => d.ID == instance.ID).FirstOrDefault();
1595
                if (rotationdoc != null)
1596
                {
1597
                    rotationdoc.PAGE_ANGLE = instance.PAGE_ANGLE;
1598
                }
1599
                else
1600
                {
1601
                    ViewerDataModel.Instance.RotationDocs.Add(instance);
1602
                }
1603
            }
1604
        }
1605
        #endregion
1606

    
1607
        private void ImageConverter(RadToggleButton instanceToggle)
1608
        {
1609
            try
1610
            {           
1611
                var instanceMain = this.ParentOfType<MainWindow>();
1612

    
1613
                Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
1614
                dlg.Filter = "All files (*.*)|*.*|PNG Images (*.png)|*.png";
1615
                Nullable<bool> result = dlg.ShowDialog();
1616
                if (result == true)
1617
                {
1618
                    instanceMain.dzMainMenu.filename = dlg.FileName;
1619
                    instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ImgControl;
1620

    
1621
                    System.IO.FileInfo fileInfo = new System.IO.FileInfo(instanceMain.dzMainMenu.filename);
1622
                    String strFile = System.IO.Path.GetFileName(instanceMain.dzMainMenu.filename);
1623
                    long numByte = fileInfo.Length;
1624
                    double dLen = Convert.ToDouble(fileInfo.Length / 1000000);
1625
                    kr.co.devdoftech.cloud.FileUpload fileUploader = App.FileUploader;
1626
             
1627
                    if (dLen < 4)
1628
                    {
1629
                        System.IO.FileStream fStream = new System.IO.FileStream(instanceMain.dzMainMenu.filename, System.IO.FileMode.Open, System.IO.FileAccess.Read);
1630
                        System.IO.BinaryReader br = new System.IO.BinaryReader(fStream);
1631
                        byte[] data = br.ReadBytes((int)numByte);
1632
                        br.Close();
1633

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

    
1636
                        Check_Uri.UriCheck(filepath);
1637

    
1638
                        instanceMain.dzMainMenu.filename = filepath;
1639

    
1640
                        fStream.Close();
1641
                        fStream.Dispose();
1642
                    }
1643
                    else
1644
                    {
1645
                        this.ParentOfType<MainWindow>().DialogMessage_Alert("Available Memory less than 4 mega byte", "Alert");
1646
                    }
1647
                }
1648
                else
1649
                {
1650
                    instanceToggle.IsChecked = false;
1651
                    Common.ViewerDataModel.Instance.SelectedControl = "";
1652
                    Common.ViewerDataModel.Instance.ControlTag = null;
1653
                    this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
1654
                    this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
1655
                    this.ParentOfType<MainWindow>().DialogMessage_Alert("No Image selected.", "Alert");
1656
                }
1657
            }
1658
            catch(Exception ex)
1659
            {
1660
                instanceToggle.IsChecked = false;
1661
                Common.ViewerDataModel.Instance.SelectedControl = "";
1662
                Common.ViewerDataModel.Instance.ControlTag = null;
1663
                this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
1664
                this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
1665
                App.FileLogger.Error("Image Converter ",ex);
1666

    
1667
                this.ParentOfType<MainWindow>().DialogMessage_Alert(ex.Message, "Alert");
1668
            }
1669
        }
1670

    
1671
        private void Control_Init(RadToggleButton instanceToggle, object sender)
1672
        {
1673

    
1674
        }
1675

    
1676
        private void ControlEvent(object sender, RoutedEventArgs e)
1677
        {
1678
            RadToggleButton instanceToggle = sender as RadToggleButton;
1679
            var instanceMain = this.ParentOfType<MainWindow>();
1680

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

    
1701
            //if (!instanceMain.IsFreeSelectionMode)
1702
            //{
1703
            //    instanceMain.IsSwingMode = true;
1704
            //}
1705

    
1706
            //#region 다른 컨트롤 버튼 선택 해제
1707
            //System.Reactive.Linq.Observable2.FromPropertyChangedPattern(Common.ViewerDataModel.Instance, temp => temp.SelectedControl).Subscribe(ControlState =>
1708
            //{
1709
            //    if (ControlState == null)
1710
            //    {
1711
            //        instanceToggle.IsChecked = false;
1712
            //        HiddenControlHide();
1713
            //    }
1714
            //});
1715
            //#endregion
1716

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

    
1719
            if (instanceToggle != null)
1720
            {
1721
                Common.ViewerDataModel.Instance.ControlTag = instanceToggle.Tag.ToString();
1722
            }
1723
            else if ((sender as RadRibbonToggleButton) != null)
1724
            {
1725
                Common.ViewerDataModel.Instance.ControlTag = (sender as RadRibbonToggleButton).Tag.ToString();
1726
                instanceToggle = (sender as RadRibbonToggleButton);
1727
            }
1728
            else if ((sender as RadRibbonButton) != null)
1729
            {
1730
                RadRibbonButton instanceButton = sender as RadRibbonButton;
1731
                Common.ViewerDataModel.Instance.ControlTag = instanceButton.Tag.ToString();
1732
            }
1733
            else
1734
            {
1735
                RadButton instanceButton = sender as RadButton;
1736
                Common.ViewerDataModel.Instance.ControlTag = instanceButton.Tag.ToString();
1737
            }
1738

    
1739

    
1740
            //System.Reactive.Linq.Observable2.FromPropertyChangedPattern(Common.ViewerDataModel.Instance, temp => temp.AngleVisibility).Subscribe(isSee =>
1741
            //{
1742
            //    if (instanceToggle.CommandParameter.ToString() == "ChainLine")
1743
            //    {
1744

    
1745
            //    }
1746
            //    else
1747
            //    {
1748
            //        System.Diagnostics.Debug.WriteLine(" instanceMain.dzMainMenu.MainAngle.Visibility   " + isSee);
1749

    
1750
            //        if (instanceMain.dzMainMenu.MainAngle.Visibility != isSee)
1751
            //        {
1752
            //            instanceMain.dzMainMenu.MainAngle.Visibility = isSee;
1753
            //        }
1754
            //    }
1755
            //    //System.Reactive.Linq.Observable2.FromPropertyChangedPattern(Common.ViewerDataModel.Instance, temp => temp.AngleValue).Subscribe(p =>
1756
            //    //{
1757
            //    //    instanceMain.dzMainMenu.MainAngle.AngleValue = p;
1758
            //    //});
1759
            //});
1760

    
1761
            instanceMain.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Drawing;
1762

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

    
1765
            if (instanceToggle.IsChecked != false)
1766
            {
1767
                string param = instanceToggle.CommandParameter.ToString();
1768
                string MacroIndex = "";
1769

    
1770
                if (param.StartsWith("MACRO"))
1771
                {
1772
                    param = "MACRO";
1773
                    MacroIndex = param.Replace("MACRO;","");
1774

    
1775
                    //Common.ViewerDataModel.Instance.MacroItems = MacroHelper.LoadMacroItems(MacroIndex);
1776
                    //var items = MacroHelper.TopMenuItems();
1777

    
1778
                    Common.ViewerDataModel.Instance.MacroItems = new List<MacroItem>
1779
                    {
1780
                        new MacroItem
1781
                        {
1782
                            Desc = "Cloud Rectangle",
1783
                            ControlType = MarkupToPDF.Controls.Common.ControlType.RectCloud
1784
                        },
1785
                        new MacroItem
1786
                        {
1787
                             Desc = "Arrow TextBox",
1788
                            ControlType = MarkupToPDF.Controls.Common.ControlType.ArrowTextBorderControl
1789
                        }
1790
                    };
1791
                }
1792

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

    
2016
                        //instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = true;
2017

    
2018
                        Common.ViewerDataModel.Instance.SelectedControl = "Ink";
2019
                        Common.ViewerDataModel.Instance.LineSize = (double)cbLineSize.Value;
2020
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.PenControl;
2021
                        break;
2022
                    #endregion
2023
                    #region Select
2024
                    case "Select":
2025
                        if (this.ParentOfType<MainWindow>().dzMainMenu.currentControl != null)
2026
                        {
2027
                            if (this.ParentOfType<MainWindow>().dzMainMenu.currentControl is MarkupToPDF.Controls.Text.TextControl
2028
                                && !string.IsNullOrEmpty(((MarkupToPDF.Controls.Text.TextControl)this.ParentOfType<MainWindow>().dzMainMenu.currentControl).Text))
2029
                            {
2030
                                DependencyObject focusScope1 = FocusManager.GetFocusScope((MarkupToPDF.Controls.Text.TextControl)this.ParentOfType<MainWindow>().dzMainMenu.currentControl);
2031
                                FocusManager.SetFocusedElement(focusScope1, (MarkupToPDF.Controls.Text.TextControl)this.ParentOfType<MainWindow>().dzMainMenu.currentControl);
2032

    
2033
                                this.ParentOfType<MainWindow>().dzMainMenu.currentControl = null;
2034
                                Keyboard.ClearFocus();
2035

    
2036
                            }
2037
                            else
2038
                            {
2039
                                ViewerDataModel.Instance.MarkupControls_USER.Remove(this.ParentOfType<MainWindow>().dzMainMenu.currentControl);
2040
                                this.ParentOfType<MainWindow>().dzMainMenu.currentControl = null;
2041
                            }
2042
                        }
2043

    
2044
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Selecting;
2045
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2046
                        instanceMain.dzMainMenu.isLeftMouseButtonDownOnWindow = false;
2047
                        break;
2048
                    #endregion
2049
                    #region Image
2050
                    case "Image":
2051
                        Common.ViewerDataModel.Instance.SelectedControl = "ImgControl";
2052
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ImgControl;
2053
                        ImageConverter(instanceToggle);
2054
                        break;
2055
                    #endregion
2056
                    #region Sign
2057
                    case "Sign":
2058
                        Common.ViewerDataModel.Instance.SelectedControl = "Sign";
2059
                        Common.ViewerDataModel.Instance.ControlTag = instanceMain.dzMainMenu._ViewInfo.UserID; //사번
2060
                        //강인구 추가
2061
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Sign;
2062
                        //instanceMain.BaseClient.GetUserSignCompleted += (sen, ea) =>
2063
                        //{
2064
                        //    if (ea.Result == null)
2065
                        //    {
2066

    
2067
                        //        this.ParentOfType<MainPage>().DialogMessage_Alert("You Don't Have Sign Data", "Alert");
2068
                        //    }
2069
                        //    else
2070
                        //    {
2071
                        //        byte[] imageBytes = System.Convert.FromBase64String(ea.Result);
2072
                        //        using (MemoryStream ms = new MemoryStream(imageBytes))
2073
                        //        {
2074
                        //            BitmapImage im = new BitmapImage();
2075
                        //            im.SetSource(ms);
2076
                        //            instanceMain.DeepLayer.SignImage = im;
2077
                        //            ms.Close();
2078
                        //        }
2079
                        //    }
2080
                        //};
2081
                        //instanceMain.BaseClient.GetUserSignAsync(instanceMain._ViewInfo.UserID);
2082
                        break;
2083
                    #endregion
2084
                    #region Check
2085
                    case "Check":
2086
                        Common.ViewerDataModel.Instance.SelectedControl = "Check";
2087
                        Common.ViewerDataModel.Instance.ControlTag = instanceMain.dzMainMenu._ViewInfo.UserID; //사번
2088
                        //강인구 추가
2089
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Symbol;
2090
                        break;
2091
                    #endregion
2092
                    #region Batch
2093
                    case "Batch":
2094
                        Common.ViewerDataModel.Instance.SelectedControl = "Batch";
2095
                        Common.ViewerDataModel.Instance.ControlTag = instanceMain.dzMainMenu._ViewInfo.UserID; //사번
2096
                        //강인구 추가
2097
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Mark;
2098
                        instanceMain.dzMainMenu.txtBatch.Visibility = Visibility.Visible;
2099
                        instanceMain.dzMainMenu.txtBatch.Text = "Place Mark";
2100
                        break;
2101
                    #endregion
2102

    
2103
                    #region MACRO -MACRO1
2104
                    case "MACRO":
2105
                        Common.ViewerDataModel.Instance.SelectedControl = "MACRO";
2106
                        Common.ViewerDataModel.Instance.ControlTag = instanceMain.dzMainMenu._ViewInfo.UserID; //사번
2107

    
2108
                        MacroHelper.MacroAction();
2109

    
2110
                        break;
2111
                    #endregion
2112

    
2113
                    #region Copy
2114
                    case "Copy":
2115
                        CopyCommand.Instance.Execute();
2116
                        //Copy_Start();
2117
                        instanceToggle.IsChecked = false;
2118
                        ViewerDataModel.Instance.SelectedControl = "";
2119
                        ViewerDataModel.Instance.ControlTag = null;
2120
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2121
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2122
                        break;
2123
                    #endregion
2124
                    #region Cut
2125
                    case "Cut":
2126
                        CutCommand.Instance.Execute();
2127
                        instanceToggle.IsChecked = false;
2128
                        ViewerDataModel.Instance.SelectedControl = "";
2129
                        ViewerDataModel.Instance.ControlTag = null;
2130
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2131
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2132
                        break;
2133
                    #endregion
2134
                    #region Paste
2135
                    case "Paste":
2136
                        PasteCommand.Instance.Execute();
2137
                        //Paste_Start();
2138
                        instanceToggle.IsChecked = false;
2139
                        ViewerDataModel.Instance.SelectedControl = "";
2140
                        ViewerDataModel.Instance.ControlTag = null;
2141
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2142
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;                        
2143
                        break;
2144
                    #endregion
2145
                    #region Delete
2146
                    case "Delete":
2147
                        UndoCommand.Instance.Push(EventType.Delete, SelectionSet.Instance.SelectedItems);
2148
                        this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Clear();
2149

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

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

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

    
2275

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

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

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

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

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

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

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

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

    
2393
                        //    check.Closed += Check_Closed;
2394

    
2395
                        //}
2396
                        break;
2397
                    #endregion
2398
                    default:
2399
                        break;
2400
                }
2401
                #endregion
2402
            }
2403
            else
2404
            {
2405
                if (Common.ViewerDataModel.Instance.IsMacroCommand)
2406
                {
2407
                    MacroHelper.Clear();
2408
                }
2409

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

    
2420
        }
2421

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

    
2443
        }
2444

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

    
2459
        }
2460

    
2461
        /* public class test 
2462
         {
2463
             public double width { get; set; }
2464
             public double height { get; set; }
2465
         }
2466
         */
2467

    
2468
        private double minHeight;
2469
        private double minWidth;
2470

    
2471
        private double maxHeight;
2472
        private double maxWidth;
2473

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
2664
                        {
2665
                            if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
2666
                            {
2667
                                MarkupToPDF.Controls.Parsing.MarkupParser.MarkupReturn res = MarkupParser.MarkupToString(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo, App.ViewInfo.UserID);
2668
                                id = (InnerItem.Symbol_ID != null) ? "|SymbolID|" + InnerItem.Symbol_ID : "";
2669
                                MarkupData += "|OR|" + res.ConvertData + id;
2670
                            }
2671
                        }
2672

    
2673
                        this.Dispatcher.Invoke(() =>
2674
                        {
2675
                            Clipboard.SetData(DataFormats.StringFormat, MarkupData);
2676
                        }, DispatcherPriority.Background);
2677
                    }
2678
                }
2679
            }
2680
        }
2681
    }
2682
}
클립보드 이미지 추가 (최대 크기: 500 MB)