프로젝트

일반

사용자정보

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

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

이력 | 보기 | 이력해설 | 다운로드 (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
            OpenSignManager();
1581
        }
1582

    
1583
        private void OpenSignManager()
1584
        { 
1585
            SignManager signManager = new SignManager();
1586

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

    
1601
            //CheckPop.ShowDialog();
1602
            signManagerPop.ShowDialog();
1603
        }
1604

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

    
1613
        private void CheckPop_Closed(object sender, WindowClosedEventArgs e)
1614
        {
1615
            isClosed = true;
1616
            //this.ParentOfType<MainWindow>().dzMainMenu.PN_Navi.IsEnabled = true;
1617
            this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
1618
            ViewerDataModel.Instance.Capture_Opacity = 0;
1619
        }
1620

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

    
1660
        private void viewEvent(object sender, RoutedEventArgs e)
1661
        {
1662
            RadRibbonToggleButton viewButton = sender as RadRibbonToggleButton;
1663
            var instanceMain = this.ParentOfType<MainWindow>();
1664

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

    
1667
            //if ((sender as RadRibbonToggleButton) != null)
1668
            //{
1669
            //    Common.ViewerDataModel.Instance.ControlTag = (sender as RadRibbonToggleButton).Tag.ToString();
1670
            //    instanceToggle = (sender as RadRibbonToggleButton);
1671
            //}
1672

    
1673
            //instanceToggle.IsChecked = false;
1674

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

    
1707
                    }
1708
                    break;
1709
                case "Rotate_M":
1710
                    {
1711
                        drawingPannelRotate(false);
1712
                        viewButton.IsChecked = false;
1713
                    }
1714
                    break;
1715
                case "Rotate_P":
1716
                    {
1717
                        drawingPannelRotate(true);
1718
                        viewButton.IsChecked = false;
1719
                    }
1720
                    break;
1721
                case "Rotate_half":
1722
                    {
1723
                        drawingPannelRotate(true);
1724
                        drawingPannelRotate(true);
1725
                        viewButton.IsChecked = false;
1726
                    }
1727
                    break;
1728
                    //case "fullscreen":
1729
                    //    {
1730
                    //        instanceMain.WindowStyle = WindowStyle.None;
1731
                    //        instanceMain.WindowState = WindowState.Maximized;
1732
                    //        instanceMain.dzMainMenu.zoomAndPanControl.ScaleToFit();
1733
                    //        viewButton.IsChecked = false;
1734
                    //    }
1735
                    //    break;
1736
            }
1737
        }
1738

    
1739
        private void Control_Event(object sender, RoutedEventArgs e)
1740
        {
1741

    
1742
        }
1743

    
1744
        #region 대기
1745

    
1746
        public void drawingPannelRotate(bool Flag)
