프로젝트

일반

사용자정보

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

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

이력 | 보기 | 이력해설 | 다운로드 (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(Flag)
1499
            {
1500
                if (instanceMain.dzMainMenu.rotate.Angle == 270)
1501
                {
1502
                    instanceMain.dzMainMenu.rotate.Angle = 0;
1503
                }
1504
                else
1505
                {
1506
                    instanceMain.dzMainMenu.rotate.Angle += 90;
1507
                }
1508
            }
1509
            else
1510
            {
1511
                if(instanceMain.dzMainMenu.rotate.Angle == 0)
1512
                {
1513
                    instanceMain.dzMainMenu.rotate.Angle = 270;
1514
                }
1515
                else
1516
                {
1517
                    instanceMain.dzMainMenu.rotate.Angle -= 90;
1518
                }
1519
            }
1520
            //instanceMain.dzMainMenu.rotate.Angle = angle;
1521
            //var rotationNum = Math.Abs((instanceMain.dzMainMenu.rotate.Angle / 90));
1522

    
1523
            if (instanceMain.dzMainMenu.zoomAndPanCanvas.Width == ViewerDataModel.Instance.ContentWidth)
1524
            {
1525
                double emptySize = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
1526
                instanceMain.dzMainMenu.zoomAndPanCanvas.Width = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
1527
                instanceMain.dzMainMenu.zoomAndPanCanvas.Height = emptySize;
1528
            }
1529

    
1530
            if (instanceMain.dzMainMenu.rotate.Angle == 0)
1531
            {
1532
                instanceMain.dzMainMenu.translate.X = 0;
1533
                instanceMain.dzMainMenu.translate.Y = 0;
1534
            }
1535
            else if (instanceMain.dzMainMenu.rotate.Angle == 90)
1536
            {
1537
                instanceMain.dzMainMenu.translate.X = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
1538
                instanceMain.dzMainMenu.translate.Y = 0;
1539
            }
1540
            else if (instanceMain.dzMainMenu.rotate.Angle == 180)
1541
            {
1542
                instanceMain.dzMainMenu.translate.X = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
1543
                instanceMain.dzMainMenu.translate.Y = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
1544
            }
1545
            else
1546
            {
1547
                instanceMain.dzMainMenu.translate.X = 0;
1548
                instanceMain.dzMainMenu.translate.Y = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
1549
            }
1550

    
1551
            //instanceMain.dzMainMenu.zoomAndPanControl.RenderTransformOrigin = new Point(0.5, 0.5);
1552
            instanceMain.dzMainMenu.zoomAndPanControl.RotationAngle = instanceMain.dzMainMenu.rotate.Angle;
1553
            //대기(강인구)
1554
            //instanceMain.dzMainMenu.imageViewer.RotateAngle = instanceMain.dzMainMenu.rotate.Angle;
1555

    
1556

    
1557
            //instanceMain.dzMainMenu.imageViewer.RenderTransformOrigin = new Point(0.5, 0.5);
1558
            //RotateTransform rotateTransform = new RotateTransform(instanceMain.dzMainMenu.rotate.Angle);
1559
            //instanceMain.dzMainMenu.imageViewer.RenderTransform = rotateTransform;
1560

    
1561

    
1562
            ViewerDataModel.Instance.ContentWidth = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
1563
            ViewerDataModel.Instance.ContentHeight = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
1564
            ViewerDataModel.Instance.AngleOffsetX = instanceMain.dzMainMenu.translate.X;
1565
            ViewerDataModel.Instance.AngleOffsetY = instanceMain.dzMainMenu.translate.Y;
1566
            ViewerDataModel.Instance.PageAngle = instanceMain.dzMainMenu.rotate.Angle;
1567
            //ViewerDataModel.Instance.Document_Info.Clear();
1568
            //ViewerDataModel.Instance.Document_Info.Where(i => i.PAGE_NUMBER == instanceMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber).ToList().ForEach(value =>
1569
            //{
1570
            //    value.PAGE_ANGLE = int.Parse(instanceMain.dzMainMenu.rotate.Angle.ToString());
1571
            //});
1572

    
1573

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

    
1577
            foreach (var data in thumbnaillist)
1578
            {
1579
                data.Angle = int.Parse(instanceMain.dzMainMenu.rotate.Angle.ToString());
1580

    
1581
                //instanceMain.dzMainMenu.pageNavigator.ImgListbox.ItemsSource = instanceMain.dzMainMenu.pageNavigator._thumbnailItems;
1582
                var instance = instanceMain.dzMainMenu.CurrentDoc.docInfo.DOCPAGE.Where(p => p.PAGE_NUMBER == instanceMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber).FirstOrDefault();
1583
                instance.PAGE_ANGLE = int.Parse(instanceMain.dzMainMenu.rotate.Angle.ToString());
1584

    
1585
                instanceMain.dzMainMenu.pageNavigator.GotoPage(data.PageNumber);
1586

    
1587
                //rotation page add or update
1588
                var rotationdoc = ViewerDataModel.Instance.RotationDocs.Find(d => d.ID == instance.ID);
1589
                if (rotationdoc != null)
1590
                {
1591
                    rotationdoc.PAGE_ANGLE = instance.PAGE_ANGLE;
1592
                }
1593
                else
1594
                {
1595
                    ViewerDataModel.Instance.RotationDocs.Add(instance);
1596
                }
1597
            }
1598
        }
