프로젝트

일반

사용자정보

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

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

이력 | 보기 | 이력해설 | 다운로드 (153 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

    
34
namespace KCOM.Views
35
{
36
    public partial class TopMenu : UserControl
37
    {
38
        public int rotateOffSet = 0;
39
        private double[] rotateValue = { 0, 90, 180, 270 };
40
        public System.Windows.Threading.DispatcherTimer SaveTimer { get; set; }
41
        public bool isClosed = true;
42
        public RadWindow CheckPop;
43
        public RadWindow OptionPop;
44

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

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

    
73
        private void CheckShapeState()
74
        {
75

    
76

    
77
            if (cbHatchShape.IsChecked == true)
78
            {
79
                cbFillShape.IsChecked = false;
80
                ViewerDataModel.Instance.paintSet = MarkupToPDF.Controls.Common.PaintSet.Hatch;
81
            }
82
            else if(cbFillShape.IsChecked == true)
83
            {
84
                cbHatchShape.IsChecked = false;
85
                ViewerDataModel.Instance.paintSet = MarkupToPDF.Controls.Common.PaintSet.Fill;
86
            }
87
            else
88
            {
89
                ViewerDataModel.Instance.paintSet = MarkupToPDF.Controls.Common.PaintSet.None;
90
            }
91
        }
92

    
93
        /// <summary>
94
        ///  comment의 속성 변경시 저장여부 확인 하도록 undocommand에 추가
95
        /// </summary>
96
        /// <param name="adnoerFinal"></param>
97
        public void ChangeComment(Controls.AdornerFinal adnoerFinal)
98
        {
99
            var adornerMembers = adnoerFinal.Members.Cast<Controls.AdornerMember>();
100

    
101
            if (adornerMembers.Count() > 0)
102
            {
103
                //UndoCommand.Instance.Push(adornerMembers.Select(x => x.DrawingData).Cast<CommentUserInfo>().ToList(), adnoerFinal.AngleValue);
104
                UndoCommand.Instance.Push(EventType.Operation, adornerMembers.Select(x => x.DrawingData).Cast<CommentUserInfo>().ToList());
105
            }
106
        }
107

    
108
        //강인구 추가(Undo End)
109
        private void SetPaintEvent()
110
        {
111
            List<AdornerMember> AdonerList = GetAdornerItem();
112

    
113
            if (AdonerList.Count > 0)
114
            {
115
                UndoDataGroup UndoData = new UndoDataGroup()
116
                {
117
                    IsUndo = false,
118
                    Event = EventType.Operation,
119
                    EventTime = DateTime.Now,
120
                    paint = ViewerDataModel.Instance.paintSet,
121
                    MarkupDataColl = new List<UndoData>()
122
                };
123
                UndoData multi_UndoData = new UndoData();
124

    
125
                foreach (AdornerMember InnerItem in AdonerList)
126
                {
127
                    multi_UndoData.PointSet = new List<Point>();
128

    
129
                    if ((InnerItem.DrawingData as MarkupToPDF.Controls.Common.IShapeControl) != null)
130
                    {
131
                        (InnerItem.DrawingData as MarkupToPDF.Controls.Common.IShapeControl).Paint = ViewerDataModel.Instance.paintSet;
132
                    }
133

    
134
                    multi_UndoData.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
135
                    UndoData.MarkupDataColl.Add(multi_UndoData);
136
                    multi_UndoData = new UndoData();
137
                }
138

    
139
                ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
140
                {
141
                    ViewerDataModel.Instance.UndoDataList.Remove(i);                    
142
                });
143
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
144
            }
145
        }
146

    
147
        private void SetHighlightEvent()
148
        {
149
            List<AdornerMember> AdonerList = GetAdornerItem();
150

    
151
            if (AdonerList.Count > 0)
152
            {
153
                foreach (AdornerMember InnerItem in AdonerList)
154
                {
155
                    switch (InnerItem.DrawingData.GetType().Name)
156
                    {
157
                        case ("TextControl"):
158
                            {
159
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).IsHighLight = ViewerDataModel.Instance.checkHighShape;
160
                            }
161
                            break;
162
                        case ("ArrowTextControl"):
163
                            {
164
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape;
165
                            }
166
                            break;
167
                    }
168
                }
169

    
170
                ViewerDataModel.Instance.IsMarkupUpdate = true;
171
            }
172

    
173
        }
174

    
175
        private void FillShapeEvent(object sender, RoutedEventArgs e)
176
        {
177
            #region 주석
178
            //if ((sender as CheckBox).IsChecked.Value)
179
            //{
180
            //    cbHatchShape.IsChecked = false;
181
            //    imgShape_RectCloud.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/RectCloud_Fill.png", UriKind.Relative));
182
            //    imgShape_Cloud.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/Cloud_Fill.png", UriKind.Relative));
183
            //    imgShape_Rect.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/Rectangle_Fill.png", UriKind.Relative));
184
            //    imgShape_Tri.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/triangle-icon.png", UriKind.Relative));
185
            //    imgShape_Cicle.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/circle-icon.png", UriKind.Relative));
186
            //    imgShape_Poly.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/polygon_Fill.png", UriKind.Relative));
187
            //    TaskMessage("채우기 옵션이 적용되었습니다", TaskMessageType.Normal);
188
            //}
189
            //else
190
            //{
191

    
192
            //    imgShape_RectCloud.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/RectCloud.png", UriKind.Relative));
193
            //    imgShape_Cloud.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/Cloud.png", UriKind.Relative));
194
            //    imgShape_Rect.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/Rectangle.png", UriKind.Relative));
195
            //    imgShape_Tri.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/triangle-icon_None.png", UriKind.Relative));
196
            //    imgShape_Cicle.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/circle-icon_None.png", UriKind.Relative));
197
            //    imgShape_Poly.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/polygon.png", UriKind.Relative));
198
            //    TaskMessage("채우기 옵션이 해제되었습니다", TaskMessageType.Caption);
199
            //}
200
            #endregion
201
            ViewerDataModel.Instance.checkFillShape = (sender as CheckBox).IsChecked.Value;
202

    
203
            if (ViewerDataModel.Instance.checkFillShape)
204
            {
205
                cbHatchShape.IsChecked = false;
206
                ViewerDataModel.Instance.paintSet = MarkupToPDF.Controls.Common.PaintSet.Fill;
207
            }
208
            else
209
            {
210
                ViewerDataModel.Instance.paintSet = MarkupToPDF.Controls.Common.PaintSet.None;
211
            }
212
            SetPaintEvent();
213
        }
214

    
215
        /// <summary>
216
        /// 도형 빗금 처리
217
        /// </summary>
218
        /// <param name="sender"></param>
219
        /// <param name="e"></param>
220
        private void HatchShapeEvent(object sender, RoutedEventArgs e)
221
        {
222
			#region 주석
223
            //if ((sender as CheckBox).IsChecked.Value)
224
            //{
225
            //    cbFillShape.IsChecked = false;
226
            //    imgShape_RectCloud.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/RectCloud_Hatch.png", UriKind.Relative));
227
            //    imgShape_Cloud.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/Cloud_Hatch.png", UriKind.Relative));
228
            //    imgShape_Rect.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/rectangle-icon_Hatch.png", UriKind.Relative));
229
            //    imgShape_Tri.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/triangle-icon_Hatch.png", UriKind.Relative));
230
            //    imgShape_Cicle.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/circle-icon_Hatch.png", UriKind.Relative));
231
            //    imgShape_Poly.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/polygon_hatch.png", UriKind.Relative));
232
            //    TaskMessage("무늬 옵션이 적용되었습니다", TaskMessageType.Normal);
233
            //}
234
            //else
235
            //{
236
            //    imgShape_RectCloud.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/RectCloud.png", UriKind.Relative));
237
            //    imgShape_Cloud.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/Cloud.png", UriKind.Relative));
238
            //    imgShape_Rect.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/Rectangle.png", UriKind.Relative));
239
            //    imgShape_Tri.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/triangle-icon_None.png", UriKind.Relative));
240
            //    imgShape_Cicle.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/circle-icon_None.png", UriKind.Relative));
241
            //    imgShape_Poly.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/polygon.png", UriKind.Relative));
242
            //    TaskMessage("무늬 옵션이 해제되었습니다", TaskMessageType.Caption);
243
            //} 
244
            #endregion
245

    
246
            //강인구 추가
247
            ViewerDataModel.Instance.checkHatchShape = (sender as CheckBox).IsChecked.Value;
248
            if (ViewerDataModel.Instance.checkHatchShape)
249
            {
250
                cbFillShape.IsChecked = false;
251
                ViewerDataModel.Instance.paintSet = MarkupToPDF.Controls.Common.PaintSet.Hatch;
252
            }
253
            else
254
            {
255
                ViewerDataModel.Instance.paintSet = MarkupToPDF.Controls.Common.PaintSet.None;  
256
            }
257
            SetPaintEvent();
258
        }
259

    
260
        void SaveTimer_Tick(object sender, EventArgs e)
261
        {
262
            //if (this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode != IKCOM.MouseHandlingMode.Drawing)
263
            if (this.ParentOfType<MainWindow>().dzMainMenu.currentControl == null && this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count == 0)
264
            {
265
                SaveEventCallback(null, null);
266
            }
267
        }
268

    
269
        private void SaveTime(bool IsRun)
270
        {
271
            if(SaveTimer == null)
272
            {
273
                SaveTimer = new System.Windows.Threading.DispatcherTimer();
274
                SaveTimer.Interval = new TimeSpan(0, 0, 5);
275
                SaveTimer.Tick += new EventHandler(SaveTimer_Tick);
276
            }
277

    
278
            if (IsRun)
279
            {
280
                SaveTimer.Start();
281
            }
282
            else
283
            {
284
                SaveTimer.Stop();
285
            }
286
        }
287
        private void SaveTime(bool IsRun,int timeinterval)
288
        {
289
            if (SaveTimer == null)
290
            {
291
                SaveTimer = new System.Windows.Threading.DispatcherTimer();
292
                SaveTimer.Interval = new TimeSpan(0, timeinterval, 0);
293
                SaveTimer.Tick += new EventHandler(SaveTimer_Tick);
294
            }
295
            else
296
            {
297
                SaveTimer.Stop();
298
                SaveTimer.Interval = new TimeSpan(0, timeinterval, 0);
299
            }
300

    
301
            if (IsRun)
302
            {
303
                SaveTimer.Start();
304
            }
305
            else
306
            {
307
                SaveTimer.Stop();
308
            }
309
        }
310
        /// <summary>
311
        /// enable busy indicator and then call _SaveEvent method.
312
        /// </summary>
313
        /// <param name="sender"></param>
314
        /// <param name="e"></param>
315
        public  void SaveEventCallback(object sender, RoutedEventArgs e)
316
        {
317
            var mianMenu = this.ParentOfType<MainWindow>().dzMainMenu;
318

    
319
            if (mianMenu.busyIndicator.IsBusy == true)
320
            {
321
                return;
322
            }
323

    
324
            //var result = await Dispatcher.InvokeAsync<bool>(()=>
325
            //{
326
                this.ParentOfType<MainWindow>().dzMainMenu.busyIndicator.IsBusy = true;
327

    
328
                _SaveEvent(sender, e);
329

    
330
                mianMenu.busyIndicator.IsBusy = false;
331
               
332
            //});
333

    
334
            //System.Threading.Tasks.Task SaveTask = System.Threading.Tasks.Task.Factory.StartNew(() =>
335
            //{
336
            //    Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, new Action<object, RoutedEventArgs>(_SaveEvent), sender, e);
337
            //}).ContinueWith(task =>
338
            //{
339
            //    Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate () { this.ParentOfType<MainWindow>().dzMainMenu.busyIndicator.IsBusy = false; }));
340
            //});
341
        }
342

    
343
        /// <summary>
344
        /// save markup
345
        ///  - convert ink control to polygon control if ink control exists
346
        ///  - unselect and update my markup list
347
        /// <param name="sender"></param>
348
        /// <param name="e"></param>
349
        public async Task<bool> _SaveEvent(object sender, RoutedEventArgs e)
350
        {
351
            bool result = false;
352

    
353
            var mainMenu = this.ParentOfType<MainWindow>().dzMainMenu;
354
            try
355
            {
356
                mainMenu.ConvertInkControlToPolygon();
357

    
358
                mainMenu.UpdateMyMarkupList();
359

    
360
                if (mainMenu.gridViewMarkup.SelectedItems.Count == 0 && mainMenu.gridViewMarkup.Items.Count > 0)
361
                {
362
                    this.ParentOfType<MainWindow>().DialogMessage_Alert("Please Select Your Comment List Item", "Alert");
363
                }
364
                else
365
                {                    
366
                    foreach (var item in mainMenu.gridViewMarkup.SelectedItems)
367
                    {
368
                        if ((item as IKCOM.MarkupInfoItem).UserID == App.ViewInfo.UserID)
369
                        {
370
                            #region 저장 서비스 호출(저장 완료시까지 대기)
371
                            await this.ExecuteSaveCommandAsync(mainMenu);
372
                            #endregion
373

    
374
                            var info = ViewerDataModel.Instance._markupInfoList.FirstOrDefault(data => data.MarkupInfoID == (item as IKCOM.MarkupInfoItem).MarkupInfoID);
375
                            if(info != null) info.UpdateTime = DateTime.Now;
376
                            if (!ViewerDataModel.Instance.IsConsolidate && (sender != null))
377
                            {
378
                                this.ParentOfType<MainWindow>().DialogMessage_Alert("Save is complete.", "Info");
379
                            }
380

    
381
                            result = true;
382
                        }
383
                    }
384
                }
385

    
386
                mainMenu.SetCommentPages(null);
387

    
388
                ViewerDataModel.Instance.UndoDataList.Clear();
389
            }
390
            catch (Exception ex)
391
            {
392
                System.Diagnostics.Debug.WriteLine("_SaveEvent Error : " + ex.ToString());
393
            }
394
            finally
395
            {
396
                /*
397
                /// delete markup information when 코멘트가 없을 경우
398
                if (ViewerDataModel.Instance.MyMarkupList.Count == 0)
399
                {
400
                    foreach (var item in menu.gridViewMarkup.SelectedItems)
401
                    {
402
                        if ((item as IKCOM.MarkupInfoItem).UserID == App.ViewInfo.UserID)
403
                        {
404
                            //this.ParentOfType<MainWindow>().dzMainMenu.DeleteItem((item as IKCOM.MarkupInfoItem));
405
                        }
406
                    }
407
                }
408
                */
409
            }
410

    
411
            return result;
412
        }
413

    
414
        public async Task<bool>  SaveEventAsync()
415
        {
416
            bool result = false;
417

    
418
            var mainMenu = this.ParentOfType<MainWindow>().dzMainMenu;
419
            try
420
            {
421
                mainMenu.ConvertInkControlToPolygon();
422

    
423
                // update mylist and gridview
424
                mainMenu.UpdateMyMarkupList();
425

    
426
                if (mainMenu.gridViewMarkup.SelectedItems.Count == 0 && mainMenu.gridViewMarkup.Items.Count > 0)
427
                {
428
                    this.ParentOfType<MainWindow>().DialogMessage_Alert("Please Select Your Comment List Item", "Alert");
429
                }
430
                else
431
                {
432
                    foreach (var item in mainMenu.gridViewMarkup.SelectedItems)
433
                    {
434
                        if ((item as IKCOM.MarkupInfoItem).UserID == App.ViewInfo.UserID)
435
                        {
436
                            /// 저장 서비스 호출
437
                            result = await this.ExecuteSaveCommandAsync(mainMenu);
438
                            ViewerDataModel.Instance._markupInfoList.Where(data => data.MarkupInfoID == (item as IKCOM.MarkupInfoItem).MarkupInfoID).FirstOrDefault().UpdateTime = DateTime.Now;
439
                        }
440
                    }
441
                }
442

    
443
                mainMenu.SetCommentPages(null);
444

    
445
                ViewerDataModel.Instance.UndoDataList.Clear();
446
                result = true;
447
            }
448
            catch (Exception ex)
449
            {
450
                System.Diagnostics.Debug.WriteLine("_SaveEvent Error : " + ex.ToString());
451
            }
452
            finally
453
            {
454
                /*
455
                /// delete markup information when 코멘트가 없을 경우
456
                if (ViewerDataModel.Instance.MyMarkupList.Count == 0)
457
                {
458
                    foreach (var item in menu.gridViewMarkup.SelectedItems)
459
                    {
460
                        if ((item as IKCOM.MarkupInfoItem).UserID == App.ViewInfo.UserID)
461
                        {
462
                            //this.ParentOfType<MainWindow>().dzMainMenu.DeleteItem((item as IKCOM.MarkupInfoItem));
463
                        }
464
                    }
465
                }
466
                */
467
            }
468

    
469
            return result;
470
        }
471

    
472
        /// <summary>
473
        /// 마크업 데이터를 저장한다.
474
        /// </summary>
475
        /// <param name="menu"></param>
476
        /// <returns></returns>
477
        public async Task<bool> ExecuteSaveCommandAsync(MainMenu menu)
478
        {
479
            bool result = false;
480

    
481
            if (menu.pageNavigator.CurrentPage != null)
482
            {
483
                SaveCommand.Instance.Project_No = App.ViewInfo.ProjectNO;
484
                SaveCommand.Instance.document_id = App.ViewInfo.DocumentItemID;
485
                SaveCommand.Instance.user_id = App.ViewInfo.UserID;
486
                SaveCommand.Instance.page_no = menu.pageNavigator.CurrentPage.PageNumber;
487

    
488
                try
489
                {
490
                    if (ViewerDataModel.Instance.UndoDataList.Count > 0 || ViewerDataModel.Instance.IsMarkupUpdate)
491
                    {
492
                        List<IKCOM.MarkupInfoItem> SelectedMarkupInfos = new List<IKCOM.MarkupInfoItem>();
493
                        foreach (var item in menu.gridViewMarkup.SelectedItems)
494
                        {
495
                            if ((item as IKCOM.MarkupInfoItem).UserID == App.ViewInfo.UserID)
496
                            {
497
                                SelectedMarkupInfos.Add(item as IKCOM.MarkupInfoItem);
498
                            }
499
                        }
500

    
501
                        result = await SaveCommand.Instance.Execute(SelectedMarkupInfos);
502
                        ViewerDataModel.Instance.IsMarkupUpdate = false;
503
                    }
504
                    else
505
                    {
506
                        result = true;
507
                    }
508

    
509
                    if (ViewerDataModel.Instance.RotationDocs.Count > 0)
510
                    {
511
                        SaveCommand.Instance.PageAngleSave(App.ViewInfo.ProjectNO, ViewerDataModel.Instance.RotationDocs);
512
                    }
513
                }
514
                catch (Exception ex)
515
                {
516
                    this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert(string.Format("세이브 실패:{0}", ex.Message), "Alert");
517
                    throw new InvalidOperationException(ex.Message);
518
                }
519
            }
520
            else
521
            {
522
                System.Diagnostics.Debug.WriteLine("ExecuteSaveCommand Error - pageNavigator.CurrentPage null");
523
            }
524

    
525
            return result;
526
        }
527

    
528
        //강인구 추가
529
        public void Print_Start(string Type)
530
        {
531
            if (ViewerDataModel.Instance.MarkupControls_USER.Count > 0 || this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
532
            {
533
                var menu = this.ParentOfType<MainWindow>().dzMainMenu;
534
                SelectionSet.Instance.UnSelect(menu);
535
                if (menu.PreviewUserMarkupInfoItem != null && menu.PreviewUserMarkupInfoItem.IsPreviewUser == true)
536
                {
537
                    this.SaveEventCallback(null, null);
538
                }
539
                else if (menu.gridViewMarkup.SelectedItems.Count == 0 || (menu.gridViewMarkup.SelectedItems.FirstOrDefault() as IKCOM.MarkupInfoItem).UserID != App.ViewInfo.UserID)
540
                {
541

    
542
                }
543
                else
544
                {
545
                    this.SaveEventCallback(null, null);
546
                }
547
            }
548

    
549
            bool isprint = false;
550
            if (Type == "Print")
551
            {
552
                isprint = true;
553
            }
554

    
555
            RadWindow PrintWindow = new RadWindow();
556
            PrintWindow.Width = 850;
557
            PrintWindow.Height = 600;
558
            PrintWindow.Header = Type;
559

    
560
            List<IKCOM.MarkupInfoItem> markupinfo = new List<IKCOM.MarkupInfoItem>();
561

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

    
564
            if (markupinfo?.Count() > 0)
565
            {
566
                //Logger.sendResLog("GetPrintDocItemList", "TRUE", 1);
567
            }
568
            else
569
            {
570
                //Logger.sendResLog("GetPrintDocItemList", "FALSE", 1);
571
            }
572

    
573
            /// Tile Source URL을 구한다
574

    
575
            string sImageURL = ViewerDataModel.Instance.SystemMain.dzMainMenu.GetImageURL(App.ViewInfo.DocumentItemID, this.ParentOfType<MainWindow>().dzMainMenu.pageNavigator.CurrentPage.PageNumber);
576
            var url = new Uri(sImageURL);
577
            string sFolder = App.ViewInfo.DocumentItemID.All(char.IsDigit) ? (Convert.ToInt64(App.ViewInfo.DocumentItemID) / 100).ToString() : App.ViewInfo.DocumentItemID.Substring(0, 5);
578
            var Tile_Url = string.Format(@"{0}://{1}:{2}/TileSource/{3}_Tile/{4}/{5}/",
579
                url.Scheme, url.Host, url.Port,
580
                App.ViewInfo.ProjectNO,
581
                sFolder,
582
                App.ViewInfo.DocumentItemID
583
                );
584
            /// up to here
585

    
586
            var docitem = this.ParentOfType<MainWindow>().dzMainMenu._DocItem;
587

    
588
            PrintWindow.Content = new KCOM.Control.PrintControl(
589
                      Tile_Url,
590
                      App.ViewInfo.ProjectNO,
591
                      this.ParentOfType<MainWindow>().dzMainMenu._DocInfo,
592
                      markupinfo,
593
                      this.ParentOfType<MainWindow>().dzMainMenu.pageNavigator.CurrentPage.PageNumber,
594
                      docitem.GROUP_NO,
595
                      docitem.DOCUMENT_NO,
596
                      docitem.ORIGINAL_FILE,
597
                      isprint);
598

    
599
            //프린트 팝업 옵션
600
            //PrintWindow.BorderThickness = new Thickness(3);
601
            //PrintWindow.BorderBrush = new SolidColorBrush(Color.FromArgb(255, 37, 160, 218));
602
            PrintWindow.ResizeMode = System.Windows.ResizeMode.NoResize;
603
            PrintWindow.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
604
            PrintWindow.Background = new SolidColorBrush(Colors.Black);
605
            PrintWindow.Background.Opacity = 0.6;
606
            PrintWindow.Owner = Application.Current.MainWindow;
607
            Telerik.Windows.Controls.StyleManager.SetTheme(PrintWindow, new Telerik.Windows.Controls.VisualStudio2013Theme());
608
            PrintWindow.ShowDialog();
609
        }
610

    
611
        //강인구 추가
612
        private void PrintEvent(object sender, RoutedEventArgs e)
613
        {
614
            RadRibbonButton button = sender as RadRibbonButton;
615
            Print_Start(button.Content.ToString());
616
        }
617

    
618
        private List<AdornerMember> GetAdornerItem()
619
        {
620
            List<AdornerMember> AdonerList = new List<AdornerMember>();
621

    
622
            if (this.ParentOfType<MainWindow>() != null)
623
            {
624
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
625
                {
626
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
627
                    {
628
                        if (item.GetType().Name == "AdornerFinal")
629
                        {
630
                            foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
631
                            {
632
                                AdonerList.Add(InnerItem);
633
                            }
634
                        }
635
                    }
636
                }
637
            }
638

    
639
            return AdonerList;
640
        }
641
        /// <summary>
642
        /// 투명도
643
        /// </summary>
644
        /// <param name="sender"></param>
645
        /// <param name="e"></param>
646
        //강인구 추가(Undo End)
647
        private void sdOpacity_ValueChanged(object sender, RoutedEventArgs e)
648
        {
649
            List<AdornerMember> AdonerList = GetAdornerItem();
650
            if(AdonerList.Count > 0)
651
            {
652
                UndoDataGroup UndoData = new UndoDataGroup()
653
                {
654
                    IsUndo = false,
655
                    Event = EventType.Operation,
656
                    EventTime = DateTime.Now,
657
                    Opacity = ViewerDataModel.Instance.ControlOpacity,
658
                    MarkupDataColl = new List<UndoData>()
659
                };
660
                UndoData multi_UndoData = new UndoData();
661

    
662
                foreach (AdornerMember InnerItem in AdonerList)
663
                {
664
                    InnerItem.DrawingData.Opacity = ViewerDataModel.Instance.ControlOpacity;
665
                  
666
                    multi_UndoData.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
667
                    UndoData.MarkupDataColl.Add(multi_UndoData);
668
                    multi_UndoData = new UndoData();
669
                }
670

    
671
                ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
672
                {
673
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
674
                });
675
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
676
            }
677
        }
678

    
679
        //강인구 추가(Undo End)
680
        private void cbLineSize_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
681
        {
682
            if (string.IsNullOrEmpty(cbLineSize.Value.ToString()))
683
            {
684
                cbLineSize.Value = cbLineSize.Minimum;
685
            }
686
            List<AdornerMember> AdonerList = GetAdornerItem();
687
            if (AdonerList.Count > 0)
688
            {
689
                UndoDataGroup UndoData = new UndoDataGroup()
690
                {
691
                    IsUndo = false,
692
                    Event = EventType.Operation,
693
                    EventTime = DateTime.Now,
694
                    LineSize = ViewerDataModel.Instance.LineSize,
695
                    MarkupDataColl = new List<UndoData>()
696
                };
697
                UndoData multi_UndoData = new UndoData();
698

    
699
                foreach (AdornerMember InnerItem in AdonerList)
700
                {
701
                    switch (InnerItem.DrawingData.GetType().Name)
702
                    {
703
                        case ("LineControl"):
704
                            {
705
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Line.LineControl).LineSize = ViewerDataModel.Instance.LineSize;
706
                            }
707
                            break;
708
                        case ("ArcControl"):
709
                            {
710
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Line.ArcControl).LineSize = ViewerDataModel.Instance.LineSize;
711
                            }
712
                            break;
713
                        case ("ArrowArcControl"):
714
                            {
715
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Line.ArrowArcControl).LineSize = ViewerDataModel.Instance.LineSize;
716
                            }
717
                            break;
718
                        case ("ArrowControl_Multi"):
719
                            {
720
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Line.ArrowControl_Multi).LineSize = ViewerDataModel.Instance.LineSize;
721
                            }
722
                            break;
723
                        case ("CloudControl"):
724
                            {
725
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Polygon.CloudControl).LineSize = ViewerDataModel.Instance.LineSize;
726
                            }
