프로젝트

일반

사용자정보

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

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

이력 | 보기 | 이력해설 | 다운로드 (148 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 SignManagerEvent(object sender,RoutedEventArgs e)
1465
        {
1466
            SignManager signManager = new SignManager();
1467

    
1468
            CheckPop = new RadWindow
1469
            {
1470
                MinWidth = 1200,
1471
                MinHeight = 500,
1472
                //Header = "My Check List",
1473
                Header = "",
1474
                Content = signManager,
1475
                Owner = this,
1476
                //ResizeMode = System.Windows.ResizeMode.CanResizeWithGrip,
1477
                ResizeMode = System.Windows.ResizeMode.CanResize,
1478
                WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen,
1479
                IsTopmost = true,
1480
            };
1481
            StyleManager.SetTheme(CheckPop, new Office2013Theme());
1482
            CheckPop.Closed += CheckPop_Closed;
1483

    
1484
            //CheckPop.ShowDialog();
1485
            CheckPop.Show();
1486
        }
1487

    
1488
        private void OptionPop_Closed(object sender, WindowClosedEventArgs e)
1489
        {
1490
            isClosed = true;
1491
            //this.ParentOfType<MainWindow>().dzMainMenu.PN_Navi.IsEnabled = true;
1492
            this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
1493
            ViewerDataModel.Instance.Capture_Opacity = 0;
1494
        }
1495

    
1496
        private void CheckPop_Closed(object sender, WindowClosedEventArgs e)
1497
        {
1498
            isClosed = true;
1499
            //this.ParentOfType<MainWindow>().dzMainMenu.PN_Navi.IsEnabled = true;
1500
            this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
1501
            ViewerDataModel.Instance.Capture_Opacity = 0;
1502
        }
1503

    
1504
        /// <summary>
1505
        /// 사용자가 선택한 페이지로 이동(썸네일 동기화 시킴)
1506
        /// </summary>
1507
        /// <param name="sender"></param>
1508
        /// <param name="e"></param>
1509
        private void PageGoEvent(object sender, RoutedEventArgs e)
1510
        {
1511
            RadButton button = sender as RadButton;
1512
            var instanceMain = this.ParentOfType<MainWindow>();
1513
            
1514
            //강인구 추가 tlcurrentPage을 이상하게 입력할수 있기때문에 Try Catch
1515
            try
1516
            {
1517
                switch (button.CommandParameter.ToString())
1518
                {
1519
                    case "Down":
1520
                        {
1521
                            instanceMain.dzMainMenu.pageNavigator.GotoPage(Convert.ToInt32(tlcurrentPage.Text) + 1);
1522
                        }
1523
                        break;
1524
                    case "Up":
1525
                        {
1526
                            instanceMain.dzMainMenu.pageNavigator.GotoPage(Convert.ToInt32(tlcurrentPage.Text) - 1);
1527
                        }
1528
                        break;
1529
                }
1530
            }
1531
            catch (Exception)
1532
            {
1533
                RadWindow.Alert(new DialogParameters
1534
                {
1535
                    Owner = Application.Current.MainWindow,
1536
                    Theme = new VisualStudio2013Theme(),
1537
                    Header = "Info",
1538
                    Content = "Enter the correct page number.",
1539
                });
1540
            }
1541
        }
1542

    
1543
        private void viewEvent(object sender, RoutedEventArgs e)
1544
        {
1545
            RadRibbonToggleButton viewButton = sender as RadRibbonToggleButton;
1546
            var instanceMain = this.ParentOfType<MainWindow>();
1547

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

    
1550
            //if ((sender as RadRibbonToggleButton) != null)
1551
            //{
1552
            //    Common.ViewerDataModel.Instance.ControlTag = (sender as RadRibbonToggleButton).Tag.ToString();
1553
            //    instanceToggle = (sender as RadRibbonToggleButton);
1554
            //}
1555

    
1556
            //instanceToggle.IsChecked = false;
1557

    
1558
            switch (viewButton.CommandParameter.ToString())
1559
            {
1560
                case "zoomout":
1561
                    {
1562
                        //장원
1563
                        //instanceMain.dzMainMenu.zoomAndPanControl.ZoomTo(new Rect(0, 0, instanceMain.dzMainMenu.zoomAndPanCanvas.ActualWidth, instanceMain.dzMainMenu.zoomAndPanCanvas.ActualHeight));
1564
                        instanceMain.dzMainMenu.zoomAndPanControl.ZoomPointToViewportCenter(ViewerDataModel.Instance.ContentScale -= 0.1, point);
1565
                        viewButton.IsChecked = false;
1566
                        //Common.ViewerDataModel.Instance.zom
1567
                    }
1568
                    break;
1569
                case "zoomin":
1570
                    {
1571
                        instanceMain.dzMainMenu.zoomAndPanControl.ZoomPointToViewportCenter(ViewerDataModel.Instance.ContentScale += 0.1, point);
1572
                        viewButton.IsChecked = false;
1573
                    }
1574
                    break;
1575
                case "fullscreen":
1576
                    {
1577
                        instanceMain.WindowState = WindowState.Maximized;
1578
                        //Sizemode 대기(강인구)
1579
                        //instanceMain.dzMainMenu.imageViewer.SizeMode = Leadtools.Windows.Controls.SizeMode.Fit;
1580
                        instanceMain.dzMainMenu.zoomAndPanControl.ScaleToFit();
1581
                        viewButton.IsChecked = false;
1582
                    }
1583
                    break;
1584
                case "fitWidth":
1585
                    {
1586
                        instanceMain.dzMainMenu.zoomAndPanControl.ScaleToFit();
1587
                        viewButton.IsChecked = false;
1588
                    }
1589
                    break;
1590
                case "fitHeight":
1591
                    {
1592
                        instanceMain.dzMainMenu.zoomAndPanControl.ScaleToFit();
1593
                        viewButton.IsChecked = false;
1594
                    }
1595
                    break;
1596
                case "boundzoom":
1597
                    {
1598

    
1599
                    }
1600
                    break;
1601
                case "Rotate_M":
1602
                    {
1603
                        drawingPannelRotate(false);
1604
                        viewButton.IsChecked = false;
1605
                    }
1606
                    break;
1607
                case "Rotate_P":
1608
                    {
1609
                        drawingPannelRotate(true);
1610
                        viewButton.IsChecked = false;
1611
                    }
1612
                    break;
1613
                case "Rotate_half":
1614
                    {
1615
                        drawingPannelRotate(true);
1616
                        drawingPannelRotate(true);
1617
                        viewButton.IsChecked = false;
1618
                    }
1619
                    break;
1620
            }
1621
        }
1622

    
1623
        private void Control_Event(object sender, RoutedEventArgs e)
1624
        {
1625

    
1626
        }
1627

    
1628
        #region 대기
1629

    
1630
        public void drawingPannelRotate(bool Flag)
1631
        {
1632
            var instanceMain = this.ParentOfType<MainWindow>();
1633

    
1634
            //if (rotateOffSet > 3)
1635
            //    rotateOffSet = 0;
1636

    
1637
            //if (rotateOffSet < 0)
1638
            //    rotateOffSet = 3;
1639

    
1640
            if(Flag)
1641
            {
1642
                if (instanceMain.dzMainMenu.rotate.Angle == 270)
1643
                {
1644
                    instanceMain.dzMainMenu.rotate.Angle = 0;
1645
                }
1646
                else
1647
                {
1648
                    instanceMain.dzMainMenu.rotate.Angle += 90;
1649
                }
1650
            }
1651
            else
1652
            {
1653
                if(instanceMain.dzMainMenu.rotate.Angle == 0)
1654
                {
1655
                    instanceMain.dzMainMenu.rotate.Angle = 270;
1656
                }
1657
                else
1658
                {
1659
                    instanceMain.dzMainMenu.rotate.Angle -= 90;
1660
                }
1661
            }
1662
            //double angle = (double)rotateValue.GetValue(rotateOffSet);
1663
            //instanceMain.dzMainMenu.rotate.Angle = angle;
1664
            var rotationNum = Math.Abs((instanceMain.dzMainMenu.rotate.Angle / 90));
1665

    
1666
            if (instanceMain.dzMainMenu.zoomAndPanCanvas.Width == ViewerDataModel.Instance.ContentWidth)
1667
            {
1668
                double emptySize = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
1669
                instanceMain.dzMainMenu.zoomAndPanCanvas.Width = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
1670
                instanceMain.dzMainMenu.zoomAndPanCanvas.Height = emptySize;
1671
            }
1672
            if (instanceMain.dzMainMenu.rotate.Angle == 0)
1673
            {
1674
                instanceMain.dzMainMenu.translate.X = 0;
1675
                instanceMain.dzMainMenu.translate.Y = 0;
1676
            }
1677
            else if (instanceMain.dzMainMenu.rotate.Angle == 90)
1678
            {
1679
                instanceMain.dzMainMenu.translate.X = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
1680
                instanceMain.dzMainMenu.translate.Y = 0;
1681
            }
1682
            else if (instanceMain.dzMainMenu.rotate.Angle == 180)
1683
            {
1684
                instanceMain.dzMainMenu.translate.X = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
1685
                instanceMain.dzMainMenu.translate.Y = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
1686
            }
1687
            else
1688
            {
1689
                instanceMain.dzMainMenu.translate.X = 0;
1690
                instanceMain.dzMainMenu.translate.Y = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
1691
            }
1692

    
1693
            //instanceMain.dzMainMenu.zoomAndPanControl.RenderTransformOrigin = new Point(0.5, 0.5);
1694
            instanceMain.dzMainMenu.zoomAndPanControl.RotationAngle = instanceMain.dzMainMenu.rotate.Angle;
1695
            //대기(강인구)
1696
            //instanceMain.dzMainMenu.imageViewer.RotateAngle = instanceMain.dzMainMenu.rotate.Angle;
1697

    
1698

    
1699
            //instanceMain.dzMainMenu.imageViewer.RenderTransformOrigin = new Point(0.5, 0.5);
1700
            //RotateTransform rotateTransform = new RotateTransform(instanceMain.dzMainMenu.rotate.Angle);
1701
            //instanceMain.dzMainMenu.imageViewer.RenderTransform = rotateTransform;
1702

    
1703

    
1704
            ViewerDataModel.Instance.ContentWidth = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
1705
            ViewerDataModel.Instance.ContentHeight = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
1706
            ViewerDataModel.Instance.AngleOffsetX = instanceMain.dzMainMenu.translate.X;
1707
            ViewerDataModel.Instance.AngleOffsetY = instanceMain.dzMainMenu.translate.Y;
1708
            ViewerDataModel.Instance.PageAngle = instanceMain.dzMainMenu.rotate.Angle;
1709
            //ViewerDataModel.Instance.Document_Info.Clear();
1710
            //ViewerDataModel.Instance.Document_Info.Where(i => i.PAGE_NUMBER == instanceMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber).ToList().ForEach(value =>
1711
            //{
1712
            //    value.PAGE_ANGLE = int.Parse(instanceMain.dzMainMenu.rotate.Angle.ToString());
1713
            //});
1714

    
1715

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

    
1719
            foreach (var data in thumbnaillist)
1720
            {
1721
                data.Angle = int.Parse(instanceMain.dzMainMenu.rotate.Angle.ToString());
1722

    
1723
                //instanceMain.dzMainMenu.pageNavigator.ImgListbox.ItemsSource = instanceMain.dzMainMenu.pageNavigator._thumbnailItems;
1724
                var instance = instanceMain.dzMainMenu.CurrentDoc.docInfo.DOCPAGE.Where(p => p.PAGE_NUMBER == instanceMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber).FirstOrDefault();
1725
                instance.PAGE_ANGLE = int.Parse(instanceMain.dzMainMenu.rotate.Angle.ToString());
1726

    
1727
                instanceMain.dzMainMenu.pageNavigator.GotoPage(data.PageNumber);
1728

    
1729
                //rotation page add or update
1730
                var rotationdoc = ViewerDataModel.Instance.RotationDocs.Where(d => d.ID == instance.ID).FirstOrDefault();
1731
                if (rotationdoc != null)
1732
                {
1733
                    rotationdoc.PAGE_ANGLE = instance.PAGE_ANGLE;
1734
                }
1735
                else
1736
                {
1737
                    ViewerDataModel.Instance.RotationDocs.Add(instance);
1738
                }
1739
            }
1740
        }
1741
        #endregion
1742

    
1743
        private void ImageConverter(RadToggleButton instanceToggle)
1744
        {
1745
            try
1746
            {           
1747
                var instanceMain = this.ParentOfType<MainWindow>();
1748

    
1749
                Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
1750
                dlg.Filter = "All files (*.*)|*.*|PNG Images (*.png)|*.png";
1751
                Nullable<bool> result = dlg.ShowDialog();
1752
                if (result == true)
1753
                {
1754
                    instanceMain.dzMainMenu.filename = dlg.FileName;
1755
                    instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ImgControl;
1756

    
1757
                    System.IO.FileInfo fileInfo = new System.IO.FileInfo(instanceMain.dzMainMenu.filename);
1758
                    String strFile = System.IO.Path.GetFileName(instanceMain.dzMainMenu.filename);
1759
                    long numByte = fileInfo.Length;
1760
                    double dLen = Convert.ToDouble(fileInfo.Length / 1000000);
1761
                    kr.co.devdoftech.cloud.FileUpload fileUploader = App.FileUploader;
1762
             
1763
                    if (dLen < 4)
1764
                    {
1765
                        System.IO.FileStream fStream = new System.IO.FileStream(instanceMain.dzMainMenu.filename, System.IO.FileMode.Open, System.IO.FileAccess.Read);
1766
                        System.IO.BinaryReader br = new System.IO.BinaryReader(fStream);
1767
                        byte[] data = br.ReadBytes((int)numByte);
1768
                        br.Close();
1769

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

    
1772
                        Check_Uri.UriCheck(filepath);
1773

    
1774
                        instanceMain.dzMainMenu.filename = filepath;
1775

    
1776
                        fStream.Close();
1777
                        fStream.Dispose();
1778
                    }
1779
                    else
1780
                    {
1781
                        this.ParentOfType<MainWindow>().DialogMessage_Alert("Available Memory less than 4 mega byte", "Alert");
1782
                    }
1783
                }
1784
                else
1785
                {
1786
                    instanceToggle.IsChecked = false;
1787
                    Common.ViewerDataModel.Instance.SelectedControl = "";
1788
                    Common.ViewerDataModel.Instance.ControlTag = null;
1789
                    this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
1790
                    this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
1791
                    this.ParentOfType<MainWindow>().DialogMessage_Alert("No Image selected.", "Alert");
1792
                }
1793
            }
1794
            catch(Exception ex)
1795
            {
1796
                instanceToggle.IsChecked = false;
1797
                Common.ViewerDataModel.Instance.SelectedControl = "";
1798
                Common.ViewerDataModel.Instance.ControlTag = null;
1799
                this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
1800
                this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
1801
                App.FileLogger.Error("Image Converter ",ex);
1802

    
1803
                this.ParentOfType<MainWindow>().DialogMessage_Alert("System Error" , "Alert");
1804
            }
1805
        }
1806

    
1807
        private void Control_Init(RadToggleButton instanceToggle, object sender)
1808
        {
1809

    
1810
        }
1811

    
1812
        private void ControlEvent(object sender, RoutedEventArgs e)
1813
        {
1814
            RadToggleButton instanceToggle = sender as RadToggleButton;
1815
            var instanceMain = this.ParentOfType<MainWindow>();
1816

    
1817
            #region Ctrl + A 눌렀을 때 대처 방법 
1818
            //원인 : Ctrl + A를 누르면 UIElementSet에 등록을 시키지 않는다(이유는 한꺼번에 많은 양의 컨트롤의 동작이 유입되기 때문에
1819
            //       시스템의 성능저하를 불러올 수 있기 때문이다. 그래서 선택 후 다른 컨트롤을 누르면 등록되지 않은 컨트롤이기 때문에 삭제된다
1820
            //       이를 대처하는 방법으로 아래 코드를 사용한다.
1821
            if (Common.ViewerDataModel.Instance.MarkupControls.Count == 0 && Common.ViewerDataModel.Instance.MarkupControls.Count >= 1)
1822
            {
1823
                //var lstItem = instanceMain.DeepLayer._SelectLayer.ChildrenOfType<AdornerFinal>().ToList();
1824
                //foreach (var item in lstItem)
1825
                //{
1826
                //    foreach (var member in item.MemberSet)
1827
                //    {
1828
                //        if (!instanceMain.DeepLayer.UIElementSet.Contains(member.DrawingData))
1829
                //        {
1830
                //            instanceMain.DeepLayer.UIElementSet.Add(member.DrawingData);
1831
                //        }
1832
                //    }
1833
                //}
1834
            }
1835
            #endregion
1836

    
1837
            //if (!instanceMain.IsFreeSelectionMode)
1838
            //{
1839
            //    instanceMain.IsSwingMode = true;
1840
            //}
1841

    
1842
            //#region 다른 컨트롤 버튼 선택 해제
1843
            //System.Reactive.Linq.Observable2.FromPropertyChangedPattern(Common.ViewerDataModel.Instance, temp => temp.SelectedControl).Subscribe(ControlState =>
1844
            //{
1845
            //    if (ControlState == null)
1846
            //    {
1847
            //        instanceToggle.IsChecked = false;
1848
            //        HiddenControlHide();
1849
            //    }
1850
            //});
1851
            //#endregion
1852

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

    
1855
            if (instanceToggle != null)
1856
            {
1857
                Common.ViewerDataModel.Instance.ControlTag = instanceToggle.Tag.ToString();
1858
            }
1859
            else if ((sender as RadRibbonToggleButton) != null)
1860
            {
1861
                Common.ViewerDataModel.Instance.ControlTag = (sender as RadRibbonToggleButton).Tag.ToString();
1862
                instanceToggle = (sender as RadRibbonToggleButton);
1863
            }
1864
            else if ((sender as RadRibbonButton) != null)
1865
            {
1866
                RadRibbonButton instanceButton = sender as RadRibbonButton;
1867
                Common.ViewerDataModel.Instance.ControlTag = instanceButton.Tag.ToString();
1868
            }
1869
            else
1870
            {
1871
                RadButton instanceButton = sender as RadButton;
1872
                Common.ViewerDataModel.Instance.ControlTag = instanceButton.Tag.ToString();
1873
            }
1874

    
1875

    
1876
            //System.Reactive.Linq.Observable2.FromPropertyChangedPattern(Common.ViewerDataModel.Instance, temp => temp.AngleVisibility).Subscribe(isSee =>
1877
            //{
1878
            //    if (instanceToggle.CommandParameter.ToString() == "ChainLine")
1879
            //    {
1880

    
1881
            //    }
1882
            //    else
1883
            //    {
1884
            //        System.Diagnostics.Debug.WriteLine(" instanceMain.dzMainMenu.MainAngle.Visibility   " + isSee);
1885

    
1886
            //        if (instanceMain.dzMainMenu.MainAngle.Visibility != isSee)
1887
            //        {
1888
            //            instanceMain.dzMainMenu.MainAngle.Visibility = isSee;
1889
            //        }
1890
            //    }
1891
            //    //System.Reactive.Linq.Observable2.FromPropertyChangedPattern(Common.ViewerDataModel.Instance, temp => temp.AngleValue).Subscribe(p =>
1892
            //    //{
1893
            //    //    instanceMain.dzMainMenu.MainAngle.AngleValue = p;
1894
            //    //});
1895
            //});
1896

    
1897
            instanceMain.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Drawing;
1898

    
1899
            instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = false;
1900

    
1901
            if (instanceToggle.IsChecked != false)
1902
            {
1903
                string param = instanceToggle.CommandParameter.ToString();
1904
                string MacroIndex = "";
1905

    
1906
                if (param.StartsWith("MACRO"))
1907
                {
1908
                    param = "MACRO";
1909
                    MacroIndex = param.Replace("MACRO;","");
1910

    
1911
                    //Common.ViewerDataModel.Instance.MacroItems = MacroHelper.LoadMacroItems(MacroIndex);
1912
                    //var items = MacroHelper.TopMenuItems();
1913

    
1914
                    Common.ViewerDataModel.Instance.MacroItems = new List<MacroItem>
1915
                    {
1916
                        new MacroItem
1917
                        {
1918
                            Desc = "Cloud Rectangle",
1919
                            ControlType = MarkupToPDF.Controls.Common.ControlType.RectCloud
1920
                        },
1921
                        new MacroItem
1922
                        {
1923
                             Desc = "Arrow TextBox",
1924
                            ControlType = MarkupToPDF.Controls.Common.ControlType.ArrowTextBorderControl
1925
                        }
1926
                    };
1927
                }
1928

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

    
2152
                        //instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = true;
2153

    
2154
                        Common.ViewerDataModel.Instance.SelectedControl = "Ink";
2155
                        Common.ViewerDataModel.Instance.LineSize = (double)cbLineSize.Value;
2156
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.PenControl;
2157
                        break;
2158
                    #endregion
2159
                    #region Select
2160
                    case "Select":
2161
                        if(this.ParentOfType<MainWindow>().dzMainMenu.currentControl != null)
2162
                        {
2163
                            ViewerDataModel.Instance.MarkupControls_USER.Remove(this.ParentOfType<MainWindow>().dzMainMenu.currentControl);
2164
                            this.ParentOfType<MainWindow>().dzMainMenu.currentControl = null;
2165
                        }
2166
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Selecting;
2167
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2168
                        instanceMain.dzMainMenu.isLeftMouseButtonDownOnWindow = false;
2169
                        break;
2170
                    #endregion
2171
                    #region Image
2172
                    case "Image":
2173
                        Common.ViewerDataModel.Instance.SelectedControl = "ImgControl";
2174
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ImgControl;
2175
                        ImageConverter(instanceToggle);
2176
                        break;
2177
                    #endregion
2178
                    #region Sign
2179
                    case "Sign":
2180
                        Common.ViewerDataModel.Instance.SelectedControl = "Sign";
2181
                        Common.ViewerDataModel.Instance.ControlTag = instanceMain.dzMainMenu._ViewInfo.UserID; //사번
2182
                        //강인구 추가
2183
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Sign;
2184
                        //instanceMain.BaseClient.GetUserSignCompleted += (sen, ea) =>
2185
                        //{
2186
                        //    if (ea.Result == null)
2187
                        //    {
2188

    
2189
                        //        this.ParentOfType<MainPage>().DialogMessage_Alert("You Don't Have Sign Data", "Alert");
2190
                        //    }
2191
                        //    else
2192
                        //    {
2193
                        //        byte[] imageBytes = System.Convert.FromBase64String(ea.Result);
2194
                        //        using (MemoryStream ms = new MemoryStream(imageBytes))
2195
                        //        {
2196
                        //            BitmapImage im = new BitmapImage();
2197
                        //            im.SetSource(ms);
2198
                        //            instanceMain.DeepLayer.SignImage = im;
2199
                        //            ms.Close();
2200
                        //        }
2201
                        //    }
2202
                        //};
2203
                        //instanceMain.BaseClient.GetUserSignAsync(instanceMain._ViewInfo.UserID);
2204
                        break;
2205
                    #endregion
2206
                    #region Check
2207
                    case "Check":
2208
                        Common.ViewerDataModel.Instance.SelectedControl = "Check";
2209
                        Common.ViewerDataModel.Instance.ControlTag = instanceMain.dzMainMenu._ViewInfo.UserID; //사번
2210
                        //강인구 추가
2211
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Symbol;
2212
                        break;
2213
                    #endregion
2214
                    #region Batch
2215
                    case "Batch":
2216
                        Common.ViewerDataModel.Instance.SelectedControl = "Batch";
2217
                        Common.ViewerDataModel.Instance.ControlTag = instanceMain.dzMainMenu._ViewInfo.UserID; //사번
2218
                        //강인구 추가
2219
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Mark;
2220
                        instanceMain.dzMainMenu.txtBatch.Visibility = Visibility.Visible;
2221
                        instanceMain.dzMainMenu.txtBatch.Text = "Place Mark";
2222
                        break;
2223
                    #endregion
2224

    
2225
                    #region MACRO -MACRO1
2226
                    case "MACRO":
2227
                        Common.ViewerDataModel.Instance.SelectedControl = "MACRO";
2228
                        Common.ViewerDataModel.Instance.ControlTag = instanceMain.dzMainMenu._ViewInfo.UserID; //사번
2229

    
2230
                        MacroHelper.MacroAction();
2231

    
2232
                        break;
2233
                    #endregion
2234

    
2235
                    #region Copy
2236
                    case "Copy":
2237
                        Copy_Start();
2238
                        instanceToggle.IsChecked = false;
2239
                        ViewerDataModel.Instance.SelectedControl = "";
2240
                        ViewerDataModel.Instance.ControlTag = null;
2241
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2242
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2243
                        break;
2244
                    #endregion
2245
                    #region Cut
2246
                    case "Cut":
2247
                        //Cut_Start();
2248
                        CutCommand.Instance.Execute();
2249
                        instanceToggle.IsChecked = false;
2250
                        ViewerDataModel.Instance.SelectedControl = "";
2251
                        ViewerDataModel.Instance.ControlTag = null;
2252
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2253
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2254
                        break;
2255
                    #endregion
2256
                    #region Paste
2257
                    case "Paste":
2258
                        Paste_Start();
2259
                        instanceToggle.IsChecked = false;
2260
                        ViewerDataModel.Instance.SelectedControl = "";
2261
                        ViewerDataModel.Instance.ControlTag = null;
2262
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2263
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;                        
2264
                        break;
2265
                    #endregion
2266
                    #region Delete
2267
                    case "Delete":
2268
                        DeleteCommand.Instance.Execute(SelectionSet.Instance.SelectedItems);
2269
                        this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Clear();
2270

    
2271
                        instanceToggle.IsChecked = false;
2272
                        ViewerDataModel.Instance.SelectedControl = "";
2273
                        ViewerDataModel.Instance.ControlTag = null;
2274
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2275
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2276
                        break;
2277
                    #endregion
2278
                    #region Undo
2279
                    case "Undo":
2280
                        UndoCommand.Instance.Execute();
2281
                        instanceToggle.IsChecked = false;
2282
                        ViewerDataModel.Instance.SelectedControl = "";
2283
                        ViewerDataModel.Instance.ControlTag = null;
2284
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2285
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2286
                        break;
2287
                    #endregion
2288
                    #region Redo
2289
                    case "Redo":
2290
                        RedoCommand.Instance.Execute();
2291
                        instanceToggle.IsChecked = false;
2292
                        ViewerDataModel.Instance.SelectedControl = "";
2293
                        ViewerDataModel.Instance.ControlTag = null;
2294
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2295
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2296
                        break;
2297
                    #endregion
2298
                    #region DragZoom
2299
                    case "DragZoom":
2300
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.DragZoom;
2301
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2302
                        instanceMain.dzMainMenu.isLeftMouseButtonDownOnWindow = false;
2303
                        break;
2304
                    #endregion
2305
                    #region Grouping
2306
                    case "Group":
2307
                        //var GrouptoggleList = this.Parent.ChildrenOfType<RadRibbonToggleButton>();
2308
                        //foreach (var togle in GrouptoggleList)
2309
                        //{
2310
                        //    togle.IsChecked = false;
2311
                        //}
2312

    
2313
                        //if (this.ParentOfType<MainWindow>().dzMainMenu.currentControl != null)
2314
                        //{
2315
                        //    ViewerDataModel.Instance.MarkupControls_USER.Remove(this.ParentOfType<MainWindow>().dzMainMenu.currentControl);
2316
                        //    this.ParentOfType<MainWindow>().dzMainMenu.currentControl = null;
2317
                        //}
2318
                        //this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2319
                        //instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2320
                        //instanceMain.dzMainMenu.isLeftMouseButtonDownOnWindow = false;
2321
                        //if (ViewerDataModel.Instance.SystemMain.dzMainMenu.SelectLayer.Children.Count < 1) //선택된 것이 없으면
2322
                        //{
2323
                        //    this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert("Please Select Controls", "Alert");
2324
                        //}
2325
                        //else//if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
2326
                        //{
2327
                        //    // string MarkupData = "";
2328
                        //    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
2329
                        //    {
2330
                        //        if (item.GetType().Name == "AdornerFinal" && (item as AdornerFinal).MemberSet.Count >= 2) // 얘가 2개 이상이여야 그룹가능 버튼도 막을거긴하지만 일단..
2331
                        //        {
2332
                        //            //MARKUP_DATA_GROUP INSERT
2333
                        //            MARKUP_DATA_GROUP mARKUP_DATA_GROUP = new MARKUP_DATA_GROUP
2334
                        //            {
2335
                        //                SYMBOL_ID = null,//InnerItem.Symbol_ID
2336
                        //                STATE = 0,
2337
                        //            };
2338
                        //            long group_id = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.AddMarkupDataGroup(mARKUP_DATA_GROUP, App.ViewInfo.ProjectNO);
2339
                        //            //Logger.sendReqLog("AddMarkupDataGroup: ", "", 1);
2340
                        //            if (group_id > 0)
2341
                        //            {
2342
                        //                foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
2343
                        //                {
2344
                        //                    if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
2345
                        //                    {
2346
                        //                        //MARKUP_DATA UPDATE
2347
                        //                        //Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.UpdateMarkupData((InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo).CommentID, group_id, App.ViewInfo.ProjectNO);
2348
                        //                        ////Logger.sendReqLog("UpdateMarkupData: ", "", 1);
2349
                        //                        ViewerDataModel.Instance.MyMarkupList.Where(d => d.ID == (InnerItem.DrawingData as CommentUserInfo).CommentID).FirstOrDefault().Group_ID = group_id;
2350
                        //                        ViewerDataModel.Instance.MyMarkupList.Where(d => d.ID == (InnerItem.DrawingData as CommentUserInfo).CommentID).FirstOrDefault().IsUpdate = true;
2351
                        //                    }
2352
                        //                }
2353
                        //            }
2354
                        //        }
2355
                        //    }
2356
                        //}
2357
                        break;
2358
                    case "UnGroup":
2359
                        //var UnGrouptoggleList = this.Parent.ChildrenOfType<RadRibbonToggleButton>();
2360
                        //foreach (var togle in UnGrouptoggleList)
2361
                        //{
2362
                        //    togle.IsChecked = false;
2363
                        //}
2364
                        //if (this.ParentOfType<MainWindow>().dzMainMenu.currentControl != null)
2365
                        //{
2366
                        //    ViewerDataModel.Instance.MarkupControls_USER.Remove(this.ParentOfType<MainWindow>().dzMainMenu.currentControl);
2367
                        //    this.ParentOfType<MainWindow>().dzMainMenu.currentControl = null;
2368
                        //}
2369
                        //this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2370
                        //instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2371
                        //instanceMain.dzMainMenu.isLeftMouseButtonDownOnWindow = false;
2372

    
2373
                        //if (ViewerDataModel.Instance.SystemMain.dzMainMenu.SelectLayer.Children.Count < 1) //선택된 것이 없으면
2374
                        //{
2375
                        //    this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert("Please Select Controls", "Alert");
2376
                        //}
2377
                        //else//if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
2378
                        //{
2379
                        //    // string MarkupData = "";
2380
                        //    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
2381
                        //    {
2382
                        //        if (item.GetType().Name == "AdornerFinal" && (item as AdornerFinal).MemberSet.Count >= 1) // 1개 이상 
2383
                        //        {
2384
                        //            //MARKUP_DATA UPDATE
2385
                        //            foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
2386
                        //            {
2387
                        //                if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
2388
                        //                {
2389
                        //                    long group_id = ViewerDataModel.Instance.MyMarkupList.Where(d => d.ID == (InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo).CommentID).FirstOrDefault().Group_ID;
2390
                        //                    //MARKUP_DATA UPDATE
2391
                        //                    //Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.UpdateMarkupData((InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo).CommentID, 0, App.ViewInfo.ProjectNO);
2392
                        //                    ////Logger.sendReqLog("UpdateMarkupData: ", "", 1);
2393
                        //                    ViewerDataModel.Instance.MyMarkupList.Where(d => d.ID == (InnerItem.DrawingData as CommentUserInfo).CommentID).FirstOrDefault().Group_ID = 0;
2394
                        //                    ViewerDataModel.Instance.MyMarkupList.Where(d => d.ID == (InnerItem.DrawingData as CommentUserInfo).CommentID).FirstOrDefault().IsUpdate = true;
2395

    
2396

    
2397
                        //                    //MARKUP_DATA_GROUP UPDATE
2398
                        //                    //bool value = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.UpdateMarkupDataGroup(group_id, App.ViewInfo.ProjectNO);
2399
                        //                    ////Logger.sendReqLog("AddMarkupDataGroup: ", value.ToString(), 1);
2400
                        //                }
2401
                        //            }
2402
                        //        }
2403
                        //    }
2404
                        //}
2405
                        break;
2406
                    #endregion
2407
                    #region Capture
2408
                    case "Capture":
2409
                        SyncInit();
2410
                        //   instanceToggle.IsChecked = false;
2411
                        var CaptureList = this.Parent.ChildrenOfType<RadRibbonToggleButton>();
2412
                        foreach (var togle in CaptureList)
2413
                        {
2414
                            togle.IsChecked = false;
2415
                        }
2416

    
2417
                        if (this.ParentOfType<MainWindow>().dzMainMenu.currentControl != null)
2418
                        {
2419
                            ViewerDataModel.Instance.MarkupControls_USER.Remove(this.ParentOfType<MainWindow>().dzMainMenu.currentControl);
2420
                            this.ParentOfType<MainWindow>().dzMainMenu.currentControl = null;
2421
                        }
2422

    
2423
                        ViewerDataModel.Instance.SelectedControl = "ImgControl";
2424
                   //     ViewerDataModel.Instance.ControlTag = null;
2425
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ImgControl;
2426

    
2427
                        /*
2428
                        //캡쳐 하기 전에 코멘트 저장
2429
                        if (Common.ViewerDataModel.Instance.MarkupControls_USER.Count > 0 || (Application.Current.MainWindow as MainWindow).dzMainMenu.SelectLayer.Children.Count > 0)
2430
                        {
2431
                            var menu = (Application.Current.MainWindow as MainWindow).dzMainMenu;
2432
                            menu.ReleaseAdorner();
2433
                            if (menu.PreviewUserMarkupInfoItem != null && menu.PreviewUserMarkupInfoItem.IsPreviewUser == true)
2434
                            {
2435
                                (Application.Current.MainWindow as MainWindow).dzTopMenu.RefactoryCommentReact(menu);
2436
                            }
2437
                            else if (menu.gridViewMarkup.SelectedItems.Count == 0 || (menu.gridViewMarkup.SelectedItems.FirstOrDefault() as IKCOM.MarkupInfoItem).UserID != App.ViewInfo.UserID)
2438
                            {
2439

    
2440
                            }
2441
                            else
2442
                            {
2443
                                (Application.Current.MainWindow as MainWindow).dzTopMenu.RefactoryCommentReact(menu);
2444
                            }
2445
                        }*/
2446

    
2447
                        //Common.ViewerDataModel.Instance.CheckList_ID = ((e.Source as Telerik.Windows.Controls.RadButton).DataContext as Customer).ID;
2448
                        //Common.ViewerDataModel.Instance.CheckList_ID = ((e.Source as Image).DataContext as Customer).ID;
2449
                        //Common.ViewerDataModel.Instance.PageNumber = ((e.Source as Image).DataContext as Customer).PAGENUMBER;
2450
                        Application.Current.MainWindow.Focus();
2451
                        Common.ViewerDataModel.Instance.Capture_Opacity = 0.49;
2452
                        (Application.Current.MainWindow as MainWindow).dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Capture;
2453
                        break;
2454
                    #endregion
2455
                    #region Cad
2456
                    case "Inside":
2457
                        //instanceMain.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Drawing;
2458
                        //instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = false;
2459
                        Common.ViewerDataModel.Instance.SelectedControl = "InsideWhite";
2460
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.InsideWhite;
2461
                        break;
2462
                    case "Overlap":
2463
                        //instanceMain.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Drawing;
2464
                        //instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = false;
2465
                        Common.ViewerDataModel.Instance.SelectedControl = "OverlapWhite";
2466
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.OverlapWhite;
2467
                        break;
2468
                    case "Clip":
2469
                        //instanceMain.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Drawing;
2470
                        //instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = false;
2471
                        Common.ViewerDataModel.Instance.SelectedControl = "ClipWhite";
2472
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ClipWhite;
2473
                        break;
2474
                    case "CadExport":
2475
                        //if (isClosed)
2476
                        //{
2477
                        //    //토글 및 마우스 상태 초기화
2478
                        //    var toggleList = this.Parent.ChildrenOfType<RadRibbonToggleButton>();
2479
                        //    foreach (var togle in toggleList)
2480
                        //    {
2481
                        //        togle.IsChecked = false;
2482
                        //    }
2483
                        //    this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2484

    
2485
                        //    isClosed = false;
2486
                        //    //Control 파일 먼저 생성
2487
                        //    CollapsedButton_Click();
2488
                        //    CadViewer check = new CadViewer();
2489
                        //    check.WindowStartupLocation = WindowStartupLocation.CenterScreen;
2490
                        //    check.Title = "Export Viewer";
2491
                        //    //check.Topmost = true;
2492
                        //    check.Show();
2493
                        //    check.Closed += Check_Closed;
2494
                        //    instanceToggle.IsChecked = false;
2495
                        //}
2496
                        //break;
2497
                    case "CadViewer":
2498
                        //if (isClosed)
2499
                        //{
2500
                        //    //토글 및 마우스 상태 초기화
2501
                        //    var toggleList = this.Parent.ChildrenOfType<RadRibbonToggleButton>();
2502
                        //    foreach (var togle in toggleList)
2503
                        //    {
2504
                        //        togle.IsChecked = false;
2505
                        //    }
2506
                        //    this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2507

    
2508
                        //    isClosed = false;
2509
                        //    CadResultViewer check = new CadResultViewer();
2510
                        //    check.WindowStartupLocation = WindowStartupLocation.CenterScreen;
2511
                        //    check.Title = "Viewer";
2512
                        //    check.Show();
2513

    
2514
                        //    check.Closed += Check_Closed;
2515

    
2516
                        //}
2517
                        break;
2518
                    #endregion
2519
                    default:
2520
                        break;
2521
                }
2522
                #endregion
2523
            }
2524
            else
2525
            {
2526
                if (Common.ViewerDataModel.Instance.IsMacroCommand)
2527
                {
2528
                    MacroHelper.Clear();
2529
                }
2530

    
2531
                if (!instanceMain.dzMainMenu.IsFreeSelectionMode)
2532
                {
2533
                    instanceMain.dzMainMenu.IsSwingMode = false;
2534
                    Common.ViewerDataModel.Instance.SelectedControl = "";
2535
                    Common.ViewerDataModel.Instance.ControlTag = null;
2536
                    this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2537
                    this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2538
                }
2539
            }
2540

    
2541
        }