1747
        {
1748
            var instanceMain = this.ParentOfType<MainWindow>();
1749

    
1750
            //if (rotateOffSet > 3)
1751
            //    rotateOffSet = 0;
1752

    
1753
            //if (rotateOffSet < 0)
1754
            //    rotateOffSet = 3;
1755

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

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

    
1809
            //instanceMain.dzMainMenu.zoomAndPanControl.RenderTransformOrigin = new Point(0.5, 0.5);
1810
            instanceMain.dzMainMenu.zoomAndPanControl.RotationAngle = instanceMain.dzMainMenu.rotate.Angle;
1811
            //대기(강인구)
1812
            //instanceMain.dzMainMenu.imageViewer.RotateAngle = instanceMain.dzMainMenu.rotate.Angle;
1813

    
1814

    
1815
            //instanceMain.dzMainMenu.imageViewer.RenderTransformOrigin = new Point(0.5, 0.5);
1816
            //RotateTransform rotateTransform = new RotateTransform(instanceMain.dzMainMenu.rotate.Angle);
1817
            //instanceMain.dzMainMenu.imageViewer.RenderTransform = rotateTransform;
1818

    
1819

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

    
1831

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

    
1835
            foreach (var data in thumbnaillist)
1836
            {
1837
                data.Angle = int.Parse(instanceMain.dzMainMenu.rotate.Angle.ToString());
1838

    
1839
                //instanceMain.dzMainMenu.pageNavigator.ImgListbox.ItemsSource = instanceMain.dzMainMenu.pageNavigator._thumbnailItems;
1840
                var instance = instanceMain.dzMainMenu.CurrentDoc.docInfo.DOCPAGE.Where(p => p.PAGE_NUMBER == instanceMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber).FirstOrDefault();
1841
                instance.PAGE_ANGLE = int.Parse(instanceMain.dzMainMenu.rotate.Angle.ToString());
1842

    
1843
                instanceMain.dzMainMenu.pageNavigator.GotoPage(data.PageNumber);
1844

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

    
1859
        private void ImageConverter(RadToggleButton instanceToggle)
1860
        {
1861
            try
1862
            {           
1863
                var instanceMain = this.ParentOfType<MainWindow>();
1864

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

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

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

    
1888
                        Check_Uri.UriCheck(filepath);
1889

    
1890
                        instanceMain.dzMainMenu.filename = filepath;
1891

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

    
1919
                this.ParentOfType<MainWindow>().DialogMessage_Alert(ex.Message, "Alert");
1920
            }
1921
        }
1922

    
1923
        private void Control_Init(RadToggleButton instanceToggle, object sender)
1924
        {
1925

    
1926
        }
1927

    
1928
        private void ControlEvent(object sender, RoutedEventArgs e)
1929
        {
1930
            RadToggleButton instanceToggle = sender as RadToggleButton;
1931
            var instanceMain = this.ParentOfType<MainWindow>();
1932

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

    
1953
            //if (!instanceMain.IsFreeSelectionMode)
1954
            //{
1955
            //    instanceMain.IsSwingMode = true;
1956
            //}
1957

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

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

    
1971
            if (instanceToggle != null)
1972
            {
1973
                Common.ViewerDataModel.Instance.ControlTag = instanceToggle.Tag.ToString();
1974
            }
1975
            else if ((sender as RadRibbonToggleButton) != null)
1976
            {
1977
                Common.ViewerDataModel.Instance.ControlTag = (sender as RadRibbonToggleButton).Tag.ToString();
1978
                instanceToggle = (sender as RadRibbonToggleButton);
1979
            }
1980
            else if ((sender as RadRibbonButton) != null)
1981
            {
1982
                RadRibbonButton instanceButton = sender as RadRibbonButton;
1983
                Common.ViewerDataModel.Instance.ControlTag = instanceButton.Tag.ToString();
1984
            }
1985
            else
1986
            {
1987
                RadButton instanceButton = sender as RadButton;
1988
                Common.ViewerDataModel.Instance.ControlTag = instanceButton.Tag.ToString();
1989
            }
1990

    
1991

    
1992
            //System.Reactive.Linq.Observable2.FromPropertyChangedPattern(Common.ViewerDataModel.Instance, temp => temp.AngleVisibility).Subscribe(isSee =>
1993
            //{
1994
            //    if (instanceToggle.CommandParameter.ToString() == "ChainLine")
1995
            //    {
1996

    
1997
            //    }
1998
            //    else
1999
            //    {
2000
            //        System.Diagnostics.Debug.WriteLine(" instanceMain.dzMainMenu.MainAngle.Visibility   " + isSee);
2001

    
2002
            //        if (instanceMain.dzMainMenu.MainAngle.Visibility != isSee)
2003
            //        {
2004
            //            instanceMain.dzMainMenu.MainAngle.Visibility = isSee;
2005
            //        }
2006
            //    }
2007
            //    //System.Reactive.Linq.Observable2.FromPropertyChangedPattern(Common.ViewerDataModel.Instance, temp => temp.AngleValue).Subscribe(p =>
2008
            //    //{
2009
            //    //    instanceMain.dzMainMenu.MainAngle.AngleValue = p;
2010
            //    //});
2011
            //});
2012

    
2013
            instanceMain.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Drawing;
2014

    
2015
            instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = false;
2016

    
2017
            if (instanceToggle.IsChecked != false)
2018
            {
2019
                string param = instanceToggle.CommandParameter.ToString();
2020
                string MacroIndex = "";
2021

    
2022
                if (param.StartsWith("MACRO"))
2023
                {
2024
                    param = "MACRO";
2025
                    MacroIndex = param.Replace("MACRO;","");
2026

    
2027
                    //Common.ViewerDataModel.Instance.MacroItems = MacroHelper.LoadMacroItems(MacroIndex);
2028
                    //var items = MacroHelper.TopMenuItems();
2029

    
2030
                    Common.ViewerDataModel.Instance.MacroItems = new List<MacroItem>
2031
                    {
2032
                        new MacroItem
2033
                        {
2034
                            Desc = "Cloud Rectangle",
2035
                            ControlType = MarkupToPDF.Controls.Common.ControlType.RectCloud
2036
                        },
2037
                        new MacroItem
2038
                        {
2039
                             Desc = "Arrow TextBox",
2040
                            ControlType = MarkupToPDF.Controls.Common.ControlType.ArrowTextBorderControl
2041
                        }
2042
                    };
2043
                }
2044

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

    
2268
                        //instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = true;
2269

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

    
2285
                                this.ParentOfType<MainWindow>().dzMainMenu.currentControl = null;
2286
                                Keyboard.ClearFocus();
2287

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

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

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

    
2355
                    #region MACRO -MACRO1
2356
                    case "MACRO":
2357
                        Common.ViewerDataModel.Instance.SelectedControl = "MACRO";
2358
                        Common.ViewerDataModel.Instance.ControlTag = instanceMain.dzMainMenu._ViewInfo.UserID; //사번
2359

    
2360
                        MacroHelper.MacroAction();
2361

    
2362
                        break;
2363
                    #endregion
2364

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

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

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

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

    
2528

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

    
2549
                        if (this.ParentOfType<MainWindow>().dzMainMenu.currentControl != null)
2550
                        {
2551
                            ViewerDataModel.Instance.MarkupControls_USER.Remove(this.ParentOfType<MainWindow>().dzMainMenu.currentControl);
2552
                            this.ParentOfType<MainWindow>().dzMainMenu.currentControl = null;
2553
                        }
2554

    
2555
                        ViewerDataModel.Instance.SelectedControl = "ImgControl";
2556
                   //     ViewerDataModel.Instance.ControlTag = null;
2557
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ImgControl;
2558

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

    
2572
                            }
2573
                            else
2574
                            {
2575
                                (Application.Current.MainWindow as MainWindow).dzTopMenu.RefactoryCommentReact(menu);
2576
                            }
2577
                        }*/
2578

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

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

    
2640
                        //    isClosed = false;
2641
                        //    CadResultViewer check = new CadResultViewer();
2642
                        //    check.WindowStartupLocation = WindowStartupLocation.CenterScreen;
2643
                        //    check.Title = "Viewer";
2644
                        //    check.Show();
2645

    
2646
                        //    check.Closed += Check_Closed;
2647

    
2648
                        //}
2649
                        break;
2650
                    #endregion
2651
                    default:
2652
                        break;
2653
                }
2654
                #endregion
2655
            }