727
                            break;
728
                        case ("PolygonControl"):
729
                            {
730
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Polygon.PolygonControl).LineSize = ViewerDataModel.Instance.LineSize;
731
                            }
732
                            break;
733
                        case ("RectangleControl"):
734
                            {
735
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.RectangleControl).LineSize = ViewerDataModel.Instance.LineSize;
736
                            }
737
                            break;
738
                        case ("RectCloudControl"):
739
                            {
740
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.RectCloudControl).LineSize = ViewerDataModel.Instance.LineSize;
741
                            }
742
                            break;
743
                        case ("TriControl"):
744
                            {
745
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.TriControl).LineSize = ViewerDataModel.Instance.LineSize;
746
                            }
747
                            break;
748
                        case ("CircleControl"):
749
                            {
750
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.CircleControl).LineSize = ViewerDataModel.Instance.LineSize;
751
                            }
752
                            break;
753
                        case ("ArrowTextControl"):
754
                            {
755
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).LineSize = ViewerDataModel.Instance.LineSize;
756
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).BorderSize = new Thickness(ViewerDataModel.Instance.LineSize);
757
                            }
758
                            break;
759
                        case ("TextControl"):
760
                            {
761
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).LineSize = new Thickness(ViewerDataModel.Instance.LineSize);
762
                            }
763
                            break;
764
                        case ("InsideWhiteControl"):
765
                            {
766
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Cad.InsideWhiteControl).LineSize = ViewerDataModel.Instance.LineSize;
767
                            }
768
                            break;
769
                        case ("OverlapWhiteControl"):
770
                            {
771
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Cad.OverlapWhiteControl).LineSize = ViewerDataModel.Instance.LineSize;
772
                            }
773
                            break;
774
                        case ("ClipWhiteControl"):
775
                            {
776
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Cad.ClipWhiteControl).LineSize = ViewerDataModel.Instance.LineSize;
777
                            }
778
                            break;
779
                        case ("CoordinateControl"):
780
                            {
781
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Cad.CoordinateControl).LineSize = 10; //ViewerDataModel.Instance.LineSize
782
                            }
783
                            break;
784
                    }
785
                    
786

    
787
                    multi_UndoData.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
788
                    UndoData.MarkupDataColl.Add(multi_UndoData);
789
                    multi_UndoData = new UndoData();
790
                }
791

    
792
                ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
793
                {
794
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
795
                });
796
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
797

    
798
                
799
            }
800
            KCOM.Properties.Settings.Default.LineSize = (double)cbLineSize.Value;
801
            Properties.Settings.Default.Save();
802
        }
803

    
804

    
805
        private void cbIntervalSize_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
806
        {
807
            if (string.IsNullOrEmpty(cbIntervalSize.Value.ToString()))
808
            {
809
                cbIntervalSize.Value = cbIntervalSize.Minimum;
810
            }
811
            List<AdornerMember> AdonerList = GetAdornerItem();
812
            if (AdonerList.Count > 0)
813
            {
814

    
815
                UndoDataGroup UndoData = new UndoDataGroup()
816
                {
817
                    IsUndo = false,
818
                    Event = EventType.Operation,
819
                    EventTime = DateTime.Now,
820
                    Interval = ViewerDataModel.Instance.Interval,
821
                    MarkupDataColl = new List<UndoData>()
822
                };
823
                UndoData multi_UndoData = new UndoData();
824

    
825
                foreach (AdornerMember InnerItem in AdonerList)
826
                {
827
                    switch (InnerItem.DrawingData.GetType().Name)
828
                    {
829
                        case ("LineControl"):
830
                            {
831
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Line.LineControl).Interval = ViewerDataModel.Instance.Interval;
832

    
833
                                multi_UndoData.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
834
                                UndoData.MarkupDataColl.Add(multi_UndoData);
835
                                multi_UndoData = new UndoData();
836
                            }
837
                            break;
838
                    }
839
                }
840

    
841
                ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
842
                {
843
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
844
                });
845
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
846
            }
847
            KCOM.Properties.Settings.Default.Interval = (double)cbIntervalSize.Value;
848
            Properties.Settings.Default.Save();
849
        }
850
        
851
        /// <summary>
852
        /// ArcLength가 수정되었을때
853
        /// </summary>
854
        /// <param name="sender"></param>
855
        /// <param name="e"></param>
856
        private void cbArcLength_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
857
        {
858
            if (string.IsNullOrEmpty(cbArcLength.Value.ToString()))
859
            {
860
                cbArcLength.Value = cbArcLength.Minimum;
861
            }
862

    
863
            List<AdornerMember> AdonerList = GetAdornerItem();
864
            if (AdonerList.Count > 0)
865
            {
866
                var comments = (from drawing in AdonerList
867
                                select drawing.DrawingData as CommentUserInfo)
868
                                .Where(x => x is RectCloudControl || x is CloudControl ||
869
                                x is MarkupToPDF.Controls.Text.TextControl || x is MarkupToPDF.Controls.Text.ArrowTextControl)
870
                                .ToList();
871
                UndoCommand.Instance.Push(EventType.Operation, comments);
872

    
873
                foreach (AdornerMember InnerItem in AdonerList)
874
                {
875
                    switch (InnerItem.DrawingData.GetType().Name)
876
                    {
877
                        case ("RectCloudControl"):
878
                            {
879
                                var item = InnerItem.DrawingData as MarkupToPDF.Controls.Shape.RectCloudControl;
880
                                item.ArcLength = ViewerDataModel.Instance.ArcLength;
881
                            }
882
                        break;
883
                        case ("CloudControl"):
884
                        {
885
                                var item = InnerItem.DrawingData as MarkupToPDF.Controls.Polygon.CloudControl;
886
                                item.ArcLength = ViewerDataModel.Instance.ArcLength;
887
                        }
888
                        break;
889
                        case ("TextControl"):
890
                        {
891
                                var item = InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl;
892
                                item.ArcLength = ViewerDataModel.Instance.ArcLength;
893
                        }
894
                        break;
895
                        case ("ArrowTextControl"):
896
                        {
897
                                var item = InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl;
898
                                item.ArcLength = ViewerDataModel.Instance.ArcLength;
899
                        }
900
                        break;
901
                    }
902
                }
903
            }
904

    
905
            KCOM.Properties.Settings.Default.ArcLength = (double)cbArcLength.Value;
906
            Properties.Settings.Default.Save();
907
        }