2542

    
2543
        private void SyncInit()
2544
        {
2545
            try
2546
            {
2547
                if (!ViewerDataModel.Instance.SystemMain.dzMainMenu.testPanel2.IsHidden)
2548
                {
2549
                    ViewerDataModel.Instance.SystemMain.dzMainMenu.testPanel2.IsHidden = true;
2550
                    ViewerDataModel.Instance.PageBalanceMode = false;
2551
                    ViewerDataModel.Instance.PageBalanceNumber = 0;
2552
                    ViewerDataModel.Instance.SyncPageNumber = 0;
2553
                    ViewerDataModel.Instance.MarkupControls_Sync.Clear();
2554
                    ViewerDataModel.Instance.SystemMain.dzMainMenu.gridViewRevMarkup.Visibility = Visibility.Collapsed;
2555
                    ViewerDataModel.Instance.SystemMain.dzMainMenu.UserList.IsChecked = false;
2556
                    ViewerDataModel.Instance.SystemMain.dzMainMenu.BalanceMode.IsChecked = false;
2557
                }
2558
            }
2559
            catch (Exception ex)
2560
            {
2561
                //Logger.sendResLog("SyncInit", ex.Message, 0);
2562
            }
2563

    
2564
        }
2565

    
2566
        Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
2567
        CommentUserInfo currentControl { get; set; }
