프로젝트

일반

사용자정보

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

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

이력 | 보기 | 이력해설 | 다운로드 (147 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 Svg2Xaml;
8
using System;
9
using System.Collections.Generic;
10
using System.Linq;
11
using System.Text;
12
using System.Windows;
13
using System.Windows.Controls;
14
using System.Windows.Input;
15
using System.Windows.Media;
16
using System.Windows.Media.Imaging;
17
using Telerik.Windows.Controls;
18
using IKCOM;
19
using Microsoft.Win32;
20
using System.IO;
21
using System.Reflection;
22
using System.Windows.Controls.Primitives;
23
using MarkupToPDF.Controls.Parsing;
24
using Telerik.Windows.Data;
25
using System.ComponentModel;
26
using System.Web;
27
using Markus.Fonts;
28
using System.Threading.Tasks;
29

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

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

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

    
69
        private void CheckShapeState()
70
        {
71

    
72

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

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

    
97
            if (adornerMembers.Count() > 0)
98
            {
99
                UndoCommand.Instance.Push(adornerMembers.Select(x => x.DrawingData).Cast<CommentUserInfo>().ToList(), adnoerFinal.AngleValue);
100
            }
101
        }
102

    
103
        //강인구 추가(Undo End)
104
        private void SetPaintEvent()
105
        {
106
            List<AdornerMember> AdonerList = GetAdornerItem();
107

    
108
            if (AdonerList.Count > 0)
109
            {
110
                Undo_data UndoData = new Undo_data()
111
                {
112
                    IsUndo = false,
113
                    Event = Event_Type.Option,
114
                    EventTime = DateTime.Now,
115
                    paint = ViewerDataModel.Instance.paintSet,
116
                    Markup_List = new List<Multi_Undo_data>()
117
                };
118
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
119

    
120
                foreach (AdornerMember InnerItem in AdonerList)
121
                {
122
                    multi_Undo_Data.PointSet = new List<Point>();
123

    
124
                    if ((InnerItem.DrawingData as MarkupToPDF.Controls.Common.IShapeControl) != null)
125
                    {
126
                        (InnerItem.DrawingData as MarkupToPDF.Controls.Common.IShapeControl).Paint = ViewerDataModel.Instance.paintSet;
127
                    }
128

    
129
                    multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
130
                    UndoData.Markup_List.Add(multi_Undo_Data);
131
                    multi_Undo_Data = new Multi_Undo_data();
132
                }
133

    
134
                ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
135
                {
136
                    ViewerDataModel.Instance.UndoDataList.Remove(i);                    
137
                });
138
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
139
            }
140
        }
141

    
142
        private void SetHighlightEvent()
143
        {
144
            List<AdornerMember> AdonerList = GetAdornerItem();
145

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

    
166
        }
167

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

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

    
196
            if (ViewerDataModel.Instance.checkFillShape)
197
            {
198
                cbHatchShape.IsChecked = false;
199
                ViewerDataModel.Instance.paintSet = MarkupToPDF.Controls.Common.PaintSet.Fill;
200
            }
201
            else
202
            {
203
                ViewerDataModel.Instance.paintSet = MarkupToPDF.Controls.Common.PaintSet.None;
204
            }
205
            SetPaintEvent();
206
        }
207

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

    
239
            //강인구 추가
240
            ViewerDataModel.Instance.checkHatchShape = (sender as CheckBox).IsChecked.Value;
241
            if (ViewerDataModel.Instance.checkHatchShape)
242
            {
243
                cbFillShape.IsChecked = false;
244
                ViewerDataModel.Instance.paintSet = MarkupToPDF.Controls.Common.PaintSet.Hatch;
245
            }
246
            else
247
            {
248
                ViewerDataModel.Instance.paintSet = MarkupToPDF.Controls.Common.PaintSet.None;  
249
            }
250
            SetPaintEvent();
251
        }
252

    
253
        void SaveTimer_Tick(object sender, EventArgs e)
254
        {
255
            //if (this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode != IKCOM.MouseHandlingMode.Drawing)
256
            if (this.ParentOfType<MainWindow>().dzMainMenu.currentControl == null && this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count == 0)
257
            {
258
                SaveEventCallback(null, null);
259
            }
260
        }
261

    
262
        private void SaveTime(bool IsRun)
263
        {
264
            if(SaveTimer == null)
265
            {
266
                SaveTimer = new System.Windows.Threading.DispatcherTimer();
267
                SaveTimer.Interval = new TimeSpan(0, 0, 5);
268
                SaveTimer.Tick += new EventHandler(SaveTimer_Tick);
269
            }
270

    
271
            if (IsRun)
272
            {
273
                SaveTimer.Start();
274
            }
275
            else
276
            {
277
                SaveTimer.Stop();
278
            }
279
        }
280
        private void SaveTime(bool IsRun,int timeinterval)
281
        {
282
            if (SaveTimer == null)
283
            {
284
                SaveTimer = new System.Windows.Threading.DispatcherTimer();
285
                SaveTimer.Interval = new TimeSpan(0, timeinterval, 0);
286
                SaveTimer.Tick += new EventHandler(SaveTimer_Tick);
287
            }
288
            else
289
            {
290
                SaveTimer.Stop();
291
                SaveTimer.Interval = new TimeSpan(0, timeinterval, 0);
292
            }
293

    
294
            if (IsRun)
295
            {
296
                SaveTimer.Start();
297
            }
298
            else
299
            {
300
                SaveTimer.Stop();
301
            }
302
        }
303
        /// <summary>
304
        /// enable busy indicator and then call _SaveEvent method.
305
        /// </summary>
306
        /// <param name="sender"></param>
307
        /// <param name="e"></param>
308
        public async void SaveEventCallback(object sender, RoutedEventArgs e)
309
        {
310
            var mianMenu = this.ParentOfType<MainWindow>().dzMainMenu;
311

    
312
            if (mianMenu.busyIndicator.IsBusy == true)
313
            {
314
                return;
315
            }
316

    
317
            var result = await Dispatcher.InvokeAsync<bool>(()=>
318
            {
319
                this.ParentOfType<MainWindow>().dzMainMenu.busyIndicator.IsBusy = true;
320

    
321
                _SaveEvent(sender, e);
322

    
323
                mianMenu.busyIndicator.IsBusy = false;
324
                return true;
325
            });
326

    
327
            //System.Threading.Tasks.Task SaveTask = System.Threading.Tasks.Task.Factory.StartNew(() =>
328
            //{
329
            //    Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, new Action<object, RoutedEventArgs>(_SaveEvent), sender, e);
330
            //}).ContinueWith(task =>
331
            //{
332
            //    Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate () { this.ParentOfType<MainWindow>().dzMainMenu.busyIndicator.IsBusy = false; }));
333
            //});
334
        }
335

    
336
        /// <summary>
337
        /// save markup
338
        ///  - convert ink control to polygon control if ink control exists
339
        ///  - unselect and update my markup list
340
        /// <param name="sender"></param>
341
        /// <param name="e"></param>
342
        public bool _SaveEvent(object sender, RoutedEventArgs e)