908

    
909
        //강인구 추가(Undo End)
910
        private void cbDashStyle_SelectionChanged(object sender, SelectionChangedEventArgs e)
911
        {
912
            //강인구 추가
913
            if (this.ParentOfType<MainWindow>() != null)
914
            {
915
                ViewerDataModel.Instance.DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
916
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
917
                {
918
                    UndoDataGroup UndoData = new UndoDataGroup()
919
                    {
920
                        IsUndo = false,
921
                        Event = EventType.Operation,
922
                        EventTime = DateTime.Now,
923
                        DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData,
924
                        MarkupDataColl = new List<UndoData>()
925
                    };
926
                    UndoData multi_UndoData = new UndoData();
927

    
928
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
929
                    {
930
                        if (item.GetType().Name == "AdornerFinal")
931
                        {
932
                            foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
933
                            {
934
                                switch (InnerItem.DrawingData.GetType().Name)
935
                                {
936
                                    case ("LineControl"):
937
                                        {
938
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Line.LineControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
939
                                        }
940
                                        break;
941
                                    case ("ArcControl"):
942
                                        {
943
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Line.ArcControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
944
                                        }
945
                                        break;
946
                                    case ("ArrowArcControl"):
947
                                        {
948
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Line.ArrowArcControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
949
                                        }
950
                                        break;
951
                                    case ("ArrowControl_Multi"):
952
                                        {
953
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Line.ArrowControl_Multi).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
954
                                        }
955
                                        break;
956
                                    case ("CloudControl"):
957
                                        {
958
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Polygon.CloudControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
959
                                        }
960
                                        break;
961
                                    case ("PolygonControl"):
962
                                        {
963
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Polygon.PolygonControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
964
                                        }
965
                                        break;
966
                                    case ("RectangleControl"):
967
                                        {
968
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.RectangleControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
969
                                        }
970
                                        break;
971
                                    case ("RectCloudControl"):
972
                                        {
973
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.RectCloudControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
974
                                        }
975
                                        break;
976
                                    case ("TriControl"):
977
                                        {
978
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.TriControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
979
                                        }
980
                                        break;
981
                                    case ("CircleControl"):
982
                                        {
983
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.CircleControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
984
                                        }
985
                                        break;
986
                                    case ("InsideWhiteControl"):
987
                                        {
988
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Cad.InsideWhiteControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
989
                                        }
990
                                        break;
991
                                    case ("OverlapWhiteControl"):
992
                                        {
993
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Cad.OverlapWhiteControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
994
                                        }
995
                                        break;
996
                                    case ("ClipWhiteControl"):
997
                                        {
998
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Cad.ClipWhiteControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
999
                                        }
1000
                                        break;
1001
                                    case ("CoordinateControl"):
1002
                                        {
1003
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Cad.CoordinateControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
1004
                                        }
1005
                                        break;
1006
                                }
1007

    
1008
                                multi_UndoData.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
1009
                                UndoData.MarkupDataColl.Add(multi_UndoData);
1010
                                multi_UndoData = new UndoData();
1011
                            }
1012

    
1013
                            ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
1014
                            {
1015
                                ViewerDataModel.Instance.UndoDataList.Remove(i);
1016
                            });
1017
                            ViewerDataModel.Instance.UndoDataList.Add(UndoData);
1018
                        }
1019
                    }
1020
                }
1021
            }
1022
        }
1023

    
1024
        //강인구 추가
1025
        private void comboFontSize_SelectionChanged(object sender, SelectionChangedEventArgs e)
1026
        {
1027
            //if (this.ParentOfType<MainWindow>() != null)
1028
            //{
1029
            //    if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
1030
            //    {
1031
            //        foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
1032
            //        {
1033
            //            if (item.GetType().Name == "AdornerFinal")
1034
            //            {
1035
            //                foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
1036
            //                {
1037
            //                    switch (InnerItem.DrawingData.GetType().Name)
1038
            //                    {
1039
            //                        case ("TextControl"):
1040
            //                            {
1041
            //                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextSize = int.Parse(comboFontSize.Text);
1042
            //                            }
1043
            //                            break;
1044
            //                        case ("ArrowTextControl"):
1045
            //                            {
1046
            //                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextSize = int.Parse(comboFontSize.Text);
1047
            //                            }
1048
            //                            break;
1049
            //                    }
1050
            //                }
1051
            //            }
1052
            //        }
1053
            //    }
1054
            //}
1055
        }
1056

    
1057
        //강인구 추가
1058
        private void btnBold_Checked(object sender, RoutedEventArgs e)
1059
        {
1060
            if (this.ParentOfType<MainWindow>() != null)
1061
            {
1062
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
1063
                {
1064
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
1065
                    {
1066
                        if (item.GetType().Name == "AdornerFinal")
1067
                        {
1068
                            foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
1069
                            {
1070
                                switch (InnerItem.DrawingData.GetType().Name)
1071
                                {
1072
                                    case ("TextControl"):
1073
                                        {
1074
                                            if((InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextWeight == FontWeights.Bold)
1075
                                            {
1076
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextWeight = FontWeights.Normal;
1077
                                                ViewerDataModel.Instance.IsMarkupUpdate = true;
1078
                                            }
1079
                                            else
1080
                                            {
1081
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextWeight = FontWeights.Bold;
1082
                                                ViewerDataModel.Instance.IsMarkupUpdate = true;
1083
                                            }
1084

    
1085
                                        }
1086
                                        break;
1087
                                    case ("ArrowTextControl"):
1088
                                        {
1089
                                            if ((InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextWeight == FontWeights.Bold)
1090
                                            {
1091
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextWeight = FontWeights.Normal;
1092
                                                ViewerDataModel.Instance.IsMarkupUpdate = true;
1093
                                            }
1094
                                            else
1095
                                            {
1096
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextWeight = FontWeights.Bold;
1097
                                                ViewerDataModel.Instance.IsMarkupUpdate = true;
1098
                                            }
1099
                                        }
1100
                                        break;
1101
                                }
1102
                            }
1103
                        }
1104
                    }
1105
                }
1106
            }
1107
        }
1108

    
1109
        //강인구 추가
1110
        private void btnItalic_Checked(object sender, RoutedEventArgs e)
1111
        {
1112
            if (this.ParentOfType<MainWindow>() != null)
1113
            {
1114
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
1115
                {
1116
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
1117
                    {
1118
                        if (item.GetType().Name == "AdornerFinal")
1119
                        {
1120
                            foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
1121
                            {
1122
                                switch (InnerItem.DrawingData.GetType().Name)
1123
                                {
1124
                                    case ("TextControl"):
1125
                                        {
1126
                                            if((InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextStyle == FontStyles.Italic)
1127
                                            {
1128
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextStyle = System.Windows.FontStyles.Normal;
1129
                                                ViewerDataModel.Instance.IsMarkupUpdate = true;
1130
                                            }
1131
                                            else
1132
                                            {
1133
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextStyle = FontStyles.Italic;
1134
                                                ViewerDataModel.Instance.IsMarkupUpdate = true;
1135
                                            }
1136

    
1137
                                        }
1138
                                        break;
1139
                                    case ("ArrowTextControl"):
1140
                                        {
1141
                                            if((InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextStyle == FontStyles.Italic)
1142
                                            {
1143
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextStyle = FontStyles.Normal;
1144
                                                ViewerDataModel.Instance.IsMarkupUpdate = true;
1145
                                            }
1146
                                            else
1147
                                            {
1148
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextStyle = FontStyles.Italic;
1149
                                                ViewerDataModel.Instance.IsMarkupUpdate = true;
1150
                                            }
1151
                                        }
1152
                                        break;
1153
                                }
1154
                            }
1155
                        }
1156
                    }
1157
                }
1158
            }
1159
        }
1160

    
1161
        //강인구 추가
1162
        private void btnUnderLine_Checked(object sender, RoutedEventArgs e)
1163
        {
1164
            if (this.ParentOfType<MainWindow>() != null)
1165
            {
1166
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
1167
                {
1168
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
1169
                    {
1170
                        if (item.GetType().Name == "AdornerFinal")
1171
                        {
1172
                            foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
1173
                            {
1174
                                switch (InnerItem.DrawingData.GetType().Name)
1175
                                {
1176
                                    case ("TextControl"):
1177
                                        {
1178
                                            if ((InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).UnderLine == TextDecorations.Underline)
1179
                                            {
1180
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).UnderLine = null;
1181
                                            }
1182
                                            else
1183
                                            {
1184
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).UnderLine = TextDecorations.Underline;
1185
                                            }
1186
                                        }
1187
                                        break;
1188
                                    case ("ArrowTextControl"):
1189
                                        {
1190
                                            if ((InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).UnderLine == TextDecorations.Underline)
1191
                                            {
1192
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).UnderLine = null;
1193
                                            }
1194
                                            else
1195
                                            {
1196
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).UnderLine = TextDecorations.Underline;
1197
                                            }
1198
                                        }
1199
                                        break;
1200
                                }
1201

    
1202
                                ViewerDataModel.Instance.IsMarkupUpdate = true;
1203
                            }
1204
                        }
1205
                    }
1206
                }
1207
            }
1208
        }
1209

    
1210

    
1211
        private void cbLineSize_PreviewKeyDown(object sender, System.Windows.Input.KeyEventArgs e)
1212
        {
1213
            if (e.Key == Key.Space || e.Key == Key.ImeProcessed)
1214
            {
1215
                e.Handled = true;
1216
            }
1217

    
1218
        }
1219

    
1220
        private void cbLineSize_PreviewTextInput(object sender, System.Windows.Input.TextCompositionEventArgs e)
1221
        {
1222
            var regex = new Regex(@"[^a-zA-Z0-9\s]");
1223
            if (regex.IsMatch(e.Text))
1224
            {
1225
                e.Handled = true;
1226
            }
1227

    
1228
        }
1229

    
1230
        private void cbArcLength_PreviewKeyDown(object sender, System.Windows.Input.KeyEventArgs e)
1231
        {
1232
            if (e.Key == Key.Space || e.Key == Key.ImeProcessed)
1233
            {
1234
                e.Handled = true;
1235
            }
1236
        }
1237

    
1238
        private void cbArcLength_PreviewTextInput(object sender, System.Windows.Input.TextCompositionEventArgs e)
1239
        {
1240
            var regex = new Regex(@"[^a-zA-Z0-9\s]");
1241
            if (regex.IsMatch(e.Text))
1242
            {
1243
                e.Handled = true;
1244
            }
1245
        }
1246

    
1247
        private void comboFontSize_PreviewKeyDown(object sender, System.Windows.Input.KeyEventArgs e)
1248
        {
1249
            if (e.Key == Key.Space || e.Key == Key.ImeProcessed)
1250
            {
1251
                e.Handled = true;
1252
            }
1253
        }
1254

    
1255
        private void cbIntervalSize_PreviewKeyDown(object sender, System.Windows.Input.KeyEventArgs e)
1256
        {
1257
            if (e.Key == Key.Space || e.Key == Key.ImeProcessed)
1258
            {
1259
                e.Handled = true;
1260
            }
1261
        }
1262

    
1263
        private void cbIntervalSize_PreviewTextInput(object sender, System.Windows.Input.TextCompositionEventArgs e)
1264
        {
1265
            var regex = new Regex(@"[^a-zA-Z0-9\s]");
1266
            if (regex.IsMatch(e.Text))
1267
            {
1268
                e.Handled = true;
1269
            }
1270
        }
1271

    
1272
        private void comboFontSize_PreviewTextInput(object sender, System.Windows.Input.TextCompositionEventArgs e)
1273
        {
1274
            var regex = new Regex(@"[^a-zA-Z0-9\s]");
1275
            if (regex.IsMatch(e.Text))
1276
            {
1277
                e.Handled = true;
1278
            }
1279
        }
1280

    
1281
        private void comboFontSize_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
1282
        {
1283
            if (string.IsNullOrEmpty(comboFontSize.Value.ToString()))
1284
            {
1285
                comboFontSize.Value = comboFontSize.Minimum;
1286
            }
1287
            if (this.ParentOfType<MainWindow>() != null)
1288
            {
1289
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
1290
                {
1291
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
1292
                    {
1293
                        if (item.GetType().Name == "AdornerFinal")
1294
                        {
1295
                            foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
1296
                            {
1297
                                switch (InnerItem.DrawingData.GetType().Name)
1298
                                {
1299
                                    case ("TextControl"):
1300
                                        {
1301
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextSize = int.Parse(comboFontSize.Value.ToString());
1302
                                        }
1303
                                        break;
1304
                                    case ("ArrowTextControl"):
1305
                                        {
1306
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextSize = int.Parse(comboFontSize.Value.ToString());
1307
                                        }
1308
                                        break;
1309
                                }
1310
                            }
1311

    
1312
                            ChangeComment(item as Controls.AdornerFinal);
1313
                        }
1314
                    }
1315
                }
1316
            }
1317

    
1318
            KCOM.Properties.Settings.Default.TextSize = (double)comboFontSize.Value;
1319
            Properties.Settings.Default.Save();
1320
        }
1321

    
1322
        //강인구 추가
1323
        private void comboFontFamily_SelectionChanged(object sender, SelectionChangedEventArgs e)
1324
        {
1325
            
1326
            if (comboFontFamily.SelectedItem != null && !IsSuspendChange)
1327
            {
1328
                var main = this.ParentOfType<MainWindow>()?.dzMainMenu;
1329
                var font = comboFontFamily.SelectedItem as Markus.Fonts.MarkusFont;
1330
                var lstTextCtrl = SelectTextControl();
1331

    
1332
                foreach (var item in lstTextCtrl)
1333
                {
1334
                    if (item is MarkupToPDF.Controls.Text.ArrowTextControl ctrl1)
1335
                    {
1336
                        ViewerDataModel.Instance.IsMarkupUpdate = true;
1337
                        ctrl1.SetFontFamily(font.FontFamily);
1338
                    }
1339
                    else if (item is MarkupToPDF.Controls.Text.TextControl ctrl2)
1340
                    {
1341
                        ViewerDataModel.Instance.IsMarkupUpdate = true;
1342
                        ctrl2.SetFontFamily(font.FontFamily);
1343
                    }
1344
                }
1345

    
1346
                KCOM.Properties.Settings.Default.FontFamily = font.FontFamily.FontName();
1347
                Properties.Settings.Default.Save();
1348
            }
1349
        }
1350

    
1351
        private List<UIElement> SelectTextControl()
1352
        {
1353
            List<UIElement> lstTextCtrl = new List<UIElement>();
1354

    
1355
            var main = this.ParentOfType<MainWindow>()?.dzMainMenu;
1356
            var font = comboFontFamily.SelectedItem as Markus.Fonts.MarkusFont;
1357

    
1358

    
1359
            if (main.SelectLayer.FindChildByType<AdornerFinal>() != null)
1360
            {
1361
                lstTextCtrl.AddRange(main.SelectLayer.FindChildByType<AdornerFinal>().Members.Where(x => x.DrawingData is MarkupToPDF.Controls.Common.ITextControl).Select(x => x.DrawingData));
1362
            }
1363

    
1364
            lstTextCtrl.AddRange(main.zoomAndPanCanvas.FindAllChildren(x => x is MarkupToPDF.Controls.Common.ITextControl c && (c.IsSelected || c.IsEditingMode == true)).Select(x => (UIElement)x));
1365

    
1366
            return lstTextCtrl;
1367
        }
1368

    
1369

    
1370
        /// <summary>
1371
        /// 텍스트 컨트롤 하일라이트 처리
1372
        /// </summary>
1373
        /// <param name="sender"></param>
1374
        /// <param name="e"></param>
