프로젝트

일반

사용자정보

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

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

이력 | 보기 | 이력해설 | 다운로드 (129 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 int rotateOffSet = 0;
40
        private double[] rotateValue = { 0, 90, 180, 270 };
41
        public System.Windows.Threading.DispatcherTimer SaveTimer { get; set; }
42
        public bool isClosed = true;
43

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

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

    
72
        /// <summary>
73
        ///  comment의 속성 변경시 저장여부 확인 하도록 undocommand에 추가
74
        /// </summary>
75
        /// <param name="adnoerFinal"></param>
76
        public void ChangeComment(Controls.AdornerFinal adnoerFinal)
77
        {
78
            var adornerMembers = adnoerFinal.Members.Cast<Controls.AdornerMember>();
79

    
80
            if (adornerMembers.Count() > 0)
81
            {
82
                //UndoCommand.Instance.Push(adornerMembers.Select(x => x.DrawingData).Cast<CommentUserInfo>().ToList(), adnoerFinal.AngleValue);
83
                UndoCommand.Instance.Push(EventType.Operation, adornerMembers.Select(x => x.DrawingData).Cast<CommentUserInfo>().ToList());
84
            }
85
        }
86

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

    
92
            if (AdonerList.Count > 0)
93
            {
94
                UndoCommand.Instance.Push(EventType.Operation, AdonerList.ConvertAll(x => x.DrawingData as CommentUserInfo));
95

    
96
                #region 속성 변경
97
                foreach (AdornerMember InnerItem in AdonerList)
98
                {
99
                    if ((InnerItem.DrawingData as MarkupToPDF.Controls.Common.IShapeControl) != null)
100
                    {
101
                        (InnerItem.DrawingData as MarkupToPDF.Controls.Common.IShapeControl).Paint = ViewerDataModel.Instance.paintSet;
102
                    }
103
                }
104
                #endregion
105
            }
106
        }
107

    
108
        private void SetHighlightEvent()
109
        {
110
            List<AdornerMember> AdonerList = GetAdornerItems();
111

    
112
            if (AdonerList.Count > 0)
113
            {
114
                foreach (AdornerMember InnerItem in AdonerList)
115
                {
116
                    switch (InnerItem.DrawingData.GetType().Name)
117
                    {
118
                        case ("TextControl"):
119
                            {
120
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).IsHighLight = ViewerDataModel.Instance.checkHighShape;
121
                            }
122
                            break;
123
                        case ("ArrowTextControl"):
124
                            {
125
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape;
126
                            }
127
                            break;
128
                    }
129
                }
130

    
131
                ViewerDataModel.Instance.IsMarkupUpdate = true;
132
            }
133

    
134
        }
135

    
136
        private void FillShapeEvent(object sender, RoutedEventArgs e)
137
        {
138
            #region 주석
139
            //if ((sender as CheckBox).IsChecked.Value)
140
            //{
141
            //    cbHatchShape.IsChecked = false;
142
            //    imgShape_RectCloud.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/RectCloud_Fill.png", UriKind.Relative));
143
            //    imgShape_Cloud.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/Cloud_Fill.png", UriKind.Relative));
144
            //    imgShape_Rect.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/Rectangle_Fill.png", UriKind.Relative));
145
            //    imgShape_Tri.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/triangle-icon.png", UriKind.Relative));
146
            //    imgShape_Cicle.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/circle-icon.png", UriKind.Relative));
147
            //    imgShape_Poly.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/polygon_Fill.png", UriKind.Relative));
148
            //    TaskMessage("채우기 옵션이 적용되었습니다", TaskMessageType.Normal);
149
            //}
150
            //else
151
            //{
152

    
153
            //    imgShape_RectCloud.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/RectCloud.png", UriKind.Relative));
154
            //    imgShape_Cloud.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/Cloud.png", UriKind.Relative));
155
            //    imgShape_Rect.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/Rectangle.png", UriKind.Relative));
156
            //    imgShape_Tri.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/triangle-icon_None.png", UriKind.Relative));
157
            //    imgShape_Cicle.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/circle-icon_None.png", UriKind.Relative));
158
            //    imgShape_Poly.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/polygon.png", UriKind.Relative));
159
            //    TaskMessage("채우기 옵션이 해제되었습니다", TaskMessageType.Caption);
160
            //}
161
            #endregion
162
            ViewerDataModel.Instance.checkFillShape = (sender as CheckBox).IsChecked.Value;
163

    
164
            if (ViewerDataModel.Instance.checkFillShape)
165
            {
166
                cbHatchShape.IsChecked = false;
167
                ViewerDataModel.Instance.paintSet = MarkupToPDF.Controls.Common.PaintSet.Fill;
168
            }
169
            else
170
            {
171
                ViewerDataModel.Instance.paintSet = MarkupToPDF.Controls.Common.PaintSet.None;
172
            }
173
            SetPaintEvent();
174
        }
175

    
176
        /// <summary>
177
        /// 도형 빗금 처리
178
        /// </summary>
179
        /// <param name="sender"></param>
180
        /// <param name="e"></param>
181
        private void HatchShapeEvent(object sender, RoutedEventArgs e)
182
        {
183
			#region 주석
184
            //if ((sender as CheckBox).IsChecked.Value)
185
            //{
186
            //    cbFillShape.IsChecked = false;
187
            //    imgShape_RectCloud.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/RectCloud_Hatch.png", UriKind.Relative));
188
            //    imgShape_Cloud.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/Cloud_Hatch.png", UriKind.Relative));
189
            //    imgShape_Rect.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/rectangle-icon_Hatch.png", UriKind.Relative));
190
            //    imgShape_Tri.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/triangle-icon_Hatch.png", UriKind.Relative));
191
            //    imgShape_Cicle.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/circle-icon_Hatch.png", UriKind.Relative));
192
            //    imgShape_Poly.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/polygon_hatch.png", UriKind.Relative));
193
            //    TaskMessage("무늬 옵션이 적용되었습니다", TaskMessageType.Normal);
194
            //}
195
            //else
196
            //{
197
            //    imgShape_RectCloud.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/RectCloud.png", UriKind.Relative));
198
            //    imgShape_Cloud.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/Cloud.png", UriKind.Relative));
199
            //    imgShape_Rect.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/Rectangle.png", UriKind.Relative));
200
            //    imgShape_Tri.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/triangle-icon_None.png", UriKind.Relative));
201
            //    imgShape_Cicle.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/circle-icon_None.png", UriKind.Relative));
202
            //    imgShape_Poly.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/polygon.png", UriKind.Relative));
203
            //    TaskMessage("무늬 옵션이 해제되었습니다", TaskMessageType.Caption);
204
            //} 
205
            #endregion
206

    
207
            //강인구 추가
208
            ViewerDataModel.Instance.checkHatchShape = (sender as CheckBox).IsChecked.Value;
209
            if (ViewerDataModel.Instance.checkHatchShape)
210
            {
211
                cbFillShape.IsChecked = false;
212
                ViewerDataModel.Instance.paintSet = MarkupToPDF.Controls.Common.PaintSet.Hatch;
213
            }
214
            else
215
            {
216
                ViewerDataModel.Instance.paintSet = MarkupToPDF.Controls.Common.PaintSet.None;  
217
            }
218
            SetPaintEvent();
219
        }
220

    
221
        void SaveTimer_Tick(object sender, EventArgs e)
222
        {
223
            //if (this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode != IKCOM.MouseHandlingMode.Drawing)
224
            if (this.ParentOfType<MainWindow>().dzMainMenu.currentControl == null && this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count == 0)
225
            {
226
                SaveEventCallback(null, null);
227
            }
228
        }
229

    
230
        private void SaveTime(bool IsRun)
231
        {
232
            if(SaveTimer == null)
233
            {
234
                SaveTimer = new System.Windows.Threading.DispatcherTimer();
235
                SaveTimer.Interval = new TimeSpan(0, 0, 5);
236
                SaveTimer.Tick += new EventHandler(SaveTimer_Tick);
237
            }
238

    
239
            if (IsRun)
240
            {
241
                SaveTimer.Start();
242
            }
243
            else
244
            {
245
                SaveTimer.Stop();
246
            }
247
        }
248
        private void SaveTime(bool IsRun,int timeinterval)
249
        {
250
            if (SaveTimer == null)
251
            {
252
                SaveTimer = new System.Windows.Threading.DispatcherTimer();
253
                SaveTimer.Interval = new TimeSpan(0, timeinterval, 0);
254
                SaveTimer.Tick += new EventHandler(SaveTimer_Tick);
255
            }
256
            else
257
            {
258
                SaveTimer.Stop();
259
                SaveTimer.Interval = new TimeSpan(0, timeinterval, 0);
260
            }
261

    
262
            if (IsRun)
263
            {
264
                SaveTimer.Start();
265
            }
266
            else
267
            {
268
                SaveTimer.Stop();
269
            }
270
        }
271
        /// <summary>
272
        /// enable busy indicator and then call _SaveEvent method.
273
        /// </summary>
274
        /// <param name="sender"></param>
275
        /// <param name="e"></param>
276
        public  void SaveEventCallback(object sender, RoutedEventArgs e)
277
        {
278
            var mianMenu = this.ParentOfType<MainWindow>().dzMainMenu;
279

    
280
            if (mianMenu.busyIndicator.IsBusy == true)
281
            {
282
                return;
283
            }
284

    
285
            //var result = await Dispatcher.InvokeAsync<bool>(()=>
286
            //{
287
                this.ParentOfType<MainWindow>().dzMainMenu.busyIndicator.IsBusy = true;
288

    
289
                _SaveEvent(sender, e);
290

    
291
                mianMenu.busyIndicator.IsBusy = false;
292
               
293
            //});
294

    
295
            //System.Threading.Tasks.Task SaveTask = System.Threading.Tasks.Task.Factory.StartNew(() =>
296
            //{
297
            //    Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, new Action<object, RoutedEventArgs>(_SaveEvent), sender, e);
298
            //}).ContinueWith(task =>
299
            //{
300
            //    Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate () { this.ParentOfType<MainWindow>().dzMainMenu.busyIndicator.IsBusy = false; }));
301
            //});
302
        }
303

    
304
        /// <summary>
305
        /// save markup
306
        ///  - convert ink control to polygon control if ink control exists
307
        ///  - unselect and update my markup list
308
        /// <param name="sender"></param>
309
        /// <param name="e"></param>
310
        public async Task<bool> _SaveEvent(object sender, RoutedEventArgs e)
311
        {
312
            bool result = false;
313

    
314
            var mainMenu = this.ParentOfType<MainWindow>().dzMainMenu;
315
            try
316
            {
317
                mainMenu.ConvertInkControlToPolygon();
318

    
319
                mainMenu.UpdateMyMarkupList();
320

    
321
                if (mainMenu.gridViewMarkup.SelectedItems.Count == 0 && mainMenu.gridViewMarkup.Items.Count > 0)
322
                {
323
                    this.ParentOfType<MainWindow>().DialogMessage_Alert("Please Select Your Comment List Item", "Alert");
324
                }
325
                else
326
                {                    
327
                    foreach (var item in mainMenu.gridViewMarkup.SelectedItems)
328
                    {
329
                        if ((item as IKCOM.MarkupInfoItem).UserID == App.ViewInfo.UserID)
330
                        {
331
                            #region 저장 서비스 호출(저장 완료시까지 대기)
332
                            await this.ExecuteSaveCommandAsync(mainMenu);
333
                            #endregion
334

    
335
                            var info = ViewerDataModel.Instance._markupInfoList.FirstOrDefault(data => data.MarkupInfoID == (item as IKCOM.MarkupInfoItem).MarkupInfoID);
336
                            if(info != null) info.UpdateTime = DateTime.Now;
337
                            if (!ViewerDataModel.Instance.IsConsolidate && (sender != null))
338
                            {
339
                                this.ParentOfType<MainWindow>().DialogMessage_Alert("Save is complete.", "Info");
340
                            }
341

    
342
                            result = true;
343
                        }
344
                    }
345
                }
346

    
347
                mainMenu.SetCommentPages(null);
348

    
349
                ViewerDataModel.Instance.UndoDataList.Clear();
350
            }
351
            catch (Exception ex)
352
            {
353
                System.Diagnostics.Debug.WriteLine("_SaveEvent Error : " + ex.ToString());
354
            }
355
            finally
356
            {
357
                /*
358
                /// delete markup information when 코멘트가 없을 경우
359
                if (ViewerDataModel.Instance.MyMarkupList.Count == 0)
360
                {
361
                    foreach (var item in menu.gridViewMarkup.SelectedItems)
362
                    {
363
                        if ((item as IKCOM.MarkupInfoItem).UserID == App.ViewInfo.UserID)
364
                        {
365
                            //this.ParentOfType<MainWindow>().dzMainMenu.DeleteItem((item as IKCOM.MarkupInfoItem));
366
                        }
367
                    }
368
                }
369
                */
370
            }
371

    
372
            return result;
373
        }
374

    
375
        public async Task<bool>  SaveEventAsync()