343
        {
344
            bool result = false;
345

    
346
            var mainMenu = this.ParentOfType<MainWindow>().dzMainMenu;
347
            try
348
            {
349
                mainMenu.ConvertInkControlToPolygon();
350

    
351
                SelectionSet.Instance.UnSelect(this.ParentOfType<MainWindow>().dzMainMenu);
352
                // update mylist and gridview
353
                mainMenu.UpdateMyMarkupList();
354

    
355
                if (mainMenu.gridViewMarkup.SelectedItems.Count == 0 && mainMenu.gridViewMarkup.Items.Count > 0)
356
                {
357
                    this.ParentOfType<MainWindow>().DialogMessage_Alert("Please Select Your Comment List Item", "Alert");
358
                }
359
                else
360
                {                    
361
                    foreach (var item in mainMenu.gridViewMarkup.SelectedItems)
362
                    {
363
                        if ((item as IKCOM.MarkupInfoItem).UserID == App.ViewInfo.UserID)
364
                        {
365
                            /// 저장 서비스 호출
366
                            this.ExecuteSaveCommand(mainMenu);
367

    
368
                            ViewerDataModel.Instance._markupInfoList.Where(data => data.MarkupInfoID == (item as IKCOM.MarkupInfoItem).MarkupInfoID).FirstOrDefault().UpdateTime = DateTime.Now;
369
                            if (!ViewerDataModel.Instance.IsConsolidate && (sender != null))
370
                            {
371
                                this.ParentOfType<MainWindow>().DialogMessage_Alert("Save is complete.", "Info");
372
                                
373
                            }
374

    
375
                            result = true;
376
                        }
377
                    }
378
                }
379

    
380
                mainMenu.SetCommentPages(null);
381

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

    
405
            return result;
406
        }
407

    
408
        /// <summary>
409
        /// call save command
410
        /// </summary>
411
        /// <param name="menu"></param>
412
		public void ExecuteSaveCommand2(MainMenu menu)
413
        {
414
            if (menu.pageNavigator.CurrentPage != null)
415
            {
416
                SaveCommand.Instance.Project_No = App.ViewInfo.ProjectNO;
417
                SaveCommand.Instance.document_id = App.ViewInfo.DocumentItemID;
418
                SaveCommand.Instance.user_id = App.ViewInfo.UserID;
419
                SaveCommand.Instance.page_no = menu.pageNavigator.CurrentPage.PageNumber;
420

    
421
                try
422
                {
423
                    if (ViewerDataModel.Instance.UndoDataList.Count > 0)
424
                    {
425
                        List<IKCOM.MarkupInfoItem> SelectedMarkupInfos = new List<IKCOM.MarkupInfoItem>();
426
                        foreach (var item in menu.gridViewMarkup.SelectedItems)
427
                        {
428
                            if ((item as IKCOM.MarkupInfoItem).UserID == App.ViewInfo.UserID)
429
                            {
430
                                SelectedMarkupInfos.Add(item as IKCOM.MarkupInfoItem);
431
                            }
432
                        }
433

    
434
                        SaveCommand.Instance.Execute(SelectedMarkupInfos);
435
                    }
436

    
437
                    if (ViewerDataModel.Instance.RotationDocs.Count > 0)
438
                    {
439
                        SaveCommand.Instance.PageAngleSave(App.ViewInfo.ProjectNO, ViewerDataModel.Instance.RotationDocs);
440
                    }
441
                }
442
                catch (Exception ex)
443
                {
444
                    this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert(string.Format("세이브 실패:{0}", ex.Message), "Alert");
445
                    throw ex;
446
                }
447
            }
448
            else
449
            {
450
                System.Diagnostics.Debug.WriteLine("ExecuteSaveCommand Error - pageNavigator.CurrentPage null");
451
            }
452
        }
453

    
454
        public async Task<bool> ExecuteSaveCommand(MainMenu menu)
455
        {
456
            bool result = false;
457

    
458
            if (menu.pageNavigator.CurrentPage != null)
459
            {
460
                SaveCommand.Instance.Project_No = App.ViewInfo.ProjectNO;
461
                SaveCommand.Instance.document_id = App.ViewInfo.DocumentItemID;
462
                SaveCommand.Instance.user_id = App.ViewInfo.UserID;
463
                SaveCommand.Instance.page_no = menu.pageNavigator.CurrentPage.PageNumber;
464

    
465
                try
466
                {
467
                    if (ViewerDataModel.Instance.UndoDataList.Count > 0)
468
                    {
469
                        List<IKCOM.MarkupInfoItem> SelectedMarkupInfos = new List<IKCOM.MarkupInfoItem>();
470
                        foreach (var item in menu.gridViewMarkup.SelectedItems)
471
                        {
472
                            if ((item as IKCOM.MarkupInfoItem).UserID == App.ViewInfo.UserID)
473
                            {
474
                                SelectedMarkupInfos.Add(item as IKCOM.MarkupInfoItem);
475
                            }
476
                        }
477

    
478
                        result = await SaveCommand.Instance.Execute(SelectedMarkupInfos);
479
                    }
480
                    else
481
                    {
482
                        result = true;
483
                    }
484

    
485
                    if (ViewerDataModel.Instance.RotationDocs.Count > 0)
486
                    {
487
                        SaveCommand.Instance.PageAngleSave(App.ViewInfo.ProjectNO, ViewerDataModel.Instance.RotationDocs);
488
                    }
489
                }
490
                catch (Exception ex)
491
                {
492
                    this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert(string.Format("세이브 실패:{0}", ex.Message), "Alert");
493
                    throw ex;
494
                }
495
            }
496
            else
497
            {
498
                System.Diagnostics.Debug.WriteLine("ExecuteSaveCommand Error - pageNavigator.CurrentPage null");
499
            }
500

    
501
            return result;
502
        }
503

    
504
        //강인구 추가
505
        public void Print_Start(string Type)
506
        {
507
            if (ViewerDataModel.Instance.MarkupControls_USER.Count > 0 || this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
508
            {
509
                var menu = this.ParentOfType<MainWindow>().dzMainMenu;
510
                SelectionSet.Instance.UnSelect(menu);
511
                if (menu.PreviewUserMarkupInfoItem != null && menu.PreviewUserMarkupInfoItem.IsPreviewUser == true)
512
                {
513
                    this.SaveEventCallback(null, null);
514
                }
515
                else if (menu.gridViewMarkup.SelectedItems.Count == 0 || (menu.gridViewMarkup.SelectedItems.FirstOrDefault() as IKCOM.MarkupInfoItem).UserID != App.ViewInfo.UserID)
516
                {
517

    
518
                }
519
                else
520
                {
521
                    this.SaveEventCallback(null, null);
522
                }
523
            }
524

    
525
            bool isprint = false;
526
            if (Type == "Print")
527
            {
528
                isprint = true;
529
            }
530

    
531
            RadWindow PrintWindow = new RadWindow();
532
            PrintWindow.Width = 850;
533
            PrintWindow.Height = 600;
534
            PrintWindow.Header = Type;
535

    
536
            List<IKCOM.MarkupInfoItem> markupinfo = new List<IKCOM.MarkupInfoItem>();
537

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

    
540
            if (markupinfo?.Count() > 0)
541
            {
542
                //Logger.sendResLog("GetPrintDocItemList", "TRUE", 1);
543
            }
544
            else
545
            {
546
                //Logger.sendResLog("GetPrintDocItemList", "FALSE", 1);
547
            }
548

    
549
            /// Tile Source URL을 구한다
550

    
551
            string sImageURL = ViewerDataModel.Instance.SystemMain.dzMainMenu.GetImageURL(App.ViewInfo.DocumentItemID, this.ParentOfType<MainWindow>().dzMainMenu.pageNavigator.CurrentPage.PageNumber);
552
            var url = new Uri(sImageURL);
553
            string sFolder = App.ViewInfo.DocumentItemID.All(char.IsDigit) ? (Convert.ToInt64(App.ViewInfo.DocumentItemID) / 100).ToString() : App.ViewInfo.DocumentItemID.Substring(0, 5);
554
            var Tile_Url = string.Format(@"{0}://{1}:{2}/TileSource/{3}_Tile/{4}/{5}/",
555
                url.Scheme, url.Host, url.Port,
556
                App.ViewInfo.ProjectNO,
557
                sFolder,
558
                App.ViewInfo.DocumentItemID
559
                );
560
            /// up to here
561

    
562
            var docitem = this.ParentOfType<MainWindow>().dzMainMenu._DocItem;
563

    
564
            PrintWindow.Content = new KCOM.Control.PrintControl(
565
                      Tile_Url,
566
                      App.ViewInfo.ProjectNO,
567
                      this.ParentOfType<MainWindow>().dzMainMenu._DocInfo,
568
                      markupinfo,
569
                      this.ParentOfType<MainWindow>().dzMainMenu.pageNavigator.CurrentPage.PageNumber,
570
                      docitem.GROUP_NO,
571
                      docitem.DOCUMENT_NO,
572
                      docitem.ORIGINAL_FILE,
573
                      isprint);
574

    
575
            //프린트 팝업 옵션
576
            //PrintWindow.BorderThickness = new Thickness(3);
577
            //PrintWindow.BorderBrush = new SolidColorBrush(Color.FromArgb(255, 37, 160, 218));
578
            PrintWindow.ResizeMode = System.Windows.ResizeMode.NoResize;
579
            PrintWindow.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
580
            PrintWindow.Background = new SolidColorBrush(Colors.Black);
581
            PrintWindow.Background.Opacity = 0.6;
582
            PrintWindow.Owner = Application.Current.MainWindow;
583
            Telerik.Windows.Controls.StyleManager.SetTheme(PrintWindow, new Telerik.Windows.Controls.VisualStudio2013Theme());
584
            PrintWindow.ShowDialog();
585
        }
586

    
587
        //강인구 추가
588
        private void PrintEvent(object sender, RoutedEventArgs e)
589
        {
590
            RadRibbonButton button = sender as RadRibbonButton;
591
            Print_Start(button.Content.ToString());
592
        }
593

    
594
        private List<AdornerMember> GetAdornerItem()
595
        {
596
            List<AdornerMember> AdonerList = new List<AdornerMember>();
597

    
598
            if (this.ParentOfType<MainWindow>() != null)
599
            {
600
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
601
                {
602
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
603
                    {
604
                        if (item.GetType().Name == "AdornerFinal")
605
                        {
606
                            foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
607
                            {
608
                                AdonerList.Add(InnerItem);
609
                            }
610
                        }
611
                    }
612
                }
613
            }
614

    
615
            return AdonerList;
616
        }
617
        /// <summary>
618
        /// 투명도
619
        /// </summary>
620
        /// <param name="sender"></param>
621
        /// <param name="e"></param>
622
        //강인구 추가(Undo End)
623
        private void sdOpacity_ValueChanged(object sender, RoutedEventArgs e)
624
        {
625
            List<AdornerMember> AdonerList = GetAdornerItem();
626
            if(AdonerList.Count > 0)
627
            {
628
                Undo_data UndoData = new Undo_data()
629
                {
630
                    IsUndo = false,
631
                    Event = Event_Type.Option,
632
                    EventTime = DateTime.Now,
633
                    Opacity = ViewerDataModel.Instance.ControlOpacity,
634
                    Markup_List = new List<Multi_Undo_data>()
635
                };
636
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
637

    
638
                foreach (AdornerMember InnerItem in AdonerList)
639
                {
640
                    InnerItem.DrawingData.Opacity = ViewerDataModel.Instance.ControlOpacity;
641
                  
642
                    multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
643
                    UndoData.Markup_List.Add(multi_Undo_Data);
644
                    multi_Undo_Data = new Multi_Undo_data();
645
                }
646

    
647
                ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
648
                {
649
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
650
                });
651
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
652
            }
653
        }
654

    
655
        //강인구 추가(Undo End)
656
        private void cbLineSize_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
657
        {
658
            if (string.IsNullOrEmpty(cbLineSize.Value.ToString()))
659
            {
660
                cbLineSize.Value = cbLineSize.Minimum;
661
            }
662
            List<AdornerMember> AdonerList = GetAdornerItem();
663
            if (AdonerList.Count > 0)
664
            {
665
                Undo_data UndoData = new Undo_data()
666
                {
667
                    IsUndo = false,
668
                    Event = Event_Type.Option,
669
                    EventTime = DateTime.Now,
670
                    LineSize = ViewerDataModel.Instance.LineSize,
671
                    Markup_List = new List<Multi_Undo_data>()
672
                };
673
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
674

    
675
                foreach (AdornerMember InnerItem in AdonerList)
676
                {
677
                    switch (InnerItem.DrawingData.GetType().Name)
678
                    {
679
                        case ("LineControl"):
680
                            {
681
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Line.LineControl).LineSize = ViewerDataModel.Instance.LineSize;
682
                            }
683
                            break;
684
                        case ("ArcControl"):
685
                            {
686
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Line.ArcControl).LineSize = ViewerDataModel.Instance.LineSize;
687
                            }
688
                            break;
689
                        case ("ArrowArcControl"):
690
                            {
691
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Line.ArrowArcControl).LineSize = ViewerDataModel.Instance.LineSize;
692
                            }
693
                            break;
694
                        case ("ArrowControl_Multi"):
695
                            {
696
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Line.ArrowControl_Multi).LineSize = ViewerDataModel.Instance.LineSize;
697
                            }
698
                            break;
699
                        case ("CloudControl"):
700
                            {
701
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Polygon.CloudControl).LineSize = ViewerDataModel.Instance.LineSize;
702
                            }
703
                            break;
704
                        case ("PolygonControl"):
705
                            {
706
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Polygon.PolygonControl).LineSize = ViewerDataModel.Instance.LineSize;
707
                            }
708
                            break;
709
                        case ("RectangleControl"):
710
                            {
711
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.RectangleControl).LineSize = ViewerDataModel.Instance.LineSize;
712
                            }
713
                            break;
714
                        case ("RectCloudControl"):
715
                            {
716
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.RectCloudControl).LineSize = ViewerDataModel.Instance.LineSize;
717
                            }
718
                            break;
719
                        case ("TriControl"):
720
                            {
721
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.TriControl).LineSize = ViewerDataModel.Instance.LineSize;
722
                            }
723
                            break;
724
                        case ("CircleControl"):
725
                            {
726
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.CircleControl).LineSize = ViewerDataModel.Instance.LineSize;
727
                            }
728
                            break;
729
                        case ("ArrowTextControl"):
730
                            {
731
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).LineSize = ViewerDataModel.Instance.LineSize;
732
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).BorderSize = new Thickness(ViewerDataModel.Instance.LineSize);
733
                            }
734
                            break;
735
                        case ("TextControl"):
736
                            {
737
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).LineSize = new Thickness(ViewerDataModel.Instance.LineSize);
738
                            }
739
                            break;
740
                        case ("InsideWhiteControl"):
741
                            {
742
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Cad.InsideWhiteControl).LineSize = ViewerDataModel.Instance.LineSize;
743
                            }
744
                            break;
745
                        case ("OverlapWhiteControl"):
746
                            {
747
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Cad.OverlapWhiteControl).LineSize = ViewerDataModel.Instance.LineSize;
748
                            }
749
                            break;
750
                        case ("ClipWhiteControl"):
751
                            {
752
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Cad.ClipWhiteControl).LineSize = ViewerDataModel.Instance.LineSize;
753
                            }
754
                            break;
755
                        case ("CoordinateControl"):
756
                            {
757
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Cad.CoordinateControl).LineSize = 10; //ViewerDataModel.Instance.LineSize
758
                            }
759
                            break;
760
                    }
761
                    
762

    
763
                    multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
764
                    UndoData.Markup_List.Add(multi_Undo_Data);
765
                    multi_Undo_Data = new Multi_Undo_data();
766
                }
767

    
768
                ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
769
                {
770
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
771
                });
772
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
773

    
774
                
775
            }
776
            KCOM.Properties.Settings.Default.LineSize = (double)cbLineSize.Value;
777
            Properties.Settings.Default.Save();
778
        }
779

    
780

    
781
        private void cbIntervalSize_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
782
        {
783
            if (string.IsNullOrEmpty(cbIntervalSize.Value.ToString()))
784
            {
785
                cbIntervalSize.Value = cbIntervalSize.Minimum;
786
            }
787
            List<AdornerMember> AdonerList = GetAdornerItem();
788
            if (AdonerList.Count > 0)
789
            {
790

    
791
                Undo_data UndoData = new Undo_data()
792
                {
793
                    IsUndo = false,
794
                    Event = Event_Type.Option,
795
                    EventTime = DateTime.Now,
796
                    Interval = ViewerDataModel.Instance.Interval,
797
                    Markup_List = new List<Multi_Undo_data>()
798
                };
799
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
800

    
801
                foreach (AdornerMember InnerItem in AdonerList)
802
                {
803
                    switch (InnerItem.DrawingData.GetType().Name)
804
                    {
805
                        case ("LineControl"):
806
                            {
807
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Line.LineControl).Interval = ViewerDataModel.Instance.Interval;
808

    
809
                                multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
810
                                UndoData.Markup_List.Add(multi_Undo_Data);
811
                                multi_Undo_Data = new Multi_Undo_data();
812
                            }
813
                            break;
814
                    }
815
                }
816

    
817
                ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
818
                {
819
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
820
                });
821
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
822
            }
823
            KCOM.Properties.Settings.Default.Interval = (double)cbIntervalSize.Value;
824
            Properties.Settings.Default.Save();
825
        }
826
        
827
        private void cbArcLength_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