1375
        private void HighlightEvent(object sender, RoutedEventArgs e)
1376
        {
1377

    
1378
            ViewerDataModel.Instance.checkHighShape = (sender as CheckBox).IsChecked.Value;
1379
            SetHighlightEvent();
1380
            //if ((sender as CheckBox).IsChecked.Value)
1381
            //{
1382
            //    TaskMessage("HighLight가 설정되었습니다", TaskMessageType.Normal);
1383
            //}
1384
            //else
1385
            //{
1386
            //    TaskMessage("HighLight가 해제되었습니다", TaskMessageType.Caption);
1387
            //}
1388
            //if (ViewerDataModel.Instance.SelectedEditor as MarkupToPDF.Controls.Text.TextControl != null)
1389
            //{
1390
            //    MarkupToPDF.Controls.Text.TextControl instance = (ViewerDataModel.Instance.SelectedEditor as MarkupToPDF.Controls.Text.TextControl);
1391
            //    instance.IsHighLight = ViewerDataModel.Instance.checkHighShape;
1392
            //    instance.SetText();
1393
            //}
1394
        }
1395

    
1396
        //추가페이지 이동 엔터
1397
        private void tlcurrentPage_KeyDown(object sender, KeyEventArgs e)
1398
        {
1399
            //강인구 추가 tlcurrentPage을 이상하게 입력할수 있기때문에 Try Catch
1400
            if (e.Key == Key.Enter)
1401
            {
1402
                try
1403
                {
1404
                    var instanceMain = this.ParentOfType<MainWindow>();
1405
                    var max = instanceMain.dzMainMenu.pageNavigator._thumbnailItems.Max(f => f.PageNumber);
1406
                    if (string.IsNullOrEmpty(tlcurrentPage.Text))
1407
                    {
1408
                        RadWindow.Alert(new DialogParameters
1409
                        {
1410
                            Owner = Application.Current.MainWindow,
1411
                            Theme = new VisualStudio2013Theme(),
1412
                            Header = "Info",
1413
                            Content = "Enter the correct page number.",
1414
                        });
1415
                    }
1416
                    else
1417
                    {
1418
                        if (Convert.ToInt32(tlcurrentPage.Text) > max || Convert.ToInt32(tlcurrentPage.Text) == 0)
1419
                        {
1420
                            RadWindow.Alert(new DialogParameters
1421
                            {
1422
                                Owner = Application.Current.MainWindow,
1423
                                Theme = new VisualStudio2013Theme(),
1424
                                Header = "Info",
1425
                                Content = "Enter the correct page number.",
1426
                            });
1427
                        }
1428
                        else
1429
                        {
1430
                            instanceMain.dzMainMenu.pageNavigator.GotoPage(Convert.ToInt32(tlcurrentPage.Text));
1431
                        }
1432
                    }
1433
                    
1434
                }
1435
                catch (Exception)
1436
                {
1437
                    RadWindow.Alert(new DialogParameters
1438
                    {
1439
                        Owner = Application.Current.MainWindow,
1440
                        Theme = new VisualStudio2013Theme(),
1441
                        Header = "Info",
1442
                        Content = "Enter the correct page number.",
1443
                    });
1444
                }
1445
                
1446
            }
1447
        }
1448
        private string previousText;
1449
        private void TlcurrentPage_PreviewTextInput(object sender, TextCompositionEventArgs e)
1450
        {
1451
            System.Text.RegularExpressions.Regex regex = new System.Text.RegularExpressions.Regex("[^0-9]+");
1452
            e.Handled = regex.IsMatch(e.Text);
1453
        }
1454
        private void TlcurrentPage_TextChanged(object sender, TextChangedEventArgs e)
1455
        {
1456
            double num = 0;
1457
            bool success = double.TryParse(((TextBox)sender).Text, out num);
1458
            if (success & num >= 0)
1459
                previousText = ((TextBox)sender).Text;
1460
            else
1461
            {
1462
                if (string.IsNullOrEmpty(((TextBox)sender).Text))
1463
                {
1464
                    ((TextBox)sender).Text = "";
1465
                }
1466
                else
1467
                {
1468

    
1469
                    ((TextBox)sender).Text = previousText;
1470
                }
1471
            }
1472
        }
1473

    
1474
        /// <summary>
1475
        /// 입력한 페이지로 이동한다
1476
        /// </summary>
1477
        /// <param name="sender"></param>
1478
        /// <param name="e"></param>
1479
        private void tlcurrentPage_readonly_KeyDown(object sender, KeyEventArgs e)
1480
        {
1481
            if (e.Key == Key.Enter)
1482
            {
1483
                try
1484
                {
1485
                    var instanceMain = this.ParentOfType<MainWindow>();
1486
                    instanceMain.dzMainMenu.pageNavigator.GotoPage(Convert.ToInt32(tlcurrentPage_readonly.Text));
1487
                }
1488
                catch (Exception)
1489
                {
1490
                    RadWindow.Alert(new DialogParameters
1491
                    {
1492
                        Owner = Application.Current.MainWindow,
1493
                        Theme = new VisualStudio2013Theme(),
1494
                        Header = "Info",
1495
                        Content = "Enter the correct page number.",
1496
                    });
1497
                }
1498
            }
1499
        }
1500
        
1501
        private void PanoramaEvent(object sender, RoutedEventArgs e)
1502
        {
1503
            PanoramaShow();
1504
        }
1505

    
1506
        public void PanoramaShow()
1507
        {
1508
            Panorama check = new Panorama();
1509
            double screenWidth = System.Windows.SystemParameters.PrimaryScreenWidth;
1510
            double screenHeight = System.Windows.SystemParameters.PrimaryScreenHeight;
1511
            //double windowWidth = this.Width;
1512
            //double windowHeight = this.Height;
1513

    
1514
            var PanoramaPop = new RadWindow
1515
            {
1516
                //MinWidth = 600,
1517
                //MinHeight = 400,
1518
                //Header = "My Check List",
1519
                Header = "Document No : " + this.ParentOfType<MainWindow>().dzMainMenu._DocItem.DOCUMENT_NO + " / Revision :" + this.ParentOfType<MainWindow>().dzMainMenu._DocItem.REVISION,
1520
                Content = check,
1521
                Owner = this,
1522
                ResizeMode = System.Windows.ResizeMode.CanResizeWithGrip,
1523
                //ResizeMode = System.Windows.ResizeMode.NoResize,
1524
                WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen,
1525
                IsTopmost = false,
1526
                //Left = (screenWidth / 2) - (windowWidth / 2),
1527
                //Top = (screenHeight / 2) - (windowHeight / 2),
1528
                //Left = (screenWidth / 2),
1529
                //Top = (screenHeight / 2),
1530
                Width = screenWidth * 0.4,
1531
                Height = screenHeight * 0.4,
1532
            };
1533
            StyleManager.SetTheme(PanoramaPop, new VisualStudio2013Theme());
1534
            //CheckPop.ShowDialog();
1535
            PanoramaPop.Owner = Application.Current.MainWindow;
1536
            PanoramaPop.Show();
1537
        }
1538

    
1539
        private void CheckEvent(object sender, RoutedEventArgs e)
1540
        {
1541
            //창이 떠있을 경우 재 실행 방지
1542
            if (isClosed)
1543
            {
1544
                //토글 및 마우스 상태 초기화
1545
                var toggleList = this.Parent.ChildrenOfType<RadToggleButton>();
1546
                foreach(var togle in toggleList)
1547
                {
1548
                    togle.IsChecked = false;
1549
                }
1550
                this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
1551

    
1552
                isClosed = false;
1553

    
1554
                
1555
                CheckList check = new CheckList(this.ParentOfType<MainWindow>());
1556

    
1557
                CheckPop = new RadWindow
1558
                {
1559
                    MinWidth = 1200,
1560
                    MinHeight = 500,
1561
                    //Header = "My Check List",
1562
                    Header = "Document No : " + this.ParentOfType<MainWindow>().dzMainMenu._DocItem.DOCUMENT_NO + " / Revision :" + this.ParentOfType<MainWindow>().dzMainMenu._DocItem.REVISION,
1563
                    Content = check,
1564
                    //Owner = this,
1565
                    //ResizeMode = System.Windows.ResizeMode.CanResizeWithGrip,
1566
                    ResizeMode = System.Windows.ResizeMode.NoResize,
1567
                    WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen,
1568
                    IsTopmost = true,
1569
                };
1570
                StyleManager.SetTheme(CheckPop, new Office2013Theme());
1571
                CheckPop.Closed += CheckPop_Closed;
1572
                
1573
                //CheckPop.ShowDialog();
1574
                CheckPop.Show();
1575
            }
1576
        }
1577

    
1578
        private void SignManagerEvent(object sender,RoutedEventArgs e)
1579
        {
1580
            SignManager signManager = new SignManager();
1581

    
1582
            RadWindow signManagerPop = new RadWindow
1583
            {
1584
                MinWidth = 1200,
1585
                MinHeight = 500,
1586
                //Header = "My Check List",
1587
                Header = "",
1588
                Content = signManager,
1589
                Owner = this,
1590
                //ResizeMode = System.Windows.ResizeMode.CanResizeWithGrip,
1591
                ResizeMode = System.Windows.ResizeMode.CanResize,
1592
                WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen,
1593
            };
1594
            StyleManager.SetTheme(signManagerPop, new Office2013Theme());
1595

    
1596
            //CheckPop.ShowDialog();
1597
            signManagerPop.ShowDialog();
1598
        }
1599

    
1600
        private void OptionPop_Closed(object sender, WindowClosedEventArgs e)
1601
        {
1602
            isClosed = true;
1603
            //this.ParentOfType<MainWindow>().dzMainMenu.PN_Navi.IsEnabled = true;
1604
            this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
1605
            ViewerDataModel.Instance.Capture_Opacity = 0;
1606
        }
1607

    
1608
        private void CheckPop_Closed(object sender, WindowClosedEventArgs e)
1609
        {
1610
            isClosed = true;
1611
            //this.ParentOfType<MainWindow>().dzMainMenu.PN_Navi.IsEnabled = true;
1612
            this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
1613
            ViewerDataModel.Instance.Capture_Opacity = 0;
1614
        }
1615

    
1616
        /// <summary>
1617
        /// 사용자가 선택한 페이지로 이동(썸네일 동기화 시킴)
1618
        /// </summary>
1619
        /// <param name="sender"></param>
1620
        /// <param name="e"></param>
1621
        private void PageGoEvent(object sender, RoutedEventArgs e)
1622
        {
1623
            RadButton button = sender as RadButton;
1624
            var instanceMain = this.ParentOfType<MainWindow>();
1625
            
1626
            //강인구 추가 tlcurrentPage을 이상하게 입력할수 있기때문에 Try Catch
1627
            try
1628
            {
1629
                switch (button.CommandParameter.ToString())
1630
                {
1631
                    case "Down":
1632
                        {
1633
                            instanceMain.dzMainMenu.pageNavigator.GotoPage(Convert.ToInt32(tlcurrentPage.Text) + 1);
1634
                        }
1635
                        break;
1636
                    case "Up":
1637
                        {
1638
                            instanceMain.dzMainMenu.pageNavigator.GotoPage(Convert.ToInt32(tlcurrentPage.Text) - 1);
1639
                        }
1640
                        break;
1641
                }
1642
            }
1643
            catch (Exception)
1644
            {
1645
                RadWindow.Alert(new DialogParameters
1646
                {
1647
                    Owner = Application.Current.MainWindow,
1648
                    Theme = new VisualStudio2013Theme(),
1649
                    Header = "Info",
1650
                    Content = "Enter the correct page number.",
1651
                });
1652
            }
1653
        }
1654

    
1655
        private void viewEvent(object sender, RoutedEventArgs e)
1656
        {
1657
            RadRibbonToggleButton viewButton = sender as RadRibbonToggleButton;
1658
            var instanceMain = this.ParentOfType<MainWindow>();
1659

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

    
1662
            //if ((sender as RadRibbonToggleButton) != null)
1663
            //{
1664
            //    Common.ViewerDataModel.Instance.ControlTag = (sender as RadRibbonToggleButton).Tag.ToString();
1665
            //    instanceToggle = (sender as RadRibbonToggleButton);
1666
            //}
1667

    
1668
            //instanceToggle.IsChecked = false;
1669

    
1670
            switch (viewButton.CommandParameter.ToString())
1671
            {
1672
                case "zoomout":
1673
                    {
1674
                        //장원
1675
                        //instanceMain.dzMainMenu.zoomAndPanControl.ZoomTo(new Rect(0, 0, instanceMain.dzMainMenu.zoomAndPanCanvas.ActualWidth, instanceMain.dzMainMenu.zoomAndPanCanvas.ActualHeight));
1676
                        instanceMain.dzMainMenu.zoomAndPanControl.ZoomPointToViewportCenter(ViewerDataModel.Instance.ContentScale -= 0.1, point);
1677
                        viewButton.IsChecked = false;
1678
                        //Common.ViewerDataModel.Instance.zom
1679
                    }
1680
                    break;
1681
                case "zoomin":
1682
                    {
1683
                        instanceMain.dzMainMenu.zoomAndPanControl.ZoomPointToViewportCenter(ViewerDataModel.Instance.ContentScale += 0.1, point);
1684
                        viewButton.IsChecked = false;
1685
                    }
1686
                    break;
1687
                case "fullscreen":
1688
                    {
1689
                        instanceMain.WindowStyle = WindowStyle.None;
1690
                        instanceMain.WindowState = WindowState.Maximized;
1691
                        instanceMain.dzMainMenu.zoomAndPanControl.ScaleToFit();
1692
                        viewButton.IsChecked = false;
1693
                    }
1694
                    break;
1695
                case "fitWidth":
1696
                    {
1697
                        instanceMain.dzMainMenu.zoomAndPanControl.ScaleToFit();
1698
                        viewButton.IsChecked = false;
1699
                    }
1700
                    break;
1701
                case "fitHeight":
1702
                    {
1703
                        instanceMain.dzMainMenu.zoomAndPanControl.ScaleToFit();
1704
                        viewButton.IsChecked = false;
1705
                    }
1706
                    break;
1707
                case "boundzoom":
1708
                    {
1709

    
1710
                    }
1711
                    break;
1712
                case "Rotate_M":
1713
                    {
1714
                        drawingPannelRotate(false);
1715
                        viewButton.IsChecked = false;
1716
                    }
1717
                    break;
1718
                case "Rotate_P":
1719
                    {
1720
                        drawingPannelRotate(true);
1721
                        viewButton.IsChecked = false;
1722
                    }
1723
                    break;
1724
                case "Rotate_half":
1725
                    {
1726
                        drawingPannelRotate(true);
1727
                        drawingPannelRotate(true);
1728
                        viewButton.IsChecked = false;
1729
                    }
1730
                    break;
1731
            }
1732
        }
1733

    
1734
        private void Control_Event(object sender, RoutedEventArgs e)
1735
        {
1736

    
1737
        }
1738

    
1739
        #region 대기
1740

    
1741
        public void drawingPannelRotate(bool Flag)
