프로젝트

일반

사용자정보

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

markus / KCOM / Events / Implementation / TopMenuEvent.cs @ 19d602e0

이력 | 보기 | 이력해설 | 다운로드 (130 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
        public RadWindow CheckPop;
44
        public RadWindow OptionPop;
45

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

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

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

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

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

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

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

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

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

    
133
                ViewerDataModel.Instance.IsMarkupUpdate = true;
134
            }
135

    
136
        }
137

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

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

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

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

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

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

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

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

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

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

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

    
291
                _SaveEvent(sender, e);
292

    
293
                mianMenu.busyIndicator.IsBusy = false;
294
               
295
            //});
296

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

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

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

    
321
                mainMenu.UpdateMyMarkupList();
322

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

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

    
344
                            result = true;
345
                        }
346
                    }
347
                }
348

    
349
                mainMenu.SetCommentPages(null);
350

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

    
374
            return result;
375
        }
376

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

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

    
386
                // update mylist and gridview
387
                mainMenu.UpdateMyMarkupList();
388

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

    
406
                mainMenu.SetCommentPages(null);
407

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

    
432
            return result;
433
        }
434

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

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

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

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

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

    
488
            return result;
489
        }
490

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

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

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

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

    
523
            List<IKCOM.MarkupInfoItem> markupinfo = new List<IKCOM.MarkupInfoItem>();
524

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

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

    
536
            /// Tile Source URL을 구한다
537

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

    
549
            var docitem = this.ParentOfType<MainWindow>().dzMainMenu._DocItem;
550

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

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

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

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

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

    
603
            return AdonerList;
604
        }
605

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

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

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

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

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

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

    
739

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
964
            ViewerDataModel.Instance.IsMarkupUpdate = true;
965
            #endregion
966
        }
967

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

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

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

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

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

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

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

    
1061
        }
1062

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

    
1071
        }
1072

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
1301
                    ((TextBox)sender).Text = previousText;
1302
                }
1303
            }
1304
        }
1305

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

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

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

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

    
1384
                isClosed = false;
1385

    
1386
                
1387
                CheckList check = new CheckList(this.ParentOfType<MainWindow>());
1388

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

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

    
1415
        private void OpenSignManager()
1416
        { 
1417
            SignManager signManager = new SignManager();
1418

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

    
1433
            //CheckPop.ShowDialog();
1434
            signManagerPop.ShowDialog();
1435
        }
1436

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

    
1445
        private void CheckPop_Closed(object sender, WindowClosedEventArgs e)
1446
        {
1447
            isClosed = true;
1448
            //this.ParentOfType<MainWindow>().dzMainMenu.PN_Navi.IsEnabled = true;
1449
            this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
1450
            ViewerDataModel.Instance.Capture_Opacity = 0;
1451
        }
1452

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

    
1492
        private void viewEvent(object sender, RoutedEventArgs e)