828
        {
829
            if (string.IsNullOrEmpty(cbArcLength.Value.ToString()))
830
            {
831
                cbArcLength.Value = cbArcLength.Minimum;
832
            }
833
            List<AdornerMember> AdonerList = GetAdornerItem();
834
            if (AdonerList.Count > 0)
835
            {
836

    
837
                //Undo_data UndoData = new Undo_data()
838
                //{
839
                //    IsUndo = false,
840
                //    Event = Event_Type.Option,
841
                //    EventTime = DateTime.Now,
842
                //    Interval = ViewerDataModel.Instance.Interval,
843
                //    Markup_List = new List<Multi_Undo_data>()
844
                //};
845
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
846

    
847
                foreach (AdornerMember InnerItem in AdonerList)
848
                {
849
                    switch (InnerItem.DrawingData.GetType().Name)
850
                    {
851
                        case ("RectCloudControl"):
852
                            {
853
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.RectCloudControl).ArcLength = ViewerDataModel.Instance.ArcLength;
854

    
855
                                //multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
856
                                //UndoData.Markup_List.Add(multi_Undo_Data);
857
                                //multi_Undo_Data = new Multi_Undo_data();
858
                            }
859
                            break;
860
                        case ("CloudControl"):
861
                            {
862
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Polygon.CloudControl).ArcLength = ViewerDataModel.Instance.ArcLength;
863

    
864
                                //multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
865
                                //UndoData.Markup_List.Add(multi_Undo_Data);
866
                                //multi_Undo_Data = new Multi_Undo_data();
867
                            }
868
                            break;
869
                    }
870
                }
871

    
872
                //ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
873
                //{
874
                //    ViewerDataModel.Instance.UndoDataList.Remove(i);
875
                //});
876
                //ViewerDataModel.Instance.UndoDataList.Add(UndoData);
877
            }
878

    
879
            KCOM.Properties.Settings.Default.ArcLength = (double)cbArcLength.Value;
880
            Properties.Settings.Default.Save();
881
        }
882

    
883
        //강인구 추가(Undo End)
884
        private void cbDashStyle_SelectionChanged(object sender, SelectionChangedEventArgs e)
885
        {
886
            //강인구 추가
887
            if (this.ParentOfType<MainWindow>() != null)
888
            {
889
                ViewerDataModel.Instance.DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
890
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
891
                {
892
                    Undo_data UndoData = new Undo_data()
893
                    {
894
                        IsUndo = false,
895
                        Event = Event_Type.Option,
896
                        EventTime = DateTime.Now,
897
                        DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData,
898
                        Markup_List = new List<Multi_Undo_data>()
899
                    };
900
                    Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
901

    
902
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
903
                    {
904
                        if (item.GetType().Name == "AdornerFinal")
905
                        {
906
                            foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
907
                            {
908
                                switch (InnerItem.DrawingData.GetType().Name)
909
                                {
910
                                    case ("LineControl"):
911
                                        {
912
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Line.LineControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
913
                                        }
914
                                        break;
915
                                    case ("ArcControl"):
916
                                        {
917
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Line.ArcControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
918
                                        }
919
                                        break;
920
                                    case ("ArrowArcControl"):
921
                                        {
922
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Line.ArrowArcControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
923
                                        }
924
                                        break;
925
                                    case ("ArrowControl_Multi"):
926
                                        {
927
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Line.ArrowControl_Multi).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
928
                                        }
929
                                        break;
930
                                    case ("CloudControl"):
931
                                        {
932
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Polygon.CloudControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
933
                                        }
934
                                        break;
935
                                    case ("PolygonControl"):
936
                                        {
937
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Polygon.PolygonControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
938
                                        }
939
                                        break;
940
                                    case ("RectangleControl"):
941
                                        {
942
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.RectangleControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
943
                                        }
944
                                        break;
945
                                    case ("RectCloudControl"):
946
                                        {
947
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.RectCloudControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
948
                                        }
949
                                        break;
950
                                    case ("TriControl"):
951
                                        {
952
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.TriControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
953
                                        }
954
                                        break;
955
                                    case ("CircleControl"):
956
                                        {
957
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.CircleControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
958
                                        }
959
                                        break;
960
                                    case ("InsideWhiteControl"):
961
                                        {
962
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Cad.InsideWhiteControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
963
                                        }
964
                                        break;
965
                                    case ("OverlapWhiteControl"):
966
                                        {
967
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Cad.OverlapWhiteControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
968
                                        }
969
                                        break;
970
                                    case ("ClipWhiteControl"):
971
                                        {
972
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Cad.ClipWhiteControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
973
                                        }
974
                                        break;
975
                                    case ("CoordinateControl"):
976
                                        {
977
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Cad.CoordinateControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
978
                                        }
979
                                        break;
980
                                }
981

    
982
                                multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
983
                                UndoData.Markup_List.Add(multi_Undo_Data);
984
                                multi_Undo_Data = new Multi_Undo_data();
985
                            }
986

    
987
                            ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
988
                            {
989
                                ViewerDataModel.Instance.UndoDataList.Remove(i);
990
                            });
991
                            ViewerDataModel.Instance.UndoDataList.Add(UndoData);
992
                        }
993
                    }
994
                }
995
            }
996
        }
997

    
998
        //강인구 추가
999
        private void comboFontSize_SelectionChanged(object sender, SelectionChangedEventArgs e)
1000
        {
1001
            //if (this.ParentOfType<MainWindow>() != null)
1002
            //{
1003
            //    if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
1004
            //    {
1005
            //        foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
1006
            //        {
1007
            //            if (item.GetType().Name == "AdornerFinal")
1008
            //            {
1009
            //                foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
1010
            //                {
1011
            //                    switch (InnerItem.DrawingData.GetType().Name)
1012
            //                    {
1013
            //                        case ("TextControl"):
1014
            //                            {
1015
            //                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextSize = int.Parse(comboFontSize.Text);
1016
            //                            }
1017
            //                            break;
1018
            //                        case ("ArrowTextControl"):
1019
            //                            {
1020
            //                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextSize = int.Parse(comboFontSize.Text);
1021
            //                            }
1022
            //                            break;
1023
            //                    }
1024
            //                }
1025
            //            }
1026
            //        }
1027
            //    }
1028
            //}
1029
        }
1030

    
1031
        //강인구 추가
1032
        private void btnBold_Checked(object sender, RoutedEventArgs e)
1033
        {
1034
            if (this.ParentOfType<MainWindow>() != null)
1035
            {
1036
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
1037
                {
1038
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
1039
                    {
1040
                        if (item.GetType().Name == "AdornerFinal")
1041
                        {
1042
                            foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
1043
                            {
1044
                                switch (InnerItem.DrawingData.GetType().Name)
1045
                                {
1046
                                    case ("TextControl"):
1047
                                        {
1048
                                            if((InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextWeight == FontWeights.Bold)
1049
                                            {
1050
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextWeight = FontWeights.Normal;
1051
                                            }
1052
                                            else
1053
                                            {
1054
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextWeight = FontWeights.Bold;
1055
                                            }
1056

    
1057
                                        }
1058
                                        break;
1059
                                    case ("ArrowTextControl"):
1060
                                        {
1061
                                            if ((InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextWeight == FontWeights.Bold)
1062
                                            {
1063
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextWeight = FontWeights.Normal;
1064
                                            }
1065
                                            else
1066
                                            {
1067
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextWeight = FontWeights.Bold;
1068
                                            }
1069
                                        }
1070
                                        break;
1071
                                }
1072
                            }
1073
                        }
1074
                    }
1075
                }
1076
            }
1077
        }
1078

    
1079
        //강인구 추가
1080
        private void btnItalic_Checked(object sender, RoutedEventArgs e)
1081
        {
1082
            if (this.ParentOfType<MainWindow>() != null)
1083
            {
1084
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
1085
                {
1086
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
1087
                    {
1088
                        if (item.GetType().Name == "AdornerFinal")
1089
                        {
1090
                            foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
1091
                            {
1092
                                switch (InnerItem.DrawingData.GetType().Name)
1093
                                {
1094
                                    case ("TextControl"):
1095
                                        {
1096
                                            if((InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextStyle == FontStyles.Italic)
1097
                                            {
1098
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextStyle = System.Windows.FontStyles.Normal;
1099
                                            }
1100
                                            else
1101
                                            {
1102
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextStyle = FontStyles.Italic;
1103
                                            }
1104

    
1105
                                        }
1106
                                        break;
1107
                                    case ("ArrowTextControl"):
1108
                                        {
1109
                                            if((InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextStyle == FontStyles.Italic)
1110
                                            {
1111
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextStyle = FontStyles.Normal;
1112
                                            }
1113
                                            else
1114
                                            {
1115
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextStyle = FontStyles.Italic;
1116
                                            }
1117
                                        }
1118
                                        break;
1119
                                }
1120
                            }
1121
                        }
1122
                    }
1123
                }
1124
            }
1125
        }
1126

    
1127
        //강인구 추가
1128
        private void btnUnderLine_Checked(object sender, RoutedEventArgs e)
1129
        {
1130
            if (this.ParentOfType<MainWindow>() != null)
1131
            {
1132
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
1133
                {
1134
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
1135
                    {
1136
                        if (item.GetType().Name == "AdornerFinal")
1137
                        {
1138
                            foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
1139
                            {
1140
                                switch (InnerItem.DrawingData.GetType().Name)
1141
                                {
1142
                                    case ("TextControl"):
1143
                                        {
1144
                                            if ((InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).UnderLine == TextDecorations.Underline)
1145
                                            {
1146
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).UnderLine = null;
1147
                                            }
1148
                                            else
1149
                                            {
1150
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).UnderLine = TextDecorations.Underline;
1151
                                            }
1152
                                        }
1153
                                        break;
1154
                                    case ("ArrowTextControl"):
1155
                                        {
1156
                                            if ((InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).UnderLine == TextDecorations.Underline)
1157
                                            {
1158
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).UnderLine = null;
1159
                                            }
1160
                                            else
1161
                                            {
1162
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).UnderLine = TextDecorations.Underline;
1163
                                            }
1164
                                        }
1165
                                        break;
1166
                                }
1167
                            }
1168
                        }
1169
                    }
1170
                }
1171
            }
1172
        }
1173

    
1174
        private void comboFontSize_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
1175
        {
1176
            if (string.IsNullOrEmpty(comboFontSize.Value.ToString()))
1177
            {
1178
                comboFontSize.Value = comboFontSize.Minimum;
1179
            }
1180
            if (this.ParentOfType<MainWindow>() != null)
1181
            {
1182
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
1183
                {
1184
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
1185
                    {
1186
                        if (item.GetType().Name == "AdornerFinal")
1187
                        {
1188
                            foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
1189
                            {
1190
                                switch (InnerItem.DrawingData.GetType().Name)
1191
                                {
1192
                                    case ("TextControl"):
1193
                                        {
1194
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextSize = int.Parse(comboFontSize.Value.ToString());
1195
                                        }
1196
                                        break;
1197
                                    case ("ArrowTextControl"):
1198
                                        {
1199
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextSize = int.Parse(comboFontSize.Value.ToString());
1200
                                        }
1201
                                        break;
1202
                                }
1203
                            }
1204

    
1205
                            ChangeComment(item as Controls.AdornerFinal);
1206
                        }
1207
                    }
1208
                }
1209
            }
1210

    
1211
            KCOM.Properties.Settings.Default.TextSize = (double)comboFontSize.Value;
1212
            Properties.Settings.Default.Save();
1213
        }
1214

    
1215
        //강인구 추가
1216
        private void RadRibbonComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
1217
        {
1218
            if (comboFontFamily.SelectedItem != null)
1219
            {
1220
                var font = comboFontFamily.SelectedItem as Markus.Fonts.MarkusFont;
1221

    
1222
                if (this.ParentOfType<MainWindow>()?.dzMainMenu.SelectLayer.Children.Count > 0)
1223
                {
1224
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
1225
                    {
1226
                        if (item.GetType().Name == "AdornerFinal")
1227
                        {
1228
                            var adnoerFinal = (item as Controls.AdornerFinal);
1229

    
1230
                            var adornerMembers = adnoerFinal.Members.Cast<Controls.AdornerMember>();
1231

    
1232
                            foreach (var InnerItem in adornerMembers)
1233
                            {
1234
                                switch (InnerItem.DrawingData.GetType().Name)
1235
                                {
1236
                                    case ("TextControl"):
1237
                                        (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).SetFontFamily(font.FontFamily);
1238
                                        break;
1239
                                    case ("ArrowTextControl"):
1240
                                        (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).SetFontFamily(font.FontFamily);
1241
                                        break;
1242
                                }
1243
                            }
1244

    
1245
                            ChangeComment(adnoerFinal);
1246
                        }
1247
                    }
1248
                }
1249

    
1250
                KCOM.Properties.Settings.Default.FontFamily = font.FontFamily.FontName();
1251
                Properties.Settings.Default.Save();
1252
            }
1253
        }
1254

    
1255

    
1256
        /// <summary>
1257
        /// 텍스트 컨트롤 하일라이트 처리
1258
        /// </summary>
1259
        /// <param name="sender"></param>
1260
        /// <param name="e"></param>
1261
        private void HighlightEvent(object sender, RoutedEventArgs e)