1742
        {
1743
            var instanceMain = this.ParentOfType<MainWindow>();
1744

    
1745
            //if (rotateOffSet > 3)
1746
            //    rotateOffSet = 0;
1747

    
1748
            //if (rotateOffSet < 0)
1749
            //    rotateOffSet = 3;
1750

    
1751
            if(Flag)
1752
            {
1753
                if (instanceMain.dzMainMenu.rotate.Angle == 270)
1754
                {
1755
                    instanceMain.dzMainMenu.rotate.Angle = 0;
1756
                }
1757
                else
1758
                {
1759
                    instanceMain.dzMainMenu.rotate.Angle += 90;
1760
                }
1761
            }
1762
            else
1763
            {
1764
                if(instanceMain.dzMainMenu.rotate.Angle == 0)
1765
                {
1766
                    instanceMain.dzMainMenu.rotate.Angle = 270;
1767
                }
1768
                else
1769
                {
1770
                    instanceMain.dzMainMenu.rotate.Angle -= 90;
1771
                }
1772
            }
1773
            //double angle = (double)rotateValue.GetValue(rotateOffSet);
1774
            //instanceMain.dzMainMenu.rotate.Angle = angle;
1775
            var rotationNum = Math.Abs((instanceMain.dzMainMenu.rotate.Angle / 90));
1776

    
1777
            if (instanceMain.dzMainMenu.zoomAndPanCanvas.Width == ViewerDataModel.Instance.ContentWidth)
1778
            {
1779
                double emptySize = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
1780
                instanceMain.dzMainMenu.zoomAndPanCanvas.Width = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
1781
                instanceMain.dzMainMenu.zoomAndPanCanvas.Height = emptySize;
1782
            }
1783
            if (instanceMain.dzMainMenu.rotate.Angle == 0)
1784
            {
1785
                instanceMain.dzMainMenu.translate.X = 0;
1786
                instanceMain.dzMainMenu.translate.Y = 0;
1787
            }
1788
            else if (instanceMain.dzMainMenu.rotate.Angle == 90)
1789
            {
1790
                instanceMain.dzMainMenu.translate.X = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
1791
                instanceMain.dzMainMenu.translate.Y = 0;
1792
            }
1793
            else if (instanceMain.dzMainMenu.rotate.Angle == 180)
1794
            {
1795
                instanceMain.dzMainMenu.translate.X = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
1796
                instanceMain.dzMainMenu.translate.Y = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
1797
            }
1798
            else
1799
            {
1800
                instanceMain.dzMainMenu.translate.X = 0;
1801
                instanceMain.dzMainMenu.translate.Y = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
1802
            }
1803

    
1804
            //instanceMain.dzMainMenu.zoomAndPanControl.RenderTransformOrigin = new Point(0.5, 0.5);
1805
            instanceMain.dzMainMenu.zoomAndPanControl.RotationAngle = instanceMain.dzMainMenu.rotate.Angle;
1806
            //대기(강인구)
1807
            //instanceMain.dzMainMenu.imageViewer.RotateAngle = instanceMain.dzMainMenu.rotate.Angle;
1808

    
1809

    
1810
            //instanceMain.dzMainMenu.imageViewer.RenderTransformOrigin = new Point(0.5, 0.5);
1811
            //RotateTransform rotateTransform = new RotateTransform(instanceMain.dzMainMenu.rotate.Angle);
1812
            //instanceMain.dzMainMenu.imageViewer.RenderTransform = rotateTransform;
1813

    
1814

    
1815
            ViewerDataModel.Instance.ContentWidth = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
1816
            ViewerDataModel.Instance.ContentHeight = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
1817
            ViewerDataModel.Instance.AngleOffsetX = instanceMain.dzMainMenu.translate.X;
1818
            ViewerDataModel.Instance.AngleOffsetY = instanceMain.dzMainMenu.translate.Y;
1819
            ViewerDataModel.Instance.PageAngle = instanceMain.dzMainMenu.rotate.Angle;
1820
            //ViewerDataModel.Instance.Document_Info.Clear();
1821
            //ViewerDataModel.Instance.Document_Info.Where(i => i.PAGE_NUMBER == instanceMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber).ToList().ForEach(value =>
1822
            //{
1823
            //    value.PAGE_ANGLE = int.Parse(instanceMain.dzMainMenu.rotate.Angle.ToString());
1824
            //});
1825

    
1826

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

    
1830
            foreach (var data in thumbnaillist)
1831
            {
1832
                data.Angle = int.Parse(instanceMain.dzMainMenu.rotate.Angle.ToString());
1833

    
1834
                //instanceMain.dzMainMenu.pageNavigator.ImgListbox.ItemsSource = instanceMain.dzMainMenu.pageNavigator._thumbnailItems;
1835
                var instance = instanceMain.dzMainMenu.CurrentDoc.docInfo.DOCPAGE.Where(p => p.PAGE_NUMBER == instanceMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber).FirstOrDefault();
1836
                instance.PAGE_ANGLE = int.Parse(instanceMain.dzMainMenu.rotate.Angle.ToString());
1837

    
1838
                instanceMain.dzMainMenu.pageNavigator.GotoPage(data.PageNumber);
1839

    
1840
                //rotation page add or update
1841
                var rotationdoc = ViewerDataModel.Instance.RotationDocs.Where(d => d.ID == instance.ID).FirstOrDefault();
1842
                if (rotationdoc != null)
1843
                {
1844
                    rotationdoc.PAGE_ANGLE = instance.PAGE_ANGLE;
1845
                }
1846
                else
1847
                {
1848
                    ViewerDataModel.Instance.RotationDocs.Add(instance);
1849
                }
1850
            }
1851
        }
1852
        #endregion
1853

    
1854
        private void ImageConverter(RadToggleButton instanceToggle)
1855
        {
1856
            try
1857
            {           
1858
                var instanceMain = this.ParentOfType<MainWindow>();
1859

    
1860
                Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
1861
                dlg.Filter = "All files (*.*)|*.*|PNG Images (*.png)|*.png";
1862
                Nullable<bool> result = dlg.ShowDialog();
1863
                if (result == true)
1864
                {
1865
                    instanceMain.dzMainMenu.filename = dlg.FileName;
1866
                    instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ImgControl;
1867

    
1868
                    System.IO.FileInfo fileInfo = new System.IO.FileInfo(instanceMain.dzMainMenu.filename);
1869
                    String strFile = System.IO.Path.GetFileName(instanceMain.dzMainMenu.filename);
1870
                    long numByte = fileInfo.Length;
1871
                    double dLen = Convert.ToDouble(fileInfo.Length / 1000000);
1872
                    kr.co.devdoftech.cloud.FileUpload fileUploader = App.FileUploader;
1873
             
1874
                    if (dLen < 4)
1875
                    {
1876
                        System.IO.FileStream fStream = new System.IO.FileStream(instanceMain.dzMainMenu.filename, System.IO.FileMode.Open, System.IO.FileAccess.Read);
1877
                        System.IO.BinaryReader br = new System.IO.BinaryReader(fStream);
1878
                        byte[] data = br.ReadBytes((int)numByte);
1879
                        br.Close();
1880

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

    
1883
                        Check_Uri.UriCheck(filepath);
1884

    
1885
                        instanceMain.dzMainMenu.filename = filepath;
1886

    
1887
                        fStream.Close();
1888
                        fStream.Dispose();
1889
                    }
1890
                    else
1891
                    {
1892
                        this.ParentOfType<MainWindow>().DialogMessage_Alert("Available Memory less than 4 mega byte", "Alert");
1893
                    }
1894
                }
1895
                else
1896
                {
1897
                    instanceToggle.IsChecked = false;
1898
                    Common.ViewerDataModel.Instance.SelectedControl = "";
1899
                    Common.ViewerDataModel.Instance.ControlTag = null;
1900
                    this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
1901
                    this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
1902
                    this.ParentOfType<MainWindow>().DialogMessage_Alert("No Image selected.", "Alert");
1903
                }
1904
            }
1905
            catch(Exception ex)
1906
            {
1907
                instanceToggle.IsChecked = false;
1908
                Common.ViewerDataModel.Instance.SelectedControl = "";
1909
                Common.ViewerDataModel.Instance.ControlTag = null;
1910
                this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
1911
                this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
1912
                App.FileLogger.Error("Image Converter ",ex);
1913

    
1914
                this.ParentOfType<MainWindow>().DialogMessage_Alert(ex.Message, "Alert");
1915
            }
1916
        }
1917

    
1918
        private void Control_Init(RadToggleButton instanceToggle, object sender)
1919
        {
1920

    
1921
        }
1922

    
1923
        private void ControlEvent(object sender, RoutedEventArgs e)
