프로젝트

일반

사용자정보

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

markus / KCOM / Events / Implementation / TopMenuEvent.cs @ 74abcf6f

이력 | 보기 | 이력해설 | 다운로드 (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
            RadWindow signManagerPop = 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
            };
1480
            StyleManager.SetTheme(signManagerPop, new Office2013Theme());
1481

    
1482
            //CheckPop.ShowDialog();
1483
            signManagerPop.ShowDialog();
1484
        }
1485

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

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

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

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

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

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

    
1554
            //instanceToggle.IsChecked = false;
1555

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

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

    
1621
        private void Control_Event(object sender, RoutedEventArgs e)
1622
        {
1623

    
1624
        }
1625

    
1626
        #region 대기
1627

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

    
1632
            //if (rotateOffSet > 3)
1633
            //    rotateOffSet = 0;
1634

    
1635
            //if (rotateOffSet < 0)
1636
            //    rotateOffSet = 3;
1637

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

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

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

    
1696

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

    
1701

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

    
1713

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

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

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

    
1725
                instanceMain.dzMainMenu.pageNavigator.GotoPage(data.PageNumber);
1726

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

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

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

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

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

    
1770
                        Check_Uri.UriCheck(filepath);
1771

    
1772
                        instanceMain.dzMainMenu.filename = filepath;
1773

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

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

    
1805
        private void Control_Init(RadToggleButton instanceToggle, object sender)
1806
        {
1807

    
1808
        }
1809

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

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

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

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

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

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

    
1873

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

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

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

    
1895
            instanceMain.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Drawing;
1896

    
1897
            instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = false;
1898

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

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

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

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

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

    
2150
                        //instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = true;
2151

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

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

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

    
2228
                        MacroHelper.MacroAction();
2229

    
2230
                        break;
2231
                    #endregion
2232

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

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

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

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

    
2394

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

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

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

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

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

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

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

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

    
2512
                        //    check.Closed += Check_Closed;
2513

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

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

    
2539
        }
2540

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

    
2562
        }
2563

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

    
2579
        }
2580

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

    
2591
            string[] data = new string[0];
2592

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

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

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

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

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

    
2629
        private double minHeight;
2630
        private double minWidth;
2631

    
2632
        private double maxHeight;
2633
        private double maxWidth;
2634

    
2635
        public bool CanVResize { get; private set; }
2636
        public bool CanHResize { get; private set; }
2637

    
2638
        public void DesignerComponent(FrameworkElement content)
2639
        {
2640
            this.InitializeComponent();
2641

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
2824
                        {
2825
                            if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
2826
                            {
2827
                                MarkupToPDF.Controls.Parsing.MarkupParser.MarkupReturn res = MarkupParser.MarkupToString(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo, App.ViewInfo.UserID);
2828
                                MarkupData += "|OR|" + res.ConvertData;
2829
                            }
2830
                        }
2831
                        Clipboard.SetDataObject(MarkupData);
2832
                    }
2833
                }
2834
            }
2835
        }
2836

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

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

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

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

    
2873
                SelectionSet.Instance.UnSelect(this.ParentOfType<MainWindow>().dzMainMenu);
2874

    
2875
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
2876

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

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

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

    
2898
                        ViewerDataModel.Instance.MarkupControls.Remove(item as MarkupToPDF.Common.CommentUserInfo);
2899
                        ViewerDataModel.Instance.MarkupControls_USER.Remove(item as MarkupToPDF.Common.CommentUserInfo);
2900

    
2901
                        adornerSet.Add(item as MarkupToPDF.Common.CommentUserInfo);
2902

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

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

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

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

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

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

    
2946

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

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

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

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

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

    
2979
                    fileInfo.Delete();
2980

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

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

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

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

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

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

    
3032
                    currentControl.ApplyTemplate();
3033
                    currentControl.SetImage();
3034

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

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