1262
        {
1263

    
1264
            ViewerDataModel.Instance.checkHighShape = (sender as CheckBox).IsChecked.Value;
1265
            SetHighlightEvent();
1266
            //if ((sender as CheckBox).IsChecked.Value)
1267
            //{
1268
            //    TaskMessage("HighLight가 설정되었습니다", TaskMessageType.Normal);
1269
            //}
1270
            //else
1271
            //{
1272
            //    TaskMessage("HighLight가 해제되었습니다", TaskMessageType.Caption);
1273
            //}
1274
            //if (ViewerDataModel.Instance.SelectedEditor as MarkupToPDF.Controls.Text.TextControl != null)
1275
            //{
1276
            //    MarkupToPDF.Controls.Text.TextControl instance = (ViewerDataModel.Instance.SelectedEditor as MarkupToPDF.Controls.Text.TextControl);
1277
            //    instance.IsHighLight = ViewerDataModel.Instance.checkHighShape;
1278
            //    instance.SetText();
1279
            //}
1280
        }
1281

    
1282
        //추가페이지 이동 엔터
1283
        private void tlcurrentPage_KeyDown(object sender, KeyEventArgs e)
1284
        {
1285
            //강인구 추가 tlcurrentPage을 이상하게 입력할수 있기때문에 Try Catch
1286
            if (e.Key == Key.Enter)
1287
            {
1288
                try
1289
                {
1290
                    var instanceMain = this.ParentOfType<MainWindow>();
1291
                    var max = instanceMain.dzMainMenu.pageNavigator._thumbnailItems.Max(f => f.PageNumber);
1292
                    if (string.IsNullOrEmpty(tlcurrentPage.Text))
1293
                    {
1294
                        RadWindow.Alert(new DialogParameters
1295
                        {
1296
                            Owner = Application.Current.MainWindow,
1297
                            Theme = new VisualStudio2013Theme(),
1298
                            Header = "Info",
1299
                            Content = "Enter the correct page number.",
1300
                        });
1301
                    }
1302
                    else
1303
                    {
1304
                        if (Convert.ToInt32(tlcurrentPage.Text) > max || Convert.ToInt32(tlcurrentPage.Text) == 0)
1305
                        {
1306
                            RadWindow.Alert(new DialogParameters
1307
                            {
1308
                                Owner = Application.Current.MainWindow,
1309
                                Theme = new VisualStudio2013Theme(),
1310
                                Header = "Info",
1311
                                Content = "Enter the correct page number.",
1312
                            });
1313
                        }
1314
                        else
1315
                        {
1316
                            instanceMain.dzMainMenu.pageNavigator.GotoPage(Convert.ToInt32(tlcurrentPage.Text));
1317
                        }
1318
                    }
1319
                    
1320
                }
1321
                catch (Exception)
1322
                {
1323
                    RadWindow.Alert(new DialogParameters
1324
                    {
1325
                        Owner = Application.Current.MainWindow,
1326
                        Theme = new VisualStudio2013Theme(),
1327
                        Header = "Info",
1328
                        Content = "Enter the correct page number.",
1329
                    });
1330
                }
1331
                
1332
            }
1333
        }
1334
        private string previousText;
1335
        private void TlcurrentPage_PreviewTextInput(object sender, TextCompositionEventArgs e)
1336
        {
1337
            System.Text.RegularExpressions.Regex regex = new System.Text.RegularExpressions.Regex("[^0-9]+");
1338
            e.Handled = regex.IsMatch(e.Text);
1339
        }
1340
        private void TlcurrentPage_TextChanged(object sender, TextChangedEventArgs e)
1341
        {
1342
            double num = 0;
1343
            bool success = double.TryParse(((TextBox)sender).Text, out num);
1344
            if (success & num >= 0)
1345
                previousText = ((TextBox)sender).Text;
1346
            else
1347
            {
1348
                if (string.IsNullOrEmpty(((TextBox)sender).Text))
1349
                {
1350
                    ((TextBox)sender).Text = "";
1351
                }
1352
                else
1353
                {
1354

    
1355
                    ((TextBox)sender).Text = previousText;
1356
                }
1357
            }
1358
        }
1359

    
1360
        /// <summary>
1361
        /// 입력한 페이지로 이동한다
1362
        /// </summary>
1363
        /// <param name="sender"></param>
1364
        /// <param name="e"></param>
1365
        private void tlcurrentPage_readonly_KeyDown(object sender, KeyEventArgs e)
1366
        {
1367
            if (e.Key == Key.Enter)
1368
            {
1369
                try
1370
                {
1371
                    var instanceMain = this.ParentOfType<MainWindow>();
1372
                    instanceMain.dzMainMenu.pageNavigator.GotoPage(Convert.ToInt32(tlcurrentPage_readonly.Text));
1373
                }
1374
                catch (Exception)
1375
                {
1376
                    RadWindow.Alert(new DialogParameters
1377
                    {
1378
                        Owner = Application.Current.MainWindow,
1379
                        Theme = new VisualStudio2013Theme(),
1380
                        Header = "Info",
1381
                        Content = "Enter the correct page number.",
1382
                    });
1383
                }
1384
            }
1385
        }
1386
        
1387
        private void PanoramaEvent(object sender, RoutedEventArgs e)
1388
        {
1389
            PanoramaShow();
1390
        }
1391

    
1392
        public void PanoramaShow()
1393
        {
1394
            Panorama check = new Panorama();
1395
            double screenWidth = System.Windows.SystemParameters.PrimaryScreenWidth;
1396
            double screenHeight = System.Windows.SystemParameters.PrimaryScreenHeight;
1397
            //double windowWidth = this.Width;
1398
            //double windowHeight = this.Height;
1399

    
1400
            var PanoramaPop = new RadWindow
1401
            {
1402
                //MinWidth = 600,
1403
                //MinHeight = 400,
1404
                //Header = "My Check List",
1405
                Header = "Document No : " + this.ParentOfType<MainWindow>().dzMainMenu._DocItem.DOCUMENT_NO + " / Revision :" + this.ParentOfType<MainWindow>().dzMainMenu._DocItem.REVISION,
1406
                Content = check,
1407
                Owner = this,
1408
                ResizeMode = System.Windows.ResizeMode.CanResizeWithGrip,
1409
                //ResizeMode = System.Windows.ResizeMode.NoResize,
1410
                WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen,
1411
                IsTopmost = false,
1412
                //Left = (screenWidth / 2) - (windowWidth / 2),
1413
                //Top = (screenHeight / 2) - (windowHeight / 2),
1414
                //Left = (screenWidth / 2),
1415
                //Top = (screenHeight / 2),
1416
                Width = screenWidth * 0.4,
1417
                Height = screenHeight * 0.4,
1418
            };
1419
            StyleManager.SetTheme(PanoramaPop, new VisualStudio2013Theme());
1420
            //CheckPop.ShowDialog();
1421
            PanoramaPop.Owner = Application.Current.MainWindow;
1422
            PanoramaPop.Show();
1423
        }
1424

    
1425
        private void CheckEvent(object sender, RoutedEventArgs e)
1426
        {
1427
            //창이 떠있을 경우 재 실행 방지
1428
            if (isClosed)
1429
            {
1430
                //토글 및 마우스 상태 초기화
1431
                var toggleList = this.Parent.ChildrenOfType<RadToggleButton>();
1432
                foreach(var togle in toggleList)
1433
                {
1434
                    togle.IsChecked = false;
1435
                }
1436
                this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
1437

    
1438
                isClosed = false;
1439

    
1440
                
1441
                CheckList check = new CheckList(this.ParentOfType<MainWindow>());
1442

    
1443
                CheckPop = new RadWindow
1444
                {
1445
                    MinWidth = 1200,
1446
                    MinHeight = 500,
1447
                    //Header = "My Check List",
1448
                    Header = "Document No : " + this.ParentOfType<MainWindow>().dzMainMenu._DocItem.DOCUMENT_NO + " / Revision :" + this.ParentOfType<MainWindow>().dzMainMenu._DocItem.REVISION,
1449
                    Content = check,
1450
                    //Owner = this,
1451
                    //ResizeMode = System.Windows.ResizeMode.CanResizeWithGrip,
1452
                    ResizeMode = System.Windows.ResizeMode.NoResize,
1453
                    WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen,
1454
                    IsTopmost = true,
1455
                };
1456
                StyleManager.SetTheme(CheckPop, new Office2013Theme());
1457
                CheckPop.Closed += CheckPop_Closed;
1458
                
1459
                //CheckPop.ShowDialog();
1460
                CheckPop.Show();
1461
            }
1462
        }
1463

    
1464
        private void OptionPop_Closed(object sender, WindowClosedEventArgs e)
1465
        {
1466
            isClosed = true;
1467
            //this.ParentOfType<MainWindow>().dzMainMenu.PN_Navi.IsEnabled = true;
1468
            this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
1469
            ViewerDataModel.Instance.Capture_Opacity = 0;
1470
        }
1471

    
1472
        private void CheckPop_Closed(object sender, WindowClosedEventArgs e)
1473
        {
1474
            isClosed = true;
1475
            //this.ParentOfType<MainWindow>().dzMainMenu.PN_Navi.IsEnabled = true;
1476
            this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
1477
            ViewerDataModel.Instance.Capture_Opacity = 0;
1478
        }
1479

    
1480
        /// <summary>
1481
        /// 사용자가 선택한 페이지로 이동(썸네일 동기화 시킴)
1482
        /// </summary>
1483
        /// <param name="sender"></param>
1484
        /// <param name="e"></param>
1485
        private void PageGoEvent(object sender, RoutedEventArgs e)
1486
        {
1487
            RadButton button = sender as RadButton;
1488
            var instanceMain = this.ParentOfType<MainWindow>();
1489
            
1490
            //강인구 추가 tlcurrentPage을 이상하게 입력할수 있기때문에 Try Catch
1491
            try
1492
            {
1493
                switch (button.CommandParameter.ToString())
1494
                {
1495
                    case "Down":
1496
                        {
1497
                            instanceMain.dzMainMenu.pageNavigator.GotoPage(Convert.ToInt32(tlcurrentPage.Text) + 1);
1498
                        }
1499
                        break;
1500
                    case "Up":
1501
                        {
1502
                            instanceMain.dzMainMenu.pageNavigator.GotoPage(Convert.ToInt32(tlcurrentPage.Text) - 1);
1503
                        }
1504
                        break;
1505
                }
1506
            }
1507
            catch (Exception)
1508
            {
1509
                RadWindow.Alert(new DialogParameters
1510
                {
1511
                    Owner = Application.Current.MainWindow,
1512
                    Theme = new VisualStudio2013Theme(),
1513
                    Header = "Info",
1514
                    Content = "Enter the correct page number.",
1515
                });
1516
            }
1517
        }
1518

    
1519
        private void viewEvent(object sender, RoutedEventArgs e)
1520
        {
1521
            RadRibbonToggleButton viewButton = sender as RadRibbonToggleButton;
1522
            var instanceMain = this.ParentOfType<MainWindow>();
1523

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

    
1526
            //if ((sender as RadRibbonToggleButton) != null)
1527
            //{
1528
            //    Common.ViewerDataModel.Instance.ControlTag = (sender as RadRibbonToggleButton).Tag.ToString();
1529
            //    instanceToggle = (sender as RadRibbonToggleButton);
1530
            //}
1531

    
1532
            //instanceToggle.IsChecked = false;
1533

    
1534
            switch (viewButton.CommandParameter.ToString())
1535
            {
1536
                case "zoomout":
1537
                    {
1538
                        //장원
1539
                        //instanceMain.dzMainMenu.zoomAndPanControl.ZoomTo(new Rect(0, 0, instanceMain.dzMainMenu.zoomAndPanCanvas.ActualWidth, instanceMain.dzMainMenu.zoomAndPanCanvas.ActualHeight));
1540
                        instanceMain.dzMainMenu.zoomAndPanControl.ZoomPointToViewportCenter(ViewerDataModel.Instance.ContentScale -= 0.1, point);
1541
                        viewButton.IsChecked = false;
1542
                        //Common.ViewerDataModel.Instance.zom
1543
                    }
1544
                    break;
1545
                case "zoomin":
1546
                    {
1547
                        instanceMain.dzMainMenu.zoomAndPanControl.ZoomPointToViewportCenter(ViewerDataModel.Instance.ContentScale += 0.1, point);
1548
                        viewButton.IsChecked = false;
1549
                    }
1550
                    break;
1551
                case "fullscreen":
1552
                    {
1553
                        instanceMain.WindowState = WindowState.Maximized;
1554
                        //Sizemode 대기(강인구)
1555
                        //instanceMain.dzMainMenu.imageViewer.SizeMode = Leadtools.Windows.Controls.SizeMode.Fit;
1556
                        instanceMain.dzMainMenu.zoomAndPanControl.ScaleToFit();
1557
                        viewButton.IsChecked = false;
1558
                    }
1559
                    break;
1560
                case "fitWidth":
1561
                    {
1562
                        instanceMain.dzMainMenu.zoomAndPanControl.ScaleToFit();
1563
                        viewButton.IsChecked = false;
1564
                    }
1565
                    break;
1566
                case "fitHeight":
1567
                    {
1568
                        instanceMain.dzMainMenu.zoomAndPanControl.ScaleToFit();
1569
                        viewButton.IsChecked = false;
1570
                    }
1571
                    break;
1572
                case "boundzoom":
1573
                    {
1574

    
1575
                    }
1576
                    break;
1577
                case "Rotate_M":
1578
                    {
1579
                        drawingPannelRotate(false);
1580
                        viewButton.IsChecked = false;
1581
                    }
1582
                    break;
1583
                case "Rotate_P":
1584
                    {
1585
                        drawingPannelRotate(true);
1586
                        viewButton.IsChecked = false;
1587
                    }
1588
                    break;
1589
                case "Rotate_half":
1590
                    {
1591
                        drawingPannelRotate(true);
1592
                        drawingPannelRotate(true);
1593
                        viewButton.IsChecked = false;
1594
                    }
1595
                    break;
1596
            }
1597
        }