1924
        {
1925
            RadToggleButton instanceToggle = sender as RadToggleButton;
1926
            var instanceMain = this.ParentOfType<MainWindow>();
1927

    
1928
            #region Ctrl + A 눌렀을 때 대처 방법 
1929
            //원인 : Ctrl + A를 누르면 UIElementSet에 등록을 시키지 않는다(이유는 한꺼번에 많은 양의 컨트롤의 동작이 유입되기 때문에
1930
            //       시스템의 성능저하를 불러올 수 있기 때문이다. 그래서 선택 후 다른 컨트롤을 누르면 등록되지 않은 컨트롤이기 때문에 삭제된다
1931
            //       이를 대처하는 방법으로 아래 코드를 사용한다.
1932
            if (Common.ViewerDataModel.Instance.MarkupControls.Count == 0 && Common.ViewerDataModel.Instance.MarkupControls.Count >= 1)
1933
            {
1934
                //var lstItem = instanceMain.DeepLayer._SelectLayer.ChildrenOfType<AdornerFinal>().ToList();
1935
                //foreach (var item in lstItem)
1936
                //{
1937
                //    foreach (var member in item.MemberSet)
1938
                //    {
1939
                //        if (!instanceMain.DeepLayer.UIElementSet.Contains(member.DrawingData))
1940
                //        {
1941
                //            instanceMain.DeepLayer.UIElementSet.Add(member.DrawingData);
1942
                //        }
1943
                //    }
1944
                //}
1945
            }
1946
            #endregion
1947

    
1948
            //if (!instanceMain.IsFreeSelectionMode)
1949
            //{
1950
            //    instanceMain.IsSwingMode = true;
1951
            //}
1952

    
1953
            //#region 다른 컨트롤 버튼 선택 해제
1954
            //System.Reactive.Linq.Observable2.FromPropertyChangedPattern(Common.ViewerDataModel.Instance, temp => temp.SelectedControl).Subscribe(ControlState =>
1955
            //{
1956
            //    if (ControlState == null)
1957
            //    {
1958
            //        instanceToggle.IsChecked = false;
1959
            //        HiddenControlHide();
1960
            //    }
1961
            //});
1962
            //#endregion
1963

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

    
1966
            if (instanceToggle != null)
1967
            {
1968
                Common.ViewerDataModel.Instance.ControlTag = instanceToggle.Tag.ToString();
1969
            }
1970
            else if ((sender as RadRibbonToggleButton) != null)
1971
            {
1972
                Common.ViewerDataModel.Instance.ControlTag = (sender as RadRibbonToggleButton).Tag.ToString();
1973
                instanceToggle = (sender as RadRibbonToggleButton);
1974
            }
1975
            else if ((sender as RadRibbonButton) != null)
1976
            {
1977
                RadRibbonButton instanceButton = sender as RadRibbonButton;
1978
                Common.ViewerDataModel.Instance.ControlTag = instanceButton.Tag.ToString();
1979
            }
1980
            else
1981
            {
1982
                RadButton instanceButton = sender as RadButton;
1983
                Common.ViewerDataModel.Instance.ControlTag = instanceButton.Tag.ToString();
1984
            }
1985

    
1986

    
1987
            //System.Reactive.Linq.Observable2.FromPropertyChangedPattern(Common.ViewerDataModel.Instance, temp => temp.AngleVisibility).Subscribe(isSee =>
1988
            //{
1989
            //    if (instanceToggle.CommandParameter.ToString() == "ChainLine")
1990
            //    {
1991

    
1992
            //    }
1993
            //    else
1994
            //    {
1995
            //        System.Diagnostics.Debug.WriteLine(" instanceMain.dzMainMenu.MainAngle.Visibility   " + isSee);
1996

    
1997
            //        if (instanceMain.dzMainMenu.MainAngle.Visibility != isSee)
1998
            //        {
1999
            //            instanceMain.dzMainMenu.MainAngle.Visibility = isSee;
2000
            //        }
2001
            //    }
2002
            //    //System.Reactive.Linq.Observable2.FromPropertyChangedPattern(Common.ViewerDataModel.Instance, temp => temp.AngleValue).Subscribe(p =>
2003
            //    //{
2004
            //    //    instanceMain.dzMainMenu.MainAngle.AngleValue = p;
2005
            //    //});
2006
            //});
2007

    
2008
            instanceMain.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Drawing;
2009

    
2010
            instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = false;
2011

    
2012
            if (instanceToggle.IsChecked != false)
2013
            {
2014
                string param = instanceToggle.CommandParameter.ToString();
2015
                string MacroIndex = "";
2016

    
2017
                if (param.StartsWith("MACRO"))
2018
                {
2019
                    param = "MACRO";
2020
                    MacroIndex = param.Replace("MACRO;","");
2021

    
2022
                    //Common.ViewerDataModel.Instance.MacroItems = MacroHelper.LoadMacroItems(MacroIndex);
2023
                    //var items = MacroHelper.TopMenuItems();
2024

    
2025
                    Common.ViewerDataModel.Instance.MacroItems = new List<MacroItem>
2026
                    {
2027
                        new MacroItem
2028
                        {
2029
                            Desc = "Cloud Rectangle",
2030
                            ControlType = MarkupToPDF.Controls.Common.ControlType.RectCloud
2031
                        },
2032
                        new MacroItem
2033
                        {
2034
                             Desc = "Arrow TextBox",
2035
                            ControlType = MarkupToPDF.Controls.Common.ControlType.ArrowTextBorderControl
2036
                        }
2037
                    };
2038
                }
2039

    
2040
                #region 컨트롤이 체크되었다면
2041
                switch (param)
2042
                {
2043
                    #region Line
2044
                    case "Line":
2045
                        Common.ViewerDataModel.Instance.SelectedControl = "Line";
2046
                        //HiddenAxisLock.Visibility = Visibility.Visible;
2047
                        if (instanceToggle.Tag.ToString() == "LineDelete")
2048
                        {
2049
                            //HiddenInterval.Visibility = Visibility.Visible;
2050
                        }
2051
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.SingleLine;
2052
                        break;
2053
                    #endregion
2054
                    #region ChainLine
2055
                    case "ChainLine":
2056
                        Common.ViewerDataModel.Instance.SelectedControl = "ChainLine";
2057
                        //HiddenAxisLock.Visibility = Visibility.Visible;
2058
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ChainLine;
2059
                        break;
2060
                    #endregion
2061
                    #region DimLine
2062
                    case "DimLine":
2063
                        Common.ViewerDataModel.Instance.SelectedControl = "DimLine";
2064
                        //HiddenAxisLock.Visibility = Visibility.Visible;
2065
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.DimLine;
2066
                        break;
2067
                    #endregion
2068
                    #region TwinLine
2069
                    case "TwinLine":
2070
                        Common.ViewerDataModel.Instance.SelectedControl = "TwinLine";
2071
                        //HiddenAxisLock.Visibility = Visibility.Visible;
2072
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.TwinLine;
2073
                        break;
2074
                    #endregion
2075
                    #region CancelLine
2076
                    case "CancelLine":
2077
                        Common.ViewerDataModel.Instance.SelectedControl = "CancelLine";
2078
                        //HiddenAxisLock.Visibility = Visibility.Visible;
2079
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.CancelLine;
2080
                        break;
2081
                    #endregion
2082
                    #region PolygonCloud
2083
                    case "PolygonCloud":
2084
                        Common.ViewerDataModel.Instance.SelectedControl = "PolygonCloud";
2085
                        //HiddenAxisLock.Visibility = Visibility.Visible;
2086
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.PolygonCloud;
2087
                        break;
2088
                    #endregion
2089
                    #region RectCloud
2090
                    case "RectCloud":
2091
                        Common.ViewerDataModel.Instance.SelectedControl = "RectCloud";
2092
                        //HiddenAxisLock.Visibility = Visibility.Visible;
2093
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.RectCloud;
2094
                        break;
2095
                    #endregion
2096
                    #region Rectangle
2097
                    case "Rectangle":
2098
                        Common.ViewerDataModel.Instance.SelectedControl = "Rectangle";
2099
                        //HiddenAxisLock.Visibility = Visibility.Visible;
2100
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Rectangle;
2101
                        break;
2102
                    #endregion
2103
                    #region Triangle
2104
                    case "Triangle":
2105
                        Common.ViewerDataModel.Instance.SelectedControl = "Triangle";
2106
                        //HiddenAxisLock.Visibility = Visibility.Visible;
2107
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Triangle;
2108
                        break;
2109
                    #endregion
2110
                    #region RectCloud
2111
                    case "Circle":
2112
                        Common.ViewerDataModel.Instance.SelectedControl = "Circle";
2113
                        //HiddenAxisLock.Visibility = Visibility.Visible;
2114
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Circle;
2115
                        break;
2116
                    #endregion
2117
                    #region Symbol
2118
                    case "Symbol":
2119
                        Common.ViewerDataModel.Instance.SelectedControl = "Symbol";
2120
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2121
                        break;
2122
                    #endregion
2123
                    #region SymbolN
2124
                    case "SymbolN":
2125
                        Common.ViewerDataModel.Instance.SelectedControl = "SymbolN";
2126
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Stamp;
2127
                        break;
2128
                    #endregion
2129
                    #region Text
2130
                    case "Text":
2131
                        Common.ViewerDataModel.Instance.SelectedControl = "Text";
2132
                        TaskMessage("Text 도구는 텍스트 영역을 더블 클릭하여 텍스트를 재 편집 할 수 있습니다", TaskMessageType.Normal);
2133
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.TextControl;
2134
                        break;
2135
                    #endregion
2136
                    #region TextBorder
2137
                    case "TextBorder":
2138
                        Common.ViewerDataModel.Instance.SelectedControl = "TextBorder";
2139
                        TaskMessage("Text 도구는 텍스트 영역을 더블 클릭하여 텍스트를 재 편집 할 수 있습니다", TaskMessageType.Normal);
2140
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.TextBorder;
2141
                        break;
2142
                    #endregion
2143
                    #region TextCloud
2144
                    case "TextCloud":
2145
                        Common.ViewerDataModel.Instance.SelectedControl = "TextCloud";
2146
                        TaskMessage("Text 도구는 텍스트 영역을 더블 클릭하여 텍스트를 재 편집 할 수 있습니다", TaskMessageType.Normal);
2147
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.TextCloud;
2148
                        break;
2149
                    #endregion
2150
                    #region Date
2151
                    case "Date":
2152
                        Common.ViewerDataModel.Instance.SelectedControl = "Date";
2153
                        TaskMessage("날짜 컨트롤을 더블 클릭하면 날짜를 변경할 수 있습니다", TaskMessageType.Normal);
2154
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Date;
2155
                        break;
2156
                    #endregion
2157
                    #region ArrowText
2158
                    case "ArrowText":
2159
                        TaskMessage("ArrowText 컨트롤은 그린 후 컨트롤을 선택하였을 시 중간점을 조정할 수 있습니다", TaskMessageType.Normal);
2160
                        if (instanceToggle.Tag.ToString() == "ArrowText_Cloud")
2161
                        {
2162
                            Common.ViewerDataModel.Instance.SelectedControl = "ArrowText_Cloud";
2163
                            instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowTextCloudControl;
2164
                        }
2165
                        else if (instanceToggle.Tag.ToString() == "ArrowText_Border")
2166
                        {
2167
                            Common.ViewerDataModel.Instance.SelectedControl = "ArrowTextBorderControl";
2168
                            instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowTextBorderControl;
2169
                        }
2170
                        else if (instanceToggle.Tag.ToString() == "ArrowTextFix_Normal")
2171
                        {
2172
                            Common.ViewerDataModel.Instance.SelectedControl = "ArrowTransTextControl";
2173
                            instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowTransTextControl;
2174
                        }
2175
                        else if (instanceToggle.Tag.ToString() == "ArrowTextFix_Border")
2176
                        {
2177
                            Common.ViewerDataModel.Instance.SelectedControl = "ArrowTransTextBorderControl";
2178
                            instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowTransTextBorderControl;
2179
                        }
2180
                        else if (instanceToggle.Tag.ToString() == "ArrowTextFix_Cloud")
2181
                        {
2182
                            Common.ViewerDataModel.Instance.SelectedControl = "ArrowTransTextCloudControl";
2183
                            instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowTransTextCloudControl;
2184
                        }
2185
                        else
2186
                        {
2187
                            Common.ViewerDataModel.Instance.SelectedControl = "ArrowText";
2188
                            instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowTextControl;
2189
                            //HiddenAxisLock.Visibility = Visibility.Visible;
2190
                        }
2191
                        break;
2192
                    #endregion
2193
                    #region Arrow
2194
                    case "Arrow":
2195
                        Common.ViewerDataModel.Instance.SelectedControl = "Arrow";
2196
                        //HiddenAxisLock.Visibility = Visibility.Visible;
2197
                        //HiddenDimSize.Visibility = Visibility.Visible;
2198
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowLine;
2199
                        break;
2200
                    #endregion
2201
                    #region Shape
2202
                    case "Shape":
2203
                        Common.ViewerDataModel.Instance.SelectedControl = "Shape";
2204
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Mark;
2205
                        break;
2206
                    #endregion
2207
                    #region Polygon
2208
                    case "Polygon":
2209
                        Common.ViewerDataModel.Instance.SelectedControl = "Polygon";
2210
                        TaskMessage("자유형 코멘트 도구는 오른쪽 마우스 클릭을 통해 그리기를 마칠 수 있습니다", TaskMessageType.Normal);
2211
                        //HiddenAxisLock.Visibility = Visibility.Visible;
2212
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.PolygonControl;
2213
                        break;
2214
                    #endregion
2215
                    #region Arc
2216
                    case "Arc":
2217
                        Common.ViewerDataModel.Instance.SelectedControl = "Arc";
2218
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArcLine;
2219
                        //HiddenAxisLock.Visibility = Visibility.Visible;
2220
                        TaskMessage("Arc 코멘트 도구는 오른쪽 마우스를 사용해 좌우 반전을 사용하실 수 있습니다", TaskMessageType.Normal);
2221
                        break;
2222
                    #endregion
2223
                    #region ArrowArc
2224
                    case "ArrowArc":
2225
                        Common.ViewerDataModel.Instance.SelectedControl = "ArrowArc";
2226
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArcArrow;
2227
                        //HiddenAxisLock.Visibility = Visibility.Visible;
2228
                        TaskMessage("ArcArrow 코멘트 도구는 오른쪽 마우스를 사용해 좌우 반전을 사용하실 수 있습니다", TaskMessageType.Normal);
2229
                        break;
2230
                    #endregion
2231
                    #region ArrowMulti
2232
                    case "ArrowMulti":
2233
                        Common.ViewerDataModel.Instance.SelectedControl = "ArrowMulti";
2234
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowMultiLine;
2235
                        //HiddenAxisLock.Visibility = Visibility.Visible;
2236
                        break;
2237
                    #endregion
2238
                    #region Etc
2239
                    case "Etc":
2240
                        Common.ViewerDataModel.Instance.SelectedControl = "Etc";
2241
                        break;
2242
                    #endregion
2243
                    #region Ink
2244
                    case "Ink":
2245
                        if (instanceToggle.Tag.ToString() == "EraserClear")
2246
                        {
2247
                            TaskMessage("해당 컨트롤은 점 단위로 그려진 펜을 지웁니다", TaskMessageType.Normal);
2248
                            //instanceMain.dzMainMenu.inkDrawingCanvas.EditingMode = InkCanvasEditingMode.EraseByPoint;
2249
                            instanceMain.dzMainMenu.inkBoard.Tag = "EraseByPoint";
2250
                        }
2251
                        else if (instanceToggle.Tag.ToString() == "Eraser")
2252
                        {
2253
                            TaskMessage("해당 컨트롤은 선 단위로 그려진 펜을 지웁니다", TaskMessageType.Normal);
2254
                            instanceMain.dzMainMenu.inkBoard.Tag = "EraseByStroke";
2255
                            //instanceMain.dzMainMenu.inkDrawingCanvas.EditingMode = InkCanvasEditingMode.EraseByStroke;
2256
                        }
2257
                        else
2258
                        {
2259
                            instanceMain.dzMainMenu.inkBoard.Tag = "Ink";
2260
                            //instanceMain.dzMainMenu.inkDrawingCanvas.EditingMode = InkCanvasEditingMode.Ink;
2261
                        }
2262

    
2263
                        //instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = true;
2264

    
2265
                        Common.ViewerDataModel.Instance.SelectedControl = "Ink";
2266
                        Common.ViewerDataModel.Instance.LineSize = (double)cbLineSize.Value;
2267
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.PenControl;
2268
                        break;
2269
                    #endregion
2270
                    #region Select
2271
                    case "Select":
2272
                        if (this.ParentOfType<MainWindow>().dzMainMenu.currentControl != null)
2273
                        {
2274
                            if (this.ParentOfType<MainWindow>().dzMainMenu.currentControl is MarkupToPDF.Controls.Text.TextControl
2275
                                && !string.IsNullOrEmpty(((MarkupToPDF.Controls.Text.TextControl)this.ParentOfType<MainWindow>().dzMainMenu.currentControl).Text))
2276
                            {
2277
                                DependencyObject focusScope1 = FocusManager.GetFocusScope((MarkupToPDF.Controls.Text.TextControl)this.ParentOfType<MainWindow>().dzMainMenu.currentControl);
2278
                                FocusManager.SetFocusedElement(focusScope1, (MarkupToPDF.Controls.Text.TextControl)this.ParentOfType<MainWindow>().dzMainMenu.currentControl);
2279

    
2280
                                this.ParentOfType<MainWindow>().dzMainMenu.currentControl = null;
2281
                                Keyboard.ClearFocus();
2282

    
2283
                            }
2284
                            else
2285
                            {
2286
                                ViewerDataModel.Instance.MarkupControls_USER.Remove(this.ParentOfType<MainWindow>().dzMainMenu.currentControl);
2287
                                this.ParentOfType<MainWindow>().dzMainMenu.currentControl = null;
2288
                            }
2289
                        }
2290

    
2291
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Selecting;
2292
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2293
                        instanceMain.dzMainMenu.isLeftMouseButtonDownOnWindow = false;
2294
                        break;
2295
                    #endregion
2296
                    #region Image
2297
                    case "Image":
2298
                        Common.ViewerDataModel.Instance.SelectedControl = "ImgControl";
2299
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ImgControl;
2300
                        ImageConverter(instanceToggle);
2301
                        break;
2302
                    #endregion
2303
                    #region Sign
2304
                    case "Sign":
2305
                        Common.ViewerDataModel.Instance.SelectedControl = "Sign";
2306
                        Common.ViewerDataModel.Instance.ControlTag = instanceMain.dzMainMenu._ViewInfo.UserID; //사번
2307
                        //강인구 추가
2308
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Sign;
2309
                        //instanceMain.BaseClient.GetUserSignCompleted += (sen, ea) =>
2310
                        //{
2311
                        //    if (ea.Result == null)
2312
                        //    {
2313

    
2314
                        //        this.ParentOfType<MainPage>().DialogMessage_Alert("You Don't Have Sign Data", "Alert");
2315
                        //    }
2316
                        //    else
2317
                        //    {
2318
                        //        byte[] imageBytes = System.Convert.FromBase64String(ea.Result);
2319
                        //        using (MemoryStream ms = new MemoryStream(imageBytes))
2320
                        //        {
2321
                        //            BitmapImage im = new BitmapImage();
2322
                        //            im.SetSource(ms);
2323
                        //            instanceMain.DeepLayer.SignImage = im;
2324
                        //            ms.Close();
2325
                        //        }
2326
                        //    }
2327
                        //};
2328
                        //instanceMain.BaseClient.GetUserSignAsync(instanceMain._ViewInfo.UserID);
2329
                        break;
2330
                    #endregion
2331
                    #region Check
2332
                    case "Check":
2333
                        Common.ViewerDataModel.Instance.SelectedControl = "Check";
2334
                        Common.ViewerDataModel.Instance.ControlTag = instanceMain.dzMainMenu._ViewInfo.UserID; //사번
2335
                        //강인구 추가
2336
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Symbol;
2337
                        break;
2338
                    #endregion
2339
                    #region Batch
2340
                    case "Batch":
2341
                        Common.ViewerDataModel.Instance.SelectedControl = "Batch";
2342
                        Common.ViewerDataModel.Instance.ControlTag = instanceMain.dzMainMenu._ViewInfo.UserID; //사번
2343
                        //강인구 추가
2344
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Mark;
2345
                        instanceMain.dzMainMenu.txtBatch.Visibility = Visibility.Visible;
2346
                        instanceMain.dzMainMenu.txtBatch.Text = "Place Mark";
2347
                        break;
2348
                    #endregion
2349

    
2350
                    #region MACRO -MACRO1
2351
                    case "MACRO":
2352
                        Common.ViewerDataModel.Instance.SelectedControl = "MACRO";
2353
                        Common.ViewerDataModel.Instance.ControlTag = instanceMain.dzMainMenu._ViewInfo.UserID; //사번
2354

    
2355
                        MacroHelper.MacroAction();
2356

    
2357
                        break;
2358
                    #endregion
2359

    
2360
                    #region Copy
2361
                    case "Copy":
2362
                        CopyCommand.Instance.Execute();
2363
                        //Copy_Start();
2364
                        instanceToggle.IsChecked = false;
2365
                        ViewerDataModel.Instance.SelectedControl = "";
2366
                        ViewerDataModel.Instance.ControlTag = null;
2367
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2368
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2369
                        break;
2370
                    #endregion
2371
                    #region Cut
2372
                    case "Cut":
2373
                        //Cut_Start();
2374
                        CutCommand.Instance.Execute();
2375
                        instanceToggle.IsChecked = false;
2376
                        ViewerDataModel.Instance.SelectedControl = "";
2377
                        ViewerDataModel.Instance.ControlTag = null;
2378
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2379
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2380
                        break;
2381
                    #endregion
2382
                    #region Paste
2383
                    case "Paste":
2384
                        PasteCommand.Instance.Execute();
2385
                        //Paste_Start();
2386
                        instanceToggle.IsChecked = false;
2387
                        ViewerDataModel.Instance.SelectedControl = "";
2388
                        ViewerDataModel.Instance.ControlTag = null;
2389
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2390
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;                        
2391
                        break;
2392
                    #endregion
2393
                    #region Delete
2394
                    case "Delete":
2395
                        UndoCommand.Instance.Push(EventType.Delete, SelectionSet.Instance.SelectedItems);
2396
                        this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Clear();
2397

    
2398
                        instanceToggle.IsChecked = false;
2399
                        ViewerDataModel.Instance.SelectedControl = "";
2400
                        ViewerDataModel.Instance.ControlTag = null;
2401
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2402
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2403
                        break;
2404
                    #endregion
2405
                    #region Undo
2406
                    case "Undo":
2407
                        UndoCommand.Instance.Execute();
2408
                        instanceToggle.IsChecked = false;
2409
                        ViewerDataModel.Instance.SelectedControl = "";
2410
                        ViewerDataModel.Instance.ControlTag = null;
2411
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2412
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2413
                        break;
2414
                    #endregion
2415
                    #region Redo
2416
                    case "Redo":
2417
                        RedoCommand.Instance.Execute();
2418
                        instanceToggle.IsChecked = false;
2419
                        ViewerDataModel.Instance.SelectedControl = "";
2420
                        ViewerDataModel.Instance.ControlTag = null;
2421
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2422
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2423
                        break;
2424
                    #endregion
2425
                    #region DragZoom
2426
                    case "DragZoom":
2427
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.DragZoom;
2428
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2429
                        instanceMain.dzMainMenu.isLeftMouseButtonDownOnWindow = false;
2430
                        break;
2431
                    #endregion
2432
                    #region Grouping
2433
                    case "Group":
2434
                        //var GrouptoggleList = this.Parent.ChildrenOfType<RadRibbonToggleButton>();
2435
                        //foreach (var togle in GrouptoggleList)
2436
                        //{
2437
                        //    togle.IsChecked = false;
2438
                        //}
2439

    
2440
                        //if (this.ParentOfType<MainWindow>().dzMainMenu.currentControl != null)
2441
                        //{
2442
                        //    ViewerDataModel.Instance.MarkupControls_USER.Remove(this.ParentOfType<MainWindow>().dzMainMenu.currentControl);
2443
                        //    this.ParentOfType<MainWindow>().dzMainMenu.currentControl = null;
2444
                        //}
2445
                        //this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2446
                        //instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2447
                        //instanceMain.dzMainMenu.isLeftMouseButtonDownOnWindow = false;
2448
                        //if (ViewerDataModel.Instance.SystemMain.dzMainMenu.SelectLayer.Children.Count < 1) //선택된 것이 없으면
2449
                        //{
2450
                        //    this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert("Please Select Controls", "Alert");
2451
                        //}
2452
                        //else//if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
2453
                        //{
2454
                        //    // string MarkupData = "";
2455
                        //    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
2456
                        //    {
2457
                        //        if (item.GetType().Name == "AdornerFinal" && (item as AdornerFinal).MemberSet.Count >= 2) // 얘가 2개 이상이여야 그룹가능 버튼도 막을거긴하지만 일단..
2458
                        //        {
2459
                        //            //MARKUP_DATA_GROUP INSERT
2460
                        //            MARKUP_DATA_GROUP mARKUP_DATA_GROUP = new MARKUP_DATA_GROUP
2461
                        //            {
2462
                        //                SYMBOL_ID = null,//InnerItem.Symbol_ID
2463
                        //                STATE = 0,
2464
                        //            };
2465
                        //            long group_id = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.AddMarkupDataGroup(mARKUP_DATA_GROUP, App.ViewInfo.ProjectNO);
2466
                        //            //Logger.sendReqLog("AddMarkupDataGroup: ", "", 1);
2467
                        //            if (group_id > 0)
2468
                        //            {
2469
                        //                foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
2470
                        //                {
2471
                        //                    if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
2472
                        //                    {
2473
                        //                        //MARKUP_DATA UPDATE
2474
                        //                        //Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.UpdateMarkupData((InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo).CommentID, group_id, App.ViewInfo.ProjectNO);
2475
                        //                        ////Logger.sendReqLog("UpdateMarkupData: ", "", 1);
2476
                        //                        ViewerDataModel.Instance.MyMarkupList.Where(d => d.ID == (InnerItem.DrawingData as CommentUserInfo).CommentID).FirstOrDefault().Group_ID = group_id;
2477
                        //                        ViewerDataModel.Instance.MyMarkupList.Where(d => d.ID == (InnerItem.DrawingData as CommentUserInfo).CommentID).FirstOrDefault().IsUpdate = true;
2478
                        //                    }
2479
                        //                }
2480
                        //            }
2481
                        //        }
2482
                        //    }
2483
                        //}
2484
                        break;
2485
                    case "UnGroup":
2486
                        //var UnGrouptoggleList = this.Parent.ChildrenOfType<RadRibbonToggleButton>();
2487
                        //foreach (var togle in UnGrouptoggleList)
2488
                        //{
2489
                        //    togle.IsChecked = false;
2490
                        //}
2491
                        //if (this.ParentOfType<MainWindow>().dzMainMenu.currentControl != null)
2492
                        //{
2493
                        //    ViewerDataModel.Instance.MarkupControls_USER.Remove(this.ParentOfType<MainWindow>().dzMainMenu.currentControl);
2494
                        //    this.ParentOfType<MainWindow>().dzMainMenu.currentControl = null;
2495
                        //}
2496
                        //this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2497
                        //instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2498
                        //instanceMain.dzMainMenu.isLeftMouseButtonDownOnWindow = false;
2499

    
2500
                        //if (ViewerDataModel.Instance.SystemMain.dzMainMenu.SelectLayer.Children.Count < 1) //선택된 것이 없으면
2501
                        //{
2502
                        //    this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert("Please Select Controls", "Alert");
2503
                        //}
2504
                        //else//if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
2505
                        //{
2506
                        //    // string MarkupData = "";
2507
                        //    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
2508
                        //    {
2509
                        //        if (item.GetType().Name == "AdornerFinal" && (item as AdornerFinal).MemberSet.Count >= 1) // 1개 이상 
2510
                        //        {
2511
                        //            //MARKUP_DATA UPDATE
2512
                        //            foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
2513
                        //            {
2514
                        //                if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
2515
                        //                {
2516
                        //                    long group_id = ViewerDataModel.Instance.MyMarkupList.Where(d => d.ID == (InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo).CommentID).FirstOrDefault().Group_ID;
2517
                        //                    //MARKUP_DATA UPDATE
2518
                        //                    //Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.UpdateMarkupData((InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo).CommentID, 0, App.ViewInfo.ProjectNO);
2519
                        //                    ////Logger.sendReqLog("UpdateMarkupData: ", "", 1);
2520
                        //                    ViewerDataModel.Instance.MyMarkupList.Where(d => d.ID == (InnerItem.DrawingData as CommentUserInfo).CommentID).FirstOrDefault().Group_ID = 0;
2521
                        //                    ViewerDataModel.Instance.MyMarkupList.Where(d => d.ID == (InnerItem.DrawingData as CommentUserInfo).CommentID).FirstOrDefault().IsUpdate = true;
2522

    
2523

    
2524
                        //                    //MARKUP_DATA_GROUP UPDATE
2525
                        //                    //bool value = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.UpdateMarkupDataGroup(group_id, App.ViewInfo.ProjectNO);
2526
                        //                    ////Logger.sendReqLog("AddMarkupDataGroup: ", value.ToString(), 1);
2527
                        //                }
2528
                        //            }
2529
                        //        }
2530
                        //    }
2531
                        //}
2532
                        break;
2533
                    #endregion
2534
                    #region Capture
2535
                    case "Capture":
2536
                        SyncInit();
2537
                        //   instanceToggle.IsChecked = false;
2538
                        var CaptureList = this.Parent.ChildrenOfType<RadRibbonToggleButton>();
2539
                        foreach (var togle in CaptureList)
2540
                        {
2541
                            togle.IsChecked = false;
2542
                        }
2543

    
2544
                        if (this.ParentOfType<MainWindow>().dzMainMenu.currentControl != null)
2545
                        {
2546
                            ViewerDataModel.Instance.MarkupControls_USER.Remove(this.ParentOfType<MainWindow>().dzMainMenu.currentControl);
2547
                            this.ParentOfType<MainWindow>().dzMainMenu.currentControl = null;
2548
                        }
2549

    
2550
                        ViewerDataModel.Instance.SelectedControl = "ImgControl";
2551
                   //     ViewerDataModel.Instance.ControlTag = null;
2552
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ImgControl;
2553

    
2554
                        /*
2555
                        //캡쳐 하기 전에 코멘트 저장
2556
                        if (Common.ViewerDataModel.Instance.MarkupControls_USER.Count > 0 || (Application.Current.MainWindow as MainWindow).dzMainMenu.SelectLayer.Children.Count > 0)
2557
                        {
2558
                            var menu = (Application.Current.MainWindow as MainWindow).dzMainMenu;
2559
                            menu.ReleaseAdorner();
2560
                            if (menu.PreviewUserMarkupInfoItem != null && menu.PreviewUserMarkupInfoItem.IsPreviewUser == true)
2561
                            {
2562
                                (Application.Current.MainWindow as MainWindow).dzTopMenu.RefactoryCommentReact(menu);
2563
                            }
2564
                            else if (menu.gridViewMarkup.SelectedItems.Count == 0 || (menu.gridViewMarkup.SelectedItems.FirstOrDefault() as IKCOM.MarkupInfoItem).UserID != App.ViewInfo.UserID)
2565
                            {
2566

    
2567
                            }
2568
                            else
2569
                            {
2570
                                (Application.Current.MainWindow as MainWindow).dzTopMenu.RefactoryCommentReact(menu);
2571
                            }
2572
                        }*/
2573

    
2574
                        //Common.ViewerDataModel.Instance.CheckList_ID = ((e.Source as Telerik.Windows.Controls.RadButton).DataContext as Customer).ID;
2575
                        //Common.ViewerDataModel.Instance.CheckList_ID = ((e.Source as Image).DataContext as Customer).ID;
2576
                        //Common.ViewerDataModel.Instance.PageNumber = ((e.Source as Image).DataContext as Customer).PAGENUMBER;
2577
                        Application.Current.MainWindow.Focus();
2578
                        Common.ViewerDataModel.Instance.Capture_Opacity = 0.49;
2579
                        (Application.Current.MainWindow as MainWindow).dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Capture;
2580
                        break;
2581
                    #endregion
2582
                    #region Cad
2583
                    case "Inside":
2584
                        //instanceMain.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Drawing;
2585
                        //instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = false;
2586
                        Common.ViewerDataModel.Instance.SelectedControl = "InsideWhite";
2587
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.InsideWhite;
2588
                        break;
2589
                    case "Overlap":
2590
                        //instanceMain.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Drawing;
2591
                        //instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = false;
2592
                        Common.ViewerDataModel.Instance.SelectedControl = "OverlapWhite";
2593
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.OverlapWhite;
2594
                        break;
2595
                    case "Clip":
2596
                        //instanceMain.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Drawing;
2597
                        //instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = false;
2598
                        Common.ViewerDataModel.Instance.SelectedControl = "ClipWhite";
2599
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ClipWhite;
2600
                        break;
2601
                    case "CadExport":
2602
                        //if (isClosed)
2603
                        //{
2604
                        //    //토글 및 마우스 상태 초기화
2605
                        //    var toggleList = this.Parent.ChildrenOfType<RadRibbonToggleButton>();
2606
                        //    foreach (var togle in toggleList)
2607
                        //    {
2608
                        //        togle.IsChecked = false;
2609
                        //    }
2610
                        //    this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2611

    
2612
                        //    isClosed = false;
2613
                        //    //Control 파일 먼저 생성
2614
                        //    CollapsedButton_Click();
2615
                        //    CadViewer check = new CadViewer();
2616
                        //    check.WindowStartupLocation = WindowStartupLocation.CenterScreen;
2617
                        //    check.Title = "Export Viewer";
2618
                        //    //check.Topmost = true;
2619
                        //    check.Show();
2620
                        //    check.Closed += Check_Closed;
2621
                        //    instanceToggle.IsChecked = false;
2622
                        //}
2623
                        //break;
2624
                    case "CadViewer":
2625
                        //if (isClosed)
2626
                        //{
2627
                        //    //토글 및 마우스 상태 초기화
2628
                        //    var toggleList = this.Parent.ChildrenOfType<RadRibbonToggleButton>();
2629
                        //    foreach (var togle in toggleList)
2630
                        //    {
2631
                        //        togle.IsChecked = false;
2632
                        //    }
2633
                        //    this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2634

    
2635
                        //    isClosed = false;
2636
                        //    CadResultViewer check = new CadResultViewer();
2637
                        //    check.WindowStartupLocation = WindowStartupLocation.CenterScreen;
2638
                        //    check.Title = "Viewer";
2639
                        //    check.Show();
2640

    
2641
                        //    check.Closed += Check_Closed;
2642

    
2643
                        //}
2644
                        break;
2645
                    #endregion
2646
                    default:
2647
                        break;
2648
                }
2649
                #endregion
2650
            }
2651
            else
2652
            {
2653
                if (Common.ViewerDataModel.Instance.IsMacroCommand)
2654
                {
2655
                    MacroHelper.Clear();
2656
                }
2657

    
2658
                if (!instanceMain.dzMainMenu.IsFreeSelectionMode)
2659
                {
2660
                    instanceMain.dzMainMenu.IsSwingMode = false;
2661
                    Common.ViewerDataModel.Instance.SelectedControl = "";
2662
                    Common.ViewerDataModel.Instance.ControlTag = null;
2663
                    this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2664
                    this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2665
                }
2666
            }
2667

    
2668
        }