1599
        #endregion
1600

    
1601
        private void ImageConverter(RadToggleButton instanceToggle)
1602
        {
1603
            try
1604
            {           
1605
                var instanceMain = this.ParentOfType<MainWindow>();
1606

    
1607
                Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
1608
                dlg.Filter = "All files (*.*)|*.*|PNG Images (*.png)|*.png";
1609
                Nullable<bool> result = dlg.ShowDialog();
1610
                if (result == true)
1611
                {
1612
                    instanceMain.dzMainMenu.filename = dlg.FileName;
1613
                    instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ImgControl;
1614

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

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

    
1630
                        Check_Uri.UriCheck(filepath);
1631

    
1632
                        instanceMain.dzMainMenu.filename = filepath;
1633

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

    
1661
                this.ParentOfType<MainWindow>().DialogMessage_Alert(ex.Message, "Alert");
1662
            }
1663
        }
1664

    
1665
        private void Control_Init(RadToggleButton instanceToggle, object sender)
1666
        {
1667

    
1668
        }
1669

    
1670
        private void ControlEvent(object sender, RoutedEventArgs e)
1671
        {
1672
            RadToggleButton instanceToggle = sender as RadToggleButton;
1673
            var instanceMain = this.ParentOfType<MainWindow>();
1674

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

    
1695
            //if (!instanceMain.IsFreeSelectionMode)
1696
            //{
1697
            //    instanceMain.IsSwingMode = true;
1698
            //}
1699

    
1700
            //#region 다른 컨트롤 버튼 선택 해제
1701
            //System.Reactive.Linq.Observable2.FromPropertyChangedPattern(Common.ViewerDataModel.Instance, temp => temp.SelectedControl).Subscribe(ControlState =>
1702
            //{
1703
            //    if (ControlState == null)
1704
            //    {
1705
            //        instanceToggle.IsChecked = false;
1706
            //        HiddenControlHide();
1707
            //    }
1708
            //});
1709
            //#endregion
1710

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

    
1713
            if (instanceToggle != null)
1714
            {
1715
                Common.ViewerDataModel.Instance.ControlTag = instanceToggle.Tag.ToString();
1716
            }
1717
            else if ((sender as RadRibbonToggleButton) != null)
1718
            {
1719
                Common.ViewerDataModel.Instance.ControlTag = (sender as RadRibbonToggleButton).Tag.ToString();
1720
                instanceToggle = (sender as RadRibbonToggleButton);
1721
            }
1722
            else if ((sender as RadRibbonButton) != null)
1723
            {
1724
                RadRibbonButton instanceButton = sender as RadRibbonButton;
1725
                Common.ViewerDataModel.Instance.ControlTag = instanceButton.Tag.ToString();
1726
            }
1727
            else
1728
            {
1729
                RadButton instanceButton = sender as RadButton;
1730
                Common.ViewerDataModel.Instance.ControlTag = instanceButton.Tag.ToString();
1731
            }
1732

    
1733

    
1734
            //System.Reactive.Linq.Observable2.FromPropertyChangedPattern(Common.ViewerDataModel.Instance, temp => temp.AngleVisibility).Subscribe(isSee =>
1735
            //{
1736
            //    if (instanceToggle.CommandParameter.ToString() == "ChainLine")
1737
            //    {
1738

    
1739
            //    }
1740
            //    else
1741
            //    {
1742
            //        System.Diagnostics.Debug.WriteLine(" instanceMain.dzMainMenu.MainAngle.Visibility   " + isSee);
1743

    
1744
            //        if (instanceMain.dzMainMenu.MainAngle.Visibility != isSee)
1745
            //        {
1746
            //            instanceMain.dzMainMenu.MainAngle.Visibility = isSee;
1747
            //        }
1748
            //    }
1749
            //    //System.Reactive.Linq.Observable2.FromPropertyChangedPattern(Common.ViewerDataModel.Instance, temp => temp.AngleValue).Subscribe(p =>
1750
            //    //{
1751
            //    //    instanceMain.dzMainMenu.MainAngle.AngleValue = p;
1752
            //    //});
1753
            //});
1754

    
1755
            instanceMain.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Drawing;
1756

    
1757
            instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = false;
1758

    
1759
            if (instanceToggle.IsChecked != false)
1760
            {
1761
                string param = instanceToggle.CommandParameter.ToString();
1762
                string MacroIndex = "";
1763

    
1764
                if (param.StartsWith("MACRO"))
1765
                {
1766
                    param = "MACRO";
1767
                    MacroIndex = param.Replace("MACRO;","");
1768

    
1769
                    //Common.ViewerDataModel.Instance.MacroItems = MacroHelper.LoadMacroItems(MacroIndex);
1770
                    //var items = MacroHelper.TopMenuItems();
1771

    
1772
                    Common.ViewerDataModel.Instance.MacroItems = new List<MacroItem>
1773
                    {
1774
                        new MacroItem
1775
                        {
1776
                            Desc = "Cloud Rectangle",
1777
                            ControlType = MarkupToPDF.Controls.Common.ControlType.RectCloud
1778
                        },
1779
                        new MacroItem
1780
                        {
1781
                             Desc = "Arrow TextBox",
1782
                            ControlType = MarkupToPDF.Controls.Common.ControlType.ArrowTextBorderControl
1783
                        }
1784
                    };
1785
                }
1786

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

    
2010
                        //instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = true;
2011

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

    
2027
                                this.ParentOfType<MainWindow>().dzMainMenu.currentControl = null;
2028
                                Keyboard.ClearFocus();
2029

    
2030
                            }
2031
                            else
2032
                            {
2033
                                ViewerDataModel.Instance.MarkupControls_USER.Remove(this.ParentOfType<MainWindow>().dzMainMenu.currentControl);
2034
                                this.ParentOfType<MainWindow>().dzMainMenu.currentControl = null;
2035
                            }
2036
                        }
2037

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

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

    
2097
                    #region MACRO -MACRO1
2098
                    case "MACRO":
2099
                        Common.ViewerDataModel.Instance.SelectedControl = "MACRO";
2100
                        Common.ViewerDataModel.Instance.ControlTag = instanceMain.dzMainMenu._ViewInfo.UserID; //사번
2101

    
2102
                        MacroHelper.MacroAction();
2103

    
2104
                        break;
2105
                    #endregion
2106

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

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

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

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

    
2269

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

    
2290
                        if (this.ParentOfType<MainWindow>().dzMainMenu.currentControl != null)
2291
                        {
2292
                            ViewerDataModel.Instance.MarkupControls_USER.Remove(this.ParentOfType<MainWindow>().dzMainMenu.currentControl);
2293
                            this.ParentOfType<MainWindow>().dzMainMenu.currentControl = null;
2294
                        }
2295

    
2296
                        ViewerDataModel.Instance.SelectedControl = "ImgControl";
2297
                   //     ViewerDataModel.Instance.ControlTag = null;
2298
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ImgControl;
2299

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

    
2313
                            }