1598

    
1599
        private void Control_Event(object sender, RoutedEventArgs e)
1600
        {
1601

    
1602
        }
1603

    
1604
        #region 대기
1605

    
1606
        public void drawingPannelRotate(bool Flag)
1607
        {
1608
            var instanceMain = this.ParentOfType<MainWindow>();
1609

    
1610
            //if (rotateOffSet > 3)
1611
            //    rotateOffSet = 0;
1612

    
1613
            //if (rotateOffSet < 0)
1614
            //    rotateOffSet = 3;
1615

    
1616
            if(Flag)
1617
            {
1618
                if (instanceMain.dzMainMenu.rotate.Angle == 270)
1619
                {
1620
                    instanceMain.dzMainMenu.rotate.Angle = 0;
1621
                }
1622
                else
1623
                {
1624
                    instanceMain.dzMainMenu.rotate.Angle += 90;
1625
                }
1626
            }
1627
            else
1628
            {
1629
                if(instanceMain.dzMainMenu.rotate.Angle == 0)
1630
                {
1631
                    instanceMain.dzMainMenu.rotate.Angle = 270;
1632
                }
1633
                else
1634
                {
1635
                    instanceMain.dzMainMenu.rotate.Angle -= 90;
1636
                }
1637
            }
1638
            //double angle = (double)rotateValue.GetValue(rotateOffSet);
1639
            //instanceMain.dzMainMenu.rotate.Angle = angle;
1640
            var rotationNum = Math.Abs((instanceMain.dzMainMenu.rotate.Angle / 90));
1641

    
1642
            if (instanceMain.dzMainMenu.zoomAndPanCanvas.Width == ViewerDataModel.Instance.ContentWidth)
1643
            {
1644
                double emptySize = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
1645
                instanceMain.dzMainMenu.zoomAndPanCanvas.Width = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
1646
                instanceMain.dzMainMenu.zoomAndPanCanvas.Height = emptySize;
1647
            }
1648
            if (instanceMain.dzMainMenu.rotate.Angle == 0)
1649
            {
1650
                instanceMain.dzMainMenu.translate.X = 0;
1651
                instanceMain.dzMainMenu.translate.Y = 0;
1652
            }
1653
            else if (instanceMain.dzMainMenu.rotate.Angle == 90)
1654
            {
1655
                instanceMain.dzMainMenu.translate.X = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
1656
                instanceMain.dzMainMenu.translate.Y = 0;
1657
            }
1658
            else if (instanceMain.dzMainMenu.rotate.Angle == 180)
1659
            {
1660
                instanceMain.dzMainMenu.translate.X = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
1661
                instanceMain.dzMainMenu.translate.Y = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
1662
            }
1663
            else
1664
            {
1665
                instanceMain.dzMainMenu.translate.X = 0;
1666
                instanceMain.dzMainMenu.translate.Y = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
1667
            }
1668

    
1669
            //instanceMain.dzMainMenu.zoomAndPanControl.RenderTransformOrigin = new Point(0.5, 0.5);
1670
            instanceMain.dzMainMenu.zoomAndPanControl.RotationAngle = instanceMain.dzMainMenu.rotate.Angle;
1671
            //대기(강인구)
1672
            //instanceMain.dzMainMenu.imageViewer.RotateAngle = instanceMain.dzMainMenu.rotate.Angle;
1673

    
1674

    
1675
            //instanceMain.dzMainMenu.imageViewer.RenderTransformOrigin = new Point(0.5, 0.5);
1676
            //RotateTransform rotateTransform = new RotateTransform(instanceMain.dzMainMenu.rotate.Angle);
1677
            //instanceMain.dzMainMenu.imageViewer.RenderTransform = rotateTransform;
1678

    
1679

    
1680
            ViewerDataModel.Instance.ContentWidth = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
1681
            ViewerDataModel.Instance.ContentHeight = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
1682
            ViewerDataModel.Instance.AngleOffsetX = instanceMain.dzMainMenu.translate.X;
1683
            ViewerDataModel.Instance.AngleOffsetY = instanceMain.dzMainMenu.translate.Y;
1684
            ViewerDataModel.Instance.PageAngle = instanceMain.dzMainMenu.rotate.Angle;
1685
            //ViewerDataModel.Instance.Document_Info.Clear();
1686
            //ViewerDataModel.Instance.Document_Info.Where(i => i.PAGE_NUMBER == instanceMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber).ToList().ForEach(value =>
1687
            //{
1688
            //    value.PAGE_ANGLE = int.Parse(instanceMain.dzMainMenu.rotate.Angle.ToString());
1689
            //});
1690

    
1691

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

    
1695
            foreach (var data in thumbnaillist)
1696
            {
1697
                data.Angle = int.Parse(instanceMain.dzMainMenu.rotate.Angle.ToString());
1698

    
1699
                //instanceMain.dzMainMenu.pageNavigator.ImgListbox.ItemsSource = instanceMain.dzMainMenu.pageNavigator._thumbnailItems;
1700
                var instance = instanceMain.dzMainMenu.CurrentDoc.docInfo.DOCPAGE.Where(p => p.PAGE_NUMBER == instanceMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber).FirstOrDefault();
1701
                instance.PAGE_ANGLE = int.Parse(instanceMain.dzMainMenu.rotate.Angle.ToString());
1702

    
1703
                instanceMain.dzMainMenu.pageNavigator.GotoPage(data.PageNumber);
1704

    
1705
                //rotation page add or update
1706
                var rotationdoc = ViewerDataModel.Instance.RotationDocs.Where(d => d.ID == instance.ID).FirstOrDefault();
1707
                if (rotationdoc != null)
1708
                {
1709
                    rotationdoc.PAGE_ANGLE = instance.PAGE_ANGLE;
1710
                }
1711
                else
1712
                {
1713
                    ViewerDataModel.Instance.RotationDocs.Add(instance);
1714
                }
1715
            }
1716
        }
1717
        #endregion
1718

    
1719
        private void ImageConverter(RadToggleButton instanceToggle)
1720
        {
1721
            try
1722
            {           
1723
                var instanceMain = this.ParentOfType<MainWindow>();
1724

    
1725
                Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
1726
                dlg.Filter = "All files (*.*)|*.*|PNG Images (*.png)|*.png";
1727
                Nullable<bool> result = dlg.ShowDialog();
1728
                if (result == true)
1729
                {
1730
                    instanceMain.dzMainMenu.filename = dlg.FileName;
1731
                    instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ImgControl;
1732

    
1733
                    System.IO.FileInfo fileInfo = new System.IO.FileInfo(instanceMain.dzMainMenu.filename);
1734
                    String strFile = System.IO.Path.GetFileName(instanceMain.dzMainMenu.filename);
1735
                    long numByte = fileInfo.Length;
1736
                    double dLen = Convert.ToDouble(fileInfo.Length / 1000000);
1737
                    kr.co.devdoftech.cloud.FileUpload fileUploader = App.FileUploader;
1738
             
1739
                    if (dLen < 4)
1740
                    {
1741
                        System.IO.FileStream fStream = new System.IO.FileStream(instanceMain.dzMainMenu.filename, System.IO.FileMode.Open, System.IO.FileAccess.Read);
1742
                        System.IO.BinaryReader br = new System.IO.BinaryReader(fStream);
1743
                        byte[] data = br.ReadBytes((int)numByte);
1744
                        br.Close();
1745

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

    
1748
                        Check_Uri.UriCheck(filepath);
1749

    
1750
                        instanceMain.dzMainMenu.filename = filepath;
1751

    
1752
                        fStream.Close();
1753
                        fStream.Dispose();
1754
                    }
1755
                    else
1756
                    {
1757
                        this.ParentOfType<MainWindow>().DialogMessage_Alert("Available Memory less than 4 mega byte", "Alert");
1758
                    }
1759
                }
1760
                else
1761
                {
1762
                    instanceToggle.IsChecked = false;
1763
                    Common.ViewerDataModel.Instance.SelectedControl = "";
1764
                    Common.ViewerDataModel.Instance.ControlTag = null;
1765
                    this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
1766
                    this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
1767
                    this.ParentOfType<MainWindow>().DialogMessage_Alert("No Image selected.", "Alert");
1768
                }
1769
            }
1770
            catch(Exception ex)
1771
            {
1772
                instanceToggle.IsChecked = false;
1773
                Common.ViewerDataModel.Instance.SelectedControl = "";
1774
                Common.ViewerDataModel.Instance.ControlTag = null;
1775
                this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
1776
                this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
1777
                App.FileLogger.Error("Image Converter ",ex);
1778

    
1779
                this.ParentOfType<MainWindow>().DialogMessage_Alert("System Error" , "Alert");
1780
            }
1781
        }
1782

    
1783
        private void Control_Init(RadToggleButton instanceToggle, object sender)
1784
        {
1785

    
1786
        }
1787

    
1788
        private void ControlEvent(object sender, RoutedEventArgs e)