2656
            else
2657
            {
2658
                if (Common.ViewerDataModel.Instance.IsMacroCommand)
2659
                {
2660
                    MacroHelper.Clear();
2661
                }
2662

    
2663
                if (!instanceMain.dzMainMenu.IsFreeSelectionMode)
2664
                {
2665
                    instanceMain.dzMainMenu.IsSwingMode = false;
2666
                    Common.ViewerDataModel.Instance.SelectedControl = "";
2667
                    Common.ViewerDataModel.Instance.ControlTag = null;
2668
                    this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2669
                    this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2670
                }
2671
            }
2672

    
2673
        }
2674

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

    
2696
        }
2697

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

    
2713
        }
2714

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

    
2725
            string[] data = new string[0];
2726

    
2727
            int cnt = 0;
2728
            var menu = this.ParentOfType<MainWindow>().dzMainMenu;
2729

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

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

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

    
2755
                if (!string.IsNullOrEmpty(FileName))
2756
                {
2757
                    //  File.WriteAllText(SaveDig.FileName, data);
2758
                    File.WriteAllLines(FileName, data);
2759
                }
2760
            }
2761
        }
2762

    
2763
        private double minHeight;
2764
        private double minWidth;
2765

    
2766
        private double maxHeight;
2767
        private double maxWidth;