2568
        private void Check_Closed(object sender, EventArgs e)
2569
        {
2570
            isClosed = true;
2571
            //this.ParentOfType<MainWindow>().dzMainMenu.PN_Navi.IsEnabled = true;
2572
            //토글 및 마우스 상태 초기화
2573
            var toggleList = this.Parent.ChildrenOfType<RadToggleButton>();
2574
            foreach (var togle in toggleList)
2575
            {
2576
                togle.IsChecked = false;
2577
            }
2578
            this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2579
            ViewerDataModel.Instance.Capture_Opacity = 0;
2580

    
2581
        }
2582

    
2583
        /* public class test 
2584
         {
2585
             public double width { get; set; }
2586
             public double height { get; set; }
2587
         }
2588
         */
2589
        private async void CollapsedButton_Click()
2590
        {
2591
            this.ParentOfType<MainWindow>().dzTopMenu._SaveEvent(null, null); // 저장하지 못한 데이터가 있다면 저장
2592

    
2593
            string[] data = new string[0];
2594

    
2595
            int cnt = 0;
2596
            var menu = this.ParentOfType<MainWindow>().dzMainMenu;
2597

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

    
2600
            foreach (var item in gridSelectionItem)
2601
            {
2602
                if ((item.UserID == App.ViewInfo.UserID) && (ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.CurrentPage != null))
2603
                {
2604
                    var instance = ViewerDataModel.Instance.MyMarkupList.Where(d => d.PageNumber == ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber &&
2605
                    d.MarkupInfoID == item.MarkupInfoID).ToList();
2606
                    data = new string[instance.Count];
2607
                    foreach (var markup in instance)
2608
                    {
2609
                        data[cnt++] = await MarkupToPDF.Serialize.Core.JsonSerializerHelper.UnCompressStringAsync(markup.Data,ViewerDataModel.Instance.CancellationToken());
2610
                    }
2611
                }
2612
            }
2613

    
2614
            if (data != null && KCOM.Properties.Settings.Default.cad == 1)
2615
            {
2616
                string FilePath = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\Cad");
2617
                string FileName = FilePath + "\\commentstring.json"; // Default file name
2618
                if (!File.Exists(FilePath))
2619
                {
2620
                    Directory.CreateDirectory(FilePath);
2621
                }
2622

    
2623
                if (!string.IsNullOrEmpty(FileName))
2624
                {
2625
                    //  File.WriteAllText(SaveDig.FileName, data);
2626
                    File.WriteAllLines(FileName, data);
2627
                }
2628
            }
2629
        }