1789
        {
1790
            RadToggleButton instanceToggle = sender as RadToggleButton;
1791
            var instanceMain = this.ParentOfType<MainWindow>();
1792

    
1793
            #region Ctrl + A 눌렀을 때 대처 방법 
1794
            //원인 : Ctrl + A를 누르면 UIElementSet에 등록을 시키지 않는다(이유는 한꺼번에 많은 양의 컨트롤의 동작이 유입되기 때문에
1795
            //       시스템의 성능저하를 불러올 수 있기 때문이다. 그래서 선택 후 다른 컨트롤을 누르면 등록되지 않은 컨트롤이기 때문에 삭제된다
1796
            //       이를 대처하는 방법으로 아래 코드를 사용한다.
1797
            if (Common.ViewerDataModel.Instance.MarkupControls.Count == 0 && Common.ViewerDataModel.Instance.MarkupControls.Count >= 1)
1798
            {
1799
                //var lstItem = instanceMain.DeepLayer._SelectLayer.ChildrenOfType<AdornerFinal>().ToList();
1800
                //foreach (var item in lstItem)
1801
                //{
1802
                //    foreach (var member in item.MemberSet)
1803
                //    {
1804
                //        if (!instanceMain.DeepLayer.UIElementSet.Contains(member.DrawingData))
1805
                //        {
1806
                //            instanceMain.DeepLayer.UIElementSet.Add(member.DrawingData);
1807
                //        }
1808
                //    }
1809
                //}
1810
            }
1811
            #endregion
1812

    
1813
            //if (!instanceMain.IsFreeSelectionMode)
1814
            //{
1815
            //    instanceMain.IsSwingMode = true;
1816
            //}
1817

    
1818
            //#region 다른 컨트롤 버튼 선택 해제
1819
            //System.Reactive.Linq.Observable2.FromPropertyChangedPattern(Common.ViewerDataModel.Instance, temp => temp.SelectedControl).Subscribe(ControlState =>
1820
            //{
1821
            //    if (ControlState == null)
1822
            //    {
1823
            //        instanceToggle.IsChecked = false;
1824
            //        HiddenControlHide();
1825
            //    }
1826
            //});
1827
            //#endregion
1828

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

    
1831
            if (instanceToggle != null)
1832
            {
1833
                Common.ViewerDataModel.Instance.ControlTag = instanceToggle.Tag.ToString();
1834
            }
1835
            else if ((sender as RadRibbonToggleButton) != null)
1836
            {
1837
                Common.ViewerDataModel.Instance.ControlTag = (sender as RadRibbonToggleButton).Tag.ToString();
1838
                instanceToggle = (sender as RadRibbonToggleButton);
1839
            }
1840
            else if ((sender as RadRibbonButton) != null)
1841
            {
1842
                RadRibbonButton instanceButton = sender as RadRibbonButton;
1843
                Common.ViewerDataModel.Instance.ControlTag = instanceButton.Tag.ToString();
1844
            }
1845
            else
1846
            {
1847
                RadButton instanceButton = sender as RadButton;
1848
                Common.ViewerDataModel.Instance.ControlTag = instanceButton.Tag.ToString();
1849
            }
1850

    
1851

    
1852
            //System.Reactive.Linq.Observable2.FromPropertyChangedPattern(Common.ViewerDataModel.Instance, temp => temp.AngleVisibility).Subscribe(isSee =>
1853
            //{
1854
            //    if (instanceToggle.CommandParameter.ToString() == "ChainLine")
1855
            //    {
1856

    
1857
            //    }
1858
            //    else
1859
            //    {
1860
            //        System.Diagnostics.Debug.WriteLine(" instanceMain.dzMainMenu.MainAngle.Visibility   " + isSee);
1861

    
1862
            //        if (instanceMain.dzMainMenu.MainAngle.Visibility != isSee)
1863
            //        {
1864
            //            instanceMain.dzMainMenu.MainAngle.Visibility = isSee;
1865
            //        }
1866
            //    }
1867
            //    //System.Reactive.Linq.Observable2.FromPropertyChangedPattern(Common.ViewerDataModel.Instance, temp => temp.AngleValue).Subscribe(p =>
1868
            //    //{
1869
            //    //    instanceMain.dzMainMenu.MainAngle.AngleValue = p;
1870
            //    //});
1871
            //});
1872

    
1873
            instanceMain.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Drawing;
1874

    
1875
            instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = false;
1876

    
1877
            if (instanceToggle.IsChecked != false)
1878
            {
1879
                string param = instanceToggle.CommandParameter.ToString();
1880
                string MacroIndex = "";
1881

    
1882
                if (param.StartsWith("MACRO"))
1883
                {
1884
                    param = "MACRO";
1885
                    MacroIndex = param.Replace("MACRO;","");
1886

    
1887
                    //Common.ViewerDataModel.Instance.MacroItems = MacroHelper.LoadMacroItems(MacroIndex);
1888
                    //var items = MacroHelper.TopMenuItems();
1889

    
1890
                    Common.ViewerDataModel.Instance.MacroItems = new List<MacroItem>
1891
                    {
1892
                        new MacroItem
1893
                        {
1894
                            Desc = "Cloud Rectangle",
1895
                            ControlType = MarkupToPDF.Controls.Common.ControlType.RectCloud
1896
                        },
1897
                        new MacroItem
1898
                        {
1899
                             Desc = "Arrow TextBox",
1900
                            ControlType = MarkupToPDF.Controls.Common.ControlType.ArrowTextBorderControl
1901
                        }
1902
                    };
1903
                }
1904

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

    
2128
                        //instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = true;
2129

    
2130
                        Common.ViewerDataModel.Instance.SelectedControl = "Ink";
2131
                        Common.ViewerDataModel.Instance.LineSize = (double)cbLineSize.Value;
2132
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.PenControl;
2133
                        break;
2134
                    #endregion
2135
                    #region Select
2136
                    case "Select":
2137
                        if(this.ParentOfType<MainWindow>().dzMainMenu.currentControl != null)
2138
                        {
2139
                            ViewerDataModel.Instance.MarkupControls_USER.Remove(this.ParentOfType<MainWindow>().dzMainMenu.currentControl);
2140
                            this.ParentOfType<MainWindow>().dzMainMenu.currentControl = null;
2141
                        }
2142
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Selecting;
2143
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2144
                        instanceMain.dzMainMenu.isLeftMouseButtonDownOnWindow = false;
2145
                        break;
2146
                    #endregion
2147
                    #region Image
2148
                    case "Image":
2149
                        Common.ViewerDataModel.Instance.SelectedControl = "ImgControl";
2150
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ImgControl;
2151
                        ImageConverter(instanceToggle);
2152
                        break;
2153
                    #endregion
2154
                    #region Sign
2155
                    case "Sign":
2156
                        Common.ViewerDataModel.Instance.SelectedControl = "Sign";
2157
                        Common.ViewerDataModel.Instance.ControlTag = instanceMain.dzMainMenu._ViewInfo.UserID; //사번
2158
                        //강인구 추가
2159
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Sign;
2160
                        //instanceMain.BaseClient.GetUserSignCompleted += (sen, ea) =>
2161
                        //{
2162
                        //    if (ea.Result == null)
2163
                        //    {
2164

    
2165
                        //        this.ParentOfType<MainPage>().DialogMessage_Alert("You Don't Have Sign Data", "Alert");
2166
                        //    }
2167
                        //    else
2168
                        //    {
2169
                        //        byte[] imageBytes = System.Convert.FromBase64String(ea.Result);
2170
                        //        using (MemoryStream ms = new MemoryStream(imageBytes))
2171
                        //        {
2172
                        //            BitmapImage im = new BitmapImage();
2173
                        //            im.SetSource(ms);
2174
                        //            instanceMain.DeepLayer.SignImage = im;
2175
                        //            ms.Close();
2176
                        //        }
2177
                        //    }
2178
                        //};
2179
                        //instanceMain.BaseClient.GetUserSignAsync(instanceMain._ViewInfo.UserID);
2180
                        break;
2181
                    #endregion
2182
                    #region Check
2183
                    case "Check":
2184
                        Common.ViewerDataModel.Instance.SelectedControl = "Check";
2185
                        Common.ViewerDataModel.Instance.ControlTag = instanceMain.dzMainMenu._ViewInfo.UserID; //사번
2186
                        //강인구 추가
2187
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Symbol;
2188
                        break;
2189
                    #endregion
2190
                    #region Batch
2191
                    case "Batch":
2192
                        Common.ViewerDataModel.Instance.SelectedControl = "Batch";
2193
                        Common.ViewerDataModel.Instance.ControlTag = instanceMain.dzMainMenu._ViewInfo.UserID; //사번
2194
                        //강인구 추가
2195
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Mark;
2196
                        instanceMain.dzMainMenu.txtBatch.Visibility = Visibility.Visible;
2197
                        instanceMain.dzMainMenu.txtBatch.Text = "Place Mark";
2198
                        break;
2199
                    #endregion
2200

    
2201
                    #region MACRO -MACRO1
2202
                    case "MACRO":
2203
                        Common.ViewerDataModel.Instance.SelectedControl = "MACRO";
2204
                        Common.ViewerDataModel.Instance.ControlTag = instanceMain.dzMainMenu._ViewInfo.UserID; //사번
2205

    
2206
                        MacroHelper.MacroAction();
2207

    
2208
                        break;
2209
                    #endregion
2210

    
2211
                    #region Copy
2212
                    case "Copy":
2213
                        Copy_Start();
2214
                        instanceToggle.IsChecked = false;
2215
                        ViewerDataModel.Instance.SelectedControl = "";
2216
                        ViewerDataModel.Instance.ControlTag = null;
2217
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2218
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2219
                        break;
2220
                    #endregion
2221
                    #region Cut
2222
                    case "Cut":
2223
                        //Cut_Start();
2224
                        CutCommand.Instance.Execute();
2225
                        instanceToggle.IsChecked = false;
2226
                        ViewerDataModel.Instance.SelectedControl = "";
2227
                        ViewerDataModel.Instance.ControlTag = null;
2228
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2229
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2230
                        break;
2231
                    #endregion
2232
                    #region Paste
2233
                    case "Paste":
2234
                        Paste_Start();
2235
                        instanceToggle.IsChecked = false;
2236
                        ViewerDataModel.Instance.SelectedControl = "";
2237
                        ViewerDataModel.Instance.ControlTag = null;
2238
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2239
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;                        
2240
                        break;
2241
                    #endregion
2242
                    #region Delete
2243
                    case "Delete":
2244
                        DeleteCommand.Instance.Execute(SelectionSet.Instance.SelectedItems);
2245
                        this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Clear();
2246

    
2247
                        instanceToggle.IsChecked = false;
2248
                        ViewerDataModel.Instance.SelectedControl = "";
2249
                        ViewerDataModel.Instance.ControlTag = null;
2250
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2251
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2252
                        break;
2253
                    #endregion
2254
                    #region Undo
2255
                    case "Undo":
2256
                        UndoCommand.Instance.Execute();
2257
                        instanceToggle.IsChecked = false;
2258
                        ViewerDataModel.Instance.SelectedControl = "";
2259
                        ViewerDataModel.Instance.ControlTag = null;
2260
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2261
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2262
                        break;
2263
                    #endregion
2264
                    #region Redo
2265
                    case "Redo":
2266
                        RedoCommand.Instance.Execute();
2267
                        instanceToggle.IsChecked = false;
2268
                        ViewerDataModel.Instance.SelectedControl = "";
2269
                        ViewerDataModel.Instance.ControlTag = null;
2270
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2271
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2272
                        break;
2273
                    #endregion
2274
                    #region DragZoom
2275
                    case "DragZoom":
2276
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.DragZoom;
2277
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2278
                        instanceMain.dzMainMenu.isLeftMouseButtonDownOnWindow = false;
2279
                        break;
2280
                    #endregion
2281
                    #region Grouping
2282
                    case "Group":
2283
                        //var GrouptoggleList = this.Parent.ChildrenOfType<RadRibbonToggleButton>();
2284
                        //foreach (var togle in GrouptoggleList)
2285
                        //{
2286
                        //    togle.IsChecked = false;
2287
                        //}
2288

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

    
2349
                        //if (ViewerDataModel.Instance.SystemMain.dzMainMenu.SelectLayer.Children.Count < 1) //선택된 것이 없으면
2350
                        //{
2351
                        //    this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert("Please Select Controls", "Alert");
2352
                        //}
2353
                        //else//if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
2354
                        //{
2355
                        //    // string MarkupData = "";
2356
                        //    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
2357
                        //    {
2358
                        //        if (item.GetType().Name == "AdornerFinal" && (item as AdornerFinal).MemberSet.Count >= 1) // 1개 이상 
2359
                        //        {
2360
                        //            //MARKUP_DATA UPDATE
2361
                        //            foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
2362
                        //            {
2363
                        //                if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
2364
                        //                {
2365
                        //                    long group_id = ViewerDataModel.Instance.MyMarkupList.Where(d => d.ID == (InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo).CommentID).FirstOrDefault().Group_ID;
2366
                        //                    //MARKUP_DATA UPDATE
2367
                        //                    //Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.UpdateMarkupData((InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo).CommentID, 0, App.ViewInfo.ProjectNO);
2368
                        //                    ////Logger.sendReqLog("UpdateMarkupData: ", "", 1);
2369
                        //                    ViewerDataModel.Instance.MyMarkupList.Where(d => d.ID == (InnerItem.DrawingData as CommentUserInfo).CommentID).FirstOrDefault().Group_ID = 0;
2370
                        //                    ViewerDataModel.Instance.MyMarkupList.Where(d => d.ID == (InnerItem.DrawingData as CommentUserInfo).CommentID).FirstOrDefault().IsUpdate = true;
2371

    
2372

    
2373
                        //                    //MARKUP_DATA_GROUP UPDATE
2374
                        //                    //bool value = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.UpdateMarkupDataGroup(group_id, App.ViewInfo.ProjectNO);
2375
                        //                    ////Logger.sendReqLog("AddMarkupDataGroup: ", value.ToString(), 1);
2376
                        //                }
2377
                        //            }
2378
                        //        }
2379
                        //    }
2380
                        //}
2381
                        break;
2382
                    #endregion
2383
                    #region Capture
2384
                    case "Capture":
2385
                        SyncInit();
2386
                        //   instanceToggle.IsChecked = false;
2387
                        var CaptureList = this.Parent.ChildrenOfType<RadRibbonToggleButton>();
2388
                        foreach (var togle in CaptureList)
2389
                        {
2390
                            togle.IsChecked = false;
2391
                        }
2392

    
2393
                        if (this.ParentOfType<MainWindow>().dzMainMenu.currentControl != null)
2394
                        {
2395
                            ViewerDataModel.Instance.MarkupControls_USER.Remove(this.ParentOfType<MainWindow>().dzMainMenu.currentControl);
2396
                            this.ParentOfType<MainWindow>().dzMainMenu.currentControl = null;
2397
                        }
2398

    
2399
                        ViewerDataModel.Instance.SelectedControl = "ImgControl";
2400
                   //     ViewerDataModel.Instance.ControlTag = null;
2401
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ImgControl;
2402

    
2403
                        /*
2404
                        //캡쳐 하기 전에 코멘트 저장
2405
                        if (Common.ViewerDataModel.Instance.MarkupControls_USER.Count > 0 || (Application.Current.MainWindow as MainWindow).dzMainMenu.SelectLayer.Children.Count > 0)
2406
                        {
2407
                            var menu = (Application.Current.MainWindow as MainWindow).dzMainMenu;
2408
                            menu.ReleaseAdorner();
2409
                            if (menu.PreviewUserMarkupInfoItem != null && menu.PreviewUserMarkupInfoItem.IsPreviewUser == true)
2410
                            {
2411
                                (Application.Current.MainWindow as MainWindow).dzTopMenu.RefactoryCommentReact(menu);
2412
                            }
2413
                            else if (menu.gridViewMarkup.SelectedItems.Count == 0 || (menu.gridViewMarkup.SelectedItems.FirstOrDefault() as IKCOM.MarkupInfoItem).UserID != App.ViewInfo.UserID)
2414
                            {
2415

    
2416
                            }
2417
                            else
2418
                            {
2419
                                (Application.Current.MainWindow as MainWindow).dzTopMenu.RefactoryCommentReact(menu);
2420
                            }
2421
                        }*/
2422

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

    
2461
                        //    isClosed = false;
2462
                        //    //Control 파일 먼저 생성
2463
                        //    CollapsedButton_Click();
2464
                        //    CadViewer check = new CadViewer();
2465
                        //    check.WindowStartupLocation = WindowStartupLocation.CenterScreen;
2466
                        //    check.Title = "Export Viewer";
2467
                        //    //check.Topmost = true;
2468
                        //    check.Show();
2469
                        //    check.Closed += Check_Closed;
2470
                        //    instanceToggle.IsChecked = false;
2471
                        //}
2472
                        //break;
2473
                    case "CadViewer":
2474
                        //if (isClosed)
2475
                        //{
2476
                        //    //토글 및 마우스 상태 초기화
2477
                        //    var toggleList = this.Parent.ChildrenOfType<RadRibbonToggleButton>();
2478
                        //    foreach (var togle in toggleList)
2479
                        //    {
2480
                        //        togle.IsChecked = false;
2481
                        //    }
2482
                        //    this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2483

    
2484
                        //    isClosed = false;
2485
                        //    CadResultViewer check = new CadResultViewer();
2486
                        //    check.WindowStartupLocation = WindowStartupLocation.CenterScreen;
2487
                        //    check.Title = "Viewer";
2488
                        //    check.Show();
2489

    
2490
                        //    check.Closed += Check_Closed;
2491

    
2492
                        //}
2493
                        break;
2494
                    #endregion
2495
                    default:
2496
                        break;
2497
                }
2498
                #endregion
2499
            }