2669

    
2670
        private void SyncInit()
2671
        {
2672
            try
2673
            {
2674
                if (!ViewerDataModel.Instance.SystemMain.dzMainMenu.testPanel2.IsHidden)
2675
                {
2676
                    ViewerDataModel.Instance.SystemMain.dzMainMenu.testPanel2.IsHidden = true;
2677
                    ViewerDataModel.Instance.PageBalanceMode = false;
2678
                    ViewerDataModel.Instance.PageBalanceNumber = 0;
2679
                    ViewerDataModel.Instance.SyncPageNumber = 0;
2680
                    ViewerDataModel.Instance.MarkupControls_Sync.Clear();
2681
                    ViewerDataModel.Instance.SystemMain.dzMainMenu.gridViewRevMarkup.Visibility = Visibility.Collapsed;
2682
                    ViewerDataModel.Instance.SystemMain.dzMainMenu.UserList.IsChecked = false;
2683
                    ViewerDataModel.Instance.SystemMain.dzMainMenu.BalanceMode.IsChecked = false;
2684
                }
2685
            }
2686
            catch (Exception ex)
2687
            {
2688
                //Logger.sendResLog("SyncInit", ex.Message, 0);
2689
            }
2690

    
2691
        }
2692

    
2693
        UndoData multi_UndoData = new UndoData();
2694
        CommentUserInfo currentControl { get; set; }
2695
        private void Check_Closed(object sender, EventArgs e)
2696
        {
2697
            isClosed = true;
2698
            //this.ParentOfType<MainWindow>().dzMainMenu.PN_Navi.IsEnabled = true;
2699
            //토글 및 마우스 상태 초기화
2700
            var toggleList = this.Parent.ChildrenOfType<RadToggleButton>();
2701
            foreach (var togle in toggleList)
2702
            {
2703
                togle.IsChecked = false;
2704
            }
2705
            this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2706
            ViewerDataModel.Instance.Capture_Opacity = 0;
2707

    
2708
        }
2709

    
2710
        /* public class test 
2711
         {
2712
             public double width { get; set; }
2713
             public double height { get; set; }
2714
         }
2715
         */
2716
        private async void CollapsedButton_Click()
2717
        {
2718
            this.ParentOfType<MainWindow>().dzTopMenu._SaveEvent(null, null); // 저장하지 못한 데이터가 있다면 저장
2719

    
2720
            string[] data = new string[0];
2721

    
2722
            int cnt = 0;
2723
            var menu = this.ParentOfType<MainWindow>().dzMainMenu;
2724

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

    
2727
            foreach (var item in gridSelectionItem)
2728
            {
2729
                if ((item.UserID == App.ViewInfo.UserID) && (ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.CurrentPage != null))
2730
                {
2731
                    var instance = ViewerDataModel.Instance.MyMarkupList.Where(d => d.PageNumber == ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber &&
2732
                    d.MarkupInfoID == item.MarkupInfoID).ToList();
2733
                    data = new string[instance.Count];
2734
                    foreach (var markup in instance)
2735
                    {
2736
                        data[cnt++] = await MarkupToPDF.Serialize.Core.JsonSerializerHelper.UnCompressStringAsync(markup.Data,ViewerDataModel.Instance.NewMarkupCancelToken());
2737
                    }
2738
                }
2739
            }
2740

    
2741
            if (data != null && KCOM.Properties.Settings.Default.cad == 1)
2742
            {
2743
                string FilePath = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\Cad");
2744
                string FileName = FilePath + "\\commentstring.json"; // Default file name
2745
                if (!File.Exists(FilePath))
2746
                {
2747
                    Directory.CreateDirectory(FilePath);
2748
                }
2749

    
2750
                if (!string.IsNullOrEmpty(FileName))
2751
                {
2752
                    //  File.WriteAllText(SaveDig.FileName, data);
2753
                    File.WriteAllLines(FileName, data);
2754
                }
2755
            }
2756
        }
2757

    
2758
        private double minHeight;
2759
        private double minWidth;
2760

    
2761
        private double maxHeight;
2762
        private double maxWidth;
2763

    
2764
        public bool CanVResize { get; private set; }
2765
        public bool CanHResize { get; private set; }
2766

    
2767
        public void DesignerComponent(FrameworkElement content)
2768
        {
2769
            this.InitializeComponent();
2770

    
2771
            if (!double.IsNaN(content.Width))
2772
            {
2773
                CanHResize = false;
2774
                this.Width = content.Width;
2775
            }
2776
            else
2777
            {
2778
                CanHResize = true;
2779
                this.Width = 23.0;
2780
            }
2781
            if (!double.IsNaN(content.Height))
2782
            {
2783
                CanVResize = false;
2784
                this.Height = content.Height; ;
2785
            }
2786
            else
2787
            {
2788
                CanVResize = true;
2789
                this.Height = 23.0;
2790
            }
2791

    
2792
            minWidth = content.MinWidth < 10.0 ? 10.0 : content.MinWidth;
2793
            minHeight = content.MinHeight < 10.0 ? 10.0 : content.MinHeight;
2794
            maxWidth = content.MaxWidth;
2795
            maxHeight = content.MaxHeight;
2796

    
2797
            double top = (double)content.GetValue(Canvas.TopProperty);
2798
            if (double.IsNaN(top))
2799
                top = 0.0;
2800
            double left = (double)content.GetValue(Canvas.LeftProperty);
2801
            if (double.IsNaN(left))
2802
                left = 0.0;
2803
            SetValue(Canvas.TopProperty, top);
2804
            SetValue(Canvas.LeftProperty, left);
2805

    
2806
            //Set the actual content. Note that "Content" property is a new property. See below
2807
            this.Content = content;
2808
        }
2809
        private void Thumb_DragDelta(object sender, DragDeltaEventArgs e)