1493
        {
1494
            RadRibbonToggleButton viewButton = sender as RadRibbonToggleButton;
1495
            var instanceMain = this.ParentOfType<MainWindow>();
1496

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

    
1499
            //if ((sender as RadRibbonToggleButton) != null)
1500
            //{
1501
            //    Common.ViewerDataModel.Instance.ControlTag = (sender as RadRibbonToggleButton).Tag.ToString();
1502
            //    instanceToggle = (sender as RadRibbonToggleButton);
1503
            //}
1504

    
1505
            //instanceToggle.IsChecked = false;
1506

    
1507
            switch (viewButton.CommandParameter.ToString())
1508
            {
1509
                case "zoomout":
1510
                    {
1511
                        //장원
1512
                        //instanceMain.dzMainMenu.zoomAndPanControl.ZoomTo(new Rect(0, 0, instanceMain.dzMainMenu.zoomAndPanCanvas.ActualWidth, instanceMain.dzMainMenu.zoomAndPanCanvas.ActualHeight));
1513
                        instanceMain.dzMainMenu.zoomAndPanControl.ZoomPointToViewportCenter(ViewerDataModel.Instance.ContentScale -= 0.1, point);
1514
                        viewButton.IsChecked = false;
1515
                        //Common.ViewerDataModel.Instance.zom
1516
                    }
1517
                    break;
1518
                case "zoomin":
1519
                    {
1520
                        instanceMain.dzMainMenu.zoomAndPanControl.ZoomPointToViewportCenter(ViewerDataModel.Instance.ContentScale += 0.1, point);
1521
                        viewButton.IsChecked = false;
1522
                    }
1523
                    break;             
1524
                case "fitWidth":
1525
                    {
1526
                        instanceMain.dzMainMenu.zoomAndPanControl.ScaleToFit();
1527
                        viewButton.IsChecked = false;
1528
                    }
1529
                    break;
1530
                case "fitHeight":
1531
                    {
1532
                        instanceMain.dzMainMenu.zoomAndPanControl.ScaleToFit();
1533
                        viewButton.IsChecked = false;
1534
                    }
1535
                    break;
1536
                case "boundzoom":
1537
                    {
1538

    
1539
                    }
1540
                    break;
1541
                case "Rotate_M":
1542
                    {
1543
                        drawingPannelRotate(false);
1544
                        viewButton.IsChecked = false;
1545
                    }
1546
                    break;
1547
                case "Rotate_P":
1548
                    {
1549
                        drawingPannelRotate(true);
1550
                        viewButton.IsChecked = false;
1551
                    }
1552
                    break;
1553
                case "Rotate_half":
1554
                    {
1555
                        drawingPannelRotate(true);
1556
                        drawingPannelRotate(true);
1557
                        viewButton.IsChecked = false;
1558
                    }
1559
                    break;
1560
                    //case "fullscreen":
1561
                    //    {
1562
                    //        instanceMain.WindowStyle = WindowStyle.None;
1563
                    //        instanceMain.WindowState = WindowState.Maximized;
1564
                    //        instanceMain.dzMainMenu.zoomAndPanControl.ScaleToFit();
1565
                    //        viewButton.IsChecked = false;
1566
                    //    }
1567
                    //    break;
1568
            }
1569
        }
1570

    
1571
        private void Control_Event(object sender, RoutedEventArgs e)
1572
        {
1573

    
1574
        }
1575

    
1576
        #region 대기
1577

    
1578
        public void drawingPannelRotate(bool Flag)
1579
        {
1580
            var instanceMain = this.ParentOfType<MainWindow>();
1581

    
1582
            //if (rotateOffSet > 3)
1583
            //    rotateOffSet = 0;
1584

    
1585
            //if (rotateOffSet < 0)
1586
            //    rotateOffSet = 3;
1587

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

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

    
1641
            //instanceMain.dzMainMenu.zoomAndPanControl.RenderTransformOrigin = new Point(0.5, 0.5);
1642
            instanceMain.dzMainMenu.zoomAndPanControl.RotationAngle = instanceMain.dzMainMenu.rotate.Angle;
1643
            //대기(강인구)
1644
            //instanceMain.dzMainMenu.imageViewer.RotateAngle = instanceMain.dzMainMenu.rotate.Angle;
1645

    
1646

    
1647
            //instanceMain.dzMainMenu.imageViewer.RenderTransformOrigin = new Point(0.5, 0.5);
1648
            //RotateTransform rotateTransform = new RotateTransform(instanceMain.dzMainMenu.rotate.Angle);
1649
            //instanceMain.dzMainMenu.imageViewer.RenderTransform = rotateTransform;
1650

    
1651

    
1652
            ViewerDataModel.Instance.ContentWidth = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
1653
            ViewerDataModel.Instance.ContentHeight = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
1654
            ViewerDataModel.Instance.AngleOffsetX = instanceMain.dzMainMenu.translate.X;
1655
            ViewerDataModel.Instance.AngleOffsetY = instanceMain.dzMainMenu.translate.Y;
1656
            ViewerDataModel.Instance.PageAngle = instanceMain.dzMainMenu.rotate.Angle;
1657
            //ViewerDataModel.Instance.Document_Info.Clear();
1658
            //ViewerDataModel.Instance.Document_Info.Where(i => i.PAGE_NUMBER == instanceMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber).ToList().ForEach(value =>
1659
            //{
1660
            //    value.PAGE_ANGLE = int.Parse(instanceMain.dzMainMenu.rotate.Angle.ToString());
1661
            //});
1662

    
1663

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

    
1667
            foreach (var data in thumbnaillist)
1668
            {
1669
                data.Angle = int.Parse(instanceMain.dzMainMenu.rotate.Angle.ToString());
1670

    
1671
                //instanceMain.dzMainMenu.pageNavigator.ImgListbox.ItemsSource = instanceMain.dzMainMenu.pageNavigator._thumbnailItems;
1672
                var instance = instanceMain.dzMainMenu.CurrentDoc.docInfo.DOCPAGE.Where(p => p.PAGE_NUMBER == instanceMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber).FirstOrDefault();
1673
                instance.PAGE_ANGLE = int.Parse(instanceMain.dzMainMenu.rotate.Angle.ToString());
1674

    
1675
                instanceMain.dzMainMenu.pageNavigator.GotoPage(data.PageNumber);
1676

    
1677
                //rotation page add or update
1678
                var rotationdoc = ViewerDataModel.Instance.RotationDocs.Where(d => d.ID == instance.ID).FirstOrDefault();
1679
                if (rotationdoc != null)
1680
                {
1681
                    rotationdoc.PAGE_ANGLE = instance.PAGE_ANGLE;
1682
                }
1683
                else
1684
                {
1685
                    ViewerDataModel.Instance.RotationDocs.Add(instance);
1686
                }
1687
            }
1688
        }