2314
                            else
2315
                            {
2316
                                (Application.Current.MainWindow as MainWindow).dzTopMenu.RefactoryCommentReact(menu);
2317
                            }
2318
                        }*/
2319

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

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

    
2381
                        //    isClosed = false;
2382
                        //    CadResultViewer check = new CadResultViewer();
2383
                        //    check.WindowStartupLocation = WindowStartupLocation.CenterScreen;
2384
                        //    check.Title = "Viewer";
2385
                        //    check.Show();
2386

    
2387
                        //    check.Closed += Check_Closed;
2388

    
2389
                        //}
2390
                        break;
2391
                    #endregion
2392
                    default:
2393
                        break;
2394
                }
2395
                #endregion
2396
            }
2397
            else
2398
            {
2399
                if (Common.ViewerDataModel.Instance.IsMacroCommand)
2400
                {
2401
                    MacroHelper.Clear();
2402
                }
2403

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

    
2414
        }
2415

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

    
2437
        }
2438

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

    
2453
        }
2454

    
2455
        /* public class test 
2456
         {
2457
             public double width { get; set; }
2458
             public double height { get; set; }
2459
         }
2460
         */
2461

    
2462
        private double minHeight;
2463
        private double minWidth;
2464

    
2465
        private double maxHeight;
2466
        private double maxWidth;
2467

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
2658
                        {
2659
                            if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
2660
                            {
2661
                                MarkupToPDF.Controls.Parsing.MarkupParser.MarkupReturn res = MarkupParser.MarkupToString(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo, App.ViewInfo.UserID);
2662
                                id = (InnerItem.Symbol_ID != null) ? "|SymbolID|" + InnerItem.Symbol_ID : "";
2663
                                MarkupData += "|OR|" + res.ConvertData + id;
2664
                            }
2665
                        }
2666

    
2667
                        this.Dispatcher.Invoke(() =>
2668
                        {
2669
                            Clipboard.SetData(DataFormats.StringFormat, MarkupData);
2670
                        }, DispatcherPriority.Background);
2671
                    }
2672
                }
2673
            }
2674
        }
2675
    }
2676
}
클립보드 이미지 추가 (최대 크기: 500 MB)