2810
        {
2811
            string name = ((Thumb)sender).Name;
2812
            if (name.Contains("Top"))
2813
            {
2814
                double newHeight = this.Height - e.VerticalChange;
2815
                if (newHeight >= minHeight && newHeight <= maxHeight)
2816
                {
2817
                    this.Height = newHeight;
2818
                    SetValue(Canvas.TopProperty,
2819
                (double)GetValue(Canvas.TopProperty) + e.VerticalChange);
2820
                }
2821
            }
2822
            if (name.Contains("Right"))
2823
            {
2824
                double newWidth = this.Width + e.HorizontalChange;
2825
                if (newWidth >= minWidth && newWidth <= maxWidth)
2826
                    this.Width = newWidth;
2827
            }
2828
            if (name.Contains("Bottom"))
2829
            {
2830
                double newHeight = this.Height + e.VerticalChange;
2831
                if (newHeight >= minHeight && newHeight <= maxHeight)
2832
                    this.Height = newHeight;
2833
            }
2834
            if (name.Contains("Left"))
2835
            {
2836
                double newWidth = this.Width - e.HorizontalChange;
2837
                if (newWidth >= minWidth && newWidth <= maxWidth)
2838
                {
2839
                    this.Width = newWidth;
2840
                    SetValue(Canvas.LeftProperty,
2841
                (double)GetValue(Canvas.LeftProperty) + e.HorizontalChange);
2842
                }
2843
            }
2844
        }
2845

    
2846
        private void drawControlBorder(object sender)
2847
        {
2848
            System.Windows.Controls.Control control = (System.Windows.Controls.Control)sender;
2849
        }
2850

    
2851
        private void ResizeThumb_DragDelta(object sender, MouseButtonEventArgs e)
2852
        {
2853
            System.Windows.Controls.Control designerItem = (System.Windows.Controls.Control)sender;
2854
            if (designerItem != null)
2855
            {
2856
                double deltaVertical, deltaHorizontal;
2857

    
2858
                switch (VerticalAlignment)
2859
                {
2860
                    case VerticalAlignment.Bottom:
2861
                        deltaVertical = designerItem.ActualHeight - designerItem.MinHeight;
2862
                        designerItem.Height -= deltaVertical;
2863
                        break;
2864
                    case VerticalAlignment.Top:
2865
                        deltaVertical = designerItem.ActualHeight - designerItem.MinHeight;
2866
                        Canvas.SetTop(designerItem, Canvas.GetTop(designerItem) + deltaVertical);
2867
                        designerItem.Height -= deltaVertical;
2868
                        break;
2869
                    default:
2870
                        break;
2871
                }
2872

    
2873
                switch (HorizontalAlignment)
2874
                {
2875
                    case HorizontalAlignment.Left:
2876
                        deltaHorizontal = designerItem.ActualWidth - designerItem.MinWidth;
2877
                        Canvas.SetLeft(designerItem, Canvas.GetLeft(designerItem) + deltaHorizontal);
2878
                        designerItem.Width -= deltaHorizontal;
2879
                        break;
2880
                    case HorizontalAlignment.Right:
2881
                        deltaHorizontal = designerItem.ActualWidth - designerItem.MinWidth;
2882
                        designerItem.Width -= deltaHorizontal;
2883
                        break;
2884
                    default:
2885
                        break;
2886
                }
2887
            }
2888
            e.Handled = true;
2889
        }
2890

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

    
2893
        void ExportMethod()
2894
        {
2895
            //FileDialogFilter filterImage = new FileDialogFilter("Image Files", "*.jpg", "*.png");
2896
            SaveDig.Filter = "PDF file format|*.pdf";
2897
            SaveDig.Title = "Save an DWG File";
2898
            SaveDig.ShowDialog();
2899
        }
2900

    
2901
        private void cbAutoSave_Checked(object sender, RoutedEventArgs e)
2902
        {            
2903
            if (cbAutoSave.IsChecked == true)
2904
            {
2905
                SaveTime(true, (int)cbSaveInterval.Value);
2906
            }
2907
            else
2908
            {
2909
                SaveTime(false, (int)cbSaveInterval.Value);
2910
            }
2911
        }
2912
        private void cbSaveInterval_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
2913
        {
2914
            if(string.IsNullOrEmpty(cbSaveInterval.Value.ToString()))
2915
            {
2916
                cbSaveInterval.Value = cbSaveInterval.Minimum;
2917
            }
2918
            if (cbAutoSave.IsChecked == true)
2919
            {
2920
                SaveTime(true, (int)cbSaveInterval.Value);
2921
            }
2922

    
2923
            KCOM.Properties.Settings.Default.SaveInterval = (double)cbSaveInterval.Value;
2924
            Properties.Settings.Default.Save();
2925
        }
2926
        //강인구 자동 저장 추가
2927
        private void AutoSave(object sender, RoutedEventArgs e)
2928
        {
2929
            RadToggleButton instanceToggle = sender as RadToggleButton;
2930

    
2931
            if(instanceToggle.IsChecked == true)
2932
            {
2933
                SaveTime(true);
2934
            }
2935
            else
2936
            {
2937
                SaveTime(false);
2938
            }
2939
        }
2940

    
2941
        public void Copy_Start()
2942
        {
2943
            if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
2944
            {
2945
                string MarkupData = "";
2946

    
2947
                foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
2948
                {
2949
                    string id = string.Empty;
2950
                    if (item.GetType().Name == "AdornerFinal")
2951
                    {
2952
                        foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
2953

    
2954
                        {
2955
                            if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
2956
                            {
2957
                                MarkupToPDF.Controls.Parsing.MarkupParser.MarkupReturn res = MarkupParser.MarkupToString(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo, App.ViewInfo.UserID);
2958
                                id = (InnerItem.Symbol_ID != null) ? "|SymbolID|" + InnerItem.Symbol_ID : "";
2959
                                MarkupData += "|OR|" + res.ConvertData + id;
2960
                            }
2961
                        }
2962

    
2963
                        this.Dispatcher.Invoke(() =>
2964
                        {
2965
                            Clipboard.SetData(DataFormats.StringFormat, MarkupData);
2966
                        }, DispatcherPriority.Background);
2967
                    }
2968
                }
2969
            }
2970
        }
2971

    
2972
        public void Cut_Start()
2973
        {
2974
            if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
2975
            {
2976
                foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
2977
                {
2978
                    string MarkupData = "";
2979

    
2980
                    if (item.GetType().Name == "AdornerFinal")
2981
                    {
2982
                        foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
2983
                        {
2984
                            if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
2985
                            {
2986
                                MarkupToPDF.Controls.Parsing.MarkupParser.MarkupReturn res = MarkupParser.MarkupToString(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo, App.ViewInfo.UserID);
2987
                                MarkupData += "|OR|" + res.ConvertData;
2988
                            }
2989
                        }
2990
                        //클립보드에 넣음
2991
                        Clipboard.SetDataObject(MarkupData);
2992
                    }
2993
                }
2994
                this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Clear();
2995
            }
2996
        }
2997

    
2998
        public async void Paste_Start()
2999
        {
3000
            //마크업 붙여넣기
3001

    
3002
            var markupData = Clipboard.GetData(DataFormats.StringFormat);
3003

    
3004
            if (markupData.GetType() == typeof(string) && markupData.ToString().Contains("|OR||DZ|"))
3005
            {
3006
                List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>();
3007

    
3008
                string[] delimiterChars = { "|OR|" };
3009
                string[] data = markupData.ToString().Split(delimiterChars, StringSplitOptions.RemoveEmptyEntries);
3010

    
3011
                SelectionSet.Instance.UnSelect(this.ParentOfType<MainWindow>().dzMainMenu);
3012

    
3013
                UndoData multi_UndoData = new UndoData();
3014

    
3015
                //강인구 Undo/Redo 보류
3016
                MarkupToPDF.Common.UndoDataGroup UndoData = new UndoDataGroup()
3017
                {
3018
                    IsUndo = false,
3019
                    Event = EventType.Create,
3020
                    EventTime = DateTime.Now,
3021
                    MarkupDataColl = new List<UndoData>()
3022
                };
3023

    
3024
                ViewerDataModel.Instance.UndoDataList.Where(data1 => data1.IsUndo == true).ToList().ForEach(i =>
3025
                {
3026
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
3027
                });
3028

    
3029
                foreach (string parse in data)
3030
                {
3031
                    if (parse != "")
3032
                    {
3033
                        System.Windows.Controls.Control item = await MarkupParser.ParseExAsync(App.BaseAddress,ViewerDataModel.Instance.NewMarkupCancelToken(),App.ViewInfo.ProjectNO, parse, ViewerDataModel.Instance.MarkupControls_USER, ViewerDataModel.Instance.PageAngle, string.Empty, string.Empty);
3034
                        (item as MarkupToPDF.Common.CommentUserInfo).CommentID = Commons.shortGuid();
3035

    
3036
                        ViewerDataModel.Instance.MarkupControls.Remove(item as MarkupToPDF.Common.CommentUserInfo);
3037
                        ViewerDataModel.Instance.MarkupControls_USER.Remove(item as MarkupToPDF.Common.CommentUserInfo);
3038

    
3039
                        adornerSet.Add(item as MarkupToPDF.Common.CommentUserInfo);
3040

    
3041
                        multi_UndoData = this.ParentOfType<MainWindow>().dzMainMenu.Control_Style(item as MarkupToPDF.Common.CommentUserInfo);
3042

    
3043
                        UndoData.MarkupDataColl.Add(multi_UndoData);
3044
                        ViewerDataModel.Instance.UndoDataList.Add(UndoData);                        
3045
                    }
3046
                }
3047
                Controls.AdornerFinal final = new Controls.AdornerFinal(adornerSet);
3048

    
3049
                if(this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.X < 0)
3050
                {
3051
                    Canvas.SetLeft(final, 0);
3052
                    Canvas.SetTop(final, 0);
3053
                }
3054
                else
3055
                {
3056
                    double realPointX = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.X - final.BorderSize.X - (final.BorderSize.Width / 2);
3057
                    double realPointY = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.Y - final.BorderSize.Y - (final.BorderSize.Height / 2);
3058
                    final.TranslateItems(realPointX, realPointY);
3059

    
3060
                    if (final.Members.Where(type => type.Drawingtype == MarkupToPDF.Controls.Common.ControlType.TextControl).FirstOrDefault() != null)
3061
                    {
3062
                        final.TranslateItems(0.001, 0.001); //dummy
3063
                    }
3064
                }
3065

    
3066
                this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Add(final);
3067
            }
3068
            //외부 이미지 붙여넣기
3069
            else if (Clipboard.GetImage() != null)
3070
            {
3071
                try
3072
                {
3073
                    UndoData multi_UndoData = new UndoData();
3074

    
3075
                    //강인구 Undo/Redo 보류
3076
                    MarkupToPDF.Common.UndoDataGroup UndoData = new UndoDataGroup()
3077
                    {
3078
                        IsUndo = false,
3079
                        Event = EventType.Create,
3080
                        EventTime = DateTime.Now,
3081
                        MarkupDataColl = new List<UndoData>()
3082
                    };
3083

    
3084

    
3085
                    string temppath = System.IO.Path.GetTempPath();
3086
                    //string filename = KCOM.Events.Save.shortCommentKey();
3087
                    string filename = Commons.shortFileKey();
3088

    
3089
                    System.Drawing.Image clipboardImage = System.Windows.Forms.Clipboard.GetImage();
3090
                    clipboardImage.Save(temppath + "\\" + filename);
3091

    
3092
                    System.IO.FileInfo fileInfo = new System.IO.FileInfo(temppath + "\\" + filename);
3093
                    String strFile = System.IO.Path.GetFileName(fileInfo.FullName);
3094
                    long numByte = fileInfo.Length;
3095
                    double dLen = Convert.ToDouble(fileInfo.Length / 1000000);
3096
                    kr.co.devdoftech.cloud.FileUpload fileUploader = App.FileUploader;
3097

    
3098
                    if (dLen < 4)
3099
                    {
3100
                        System.IO.FileStream fStream = new System.IO.FileStream(fileInfo.FullName,
3101
                        System.IO.FileMode.Open, System.IO.FileAccess.Read,FileShare.Read);
3102
                        System.IO.BinaryReader br = new System.IO.BinaryReader(fStream);
3103
                        byte[] data = br.ReadBytes((int)numByte);
3104

    
3105
                        filename = fileUploader.Run(App.ViewInfo.ProjectNO, this.ParentOfType<MainWindow>().dzMainMenu._DocItem.DOCUMENT_NO, App.ViewInfo.UserID, strFile + ".png", data);
3106
                        Check_Uri.UriCheck(filename);
3107
                        br.Close();
3108
                        fStream.Close();
3109
                        fStream.Dispose();
3110
                    }
3111
                    else
3112
                    {
3113
                        this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert("Available Memory less than 4 mega byte", "Alert");
3114
                        return;
3115
                    }
3116

    
3117
                    fileInfo.Delete();
3118

    
3119
                    System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(clipboardImage);
3120
                    IntPtr hBitmap = bmp.GetHbitmap();
3121
                    System.Windows.Media.ImageSource WpfBitmap = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(hBitmap, IntPtr.Zero, Int32Rect.Empty, System.Windows.Media.Imaging.BitmapSizeOptions.FromEmptyOptions());
3122
                    Image img = new Image();
3123
                    if (filename.Contains(".svg"))
3124
                    {
3125
                        SharpVectors.Converters.SvgImageExtension svgImage = new SharpVectors.Converters.SvgImageExtension(filename);
3126
                        img.Source = (DrawingImage)svgImage.ProvideValue(null);
3127
                    }
3128
                    else
3129
                    {
3130
                        img.Source = new BitmapImage(new Uri(filename));
3131
                    }
3132

    
3133
                    var currentControl = new MarkupToPDF.Controls.Etc.ImgControl
3134
                    {
3135
                        PointSet = new List<Point>(),
3136
                        FilePath = filename,
3137
                        ImageData = img.Source,
3138
                        StartPoint = new Point(100, 100),
3139
                        EndPoint = new Point(200, 200),
3140
                        TopRightPoint = new Point(100, 200),
3141
                        LeftBottomPoint = new Point(200, 100)
3142
                    };
3143

    
3144
                    currentControl.TopRightPoint = new Point(currentControl.StartPoint.X + clipboardImage.Width, currentControl.StartPoint.Y);
3145
                    currentControl.LeftBottomPoint = new Point(currentControl.StartPoint.X, currentControl.StartPoint.Y + clipboardImage.Height);
3146
                    currentControl.EndPoint = new Point(currentControl.StartPoint.X + clipboardImage.Width, currentControl.StartPoint.Y + clipboardImage.Height);
3147

    
3148
                    currentControl.PointSet = new List<Point>
3149
                                        {
3150
                                            currentControl.StartPoint,
3151
                                            currentControl.LeftBottomPoint,
3152
                                            currentControl.EndPoint,
3153
                                            currentControl.TopRightPoint,
3154
                                        };
3155

    
3156
                    multi_UndoData = this.ParentOfType<MainWindow>().dzMainMenu.Control_Style(currentControl as MarkupToPDF.Common.CommentUserInfo);
3157
                    UndoData.MarkupDataColl.Add(multi_UndoData);
3158
                    ViewerDataModel.Instance.UndoDataList.Add(UndoData);
3159

    
3160
                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl as MarkupToPDF.Common.CommentUserInfo);
3161
                    currentControl.CommentID = Commons.shortGuid();
3162

    
3163
                    currentControl.ApplyTemplate();
3164
                    currentControl.SetImage();
3165

    
3166
                    ViewerDataModel.Instance.MarkupControls_USER.Remove(currentControl as MarkupToPDF.Common.CommentUserInfo);
3167
                    Controls.AdornerFinal final = new Controls.AdornerFinal(currentControl as MarkupToPDF.Common.CommentUserInfo);
3168
                    this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Add(final);
3169

    
3170
                    double realPointX = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.X - final.BorderSize.X - (final.BorderSize.Width / 2);
3171
                    double realPointY = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.Y - final.BorderSize.Y - (final.BorderSize.Height / 2);
3172
                    final.TranslateItems(realPointX, realPointY);
3173
                }
3174
                catch(Exception ex)
3175
                {
3176
                    this.ParentOfType<MainWindow>().DialogMessage_Alert("" + ex, "Alert");
3177
                }
3178
            }
3179
        }
3180
    }
3181
}
클립보드 이미지 추가 (최대 크기: 500 MB)