376
        {
377
            bool result = false;
378

    
379
            var mainMenu = this.ParentOfType<MainWindow>().dzMainMenu;
380
            try
381
            {
382
                mainMenu.ConvertInkControlToPolygon();
383

    
384
                // update mylist and gridview
385
                mainMenu.UpdateMyMarkupList();
386

    
387
                if (mainMenu.gridViewMarkup.SelectedItems.Count == 0 && mainMenu.gridViewMarkup.Items.Count > 0)
388
                {
389
                    this.ParentOfType<MainWindow>().DialogMessage_Alert("Please Select Your Comment List Item", "Alert");
390
                }
391
                else
392
                {
393
                    foreach (var item in mainMenu.gridViewMarkup.SelectedItems)
394
                    {
395
                        if ((item as IKCOM.MarkupInfoItem).UserID == App.ViewInfo.UserID)
396
                        {
397
                            /// 저장 서비스 호출
398
                            result = await this.ExecuteSaveCommandAsync(mainMenu);
399
                            ViewerDataModel.Instance._markupInfoList.Where(data => data.MarkupInfoID == (item as IKCOM.MarkupInfoItem).MarkupInfoID).FirstOrDefault().UpdateTime = DateTime.Now;
400
                        }
401
                    }
402
                }
403

    
404
                mainMenu.SetCommentPages(null);
405

    
406
                ViewerDataModel.Instance.UndoDataList.Clear();
407
                result = true;
408
            }
409
            catch (Exception ex)
410
            {
411
                System.Diagnostics.Debug.WriteLine("_SaveEvent Error : " + ex.ToString());
412
            }
413
            finally
414
            {
415
                /*
416
                /// delete markup information when 코멘트가 없을 경우
417
                if (ViewerDataModel.Instance.MyMarkupList.Count == 0)
418
                {
419
                    foreach (var item in menu.gridViewMarkup.SelectedItems)
420
                    {
421
                        if ((item as IKCOM.MarkupInfoItem).UserID == App.ViewInfo.UserID)
422
                        {
423
                            //this.ParentOfType<MainWindow>().dzMainMenu.DeleteItem((item as IKCOM.MarkupInfoItem));
424
                        }
425
                    }
426
                }
427
                */
428
            }
429

    
430
            return result;
431
        }
432

    
433
        /// <summary>
434
        /// 마크업 데이터를 저장한다.
435
        /// </summary>
436
        /// <param name="menu"></param>
437
        /// <returns></returns>
438
        public async Task<bool> ExecuteSaveCommandAsync(MainMenu menu)
439
        {
440
            bool result = false;
441

    
442
            if (menu.pageNavigator.CurrentPage != null)
443
            {
444
                SaveCommand.Instance.Project_No = App.ViewInfo.ProjectNO;
445
                SaveCommand.Instance.document_id = App.ViewInfo.DocumentItemID;
446
                SaveCommand.Instance.user_id = App.ViewInfo.UserID;
447
                SaveCommand.Instance.page_no = menu.pageNavigator.CurrentPage.PageNumber;
448

    
449
                try
450
                {
451
                    if (ViewerDataModel.Instance.UndoDataList.Count > 0 || ViewerDataModel.Instance.IsMarkupUpdate)
452
                    {
453
                        List<IKCOM.MarkupInfoItem> SelectedMarkupInfos = new List<IKCOM.MarkupInfoItem>();
454
                        foreach (var item in menu.gridViewMarkup.SelectedItems)
455
                        {
456
                            if ((item as IKCOM.MarkupInfoItem).UserID == App.ViewInfo.UserID)
457
                            {
458
                                SelectedMarkupInfos.Add(item as IKCOM.MarkupInfoItem);
459
                            }
460
                        }
461

    
462
                        result = await SaveCommand.Instance.Execute(SelectedMarkupInfos);
463
                        ViewerDataModel.Instance.IsMarkupUpdate = false;
464
                    }
465
                    else
466
                    {
467
                        result = true;
468
                    }
469

    
470
                    if (ViewerDataModel.Instance.RotationDocs.Count > 0)
471
                    {
472
                        SaveCommand.Instance.PageAngleSave(App.ViewInfo.ProjectNO, ViewerDataModel.Instance.RotationDocs);
473
                    }
474
                }
475
                catch (Exception ex)
476
                {
477
                    this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert(string.Format("세이브 실패:{0}", ex.Message), "Alert");
478
                    throw new InvalidOperationException(ex.Message);
479
                }
480
            }
481
            else
482
            {
483
                System.Diagnostics.Debug.WriteLine("ExecuteSaveCommand Error - pageNavigator.CurrentPage null");
484
            }
485

    
486
            return result;
487
        }
488

    
489
        //강인구 추가
490
        public void Print_Start(string Type)
