프로젝트

일반

사용자정보

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

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

이력 | 보기 | 이력해설 | 다운로드 (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
                MinWidth = 1200,
1345
                MinHeight = 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
            };
1354
            StyleManager.SetTheme(signManagerPop, new Office2013Theme());
1355

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

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

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

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

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

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

    
1420
            //instanceToggle.IsChecked = false;
1421

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

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

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

    
1489
        }
1490

    
1491
        #region 대기
1492

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

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

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

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

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

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

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

    
1561

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

    
1566

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

    
1578

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

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

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

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

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

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

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

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

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

    
1635
                        Check_Uri.UriCheck(filepath);
1636

    
1637
                        instanceMain.dzMainMenu.filename = filepath;
1638

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

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

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

    
1673
        }
1674

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

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

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

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

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

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

    
1738

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
2107
                        MacroHelper.MacroAction();
2108

    
2109
                        break;
2110
                    #endregion
2111

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

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

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

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

    
2274

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

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

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

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

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

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

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

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

    
2392
                        //    check.Closed += Check_Closed;
2393

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

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

    
2419
        }
2420

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

    
2442
        }
2443

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

    
2458
        }
2459

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

    
2467
        private double minHeight;
2468
        private double minWidth;
2469

    
2470
        private double maxHeight;
2471
        private double maxWidth;
2472

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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