2630

    
2631
        private double minHeight;
2632
        private double minWidth;
2633

    
2634
        private double maxHeight;
2635
        private double maxWidth;
2636

    
2637
        public bool CanVResize { get; private set; }
2638
        public bool CanHResize { get; private set; }
2639

    
2640
        public void DesignerComponent(FrameworkElement content)
2641
        {
2642
            this.InitializeComponent();
2643

    
2644
            if (!double.IsNaN(content.Width))
2645
            {
2646
                CanHResize = false;
2647
                this.Width = content.Width;
2648
            }
2649
            else
2650
            {
2651
                CanHResize = true;
2652
                this.Width = 23.0;
2653
            }
2654
            if (!double.IsNaN(content.Height))
2655
            {
2656
                CanVResize = false;
2657
                this.Height = content.Height; ;
2658
            }
2659
            else
2660
            {
2661
                CanVResize = true;
2662
                this.Height = 23.0;
2663
            }
2664

    
2665
            minWidth = content.MinWidth < 10.0 ? 10.0 : content.MinWidth;
2666
            minHeight = content.MinHeight < 10.0 ? 10.0 : content.MinHeight;
2667
            maxWidth = content.MaxWidth;
2668
            maxHeight = content.MaxHeight;
2669

    
2670
            double top = (double)content.GetValue(Canvas.TopProperty);
2671
            if (double.IsNaN(top))
2672
                top = 0.0;
2673
            double left = (double)content.GetValue(Canvas.LeftProperty);
2674
            if (double.IsNaN(left))
2675
                left = 0.0;
2676
            SetValue(Canvas.TopProperty, top);
2677
            SetValue(Canvas.LeftProperty, left);
2678

    
2679
            //Set the actual content. Note that "Content" property is a new property. See below
2680
            this.Content = content;
2681
        }