2768

    
2769
        public bool CanVResize { get; private set; }
2770
        public bool CanHResize { get; private set; }
2771

    
2772
        public void DesignerComponent(FrameworkElement content)
2773
        {
2774
            this.InitializeComponent();
2775

    
2776
            if (!double.IsNaN(content.Width))
2777
            {
2778
                CanHResize = false;
2779
                this.Width = content.Width;
2780
            }
2781
            else
2782
            {
2783
                CanHResize = true;
2784
                this.Width = 23.0;
2785
            }
2786
            if (!double.IsNaN(content.Height))
2787
            {
2788
                CanVResize = false;
2789
                this.Height = content.Height; ;
2790
            }
2791
            else
2792
            {
2793
                CanVResize = true;
2794
                this.Height = 23.0;
2795
            }
2796

    
2797
            minWidth = content.MinWidth < 10.0 ? 10.0 : content.MinWidth;
2798
            minHeight = content.MinHeight < 10.0 ? 10.0 : content.MinHeight;
2799
            maxWidth = content.MaxWidth;
2800
            maxHeight = content.MaxHeight;
2801

    
2802
            double top = (double)content.GetValue(Canvas.TopProperty);
2803
            if (double.IsNaN(top))
2804
                top = 0.0;
2805
            double left = (double)content.GetValue(Canvas.LeftProperty);
2806
            if (double.IsNaN(left))
2807
                left = 0.0;
2808
            SetValue(Canvas.TopProperty, top);
2809
            SetValue(Canvas.LeftProperty, left);
2810

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

    
2851
        private void drawControlBorder(object sender)
2852
        {
2853
            System.Windows.Controls.Control control = (System.Windows.Controls.Control)sender;
2854
        }
2855

    
2856
        private void ResizeThumb_DragDelta(object sender, MouseButtonEventArgs e)
2857
        {
2858
            System.Windows.Controls.Control designerItem = (System.Windows.Controls.Control)sender;
2859
            if (designerItem != null)
2860
            {
2861
                double deltaVertical, deltaHorizontal;
2862

    
2863
                switch (VerticalAlignment)
2864
                {
2865
                    case VerticalAlignment.Bottom:
2866
                        deltaVertical = designerItem.ActualHeight - designerItem.MinHeight;
2867
                        designerItem.Height -= deltaVertical;
2868
                        break;
2869
                    case VerticalAlignment.Top:
2870
                        deltaVertical = designerItem.ActualHeight - designerItem.MinHeight;
2871
                        Canvas.SetTop(designerItem, Canvas.GetTop(designerItem) + deltaVertical);
2872
                        designerItem.Height -= deltaVertical;
2873
                        break;
2874
                    default:
2875
                        break;
2876
                }
2877

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

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

    
2898
        void ExportMethod()
2899
        {
2900
            //FileDialogFilter filterImage = new FileDialogFilter("Image Files", "*.jpg", "*.png");
2901
            SaveDig.Filter = "PDF file format|*.pdf";
2902
            SaveDig.Title = "Save an DWG File";
2903
            SaveDig.ShowDialog();
2904
        }
2905

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

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

    
2936
            if(instanceToggle.IsChecked == true)
2937
            {
2938
                SaveTime(true);
2939
            }
2940
            else
2941
            {
2942
                SaveTime(false);
2943
            }
2944
        }
2945

    
2946
        public void Copy_Start()
2947
        {
2948
            if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
2949
            {
2950
                string MarkupData = "";
2951

    
2952
                foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
2953
                {
2954
                    string id = string.Empty;
2955
                    if (item.GetType().Name == "AdornerFinal")
2956
                    {
2957
                        foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
2958

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

    
2968
                        this.Dispatcher.Invoke(() =>
2969
                        {
2970
                            Clipboard.SetData(DataFormats.StringFormat, MarkupData);
2971
                        }, DispatcherPriority.Background);
2972
                    }
2973
                }
2974
            }
2975
        }
2976

    
2977
        public void Cut_Start()
2978
        {
2979
            if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
2980
            {
2981
                foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
2982
                {
2983
                    string MarkupData = "";
2984

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

    
3003
        public async void Paste_Start()
3004
        {
3005
            //마크업 붙여넣기
3006

    
3007
            var markupData = Clipboard.GetData(DataFormats.StringFormat);
3008

    
3009
            if (markupData.GetType() == typeof(string) && markupData.ToString().Contains("|OR||DZ|"))
3010
            {
3011
                List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>();
3012

    
3013
                string[] delimiterChars = { "|OR|" };
3014
                string[] data = markupData.ToString().Split(delimiterChars, StringSplitOptions.RemoveEmptyEntries);
3015

    
3016
                SelectionSet.Instance.UnSelect(this.ParentOfType<MainWindow>().dzMainMenu);
3017

    
3018
                UndoData multi_UndoData = new UndoData();
3019

    
3020
                //강인구 Undo/Redo 보류
3021
                MarkupToPDF.Common.UndoDataGroup UndoData = new UndoDataGroup()
3022
                {
3023
                    IsUndo = false,
3024
                    Event = EventType.Create,
3025
                    EventTime = DateTime.Now,
3026
                    MarkupDataColl = new List<UndoData>()
3027
                };
3028

    
3029
                ViewerDataModel.Instance.UndoDataList.Where(data1 => data1.IsUndo == true).ToList().ForEach(i =>
3030
                {
3031
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
3032
                });
3033

    
3034
                foreach (string parse in data)
3035
                {
3036
                    if (parse != "")
3037
                    {
3038
                        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,
3039
                            STAMP_Contents: App.SystemInfo.STAMP_CONTENTS);
3040
                        (item as MarkupToPDF.Common.CommentUserInfo).CommentID = Commons.ShortGuid();
3041

    
3042
                        ViewerDataModel.Instance.MarkupControls.Remove(item as MarkupToPDF.Common.CommentUserInfo);
3043
                        ViewerDataModel.Instance.MarkupControls_USER.Remove(item as MarkupToPDF.Common.CommentUserInfo);
3044

    
3045
                        adornerSet.Add(item as MarkupToPDF.Common.CommentUserInfo);
3046

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

    
3049
                        UndoData.MarkupDataColl.Add(multi_UndoData);
3050
                        ViewerDataModel.Instance.UndoDataList.Add(UndoData);                        
3051
                    }
3052
                }
3053
                Controls.AdornerFinal final = new Controls.AdornerFinal(adornerSet);
3054

    
3055
                if(this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.X < 0)
3056
                {
3057
                    Canvas.SetLeft(final, 0);
3058
                    Canvas.SetTop(final, 0);
3059
                }
3060
                else
3061
                {
3062
                    double realPointX = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.X - final.BorderSize.X - (final.BorderSize.Width / 2);
3063
                    double realPointY = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.Y - final.BorderSize.Y - (final.BorderSize.Height / 2);
3064
                    final.TranslateItems(realPointX, realPointY);
3065

    
3066
                    if (final.Members.Where(type => type.Drawingtype == MarkupToPDF.Controls.Common.ControlType.TextControl).FirstOrDefault() != null)
3067
                    {
3068
                        final.TranslateItems(0.001, 0.001); //dummy
3069
                    }
3070
                }
3071

    
3072
                this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Add(final);
3073
            }
3074
            //외부 이미지 붙여넣기
3075
            else if (Clipboard.GetImage() != null)
3076
            {
3077
                try
3078
                {
3079
                    UndoData multi_UndoData = new UndoData();
3080

    
3081
                    //강인구 Undo/Redo 보류
3082
                    MarkupToPDF.Common.UndoDataGroup UndoData = new UndoDataGroup()
3083
                    {
3084
                        IsUndo = false,
3085
                        Event = EventType.Create,
3086
                        EventTime = DateTime.Now,
3087
                        MarkupDataColl = new List<UndoData>()
3088
                    };
3089

    
3090

    
3091
                    string temppath = System.IO.Path.GetTempPath();
3092
                    //string filename = KCOM.Events.Save.shortCommentKey();
3093
                    string filename = Commons.ShortFileKey();
3094

    
3095
                    System.Drawing.Image clipboardImage = System.Windows.Forms.Clipboard.GetImage();
3096
                    clipboardImage.Save(temppath + "\\" + filename);
3097

    
3098
                    System.IO.FileInfo fileInfo = new System.IO.FileInfo(temppath + "\\" + filename);
3099
                    String strFile = System.IO.Path.GetFileName(fileInfo.FullName);
3100
                    long numByte = fileInfo.Length;
3101
                    double dLen = Convert.ToDouble(fileInfo.Length / 1000000);
3102
                    kr.co.devdoftech.cloud.FileUpload fileUploader = App.FileUploader;
3103

    
3104
                    if (dLen < 4)
3105
                    {
3106
                        System.IO.FileStream fStream = new System.IO.FileStream(fileInfo.FullName,
3107
                        System.IO.FileMode.Open, System.IO.FileAccess.Read,FileShare.Read);
3108
                        System.IO.BinaryReader br = new System.IO.BinaryReader(fStream);
3109
                        byte[] data = br.ReadBytes((int)numByte);
3110

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

    
3123
                    fileInfo.Delete();
3124

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

    
3139
                    var currentControl = new MarkupToPDF.Controls.Etc.ImgControl
3140
                    {
3141
                        PointSet = new List<Point>(),
3142
                        FilePath = filename,
3143
                        ImageData = img.Source,
3144
                        StartPoint = new Point(100, 100),
3145
                        EndPoint = new Point(200, 200),
3146
                        TopRightPoint = new Point(100, 200),
3147
                        LeftBottomPoint = new Point(200, 100)
3148
                    };
3149

    
3150
                    currentControl.TopRightPoint = new Point(currentControl.StartPoint.X + clipboardImage.Width, currentControl.StartPoint.Y);
3151
                    currentControl.LeftBottomPoint = new Point(currentControl.StartPoint.X, currentControl.StartPoint.Y + clipboardImage.Height);
3152
                    currentControl.EndPoint = new Point(currentControl.StartPoint.X + clipboardImage.Width, currentControl.StartPoint.Y + clipboardImage.Height);
3153

    
3154
                    currentControl.PointSet = new List<Point>
3155
                                        {
3156
                                            currentControl.StartPoint,
3157
                                            currentControl.LeftBottomPoint,
3158
                                            currentControl.EndPoint,
3159
                                            currentControl.TopRightPoint,
3160
                                        };
3161

    
3162
                    multi_UndoData = this.ParentOfType<MainWindow>().dzMainMenu.Control_Style(currentControl as MarkupToPDF.Common.CommentUserInfo);
3163
                    UndoData.MarkupDataColl.Add(multi_UndoData);
3164
                    ViewerDataModel.Instance.UndoDataList.Add(UndoData);
3165

    
3166
                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl as MarkupToPDF.Common.CommentUserInfo);
3167
                    currentControl.CommentID = Commons.ShortGuid();
3168

    
3169
                    currentControl.ApplyTemplate();
3170
                    currentControl.SetImage();
3171

    
3172
                    ViewerDataModel.Instance.MarkupControls_USER.Remove(currentControl as MarkupToPDF.Common.CommentUserInfo);
3173
                    Controls.AdornerFinal final = new Controls.AdornerFinal(currentControl as MarkupToPDF.Common.CommentUserInfo);
3174
                    this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Add(final);
3175

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