1689
        #endregion
1690

    
1691
        private void ImageConverter(RadToggleButton instanceToggle)
1692
        {
1693
            try
1694
            {           
1695
                var instanceMain = this.ParentOfType<MainWindow>();
1696

    
1697
                Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
1698
                dlg.Filter = "All files (*.*)|*.*|PNG Images (*.png)|*.png";
1699
                Nullable<bool> result = dlg.ShowDialog();
1700
                if (result == true)
1701
                {
1702
                    instanceMain.dzMainMenu.filename = dlg.FileName;
1703
                    instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ImgControl;
1704

    
1705
                    System.IO.FileInfo fileInfo = new System.IO.FileInfo(instanceMain.dzMainMenu.filename);
1706
                    String strFile = System.IO.Path.GetFileName(instanceMain.dzMainMenu.filename);
1707
                    long numByte = fileInfo.Length;
1708
                    double dLen = Convert.ToDouble(fileInfo.Length / 1000000);
1709
                    kr.co.devdoftech.cloud.FileUpload fileUploader = App.FileUploader;
1710
             
1711
                    if (dLen < 4)
1712
                    {
1713
                        System.IO.FileStream fStream = new System.IO.FileStream(instanceMain.dzMainMenu.filename, System.IO.FileMode.Open, System.IO.FileAccess.Read);
1714
                        System.IO.BinaryReader br = new System.IO.BinaryReader(fStream);
1715
                        byte[] data = br.ReadBytes((int)numByte);
1716
                        br.Close();
1717

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

    
1720
                        Check_Uri.UriCheck(filepath);
1721

    
1722
                        instanceMain.dzMainMenu.filename = filepath;
1723

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

    
1751
                this.ParentOfType<MainWindow>().DialogMessage_Alert(ex.Message, "Alert");
1752
            }
1753
        }
1754

    
1755
        private void Control_Init(RadToggleButton instanceToggle, object sender)
1756
        {
1757

    
1758
        }
1759

    
1760
        private void ControlEvent(object sender, RoutedEventArgs e)
1761
        {
1762
            RadToggleButton instanceToggle = sender as RadToggleButton;
1763
            var instanceMain = this.ParentOfType<MainWindow>();
1764

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

    
1785
            //if (!instanceMain.IsFreeSelectionMode)
1786
            //{
1787
            //    instanceMain.IsSwingMode = true;
1788
            //}
1789

    
1790
            //#region 다른 컨트롤 버튼 선택 해제
1791
            //System.Reactive.Linq.Observable2.FromPropertyChangedPattern(Common.ViewerDataModel.Instance, temp => temp.SelectedControl).Subscribe(ControlState =>
1792
            //{
1793
            //    if (ControlState == null)
1794
            //    {
1795
            //        instanceToggle.IsChecked = false;
1796
            //        HiddenControlHide();
1797
            //    }
1798
            //});
1799
            //#endregion
1800

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

    
1803
            if (instanceToggle != null)
1804
            {
1805
                Common.ViewerDataModel.Instance.ControlTag = instanceToggle.Tag.ToString();
1806
            }
1807
            else if ((sender as RadRibbonToggleButton) != null)
1808
            {
1809
                Common.ViewerDataModel.Instance.ControlTag = (sender as RadRibbonToggleButton).Tag.ToString();
1810
                instanceToggle = (sender as RadRibbonToggleButton);
1811
            }
1812
            else if ((sender as RadRibbonButton) != null)
1813
            {
1814
                RadRibbonButton instanceButton = sender as RadRibbonButton;
1815
                Common.ViewerDataModel.Instance.ControlTag = instanceButton.Tag.ToString();
1816
            }
1817
            else
1818
            {
1819
                RadButton instanceButton = sender as RadButton;
1820
                Common.ViewerDataModel.Instance.ControlTag = instanceButton.Tag.ToString();
1821
            }
1822

    
1823

    
1824
            //System.Reactive.Linq.Observable2.FromPropertyChangedPattern(Common.ViewerDataModel.Instance, temp => temp.AngleVisibility).Subscribe(isSee =>
1825
            //{
1826
            //    if (instanceToggle.CommandParameter.ToString() == "ChainLine")
1827
            //    {
1828

    
1829
            //    }
1830
            //    else
1831
            //    {
1832
            //        System.Diagnostics.Debug.WriteLine(" instanceMain.dzMainMenu.MainAngle.Visibility   " + isSee);
1833

    
1834
            //        if (instanceMain.dzMainMenu.MainAngle.Visibility != isSee)
1835
            //        {
1836
            //            instanceMain.dzMainMenu.MainAngle.Visibility = isSee;
1837
            //        }
1838
            //    }
1839
            //    //System.Reactive.Linq.Observable2.FromPropertyChangedPattern(Common.ViewerDataModel.Instance, temp => temp.AngleValue).Subscribe(p =>
1840
            //    //{
1841
            //    //    instanceMain.dzMainMenu.MainAngle.AngleValue = p;
1842
            //    //});
1843
            //});
1844

    
1845
            instanceMain.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Drawing;
1846

    
1847
            instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = false;
1848

    
1849
            if (instanceToggle.IsChecked != false)
1850
            {
1851
                string param = instanceToggle.CommandParameter.ToString();
1852
                string MacroIndex = "";
1853

    
1854
                if (param.StartsWith("MACRO"))
1855
                {
1856
                    param = "MACRO";
1857
                    MacroIndex = param.Replace("MACRO;","");
1858

    
1859
                    //Common.ViewerDataModel.Instance.MacroItems = MacroHelper.LoadMacroItems(MacroIndex);
1860
                    //var items = MacroHelper.TopMenuItems();
1861

    
1862
                    Common.ViewerDataModel.Instance.MacroItems = new List<MacroItem>
1863
                    {
1864
                        new MacroItem
1865
                        {
1866
                            Desc = "Cloud Rectangle",
1867
                            ControlType = MarkupToPDF.Controls.Common.ControlType.RectCloud
1868
                        },
1869
                        new MacroItem
1870
                        {
1871
                             Desc = "Arrow TextBox",
1872
                            ControlType = MarkupToPDF.Controls.Common.ControlType.ArrowTextBorderControl
1873
                        }
1874
                    };
1875
                }
1876

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

    
2100
                        //instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = true;
2101

    
2102
                        Common.ViewerDataModel.Instance.SelectedControl = "Ink";
2103
                        Common.ViewerDataModel.Instance.LineSize = (double)cbLineSize.Value;
2104
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.PenControl;
2105
                        break;
2106
                    #endregion
2107
                    #region Select
2108
                    case "Select":
2109
                        if (this.ParentOfType<MainWindow>().dzMainMenu.currentControl != null)
2110
                        {
2111
                            if (this.ParentOfType<MainWindow>().dzMainMenu.currentControl is MarkupToPDF.Controls.Text.TextControl
2112
                                && !string.IsNullOrEmpty(((MarkupToPDF.Controls.Text.TextControl)this.ParentOfType<MainWindow>().dzMainMenu.currentControl).Text))
2113
                            {
2114
                                DependencyObject focusScope1 = FocusManager.GetFocusScope((MarkupToPDF.Controls.Text.TextControl)this.ParentOfType<MainWindow>().dzMainMenu.currentControl);
2115
                                FocusManager.SetFocusedElement(focusScope1, (MarkupToPDF.Controls.Text.TextControl)this.ParentOfType<MainWindow>().dzMainMenu.currentControl);
2116

    
2117
                                this.ParentOfType<MainWindow>().dzMainMenu.currentControl = null;
2118
                                Keyboard.ClearFocus();
2119

    
2120
                            }
2121
                            else
2122
                            {
2123
                                ViewerDataModel.Instance.MarkupControls_USER.Remove(this.ParentOfType<MainWindow>().dzMainMenu.currentControl);
2124
                                this.ParentOfType<MainWindow>().dzMainMenu.currentControl = null;
2125
                            }
2126
                        }
2127

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

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

    
2187
                    #region MACRO -MACRO1
2188
                    case "MACRO":
2189
                        Common.ViewerDataModel.Instance.SelectedControl = "MACRO";
2190
                        Common.ViewerDataModel.Instance.ControlTag = instanceMain.dzMainMenu._ViewInfo.UserID; //사번
2191

    
2192
                        MacroHelper.MacroAction();
2193

    
2194
                        break;
2195
                    #endregion
2196

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

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

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

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

    
2359

    
2360
                        //                    //MARKUP_DATA_GROUP UPDATE
2361
                        //                    //bool value = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.UpdateMarkupDataGroup(group_id, App.ViewInfo.ProjectNO);
2362
                        //                    ////Logger.sendReqLog("AddMarkupDataGroup: ", value.ToString(), 1);
2363
                        //                }
2364
                        //            }
2365
                        //        }
2366
                        //    }
2367
                        //}
2368
                        break;
2369
                    #endregion
2370
                    #region Capture
2371
                    case "Capture":
2372
                        SyncInit();
2373
                        //   instanceToggle.IsChecked = false;
2374
                        var CaptureList = this.Parent.ChildrenOfType<RadRibbonToggleButton>();
2375
                        foreach (var togle in CaptureList)
2376
                        {
2377
                            togle.IsChecked = false;
2378
                        }
2379

    
2380
                        if (this.ParentOfType<MainWindow>().dzMainMenu.currentControl != null)
2381
                        {
2382
                            ViewerDataModel.Instance.MarkupControls_USER.Remove(this.ParentOfType<MainWindow>().dzMainMenu.currentControl);
2383
                            this.ParentOfType<MainWindow>().dzMainMenu.currentControl = null;
2384
                        }
2385

    
2386
                        ViewerDataModel.Instance.SelectedControl = "ImgControl";
2387
                   //     ViewerDataModel.Instance.ControlTag = null;
2388
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ImgControl;
2389

    
2390
                        /*
2391
                        //캡쳐 하기 전에 코멘트 저장
2392
                        if (Common.ViewerDataModel.Instance.MarkupControls_USER.Count > 0 || (Application.Current.MainWindow as MainWindow).dzMainMenu.SelectLayer.Children.Count > 0)
2393
                        {
2394
                            var menu = (Application.Current.MainWindow as MainWindow).dzMainMenu;
2395
                            menu.ReleaseAdorner();
2396
                            if (menu.PreviewUserMarkupInfoItem != null && menu.PreviewUserMarkupInfoItem.IsPreviewUser == true)
2397
                            {
2398
                                (Application.Current.MainWindow as MainWindow).dzTopMenu.RefactoryCommentReact(menu);
2399
                            }
2400
                            else if (menu.gridViewMarkup.SelectedItems.Count == 0 || (menu.gridViewMarkup.SelectedItems.FirstOrDefault() as IKCOM.MarkupInfoItem).UserID != App.ViewInfo.UserID)
2401
                            {
2402

    
2403
                            }
2404
                            else
2405
                            {
2406
                                (Application.Current.MainWindow as MainWindow).dzTopMenu.RefactoryCommentReact(menu);
2407
                            }
2408
                        }*/
2409

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

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

    
2471
                        //    isClosed = false;
2472
                        //    CadResultViewer check = new CadResultViewer();
2473
                        //    check.WindowStartupLocation = WindowStartupLocation.CenterScreen;
2474
                        //    check.Title = "Viewer";
2475
                        //    check.Show();
2476

    
2477
                        //    check.Closed += Check_Closed;
2478

    
2479
                        //}
2480
                        break;
2481
                    #endregion
2482
                    default:
2483
                        break;
2484
                }
2485
                #endregion
2486
            }
2487
            else
2488
            {
2489
                if (Common.ViewerDataModel.Instance.IsMacroCommand)
2490
                {
2491
                    MacroHelper.Clear();
2492
                }
2493

    
2494
                if (!instanceMain.dzMainMenu.IsFreeSelectionMode)
2495
                {
2496
                    instanceMain.dzMainMenu.IsSwingMode = false;
2497
                    Common.ViewerDataModel.Instance.SelectedControl = "";
2498
                    Common.ViewerDataModel.Instance.ControlTag = null;
2499
                    this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2500
                    this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2501
                }
2502
            }
2503

    
2504
        }
2505

    
2506
        private void SyncInit()
2507
        {
2508
            try
2509
            {
2510
                if (!ViewerDataModel.Instance.SystemMain.dzMainMenu.testPanel2.IsHidden)
2511
                {
2512
                    ViewerDataModel.Instance.SystemMain.dzMainMenu.testPanel2.IsHidden = true;
2513
                    ViewerDataModel.Instance.PageBalanceMode = false;
2514
                    ViewerDataModel.Instance.PageBalanceNumber = 0;
2515
                    ViewerDataModel.Instance.SyncPageNumber = 0;
2516
                    ViewerDataModel.Instance.MarkupControls_Sync.Clear();
2517
                    ViewerDataModel.Instance.SystemMain.dzMainMenu.gridViewRevMarkup.Visibility = Visibility.Collapsed;
2518
                    ViewerDataModel.Instance.SystemMain.dzMainMenu.UserList.IsChecked = false;
2519
                    ViewerDataModel.Instance.SystemMain.dzMainMenu.BalanceMode.IsChecked = false;
2520
                }
2521
            }
2522
            catch (Exception ex)
2523
            {
2524
                //Logger.sendResLog("SyncInit", ex.Message, 0);
2525
            }
2526

    
2527
        }
2528

    
2529
        CommentUserInfo currentControl { get; set; }
2530
        private void Check_Closed(object sender, EventArgs e)
2531
        {
2532
            isClosed = true;
2533
            //this.ParentOfType<MainWindow>().dzMainMenu.PN_Navi.IsEnabled = true;
2534
            //토글 및 마우스 상태 초기화
2535
            var toggleList = this.Parent.ChildrenOfType<RadToggleButton>();
2536
            foreach (var togle in toggleList)
2537
            {
2538
                togle.IsChecked = false;
2539
            }
2540
            this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2541
            ViewerDataModel.Instance.Capture_Opacity = 0;
2542

    
2543
        }
2544

    
2545
        /* public class test 
2546
         {
2547
             public double width { get; set; }
2548
             public double height { get; set; }
2549
         }
2550
         */
2551
        private async void CollapsedButton_Click()
2552
        {
2553
            this.ParentOfType<MainWindow>().dzTopMenu._SaveEvent(null, null); // 저장하지 못한 데이터가 있다면 저장
2554

    
2555
            string[] data = new string[0];
2556

    
2557
            int cnt = 0;
2558
            var menu = this.ParentOfType<MainWindow>().dzMainMenu;
2559

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

    
2562
            foreach (var item in gridSelectionItem)
2563
            {
2564
                if ((item.UserID == App.ViewInfo.UserID) && (ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.CurrentPage != null))
2565
                {
2566
                    var instance = ViewerDataModel.Instance.MyMarkupList.Where(d => d.PageNumber == ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber &&
2567
                    d.MarkupInfoID == item.MarkupInfoID).ToList();
2568
                    data = new string[instance.Count];
2569
                    foreach (var markup in instance)
2570
                    {
2571
                        data[cnt++] = await MarkupToPDF.Serialize.Core.JsonSerializerHelper.UnCompressStringAsync(markup.Data,ViewerDataModel.Instance.NewMarkupCancelToken());
2572
                    }
2573
                }
2574
            }
2575

    
2576
            if (data != null && KCOM.Properties.Settings.Default.cad == 1)
2577
            {
2578
                string FilePath = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\Cad");
2579
                string FileName = FilePath + "\\commentstring.json"; // Default file name
2580
                if (!File.Exists(FilePath))
2581
                {
2582
                    Directory.CreateDirectory(FilePath);
2583
                }
2584

    
2585
                if (!string.IsNullOrEmpty(FileName))
2586
                {
2587
                    //  File.WriteAllText(SaveDig.FileName, data);
2588
                    File.WriteAllLines(FileName, data);
2589
                }
2590
            }
2591
        }
2592

    
2593
        private double minHeight;
2594
        private double minWidth;
2595

    
2596
        private double maxHeight;
2597
        private double maxWidth;
2598

    
2599
        public bool CanVResize { get; private set; }
2600
        public bool CanHResize { get; private set; }
2601

    
2602
        public void DesignerComponent(FrameworkElement content)
2603
        {
2604
            this.InitializeComponent();
2605

    
2606
            if (!double.IsNaN(content.Width))
2607
            {
2608
                CanHResize = false;
2609
                this.Width = content.Width;
2610
            }
2611
            else
2612
            {
2613
                CanHResize = true;
2614
                this.Width = 23.0;
2615
            }
2616
            if (!double.IsNaN(content.Height))
2617
            {
2618
                CanVResize = false;
2619
                this.Height = content.Height; ;
2620
            }
2621
            else
2622
            {
2623
                CanVResize = true;
2624
                this.Height = 23.0;
2625
            }
2626

    
2627
            minWidth = content.MinWidth < 10.0 ? 10.0 : content.MinWidth;
2628
            minHeight = content.MinHeight < 10.0 ? 10.0 : content.MinHeight;
2629
            maxWidth = content.MaxWidth;
2630
            maxHeight = content.MaxHeight;
2631

    
2632
            double top = (double)content.GetValue(Canvas.TopProperty);
2633
            if (double.IsNaN(top))
2634
                top = 0.0;
2635
            double left = (double)content.GetValue(Canvas.LeftProperty);
2636
            if (double.IsNaN(left))
2637
                left = 0.0;
2638
            SetValue(Canvas.TopProperty, top);
2639
            SetValue(Canvas.LeftProperty, left);
2640

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

    
2681
        private void drawControlBorder(object sender)
2682
        {
2683
            System.Windows.Controls.Control control = (System.Windows.Controls.Control)sender;
2684
        }
2685

    
2686
        private void ResizeThumb_DragDelta(object sender, MouseButtonEventArgs e)
2687
        {
2688
            System.Windows.Controls.Control designerItem = (System.Windows.Controls.Control)sender;
2689
            if (designerItem != null)
2690
            {
2691
                double deltaVertical, deltaHorizontal;
2692

    
2693
                switch (VerticalAlignment)
2694
                {
2695
                    case VerticalAlignment.Bottom:
2696
                        deltaVertical = designerItem.ActualHeight - designerItem.MinHeight;
2697
                        designerItem.Height -= deltaVertical;
2698
                        break;
2699
                    case VerticalAlignment.Top:
2700
                        deltaVertical = designerItem.ActualHeight - designerItem.MinHeight;
2701
                        Canvas.SetTop(designerItem, Canvas.GetTop(designerItem) + deltaVertical);
2702
                        designerItem.Height -= deltaVertical;
2703
                        break;
2704
                    default:
2705
                        break;
2706
                }
2707

    
2708
                switch (HorizontalAlignment)
2709
                {
2710
                    case HorizontalAlignment.Left:
2711
                        deltaHorizontal = designerItem.ActualWidth - designerItem.MinWidth;
2712
                        Canvas.SetLeft(designerItem, Canvas.GetLeft(designerItem) + deltaHorizontal);
2713
                        designerItem.Width -= deltaHorizontal;
2714
                        break;
2715
                    case HorizontalAlignment.Right:
2716
                        deltaHorizontal = designerItem.ActualWidth - designerItem.MinWidth;
2717
                        designerItem.Width -= deltaHorizontal;
2718
                        break;
2719
                    default:
2720
                        break;
2721
                }
2722
            }
2723
            e.Handled = true;
2724
        }
2725

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

    
2728
        void ExportMethod()
2729
        {
2730
            //FileDialogFilter filterImage = new FileDialogFilter("Image Files", "*.jpg", "*.png");
2731
            SaveDig.Filter = "PDF file format|*.pdf";
2732
            SaveDig.Title = "Save an DWG File";
2733
            SaveDig.ShowDialog();
2734
        }
2735

    
2736
        private void cbAutoSave_Checked(object sender, RoutedEventArgs e)
2737
        {            
2738
            if (cbAutoSave.IsChecked == true)
2739
            {
2740
                SaveTime(true, (int)cbSaveInterval.Value);
2741
            }
2742
            else
2743
            {
2744
                SaveTime(false, (int)cbSaveInterval.Value);
2745
            }
2746
        }
2747
        private void cbSaveInterval_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
2748
        {
2749
            if(string.IsNullOrEmpty(cbSaveInterval.Value.ToString()))
2750
            {
2751
                cbSaveInterval.Value = cbSaveInterval.Minimum;
2752
            }
2753
            if (cbAutoSave.IsChecked == true)
2754
            {
2755
                SaveTime(true, (int)cbSaveInterval.Value);
2756
            }
2757

    
2758
            KCOM.Properties.Settings.Default.SaveInterval = (double)cbSaveInterval.Value;
2759
            Properties.Settings.Default.Save();
2760
        }
2761
        //강인구 자동 저장 추가
2762
        private void AutoSave(object sender, RoutedEventArgs e)
2763
        {
2764
            RadToggleButton instanceToggle = sender as RadToggleButton;
2765

    
2766
            if(instanceToggle.IsChecked == true)
2767
            {
2768
                SaveTime(true);
2769
            }
2770
            else
2771
            {
2772
                SaveTime(false);
2773
            }
2774
        }
2775

    
2776
        public void Copy_Start()
2777
        {
2778
            if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
2779
            {
2780
                string MarkupData = "";
2781

    
2782
                foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
2783
                {
2784
                    string id = string.Empty;
2785
                    if (item.GetType().Name == "AdornerFinal")
2786
                    {
2787
                        foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
2788

    
2789
                        {
2790
                            if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
2791
                            {
2792
                                MarkupToPDF.Controls.Parsing.MarkupParser.MarkupReturn res = MarkupParser.MarkupToString(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo, App.ViewInfo.UserID);
2793
                                id = (InnerItem.Symbol_ID != null) ? "|SymbolID|" + InnerItem.Symbol_ID : "";
2794
                                MarkupData += "|OR|" + res.ConvertData + id;
2795
                            }
2796
                        }
2797

    
2798
                        this.Dispatcher.Invoke(() =>
2799
                        {
2800
                            Clipboard.SetData(DataFormats.StringFormat, MarkupData);
2801
                        }, DispatcherPriority.Background);
2802
                    }
2803
                }
2804
            }
2805
        }
2806
    }
2807
}
클립보드 이미지 추가 (최대 크기: 500 MB)