491
        {
492
            if (ViewerDataModel.Instance.MarkupControls_USER.Count > 0 || this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
493
            {
494
                var menu = this.ParentOfType<MainWindow>().dzMainMenu;
495
                SelectionSet.Instance.UnSelect(menu);
496
                if (menu.PreviewUserMarkupInfoItem != null && menu.PreviewUserMarkupInfoItem.IsPreviewUser == true)
497
                {
498
                    this.SaveEventCallback(null, null);
499
                }
500
                else if (menu.gridViewMarkup.SelectedItems.Count == 0 || (menu.gridViewMarkup.SelectedItems.FirstOrDefault() as IKCOM.MarkupInfoItem).UserID != App.ViewInfo.UserID)
501
                {
502

    
503
                }
504
                else
505
                {
506
                    this.SaveEventCallback(null, null);
507
                }
508
            }
509

    
510
            bool isprint = false;
511
            if (Type == "Print")
512
            {
513
                isprint = true;
514
            }
515

    
516
            RadWindow PrintWindow = new RadWindow();
517
            PrintWindow.Width = 850;
518
            PrintWindow.Height = 600;
519
            PrintWindow.Header = Type;
520

    
521
            List<IKCOM.MarkupInfoItem> markupinfo = new List<IKCOM.MarkupInfoItem>();
522

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

    
525
            if (markupinfo?.Count() > 0)
526
            {
527
                //Logger.sendResLog("GetPrintDocItemList", "TRUE", 1);
528
            }
529
            else
530
            {
531
                //Logger.sendResLog("GetPrintDocItemList", "FALSE", 1);
532
            }
533

    
534
            /// Tile Source URL을 구한다
535

    
536
            string sImageURL = ViewerDataModel.Instance.SystemMain.dzMainMenu.GetImageURL(App.ViewInfo.DocumentItemID, this.ParentOfType<MainWindow>().dzMainMenu.pageNavigator.CurrentPage.PageNumber);
537
            var url = new Uri(sImageURL);
538
            string sFolder = App.ViewInfo.DocumentItemID.All(char.IsDigit) ? (Convert.ToInt64(App.ViewInfo.DocumentItemID) / 100).ToString() : App.ViewInfo.DocumentItemID.Substring(0, 5);
539
            var Tile_Url = string.Format(@"{0}://{1}:{2}/TileSource/{3}_Tile/{4}/{5}/",
540
                url.Scheme, url.Host, url.Port,
541
                App.ViewInfo.ProjectNO,
542
                sFolder,
543
                App.ViewInfo.DocumentItemID
544
                );
545
            /// up to here
546

    
547
            var docitem = this.ParentOfType<MainWindow>().dzMainMenu._DocItem;
548

    
549
            PrintWindow.Content = new KCOM.Control.PrintControl(
550
                      Tile_Url,
551
                      App.ViewInfo.ProjectNO,
552
                      this.ParentOfType<MainWindow>().dzMainMenu._DocInfo,
553
                      markupinfo,
554
                      this.ParentOfType<MainWindow>().dzMainMenu.pageNavigator.CurrentPage.PageNumber,
555
                      docitem.GROUP_NO,
556
                      docitem.DOCUMENT_NO,
557
                      docitem.ORIGINAL_FILE,
558
                      isprint);
559

    
560
            //프린트 팝업 옵션
561
            //PrintWindow.BorderThickness = new Thickness(3);
562
            //PrintWindow.BorderBrush = new SolidColorBrush(Color.FromArgb(255, 37, 160, 218));
563
            PrintWindow.ResizeMode = System.Windows.ResizeMode.NoResize;
564
            PrintWindow.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
565
            PrintWindow.Background = new SolidColorBrush(Colors.Black);
566
            PrintWindow.Background.Opacity = 0.6;
567
            PrintWindow.Owner = Application.Current.MainWindow;
568
            Telerik.Windows.Controls.StyleManager.SetTheme(PrintWindow, new Telerik.Windows.Controls.VisualStudio2013Theme());
569
            PrintWindow.ShowDialog();
570
        }
571

    
572
        //강인구 추가
573
        private void PrintEvent(object sender, RoutedEventArgs e)
574
        {
575
            RadRibbonButton button = sender as RadRibbonButton;
576
            Print_Start(button.Content.ToString());
577
        }
578

    
579
        /// <summary>
580
        /// 선택된 AdornerMember들을 리턴한다.
581
        /// </summary>
582
        /// <returns></returns>
583
        public List<AdornerMember> GetAdornerItems()
584
        {
585
            List<AdornerMember> AdonerList = new List<AdornerMember>();
586

    
587
            if (this.ParentOfType<MainWindow>() != null && this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
588
            {
589
                foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
590
                {
591
                    if (item.GetType().Name == "AdornerFinal")
592
                    {
593
                        foreach (var InnerItem in (item as Controls.AdornerFinal).Members)
594
                        {
595
                            AdonerList.Add(InnerItem);
596
                        }
597
                    }
598
                }
599
            }
600

    
601
            return AdonerList;
602
        }
603

    
604
        /// <summary>
605
        /// 투명도 변경
606
        /// </summary>
607
        /// <param name="sender"></param>
608
        /// <param name="e"></param>
609
        //강인구 추가(Undo End)
610
        private void sdOpacity_ValueChanged(object sender, RoutedEventArgs e)
611
        {
612
            List<AdornerMember> AdonerList = GetAdornerItems();
613
            if (!AdonerList.Any()) return;
614

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

    
617
            #region 속성 변경
618
            foreach (AdornerMember InnerItem in AdonerList)
619
            {
620
                InnerItem.DrawingData.Opacity = ViewerDataModel.Instance.ControlOpacity;
621
            }
622
            ViewerDataModel.Instance.IsMarkupUpdate = true;
623
            #endregion
624
        }
625

    
626
        /// <summary>
627
        /// LineSize 변경
628
        /// </summary>
629
        /// <param name="sender"></param>
630
        /// <param name="e"></param>
631
        private void cbLineSize_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
632
        {
633
            if (string.IsNullOrEmpty(cbLineSize.Value.ToString()))
634
            {
635
                cbLineSize.Value = cbLineSize.Minimum;
636
            }
637
            List<AdornerMember> AdonerList = GetAdornerItems();
638
            if (!AdonerList.Any()) return;
639
                
640
            UndoCommand.Instance.Push(EventType.Operation, AdonerList.ConvertAll(x => x.DrawingData as CommentUserInfo));
641

    
642
            #region 속성 변경
643
            foreach (AdornerMember InnerItem in AdonerList)
644
            {
645
                switch (InnerItem.DrawingData.GetType().Name)
646
                {
647
                    case ("LineControl"):
648
                        {
649
                            (InnerItem.DrawingData as MarkupToPDF.Controls.Line.LineControl).LineSize = ViewerDataModel.Instance.LineSize;
650
                        }
651
                        break;
652
                    case ("ArcControl"):
653
                        {
654
                            (InnerItem.DrawingData as MarkupToPDF.Controls.Line.ArcControl).LineSize = ViewerDataModel.Instance.LineSize;
655
                        }
656
                        break;
657
                    case ("ArrowArcControl"):
658
                        {
659
                            (InnerItem.DrawingData as MarkupToPDF.Controls.Line.ArrowArcControl).LineSize = ViewerDataModel.Instance.LineSize;
660
                        }
661
                        break;
662
                    case ("ArrowControl_Multi"):
663
                        {
664
                            (InnerItem.DrawingData as MarkupToPDF.Controls.Line.ArrowControl_Multi).LineSize = ViewerDataModel.Instance.LineSize;
665
                        }
666
                        break;
667
                    case ("CloudControl"):
668
                        {
669
                            (InnerItem.DrawingData as MarkupToPDF.Controls.Polygon.CloudControl).LineSize = ViewerDataModel.Instance.LineSize;
670
                        }
671
                        break;
672
                    case ("PolygonControl"):
673
                        {
674
                            (InnerItem.DrawingData as MarkupToPDF.Controls.Polygon.PolygonControl).LineSize = ViewerDataModel.Instance.LineSize;
675
                        }
676
                        break;
677
                    case ("RectangleControl"):
678
                        {
679
                            (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.RectangleControl).LineSize = ViewerDataModel.Instance.LineSize;
680
                        }
681
                        break;
682
                    case ("RectCloudControl"):
683
                        {
684
                            (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.RectCloudControl).LineSize = ViewerDataModel.Instance.LineSize;
685
                        }
686
                        break;
687
                    case ("TriControl"):
688
                        {
689
                            (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.TriControl).LineSize = ViewerDataModel.Instance.LineSize;
690
                        }
691
                        break;
692
                    case ("CircleControl"):
693
                        {
694
                            (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.CircleControl).LineSize = ViewerDataModel.Instance.LineSize;
695
                        }
696
                        break;
697
                    case ("ArrowTextControl"):
698
                        {
699
                            (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).LineSize = ViewerDataModel.Instance.LineSize;
700
                            (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).BorderSize = new Thickness(ViewerDataModel.Instance.LineSize);
701
                        }
702
                        break;
703
                    case ("TextControl"):
704
                        {
705
                            (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).LineSize = new Thickness(ViewerDataModel.Instance.LineSize);
706
                        }
707
                        break;
708
                    case ("InsideWhiteControl"):
709
                        {
710
                            (InnerItem.DrawingData as MarkupToPDF.Controls.Cad.InsideWhiteControl).LineSize = ViewerDataModel.Instance.LineSize;
711
                        }
712
                        break;
713
                    case ("OverlapWhiteControl"):
714
                        {
715
                            (InnerItem.DrawingData as MarkupToPDF.Controls.Cad.OverlapWhiteControl).LineSize = ViewerDataModel.Instance.LineSize;
716
                        }
717
                        break;
718
                    case ("ClipWhiteControl"):
719
                        {
720
                            (InnerItem.DrawingData as MarkupToPDF.Controls.Cad.ClipWhiteControl).LineSize = ViewerDataModel.Instance.LineSize;
721
                        }
722
                        break;
723
                    case ("CoordinateControl"):
724
                        {
725
                            (InnerItem.DrawingData as MarkupToPDF.Controls.Cad.CoordinateControl).LineSize = 10; //ViewerDataModel.Instance.LineSize
726
                        }
727
                        break;
728
                }
729
            }
730
            ViewerDataModel.Instance.IsMarkupUpdate = true;
731
            #endregion
732

    
733
            KCOM.Properties.Settings.Default.LineSize = (double)cbLineSize.Value;
734
            Properties.Settings.Default.Save();
735
        }
736

    
737

    
738
        /// <summary>
739
        /// Interval Size 변경
740
        /// </summary>
741
        /// <param name="sender"></param>
742
        /// <param name="e"></param>
743
        private void cbIntervalSize_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
744
        {
745
            if (string.IsNullOrEmpty(cbIntervalSize.Value.ToString()))
746
            {
747
                cbIntervalSize.Value = cbIntervalSize.Minimum;
748
            }
749
            List<AdornerMember> AdonerList = GetAdornerItems();
750
            if (!AdonerList.Any()) return;
751

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

    
754
            #region 속성 변경
755
            foreach (AdornerMember InnerItem in AdonerList)
756
            {
757
                switch (InnerItem.DrawingData.GetType().Name)
758
                {
759
                    case ("LineControl"):
760
                        {
761
                            (InnerItem.DrawingData as MarkupToPDF.Controls.Line.LineControl).Interval = ViewerDataModel.Instance.Interval;
762
                        }
763
                        break;
764
                }
765
            }
766
            ViewerDataModel.Instance.IsMarkupUpdate = true;
767
            #endregion
768

    
769
            KCOM.Properties.Settings.Default.Interval = (double)cbIntervalSize.Value;
770
            Properties.Settings.Default.Save();
771
        }
772
        
773
        /// <summary>
774
        /// ArcLength가 수정되었을때
775
        /// </summary>
776
        /// <param name="sender"></param>
777
        /// <param name="e"></param>
778
        private void cbArcLength_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
779
        {
780
            if (string.IsNullOrEmpty(cbArcLength.Value.ToString()))
781
            {
782
                cbArcLength.Value = cbArcLength.Minimum;
783
            }
784

    
785
            List<AdornerMember> AdonerList = GetAdornerItems();
786
            if (!AdonerList.Any()) return;
787

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

    
790
            #region 속성 변경
791
            foreach (AdornerMember InnerItem in AdonerList)
792
            {
793
                switch (InnerItem.DrawingData.GetType().Name)
794
                {
795
                    case ("RectCloudControl"):
796
                        {
797
                            var item = InnerItem.DrawingData as MarkupToPDF.Controls.Shape.RectCloudControl;
798
                            item.ArcLength = ViewerDataModel.Instance.ArcLength;
799
                        }
800
                    break;
801
                    case ("CloudControl"):
802
                    {
803
                            var item = InnerItem.DrawingData as MarkupToPDF.Controls.Polygon.CloudControl;
804
                            item.ArcLength = ViewerDataModel.Instance.ArcLength;
805
                    }
806
                    break;
807
                    case ("TextControl"):
808
                    {
809
                            var item = InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl;
810
                            item.ArcLength = ViewerDataModel.Instance.ArcLength;
811
                    }
812
                    break;
813
                    case ("ArrowTextControl"):
814
                    {
815
                            var item = InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl;
816
                            item.ArcLength = ViewerDataModel.Instance.ArcLength;
817
                    }
818
                    break;
819
                }
820
            }
821
            ViewerDataModel.Instance.IsMarkupUpdate = true;
822
            #endregion
823

    
824
            KCOM.Properties.Settings.Default.ArcLength = (double)cbArcLength.Value;
825
            Properties.Settings.Default.Save();
826
        }
827

    
828
        /// <summary>
829
        /// Dash 스타일 변경
830
        /// </summary>
831
        /// <param name="sender"></param>
832
        /// <param name="e"></param>
833
        private void cbDashStyle_SelectionChanged(object sender, SelectionChangedEventArgs e)
834
        {
835
            ViewerDataModel.Instance.DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
836
            List<AdornerMember> AdonerList = GetAdornerItems();
837
            if (!AdonerList.Any()) return;
838

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

    
841
            #region 속성 변경
842
            foreach (AdornerMember InnerItem in AdonerList)
843
            {
844
                switch (InnerItem.DrawingData.GetType().Name)
845
                {
846
                    case ("LineControl"):
847
                        {
848
                            (InnerItem.DrawingData as MarkupToPDF.Controls.Line.LineControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
849
                        }
850
                        break;
851
                    case ("ArcControl"):
852
                        {
853
                            (InnerItem.DrawingData as MarkupToPDF.Controls.Line.ArcControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
854
                        }
855
                        break;
856
                    case ("ArrowArcControl"):
857
                        {
858
                            (InnerItem.DrawingData as MarkupToPDF.Controls.Line.ArrowArcControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
859
                        }
860
                        break;
861
                    case ("ArrowControl_Multi"):
862
                        {
863
                            (InnerItem.DrawingData as MarkupToPDF.Controls.Line.ArrowControl_Multi).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
864
                        }
865
                        break;
866
                    case ("CloudControl"):
867
                        {
868
                            (InnerItem.DrawingData as MarkupToPDF.Controls.Polygon.CloudControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
869
                        }
870
                        break;
871
                    case ("PolygonControl"):
872
                        {
873
                            (InnerItem.DrawingData as MarkupToPDF.Controls.Polygon.PolygonControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
874
                        }
875
                        break;
876
                    case ("RectangleControl"):
877
                        {
878
                            (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.RectangleControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
879
                        }
880
                        break;
881
                    case ("RectCloudControl"):
882
                        {
883
                            (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.RectCloudControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
884
                        }
885
                        break;
886
                    case ("TriControl"):
887
                        {
888
                            (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.TriControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
889
                        }
890
                        break;
891
                    case ("CircleControl"):
892
                        {
893
                            (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.CircleControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
894
                        }
895
                        break;
896
                    case ("InsideWhiteControl"):
897
                        {
898
                            (InnerItem.DrawingData as MarkupToPDF.Controls.Cad.InsideWhiteControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
899
                        }
900
                        break;
901
                    case ("OverlapWhiteControl"):
902
                        {
903
                            (InnerItem.DrawingData as MarkupToPDF.Controls.Cad.OverlapWhiteControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
904
                        }
905
                        break;
906
                    case ("ClipWhiteControl"):
907
                        {
908
                            (InnerItem.DrawingData as MarkupToPDF.Controls.Cad.ClipWhiteControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
909
                        }
910
                        break;
911
                    case ("CoordinateControl"):
912
                        {
913
                            (InnerItem.DrawingData as MarkupToPDF.Controls.Cad.CoordinateControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
914
                        }
915
                        break;
916
                }
917
            }
918
            ViewerDataModel.Instance.IsMarkupUpdate = true;
919
            #endregion
920
        }
921

    
922
        /// <summary>
923
        /// 굵기 속성 변경
924
        /// </summary>
925
        /// <param name="sender"></param>
926
        /// <param name="e"></param>
927
        private void btnBold_Checked(object sender, RoutedEventArgs e)
928
        {
929
            var AdonerList = GetAdornerItems();
930
            if (!AdonerList.Any()) return;
931

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

    
934
            #region 속성 변경
935
            foreach (AdornerMember InnerItem in AdonerList)
936
            {
937
                var element = InnerItem.DrawingData;
938
                if (element is MarkupToPDF.Controls.Text.ArrowTextControl ArrowTextCtrl)
939
                {
940
                    if (ArrowTextCtrl.TextWeight == FontWeights.Bold)
941
                    {
942
                        ArrowTextCtrl.TextWeight = FontWeights.Normal;
943
                    }
944
                    else
945
                    {
946
                        ArrowTextCtrl.TextWeight = FontWeights.Bold;
947
                    }
948
                }
949
                else if (element is MarkupToPDF.Controls.Text.TextControl TextCtrl)
950
                {
951
                    if (TextCtrl.TextWeight == FontWeights.Bold)
952
                    {
953
                        TextCtrl.TextWeight = FontWeights.Normal;
954
                    }
955
                    else
956
                    {
957
                        TextCtrl.TextWeight = FontWeights.Bold;
958
                    }
959
                }
960
            }
961

    
962
            ViewerDataModel.Instance.IsMarkupUpdate = true;
963
            #endregion
964
        }
965

    
966
        /// <summary>
967
        /// 이탤릭 속성 변경
968
        /// </summary>
969
        /// <param name="sender"></param>
970
        /// <param name="e"></param>
971
        private void btnItalic_Checked(object sender, RoutedEventArgs e)
972
        {
973
            var AdonerList = GetAdornerItems();
974
            if (!AdonerList.Any()) return;
975

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

    
978
            #region 속성 변경
979
            foreach (AdornerMember InnerItem in AdonerList)
980
            {
981
                var element = InnerItem.DrawingData;
982
                if (element is MarkupToPDF.Controls.Text.ArrowTextControl ArrowTextCtrl)
983
                {
984
                    if (ArrowTextCtrl.TextStyle == FontStyles.Italic)
985
                    {
986
                        ArrowTextCtrl.TextStyle = System.Windows.FontStyles.Normal;
987
                    }
988
                    else
989
                    {
990
                        ArrowTextCtrl.TextStyle = FontStyles.Italic;
991
                    }
992
                }
993
                else if (element is MarkupToPDF.Controls.Text.TextControl TextCtrl)
994
                {
995
                    if (TextCtrl.TextStyle == FontStyles.Italic)
996
                    {
997
                        TextCtrl.TextStyle = System.Windows.FontStyles.Normal;
998
                    }
999
                    else
1000
                    {
1001
                        TextCtrl.TextStyle = FontStyles.Italic;
1002
                    }
1003
                }
1004
            }
1005
            ViewerDataModel.Instance.IsMarkupUpdate = true;
1006
            #endregion
1007
        }
1008

    
1009
        /// <summary>
1010
        /// 밑줄 변경
1011
        /// </summary>
1012
        /// <param name="sender"></param>
1013
        /// <param name="e"></param>
1014
        private void btnUnderLine_Checked(object sender, RoutedEventArgs e)
1015
        {
1016
            var AdonerList = GetAdornerItems();
1017
            if (!AdonerList.Any()) return;
1018

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

    
1021
            #region 속성 변경
1022
            foreach (AdornerMember InnerItem in AdonerList)
1023
            {
1024
                var element = InnerItem.DrawingData;
1025
                if (element is MarkupToPDF.Controls.Text.ArrowTextControl ArrowTextCtrl)
1026
                {
1027
                    if (ArrowTextCtrl.UnderLine != null && ArrowTextCtrl.UnderLine == TextDecorations.Underline)
1028
                    {
1029
                        ArrowTextCtrl.UnderLine = null;
1030
                    }
1031
                    else
1032
                    {
1033
                        ArrowTextCtrl.UnderLine = TextDecorations.Underline;
1034
                    }
1035
                }
1036
                else if (element is MarkupToPDF.Controls.Text.TextControl TextCtrl)
1037
                {
1038
                    if (TextCtrl.UnderLine != null && TextCtrl.UnderLine == TextDecorations.Underline)
1039
                    {
1040
                        TextCtrl.UnderLine = null;
1041
                    }
1042
                    else
1043
                    {
1044
                        TextCtrl.UnderLine = TextDecorations.Underline;
1045
                    }
1046
                }
1047
            }
1048
            ViewerDataModel.Instance.IsMarkupUpdate = true;
1049
            #endregion
1050
        }
1051

    
1052
        private void cbLineSize_PreviewKeyDown(object sender, System.Windows.Input.KeyEventArgs e)
1053
        {
1054
            if (e.Key == Key.Space || e.Key == Key.ImeProcessed)
1055
            {
1056
                e.Handled = true;
1057
            }
1058

    
1059
        }
1060

    
1061
        private void cbLineSize_PreviewTextInput(object sender, System.Windows.Input.TextCompositionEventArgs e)
1062
        {
1063
            var regex = new Regex(@"[^a-zA-Z0-9\s]");
1064
            if (regex.IsMatch(e.Text))
1065
            {
1066
                e.Handled = true;
1067
            }
1068

    
1069
        }
1070

    
1071
        private void cbArcLength_PreviewKeyDown(object sender, System.Windows.Input.KeyEventArgs e)
1072
        {
1073
            if (e.Key == Key.Space || e.Key == Key.ImeProcessed)
1074
            {
1075
                e.Handled = true;
1076
            }
1077
        }
1078

    
1079
        private void cbArcLength_PreviewTextInput(object sender, System.Windows.Input.TextCompositionEventArgs e)
1080
        {
1081
            var regex = new Regex(@"[^a-zA-Z0-9\s]");
1082
            if (regex.IsMatch(e.Text))
1083
            {
1084
                e.Handled = true;
1085
            }
1086
        }
1087

    
1088
        private void comboFontSize_PreviewKeyDown(object sender, System.Windows.Input.KeyEventArgs e)
1089
        {
1090
            if (e.Key == Key.Space || e.Key == Key.ImeProcessed)
1091
            {
1092
                e.Handled = true;
1093
            }
1094
        }
1095

    
1096
        private void cbIntervalSize_PreviewKeyDown(object sender, System.Windows.Input.KeyEventArgs e)
1097
        {
1098
            if (e.Key == Key.Space || e.Key == Key.ImeProcessed)
1099
            {
1100
                e.Handled = true;
1101
            }
1102
        }
1103

    
1104
        private void cbIntervalSize_PreviewTextInput(object sender, System.Windows.Input.TextCompositionEventArgs e)
1105
        {
1106
            var regex = new Regex(@"[^a-zA-Z0-9\s]");
1107
            if (regex.IsMatch(e.Text))
1108
            {
1109
                e.Handled = true;
1110
            }
1111
        }
1112

    
1113
        private void comboFontSize_PreviewTextInput(object sender, System.Windows.Input.TextCompositionEventArgs e)
1114
        {
1115
            var regex = new Regex(@"[^a-zA-Z0-9\s]");
1116
            if (regex.IsMatch(e.Text))
1117
            {
1118
                e.Handled = true;
1119
            }
1120
        }
1121

    
1122
        /// <summary>
1123
        /// 폰트 크기 변경
1124
        /// </summary>
1125
        /// <param name="sender"></param>
1126
        /// <param name="e"></param>
1127
        private void comboFontSize_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
1128
        {
1129
            if (string.IsNullOrEmpty(comboFontSize.Value.ToString()))
1130
            {
1131
                comboFontSize.Value = comboFontSize.Minimum;
1132
            }
1133

    
1134
            var AdonerList = GetAdornerItems();
1135
            if (!AdonerList.Any()) return;
1136
            UndoCommand.Instance.Push(EventType.Operation, AdonerList.ConvertAll(x => x.DrawingData as CommentUserInfo));
1137

    
1138
            #region 속성 변경
1139
            foreach (AdornerMember InnerItem in AdonerList)
1140
            {
1141
                switch (InnerItem.DrawingData.GetType().Name)
1142
                {
1143
                    case ("TextControl"):
1144
                        {
1145
                            (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextSize = int.Parse(comboFontSize.Value.ToString());
1146
                        }
1147
                        break;
1148
                    case ("ArrowTextControl"):
1149
                        {
1150
                            (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextSize = int.Parse(comboFontSize.Value.ToString());
1151
                        }
1152
                        break;
1153
                }
1154
            }
1155
            ViewerDataModel.Instance.IsMarkupUpdate = true;
1156
            #endregion
1157

    
1158
            KCOM.Properties.Settings.Default.TextSize = (double)comboFontSize.Value;
1159
            Properties.Settings.Default.Save();
1160
        }
1161

    
1162
        /// <summary>
1163
        /// 폰트 패밀리 변경
1164
        /// </summary>
1165
        /// <param name="sender"></param>
1166
        /// <param name="e"></param>
1167
        private void comboFontFamily_SelectionChanged(object sender, SelectionChangedEventArgs e)
1168
        {
1169
            if (comboFontFamily.SelectedItem != null && !IsSuspendChange)
1170
            {
1171
                var AdonerList = GetAdornerItems();
1172
                if (!AdonerList.Any()) return;
1173

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

    
1176
                #region 속성 변경
1177
                var font = comboFontFamily.SelectedItem as Markus.Fonts.MarkusFont;
1178
                foreach (AdornerMember InnerItem in AdonerList)
1179
                {
1180
                    var element = InnerItem.DrawingData;
1181
                    if (element is MarkupToPDF.Controls.Text.ArrowTextControl ctrl1)
1182
                    {
1183
                        ViewerDataModel.Instance.IsMarkupUpdate = true;
1184
                        ctrl1.SetFontFamily(font.FontFamily);
1185
                    }
1186
                    else if (element is MarkupToPDF.Controls.Text.TextControl ctrl2)
1187
                    {
1188
                        ViewerDataModel.Instance.IsMarkupUpdate = true;
1189
                        ctrl2.SetFontFamily(font.FontFamily);
1190
                    }
1191
                }
1192
                ViewerDataModel.Instance.IsMarkupUpdate = true;
1193
                #endregion
1194

    
1195
                KCOM.Properties.Settings.Default.FontFamily = font.FontFamily.FontName();
1196
                Properties.Settings.Default.Save();
1197
            }
1198
        }
1199

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

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

    
1226
        //추가페이지 이동 엔터
1227
        private void tlcurrentPage_KeyDown(object sender, KeyEventArgs e)
1228
        {
1229
            //강인구 추가 tlcurrentPage을 이상하게 입력할수 있기때문에 Try Catch
1230
            if (e.Key == Key.Enter)
1231
            {
1232
                try
1233
                {
1234
                    var instanceMain = this.ParentOfType<MainWindow>();
1235
                    var max = instanceMain.dzMainMenu.pageNavigator._thumbnailItems.Max(f => f.PageNumber);
1236
                    if (string.IsNullOrEmpty(tlcurrentPage.Text))
1237
                    {
1238
                        RadWindow.Alert(new DialogParameters
1239
                        {
1240
                            Owner = Application.Current.MainWindow,
1241
                            Theme = new VisualStudio2013Theme(),
1242
                            Header = "Info",
1243
                            Content = "Enter the correct page number.",
1244
                        });
1245
                    }
1246
                    else
1247
                    {
1248
                        if (Convert.ToInt32(tlcurrentPage.Text) > max || Convert.ToInt32(tlcurrentPage.Text) == 0)
1249
                        {
1250
                            RadWindow.Alert(new DialogParameters
1251
                            {
1252
                                Owner = Application.Current.MainWindow,
1253
                                Theme = new VisualStudio2013Theme(),
1254
                                Header = "Info",
1255
                                Content = "Enter the correct page number.",
1256
                            });
1257
                        }
1258
                        else
1259
                        {
1260
                            instanceMain.dzMainMenu.pageNavigator.GotoPage(Convert.ToInt32(tlcurrentPage.Text));
1261
                        }
1262
                    }
1263
                    
1264
                }
1265
                catch (Exception)
1266
                {
1267
                    RadWindow.Alert(new DialogParameters
1268
                    {
1269
                        Owner = Application.Current.MainWindow,
1270
                        Theme = new VisualStudio2013Theme(),
1271
                        Header = "Info",
1272
                        Content = "Enter the correct page number.",
1273
                    });
1274
                }
1275
                
1276
            }
1277
        }
1278
        private string previousText;
1279
        private void TlcurrentPage_PreviewTextInput(object sender, TextCompositionEventArgs e)
1280
        {
1281
            System.Text.RegularExpressions.Regex regex = new System.Text.RegularExpressions.Regex("[^0-9]+");
1282
            e.Handled = regex.IsMatch(e.Text);
1283
        }
1284
        private void TlcurrentPage_TextChanged(object sender, TextChangedEventArgs e)
1285
        {
1286
            double num = 0;
1287
            bool success = double.TryParse(((TextBox)sender).Text, out num);
1288
            if (success & num >= 0)
1289
                previousText = ((TextBox)sender).Text;
1290
            else
1291
            {
1292
                if (string.IsNullOrEmpty(((TextBox)sender).Text))
1293
                {
1294
                    ((TextBox)sender).Text = "";
1295
                }
1296
                else
1297
                {
1298

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

    
1304
        /// <summary>
1305
        /// 입력한 페이지로 이동한다
1306
        /// </summary>
1307
        /// <param name="sender"></param>
1308
        /// <param name="e"></param>
1309
        private void tlcurrentPage_readonly_KeyDown(object sender, KeyEventArgs e)
1310
        {
1311
            if (e.Key == Key.Enter)
1312
            {
1313
                try
1314
                {
1315
                    var instanceMain = this.ParentOfType<MainWindow>();
1316
                    instanceMain.dzMainMenu.pageNavigator.GotoPage(Convert.ToInt32(tlcurrentPage_readonly.Text));
1317
                }
1318
                catch (Exception)
1319
                {
1320
                    RadWindow.Alert(new DialogParameters
1321
                    {
1322
                        Owner = Application.Current.MainWindow,
1323
                        Theme = new VisualStudio2013Theme(),
1324
                        Header = "Info",
1325
                        Content = "Enter the correct page number.",
1326
                    });
1327
                }
1328
            }
1329
        }
1330
        
1331
        private void PanoramaEvent(object sender, RoutedEventArgs e)
1332
        {
1333
            PanoramaShow();
1334
        }
1335

    
1336
        public void PanoramaShow()
1337
        {
1338
            Panorama check = new Panorama();
1339
            double screenWidth = System.Windows.SystemParameters.PrimaryScreenWidth;
1340
            double screenHeight = System.Windows.SystemParameters.PrimaryScreenHeight;
1341
            //double windowWidth = this.Width;
1342
            //double windowHeight = this.Height;
1343

    
1344
            var PanoramaPop = new RadWindow
1345
            {
1346
                //MinWidth = 600,
1347
                //MinHeight = 400,
1348
                //Header = "My Check List",
1349
                Header = "Document No : " + this.ParentOfType<MainWindow>().dzMainMenu._DocItem.DOCUMENT_NO + " / Revision :" + this.ParentOfType<MainWindow>().dzMainMenu._DocItem.REVISION,
1350
                Content = check,
1351
                Owner = this,
1352
                ResizeMode = System.Windows.ResizeMode.CanResizeWithGrip,
1353
                //ResizeMode = System.Windows.ResizeMode.NoResize,
1354
                WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen,
1355
                IsTopmost = false,
1356
                //Left = (screenWidth / 2) - (windowWidth / 2),
1357
                //Top = (screenHeight / 2) - (windowHeight / 2),
1358
                //Left = (screenWidth / 2),
1359
                //Top = (screenHeight / 2),
1360
                Width = screenWidth * 0.4,
1361
                Height = screenHeight * 0.4,
1362
            };
1363
            StyleManager.SetTheme(PanoramaPop, new VisualStudio2013Theme());
1364
            //CheckPop.ShowDialog();
1365
            PanoramaPop.Owner = Application.Current.MainWindow;
1366
            PanoramaPop.Show();
1367
        }
1368

    
1369
        private void CheckEvent(object sender, RoutedEventArgs e)
1370
        {
1371
            //창이 떠있을 경우 재 실행 방지
1372
            if (isClosed)
1373
            {
1374
                //토글 및 마우스 상태 초기화
1375
                var toggleList = this.Parent.ChildrenOfType<RadToggleButton>();
1376
                foreach(var togle in toggleList)
1377
                {
1378
                    togle.IsChecked = false;
1379
                }
1380
                this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
1381

    
1382
                isClosed = false;
1383

    
1384
                
1385
                CheckList check = new CheckList(this.ParentOfType<MainWindow>());
1386

    
1387
                var CheckPop = new RadWindow
1388
                {
1389
                    MinWidth = 1200,
1390
                    MinHeight = 500,
1391
                    //Header = "My Check List",
1392
                    Header = "Document No : " + this.ParentOfType<MainWindow>().dzMainMenu._DocItem.DOCUMENT_NO + " / Revision :" + this.ParentOfType<MainWindow>().dzMainMenu._DocItem.REVISION,
1393
                    Content = check,
1394
                    //Owner = this,
1395
                    //ResizeMode = System.Windows.ResizeMode.CanResizeWithGrip,
1396
                    ResizeMode = System.Windows.ResizeMode.NoResize,
1397
                    WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen,
1398
                    IsTopmost = true,
1399
                };
1400
                StyleManager.SetTheme(CheckPop, new Office2013Theme());
1401
                CheckPop.Closed += CheckPop_Closed;
1402
                
1403
                //CheckPop.ShowDialog();
1404
                CheckPop.Show();
1405
            }
1406
        }
1407

    
1408
        private void SignManagerEvent(object sender, RoutedEventArgs e)
1409
        {
1410
            OpenSignManager();
1411
        }
1412

    
1413
        private void OpenSignManager()
1414
        { 
1415
            SignManager signManager = new SignManager();
1416

    
1417
            RadWindow signManagerPop = new RadWindow
1418
            {
1419
                MinWidth = 1200,
1420
                MinHeight = 500,
1421
                //Header = "My Check List",
1422
                Header = "",
1423
                Content = signManager,
1424
                Owner = this,
1425
                //ResizeMode = System.Windows.ResizeMode.CanResizeWithGrip,
1426
                ResizeMode = System.Windows.ResizeMode.CanResize,
1427
                WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen,
1428
            };
1429
            StyleManager.SetTheme(signManagerPop, new Office2013Theme());
1430

    
1431
            //CheckPop.ShowDialog();
1432
            signManagerPop.ShowDialog();
1433
        }
1434

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

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

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

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

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

    
1495
            //instanceToggle.IsChecked = false;
1496

    
1497
            switch (viewButton.CommandParameter.ToString())
1498
            {
1499
                case "zoomout":
1500
                    {
1501
                        //장원
1502
                        //instanceMain.dzMainMenu.zoomAndPanControl.ZoomTo(new Rect(0, 0, instanceMain.dzMainMenu.zoomAndPanCanvas.ActualWidth, instanceMain.dzMainMenu.zoomAndPanCanvas.ActualHeight));
1503
                        instanceMain.dzMainMenu.zoomAndPanControl.ZoomPointToViewportCenter(ViewerDataModel.Instance.ContentScale -= 0.1, point);
1504
                        viewButton.IsChecked = false;
1505
                        //Common.ViewerDataModel.Instance.zom
1506
                    }
1507
                    break;
1508
                case "zoomin":
1509
                    {
1510
                        instanceMain.dzMainMenu.zoomAndPanControl.ZoomPointToViewportCenter(ViewerDataModel.Instance.ContentScale += 0.1, point);
1511
                        viewButton.IsChecked = false;
1512
                    }
1513
                    break;             
1514
                case "fitWidth":
1515
                    {
1516
                        instanceMain.dzMainMenu.zoomAndPanControl.ScaleToFit();
1517
                        viewButton.IsChecked = false;
1518
                    }
1519
                    break;
1520
                case "fitHeight":
1521
                    {
1522
                        instanceMain.dzMainMenu.zoomAndPanControl.ScaleToFit();
1523
                        viewButton.IsChecked = false;
1524
                    }
1525
                    break;
1526
                case "boundzoom":
1527
                    {
1528

    
1529
                    }
1530
                    break;
1531
                case "Rotate_M":
1532
                    {
1533
                        drawingPannelRotate(false);
1534
                        viewButton.IsChecked = false;
1535
                    }
1536
                    break;
1537
                case "Rotate_P":
1538
                    {
1539
                        drawingPannelRotate(true);
1540
                        viewButton.IsChecked = false;
1541
                    }
1542
                    break;
1543
                case "Rotate_half":
1544
                    {
1545
                        drawingPannelRotate(true);
1546
                        drawingPannelRotate(true);
1547
                        viewButton.IsChecked = false;
1548
                    }
1549
                    break;
1550
                    //case "fullscreen":
1551
                    //    {
1552
                    //        instanceMain.WindowStyle = WindowStyle.None;
1553
                    //        instanceMain.WindowState = WindowState.Maximized;
1554
                    //        instanceMain.dzMainMenu.zoomAndPanControl.ScaleToFit();
1555
                    //        viewButton.IsChecked = false;
1556
                    //    }
1557
                    //    break;
1558
            }
1559
        }
1560

    
1561
        private void Control_Event(object sender, RoutedEventArgs e)
1562
        {
1563

    
1564
        }
1565

    
1566
        #region 대기
1567

    
1568
        public void drawingPannelRotate(bool Flag)
1569
        {
1570
            var instanceMain = this.ParentOfType<MainWindow>();
1571

    
1572
            //if (rotateOffSet > 3)
1573
            //    rotateOffSet = 0;
1574

    
1575
            //if (rotateOffSet < 0)
1576
            //    rotateOffSet = 3;
1577

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

    
1604
            if (instanceMain.dzMainMenu.zoomAndPanCanvas.Width == ViewerDataModel.Instance.ContentWidth)
1605
            {
1606
                double emptySize = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
1607
                instanceMain.dzMainMenu.zoomAndPanCanvas.Width = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
1608
                instanceMain.dzMainMenu.zoomAndPanCanvas.Height = emptySize;
1609
            }
1610

    
1611
            if (instanceMain.dzMainMenu.rotate.Angle == 0)
1612
            {
1613
                instanceMain.dzMainMenu.translate.X = 0;
1614
                instanceMain.dzMainMenu.translate.Y = 0;
1615
            }
1616
            else if (instanceMain.dzMainMenu.rotate.Angle == 90)
1617
            {
1618
                instanceMain.dzMainMenu.translate.X = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
1619
                instanceMain.dzMainMenu.translate.Y = 0;
1620
            }
1621
            else if (instanceMain.dzMainMenu.rotate.Angle == 180)
1622
            {
1623
                instanceMain.dzMainMenu.translate.X = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
1624
                instanceMain.dzMainMenu.translate.Y = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
1625
            }
1626
            else
1627
            {
1628
                instanceMain.dzMainMenu.translate.X = 0;
1629
                instanceMain.dzMainMenu.translate.Y = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
1630
            }
1631

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

    
1637

    
1638
            //instanceMain.dzMainMenu.imageViewer.RenderTransformOrigin = new Point(0.5, 0.5);
1639
            //RotateTransform rotateTransform = new RotateTransform(instanceMain.dzMainMenu.rotate.Angle);
1640
            //instanceMain.dzMainMenu.imageViewer.RenderTransform = rotateTransform;
1641

    
1642

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

    
1654

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

    
1658
            foreach (var data in thumbnaillist)
1659
            {
1660
                data.Angle = int.Parse(instanceMain.dzMainMenu.rotate.Angle.ToString());
1661

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

    
1666
                instanceMain.dzMainMenu.pageNavigator.GotoPage(data.PageNumber);
1667

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

    
1682
        private void ImageConverter(RadToggleButton instanceToggle)
1683
        {
1684
            try
1685
            {           
1686
                var instanceMain = this.ParentOfType<MainWindow>();
1687

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

    
1696
                    System.IO.FileInfo fileInfo = new System.IO.FileInfo(instanceMain.dzMainMenu.filename);
1697
                    String strFile = System.IO.Path.GetFileName(instanceMain.dzMainMenu.filename);
1698
                    long numByte = fileInfo.Length;
1699
                    double dLen = Convert.ToDouble(fileInfo.Length / 1000000);
1700
                    kr.co.devdoftech.cloud.FileUpload fileUploader = App.FileUploader;
1701
             
1702
                    if (dLen < 4)
1703
                    {
1704
                        System.IO.FileStream fStream = new System.IO.FileStream(instanceMain.dzMainMenu.filename, System.IO.FileMode.Open, System.IO.FileAccess.Read);
1705
                        System.IO.BinaryReader br = new System.IO.BinaryReader(fStream);
1706
                        byte[] data = br.ReadBytes((int)numByte);
1707
                        br.Close();
1708

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

    
1711
                        Check_Uri.UriCheck(filepath);
1712

    
1713
                        instanceMain.dzMainMenu.filename = filepath;
1714

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

    
1742
                this.ParentOfType<MainWindow>().DialogMessage_Alert(ex.Message, "Alert");
1743
            }
1744
        }
1745

    
1746
        private void Control_Init(RadToggleButton instanceToggle, object sender)
1747
        {
1748

    
1749
        }
1750

    
1751
        private void ControlEvent(object sender, RoutedEventArgs e)
1752
        {
1753
            RadToggleButton instanceToggle = sender as RadToggleButton;
1754
            var instanceMain = this.ParentOfType<MainWindow>();
1755

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

    
1776
            //if (!instanceMain.IsFreeSelectionMode)
1777
            //{
1778
            //    instanceMain.IsSwingMode = true;
1779
            //}
1780

    
1781
            //#region 다른 컨트롤 버튼 선택 해제
1782
            //System.Reactive.Linq.Observable2.FromPropertyChangedPattern(Common.ViewerDataModel.Instance, temp => temp.SelectedControl).Subscribe(ControlState =>
1783
            //{
1784
            //    if (ControlState == null)
1785
            //    {
1786
            //        instanceToggle.IsChecked = false;
1787
            //        HiddenControlHide();
1788
            //    }
1789
            //});
1790
            //#endregion
1791

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

    
1794
            if (instanceToggle != null)
1795
            {
1796
                Common.ViewerDataModel.Instance.ControlTag = instanceToggle.Tag.ToString();
1797
            }
1798
            else if ((sender as RadRibbonToggleButton) != null)
1799
            {
1800
                Common.ViewerDataModel.Instance.ControlTag = (sender as RadRibbonToggleButton).Tag.ToString();
1801
                instanceToggle = (sender as RadRibbonToggleButton);
1802
            }
1803
            else if ((sender as RadRibbonButton) != null)
1804
            {
1805
                RadRibbonButton instanceButton = sender as RadRibbonButton;
1806
                Common.ViewerDataModel.Instance.ControlTag = instanceButton.Tag.ToString();
1807
            }
1808
            else
1809
            {
1810
                RadButton instanceButton = sender as RadButton;
1811
                Common.ViewerDataModel.Instance.ControlTag = instanceButton.Tag.ToString();
1812
            }
1813

    
1814

    
1815
            //System.Reactive.Linq.Observable2.FromPropertyChangedPattern(Common.ViewerDataModel.Instance, temp => temp.AngleVisibility).Subscribe(isSee =>
1816
            //{
1817
            //    if (instanceToggle.CommandParameter.ToString() == "ChainLine")
1818
            //    {
1819

    
1820
            //    }
1821
            //    else
1822
            //    {
1823
            //        System.Diagnostics.Debug.WriteLine(" instanceMain.dzMainMenu.MainAngle.Visibility   " + isSee);
1824

    
1825
            //        if (instanceMain.dzMainMenu.MainAngle.Visibility != isSee)
1826
            //        {
1827
            //            instanceMain.dzMainMenu.MainAngle.Visibility = isSee;
1828
            //        }
1829
            //    }
1830
            //    //System.Reactive.Linq.Observable2.FromPropertyChangedPattern(Common.ViewerDataModel.Instance, temp => temp.AngleValue).Subscribe(p =>
1831
            //    //{
1832
            //    //    instanceMain.dzMainMenu.MainAngle.AngleValue = p;
1833
            //    //});
1834
            //});
1835

    
1836
            instanceMain.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Drawing;
1837

    
1838
            instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = false;
1839

    
1840
            if (instanceToggle.IsChecked != false)
1841
            {
1842
                string param = instanceToggle.CommandParameter.ToString();
1843
                string MacroIndex = "";
1844

    
1845
                if (param.StartsWith("MACRO"))
1846
                {
1847
                    param = "MACRO";
1848
                    MacroIndex = param.Replace("MACRO;","");
1849

    
1850
                    //Common.ViewerDataModel.Instance.MacroItems = MacroHelper.LoadMacroItems(MacroIndex);
1851
                    //var items = MacroHelper.TopMenuItems();
1852

    
1853
                    Common.ViewerDataModel.Instance.MacroItems = new List<MacroItem>
1854
                    {
1855
                        new MacroItem
1856
                        {
1857
                            Desc = "Cloud Rectangle",
1858
                            ControlType = MarkupToPDF.Controls.Common.ControlType.RectCloud
1859
                        },
1860
                        new MacroItem
1861
                        {
1862
                             Desc = "Arrow TextBox",
1863
                            ControlType = MarkupToPDF.Controls.Common.ControlType.ArrowTextBorderControl
1864
                        }
1865
                    };
1866
                }
1867

    
1868
                #region 컨트롤이 체크되었다면
1869
                switch (param)
1870
                {
1871
                    #region Line
1872
                    case "Line":
1873
                        Common.ViewerDataModel.Instance.SelectedControl = "Line";
1874
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1875
                        if (instanceToggle.Tag.ToString() == "LineDelete")
1876
                        {
1877
                            //HiddenInterval.Visibility = Visibility.Visible;
1878
                        }
1879
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.SingleLine;
1880
                        break;
1881
                    #endregion
1882
                    #region ChainLine
1883
                    case "ChainLine":
1884
                        Common.ViewerDataModel.Instance.SelectedControl = "ChainLine";
1885
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1886
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ChainLine;
1887
                        break;
1888
                    #endregion
1889
                    #region DimLine
1890
                    case "DimLine":
1891
                        Common.ViewerDataModel.Instance.SelectedControl = "DimLine";
1892
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1893
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.DimLine;
1894
                        break;
1895
                    #endregion
1896
                    #region TwinLine
1897
                    case "TwinLine":
1898
                        Common.ViewerDataModel.Instance.SelectedControl = "TwinLine";
1899
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1900
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.TwinLine;
1901
                        break;
1902
                    #endregion
1903
                    #region CancelLine
1904
                    case "CancelLine":
1905
                        Common.ViewerDataModel.Instance.SelectedControl = "CancelLine";
1906
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1907
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.CancelLine;
1908
                        break;
1909
                    #endregion
1910
                    #region PolygonCloud
1911
                    case "PolygonCloud":
1912
                        Common.ViewerDataModel.Instance.SelectedControl = "PolygonCloud";
1913
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1914
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.PolygonCloud;
1915
                        break;
1916
                    #endregion
1917
                    #region RectCloud
1918
                    case "RectCloud":
1919
                        Common.ViewerDataModel.Instance.SelectedControl = "RectCloud";
1920
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1921
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.RectCloud;
1922
                        break;
1923
                    #endregion
1924
                    #region Rectangle
1925
                    case "Rectangle":
1926
                        Common.ViewerDataModel.Instance.SelectedControl = "Rectangle";
1927
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1928
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Rectangle;
1929
                        break;
1930
                    #endregion
1931
                    #region Triangle
1932
                    case "Triangle":
1933
                        Common.ViewerDataModel.Instance.SelectedControl = "Triangle";
1934
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1935
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Triangle;
1936
                        break;
1937
                    #endregion
1938
                    #region RectCloud
1939
                    case "Circle":
1940
                        Common.ViewerDataModel.Instance.SelectedControl = "Circle";
1941
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1942
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Circle;
1943
                        break;
1944
                    #endregion
1945
                    #region Symbol
1946
                    case "Symbol":
1947
                        Common.ViewerDataModel.Instance.SelectedControl = "Symbol";
1948
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
1949
                        break;
1950
                    #endregion
1951
                    #region SymbolN
1952
                    case "SymbolN":
1953
                        Common.ViewerDataModel.Instance.SelectedControl = "SymbolN";
1954
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Stamp;
1955
                        break;
1956
                    #endregion
1957
                    #region Text
1958
                    case "Text":
1959
                        Common.ViewerDataModel.Instance.SelectedControl = "Text";
1960
                        TaskMessage("Text 도구는 텍스트 영역을 더블 클릭하여 텍스트를 재 편집 할 수 있습니다", TaskMessageType.Normal);
1961
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.TextControl;
1962
                        break;
1963
                    #endregion
1964
                    #region TextBorder
1965
                    case "TextBorder":
1966
                        Common.ViewerDataModel.Instance.SelectedControl = "TextBorder";
1967
                        TaskMessage("Text 도구는 텍스트 영역을 더블 클릭하여 텍스트를 재 편집 할 수 있습니다", TaskMessageType.Normal);
1968
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.TextBorder;
1969
                        break;
1970
                    #endregion
1971
                    #region TextCloud
1972
                    case "TextCloud":
1973
                        Common.ViewerDataModel.Instance.SelectedControl = "TextCloud";
1974
                        TaskMessage("Text 도구는 텍스트 영역을 더블 클릭하여 텍스트를 재 편집 할 수 있습니다", TaskMessageType.Normal);
1975
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.TextCloud;
1976
                        break;
1977
                    #endregion
1978
                    #region Date
1979
                    case "Date":
1980
                        Common.ViewerDataModel.Instance.SelectedControl = "Date";
1981
                        TaskMessage("날짜 컨트롤을 더블 클릭하면 날짜를 변경할 수 있습니다", TaskMessageType.Normal);
1982
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Date;
1983
                        break;
1984
                    #endregion
1985
                    #region ArrowText
1986
                    case "ArrowText":
1987
                        TaskMessage("ArrowText 컨트롤은 그린 후 컨트롤을 선택하였을 시 중간점을 조정할 수 있습니다", TaskMessageType.Normal);
1988
                        if (instanceToggle.Tag.ToString() == "ArrowText_Cloud")
1989
                        {
1990
                            Common.ViewerDataModel.Instance.SelectedControl = "ArrowText_Cloud";
1991
                            instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowTextCloudControl;
1992
                        }
1993
                        else if (instanceToggle.Tag.ToString() == "ArrowText_Border")
1994
                        {
1995
                            Common.ViewerDataModel.Instance.SelectedControl = "ArrowTextBorderControl";
1996
                            instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowTextBorderControl;
1997
                        }
1998
                        else if (instanceToggle.Tag.ToString() == "ArrowTextFix_Normal")
1999
                        {
2000
                            Common.ViewerDataModel.Instance.SelectedControl = "ArrowTransTextControl";
2001
                            instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowTransTextControl;
2002
                        }
2003
                        else if (instanceToggle.Tag.ToString() == "ArrowTextFix_Border")
2004
                        {
2005
                            Common.ViewerDataModel.Instance.SelectedControl = "ArrowTransTextBorderControl";
2006
                            instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowTransTextBorderControl;
2007
                        }
2008
                        else if (instanceToggle.Tag.ToString() == "ArrowTextFix_Cloud")
2009
                        {
2010
                            Common.ViewerDataModel.Instance.SelectedControl = "ArrowTransTextCloudControl";
2011
                            instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowTransTextCloudControl;
2012
                        }
2013
                        else
2014
                        {
2015
                            Common.ViewerDataModel.Instance.SelectedControl = "ArrowText";
2016
                            instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowTextControl;
2017
                            //HiddenAxisLock.Visibility = Visibility.Visible;
2018
                        }
2019
                        break;
2020
                    #endregion
2021
                    #region Arrow
2022
                    case "Arrow":
2023
                        Common.ViewerDataModel.Instance.SelectedControl = "Arrow";
2024
                        //HiddenAxisLock.Visibility = Visibility.Visible;
2025
                        //HiddenDimSize.Visibility = Visibility.Visible;
2026
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowLine;
2027
                        break;
2028
                    #endregion
2029
                    #region Shape
2030
                    case "Shape":
2031
                        Common.ViewerDataModel.Instance.SelectedControl = "Shape";
2032
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Mark;
2033
                        break;
2034
                    #endregion
2035
                    #region Polygon
2036
                    case "Polygon":
2037
                        Common.ViewerDataModel.Instance.SelectedControl = "Polygon";
2038
                        TaskMessage("자유형 코멘트 도구는 오른쪽 마우스 클릭을 통해 그리기를 마칠 수 있습니다", TaskMessageType.Normal);
2039
                        //HiddenAxisLock.Visibility = Visibility.Visible;
2040
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.PolygonControl;
2041
                        break;
2042
                    #endregion
2043
                    #region Arc
2044
                    case "Arc":
2045
                        Common.ViewerDataModel.Instance.SelectedControl = "Arc";
2046
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArcLine;
2047
                        //HiddenAxisLock.Visibility = Visibility.Visible;
2048
                        TaskMessage("Arc 코멘트 도구는 오른쪽 마우스를 사용해 좌우 반전을 사용하실 수 있습니다", TaskMessageType.Normal);
2049
                        break;
2050
                    #endregion
2051
                    #region ArrowArc
2052
                    case "ArrowArc":
2053
                        Common.ViewerDataModel.Instance.SelectedControl = "ArrowArc";
2054
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArcArrow;
2055
                        //HiddenAxisLock.Visibility = Visibility.Visible;
2056
                        TaskMessage("ArcArrow 코멘트 도구는 오른쪽 마우스를 사용해 좌우 반전을 사용하실 수 있습니다", TaskMessageType.Normal);
2057
                        break;
2058
                    #endregion
2059
                    #region ArrowMulti
2060
                    case "ArrowMulti":
2061
                        Common.ViewerDataModel.Instance.SelectedControl = "ArrowMulti";
2062
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowMultiLine;
2063
                        //HiddenAxisLock.Visibility = Visibility.Visible;
2064
                        break;
2065
                    #endregion
2066
                    #region Etc
2067
                    case "Etc":
2068
                        Common.ViewerDataModel.Instance.SelectedControl = "Etc";
2069
                        break;
2070
                    #endregion
2071
                    #region Ink
2072
                    case "Ink":
2073
                        if (instanceToggle.Tag.ToString() == "EraserClear")
2074
                        {
2075
                            TaskMessage("해당 컨트롤은 점 단위로 그려진 펜을 지웁니다", TaskMessageType.Normal);
2076
                            //instanceMain.dzMainMenu.inkDrawingCanvas.EditingMode = InkCanvasEditingMode.EraseByPoint;
2077
                            instanceMain.dzMainMenu.inkBoard.Tag = "EraseByPoint";
2078
                        }
2079
                        else if (instanceToggle.Tag.ToString() == "Eraser")
2080
                        {
2081
                            TaskMessage("해당 컨트롤은 선 단위로 그려진 펜을 지웁니다", TaskMessageType.Normal);
2082
                            instanceMain.dzMainMenu.inkBoard.Tag = "EraseByStroke";
2083
                            //instanceMain.dzMainMenu.inkDrawingCanvas.EditingMode = InkCanvasEditingMode.EraseByStroke;
2084
                        }
2085
                        else
2086
                        {
2087
                            instanceMain.dzMainMenu.inkBoard.Tag = "Ink";
2088
                            //instanceMain.dzMainMenu.inkDrawingCanvas.EditingMode = InkCanvasEditingMode.Ink;
2089
                        }
2090

    
2091
                        //instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = true;
2092

    
2093
                        Common.ViewerDataModel.Instance.SelectedControl = "Ink";
2094
                        Common.ViewerDataModel.Instance.LineSize = (double)cbLineSize.Value;
2095
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.PenControl;
2096
                        break;
2097
                    #endregion
2098
                    #region Select
2099
                    case "Select":
2100
                        if (this.ParentOfType<MainWindow>().dzMainMenu.currentControl != null)
2101
                        {
2102
                            if (this.ParentOfType<MainWindow>().dzMainMenu.currentControl is MarkupToPDF.Controls.Text.TextControl
2103
                                && !string.IsNullOrEmpty(((MarkupToPDF.Controls.Text.TextControl)this.ParentOfType<MainWindow>().dzMainMenu.currentControl).Text))
2104
                            {
2105
                                DependencyObject focusScope1 = FocusManager.GetFocusScope((MarkupToPDF.Controls.Text.TextControl)this.ParentOfType<MainWindow>().dzMainMenu.currentControl);
2106
                                FocusManager.SetFocusedElement(focusScope1, (MarkupToPDF.Controls.Text.TextControl)this.ParentOfType<MainWindow>().dzMainMenu.currentControl);
2107

    
2108
                                this.ParentOfType<MainWindow>().dzMainMenu.currentControl = null;
2109
                                Keyboard.ClearFocus();
2110

    
2111
                            }
2112
                            else
2113
                            {
2114
                                ViewerDataModel.Instance.MarkupControls_USER.Remove(this.ParentOfType<MainWindow>().dzMainMenu.currentControl);
2115
                                this.ParentOfType<MainWindow>().dzMainMenu.currentControl = null;
2116
                            }
2117
                        }
2118

    
2119
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Selecting;
2120
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2121
                        instanceMain.dzMainMenu.isLeftMouseButtonDownOnWindow = false;
2122
                        break;
2123
                    #endregion
2124
                    #region Image
2125
                    case "Image":
2126
                        Common.ViewerDataModel.Instance.SelectedControl = "ImgControl";
2127
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ImgControl;
2128
                        ImageConverter(instanceToggle);
2129
                        break;
2130
                    #endregion
2131
                    #region Sign
2132
                    case "Sign":
2133
                        Common.ViewerDataModel.Instance.SelectedControl = "Sign";
2134
                        Common.ViewerDataModel.Instance.ControlTag = instanceMain.dzMainMenu._ViewInfo.UserID; //사번
2135
                        //강인구 추가
2136
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Sign;
2137
                        //instanceMain.BaseClient.GetUserSignCompleted += (sen, ea) =>
2138
                        //{
2139
                        //    if (ea.Result == null)
2140
                        //    {
2141

    
2142
                        //        this.ParentOfType<MainPage>().DialogMessage_Alert("You Don't Have Sign Data", "Alert");
2143
                        //    }
2144
                        //    else
2145
                        //    {
2146
                        //        byte[] imageBytes = System.Convert.FromBase64String(ea.Result);
2147
                        //        using (MemoryStream ms = new MemoryStream(imageBytes))
2148
                        //        {
2149
                        //            BitmapImage im = new BitmapImage();
2150
                        //            im.SetSource(ms);
2151
                        //            instanceMain.DeepLayer.SignImage = im;
2152
                        //            ms.Close();
2153
                        //        }
2154
                        //    }
2155
                        //};
2156
                        //instanceMain.BaseClient.GetUserSignAsync(instanceMain._ViewInfo.UserID);
2157
                        break;
2158
                    #endregion
2159
                    #region Check
2160
                    case "Check":
2161
                        Common.ViewerDataModel.Instance.SelectedControl = "Check";
2162
                        Common.ViewerDataModel.Instance.ControlTag = instanceMain.dzMainMenu._ViewInfo.UserID; //사번
2163
                        //강인구 추가
2164
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Symbol;
2165
                        break;
2166
                    #endregion
2167
                    #region Batch
2168
                    case "Batch":
2169
                        Common.ViewerDataModel.Instance.SelectedControl = "Batch";
2170
                        Common.ViewerDataModel.Instance.ControlTag = instanceMain.dzMainMenu._ViewInfo.UserID; //사번
2171
                        //강인구 추가
2172
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Mark;
2173
                        instanceMain.dzMainMenu.txtBatch.Visibility = Visibility.Visible;
2174
                        instanceMain.dzMainMenu.txtBatch.Text = "Place Mark";
2175
                        break;
2176
                    #endregion
2177

    
2178
                    #region MACRO -MACRO1
2179
                    case "MACRO":
2180
                        Common.ViewerDataModel.Instance.SelectedControl = "MACRO";
2181
                        Common.ViewerDataModel.Instance.ControlTag = instanceMain.dzMainMenu._ViewInfo.UserID; //사번
2182

    
2183
                        MacroHelper.MacroAction();
2184

    
2185
                        break;
2186
                    #endregion
2187

    
2188
                    #region Copy
2189
                    case "Copy":
2190
                        CopyCommand.Instance.Execute();
2191
                        //Copy_Start();
2192
                        instanceToggle.IsChecked = false;
2193
                        ViewerDataModel.Instance.SelectedControl = "";
2194
                        ViewerDataModel.Instance.ControlTag = null;
2195
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2196
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2197
                        break;
2198
                    #endregion
2199
                    #region Cut
2200
                    case "Cut":
2201
                        CutCommand.Instance.Execute();
2202
                        instanceToggle.IsChecked = false;
2203
                        ViewerDataModel.Instance.SelectedControl = "";
2204
                        ViewerDataModel.Instance.ControlTag = null;
2205
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2206
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2207
                        break;
2208
                    #endregion
2209
                    #region Paste
2210
                    case "Paste":
2211
                        PasteCommand.Instance.Execute();
2212
                        //Paste_Start();
2213
                        instanceToggle.IsChecked = false;
2214
                        ViewerDataModel.Instance.SelectedControl = "";
2215
                        ViewerDataModel.Instance.ControlTag = null;
2216
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2217
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;                        
2218
                        break;
2219
                    #endregion
2220
                    #region Delete
2221
                    case "Delete":
2222
                        UndoCommand.Instance.Push(EventType.Delete, SelectionSet.Instance.SelectedItems);
2223
                        this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Clear();
2224

    
2225
                        instanceToggle.IsChecked = false;
2226
                        ViewerDataModel.Instance.SelectedControl = "";
2227
                        ViewerDataModel.Instance.ControlTag = null;
2228
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2229
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2230
                        break;
2231
                    #endregion
2232
                    #region Undo
2233
                    case "Undo":
2234
                        UndoCommand.Instance.Execute();
2235
                        instanceToggle.IsChecked = false;
2236
                        ViewerDataModel.Instance.SelectedControl = "";
2237
                        ViewerDataModel.Instance.ControlTag = null;
2238
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2239
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2240
                        break;
2241
                    #endregion
2242
                    #region Redo
2243
                    case "Redo":
2244
                        RedoCommand.Instance.Execute();
2245
                        instanceToggle.IsChecked = false;
2246
                        ViewerDataModel.Instance.SelectedControl = "";
2247
                        ViewerDataModel.Instance.ControlTag = null;
2248
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2249
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2250
                        break;
2251
                    #endregion
2252
                    #region DragZoom
2253
                    case "DragZoom":
2254
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.DragZoom;
2255
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2256
                        instanceMain.dzMainMenu.isLeftMouseButtonDownOnWindow = false;
2257
                        break;
2258
                    #endregion
2259
                    #region Grouping
2260
                    case "Group":
2261
                        //var GrouptoggleList = this.Parent.ChildrenOfType<RadRibbonToggleButton>();
2262
                        //foreach (var togle in GrouptoggleList)
2263
                        //{
2264
                        //    togle.IsChecked = false;
2265
                        //}
2266

    
2267
                        //if (this.ParentOfType<MainWindow>().dzMainMenu.currentControl != null)
2268
                        //{
2269
                        //    ViewerDataModel.Instance.MarkupControls_USER.Remove(this.ParentOfType<MainWindow>().dzMainMenu.currentControl);
2270
                        //    this.ParentOfType<MainWindow>().dzMainMenu.currentControl = null;
2271
                        //}
2272
                        //this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2273
                        //instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2274
                        //instanceMain.dzMainMenu.isLeftMouseButtonDownOnWindow = false;
2275
                        //if (ViewerDataModel.Instance.SystemMain.dzMainMenu.SelectLayer.Children.Count < 1) //선택된 것이 없으면
2276
                        //{
2277
                        //    this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert("Please Select Controls", "Alert");
2278
                        //}
2279
                        //else//if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
2280
                        //{
2281
                        //    // string MarkupData = "";
2282
                        //    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
2283
                        //    {
2284
                        //        if (item.GetType().Name == "AdornerFinal" && (item as AdornerFinal).MemberSet.Count >= 2) // 얘가 2개 이상이여야 그룹가능 버튼도 막을거긴하지만 일단..
2285
                        //        {
2286
                        //            //MARKUP_DATA_GROUP INSERT
2287
                        //            MARKUP_DATA_GROUP mARKUP_DATA_GROUP = new MARKUP_DATA_GROUP
2288
                        //            {
2289
                        //                SYMBOL_ID = null,//InnerItem.Symbol_ID
2290
                        //                STATE = 0,
2291
                        //            };
2292
                        //            long group_id = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.AddMarkupDataGroup(mARKUP_DATA_GROUP, App.ViewInfo.ProjectNO);
2293
                        //            //Logger.sendReqLog("AddMarkupDataGroup: ", "", 1);
2294
                        //            if (group_id > 0)
2295
                        //            {
2296
                        //                foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
2297
                        //                {
2298
                        //                    if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
2299
                        //                    {
2300
                        //                        //MARKUP_DATA UPDATE
2301
                        //                        //Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.UpdateMarkupData((InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo).CommentID, group_id, App.ViewInfo.ProjectNO);
2302
                        //                        ////Logger.sendReqLog("UpdateMarkupData: ", "", 1);
2303
                        //                        ViewerDataModel.Instance.MyMarkupList.Where(d => d.ID == (InnerItem.DrawingData as CommentUserInfo).CommentID).FirstOrDefault().Group_ID = group_id;
2304
                        //                        ViewerDataModel.Instance.MyMarkupList.Where(d => d.ID == (InnerItem.DrawingData as CommentUserInfo).CommentID).FirstOrDefault().IsUpdate = true;
2305
                        //                    }
2306
                        //                }
2307
                        //            }
2308
                        //        }
2309
                        //    }
2310
                        //}
2311
                        break;
2312
                    case "UnGroup":
2313
                        //var UnGrouptoggleList = this.Parent.ChildrenOfType<RadRibbonToggleButton>();
2314
                        //foreach (var togle in UnGrouptoggleList)
2315
                        //{
2316
                        //    togle.IsChecked = false;
2317
                        //}
2318
                        //if (this.ParentOfType<MainWindow>().dzMainMenu.currentControl != null)
2319
                        //{
2320
                        //    ViewerDataModel.Instance.MarkupControls_USER.Remove(this.ParentOfType<MainWindow>().dzMainMenu.currentControl);
2321
                        //    this.ParentOfType<MainWindow>().dzMainMenu.currentControl = null;
2322
                        //}
2323
                        //this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2324
                        //instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2325
                        //instanceMain.dzMainMenu.isLeftMouseButtonDownOnWindow = false;
2326

    
2327
                        //if (ViewerDataModel.Instance.SystemMain.dzMainMenu.SelectLayer.Children.Count < 1) //선택된 것이 없으면
2328
                        //{
2329
                        //    this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert("Please Select Controls", "Alert");
2330
                        //}
2331
                        //else//if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
2332
                        //{
2333
                        //    // string MarkupData = "";
2334
                        //    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
2335
                        //    {
2336
                        //        if (item.GetType().Name == "AdornerFinal" && (item as AdornerFinal).MemberSet.Count >= 1) // 1개 이상 
2337
                        //        {
2338
                        //            //MARKUP_DATA UPDATE
2339
                        //            foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
2340
                        //            {
2341
                        //                if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
2342
                        //                {
2343
                        //                    long group_id = ViewerDataModel.Instance.MyMarkupList.Where(d => d.ID == (InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo).CommentID).FirstOrDefault().Group_ID;
2344
                        //                    //MARKUP_DATA UPDATE
2345
                        //                    //Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.UpdateMarkupData((InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo).CommentID, 0, App.ViewInfo.ProjectNO);
2346
                        //                    ////Logger.sendReqLog("UpdateMarkupData: ", "", 1);
2347
                        //                    ViewerDataModel.Instance.MyMarkupList.Where(d => d.ID == (InnerItem.DrawingData as CommentUserInfo).CommentID).FirstOrDefault().Group_ID = 0;
2348
                        //                    ViewerDataModel.Instance.MyMarkupList.Where(d => d.ID == (InnerItem.DrawingData as CommentUserInfo).CommentID).FirstOrDefault().IsUpdate = true;
2349

    
2350

    
2351
                        //                    //MARKUP_DATA_GROUP UPDATE
2352
                        //                    //bool value = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.UpdateMarkupDataGroup(group_id, App.ViewInfo.ProjectNO);
2353
                        //                    ////Logger.sendReqLog("AddMarkupDataGroup: ", value.ToString(), 1);
2354
                        //                }
2355
                        //            }
2356
                        //        }
2357
                        //    }
2358
                        //}
2359
                        break;
2360
                    #endregion
2361
                    #region Capture
2362
                    case "Capture":
2363
                        SyncInit();
2364
                        //   instanceToggle.IsChecked = false;
2365
                        var CaptureList = this.Parent.ChildrenOfType<RadRibbonToggleButton>();
2366
                        foreach (var togle in CaptureList)
2367
                        {
2368
                            togle.IsChecked = false;
2369
                        }
2370

    
2371
                        if (this.ParentOfType<MainWindow>().dzMainMenu.currentControl != null)
2372
                        {
2373
                            ViewerDataModel.Instance.MarkupControls_USER.Remove(this.ParentOfType<MainWindow>().dzMainMenu.currentControl);
2374
                            this.ParentOfType<MainWindow>().dzMainMenu.currentControl = null;
2375
                        }
2376

    
2377
                        ViewerDataModel.Instance.SelectedControl = "ImgControl";
2378
                   //     ViewerDataModel.Instance.ControlTag = null;
2379
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ImgControl;
2380

    
2381
                        /*
2382
                        //캡쳐 하기 전에 코멘트 저장
2383
                        if (Common.ViewerDataModel.Instance.MarkupControls_USER.Count > 0 || (Application.Current.MainWindow as MainWindow).dzMainMenu.SelectLayer.Children.Count > 0)
2384
                        {
2385
                            var menu = (Application.Current.MainWindow as MainWindow).dzMainMenu;
2386
                            menu.ReleaseAdorner();
2387
                            if (menu.PreviewUserMarkupInfoItem != null && menu.PreviewUserMarkupInfoItem.IsPreviewUser == true)
2388
                            {
2389
                                (Application.Current.MainWindow as MainWindow).dzTopMenu.RefactoryCommentReact(menu);
2390
                            }
2391
                            else if (menu.gridViewMarkup.SelectedItems.Count == 0 || (menu.gridViewMarkup.SelectedItems.FirstOrDefault() as IKCOM.MarkupInfoItem).UserID != App.ViewInfo.UserID)
2392
                            {
2393

    
2394
                            }
2395
                            else
2396
                            {
2397
                                (Application.Current.MainWindow as MainWindow).dzTopMenu.RefactoryCommentReact(menu);
2398
                            }
2399
                        }*/
2400

    
2401
                        //Common.ViewerDataModel.Instance.CheckList_ID = ((e.Source as Telerik.Windows.Controls.RadButton).DataContext as Customer).ID;
2402
                        //Common.ViewerDataModel.Instance.CheckList_ID = ((e.Source as Image).DataContext as Customer).ID;
2403
                        //Common.ViewerDataModel.Instance.PageNumber = ((e.Source as Image).DataContext as Customer).PAGENUMBER;
2404
                        Application.Current.MainWindow.Focus();
2405
                        Common.ViewerDataModel.Instance.Capture_Opacity = 0.49;
2406
                        (Application.Current.MainWindow as MainWindow).dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Capture;
2407
                        break;
2408
                    #endregion
2409
                    #region Cad
2410
                    case "Inside":
2411
                        //instanceMain.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Drawing;
2412
                        //instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = false;
2413
                        Common.ViewerDataModel.Instance.SelectedControl = "InsideWhite";
2414
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.InsideWhite;
2415
                        break;
2416
                    case "Overlap":
2417
                        //instanceMain.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Drawing;
2418
                        //instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = false;
2419
                        Common.ViewerDataModel.Instance.SelectedControl = "OverlapWhite";
2420
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.OverlapWhite;
2421
                        break;
2422
                    case "Clip":
2423
                        //instanceMain.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Drawing;
2424
                        //instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = false;
2425
                        Common.ViewerDataModel.Instance.SelectedControl = "ClipWhite";
2426
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ClipWhite;
2427
                        break;
2428
                    case "CadExport":
2429
                        //if (isClosed)
2430
                        //{
2431
                        //    //토글 및 마우스 상태 초기화
2432
                        //    var toggleList = this.Parent.ChildrenOfType<RadRibbonToggleButton>();
2433
                        //    foreach (var togle in toggleList)
2434
                        //    {
2435
                        //        togle.IsChecked = false;
2436
                        //    }
2437
                        //    this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2438

    
2439
                        //    isClosed = false;
2440
                        //    //Control 파일 먼저 생성
2441
                        //    CollapsedButton_Click();
2442
                        //    CadViewer check = new CadViewer();
2443
                        //    check.WindowStartupLocation = WindowStartupLocation.CenterScreen;
2444
                        //    check.Title = "Export Viewer";
2445
                        //    //check.Topmost = true;
2446
                        //    check.Show();
2447
                        //    check.Closed += Check_Closed;
2448
                        //    instanceToggle.IsChecked = false;
2449
                        //}
2450
                        //break;
2451
                    case "CadViewer":
2452
                        //if (isClosed)
2453
                        //{
2454
                        //    //토글 및 마우스 상태 초기화
2455
                        //    var toggleList = this.Parent.ChildrenOfType<RadRibbonToggleButton>();
2456
                        //    foreach (var togle in toggleList)
2457
                        //    {
2458
                        //        togle.IsChecked = false;
2459
                        //    }
2460
                        //    this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2461

    
2462
                        //    isClosed = false;
2463
                        //    CadResultViewer check = new CadResultViewer();
2464
                        //    check.WindowStartupLocation = WindowStartupLocation.CenterScreen;
2465
                        //    check.Title = "Viewer";
2466
                        //    check.Show();
2467

    
2468
                        //    check.Closed += Check_Closed;
2469

    
2470
                        //}
2471
                        break;
2472
                    #endregion
2473
                    default:
2474
                        break;
2475
                }
2476
                #endregion
2477
            }
2478
            else
2479
            {
2480
                if (Common.ViewerDataModel.Instance.IsMacroCommand)
2481
                {
2482
                    MacroHelper.Clear();
2483
                }
2484

    
2485
                if (!instanceMain.dzMainMenu.IsFreeSelectionMode)
2486
                {
2487
                    instanceMain.dzMainMenu.IsSwingMode = false;
2488
                    Common.ViewerDataModel.Instance.SelectedControl = "";
2489
                    Common.ViewerDataModel.Instance.ControlTag = null;
2490
                    this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2491
                    this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2492
                }
2493
            }
2494

    
2495
        }
2496

    
2497
        private void SyncInit()
2498
        {
2499
            try
2500
            {
2501
                if (!ViewerDataModel.Instance.SystemMain.dzMainMenu.testPanel2.IsHidden)
2502
                {
2503
                    ViewerDataModel.Instance.SystemMain.dzMainMenu.testPanel2.IsHidden = true;
2504
                    ViewerDataModel.Instance.PageBalanceMode = false;
2505
                    ViewerDataModel.Instance.PageBalanceNumber = 0;
2506
                    ViewerDataModel.Instance.SyncPageNumber = 0;
2507
                    ViewerDataModel.Instance.MarkupControls_Sync.Clear();
2508
                    ViewerDataModel.Instance.SystemMain.dzMainMenu.gridViewRevMarkup.Visibility = Visibility.Collapsed;
2509
                    ViewerDataModel.Instance.SystemMain.dzMainMenu.UserList.IsChecked = false;
2510
                    ViewerDataModel.Instance.SystemMain.dzMainMenu.BalanceMode.IsChecked = false;
2511
                }
2512
            }
2513
            catch (Exception ex)
2514
            {
2515
                //Logger.sendResLog("SyncInit", ex.Message, 0);
2516
            }
2517

    
2518
        }
2519

    
2520
        CommentUserInfo currentControl { get; set; }
2521
        private void Check_Closed(object sender, EventArgs e)
2522
        {
2523
            isClosed = true;
2524
            //this.ParentOfType<MainWindow>().dzMainMenu.PN_Navi.IsEnabled = true;
2525
            //토글 및 마우스 상태 초기화
2526
            var toggleList = this.Parent.ChildrenOfType<RadToggleButton>();
2527
            foreach (var togle in toggleList)
2528
            {
2529
                togle.IsChecked = false;
2530
            }
2531
            this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2532
            ViewerDataModel.Instance.Capture_Opacity = 0;
2533

    
2534
        }
2535

    
2536
        /* public class test 
2537
         {
2538
             public double width { get; set; }
2539
             public double height { get; set; }
2540
         }
2541
         */
2542
        private async void CollapsedButton_Click()
2543
        {
2544
            this.ParentOfType<MainWindow>().dzTopMenu._SaveEvent(null, null); // 저장하지 못한 데이터가 있다면 저장
2545

    
2546
            string[] data = new string[0];
2547

    
2548
            int cnt = 0;
2549
            var menu = this.ParentOfType<MainWindow>().dzMainMenu;
2550

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

    
2553
            foreach (var item in gridSelectionItem)
2554
            {
2555
                if ((item.UserID == App.ViewInfo.UserID) && (ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.CurrentPage != null))
2556
                {
2557
                    var instance = ViewerDataModel.Instance.MyMarkupList.Where(d => d.PageNumber == ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber &&
2558
                    d.MarkupInfoID == item.MarkupInfoID).ToList();
2559
                    data = new string[instance.Count];
2560
                    foreach (var markup in instance)
2561
                    {
2562
                        data[cnt++] = await MarkupToPDF.Serialize.Core.JsonSerializerHelper.UnCompressStringAsync(markup.Data,ViewerDataModel.Instance.NewMarkupCancelToken());
2563
                    }
2564
                }
2565
            }
2566

    
2567
            if (data != null && KCOM.Properties.Settings.Default.cad == 1)
2568
            {
2569
                string FilePath = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\Cad");
2570
                string FileName = FilePath + "\\commentstring.json"; // Default file name
2571
                if (!File.Exists(FilePath))
2572
                {
2573
                    Directory.CreateDirectory(FilePath);
2574
                }
2575

    
2576
                if (!string.IsNullOrEmpty(FileName))
2577
                {
2578
                    //  File.WriteAllText(SaveDig.FileName, data);
2579
                    File.WriteAllLines(FileName, data);
2580
                }
2581
            }
2582
        }
2583

    
2584
        private double minHeight;
2585
        private double minWidth;
2586

    
2587
        private double maxHeight;
2588
        private double maxWidth;
2589

    
2590
        public bool CanVResize { get; private set; }
2591
        public bool CanHResize { get; private set; }
2592

    
2593
        public void DesignerComponent(FrameworkElement content)
2594
        {
2595
            this.InitializeComponent();
2596

    
2597
            if (!double.IsNaN(content.Width))
2598
            {
2599
                CanHResize = false;
2600
                this.Width = content.Width;
2601
            }
2602
            else
2603
            {
2604
                CanHResize = true;
2605
                this.Width = 23.0;
2606
            }
2607
            if (!double.IsNaN(content.Height))
2608
            {
2609
                CanVResize = false;
2610
                this.Height = content.Height; ;
2611
            }
2612
            else
2613
            {
2614
                CanVResize = true;
2615
                this.Height = 23.0;
2616
            }
2617

    
2618
            minWidth = content.MinWidth < 10.0 ? 10.0 : content.MinWidth;
2619
            minHeight = content.MinHeight < 10.0 ? 10.0 : content.MinHeight;
2620
            maxWidth = content.MaxWidth;
2621
            maxHeight = content.MaxHeight;
2622

    
2623
            double top = (double)content.GetValue(Canvas.TopProperty);
2624
            if (double.IsNaN(top))
2625
                top = 0.0;
2626
            double left = (double)content.GetValue(Canvas.LeftProperty);
2627
            if (double.IsNaN(left))
2628
                left = 0.0;
2629
            SetValue(Canvas.TopProperty, top);
2630
            SetValue(Canvas.LeftProperty, left);
2631

    
2632
            //Set the actual content. Note that "Content" property is a new property. See below
2633
            this.Content = content;
2634
        }
2635
        private void Thumb_DragDelta(object sender, DragDeltaEventArgs e)
2636
        {
2637
            string name = ((Thumb)sender).Name;
2638
            if (name.Contains("Top"))
2639
            {
2640
                double newHeight = this.Height - e.VerticalChange;
2641
                if (newHeight >= minHeight && newHeight <= maxHeight)
2642
                {
2643
                    this.Height = newHeight;
2644
                    SetValue(Canvas.TopProperty,
2645
                (double)GetValue(Canvas.TopProperty) + e.VerticalChange);
2646
                }
2647
            }
2648
            if (name.Contains("Right"))
2649
            {
2650
                double newWidth = this.Width + e.HorizontalChange;
2651
                if (newWidth >= minWidth && newWidth <= maxWidth)
2652
                    this.Width = newWidth;
2653
            }
2654
            if (name.Contains("Bottom"))
2655
            {
2656
                double newHeight = this.Height + e.VerticalChange;
2657
                if (newHeight >= minHeight && newHeight <= maxHeight)
2658
                    this.Height = newHeight;
2659
            }
2660
            if (name.Contains("Left"))
2661
            {
2662
                double newWidth = this.Width - e.HorizontalChange;
2663
                if (newWidth >= minWidth && newWidth <= maxWidth)
2664
                {
2665
                    this.Width = newWidth;
2666
                    SetValue(Canvas.LeftProperty,
2667
                (double)GetValue(Canvas.LeftProperty) + e.HorizontalChange);
2668
                }
2669
            }
2670
        }
2671

    
2672
        private void drawControlBorder(object sender)
2673
        {
2674
            System.Windows.Controls.Control control = (System.Windows.Controls.Control)sender;
2675
        }
2676

    
2677
        private void ResizeThumb_DragDelta(object sender, MouseButtonEventArgs e)
2678
        {
2679
            System.Windows.Controls.Control designerItem = (System.Windows.Controls.Control)sender;
2680
            if (designerItem != null)
2681
            {
2682
                double deltaVertical, deltaHorizontal;
2683

    
2684
                switch (VerticalAlignment)
2685
                {
2686
                    case VerticalAlignment.Bottom:
2687
                        deltaVertical = designerItem.ActualHeight - designerItem.MinHeight;
2688
                        designerItem.Height -= deltaVertical;
2689
                        break;
2690
                    case VerticalAlignment.Top:
2691
                        deltaVertical = designerItem.ActualHeight - designerItem.MinHeight;
2692
                        Canvas.SetTop(designerItem, Canvas.GetTop(designerItem) + deltaVertical);
2693
                        designerItem.Height -= deltaVertical;
2694
                        break;
2695
                    default:
2696
                        break;
2697
                }
2698

    
2699
                switch (HorizontalAlignment)
2700
                {
2701
                    case HorizontalAlignment.Left:
2702
                        deltaHorizontal = designerItem.ActualWidth - designerItem.MinWidth;
2703
                        Canvas.SetLeft(designerItem, Canvas.GetLeft(designerItem) + deltaHorizontal);
2704
                        designerItem.Width -= deltaHorizontal;
2705
                        break;
2706
                    case HorizontalAlignment.Right:
2707
                        deltaHorizontal = designerItem.ActualWidth - designerItem.MinWidth;
2708
                        designerItem.Width -= deltaHorizontal;
2709
                        break;
2710
                    default:
2711
                        break;
2712
                }
2713
            }
2714
            e.Handled = true;
2715
        }
2716

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

    
2719
        void ExportMethod()
2720
        {
2721
            //FileDialogFilter filterImage = new FileDialogFilter("Image Files", "*.jpg", "*.png");
2722
            SaveDig.Filter = "PDF file format|*.pdf";
2723
            SaveDig.Title = "Save an DWG File";
2724
            SaveDig.ShowDialog();
2725
        }
2726

    
2727
        private void cbAutoSave_Checked(object sender, RoutedEventArgs e)
2728
        {            
2729
            if (cbAutoSave.IsChecked == true)
2730
            {
2731
                SaveTime(true, (int)cbSaveInterval.Value);
2732
            }
2733
            else
2734
            {
2735
                SaveTime(false, (int)cbSaveInterval.Value);
2736
            }
2737
        }
2738
        private void cbSaveInterval_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
2739
        {
2740
            if(string.IsNullOrEmpty(cbSaveInterval.Value.ToString()))
2741
            {
2742
                cbSaveInterval.Value = cbSaveInterval.Minimum;
2743
            }
2744
            if (cbAutoSave.IsChecked == true)
2745
            {
2746
                SaveTime(true, (int)cbSaveInterval.Value);
2747
            }
2748

    
2749
            KCOM.Properties.Settings.Default.SaveInterval = (double)cbSaveInterval.Value;
2750
            Properties.Settings.Default.Save();
2751
        }
2752
        //강인구 자동 저장 추가
2753
        private void AutoSave(object sender, RoutedEventArgs e)
2754
        {
2755
            RadToggleButton instanceToggle = sender as RadToggleButton;
2756

    
2757
            if(instanceToggle.IsChecked == true)
2758
            {
2759
                SaveTime(true);
2760
            }
2761
            else
2762
            {
2763
                SaveTime(false);
2764
            }
2765
        }
2766

    
2767
        public void Copy_Start()
2768
        {
2769
            if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
2770
            {
2771
                string MarkupData = "";
2772

    
2773
                foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
2774
                {
2775
                    string id = string.Empty;
2776
                    if (item.GetType().Name == "AdornerFinal")
2777
                    {
2778
                        foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
2779

    
2780
                        {
2781
                            if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
2782
                            {
2783
                                MarkupToPDF.Controls.Parsing.MarkupParser.MarkupReturn res = MarkupParser.MarkupToString(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo, App.ViewInfo.UserID);
2784
                                id = (InnerItem.Symbol_ID != null) ? "|SymbolID|" + InnerItem.Symbol_ID : "";
2785
                                MarkupData += "|OR|" + res.ConvertData + id;
2786
                            }
2787
                        }
2788

    
2789
                        this.Dispatcher.Invoke(() =>
2790
                        {
2791
                            Clipboard.SetData(DataFormats.StringFormat, MarkupData);
2792
                        }, DispatcherPriority.Background);
2793
                    }
2794
                }
2795
            }
2796
        }
2797
    }
2798
}
클립보드 이미지 추가 (최대 크기: 500 MB)