2500
            else
2501
            {
2502
                if (Common.ViewerDataModel.Instance.IsMacroCommand)
2503
                {
2504
                    MacroHelper.Clear();
2505
                }
2506

    
2507
                if (!instanceMain.dzMainMenu.IsFreeSelectionMode)
2508
                {
2509
                    instanceMain.dzMainMenu.IsSwingMode = false;
2510
                    Common.ViewerDataModel.Instance.SelectedControl = "";
2511
                    Common.ViewerDataModel.Instance.ControlTag = null;
2512
                    this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2513
                    this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2514
                }
2515
            }
2516

    
2517
        }
2518

    
2519
        private void SyncInit()
2520
        {
2521
            try
2522
            {
2523
                if (!ViewerDataModel.Instance.SystemMain.dzMainMenu.testPanel2.IsHidden)
2524
                {
2525
                    ViewerDataModel.Instance.SystemMain.dzMainMenu.testPanel2.IsHidden = true;
2526
                    ViewerDataModel.Instance.PageBalanceMode = false;
2527
                    ViewerDataModel.Instance.PageBalanceNumber = 0;
2528
                    ViewerDataModel.Instance.SyncPageNumber = 0;
2529
                    ViewerDataModel.Instance.MarkupControls_Sync.Clear();
2530
                    ViewerDataModel.Instance.SystemMain.dzMainMenu.gridViewRevMarkup.Visibility = Visibility.Collapsed;
2531
                    ViewerDataModel.Instance.SystemMain.dzMainMenu.UserList.IsChecked = false;
2532
                    ViewerDataModel.Instance.SystemMain.dzMainMenu.BalanceMode.IsChecked = false;
2533
                }
2534
            }
2535
            catch (Exception ex)
2536
            {
2537
                //Logger.sendResLog("SyncInit", ex.Message, 0);
2538
            }
2539

    
2540
        }
2541

    
2542
        Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
2543
        CommentUserInfo currentControl { get; set; }
2544
        private void Check_Closed(object sender, EventArgs e)
2545
        {
2546
            isClosed = true;
2547
            //this.ParentOfType<MainWindow>().dzMainMenu.PN_Navi.IsEnabled = true;
2548
            //토글 및 마우스 상태 초기화
2549
            var toggleList = this.Parent.ChildrenOfType<RadToggleButton>();
2550
            foreach (var togle in toggleList)
2551
            {
2552
                togle.IsChecked = false;
2553
            }
2554
            this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2555
            ViewerDataModel.Instance.Capture_Opacity = 0;
2556

    
2557
        }
2558

    
2559
        /* public class test 
2560
         {
2561
             public double width { get; set; }
2562
             public double height { get; set; }
2563
         }
2564
         */
2565
        private async void CollapsedButton_Click()
2566
        {
2567
            this.ParentOfType<MainWindow>().dzTopMenu._SaveEvent(null, null); // 저장하지 못한 데이터가 있다면 저장
2568

    
2569
            string[] data = new string[0];
2570

    
2571
            int cnt = 0;
2572
            var menu = this.ParentOfType<MainWindow>().dzMainMenu;
2573

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

    
2576
            foreach (var item in gridSelectionItem)
2577
            {
2578
                if ((item.UserID == App.ViewInfo.UserID) && (ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.CurrentPage != null))
2579
                {
2580
                    var instance = ViewerDataModel.Instance.MyMarkupList.Where(d => d.PageNumber == ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber &&
2581
                    d.MarkupInfoID == item.MarkupInfoID).ToList();
2582
                    data = new string[instance.Count];
2583
                    foreach (var markup in instance)
2584
                    {
2585
                        data[cnt++] = await MarkupToPDF.Serialize.Core.JsonSerializerHelper.UnCompressStringAsync(markup.Data,ViewerDataModel.Instance.CancellationToken());
2586
                    }
2587
                }
2588
            }
2589

    
2590
            if (data != null && KCOM.Properties.Settings.Default.cad == 1)
2591
            {
2592
                string FilePath = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\Cad");
2593
                string FileName = FilePath + "\\commentstring.json"; // Default file name
2594
                if (!File.Exists(FilePath))
2595
                {
2596
                    Directory.CreateDirectory(FilePath);
2597
                }
2598

    
2599
                if (!string.IsNullOrEmpty(FileName))
2600
                {
2601
                    //  File.WriteAllText(SaveDig.FileName, data);
2602
                    File.WriteAllLines(FileName, data);
2603
                }
2604
            }
2605
        }
2606

    
2607
        private double minHeight;
2608
        private double minWidth;
2609

    
2610
        private double maxHeight;
2611
        private double maxWidth;
2612

    
2613
        public bool CanVResize { get; private set; }
2614
        public bool CanHResize { get; private set; }
2615

    
2616
        public void DesignerComponent(FrameworkElement content)
2617
        {
2618
            this.InitializeComponent();
2619

    
2620
            if (!double.IsNaN(content.Width))
2621
            {
2622
                CanHResize = false;
2623
                this.Width = content.Width;
2624
            }
2625
            else
2626
            {
2627
                CanHResize = true;
2628
                this.Width = 23.0;
2629
            }
2630
            if (!double.IsNaN(content.Height))
2631
            {
2632
                CanVResize = false;
2633
                this.Height = content.Height; ;
2634
            }
2635
            else
2636
            {
2637
                CanVResize = true;
2638
                this.Height = 23.0;
2639
            }
2640

    
2641
            minWidth = content.MinWidth < 10.0 ? 10.0 : content.MinWidth;
2642
            minHeight = content.MinHeight < 10.0 ? 10.0 : content.MinHeight;
2643
            maxWidth = content.MaxWidth;
2644
            maxHeight = content.MaxHeight;
2645

    
2646
            double top = (double)content.GetValue(Canvas.TopProperty);
2647
            if (double.IsNaN(top))
2648
                top = 0.0;
2649
            double left = (double)content.GetValue(Canvas.LeftProperty);
2650
            if (double.IsNaN(left))
2651
                left = 0.0;
2652
            SetValue(Canvas.TopProperty, top);
2653
            SetValue(Canvas.LeftProperty, left);
2654

    
2655
            //Set the actual content. Note that "Content" property is a new property. See below
2656
            this.Content = content;
2657
        }
2658
        private void Thumb_DragDelta(object sender, DragDeltaEventArgs e)
2659
        {
2660
            string name = ((Thumb)sender).Name;
2661
            if (name.Contains("Top"))
2662
            {
2663
                double newHeight = this.Height - e.VerticalChange;
2664
                if (newHeight >= minHeight && newHeight <= maxHeight)
2665
                {
2666
                    this.Height = newHeight;
2667
                    SetValue(Canvas.TopProperty,
2668
                (double)GetValue(Canvas.TopProperty) + e.VerticalChange);
2669
                }
2670
            }
2671
            if (name.Contains("Right"))
2672
            {
2673
                double newWidth = this.Width + e.HorizontalChange;
2674
                if (newWidth >= minWidth && newWidth <= maxWidth)
2675
                    this.Width = newWidth;
2676
            }
2677
            if (name.Contains("Bottom"))
2678
            {
2679
                double newHeight = this.Height + e.VerticalChange;
2680
                if (newHeight >= minHeight && newHeight <= maxHeight)
2681
                    this.Height = newHeight;
2682
            }
2683
            if (name.Contains("Left"))
2684
            {
2685
                double newWidth = this.Width - e.HorizontalChange;
2686
                if (newWidth >= minWidth && newWidth <= maxWidth)
2687
                {
2688
                    this.Width = newWidth;
2689
                    SetValue(Canvas.LeftProperty,
2690
                (double)GetValue(Canvas.LeftProperty) + e.HorizontalChange);
2691
                }
2692
            }
2693
        }
2694

    
2695
        private void drawControlBorder(object sender)
2696
        {
2697
            System.Windows.Controls.Control control = (System.Windows.Controls.Control)sender;
2698
        }
2699

    
2700
        private void ResizeThumb_DragDelta(object sender, MouseButtonEventArgs e)
2701
        {
2702
            System.Windows.Controls.Control designerItem = (System.Windows.Controls.Control)sender;
2703
            if (designerItem != null)
2704
            {
2705
                double deltaVertical, deltaHorizontal;
2706

    
2707
                switch (VerticalAlignment)
2708
                {
2709
                    case VerticalAlignment.Bottom:
2710
                        deltaVertical = designerItem.ActualHeight - designerItem.MinHeight;
2711
                        designerItem.Height -= deltaVertical;
2712
                        break;
2713
                    case VerticalAlignment.Top:
2714
                        deltaVertical = designerItem.ActualHeight - designerItem.MinHeight;
2715
                        Canvas.SetTop(designerItem, Canvas.GetTop(designerItem) + deltaVertical);
2716
                        designerItem.Height -= deltaVertical;
2717
                        break;
2718
                    default:
2719
                        break;
2720
                }
2721

    
2722
                switch (HorizontalAlignment)
2723
                {
2724
                    case HorizontalAlignment.Left:
2725
                        deltaHorizontal = designerItem.ActualWidth - designerItem.MinWidth;
2726
                        Canvas.SetLeft(designerItem, Canvas.GetLeft(designerItem) + deltaHorizontal);
2727
                        designerItem.Width -= deltaHorizontal;
2728
                        break;
2729
                    case HorizontalAlignment.Right:
2730
                        deltaHorizontal = designerItem.ActualWidth - designerItem.MinWidth;
2731
                        designerItem.Width -= deltaHorizontal;
2732
                        break;
2733
                    default:
2734
                        break;
2735
                }
2736
            }
2737
            e.Handled = true;
2738
        }
2739

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

    
2742
        void ExportMethod()