2682
        private void Thumb_DragDelta(object sender, DragDeltaEventArgs e)
2683
        {
2684
            string name = ((Thumb)sender).Name;
2685
            if (name.Contains("Top"))
2686
            {
2687
                double newHeight = this.Height - e.VerticalChange;
2688
                if (newHeight >= minHeight && newHeight <= maxHeight)
2689
                {
2690
                    this.Height = newHeight;
2691
                    SetValue(Canvas.TopProperty,
2692
                (double)GetValue(Canvas.TopProperty) + e.VerticalChange);
2693
                }
2694
            }
2695
            if (name.Contains("Right"))
2696
            {
2697
                double newWidth = this.Width + e.HorizontalChange;
2698
                if (newWidth >= minWidth && newWidth <= maxWidth)
2699
                    this.Width = newWidth;
2700
            }
2701
            if (name.Contains("Bottom"))
2702
            {
2703
                double newHeight = this.Height + e.VerticalChange;
2704
                if (newHeight >= minHeight && newHeight <= maxHeight)
2705
                    this.Height = newHeight;
2706
            }
2707
            if (name.Contains("Left"))
2708
            {
2709
                double newWidth = this.Width - e.HorizontalChange;
2710
                if (newWidth >= minWidth && newWidth <= maxWidth)
2711
                {
2712
                    this.Width = newWidth;
2713
                    SetValue(Canvas.LeftProperty,
2714
                (double)GetValue(Canvas.LeftProperty) + e.HorizontalChange);
2715
                }
2716
            }
2717
        }
2718

    
2719
        private void drawControlBorder(object sender)
2720
        {
2721
            System.Windows.Controls.Control control = (System.Windows.Controls.Control)sender;
2722
        }
2723

    
2724
        private void ResizeThumb_DragDelta(object sender, MouseButtonEventArgs e)
2725
        {
2726
            System.Windows.Controls.Control designerItem = (System.Windows.Controls.Control)sender;
2727
            if (designerItem != null)
2728
            {
2729
                double deltaVertical, deltaHorizontal;
2730

    
2731
                switch (VerticalAlignment)
2732
                {
2733
                    case VerticalAlignment.Bottom:
2734
                        deltaVertical = designerItem.ActualHeight - designerItem.MinHeight;
2735
                        designerItem.Height -= deltaVertical;
2736
                        break;
2737
                    case VerticalAlignment.Top:
2738
                        deltaVertical = designerItem.ActualHeight - designerItem.MinHeight;
2739
                        Canvas.SetTop(designerItem, Canvas.GetTop(designerItem) + deltaVertical);
2740
                        designerItem.Height -= deltaVertical;
2741
                        break;
2742
                    default:
2743
                        break;
2744
                }
2745

    
2746
                switch (HorizontalAlignment)
2747
                {
2748
                    case HorizontalAlignment.Left:
2749
                        deltaHorizontal = designerItem.ActualWidth - designerItem.MinWidth;
2750
                        Canvas.SetLeft(designerItem, Canvas.GetLeft(designerItem) + deltaHorizontal);
2751
                        designerItem.Width -= deltaHorizontal;
2752
                        break;
2753
                    case HorizontalAlignment.Right:
2754
                        deltaHorizontal = designerItem.ActualWidth - designerItem.MinWidth;
2755
                        designerItem.Width -= deltaHorizontal;
2756
                        break;
2757
                    default:
2758
                        break;
2759
                }
2760
            }
2761
            e.Handled = true;
2762
        }