2743
        {
2744
            //FileDialogFilter filterImage = new FileDialogFilter("Image Files", "*.jpg", "*.png");
2745
            SaveDig.Filter = "PDF file format|*.pdf";
2746
            SaveDig.Title = "Save an DWG File";
2747
            SaveDig.ShowDialog();
2748
        }
2749

    
2750
        private void cbAutoSave_Checked(object sender, RoutedEventArgs e)
2751
        {            
2752
            if (cbAutoSave.IsChecked == true)
2753
            {
2754
                SaveTime(true, (int)cbSaveInterval.Value);
2755
            }
2756
            else
2757
            {
2758
                SaveTime(false, (int)cbSaveInterval.Value);
2759
            }
2760
        }
2761
        private void cbSaveInterval_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
2762
        {
2763
            if(string.IsNullOrEmpty(cbSaveInterval.Value.ToString()))
2764
            {
2765
                cbSaveInterval.Value = cbSaveInterval.Minimum;
2766
            }
2767
            if (cbAutoSave.IsChecked == true)
2768
            {
2769
                SaveTime(true, (int)cbSaveInterval.Value);
2770
            }
2771

    
2772
            KCOM.Properties.Settings.Default.SaveInterval = (double)cbSaveInterval.Value;
2773
            Properties.Settings.Default.Save();
2774
        }
2775
        //강인구 자동 저장 추가
2776
        private void AutoSave(object sender, RoutedEventArgs e)
2777
        {
2778
            RadToggleButton instanceToggle = sender as RadToggleButton;
2779

    
2780
            if(instanceToggle.IsChecked == true)
2781
            {
2782
                SaveTime(true);
2783
            }
2784
            else
2785
            {
2786
                SaveTime(false);
2787
            }
2788
        }
2789

    
2790
        public void Copy_Start()
2791
        {
2792
            if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
2793
            {
2794
                string MarkupData = "";
2795

    
2796
                foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
2797
                {
2798
                    if (item.GetType().Name == "AdornerFinal")
2799
                    {
2800
                        foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
2801

    
2802
                        {
2803
                            if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
2804
                            {
2805
                                MarkupToPDF.Controls.Parsing.MarkupParser.MarkupReturn res = MarkupParser.MarkupToString(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo, App.ViewInfo.UserID);
2806
                                MarkupData += "|OR|" + res.ConvertData;
2807
                            }
2808
                        }
2809
                        Clipboard.SetDataObject(MarkupData);
2810
                    }
2811
                }
2812
            }
2813
        }
2814

    
2815
        public void Cut_Start()
2816
        {
2817
            if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
2818
            {
2819
                foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
2820
                {
2821
                    string MarkupData = "";
2822

    
2823
                    if (item.GetType().Name == "AdornerFinal")
2824
                    {
2825
                        foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
2826
                        {
2827
                            if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
2828
                            {
2829
                                MarkupToPDF.Controls.Parsing.MarkupParser.MarkupReturn res = MarkupParser.MarkupToString(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo, App.ViewInfo.UserID);
2830
                                MarkupData += "|OR|" + res.ConvertData;
2831
                            }
2832
                        }
2833
                        //클립보드에 넣음
2834
                        Clipboard.SetDataObject(MarkupData);
2835
                    }
2836
                }
2837
                this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Clear();
2838
            }
2839
        }
2840

    
2841
        public async void Paste_Start()
2842
        {
2843
            //마크업 붙여넣기
2844
            if (Clipboard.GetText().Contains("|OR||DZ|"))
2845
            {
2846
                List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>();
2847

    
2848
                string[] delimiterChars = { "|OR|" };
2849
                string[] data = Clipboard.GetText().Split(delimiterChars, StringSplitOptions.RemoveEmptyEntries);
2850

    
2851
                SelectionSet.Instance.UnSelect(this.ParentOfType<MainWindow>().dzMainMenu);
2852

    
2853
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
2854

    
2855
                //강인구 Undo/Redo 보류
2856
                MarkupToPDF.Common.Undo_data UndoData = new Undo_data()
2857
                {
2858
                    IsUndo = false,
2859
                    Event = Event_Type.Create,
2860
                    EventTime = DateTime.Now,
2861
                    Markup_List = new List<Multi_Undo_data>()
2862
                };
2863

    
2864
                ViewerDataModel.Instance.UndoDataList.Where(data1 => data1.IsUndo == true).ToList().ForEach(i =>
2865
                {
2866
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
2867
                });
2868

    
2869
                foreach (string parse in data)
2870
                {
2871
                    if (parse != "")
2872
                    {
2873
                        System.Windows.Controls.Control item = await MarkupParser.ParseExAsync(App.BaseAddress,ViewerDataModel.Instance.CancellationToken(),App.ViewInfo.ProjectNO, parse, ViewerDataModel.Instance.MarkupControls_USER, ViewerDataModel.Instance.PageAngle, string.Empty, string.Empty);
2874
                        (item as MarkupToPDF.Common.CommentUserInfo).CommentID = Commons.shortGuid();
2875

    
2876
                        ViewerDataModel.Instance.MarkupControls.Remove(item as MarkupToPDF.Common.CommentUserInfo);
2877
                        ViewerDataModel.Instance.MarkupControls_USER.Remove(item as MarkupToPDF.Common.CommentUserInfo);
2878

    
2879
                        adornerSet.Add(item as MarkupToPDF.Common.CommentUserInfo);
2880

    
2881
                        multi_Undo_Data = this.ParentOfType<MainWindow>().dzMainMenu.Control_Style(item as MarkupToPDF.Common.CommentUserInfo);
2882

    
2883
                        UndoData.Markup_List.Add(multi_Undo_Data);
2884
                        ViewerDataModel.Instance.UndoDataList.Add(UndoData);                        
2885
                    }
2886
                }
2887
                Controls.AdornerFinal final = new Controls.AdornerFinal(adornerSet);
2888

    
2889
                if(this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.X < 0)
2890
                {
2891
                    Canvas.SetLeft(final, 0);
2892
                    Canvas.SetTop(final, 0);
2893
                }
2894
                else
2895
                {
2896
                    double realPointX = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.X - final.BorderSize.X - (final.BorderSize.Width / 2);
2897
                    double realPointY = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.Y - final.BorderSize.Y - (final.BorderSize.Height / 2);
2898
                    final.TranslateItems(realPointX, realPointY);
2899

    
2900
                    if (final.Members.Where(type => type.Drawingtype == MarkupToPDF.Controls.Common.ControlType.TextControl).FirstOrDefault() != null)
2901
                    {
2902
                        final.TranslateItems(0.001, 0.001); //dummy
2903
                    }
2904
                }
2905

    
2906
                this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Add(final);
2907
            }
2908
            //외부 이미지 붙여넣기
2909
            else if (Clipboard.GetImage() != null)
2910
            {
2911
                try
2912
                {
2913
                    Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
2914

    
2915
                    //강인구 Undo/Redo 보류
2916
                    MarkupToPDF.Common.Undo_data UndoData = new Undo_data()
2917
                    {
2918
                        IsUndo = false,
2919
                        Event = Event_Type.Create,
2920
                        EventTime = DateTime.Now,
2921
                        Markup_List = new List<Multi_Undo_data>()
2922
                    };
2923

    
2924

    
2925
                    string temppath = System.IO.Path.GetTempPath();
2926
                    //string filename = KCOM.Events.Save.shortCommentKey();
2927
                    string filename = Commons.shortFileKey();
2928

    
2929
                    System.Drawing.Image clipboardImage = System.Windows.Forms.Clipboard.GetImage();
2930
                    clipboardImage.Save(temppath + "\\" + filename);
2931

    
2932
                    System.IO.FileInfo fileInfo = new System.IO.FileInfo(temppath + "\\" + filename);
2933
                    String strFile = System.IO.Path.GetFileName(fileInfo.FullName);
2934
                    long numByte = fileInfo.Length;
2935
                    double dLen = Convert.ToDouble(fileInfo.Length / 1000000);
2936
                    kr.co.devdoftech.cloud.FileUpload fileUploader = App.FileUploader;
2937

    
2938
                    if (dLen < 4)
2939
                    {
2940
                        System.IO.FileStream fStream = new System.IO.FileStream(fileInfo.FullName,
2941
                        System.IO.FileMode.Open, System.IO.FileAccess.Read);
2942
                        System.IO.BinaryReader br = new System.IO.BinaryReader(fStream);
2943
                        byte[] data = br.ReadBytes((int)numByte);
2944

    
2945
                        filename = fileUploader.Run(App.ViewInfo.ProjectNO, this.ParentOfType<MainWindow>().dzMainMenu._DocItem.DOCUMENT_NO, App.ViewInfo.UserID, strFile + ".png", data);
2946
                        Check_Uri.UriCheck(filename);
2947
                        br.Close();
2948
                        fStream.Close();
2949
                        fStream.Dispose();
2950
                    }
2951
                    else
2952
                    {
2953
                        this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert("Available Memory less than 4 mega byte", "Alert");
2954
                        return;
2955
                    }
2956

    
2957
                    fileInfo.Delete();
2958

    
2959
                    System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(clipboardImage);
2960
                    IntPtr hBitmap = bmp.GetHbitmap();
2961
                    System.Windows.Media.ImageSource WpfBitmap = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(hBitmap, IntPtr.Zero, Int32Rect.Empty, System.Windows.Media.Imaging.BitmapSizeOptions.FromEmptyOptions());
2962
                    Image img = new Image();
2963
                    if (filename.Contains(".svg"))
2964
                    {
2965
                        byte[] imageData = null;
2966
                        DrawingImage image = null;
2967
                        using (System.Net.WebClient web = new System.Net.WebClient())
2968
                        {
2969
                            imageData = web.DownloadData(new Uri(filename));
2970
                            System.IO.Stream stream = new System.IO.MemoryStream(imageData);
2971
                            image = SvgReader.Load(stream);
2972
                        }
2973
                        img.Source = image;
2974
                    }
2975
                    else
2976
                    {
2977
                        img.Source = new BitmapImage(new Uri(filename));
2978
                    }
2979

    
2980
                    var currentControl = new MarkupToPDF.Controls.Etc.ImgControl
2981
                    {
2982
                        PointSet = new List<Point>(),
2983
                        FilePath = filename,
2984
                        ImageData = img.Source,
2985
                        StartPoint = new Point(100, 100),
2986
                        EndPoint = new Point(200, 200),
2987
                        TopRightPoint = new Point(100, 200),
2988
                        LeftBottomPoint = new Point(200, 100)
2989
                    };
2990

    
2991
                    currentControl.TopRightPoint = new Point(currentControl.StartPoint.X + clipboardImage.Width, currentControl.StartPoint.Y);
2992
                    currentControl.LeftBottomPoint = new Point(currentControl.StartPoint.X, currentControl.StartPoint.Y + clipboardImage.Height);
2993
                    currentControl.EndPoint = new Point(currentControl.StartPoint.X + clipboardImage.Width, currentControl.StartPoint.Y + clipboardImage.Height);
2994

    
2995
                    currentControl.PointSet = new List<Point>
2996
                                        {
2997
                                            currentControl.StartPoint,
2998
                                            currentControl.LeftBottomPoint,
2999
                                            currentControl.EndPoint,
3000
                                            currentControl.TopRightPoint,
3001
                                        };
3002

    
3003
                    multi_Undo_Data = this.ParentOfType<MainWindow>().dzMainMenu.Control_Style(currentControl as MarkupToPDF.Common.CommentUserInfo);
3004
                    UndoData.Markup_List.Add(multi_Undo_Data);
3005
                    ViewerDataModel.Instance.UndoDataList.Add(UndoData);
3006

    
3007
                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl as MarkupToPDF.Common.CommentUserInfo);
3008
                    currentControl.CommentID = Commons.shortGuid();
3009

    
3010
                    currentControl.ApplyTemplate();
3011
                    currentControl.SetImage();
3012

    
3013
                    ViewerDataModel.Instance.MarkupControls_USER.Remove(currentControl as MarkupToPDF.Common.CommentUserInfo);
3014
                    Controls.AdornerFinal final = new Controls.AdornerFinal(currentControl as MarkupToPDF.Common.CommentUserInfo);
3015
                    this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Add(final);
3016

    
3017
                    double realPointX = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.X - final.BorderSize.X - (final.BorderSize.Width / 2);
3018
                    double realPointY = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.Y - final.BorderSize.Y - (final.BorderSize.Height / 2);
3019
                    final.TranslateItems(realPointX, realPointY);
3020
                }
3021
                catch(Exception ex)
3022
                {
3023
                    this.ParentOfType<MainWindow>().DialogMessage_Alert("" + ex, "Alert");
3024
                }
3025
            }
3026
        }
3027
    }
3028
}
클립보드 이미지 추가 (최대 크기: 500 MB)