2763

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

    
2766
        void ExportMethod()
2767
        {
2768
            //FileDialogFilter filterImage = new FileDialogFilter("Image Files", "*.jpg", "*.png");
2769
            SaveDig.Filter = "PDF file format|*.pdf";
2770
            SaveDig.Title = "Save an DWG File";
2771
            SaveDig.ShowDialog();
2772
        }
2773

    
2774
        private void cbAutoSave_Checked(object sender, RoutedEventArgs e)
2775
        {            
2776
            if (cbAutoSave.IsChecked == true)
2777
            {
2778
                SaveTime(true, (int)cbSaveInterval.Value);
2779
            }
2780
            else
2781
            {
2782
                SaveTime(false, (int)cbSaveInterval.Value);
2783
            }
2784
        }
2785
        private void cbSaveInterval_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
2786
        {
2787
            if(string.IsNullOrEmpty(cbSaveInterval.Value.ToString()))
2788
            {
2789
                cbSaveInterval.Value = cbSaveInterval.Minimum;
2790
            }
2791
            if (cbAutoSave.IsChecked == true)
2792
            {
2793
                SaveTime(true, (int)cbSaveInterval.Value);
2794
            }
2795

    
2796
            KCOM.Properties.Settings.Default.SaveInterval = (double)cbSaveInterval.Value;
2797
            Properties.Settings.Default.Save();
2798
        }
2799
        //강인구 자동 저장 추가
2800
        private void AutoSave(object sender, RoutedEventArgs e)
2801
        {
2802
            RadToggleButton instanceToggle = sender as RadToggleButton;
2803

    
2804
            if(instanceToggle.IsChecked == true)
2805
            {
2806
                SaveTime(true);
2807
            }
2808
            else
2809
            {
2810
                SaveTime(false);
2811
            }
2812
        }
2813

    
2814
        public void Copy_Start()
2815
        {
2816
            if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
2817
            {
2818
                string MarkupData = "";
2819

    
2820
                foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
2821
                {
2822
                    if (item.GetType().Name == "AdornerFinal")
2823
                    {
2824
                        foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
2825

    
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
                        Clipboard.SetDataObject(MarkupData);
2834
                    }
2835
                }
2836
            }
2837
        }
2838

    
2839
        public void Cut_Start()
2840
        {
2841
            if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
2842
            {
2843
                foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
2844
                {
2845
                    string MarkupData = "";
2846

    
2847
                    if (item.GetType().Name == "AdornerFinal")
2848
                    {
2849
                        foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
2850
                        {
2851
                            if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
2852
                            {
2853
                                MarkupToPDF.Controls.Parsing.MarkupParser.MarkupReturn res = MarkupParser.MarkupToString(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo, App.ViewInfo.UserID);
2854
                                MarkupData += "|OR|" + res.ConvertData;
2855
                            }
2856
                        }
2857
                        //클립보드에 넣음
2858
                        Clipboard.SetDataObject(MarkupData);
2859
                    }
2860
                }
2861
                this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Clear();
2862
            }
2863
        }
2864

    
2865
        public async void Paste_Start()
2866
        {
2867
            //마크업 붙여넣기
2868
            if (Clipboard.GetText().Contains("|OR||DZ|"))
2869
            {
2870
                List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>();
2871

    
2872
                string[] delimiterChars = { "|OR|" };
2873
                string[] data = Clipboard.GetText().Split(delimiterChars, StringSplitOptions.RemoveEmptyEntries);
2874

    
2875
                SelectionSet.Instance.UnSelect(this.ParentOfType<MainWindow>().dzMainMenu);
2876

    
2877
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
2878

    
2879
                //강인구 Undo/Redo 보류
2880
                MarkupToPDF.Common.Undo_data UndoData = new Undo_data()
2881
                {
2882
                    IsUndo = false,
2883
                    Event = Event_Type.Create,
2884
                    EventTime = DateTime.Now,
2885
                    Markup_List = new List<Multi_Undo_data>()
2886
                };
2887

    
2888
                ViewerDataModel.Instance.UndoDataList.Where(data1 => data1.IsUndo == true).ToList().ForEach(i =>
2889
                {
2890
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
2891
                });
2892

    
2893
                foreach (string parse in data)
2894
                {
2895
                    if (parse != "")
2896
                    {
2897
                        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);
2898
                        (item as MarkupToPDF.Common.CommentUserInfo).CommentID = Commons.shortGuid();
2899

    
2900
                        ViewerDataModel.Instance.MarkupControls.Remove(item as MarkupToPDF.Common.CommentUserInfo);
2901
                        ViewerDataModel.Instance.MarkupControls_USER.Remove(item as MarkupToPDF.Common.CommentUserInfo);
2902

    
2903
                        adornerSet.Add(item as MarkupToPDF.Common.CommentUserInfo);
2904

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

    
2907
                        UndoData.Markup_List.Add(multi_Undo_Data);
2908
                        ViewerDataModel.Instance.UndoDataList.Add(UndoData);                        
2909
                    }
2910
                }
2911
                Controls.AdornerFinal final = new Controls.AdornerFinal(adornerSet);
2912

    
2913
                if(this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.X < 0)
2914
                {
2915
                    Canvas.SetLeft(final, 0);
2916
                    Canvas.SetTop(final, 0);
2917
                }
2918
                else
2919
                {
2920
                    double realPointX = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.X - final.BorderSize.X - (final.BorderSize.Width / 2);
2921
                    double realPointY = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.Y - final.BorderSize.Y - (final.BorderSize.Height / 2);
2922
                    final.TranslateItems(realPointX, realPointY);
2923

    
2924
                    if (final.Members.Where(type => type.Drawingtype == MarkupToPDF.Controls.Common.ControlType.TextControl).FirstOrDefault() != null)
2925
                    {
2926
                        final.TranslateItems(0.001, 0.001); //dummy
2927
                    }
2928
                }
2929

    
2930
                this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Add(final);
2931
            }
2932
            //외부 이미지 붙여넣기
2933
            else if (Clipboard.GetImage() != null)
2934
            {
2935
                try
2936
                {
2937
                    Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
2938

    
2939
                    //강인구 Undo/Redo 보류
2940
                    MarkupToPDF.Common.Undo_data UndoData = new Undo_data()
2941
                    {
2942
                        IsUndo = false,
2943
                        Event = Event_Type.Create,
2944
                        EventTime = DateTime.Now,
2945
                        Markup_List = new List<Multi_Undo_data>()
2946
                    };
2947

    
2948

    
2949
                    string temppath = System.IO.Path.GetTempPath();
2950
                    //string filename = KCOM.Events.Save.shortCommentKey();
2951
                    string filename = Commons.shortFileKey();
2952

    
2953
                    System.Drawing.Image clipboardImage = System.Windows.Forms.Clipboard.GetImage();
2954
                    clipboardImage.Save(temppath + "\\" + filename);
2955

    
2956
                    System.IO.FileInfo fileInfo = new System.IO.FileInfo(temppath + "\\" + filename);
2957
                    String strFile = System.IO.Path.GetFileName(fileInfo.FullName);
2958
                    long numByte = fileInfo.Length;
2959
                    double dLen = Convert.ToDouble(fileInfo.Length / 1000000);
2960
                    kr.co.devdoftech.cloud.FileUpload fileUploader = App.FileUploader;
2961

    
2962
                    if (dLen < 4)
2963
                    {
2964
                        System.IO.FileStream fStream = new System.IO.FileStream(fileInfo.FullName,
2965
                        System.IO.FileMode.Open, System.IO.FileAccess.Read);
2966
                        System.IO.BinaryReader br = new System.IO.BinaryReader(fStream);
2967
                        byte[] data = br.ReadBytes((int)numByte);
2968

    
2969
                        filename = fileUploader.Run(App.ViewInfo.ProjectNO, this.ParentOfType<MainWindow>().dzMainMenu._DocItem.DOCUMENT_NO, App.ViewInfo.UserID, strFile + ".png", data);
2970
                        Check_Uri.UriCheck(filename);
2971
                        br.Close();
2972
                        fStream.Close();
2973
                        fStream.Dispose();
2974
                    }
2975
                    else
2976
                    {
2977
                        this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert("Available Memory less than 4 mega byte", "Alert");
2978
                        return;
2979
                    }
2980

    
2981
                    fileInfo.Delete();
2982

    
2983
                    System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(clipboardImage);
2984
                    IntPtr hBitmap = bmp.GetHbitmap();
2985
                    System.Windows.Media.ImageSource WpfBitmap = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(hBitmap, IntPtr.Zero, Int32Rect.Empty, System.Windows.Media.Imaging.BitmapSizeOptions.FromEmptyOptions());
2986
                    Image img = new Image();
2987
                    if (filename.Contains(".svg"))
2988
                    {
2989
                        byte[] imageData = null;
2990
                        DrawingImage image = null;
2991
                        using (System.Net.WebClient web = new System.Net.WebClient())
2992
                        {
2993
                            imageData = web.DownloadData(new Uri(filename));
2994
                            System.IO.Stream stream = new System.IO.MemoryStream(imageData);
2995
                            image = SvgReader.Load(stream);
2996
                        }
2997
                        img.Source = image;
2998
                    }
2999
                    else
3000
                    {
3001
                        img.Source = new BitmapImage(new Uri(filename));
3002
                    }
3003

    
3004
                    var currentControl = new MarkupToPDF.Controls.Etc.ImgControl
3005
                    {
3006
                        PointSet = new List<Point>(),
3007
                        FilePath = filename,
3008
                        ImageData = img.Source,
3009
                        StartPoint = new Point(100, 100),
3010
                        EndPoint = new Point(200, 200),
3011
                        TopRightPoint = new Point(100, 200),
3012
                        LeftBottomPoint = new Point(200, 100)
3013
                    };
3014

    
3015
                    currentControl.TopRightPoint = new Point(currentControl.StartPoint.X + clipboardImage.Width, currentControl.StartPoint.Y);
3016
                    currentControl.LeftBottomPoint = new Point(currentControl.StartPoint.X, currentControl.StartPoint.Y + clipboardImage.Height);
3017
                    currentControl.EndPoint = new Point(currentControl.StartPoint.X + clipboardImage.Width, currentControl.StartPoint.Y + clipboardImage.Height);
3018

    
3019
                    currentControl.PointSet = new List<Point>
3020
                                        {
3021
                                            currentControl.StartPoint,
3022
                                            currentControl.LeftBottomPoint,
3023
                                            currentControl.EndPoint,
3024
                                            currentControl.TopRightPoint,
3025
                                        };
3026

    
3027
                    multi_Undo_Data = this.ParentOfType<MainWindow>().dzMainMenu.Control_Style(currentControl as MarkupToPDF.Common.CommentUserInfo);
3028
                    UndoData.Markup_List.Add(multi_Undo_Data);
3029
                    ViewerDataModel.Instance.UndoDataList.Add(UndoData);
3030

    
3031
                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl as MarkupToPDF.Common.CommentUserInfo);
3032
                    currentControl.CommentID = Commons.shortGuid();
3033

    
3034
                    currentControl.ApplyTemplate();
3035
                    currentControl.SetImage();
3036

    
3037
                    ViewerDataModel.Instance.MarkupControls_USER.Remove(currentControl as MarkupToPDF.Common.CommentUserInfo);
3038
                    Controls.AdornerFinal final = new Controls.AdornerFinal(currentControl as MarkupToPDF.Common.CommentUserInfo);
3039
                    this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Add(final);
3040

    
3041
                    double realPointX = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.X - final.BorderSize.X - (final.BorderSize.Width / 2);
3042
                    double realPointY = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.Y - final.BorderSize.Y - (final.BorderSize.Height / 2);
3043
                    final.TranslateItems(realPointX, realPointY);
3044
                }
3045
                catch(Exception ex)
3046
                {
3047
                    this.ParentOfType<MainWindow>().DialogMessage_Alert("" + ex, "Alert");
3048
                }
3049
            }
3050
        }
3051
    }
3052
}
클립보드 이미지 추가 (최대 크기: 500 MB)