프로젝트

일반

사용자정보

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

markus / KCOM / Views / MainMenu.xaml.cs @ 5ce56a3a

이력 | 보기 | 이력해설 | 다운로드 (286 KB)

1

2
using MarkupToPDF.Controls.Common;
3
using MarkupToPDF.Controls.Line;
4
using MarkupToPDF.Controls.Polygon;
5
using MarkupToPDF.Controls.Shape;
6
using MarkupToPDF.Controls.Text;
7
using MarkupToPDF.Controls.Etc;
8

    
9
using System;
10
using System.Collections.Generic;
11
using System.Linq;
12
using System.Text;
13
using System.Windows;
14
using System.Windows.Controls;
15
using System.Windows.Data;
16
using System.Windows.Documents;
17
using System.Windows.Input;
18
using System.Windows.Media;
19
using System.Windows.Media.Imaging;
20
using System.Windows.Navigation;
21
using System.Windows.Shapes;
22
using KCOM.Common;
23
//using MarkupToPDF.Controls.Event;
24
using IKCOM;
25
using System.Windows.Ink;
26
using System.Collections.ObjectModel;
27
using Telerik.Windows.Controls;
28
using KCOM.Events;
29
using System.Reflection;
30
using MarkupToPDF.Common;
31
using KCOM.Controls;
32
//using MARKUS;
33

    
34
namespace KCOM.Views
35
{
36
    public static class ControlExtensions
37
    {
38
        public static T Clone<T>(this T controlToClone)
39
            where T : System.Windows.Controls.Control
40
        {
41
            System.Reflection.PropertyInfo[] controlProperties = typeof(T).GetProperties(System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance);
42

    
43
            T instance = Activator.CreateInstance<T>();
44

    
45
            foreach (PropertyInfo propInfo in controlProperties)
46
            {
47
                if (propInfo.CanWrite)
48
                {
49
                    if (propInfo.Name != "WindowTarget")
50
                        propInfo.SetValue(instance, propInfo.GetValue(controlToClone, null), null);
51
                }
52
            }
53
            return instance;
54
        }
55
    }
56

    
57
    public class MyConsole
58
    {
59
        private readonly System.Threading.ManualResetEvent _readLineSignal;
60
        private string _lastLine;
61
        public MyConsole()
62
        {
63
            _readLineSignal = new System.Threading.ManualResetEvent(false);
64
            Gui = new TextBox();
65
            Gui.AcceptsReturn = true;
66
            Gui.KeyUp += OnKeyUp;
67
        }
68

    
69
        private void OnKeyUp(object sender, KeyEventArgs e)
70
        {
71
            // this is always fired on UI thread
72
            if (e.Key == Key.Enter)
73
            {
74
                // quick and dirty, but that is not relevant to your question
75
                _lastLine = Gui.Text.Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries).Last();
76
                // now, when you detected that user typed a line, set signal
77
                _readLineSignal.Set();
78
            }
79
        }
80

    
81
        public TextBox Gui { get; private set; }
82

    
83
        public string ReadLine()
84
        {
85
            // that should always be called from non-ui thread
86
            if (Gui.Dispatcher.CheckAccess())
87
                throw new Exception("Cannot be called on UI thread");
88
            // reset signal
89
            _readLineSignal.Reset();
90
            // wait until signal is set. This call is blocking, but since we are on non-ui thread - there is no problem with that
91
            _readLineSignal.WaitOne();
92
            // we got signalled - return line user typed.
93
            return _lastLine;
94
        }
95

    
96
        public void WriteLine(string line)
97
        {
98
            if (!Gui.Dispatcher.CheckAccess())
99
            {
100
                Gui.Dispatcher.Invoke(new Action(() => WriteLine(line)));
101
                return;
102
            }
103

    
104
            Gui.Text += line + Environment.NewLine;
105
        }
106
    }
107

    
108
    /// <summary>
109
    /// MainMenu.xaml에 대한 상호 작용 논리
110
    /// </summary>
111
    public partial class MainMenu : UserControl
112
    {
113
        #region 프로퍼티
114
        //public List<Undo_data> UndoDataList { get; set; }
115
        public Undo_data UndoData { get; set; }
116

    
117
        public CommentUserInfo currentControl { get; set; }
118
        public ControlType controlType { get; set; }
119
        private Move move;
120
        private double[] rotateValue = { 0, 90, 180, 270 };
121
        //private OverView overview = new OverView();
122
        public MouseHandlingMode mouseHandlingMode = MouseHandlingMode.None;
123
        public MouseButton mouseButtonDown { get; set; }
124
        private static readonly double DragThreshold = 5;
125
        private Cursor cursor { get; set; }
126
        private Point canvasDrawingMouseDownPoint;
127
        public string filename { get; set; }
128
        private Point canvasZoomPanningMouseDownPoint;
129
        public Point getCurrentPoint;
130
        private Point canvasZoommovingMouseDownPoint;
131
        private int rotateOffSet = 0;
132
        List<object> ControlList = new List<object>();
133
        private ListBox listBox = new ListBox();
134
        //public ObservableCollection<MarkupInfoItem> _markupInfoList = new ObservableCollection<MarkupInfoItem>();
135
        private Dictionary<Geometry, string> selected_item = new Dictionary<Geometry, string>();
136
        private bool isDraggingSelectionRect = false;
137
        DrawingAttributes inkDA = new DrawingAttributes();
138
        private VPRevision CurrentRev { get; set; }
139
        public RadRibbonButton btnConsolidate { get; set; }
140
        public RadRibbonButton btnFinalPDF { get; set; }
141
        public RadRibbonButton btnTeamConsolidate { get; set; }
142
        public string Filename_ { get; set; }
143
        public double L_Size = 0;
144
        public AdornerFinal adorner_;
145
        public Multi_Undo_data multi_Undo_Data;
146
        public string Symbol_ID = "";
147
        /// <summary>
148
        /// Set to 'true' when the left mouse-button is down.
149
        /// </summary>
150
        private bool isLeftMouseButtonDownOnWindow = false;
151
        //public int currnetNo = 1;
152

    
153
        public InkPresenter _InkBoard = null;
154
        Stroke stroke;
155
        Boolean IsDrawing = false;
156
        StylusPointCollection strokePoints;
157
        StylusPointCollection erasePoints;
158
        RenderTargetBitmap canvasImage;
159
        Point Sync_Offset_Point;
160

    
161
        //강인구 테스트
162
        private Path _SelectionPath { get; set; }
163
        public Path SelectionPath
164
        {
165
            get
166
            {
167
                return _SelectionPath;
168
            }
169
            set
170
            {
171
                if (_SelectionPath != value)
172
                {
173
                    _SelectionPath = value;
174
                    RaisePropertyChanged("SelectionPath");
175

    
176
                }
177
            }
178
        }
179

    
180
        //private RasterImageViewer _imageViewer { get; set; }
181
        //public RasterImageViewer imageViewer
182
        //{
183
        //    get
184
        //    {
185
        //        if (_imageViewer == null)
186
        //        {
187
        //            _imageViewer = new RasterImageViewer();
188
        //            return _imageViewer;
189
        //        }
190
        //        else
191
        //        {
192
        //            return _imageViewer;
193
        //        }
194
        //    }
195
        //    set
196
        //    {
197
        //        if (_imageViewer != value)
198
        //        {
199
        //            _imageViewer = value;
200
        //        }
201
        //    }
202
        //}
203

    
204
        private System.Windows.Controls.Image _imageViewer { get; set; }
205
        public System.Windows.Controls.Image imageViewer
206
        {
207
            get
208
            {
209
                if (_imageViewer == null)
210
                {
211
                    _imageViewer = new System.Windows.Controls.Image();
212
                    return _imageViewer;
213
                }
214
                else
215
                {
216
                    return _imageViewer;
217
                }
218
            }
219
            set
220
            {
221
                if (_imageViewer != value)
222
                {
223
                    _imageViewer = value;
224
                }
225
            }
226
        }
227

    
228
        public bool IsSyncPDFMode { get; set; }
229

    
230

    
231
        //private RasterImageViewer _imageViewer_Compare { get; set; }
232
        //public RasterImageViewer imageViewer_Compare
233
        //{
234
        //    get
235
        //    {
236
        //        if (_imageViewer_Compare == null)
237
        //        {
238
        //            _imageViewer_Compare = new RasterImageViewer();
239
        //            return _imageViewer_Compare;
240
        //        }
241
        //        else
242
        //        {
243
        //            return _imageViewer_Compare;
244
        //        }
245
        //    }
246
        //    set
247
        //    {
248
        //        if (_imageViewer_Compare != value)
249
        //        {
250
        //            _imageViewer_Compare = value;
251
        //        }
252
        //    }
253
        //}
254

    
255
        private System.Windows.Controls.Image _imageViewer_Compare { get; set; }
256
        public System.Windows.Controls.Image imageViewer_Compare
257
        {
258
            get
259
            {
260
                if (_imageViewer_Compare == null)
261
                {
262
                    _imageViewer_Compare = new System.Windows.Controls.Image();
263
                    return _imageViewer_Compare;
264
                }
265
                else
266
                {
267
                    return _imageViewer_Compare;
268
                }
269
            }
270
            set
271
            {
272
                if (_imageViewer_Compare != value)
273
                {
274
                    _imageViewer_Compare = value;
275
                }
276
            }
277
        }
278

    
279
        #endregion
280

    
281

    
282
        public MainMenu()
283
        {
284
            InitializeComponent();
285
            this.Loaded += MainMenu_Loaded;
286
            //UndoDataList = new List<Undo_data>();
287

    
288
            //var console = new MyConsole();
289
            //this.Content = console.Gui;
290
            //var read = console.ReadLine();
291
            //console.WriteLine(read);
292

    
293
        }
294
        private void SetCursor()
295
        {
296
            this.Cursor = cursor;
297
        }
298

    
299
        private bool IsDrawingEnable(Point _canvasZoomPanningMouseDownPoint)
300
        {
301
            if ((_canvasZoomPanningMouseDownPoint.X > 0 &&
302
                             zoomAndPanCanvas.ActualWidth > _canvasZoomPanningMouseDownPoint.X) &&
303
                             (_canvasZoomPanningMouseDownPoint.Y > 0 &&
304
                             zoomAndPanCanvas.ActualHeight > _canvasZoomPanningMouseDownPoint.Y))
305
            {
306
                return true;
307
            }
308

    
309
            return false;
310
        }
311

    
312
        public void DeleteItem(MarkupInfoItem item)
313
        {
314
            if (PreviewUserMarkupInfoItem != null && item.Consolidate == 1 && item.AvoidConsolidate == 0)
315
            {
316
                App.Custom_ViewInfoId = PreviewUserMarkupInfoItem.MarkupInfoID;
317
            }
318

    
319
            ViewerDataModel.Instance._markupInfoList.Remove(item);
320

    
321
            ViewerDataModel.Instance.MarkupControls.Where(data => data.MarkupInfoID == item.MarkupInfoID).ToList().ForEach(a =>
322
            {
323
                ViewerDataModel.Instance.MarkupControls.Remove(a);
324
            });
325

    
326
            ViewerDataModel.Instance.MarkupControls_USER.Where(data => data.MarkupInfoID == item.MarkupInfoID).ToList().ForEach(a =>
327
            {
328
                ViewerDataModel.Instance.MarkupControls_USER.Remove(a);
329
            });
330

    
331
            ViewerDataModel.Instance.MarkupList_USER.Where(data => data.MarkupInfoID == item.MarkupInfoID).ToList().ForEach(a =>
332
            {
333
                ComingNewBieEnd = false;
334
                ViewerDataModel.Instance.MarkupList_USER.Remove(a);
335
            });
336

    
337
            gridViewMarkup.ItemsSource = ViewerDataModel.Instance._markupInfoList;
338
            if (PreviewUserMarkupInfoItem == null && gridViewMarkup.SelectedItems.Where(d => (d as MarkupInfoItem).UserID == App.ViewInfo.UserID).FirstOrDefault() == null)
339
            {
340
                if (gridViewMarkup.Items.Cast<MarkupInfoItem>().ToList().Where(d => d.UserID == App.ViewInfo.UserID).Count() == 0)
341
                {
342
                    var infoId = Events.Save.shortGuid();
343
                    PreviewUserMarkupInfoItem = new MarkupInfoItem
344
                    {
345
                        CreateTime = DateTime.Now,
346
                        Depatment = userData.DEPARTMENT,
347
                        DisplayColor = "#FFFF0000",
348
                        UserID = userData.ID,
349
                        UserName = userData.NAME,
350
                        PageCount = 1,
351
                        Description = "",
352
                        MarkupInfoID = infoId,
353
                        MarkupList = null,
354
                        MarkupVersionID = Events.Save.shortGuid(),
355
                        Consolidate = 0,
356
                        PartConsolidate = 0,
357
                        userDelete = true,
358
                        AvoidConsolidate = 0,
359
                        IsPreviewUser = true
360
                    };
361
                    App.Custom_ViewInfoId = infoId;
362
                }
363
            }
364
            BaseClient.DeleteMarkupAsync(App.ViewInfo.ProjectNO, item.MarkupInfoID);
365
        }
366

    
367
        public void DeleteCommentEvent(object sender, RoutedEventArgs e)
368
        {
369
            //선택된 어도너가 있을시 삭제가 되지 않음(강인구 추가)
370
            this.ReleaseAdorner();
371

    
372
            Button content = (sender as Button);
373
            MarkupInfoItem item = content.CommandParameter as MarkupInfoItem;
374

    
375
            DeleteItem(item);
376
        }
377

    
378
        System.Windows.Media.Animation.DoubleAnimation da = new System.Windows.Media.Animation.DoubleAnimation();
379

    
380
        private void MainMenu_Loaded(object sender, RoutedEventArgs e)
381
        {
382
            if (App.ParameterMode)
383
            {
384
                this.pageNavigator.PageChanging += pageNavigator_PageChanging;
385
                imageViewer_Compare = new Image();
386

    
387
                //drawingRotateCanvas.Children.Add(imageViewer);
388
                //imageViewer1 = imageViewer;
389

    
390
                //drawingRotateCanvas2.Children.Add(imageViewer_Compare);
391

    
392
                //zoomAndPanCanvas.Children.Add(imageViewer);
393
                //zoomAndPanCanvas2.Children.Add(imageViewer_Compare);
394

    
395
                layerControl.ProjectNo = App.ViewInfo.ProjectNO;
396
                ViewerDataModel.Instance.Capture_Opacity = 0;
397
                //ViewerDataModel.Instance.Capture_Opacity = 0.5;
398

    
399
                //testPanel.Visibility = Visibility.Collapsed;
400
                //testPanel2.IsHidden = false;
401
                //testPanel2.Visibility = Visibility.Visible;
402
                //testPanel3.Visibility = Visibility.Collapsed;
403

    
404

    
405
                da.From = 0.8;
406
                da.To = 0;
407
                da.Duration = new Duration(TimeSpan.FromSeconds(1));
408
                da.AutoReverse = true;
409
                da.RepeatBehavior = System.Windows.Media.Animation.RepeatBehavior.Forever;
410
            }
411

    
412

    
413
        }
414

    
415
        public void ReleaseAdorner()
416
        {
417
            if (SelectLayer.Children.Count > 0)
418
            {
419
                foreach (var item in SelectLayer.Children)
420
                {
421
                    if (item.GetType().Name == "AdornerFinal")
422
                    {
423
                        (item as AdornerFinal).unRegister();
424

    
425
                        foreach (var InnerItem in (item as AdornerFinal).MemberSet.Cast<AdornerMember>())
426
                        {
427
                            if (!ViewerDataModel.Instance.MarkupControls_USER.Contains(InnerItem.DrawingData))
428
                            {
429
                                //if (InnerItem.DrawingData.GetType().Name == "InkControl")
430
                                if (InnerItem.DrawingData.GetType().Name == "PolygonControl")
431
                                {
432
                                    if ((InnerItem.DrawingData as PolygonControl).CommentID == null)
433
                                    {
434
                                        (InnerItem.DrawingData as PolygonControl).CommentID = KCOM.Events.Save.shortGuid();
435
                                    }
436
                                }
437

    
438
                                ViewerDataModel.Instance.MarkupControls_USER.Add(InnerItem.DrawingData as CommentUserInfo);
439
                            }
440
                        }
441
                    }
442
                }
443
                SelectLayer.Children.Clear();
444
            }
445
        }
446

    
447
        public List<CommentUserInfo> AddAdorner()
448
        {
449
            List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>();
450

    
451
            if (SelectLayer.Children.Count > 0)
452
            {
453
                foreach (var item in SelectLayer.Children)
454
                {
455
                    if (item.GetType().Name == "AdornerFinal")
456
                    {
457
                        (item as AdornerFinal).unRegister();
458

    
459
                        foreach (var InnerItem in (item as AdornerFinal).MemberSet.Cast<AdornerMember>())
460
                        {
461
                            if (!ViewerDataModel.Instance.MarkupControls_USER.Contains(InnerItem.DrawingData))
462
                            {
463
                                adornerSet.Add(InnerItem.DrawingData as CommentUserInfo);
464
                            }
465

    
466
                            Control_Style(InnerItem.DrawingData as CommentUserInfo);
467

    
468
                            UndoData.Markup_List.Add(multi_Undo_Data);
469
                            multi_Undo_Data = new Multi_Undo_data();
470
                        }
471
                    }
472
                }
473
                SelectLayer.Children.Clear();
474
            }
475
            return adornerSet;
476
        }
477

    
478
        public void ChangeCommentReact()
479
        {
480
            bool isComingNewBie = false;
481
            //if (PreviewUserMarkupInfoItem != null) // 신규 임시 저장인 경우
482
            //{
483

    
484
            //}
485
            //else //기존 게시물에 추가하는 경우
486
            //{
487

    
488
            //}
489

    
490
            if (ViewerDataModel.Instance.MarkupControls_USER.Count > 0)
491
            {
492
                foreach (var control in ViewerDataModel.Instance.MarkupControls_USER)
493
                {
494
                    var root = layerControl.MarkupToString(control, App.ViewInfo.UserID);
495
                    var existItem = ViewerDataModel.Instance.MarkupList_USER.Where(data => data.ID == root.CommentID).FirstOrDefault();
496
                    if (existItem != null) //신규 추가 된 코멘트
497
                    {
498
                        if (existItem.Data != root.ConvertData) //코멘트가 같은지
499
                        {
500
                            existItem.Data = root.ConvertData;
501
                            existItem.IsUpdate = true;
502
                        }
503
                    }
504
                    else
505
                    {
506
                        if (root.CommentID != null)
507
                        {
508
                            isComingNewBie = true;
509
                            var currentCommentCheck = ViewerDataModel.Instance.MarkupList_USER.Where(dt => dt.ID == control.CommentID).FirstOrDefault();
510
                            if (currentCommentCheck != null)
511
                            {
512
                                currentCommentCheck.Data = root.ConvertData;
513
                            }
514
                            else
515
                            {
516
                                ViewerDataModel.Instance.MarkupList_USER.Add(new MarkupItemEx
517
                                {
518
                                    ID = control.CommentID,
519
                                    Data = root.ConvertData,
520
                                    Data_Type = root.DATA_TYPE,
521
                                    MarkupInfoID = App.Custom_ViewInfoId,
522
                                    PageNumber = this.pageNavigator.CurrentPage.PageNumber,
523
                                });
524
                            }
525
                        }
526
                    }
527
                }
528
            }
529
            else
530
            {
531
                //gridViewMarkup.SelectedItems.Clear();
532
            }
533

    
534

    
535
            //if (ViewerDataModel.Instance.MarkupControls_USER.Count > 0)
536
            //{
537
            //    foreach (var control in ViewerDataModel.Instance.MarkupControls_USER)
538
            //    {
539
            //        var root = layerControl.MarkupToString(control, App.ViewInfo.UserID);
540
            //        var existItem = ViewerDataModel.Instance.MarkupList_Pre.Where(data => data.ID == root.CommentID).FirstOrDefault();
541
            //        if (existItem != null) //신규 추가 된 코멘트
542
            //        {
543
            //            if (existItem.Data != root.ConvertData) //코멘트가 같은지
544
            //            {
545
            //                existItem.Data = root.ConvertData;
546
            //                existItem.IsUpdate = true;
547
            //            }
548
            //        }
549
            //        else //신규 코멘트
550
            //        {
551
            //            if (root.CommentID != null)
552
            //            {
553
            //                isComingNewBie = true;
554
            //                var currentCommentCheck = ViewerDataModel.Instance.MarkupList_USER.Where(dt => dt.ID == control.CommentID).FirstOrDefault();
555
            //                if (currentCommentCheck!=null)
556
            //                {
557
            //                    currentCommentCheck.Data = root.ConvertData;
558
            //                }
559
            //                else
560
            //                {
561
            //                    ViewerDataModel.Instance.MarkupList_USER.Add(new MarkupItemEx
562
            //                    {
563
            //                        ID = control.CommentID,
564
            //                        Data = root.ConvertData,
565
            //                        Data_Type = root.DATA_TYPE,
566
            //                        MarkupInfoID = App.Custom_ViewInfoId,
567
            //                        PageNumber = this.pageNavigator.CurrentPage.PageNumber,
568
            //                    });
569
            //                }
570
            //            }
571

    
572
            //        }
573
            //    }
574

    
575
            //}
576

    
577
            //if (PreviewUserMarkupInfoItem != null && isComingNewBie && !ComingNewBieEnd)
578
            //if (PreviewUserMarkupInfoItem != null && isComingNewBie)
579
            //{
580
            //    if (PreviewUserMarkupInfoItem.MarkupList == null)
581
            //    {
582
            //        PreviewUserMarkupInfoItem.MarkupList = new List<MarkupItem>();
583
            //    }
584
            //    foreach (var item in ViewerDataModel.Instance.MarkupList_USER)
585
            //    {
586
            //        PreviewUserMarkupInfoItem.MarkupList.Add(item);
587
            //    }
588
            //    if(!ComingNewBieEnd)
589
            //    {
590

    
591
            //        ViewerDataModel.Instance._markupInfoList.Insert(0, PreviewUserMarkupInfoItem);
592
            //        PreviewUserMarkupInfoItem.IsPreviewUser = false;
593
            //        gridViewMarkup.ItemsSource = null;
594
            //        gridViewMarkup.ItemsSource = ViewerDataModel.Instance._markupInfoList;
595
            //        gridViewMarkup.SelectedItem = PreviewUserMarkupInfoItem;
596
            //    }
597
            //}
598

    
599
            if (PreviewUserMarkupInfoItem != null && isComingNewBie && !ComingNewBieEnd)
600
            {
601
                if (ViewerDataModel.Instance._markupInfoList.Where(info => info.UserID == PreviewUserMarkupInfoItem.UserID).FirstOrDefault() == null)
602
                {
603
                    ComingNewBieEnd = true;
604
                    ViewerDataModel.Instance._markupInfoList.Insert(0, PreviewUserMarkupInfoItem);
605
                    PreviewUserMarkupInfoItem.IsPreviewUser = false;
606
                    gridViewMarkup.ItemsSource = null;
607
                    gridViewMarkup.ItemsSource = ViewerDataModel.Instance._markupInfoList;
608
                    gridViewMarkup.SelectedItem = PreviewUserMarkupInfoItem;
609
                }
610
            }
611

    
612
        }
613

    
614
        MarkupToPDF.Controls.Parsing.LayerControl layerControl = new MarkupToPDF.Controls.Parsing.LayerControl();
615
        bool ComingNewBieEnd = false;
616

    
617
        private void pageNavigator_PageChanging(object sender, Controls.Sample.PageChangeEventArgs e)
618
        {
619
            ViewerDataModel.Instance.UndoDataList.Clear();
620

    
621
            InkControl_Convert();
622

    
623
            ReleaseAdorner();
624
            ChangeCommentReact();
625
            CompareMode.IsChecked = false;
626
            //if (ViewerDataModel.Instance.PageBalanceMode)
627
            //{
628
            //    //ViewerDataModel.Instance.PageBalanceNumber = e.PageNumber + (ViewerDataModel.Instance.PageBalanceNumber - e.PageNumber);
629
            //    //ViewerDataModel.Instance.PageBalanceNumber = e.CurrentPage.PAGE_NUMBER;
630
            //}
631
            //else
632
            //{
633
            //    //ViewerDataModel.Instance.PageBalanceNumber = e.PageNumber + (ViewerDataModel.Instance.PageBalanceNumber - e.PageNumber);
634
            //    ViewerDataModel.Instance.PageBalanceNumber = e.CurrentPage.PAGE_NUMBER;
635
            //}
636

    
637

    
638

    
639
            //using (Leadtools.Codecs.RasterCodecs codecs = new Leadtools.Codecs.RasterCodecs())
640
            //{
641

    
642
            //var BalancePoint = ViewerDataModel.Instance.PageBalanceMode == true ? e.PageNumber + ViewerDataModel.Instance.PageBalanceNumber - 1 : e.PageNumber;
643
            var BalancePoint = ViewerDataModel.Instance.PageBalanceMode == true ? e.PageNumber + ViewerDataModel.Instance.PageBalanceNumber : e.PageNumber;
644

    
645

    
646
            #region 페이지가 벗어난 경우
647

    
648
            if (BalancePoint < 1)
649
            {
650
                BalancePoint = 1;
651
                ViewerDataModel.Instance.PageBalanceNumber = 0;
652
            }
653

    
654
            if (pageNavigator.PageCount < BalancePoint)
655
            {
656
                BalancePoint = pageNavigator.PageCount;
657
                ViewerDataModel.Instance.PageBalanceNumber = 0;
658
            }
659

    
660
            #endregion
661

    
662
            ViewerDataModel.Instance.PageNumber = BalancePoint;
663

    
664
            var uri = String.Format(@"http://cloud.devdoftech.co.kr:5977/TileSource/{0}_Tile/{1}/{2}/{3}.png", _ViewInfo.ProjectNO, (Convert.ToInt32(_ViewInfo.DocumentItemID) / 100).ToString(), _ViewInfo.DocumentItemID, e.PageNumber);
665

    
666
            var defaultBitmapImage = new BitmapImage(new Uri(uri));
667

    
668
            ViewerDataModel.Instance.ImageViewPath = defaultBitmapImage;
669
            ViewerDataModel.Instance.ImageViewWidth = defaultBitmapImage.PixelWidth;
670
            ViewerDataModel.Instance.ImageViewHeight = defaultBitmapImage.PixelHeight;
671

    
672
            if (defaultBitmapImage.IsDownloading)
673
            {
674
                defaultBitmapImage.DownloadCompleted += (ex, arg) =>
675
                {
676
                    ViewerDataModel.Instance.ImageViewPath = defaultBitmapImage;
677
                    ViewerDataModel.Instance.ImageViewWidth = defaultBitmapImage.PixelWidth;
678
                    ViewerDataModel.Instance.ImageViewHeight = defaultBitmapImage.PixelHeight;
679
                };
680
            }
681

    
682
            zoomAndPanCanvas.Width = Convert.ToDouble(e.CurrentPage.PAGE_WIDTH);
683
            zoomAndPanCanvas.Height = Convert.ToDouble(e.CurrentPage.PAGE_HEIGHT);
684

    
685

    
686
            Common.ViewerDataModel.Instance.ContentWidth = zoomAndPanCanvas.Width;
687
            Common.ViewerDataModel.Instance.ContentHeight = zoomAndPanCanvas.Height;
688
            //inkDrawingCanvas.Width = zoomAndPanCanvas.Width;
689
            //inkDrawingCanvas.Height = zoomAndPanCanvas.Height;
690
            inkBoard.Width = zoomAndPanCanvas.Width;
691
            inkBoard.Height = zoomAndPanCanvas.Height;
692

    
693

    
694
            if (!testPanel2.IsHidden)
695
            {
696
                //ViewerDataModel.Instance.PageBalanceNumber = ViewerDataModel.Instance.PageBalanceMode == true ? e.PageNumber + (ViewerDataModel.Instance.PageBalanceNumber - e.PageNumber) : e.PageNumber;
697

    
698
                //PDF모드일때 잠시 대기(강인구)
699
                if (IsSyncPDFMode)
700
                {
701
                    Get_FinalImage.Get_PdfImage get_PdfImage = new Get_FinalImage.Get_PdfImage();
702
                    var pdfpath = new BitmapImage(new Uri(get_PdfImage.Run(CurrentRev.TO_VENDOR, App.ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, ViewerDataModel.Instance.PageNumber)));
703

    
704
                    if (pdfpath.IsDownloading)
705
                    {
706
                        pdfpath.DownloadCompleted += (ex, arg) =>
707
                        {
708
                            ViewerDataModel.Instance.ImageViewPath_C = pdfpath;
709
                            ViewerDataModel.Instance.ImageViewWidth_C = pdfpath.PixelWidth;
710
                            ViewerDataModel.Instance.ImageViewHeight_C = pdfpath.PixelHeight;
711
                            zoomAndPanCanvas2.Width = pdfpath.PixelWidth;
712
                            zoomAndPanCanvas2.Height = pdfpath.PixelHeight;
713
                        };
714
                    }
715
                    else
716
                    {
717
                        ViewerDataModel.Instance.ImageViewPath_C = pdfpath;
718
                        ViewerDataModel.Instance.ImageViewWidth_C = pdfpath.PixelWidth;
719
                        ViewerDataModel.Instance.ImageViewHeight_C = pdfpath.PixelHeight;
720

    
721
                        zoomAndPanCanvas2.Width = pdfpath.PixelWidth;
722
                        zoomAndPanCanvas2.Height = pdfpath.PixelHeight;
723
                    }
724

    
725
                    //Leadtools.Pdf.PDFDocument dpc = new Leadtools.Pdf.PDFDocument(ViewerDataModel.Instance.GetStreamFromUrl(CurrentRev.TO_VENDOR));
726

    
727
                    //var image = dpc.GetPageImage(codecs, BalancePoint);
728
                    //Leadtools.ImageProcessing.SizeCommand size = new Leadtools.ImageProcessing.SizeCommand((int)imageViewer.Image.Width, (int)imageViewer.Image.Height, Leadtools.RasterSizeFlags.Resample);
729
                    //size.Run(image);
730
                    //image.XResolution = 150;
731
                    //image.YResolution = 150;
732
                    //imageViewer_Compare.Image = image;
733
                }
734
                else
735
                {
736
                    //var uri2 = String.Format(@"http://cloud.devdoftech.co.kr:5977/TileSource/{0}_Tile/{1}/{2}/{3}.cmp", _ViewInfo.ProjectNO, (Convert.ToInt32(CurrentRev.DOCUMENT_ID) / 100).ToString(), CurrentRev.DOCUMENT_ID, BalancePoint);
737
                    var uri2 = String.Format(@"http://cloud.devdoftech.co.kr:5977/TileSource/{0}_Tile/{1}/{2}/{3}.png", _ViewInfo.ProjectNO, (Convert.ToInt32(CurrentRev.DOCUMENT_ID) / 100).ToString(), CurrentRev.DOCUMENT_ID, BalancePoint);
738

    
739
                    var defaultBitmapImage_Compare = new BitmapImage(new Uri(uri2));
740

    
741
                    ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare;
742
                    ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth;
743
                    ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight;
744
                    zoomAndPanCanvas2.Width = defaultBitmapImage_Compare.PixelWidth;
745
                    zoomAndPanCanvas2.Height = defaultBitmapImage_Compare.PixelHeight;
746

    
747
                    zoomAndPanControl.ZoomTo(new Rect
748
                    {
749
                        X = 0,
750
                        Y = 0,
751
                        Width = Math.Max(zoomAndPanCanvas.Width, zoomAndPanCanvas2.Width),
752
                        Height = Math.Max(zoomAndPanCanvas.Height, zoomAndPanCanvas2.Height),
753
                    });
754

    
755
                    if (defaultBitmapImage_Compare.IsDownloading)
756
                    {
757
                        defaultBitmapImage_Compare.DownloadCompleted += (ex, arg) =>
758
                        {
759

    
760
                            ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare;
761
                            ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth;
762
                            ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight;
763

    
764
                            zoomAndPanCanvas2.Width = defaultBitmapImage_Compare.PixelWidth;
765
                            zoomAndPanCanvas2.Height = defaultBitmapImage_Compare.PixelHeight;
766

    
767
                            zoomAndPanControl.ZoomTo(new Rect
768
                            {
769
                                X = 0,
770
                                Y = 0,
771
                                Width = Math.Max(zoomAndPanCanvas.Width, zoomAndPanCanvas2.Width),
772
                                Height = Math.Max(zoomAndPanCanvas.Height, zoomAndPanCanvas2.Height),
773
                            });
774
                        };
775
                    }
776

    
777
                    //imageViewer_Compare.Image = codecs.Load(ViewerDataModel.Instance.GetStreamFromUrl(uri2), 0, Leadtools.Codecs.CodecsLoadByteOrder.BgrOrGray, 1, 1);
778

    
779
                    //zoomAndPanCanvas2.Width = imageViewer_Compare.Image.Width;
780
                    //zoomAndPanCanvas2.Height = imageViewer_Compare.Image.Height;
781
                }
782
                tlSyncPageNum.Text = String.Format("Current Page : {0}", BalancePoint);
783
            }
784

    
785
            this.pageNavigator.SetNextPage();
786

    
787
            //강인구 수정
788
            //if (!zoomAndPanCanvas2.Width.IsNaN())
789
            //{
790
            //    zoomAndPanControl.ZoomTo(new Rect
791
            //    {
792
            //        X = 0,
793
            //        Y = 0,
794
            //        Width = Math.Max(zoomAndPanCanvas.Width, zoomAndPanCanvas2.Width),
795
            //        Height = Math.Max(zoomAndPanCanvas.Height, zoomAndPanCanvas2.Height),
796
            //    });
797
            //}
798
            //else
799
            //{
800
            //    zoomAndPanControl.ZoomTo(new Rect { X = 0, Y = 0, Width = zoomAndPanCanvas.Width, Height = zoomAndPanCanvas.Height });
801
            //}
802

    
803
            if (zoomAndPanCanvas2.Width.IsNaN())
804
            {
805
                zoomAndPanControl.ZoomTo(new Rect { X = 0, Y = 0, Width = zoomAndPanCanvas.Width, Height = zoomAndPanCanvas.Height });
806
            }
807

    
808
            Common.ViewerDataModel.Instance.MarkupControls_USER.Clear();  //전체 제거
809
            Common.ViewerDataModel.Instance.MarkupControls.Clear();  //전체 제거
810

    
811
            List<MarkupInfoItem> gridSelectionItem = gridViewMarkup.SelectedItems.Cast<MarkupInfoItem>().ToList(); //선택 된 마크업
812
            foreach (var item in gridSelectionItem)
813
            {
814
                if (item.UserID == App.ViewInfo.UserID)
815
                {
816
                    ViewerDataModel.Instance.MarkupList_USER.Where(data => data.PageNumber == pageNavigator.CurrentPage.PageNumber && data.MarkupInfoID == item.MarkupInfoID).ToList().ForEach(delegate (MarkupItemEx markupitem)
817
                    {
818
                        layerControl.markupParseEx(markupitem.Data, Common.ViewerDataModel.Instance.MarkupControls_USER, item.DisplayColor, "", item.MarkupInfoID, markupitem.ID);
819
                    });
820
                }
821
                else
822
                {
823
                    ViewerDataModel.Instance.MarkupList_Pre.Where(data => data.PageNumber == pageNavigator.CurrentPage.PageNumber && data.MarkupInfoID == item.MarkupInfoID).ToList().ForEach(delegate (MarkupItemEx markupitem)
824
                    {
825
                        layerControl.markupParse(markupitem.Data, Common.ViewerDataModel.Instance.MarkupControls, item.DisplayColor, "", item.MarkupInfoID);
826
                    });
827
                }
828
            }
829

    
830

    
831
            if (!testPanel2.IsHidden)
832
            {
833
                Common.ViewerDataModel.Instance.MarkupControls_Sync.Clear();
834
                List<MarkupInfoItem> gridSelectionRevItem = gridViewRevMarkup.SelectedItems.Cast<MarkupInfoItem>().ToList();
835

    
836

    
837
                foreach (var item in gridSelectionRevItem)
838
                {
839
                    item.MarkupList.Where(pageItem => pageItem.PageNumber == BalancePoint).ToList().ForEach(delegate (MarkupItem markupitem)
840
                    {
841
                        layerControl.markupParse(markupitem.Data, Common.ViewerDataModel.Instance.MarkupControls_Sync, item.DisplayColor, "", item.MarkupInfoID);
842
                    });
843
                }
844

    
845
            }
846

    
847

    
848

    
849
            var instanceMain = this.ParentOfType<MainWindow>();
850
            instanceMain.dzTopMenu.tlcurrentPage.Text = e.CurrentPage.PAGE_NUMBER.ToString();
851

    
852
            //강인구 추가
853
            instanceMain.dzTopMenu.rotateOffSet = 0;
854
            var pageinfo = this.CurrentDoc.docInfo.DOCPAGE.Where(p => p.PAGE_NUMBER == e.CurrentPage.PAGE_NUMBER).FirstOrDefault();
855
            drawingPannelRotate(pageinfo.PAGE_ANGLE);
856

    
857
            //}
858
            SetCommentPages(true);
859
        }
860

    
861
        private void SetCommentPages(bool onlyMe = false)
862
        {
863

    
864
            List<UsersCommentPagesMember> _pages = new List<UsersCommentPagesMember>();
865
            foreach (var item in ViewerDataModel.Instance._markupInfoList)
866
            {
867
                UsersCommentPagesMember instance = new UsersCommentPagesMember();
868
                instance.UserName = item.UserName;
869
                instance.Depart = item.Depatment;
870
                instance.MarkupInfoID = item.MarkupInfoID;
871
                instance.IsSelected = true;
872
                instance.isConSolidation = item.Consolidate;
873
                instance.SetColor = item.DisplayColor;
874
                if (item.UserID == App.ViewInfo.UserID && item.MarkupInfoID == item.MarkupInfoID)
875
                {
876
                    instance.PageNumber = ViewerDataModel.Instance.MarkupList_USER.Select(d => d.PageNumber).ToList();
877
                }
878
                else
879
                {
880
                    instance.PageNumber = ViewerDataModel.Instance.MarkupList_Pre.Where(data => data.MarkupInfoID == item.MarkupInfoID).Select(d => d.PageNumber).ToList();
881
                }
882
                _pages.Add(instance);
883
            }
884
            this.pageNavigator.SetCommentList(_pages.ToList());
885
        }
886

    
887
        private void zoomAndPanControl_MouseWheel(object sender, MouseWheelEventArgs e)
888
        {
889
            if (e.MiddleButton == MouseButtonState.Pressed)
890
            {
891

    
892
            }
893
            e.Handled = true;
894
            if (e.Delta > 0)
895
            {
896
                Point currentContentMousePoint = e.GetPosition(zoomAndPanCanvas);
897
                ZoomIn(currentContentMousePoint);
898
            }
899
            else
900
            {
901
                Point currentContentMousePoint = e.GetPosition(zoomAndPanCanvas);
902
                ZoomOut(currentContentMousePoint);
903
            }
904
        }
905

    
906
        #region ZoomIn & ZoomOut
907

    
908
        private void ZoomOut_Executed(object sender, ExecutedRoutedEventArgs e)
909
        {
910
            ZoomOut(new Point(zoomAndPanControl.ContentZoomFocusX,
911
                zoomAndPanControl.ContentZoomFocusY));
912
        }
913

    
914
        private void ZoomIn_Executed(object sender, ExecutedRoutedEventArgs e)
915
        {
916
            ZoomIn(new Point(zoomAndPanControl.ContentZoomFocusX,
917
                zoomAndPanControl.ContentZoomFocusY));
918
        }
919

    
920

    
921
        //강인구 추가 (줌 인아웃 수치 변경)
922
        //큰해상도의 문서일 경우 줌 인 아웃시 사이즈 변동이 큼
923
        private void ZoomOut(Point contentZoomCenter)
924
        {
925
            if (zoomAndPanControl.ContentScale > 0.39)
926
            {
927
                zoomAndPanControl.ZoomAboutPoint(zoomAndPanControl.ContentScale - 0.2, contentZoomCenter);
928
            }
929
            else
930
            {
931
                zoomAndPanControl.ZoomAboutPoint(zoomAndPanControl.ContentScale / 2, contentZoomCenter);
932
            }
933

    
934
            if (zoomAndPanControl2 != null)
935
            {
936
                if (zoomAndPanControl2.ContentScale > 0.39)
937
                {
938
                    zoomAndPanControl2.ZoomAboutPoint(zoomAndPanControl2.ContentScale - 0.2, contentZoomCenter);
939
                }
940
                else
941
                {
942
                    zoomAndPanControl2.ZoomAboutPoint(zoomAndPanControl2.ContentScale / 2, contentZoomCenter);
943
                }
944
            }
945
        }
946

    
947
        private void ZoomIn(Point contentZoomCenter)
948
        {
949
            if (zoomAndPanControl.ContentScale > 0.19)
950
            {
951
                zoomAndPanControl.ZoomAboutPoint(zoomAndPanControl.ContentScale + 0.2, contentZoomCenter);
952
            }
953
            else
954
            {
955
                zoomAndPanControl.ZoomAboutPoint(zoomAndPanControl.ContentScale * 2, contentZoomCenter);
956
            }
957

    
958
            if (zoomAndPanControl2 != null)
959
            {
960
                if (zoomAndPanControl2.ContentScale > 0.19)
961
                {
962
                    zoomAndPanControl2.ZoomAboutPoint(zoomAndPanControl2.ContentScale + 0.2, contentZoomCenter);
963
                }
964
                else
965
                {
966
                    zoomAndPanControl2.ZoomAboutPoint(zoomAndPanControl2.ContentScale * 2, contentZoomCenter);
967
                }
968
            }
969
        }
970

    
971
        private void ZoomOut()
972
        {
973
            zoomAndPanControl.ContentScale -= 0.1;
974
            //if (zoomAndPanControl2 != null)
975
            //{
976
            //    zoomAndPanControl2.ContentScale -= 0.1;
977
            //}
978
        }
979

    
980
        private void ZoomIn()
981
        {
982
            zoomAndPanControl.ContentScale += 0.1;
983
            //if (zoomAndPanControl2 != null)
984
            //{
985
            //    zoomAndPanControl2.ContentScale += 0.1;
986
            //}
987
        }
988

    
989
        #endregion
990

    
991
        private void init()
992
        {
993
            foreach (var item in ViewerDataModel.Instance.MarkupControls)
994
            {
995

    
996
                ControlList.Clear();
997
                listBox.Items.Clear();
998
                selected_item.Clear();
999

    
1000
                (item as IMarkupCommonData).IsSelected = false;
1001
            }
1002

    
1003
        }
1004

    
1005
        private HitTestResultBehavior MyCallback(HitTestResult result)
1006
        {
1007
            //this.cursor = Cursors.UpArrow;
1008
            var element = result.VisualHit;
1009
            while (element != null && !(element is CommentUserInfo))
1010
                element = VisualTreeHelper.GetParent(element);
1011

    
1012
            if (element == null)
1013
            {
1014
                return HitTestResultBehavior.Stop;
1015
            }
1016
            else
1017
            {
1018
                if (element is CommentUserInfo)
1019
                {
1020
                    if (!hitList.Contains(element))
1021
                    {
1022
                        hitList.Add((CommentUserInfo)element);
1023
                    }
1024
                    else
1025
                    {
1026
                        return HitTestResultBehavior.Stop;
1027
                    }
1028
                    //IntersectionDetail intersectionDetail =
1029
                    //((GeometryHitTestResult)result).IntersectionDetail;
1030
                    //switch (intersectionDetail)
1031
                    //{
1032
                    //    case IntersectionDetail.FullyContains:
1033
                    //        // Add the hit test result to the list:
1034
                    //        hitList.Add((CommentUserInfo)result.VisualHit);
1035
                    //        return HitTestResultBehavior.Continue;
1036
                    //    case IntersectionDetail.Intersects:
1037
                    //        // Set the behavior to return visuals at all z-order levels:
1038
                    //        return HitTestResultBehavior.Continue;
1039
                    //    case IntersectionDetail.FullyInside:
1040
                    //        // Set the behavior to return visuals at all z-order levels:
1041
                    //        return HitTestResultBehavior.Continue;
1042
                    //    default:
1043
                    //        return HitTestResultBehavior.Stop;
1044
                    //}
1045
                }
1046
            }
1047
            return HitTestResultBehavior.Continue;
1048
        }
1049

    
1050
        public void ReleaseSelectPath()
1051
        {
1052
            if (SelectionPath == null)
1053
            {
1054
                SelectionPath = new Path();
1055
                SelectionPath.Name = "";
1056
            }
1057
            if (SelectionPath.Name != "")
1058
            {
1059
                SelectionPath.Name = "None";
1060
            }
1061
            SelectionPath.Opacity = 0.01;
1062
            SelectionPath.RenderTransform = null;
1063
            SelectionPath.RenderTransformOrigin = new Point(0, 0);
1064
        }
1065

    
1066
        #region 컨트롤 초기화 
1067
        public void Control_Init(object control)
1068
        {
1069
            if (L_Size != 0 && (control as IPath) != null)
1070
            {
1071
                (control as IPath).LineSize = L_Size;
1072
                L_Size = 0;
1073
            }
1074

    
1075
            switch (control.GetType().Name)
1076
            {
1077
                case "RectangleControl":
1078
                    {
1079
                        (control as RectangleControl).StrokeColor = Brushes.Red;
1080
                    }
1081
                    break;
1082
                case "CircleControl":
1083
                    {
1084
                        (control as CircleControl).StrokeColor = Brushes.Red;
1085
                    }
1086
                    break;
1087
                case "TriControl":
1088
                    {
1089
                        (control as TriControl).StrokeColor = Brushes.Red;
1090
                    }
1091
                    break;
1092
                case "RectCloudControl":
1093
                    {
1094
                        (control as RectCloudControl).StrokeColor = Brushes.Red;
1095
                    }
1096
                    break;
1097
                case "CloudControl":
1098
                    {
1099
                        (control as CloudControl).StrokeColor = Brushes.Red;
1100
                    }
1101
                    break;
1102
                case "PolygonControl":
1103
                    {
1104
                        (control as PolygonControl).StrokeColor = Brushes.Red;
1105
                    }
1106
                    break;
1107
                case "ArcControl":
1108
                    {
1109
                        (control as ArcControl).StrokeColor = Brushes.Red;
1110
                    }
1111
                    break;
1112
                case "LineControl":
1113
                    {
1114
                        (control as LineControl).StrokeColor = Brushes.Red;
1115
                    }
1116
                    break;
1117
                case "ArrowControl_Multi":
1118
                    {
1119
                        (control as ArrowControl_Multi).StrokeColor = Brushes.Red;
1120
                    }
1121
                    break;
1122
                case "TextControl":
1123
                    {
1124
                        (control as TextControl).BackInnerColor = new SolidColorBrush(Color.FromArgb(Convert.ToByte(255 * 0.6), Colors.White.R, Colors.White.G, Colors.White.B));
1125
                    }
1126
                    break;
1127
                case "ArrowTextControl":
1128
                    {
1129
                        (control as ArrowTextControl).BackInnerColor = new SolidColorBrush(Color.FromArgb(Convert.ToByte(255 * 0.6), Colors.White.R, Colors.White.G, Colors.White.B));
1130
                    }
1131
                    break;
1132
            }
1133
        }
1134
        #endregion
1135

    
1136
        public void firstCondition_MouseLeave(object sender, MouseEventArgs e)
1137
        {
1138
            //Control_Init(e.Source);
1139
        }
1140

    
1141
        private void zoomAndPanControl_MouseMove(object sender, MouseEventArgs e)
1142
        {
1143

    
1144
            //if(e.LeftButton == MouseButtonState.Pressed && Symbol_ID != "")
1145
            //{
1146

    
1147

    
1148
            //}
1149

    
1150

    
1151
            //var ct = ViewerDataModel.Instance.MarkupControls_USER.Where(data => data.IsMouseOver).FirstOrDefault();
1152
            //if (ct != null)
1153
            //{
1154
            //    this.cursor = Cursors.Hand;
1155
            //    SetCursor();
1156
            //}
1157
            //else
1158
            //{
1159
            //    this.cursor = Cursors.Arrow;
1160
            //    SetCursor();
1161
            //}
1162

    
1163
            if (Common.ViewerDataModel.Instance.SelectedControl == "Batch")
1164
            {
1165
                if (!floatingTip.IsOpen) { floatingTip.IsOpen = true; }
1166

    
1167
                Point currentPos = e.GetPosition(rect);
1168

    
1169
                floatingTip.HorizontalOffset = currentPos.X + 20;
1170
                floatingTip.VerticalOffset = currentPos.Y;
1171

    
1172

    
1173
                //ToolTip tool = new System.Windows.Controls.ToolTip();
1174
                //tool.Content = "ToolTip";
1175
                //panel.ToolTip = tool;
1176
            }
1177

    
1178
            if (mouseHandlingMode != MouseHandlingMode.Drawing)
1179
            {
1180
                #region 마우스 오버 시 색상 변경
1181
                //var firstCondition = ViewerDataModel.Instance.MarkupControls_USER.Where(data => data.IsMouseOver).FirstOrDefault();
1182
                //Color TempColor = MarkupToPDF.Controls.Common.ValueConverter.StringToColorConverter.Parse("FF07B4FF");
1183

    
1184
                //if (firstCondition != null)
1185
                //{
1186
                //    firstCondition.MouseLeave += new System.Windows.Input.MouseEventHandler(firstCondition_MouseLeave);
1187

    
1188
                //    if (firstCondition.GetType().Name == "TextControl")
1189
                //    {
1190
                //        (firstCondition as TextControl).BackInnerColor = new SolidColorBrush(TempColor);
1191
                //        return;
1192
                //    }
1193
                //    else if (firstCondition.GetType().Name == "ArrowTextControl")
1194
                //    {
1195
                //        (firstCondition as ArrowTextControl).BackInnerColor = new SolidColorBrush(TempColor);
1196
                //        return;
1197
                //    }
1198

    
1199
                //    if (L_Size == 0)
1200
                //    {
1201
                //        L_Size = (firstCondition as IPath).LineSize;
1202
                //        (firstCondition as IPath).LineSize *= 4;
1203
                //    }
1204
                //    switch (firstCondition.GetType().Name)
1205
                //    {
1206
                //        case "RectangleControl":
1207
                //            {
1208
                //                (firstCondition as RectangleControl).StrokeColor = new SolidColorBrush(TempColor);
1209
                //            }
1210
                //            break;
1211
                //        case "CircleControl":
1212
                //            {
1213
                //                (firstCondition as CircleControl).StrokeColor = new SolidColorBrush(TempColor);
1214
                //            }
1215
                //            break;
1216
                //        case "TriControl":
1217
                //            {
1218
                //                (firstCondition as TriControl).StrokeColor = new SolidColorBrush(TempColor);
1219
                //            }
1220
                //            break;
1221
                //        case "RectCloudControl":
1222
                //            {
1223
                //                (firstCondition as RectCloudControl).StrokeColor = new SolidColorBrush(TempColor);
1224
                //            }
1225
                //            break;
1226
                //        case "CloudControl":
1227
                //            {
1228
                //                (firstCondition as CloudControl).StrokeColor = new SolidColorBrush(TempColor);
1229
                //            }
1230
                //            break;
1231
                //        case "PolygonControl":
1232
                //            {
1233
                //                (firstCondition as PolygonControl).StrokeColor = new SolidColorBrush(TempColor);
1234
                //            }
1235
                //            break;
1236
                //        case "ArcControl":
1237
                //            {
1238
                //                (firstCondition as ArcControl).StrokeColor = new SolidColorBrush(TempColor);
1239
                //            }
1240
                //            break;
1241
                //        case "LineControl":
1242
                //            {
1243
                //                (firstCondition as LineControl).StrokeColor = new SolidColorBrush(TempColor);
1244
                //            }
1245
                //            break;
1246
                //        case "ArrowControl_Multi":
1247
                //            {
1248
                //                (firstCondition as ArrowControl_Multi).StrokeColor = new SolidColorBrush(TempColor);
1249
                //            }
1250
                //            break;
1251

    
1252
                //        default:
1253
                //            {
1254

    
1255
                //            }
1256
                //            break;
1257
                //    }
1258
                //} 
1259
                #endregion
1260
            }
1261

    
1262
            getCurrentPoint = e.GetPosition(drawingRotateCanvas);
1263

    
1264
            if (mouseButtonDown == MouseButton.Middle)
1265
            {
1266
                SetCursor();
1267
                Point currentCanvasDrawingMouseMovePoint = e.GetPosition(drawingRotateCanvas);
1268
                Point currentCanvasZoomPanningMouseMovePoint = e.GetPosition(zoomAndPanCanvas);
1269

    
1270
                Vector dragOffset = currentCanvasZoomPanningMouseMovePoint - canvasZoommovingMouseDownPoint;
1271

    
1272
                zoomAndPanControl.ContentOffsetX += 1;
1273
                zoomAndPanControl.ContentOffsetY += 1;
1274

    
1275
                //zoomAndPanControl.ContentOffsetX += dragOffset.X;
1276
                //zoomAndPanControl.ContentOffsetY += dragOffset.Y;
1277
            }
1278

    
1279
            if (mouseButtonDown == MouseButton.Right)
1280
            {
1281
                SetCursor();
1282
                Point currentCanvasDrawingMouseMovePoint = e.GetPosition(drawingRotateCanvas);
1283
                Point currentCanvasZoomPanningMouseMovePoint = e.GetPosition(zoomAndPanCanvas);
1284

    
1285
                Vector dragOffset = currentCanvasZoomPanningMouseMovePoint - canvasZoommovingMouseDownPoint;
1286
                zoomAndPanControl.ContentOffsetX -= dragOffset.X;
1287
                zoomAndPanControl.ContentOffsetY -= dragOffset.Y;
1288
            }
1289
            //else if (currentControl != null && mouseHandlingMode == MouseHandlingMode.Drawing && mouseButtonDown == MouseButton.Left)
1290
            else if (mouseHandlingMode == MouseHandlingMode.Drawing && mouseButtonDown == MouseButton.Left)
1291
            {
1292
                Point currentCanvasDrawingMouseMovePoint = e.GetPosition(drawingRotateCanvas);
1293
                Point currentCanvasZoomPanningMouseMovePoint = e.GetPosition(zoomAndPanCanvas);
1294
                SetCursor();
1295

    
1296
                if (IsDrawing)
1297
                {
1298
                    if (currentControl == null)
1299
                    {
1300
                        switch (controlType)
1301
                        {
1302
                            case ControlType.PenControl:
1303
                                {
1304
                                    if (inkBoard.Tag.ToString() == "Ink")
1305
                                    {
1306
                                        stroke.StylusPoints.Add(new StylusPoint(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y));
1307
                                    }
1308
                                    else if (inkBoard.Tag.ToString() == "EraseByPoint")
1309
                                    {
1310
                                        RemovePointStroke(currentCanvasDrawingMouseMovePoint);
1311
                                    }
1312
                                    else if (inkBoard.Tag.ToString() == "EraseByStroke")
1313
                                    {
1314
                                        RemoveLineStroke(currentCanvasDrawingMouseMovePoint);
1315
                                    }
1316

    
1317
                                    //inkBoard.Strokes.Add(stroke);
1318
                                }
1319
                                break;
1320
                        }
1321
                        return;
1322
                    }
1323
                }
1324

    
1325
                if (currentControl != null)
1326
                {
1327
                    double moveX = currentCanvasDrawingMouseMovePoint.X - canvasDrawingMouseDownPoint.X;
1328
                    double moveY = currentCanvasDrawingMouseMovePoint.Y - canvasDrawingMouseDownPoint.Y;
1329
                    //강인구 추가
1330
                    currentControl.Opacity = ViewerDataModel.Instance.ControlOpacity;
1331

    
1332
                    if ((currentControl as IPath) != null)
1333
                    {
1334
                        (currentControl as IPath).LineSize = ViewerDataModel.Instance.LineSize;
1335
                    }
1336
                    if ((currentControl as LineControl) != null)
1337
                    {
1338
                        (currentControl as LineControl).Interval = ViewerDataModel.Instance.Interval;
1339
                    }
1340

    
1341
                    if ((currentControl as IShapeControl) != null)
1342
                    {
1343
                        (currentControl as IShapeControl).Paint = ViewerDataModel.Instance.paintSet;
1344
                    }
1345
                    if ((currentControl as TextControl) != null)
1346
                    {
1347
                        if (this.ParentOfType<MainWindow>().dzTopMenu.btnItalic.IsChecked == true)
1348
                        {
1349
                            (currentControl as TextControl).TextStyle = FontStyles.Italic;
1350
                        }
1351
                        if (this.ParentOfType<MainWindow>().dzTopMenu.btnBold.IsChecked == true)
1352
                        {
1353
                            (currentControl as TextControl).TextWeight = FontWeights.Heavy;
1354
                        }
1355
                        if (this.ParentOfType<MainWindow>().dzTopMenu.btnUnderLine.IsChecked == true)
1356
                        {
1357
                            (currentControl as TextControl).UnderLine = TextDecorations.Underline;
1358
                        }
1359
                    }
1360
                    else if ((currentControl as ArrowTextControl) != null)
1361
                    {
1362
                        if (this.ParentOfType<MainWindow>().dzTopMenu.btnItalic.IsChecked == true)
1363
                        {
1364
                            (currentControl as ArrowTextControl).TextStyle = FontStyles.Italic;
1365
                        }
1366
                        if (this.ParentOfType<MainWindow>().dzTopMenu.btnBold.IsChecked == true)
1367
                        {
1368
                            (currentControl as ArrowTextControl).TextWeight = FontWeights.Heavy;
1369
                        }
1370
                        if (this.ParentOfType<MainWindow>().dzTopMenu.btnUnderLine.IsChecked == true)
1371
                        {
1372
                            (currentControl as ArrowTextControl).UnderLine = TextDecorations.Underline;
1373
                        }
1374
                    }
1375

    
1376
                    switch (controlType)
1377
                    {
1378
                        case ControlType.Rectangle:
1379
                            {
1380
                                var control = currentControl as RectangleControl;
1381

    
1382
                                if (control != null)
1383
                                {
1384
                                    if (move.mousemode == MouseMode.Drawing)
1385
                                    {
1386
                                        //move.control_Move(ControlList, true, moveX, moveY);
1387
                                    }
1388
                                    else
1389
                                    {
1390
                                        //control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
1391
                                        //control.LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X, currentCanvasDrawingMouseMovePoint.Y);
1392
                                        //control.TopRightPoint = new Point(currentCanvasDrawingMouseMovePoint.X, canvasDrawingMouseDownPoint.Y);
1393
                                        //control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
1394

    
1395

    
1396
                                        //control.PointSet = new List<Point>
1397
                                        //{
1398
                                        //    control.StartPoint,
1399
                                        //    control.LeftBottomPoint,
1400
                                        //    control.EndPoint,
1401
                                        //    control.TopRightPoint,
1402
                                        //};
1403
                                        control.PointSet = new List<Point>
1404
                                        {
1405
                                            new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y),
1406
                                            new Point(canvasDrawingMouseDownPoint.X, currentCanvasDrawingMouseMovePoint.Y),
1407
                                            new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y),
1408
                                            new Point(currentCanvasDrawingMouseMovePoint.X, canvasDrawingMouseDownPoint.Y),
1409
                                        };
1410
                                        control.updateControl();
1411
                                    }
1412

    
1413
                                    //강인구 추가
1414
                                    control.ControlType = controlType;
1415
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1416
                                    control.Paint = ViewerDataModel.Instance.paintSet;
1417
                                }
1418
                            }
1419
                            break;
1420

    
1421
                        case ControlType.RectCloud:
1422
                            {
1423
                                var control = currentControl as RectCloudControl;
1424

    
1425
                                if (control != null)
1426
                                {
1427
                                    if (move.mousemode == MouseMode.Drawing)
1428
                                    {
1429
                                        //move.control_Move(ControlList, true, moveX, moveY);
1430
                                    }
1431
                                    else
1432
                                    {
1433
                                        control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
1434
                                        control.LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X, currentCanvasDrawingMouseMovePoint.Y);
1435
                                        control.TopRightPoint = new Point(currentCanvasDrawingMouseMovePoint.X, canvasDrawingMouseDownPoint.Y);
1436
                                        control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
1437

    
1438
                                        control.PointSet = new List<Point>
1439
                                        {
1440
                                            control.StartPoint,
1441
                                            control.LeftBottomPoint,
1442
                                            control.EndPoint,
1443
                                            control.TopRightPoint,
1444
                                        };
1445
                                    }
1446
                                    //강인구 추가
1447
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1448
                                    control.Paint = ViewerDataModel.Instance.paintSet;
1449
                                }
1450
                            }
1451
                            break;
1452

    
1453
                        case ControlType.SingleLine:
1454
                            {
1455
                                if (currentControl != null)
1456
                                {
1457
                                    var control = currentControl as LineControl;
1458
                                    control.LineStyleSet = LineStyleSet.SingleLine;
1459
                                    control.ControlType = controlType;
1460
                                    if (control != null)
1461
                                    {
1462
                                        control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
1463
                                        control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
1464
                                        Point tempPoint = control.EndPoint;
1465

    
1466
                                        if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift)
1467
                                        {
1468
                                            //var AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
1469
                                            ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
1470
                                            control.EndPoint = tempPoint;
1471
                                        }
1472
                                        else
1473
                                        {
1474
                                            ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false);
1475
                                        }
1476

    
1477
                                       control.PointSet = new List<Point>
1478
                                        {
1479
                                            control.StartPoint,
1480
                                            control.EndPoint,
1481
                                        };
1482
                                        //강인구 추가
1483
                                        control.DashSize = ViewerDataModel.Instance.DashSize;
1484
                                    }
1485
                                }
1486

    
1487
                            }
1488
                            break;
1489

    
1490
                        case ControlType.CancelLine:
1491
                            {
1492
                                if (currentControl != null)
1493
                                {
1494
                                    var control = currentControl as LineControl;
1495
                                    control.LineStyleSet = LineStyleSet.CancelLine;
1496
                                    //control.LineStyle = LineControl.LineStyleSet.MultiLine;
1497
                                    control.ControlType = controlType;
1498
                                    if (control != null)
1499
                                    {
1500
                                        control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
1501
                                        control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
1502
                                        Point tempPoint = control.EndPoint;
1503

    
1504
                                        if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift)
1505
                                        {
1506
                                            //var AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
1507
                                            ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
1508
                                            control.EndPoint = tempPoint;
1509
                                        }
1510
                                        else
1511
                                        {
1512
                                            ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false);
1513
                                        }
1514

    
1515

    
1516
                                        control.PointSet = new List<Point>
1517
                                            {
1518
                                                control.StartPoint,
1519
                                                control.EndPoint,
1520
                                            };
1521
                                    }
1522
                                    //강인구 추가
1523
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1524
                                }
1525
                            }
1526
                            break;
1527

    
1528
                        case ControlType.ArrowLine:
1529
                            {
1530
                                if (currentControl != null)
1531
                                {
1532
                                    var control = currentControl as LineControl;
1533
                                    control.LineStyleSet = LineStyleSet.ArrowLine;
1534
                                    control.ControlType = controlType;
1535
                                    if (control != null)
1536
                                    {
1537
                                        control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
1538
                                        control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
1539
                                        Point tempPoint = control.EndPoint;
1540

    
1541
                                        if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift)
1542
                                        {
1543
                                            //var AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
1544
                                            ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
1545
                                            control.EndPoint = tempPoint;
1546
                                        }
1547
                                        else
1548
                                        {
1549
                                            ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false);
1550
                                        }
1551

    
1552

    
1553
                                        control.PointSet = new List<Point>
1554
                                            {
1555
                                                control.StartPoint,
1556
                                                control.EndPoint,
1557
                                            };
1558
                                    }
1559
                                    //강인구 추가
1560
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1561
                                }
1562

    
1563
                            }
1564
                            break;
1565

    
1566
                        case ControlType.TwinLine:
1567
                            {
1568
                                if (currentControl != null)
1569
                                {
1570
                                    var control = currentControl as LineControl;
1571
                                    control.LineStyleSet = LineStyleSet.TwinLine;
1572
                                    control.ControlType = controlType;
1573
                                    if (control != null)
1574
                                    {
1575
                                        control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
1576
                                        control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
1577
                                        Point tempPoint = control.EndPoint;
1578

    
1579
                                        if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift)
1580
                                        {
1581
                                            //var AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
1582
                                            ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
1583
                                            control.EndPoint = tempPoint;
1584
                                        }
1585
                                        else
1586
                                        {
1587
                                            ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false);
1588
                                        }
1589

    
1590

    
1591
                                        control.PointSet = new List<Point>
1592
                                            {
1593
                                                control.StartPoint,
1594
                                                control.EndPoint,
1595
                                            };
1596
                                    }
1597
                                    //강인구 추가
1598
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1599
                                }
1600

    
1601
                            }
1602
                            break;
1603

    
1604
                        case ControlType.DimLine:
1605
                            {
1606
                                if (currentControl != null)
1607
                                {
1608
                                    var control = currentControl as LineControl;
1609
                                    control.LineStyleSet = LineStyleSet.DimLine;
1610
                                    control.ControlType = controlType;
1611
                                    if (control != null)
1612
                                    {
1613
                                        control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
1614
                                        control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
1615
                                        Point tempPoint = control.EndPoint;
1616

    
1617
                                        if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift)
1618
                                        {
1619
                                            //var AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
1620
                                            ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
1621
                                            control.EndPoint = tempPoint;
1622
                                        }
1623
                                        else
1624
                                        {
1625
                                            ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false);
1626
                                        }
1627

    
1628
                                        control.PointSet = new List<Point>
1629
                                            {
1630
                                                control.StartPoint,
1631
                                                control.EndPoint,
1632
                                            };
1633
                                    }
1634
                                    //강인구 추가
1635
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1636
                                }
1637

    
1638
                            }
1639
                            break;
1640

    
1641
                        case ControlType.ChainLine:
1642
                            {
1643
                                var control = currentControl as PolygonControl;
1644

    
1645
                                if (control != null)
1646
                                {
1647
                                    control.PointSet.RemoveAt(control.PointSet.Count - 1);
1648
                                    control.PointSet.Add(currentCanvasDrawingMouseMovePoint);
1649
                                    control.SetPolyPath();
1650
                                    //movePoint.X = currentCanvasDrawingMouseMovePoint.X;
1651
                                    //movePoint.Y = currentCanvasDrawingMouseMovePoint.Y;
1652
                                    //control.PointC.pointSet.Add(new Point(currentCanvasDrawingMouseMovePoint.X,currentCanvasDrawingMouseMovePoint.Y));
1653

    
1654
                                    //강인구 추가
1655
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1656
                                }
1657
                            }
1658
                            break;
1659

    
1660
                        case ControlType.ArcLine:
1661
                            {
1662
                                if (currentControl != null)
1663
                                {
1664
                                    var control = currentControl as ArcControl;
1665
                                    control.isTransOn = false;
1666
                                    control.ControlType = controlType;
1667

    
1668
                                    if (control != null)
1669
                                    {
1670
                                        control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
1671
                                        control.MidPoint = new Point(0, 0);
1672
                                        control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
1673
                                        Point tempPoint = control.EndPoint;
1674

    
1675
                                        if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift)
1676
                                        {
1677
                                            ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
1678
                                            control.EndPoint = tempPoint;
1679
                                        }
1680
                                        else
1681
                                        {
1682
                                            ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false);
1683
                                        }
1684

    
1685

    
1686
                                        control.PointSet = new List<Point>
1687
                                            {
1688
                                                control.StartPoint,
1689
                                                control.MidPoint,
1690
                                                control.EndPoint,
1691
                                            };
1692
                                    }
1693
                                    //강인구 추가
1694
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1695
                                }
1696

    
1697
                            }
1698
                            break;
1699

    
1700
                        case ControlType.ArcArrow:
1701
                            {
1702
                                if (currentControl != null)
1703
                                {
1704
                                    var control = currentControl as ArcControl;
1705
                                    control.isTransOn = true;
1706
                                    control.ControlType = controlType;
1707

    
1708
                                    if (control != null)
1709
                                    {
1710
                                        if (move.mousemode == MouseMode.Drawing)
1711
                                        {
1712
                                            //move.control_Move(ControlList, true, moveX, moveY);
1713
                                        }
1714
                                        else
1715
                                        {
1716
                                            control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
1717
                                            control.MidPoint = new Point(0, 0);
1718
                                            control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
1719
                                        }
1720

    
1721
                                        control.PointSet = new List<Point>
1722
                                            {
1723
                                                control.StartPoint,
1724
                                                control.MidPoint,
1725
                                                control.EndPoint,
1726
                                            };
1727
                                    }
1728
                                    //강인구 추가
1729
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1730
                                }
1731
                            }
1732
                            break;
1733

    
1734
                        case ControlType.ArrowMultiLine:
1735
                            {
1736
                                if (currentControl != null)
1737
                                {
1738
                                    var control = currentControl as ArrowControl_Multi;
1739

    
1740
                                    if (control != null)
1741
                                    {
1742
                                        control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
1743
                                        Point tempPoint = control.EndPoint;
1744
                                        if (control.MiddlePoint == new Point(0, 0))
1745
                                        {
1746
                                            if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift)
1747
                                            {
1748
                                                ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
1749
                                                //var AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
1750
                                                control.EndPoint = tempPoint;
1751
                                            }
1752
                                            else
1753
                                            {
1754
                                                ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false);
1755
                                            }
1756
                                        }
1757
                                        else
1758
                                        {
1759
                                            if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift)
1760
                                            {
1761
                                                //var AngleValue = MathSet.returnAngleString(control.MiddlePoint, ref tempPoint, true);
1762
                                                ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
1763
                                                control.EndPoint = tempPoint;
1764
                                            }
1765
                                            else
1766
                                            {
1767
                                                ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false);
1768
                                            }
1769

    
1770
                                        }
1771

    
1772
                                        control.PointSet = new List<Point>
1773
                                            {
1774
                                                control.StartPoint,
1775
                                                control.MiddlePoint,
1776
                                                control.EndPoint,
1777
                                            };
1778

    
1779
                                    }
1780
                                    //강인구 추가
1781
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1782
                                }
1783

    
1784
                            }
1785
                            break;
1786

    
1787
                        case ControlType.Circle:
1788
                            {
1789
                                var control = currentControl as CircleControl;
1790

    
1791
                                if (control != null)
1792
                                {
1793
                                    if (move.mousemode == MouseMode.Drawing)
1794
                                    {
1795
                                        //move.control_Move(ControlList, true, moveX, moveY);
1796
                                    }
1797
                                    else
1798
                                    {
1799
                                        control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
1800
                                        control.LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X, currentCanvasDrawingMouseMovePoint.Y);
1801
                                        control.TopRightPoint = new Point(currentCanvasDrawingMouseMovePoint.X, canvasDrawingMouseDownPoint.Y);
1802
                                        control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
1803

    
1804
                                        control.PointSet = new List<Point>
1805
                                        {
1806
                                            control.StartPoint,
1807
                                            control.LeftBottomPoint,
1808
                                            control.EndPoint,
1809
                                            control.TopRightPoint,
1810
                                        };
1811
                                    }
1812
                                    //강인구 추가
1813
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1814
                                    control.Paint = ViewerDataModel.Instance.paintSet;
1815

    
1816
                                }
1817
                            }
1818
                            break;
1819

    
1820
                        case ControlType.PolygonCloud:
1821
                            {
1822
                                var control = currentControl as CloudControl;
1823

    
1824
                                if (control != null)
1825
                                {
1826
                                    control.isTransOn = true;
1827
                                    control.PointSet.RemoveAt(control.PointSet.Count - 1);
1828

    
1829
                                    control.PointSet.Add(currentCanvasDrawingMouseMovePoint);
1830

    
1831
                                    control.SetCloud();
1832
                                    //강인구 추가
1833
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1834
                                    control.Paint = ViewerDataModel.Instance.paintSet;
1835
                                }
1836
                            }
1837
                            break;
1838

    
1839
                        case ControlType.Triangle:
1840
                            {
1841
                                var control = currentControl as TriControl;
1842

    
1843
                                if (control != null)
1844
                                {
1845
                                    if (move.mousemode == MouseMode.Drawing)
1846
                                    {
1847
                                        //move.control_Move(ControlList, true, moveX, moveY);
1848
                                    }
1849
                                    else
1850
                                    {
1851
                                        control.Paint = ViewerDataModel.Instance.paintSet;
1852
                                        control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
1853

    
1854
                                        control.PointSet = new List<Point>
1855
                                            {
1856
                                                control.StartPoint,
1857
                                                control.MidPoint,
1858
                                                control.EndPoint,
1859
                                            };
1860
                                    }
1861
                                    //강인구 추가
1862
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1863
                                    control.Paint = ViewerDataModel.Instance.paintSet;
1864
                                }
1865
                            }
1866
                            break;
1867

    
1868
                        case ControlType.ImgControl:
1869
                            {
1870
                                var control = currentControl as ImgControl;
1871

    
1872
                                if (control != null)
1873
                                {
1874
                                    control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
1875
                                    control.LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X, currentCanvasDrawingMouseMovePoint.Y);
1876
                                    control.TopRightPoint = new Point(currentCanvasDrawingMouseMovePoint.X, canvasDrawingMouseDownPoint.Y);
1877
                                    control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
1878

    
1879
                                    control.PointSet = new List<Point>
1880
                                        {
1881
                                            control.StartPoint,
1882
                                            control.LeftBottomPoint,
1883
                                            control.EndPoint,
1884
                                            control.TopRightPoint,
1885
                                        };
1886
                                }
1887
                            }
1888
                            break;
1889

    
1890
                        case ControlType.Date:
1891
                            {
1892
                                var control = currentControl as DateControl;
1893

    
1894
                                if (control != null)
1895
                                {
1896
                                    control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
1897
                                    control.LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X, currentCanvasDrawingMouseMovePoint.Y);
1898
                                    control.TopRightPoint = new Point(currentCanvasDrawingMouseMovePoint.X, canvasDrawingMouseDownPoint.Y);
1899
                                    control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
1900
                                    //control.Text = DateTime.Now.ToString("yyyy-MM-dd");
1901

    
1902
                                    control.PointSet = new List<Point>
1903
                                        {
1904
                                            control.StartPoint,
1905
                                            control.LeftBottomPoint,
1906
                                            control.EndPoint,
1907
                                            control.TopRightPoint,
1908
                                        };
1909
                                }
1910
                            }
1911
                            break;
1912

    
1913
                        case ControlType.ArrowTextControl:
1914
                            {
1915
                                var control = currentControl as ArrowTextControl;
1916

    
1917
                                if (control != null)
1918
                                {
1919
                                    control.EndPoint = currentCanvasDrawingMouseMovePoint;
1920
                                    Point tempPoint = control.EndPoint;
1921
                                    if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift)
1922
                                    {
1923
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
1924
                                        control.EndPoint = tempPoint;
1925
                                    }
1926
                                    else
1927
                                    {
1928
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false);
1929
                                    }
1930

    
1931
                                    control.PointSet = new List<Point>
1932
                                            {
1933
                                                control.StartPoint,
1934
                                                control.MidPoint,
1935
                                                control.EndPoint,
1936
                                            };
1937
                                }
1938
                            }
1939
                            break;
1940

    
1941
                        case ControlType.ArrowTransTextControl:
1942
                            {
1943
                                var control = currentControl as ArrowTextControl;
1944

    
1945
                                if (control != null)
1946
                                {
1947
                                    control.EndPoint = currentCanvasDrawingMouseMovePoint;
1948
                                    Point tempPoint = control.EndPoint;
1949
                                    if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift)
1950
                                    {
1951
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
1952
                                        control.EndPoint = tempPoint;
1953
                                    }
1954
                                    else
1955
                                    {
1956
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false);
1957
                                    }
1958
                                    control.isFixed = true;
1959

    
1960
                                    control.PointSet = new List<Point>
1961
                                            {
1962
                                                control.StartPoint,
1963
                                                control.MidPoint,
1964
                                                control.EndPoint,
1965
                                            };
1966
                                }
1967
                            }
1968
                            break;
1969

    
1970
                        case ControlType.ArrowTextBorderControl:
1971
                            {
1972
                                var control = currentControl as ArrowTextControl;
1973

    
1974
                                if (control != null)
1975
                                {
1976
                                    control.EndPoint = currentCanvasDrawingMouseMovePoint;
1977
                                    Point tempPoint = control.EndPoint;
1978
                                    if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift)
1979
                                    {
1980
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
1981
                                        control.EndPoint = tempPoint;
1982
                                    }
1983
                                    else
1984
                                    {
1985
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false);
1986
                                    }
1987
                                    control.PointSet = new List<Point>
1988
                                            {
1989
                                                control.StartPoint,
1990
                                                control.MidPoint,
1991
                                                control.EndPoint,
1992
                                            };
1993
                                }
1994

    
1995
                            }
1996
                            break;
1997
                        case ControlType.ArrowTransTextBorderControl:
1998
                            {
1999
                                var control = currentControl as ArrowTextControl;
2000

    
2001
                                if (control != null)
2002
                                {
2003
                                    control.isFixed = true;
2004
                                    control.EndPoint = currentCanvasDrawingMouseMovePoint;
2005
                                    Point tempPoint = control.EndPoint;
2006
                                    if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift)
2007
                                    {
2008
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
2009
                                        control.EndPoint = tempPoint;
2010
                                    }
2011
                                    else
2012
                                    {
2013
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false);
2014
                                    }
2015
                                    control.PointSet = new List<Point>
2016
                                            {
2017
                                                control.StartPoint,
2018
                                                control.MidPoint,
2019
                                                control.EndPoint,
2020
                                            };
2021
                                }
2022

    
2023
                            }
2024
                            break;
2025
                        case ControlType.ArrowTextCloudControl:
2026
                            {
2027
                                var control = currentControl as ArrowTextControl;
2028

    
2029
                                if (control != null)
2030
                                {
2031
                                    control.EndPoint = currentCanvasDrawingMouseMovePoint;
2032
                                    Point tempPoint = control.EndPoint;
2033
                                    if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift)
2034
                                    {
2035
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
2036
                                        control.EndPoint = tempPoint;
2037
                                    }
2038
                                    else
2039
                                    {
2040
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false);
2041
                                    }
2042
                                    control.PointSet = new List<Point>
2043
                                            {
2044
                                                control.StartPoint,
2045
                                                control.MidPoint,
2046
                                                control.EndPoint,
2047
                                            };
2048
                                }
2049

    
2050
                            }
2051
                            break;
2052
                        case ControlType.ArrowTransTextCloudControl:
2053
                            {
2054
                                var control = currentControl as ArrowTextControl;
2055

    
2056
                                if (control != null)
2057
                                {
2058
                                    control.isFixed = true;
2059
                                    control.EndPoint = currentCanvasDrawingMouseMovePoint;
2060
                                    Point tempPoint = control.EndPoint;
2061
                                    if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift)
2062
                                    {
2063
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
2064
                                        control.EndPoint = tempPoint;
2065
                                    }
2066
                                    else
2067
                                    {
2068
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false);
2069
                                    }
2070
                                    control.PointSet = new List<Point>
2071
                                            {
2072
                                                control.StartPoint,
2073
                                                control.MidPoint,
2074
                                                control.EndPoint,
2075
                                            };
2076
                                }
2077

    
2078
                            }
2079
                            break;
2080
                        case ControlType.PolygonControl:
2081
                            {
2082
                                var control = currentControl as PolygonControl;
2083

    
2084
                                if (control != null)
2085
                                {
2086
                                    control.PointSet.RemoveAt(control.PointSet.Count - 1);
2087
                                    control.PointSet.Add(currentCanvasDrawingMouseMovePoint);
2088
                                    control.Paint = ViewerDataModel.Instance.paintSet;
2089
                                    control.SetPolyPath();
2090
                                    //강인구 추가
2091
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
2092
                                    control.Paint = ViewerDataModel.Instance.paintSet;
2093
                                }
2094
                            }
2095
                            break;
2096
                        //강인구 추가
2097
                        case ControlType.Sign:
2098
                            {
2099
                                var control = currentControl as SignControl;
2100

    
2101
                                if (control != null)
2102
                                {
2103
                                    control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
2104
                                    control.LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X, currentCanvasDrawingMouseMovePoint.Y);
2105
                                    control.TopRightPoint = new Point(currentCanvasDrawingMouseMovePoint.X, canvasDrawingMouseDownPoint.Y);
2106
                                    control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
2107

    
2108
                                    if (control.StartPoint != control.EndPoint && control.SignImage == null)
2109
                                    {
2110
                                        GetUserSign getUser = new GetUserSign();
2111
                                        var _sign = getUser.GetSign(App.ViewInfo.UserID, App.ViewInfo.ProjectNO);
2112
                                        byte[] imageBytes = System.Convert.FromBase64String(_sign);
2113
                                        System.IO.MemoryStream stream = new System.IO.MemoryStream();
2114
                                        stream.Write(imageBytes, 0, imageBytes.Length);
2115
                                        stream.Position = 0;
2116
                                        System.Drawing.Image img = System.Drawing.Image.FromStream(stream);
2117
                                        BitmapImage returnImage = new BitmapImage();
2118
                                        returnImage.BeginInit();
2119
                                        System.IO.MemoryStream ms = new System.IO.MemoryStream();
2120
                                        img.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
2121
                                        ms.Seek(0, System.IO.SeekOrigin.Begin);
2122
                                        returnImage.StreamSource = ms;
2123
                                        returnImage.EndInit();
2124
                                        stream.Close();
2125

    
2126
                                        control.SignImage = returnImage;
2127
                                    }
2128
                                    control.PointSet = new List<Point>
2129
                                        {
2130
                                            control.StartPoint,
2131
                                            control.LeftBottomPoint,
2132
                                            control.EndPoint,
2133
                                            control.TopRightPoint,
2134
                                        };
2135
                                }
2136
                            }
2137
                            break;
2138
                        //강인구 추가
2139
                        case ControlType.Symbol:
2140
                            {
2141
                                var control = currentControl as SymControl;
2142

    
2143
                                if (control != null)
2144
                                {
2145
                                    control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
2146
                                    control.LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X, currentCanvasDrawingMouseMovePoint.Y);
2147
                                    control.TopRightPoint = new Point(currentCanvasDrawingMouseMovePoint.X, canvasDrawingMouseDownPoint.Y);
2148
                                    control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
2149
                                    control.LineSize = ViewerDataModel.Instance.LineSize + 3;
2150
                                    control.StrokeColor = new SolidColorBrush(Colors.Red);
2151

    
2152
                                    if (control.StartPoint != control.EndPoint)
2153
                                    {
2154
                                        if (control.PathData == null)
2155
                                        {
2156
                                            using (StringToPathConverter Convert = new StringToPathConverter())
2157
                                            {
2158
                                                control.PathData = Convert.Convert("M-5,5L0,0L20,30L40,-20 ");
2159
                                            }
2160
                                        }
2161
                                    }
2162

    
2163
                                    control.PointSet = new List<Point>
2164
                                        {
2165
                                            control.StartPoint,
2166
                                            control.LeftBottomPoint,
2167
                                            control.EndPoint,
2168
                                            control.TopRightPoint,
2169
                                        };
2170
                                }
2171
                            }
2172
                            break;
2173
                        case ControlType.Stamp:
2174
                            {
2175
                                var control = currentControl as SymControlN;
2176

    
2177
                                if (control != null)
2178
                                {
2179

    
2180
                                    if (control.StartPoint == control.EndPoint)
2181
                                    {
2182
                                        string appovalData = "eJyycS/KTFHwS8xNtVVKBAMlhYrcnLxiW6WMkpICK3394uSM1NzEYr3czOSi/OL8tBK95Pxc/fLMvLQKfSMDAzP9isTcHP2CotTi1LySxJLM/DwlOxuQqXpOicnZ6UX5pXkpdjbB+TmZKc75OflFTkWlxRkKYKatkrIbFCgp+BckJmeWVNoqGegZKino29noYxgSlJpckpiXnpOqEFxSlFqSnGGr5JaZk6ME4uZnp0KNMwACmFBIRmZydl5qMdA7pjAxn8y8VK/8zDxbpSCQsUpQ38MNV1IIz0wpAZptZADU45GamZ5RYqtkYamk4JyYVwYMCZ/UNKCArpGeKVwoJL8AJqIP8T00DILyy11S0zLzMkEBUwz0AjIfbrgWWBt2OWM9U3zSBviljfBJaiGFM7pDQ1IrSpxy8pOzFUAsWyXHgIAg/zBXFyUFt/y8knCoCa4VJUWJTvk5KRDh4MwqYEgaG4B4RamQaEOJFY/8oswqoMLEHMeczPS8XGCSsVVyBpKpRUoKYalFJZnJWKVgTrRVgqQNdNc5VSqkJKbmZOYS4TwjWjrPGBGkMAoAAAD//w==";
2183

    
2184
                                        var xamlData = MarkupToPDF.Serialize.Core.JsonSerializerHelper.UnCompressString_NonPrefix(appovalData);
2185
                                        xamlData = xamlData.Replace("daelim", "DAELIM");
2186

    
2187

    
2188
                                        //object obj = System.Windows.Markup.XamlReader.Load(xamlData);
2189

    
2190
                                        System.IO.MemoryStream stream = new System.IO.MemoryStream();
2191
                                        System.IO.StreamWriter writer = new System.IO.StreamWriter(stream);
2192
                                        writer.Write(xamlData);
2193
                                        writer.Flush();
2194
                                        stream.Position = 0;
2195

    
2196
                                        control.StrokeColor = new SolidColorBrush(Colors.Red);
2197
                                        object obj = System.Windows.Markup.XamlReader.Load(stream);
2198
                                        UIElement ob = obj as UIElement;
2199

    
2200
                                        //control.ApplyTemplate();
2201

    
2202
                                        control.SetViewBox();
2203
                                        control.PathXathData = appovalData;
2204
                                        control.Base_ViewBox.Child = ob;
2205
                                    }
2206

    
2207
                                    control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
2208
                                    control.LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X, currentCanvasDrawingMouseMovePoint.Y);
2209
                                    control.TopRightPoint = new Point(currentCanvasDrawingMouseMovePoint.X, canvasDrawingMouseDownPoint.Y);
2210
                                    control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
2211
                                    //control.LineSize = ViewerDataModel.Instance.LineSize + 3;
2212

    
2213

    
2214
                                    control.PointSet = new List<Point>
2215
                                    {
2216
                                        control.StartPoint,
2217
                                        control.LeftBottomPoint,
2218
                                        control.EndPoint,
2219
                                        control.TopRightPoint,
2220
                                    };
2221
                                }
2222
                            }
2223
                            break;
2224
                        case ControlType.Mark:
2225
                            {
2226
                                var control = currentControl as RectangleControl;
2227

    
2228
                                if (control != null)
2229
                                {
2230
                                    if (move.mousemode == MouseMode.Drawing)
2231
                                    {
2232
                                        //move.control_Move(ControlList, true, moveX, moveY);
2233
                                    }
2234
                                    else
2235
                                    {
2236
                                        control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
2237
                                        control.LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X, currentCanvasDrawingMouseMovePoint.Y);
2238
                                        control.TopRightPoint = new Point(currentCanvasDrawingMouseMovePoint.X, canvasDrawingMouseDownPoint.Y);
2239
                                        control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
2240

    
2241

    
2242
                                        control.PointSet = new List<Point>
2243
                                    {
2244
                                        control.StartPoint,
2245
                                        control.LeftBottomPoint,
2246
                                        control.EndPoint,
2247
                                        control.TopRightPoint,
2248
                                    };
2249
                                    }
2250

    
2251
                                    //강인구 추가
2252
                                    control.Paint = PaintSet.Fill;
2253
                                }
2254
                            }
2255
                            break;
2256
                        case ControlType.PenControl:
2257
                            {
2258
                                stroke.StylusPoints.Add(new StylusPoint(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y));
2259
                                //inkBoard.Strokes.Add(stroke);
2260
                            }
2261
                            break;
2262
                        default:
2263
                            break;
2264
                    }
2265
                }
2266
            }
2267
            else if (mouseButtonDown == MouseButton.Left && mouseHandlingMode == MouseHandlingMode.Selecting || mouseButtonDown == MouseButton.Left && mouseHandlingMode == MouseHandlingMode.Capture)
2268
            {
2269
                Point curMouseDownPoint = e.GetPosition(drawingRotateCanvas);
2270

    
2271
                if (isDraggingSelectionRect)
2272
                {
2273
                    UpdateDragSelectionRect(canvasDrawingMouseDownPoint, curMouseDownPoint);
2274

    
2275
                    e.Handled = true;
2276
                }
2277
                else if (isLeftMouseButtonDownOnWindow)
2278
                {
2279
                    var dragDelta = curMouseDownPoint - canvasDrawingMouseDownPoint;
2280
                    double dragDistance = Math.Abs(dragDelta.Length);
2281

    
2282
                    if (dragDistance > DragThreshold)
2283
                    {
2284
                        isDraggingSelectionRect = true;
2285

    
2286
                        InitDragSelectionRect(canvasDrawingMouseDownPoint, curMouseDownPoint);
2287
                    }
2288

    
2289
                    e.Handled = true;
2290
                }
2291

    
2292

    
2293
                if (canvasDrawingMouseDownPoint == curMouseDownPoint)
2294
                {
2295
                    //SelectionPath = new Path();
2296
                    //PathFigure pathFigure = new PathFigure();
2297
                    //SelectionPath.Fill = new SolidColorBrush(Colors.Yellow);
2298
                    //SelectionPath.Opacity = 0.5;
2299
                    //SelectionPath.StrokeDashArray = new DoubleCollection() { 1 };
2300
                    //SelectionPath.StrokeDashCap = PenLineCap.Round;
2301
                    //SelectionPath.Stroke = new SolidColorBrush(Colors.Black);
2302
                }
2303
                else
2304
                {
2305
                    //List<Stroke> removingStroke = new List<Stroke>();
2306
                    //Rect p1 = new Rect(canvasDrawingMouseDownPoint, curMouseDownPoint);
2307
                    //StrokeCollection stC = new StrokeCollection();
2308
                    //for (int i = 0; i <= inkBoard.Strokes.Count - 1; i++)
2309
                    //{
2310
                    //    Rect p2 = inkBoard.Strokes[i].GetBounds();
2311
                    //    p1.Intersect(p2);
2312
                    //    if (p1.IsEmpty)
2313
                    //    {
2314

    
2315

    
2316
                    //        p1 = SelectionPath.Data.Bounds;
2317
                    //        bool intersectCheck = false;
2318
                    //        foreach (var T in inkBoard.Strokes[i].StylusPoints)
2319
                    //        {
2320
                    //            Rect p3 = new Rect(new Point(T.X, T.Y), new Size(10, 10));
2321
                    //            p1.Intersect(p3);
2322
                    //            if (!p1.IsEmpty)
2323
                    //            {
2324
                    //                intersectCheck = true;
2325
                    //            }
2326
                    //        }
2327
                    //        if (intersectCheck)
2328
                    //        {
2329
                    //            removingStroke.Add(inkBoard.Strokes[i]);
2330
                    //        }
2331

    
2332
                    //    }
2333
                    //    else
2334
                    //    {
2335
                    //        removingStroke.Add(inkBoard.Strokes[i]);
2336
                    //    }
2337
                    //}
2338

    
2339
                    e.Handled = true;
2340
                }
2341
            }
2342
            else if (mouseButtonDown == MouseButton.Left && ViewerDataModel.Instance.MarkupControls_USER.Count > 0)
2343
            {
2344
                var control = ViewerDataModel.Instance.MarkupControls_USER.Where(data => data.IsMouseOver).FirstOrDefault();
2345
                if (control != null)
2346
                {
2347
                    this.cursor = Cursors.Hand;
2348
                    SetCursor();
2349
                }
2350
                else
2351
                {
2352
                    this.cursor = Cursors.Arrow;
2353
                    SetCursor();
2354
                }
2355
            }
2356
            else
2357
            {
2358
                //var hitRect = new Rect(currentCanvasDrawingMouseMovePoint.X - 10, currentCanvasDrawingMouseMovePoint.Y - 10, 20, 20);
2359

    
2360
                //VisualTreeHelper.HitTest(this.drawingRotateCanvas, null, MyCallback,
2361
                //    new GeometryHitTestParameters(new RectangleGeometry(hitRect)));
2362

    
2363
                //if (hitList.Count > 0)
2364
                //{
2365

    
2366
                //}
2367

    
2368
                #region 조건 설정 : firstCondition
2369
                //GeneralTransform generalTransform = this.DeepLayer._BaseLayer.TransformToVisual(Application.Current.RootVisual);
2370
                //pnts = generalTransform.Transform(pnts);
2371
                //Rect areaInAbsoluteCoordinates = new Rect(pnts.X - 10, pnts.Y - 10, 20, 20);
2372
                //var firstCondition = (from kkk in VisualTreeHelper.FindElementsInHostCoordinates(areaInAbsoluteCoordinates,
2373
                //                               this.DeepLayer._BaseLayer).ToObservable()
2374
                //                      where String.IsNullOrEmpty((kkk as FrameworkElement).Name)
2375
                //                      select kkk).FirstOrDefault();
2376

    
2377
                //var canvas = LogicalTreeHelper.FindLogicalNode(this, "drawingRotateCanvas") as Canvas;
2378
                //if (canvas !=null)
2379
                //{
2380
                //    foreach (var item in (canvas.Children[0] as ItemsControl).Items)
2381
                //    {
2382
                //        UIElement uiElement = (UIElement)(canvas.Children[0] as ItemsControl).ItemContainerGenerator.ContainerFromItem(item);
2383
                //        if (uiElement!=null)
2384
                //        {
2385
                //            uiElement.InputHitTest(currentCanvasDrawingMouseMovePoint).
2386
                //        }
2387
                //    }
2388
                //}
2389

    
2390
                //EllipseGeometry expandedHitTestArea = new EllipseGeometry(currentCanvasDrawingMouseMovePoint, 10.0, 10.0);
2391
                //hitResultsList.Clear();
2392

    
2393
                #endregion
2394
            }
2395
        }
2396

    
2397
        //private void Point_StateChanged(object sender, MyEventArgs e)
2398
        //{
2399
        //    //if (e.isMouseOver)
2400
        //    //{
2401
        //    //    this.cursor = Cursors.Hand;
2402
        //    //}
2403
        //    //else
2404
        //    //{
2405
        //    //    this.cursor = Cursors.Arrow;
2406
        //    //    (sender as CommentUserInfo).StateChanged -= Point_StateChanged;
2407
        //    //}
2408
        //}
2409
        private List<CommentUserInfo> hitList = new List<CommentUserInfo>();
2410

    
2411
        private EllipseGeometry hitArea = new EllipseGeometry();
2412

    
2413
        private void zoomAndPanControl_MouseUp(object sender, MouseButtonEventArgs e)
2414
        {
2415
            IsDrawing = false;
2416

    
2417
            if (mouseHandlingMode != MouseHandlingMode.None)
2418
            {
2419
                if (mouseHandlingMode == MouseHandlingMode.Drawing)
2420
                {
2421
                    this.cursor = Cursors.Arrow;
2422

    
2423
                    SetCursor();
2424

    
2425
                    switch (controlType)
2426
                    {
2427
                        case ControlType.None:
2428
                            break;
2429
                        case ControlType.Rectangle:
2430
                            {
2431

    
2432
                            }
2433
                            break;
2434
                        case ControlType.PenControl:
2435
                            {
2436

    
2437
                            }
2438
                            break;
2439
                        default:
2440
                            break;
2441
                    }
2442
                }
2443
                else if (mouseHandlingMode == MouseHandlingMode.Selecting && e.ChangedButton == MouseButton.Left || mouseHandlingMode == MouseHandlingMode.Capture && e.ChangedButton == MouseButton.Left)
2444
                {
2445
                    if (isLeftMouseButtonDownOnWindow)
2446
                    {
2447
                        bool wasDragSelectionApplied = false;
2448

    
2449
                        if (isDraggingSelectionRect)
2450
                        {
2451
                            if (mouseHandlingMode == MouseHandlingMode.Capture)
2452
                            {
2453
                                dragCaptureBorder.Visibility = Visibility.Collapsed;
2454
                                mouseHandlingMode = MouseHandlingMode.None;
2455
                                Set_Capture();
2456

    
2457
                                ViewerDataModel.Instance.ViewVisible = Visibility.Collapsed;
2458
                                ViewerDataModel.Instance.ViewVisible = Visibility.Visible;
2459
                                ViewerDataModel.Instance.Capture_Opacity = 0;
2460
                            }
2461

    
2462
                            isDraggingSelectionRect = false;
2463
                            if (mouseHandlingMode == MouseHandlingMode.Selecting)
2464
                            {
2465
                                ApplyDragSelectionRect();
2466
                            }
2467

    
2468
                            e.Handled = true;
2469
                            wasDragSelectionApplied = true;
2470
                        }
2471

    
2472
                        if (isLeftMouseButtonDownOnWindow)
2473
                        {
2474
                            isLeftMouseButtonDownOnWindow = false;
2475
                            this.ReleaseMouseCapture();
2476
                            e.Handled = true;
2477
                        }
2478

    
2479
                        if (!wasDragSelectionApplied)
2480
                        {
2481
                            init();
2482
                        }
2483
                    }
2484
                }
2485
                else if (mouseButtonDown == MouseButton.Right)
2486
                {
2487
                    this.cursor = Cursors.Arrow;
2488
                    SetCursor();
2489
                }
2490

    
2491
                zoomAndPanControl.ReleaseMouseCapture();
2492

    
2493

    
2494
                e.Handled = true;
2495
            }
2496
            else
2497
            {
2498
                this.cursor = Cursors.Arrow;
2499
                SetCursor();
2500
            }
2501
            mouseButtonDown = MouseButton.Left;
2502

    
2503
            //controlType = ControlType.SingleLine;
2504
        }
2505

    
2506
        private void zoomAndPanControl_MouseLeave(object sender, MouseEventArgs e)
2507
        {
2508
            mouseButtonDown = MouseButton.Left;
2509
            this.Cursor = Cursors.Arrow;
2510
        }
2511

    
2512
        private void zoomAndPanControl_MouseDoubleClick(object sender, MouseButtonEventArgs e)
2513
        {
2514

    
2515
        }
2516

    
2517
        private void ApplyDragSelectionRect()
2518
        {
2519
            multi_Undo_Data = new Multi_Undo_data();
2520

    
2521
            UndoData = new Undo_data()
2522
            {
2523
                IsUndo = false,
2524
                Event = Event_Type.Select,
2525
                EventTime = DateTime.Now,
2526
                Markup_List = new List<Multi_Undo_data>()
2527
            };
2528

    
2529
            dragSelectionBorder.Visibility = Visibility.Collapsed;
2530

    
2531
            double x = Canvas.GetLeft(dragSelectionBorder);
2532
            double y = Canvas.GetTop(dragSelectionBorder);
2533
            double width = dragSelectionBorder.Width;
2534
            double height = dragSelectionBorder.Height;
2535
            Rect dragRect = new Rect(x, y, width, height);
2536
            Boolean Flag = false;
2537
            dragRect.Inflate(width / 10, height / 10);
2538
            List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>();
2539
            var Items = ViewerDataModel.Instance.MarkupControls_USER.ToList();
2540

    
2541

    
2542

    
2543

    
2544
            //#region 잉크 불필요
2545

    
2546
            ////#region Ink Canvas Select
2547
            //List<Stroke> removingStroke = new List<Stroke>();
2548
            //StrokeCollection stC = new StrokeCollection();
2549

    
2550

    
2551
            //for (int i = 0; i <= inkBoard.Strokes.Count - 1; i++)
2552
            //{
2553
            //    dragRect = new Rect(x, y, width, height);
2554
            //    dragRect.Inflate(width / 10, height / 10);
2555

    
2556
            //    Rect p2 = inkBoard.Strokes[i].GetBounds();
2557
            //    dragRect.Intersect(p2);
2558
            //    if (dragRect.IsEmpty)
2559
            //    {
2560
            //        //dragRect = SelectionPath.Data.Bounds;
2561
            //        bool intersectCheck = false;
2562
            //        foreach (var T in inkBoard.Strokes[i].StylusPoints)
2563
            //        {
2564
            //            Rect p3 = new Rect(new Point(T.X, T.Y), new Size(10, 10));
2565
            //            dragRect.Intersect(p3);
2566
            //            if (!dragRect.IsEmpty)
2567
            //            {
2568
            //                intersectCheck = true;
2569
            //            }
2570
            //        }
2571
            //        if (intersectCheck)
2572
            //        {
2573
            //            removingStroke.Add(inkBoard.Strokes[i]);
2574
            //        }
2575
            //    }
2576
            //    else
2577
            //    {
2578
            //        removingStroke.Add(inkBoard.Strokes[i]);
2579
            //    }
2580
            //}
2581

    
2582
            //InkToPath ip = new InkToPath();
2583
            //List<Point> inkPointSet = new List<Point>();
2584
            //PolygonControl pc = null;
2585
            ////InkControl pc = null;
2586
            ////pc = new InkControl()
2587
            //pc = new PolygonControl()
2588
            //{
2589
            //    //PointC = new List<StylusPointSet>(),
2590
            //    Angle = 0,
2591
            //    StartPoint = dragRect.TopLeft,
2592
            //    EndPoint = dragRect.BottomRight,
2593
            //    PointSet = new List<Point>(),
2594
            //    CommentID = Save.shortGuid(),
2595
            //    ControlType = ControlType.Ink,
2596
            //};
2597
            //foreach (var item in removingStroke)
2598
            //{
2599
            //    //pc.PointC.Add(new StylusPointSet() { pointSet = ip.StrokeGetPointsPlus(item) });
2600
            //    inkPointSet.AddRange(ip.StrokeGetPointsPlus(item));
2601
            //    inkBoard.Strokes.Remove(item);
2602
            //}
2603
            //if (inkPointSet.Count != 0)
2604
            //{
2605
            //    pc.StartPoint = inkPointSet[0];
2606
            //    pc.EndPoint = inkPointSet[inkPointSet.Count - 1];
2607
            //    pc.PointSet = inkPointSet;
2608
            //    pc.LineSize = 3;
2609
            //    //pc.StrokeColor = new SolidColorBrush(MarkupToPDF.Controls.Common.ValueConverter.StringToColorConverter.Parse("ff18b7fc"));
2610
            //    pc.StrokeColor = new SolidColorBrush(Colors.Red);
2611
            //    ViewerDataModel.Instance.MarkupControls_USER.Add(pc);
2612
            //    pc.SetPolyPath();
2613

    
2614
            //    adornerSet.Add(pc);
2615
            //    ViewerDataModel.Instance.MarkupControls_USER.Remove(pc);
2616

    
2617
            //    //Controls.AdornerFinal final = new Controls.AdornerFinal(adornerSet);
2618
            //    //SelectLayer.Children.Add(final);
2619
            //}
2620
            ////#endregion 
2621
            //#endregion
2622

    
2623

    
2624
            dragRect = new Rect(x, y, width, height);
2625
            dragRect.Inflate(width / 10, height / 10);
2626

    
2627
            foreach (var item in Items)
2628
            {
2629
                //switch ((item as IMarkupCommonData).ControlType)
2630
                //{
2631
                //case ControlType.Rectangle:
2632
                //    {
2633
                //var rectangleControl = (item as RectangleControl);
2634
                //Flag = move.control_Select(rectangleControl,  dragRect);
2635
                Flag = move.control_Select(item, dragRect);
2636

    
2637
                if (Flag)
2638
                {
2639
                    adornerSet.Add(item);
2640
                    ViewerDataModel.Instance.MarkupControls_USER.Remove(item);
2641

    
2642
                    Control_Style(item);
2643
                    UndoData.Markup_List.Add(multi_Undo_Data);
2644
                    multi_Undo_Data = new Multi_Undo_data();
2645

    
2646
                    //SelectLayer.Children.Add(final);
2647
                }
2648
                //}
2649
                //break;
2650
                //}
2651
            }
2652
            if (adornerSet.Count > 0)
2653
            {
2654
                ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
2655
                {
2656
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
2657
                });
2658
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
2659

    
2660
                Controls.AdornerFinal final = new Controls.AdornerFinal(adornerSet);
2661
                SelectLayer.Children.Add(final);
2662
                //mouseHandlingMode = MouseHandlingMode.Adorner;
2663
            }
2664
        }
2665

    
2666
        private void InitDragSelectionRect(Point pt1, Point pt2)
2667
        {
2668
            //선택 중
2669
            if (mouseHandlingMode == MouseHandlingMode.Selecting)
2670
            {
2671
                dragSelectionBorder.Visibility = Visibility.Visible;
2672
            }
2673
            //캡쳐 중
2674
            else
2675
            {
2676
                dragCaptureBorder.Visibility = Visibility.Visible;
2677
            }
2678
            UpdateDragSelectionRect(pt1, pt2);
2679
        }
2680

    
2681
        /// <summary>
2682
        /// Update the position and size of the rectangle used for drag selection.
2683
        /// </summary>
2684
        private void UpdateDragSelectionRect(Point pt1, Point pt2)
2685
        {
2686
            double x, y, width, height;
2687

    
2688
            //
2689
            // Determine x,y,width and height of the rect inverting the points if necessary.
2690
            // 
2691

    
2692
            if (pt2.X < pt1.X)
2693
            {
2694
                x = pt2.X;
2695
                width = pt1.X - pt2.X;
2696
            }
2697
            else
2698
            {
2699
                x = pt1.X;
2700
                width = pt2.X - pt1.X;
2701
            }
2702

    
2703
            if (pt2.Y < pt1.Y)
2704
            {
2705
                y = pt2.Y;
2706
                height = pt1.Y - pt2.Y;
2707
            }
2708
            else
2709
            {
2710
                y = pt1.Y;
2711
                height = pt2.Y - pt1.Y;
2712
            }
2713

    
2714

    
2715
            //
2716
            // Update the coordinates of the rectangle used for drag selection.
2717
            //
2718
            //선택 중
2719
            if (mouseHandlingMode == MouseHandlingMode.Selecting)
2720
            {
2721
                Canvas.SetLeft(dragSelectionBorder, x);
2722
                Canvas.SetTop(dragSelectionBorder, y);
2723
                dragSelectionBorder.Width = width;
2724
                dragSelectionBorder.Height = height;
2725
            }
2726
            //캡쳐 중
2727
            else
2728
            {
2729
                Canvas.SetLeft(dragCaptureBorder, x);
2730
                Canvas.SetTop(dragCaptureBorder, y);
2731
                dragCaptureBorder.Width = width;
2732
                dragCaptureBorder.Height = height;
2733
            }
2734

    
2735
            //System.Diagnostics.Debug.WriteLine("x : {0},  y : {1} , Width : {2}, Height : {3} ", x, y, width,height);
2736
        }
2737

    
2738
        public bool IsSelectionControl(Rect dragRect, Rect controlRect, Geometry OverViewPathData, ControlType type)
2739
        {
2740
            //// X, Y, WIDTH, HEIGHT 형태로 RECT를 만든다.
2741

    
2742
            bool result = false;
2743
            if (dragRect.Contains(controlRect))
2744
            {
2745
                result = true;
2746
                //잡은 객체들을 담은 리스트
2747
                //selected_item.Add(OverViewPathData, type);
2748
                try
2749
                {
2750
                    //controlType = type;
2751
                    selected_item.Add(OverViewPathData, type.ToString());
2752
                }
2753
                catch (Exception)
2754
                {
2755

    
2756
                }
2757
                //listBox.Items.Add(OverViewPathData, commonData.ControlType.ToString());
2758
                //listBox.SelectedItems.Add(rectangleViewModel);
2759
            }
2760
            return result;
2761
        }
2762

    
2763
        private void drawingPannelRotate(double angle)
2764
        {
2765
            rotate.Angle = angle;
2766
            var rotationNum = Math.Abs((rotate.Angle / 90));
2767

    
2768
            if (angle == 90 || angle == 270)
2769
            {
2770
                double emptySize = zoomAndPanCanvas.Width;
2771
                zoomAndPanCanvas.Width = zoomAndPanCanvas.Height;
2772
                zoomAndPanCanvas.Height = emptySize;
2773
            }
2774
            if (angle == 0)
2775
            {
2776
                translate.X = 0;
2777
                translate.Y = 0;
2778
            }
2779
            else if (angle == 90)
2780
            {
2781
                translate.X = zoomAndPanCanvas.Width;
2782
                translate.Y = 0;
2783
            }
2784
            else if (angle == 180)
2785
            {
2786
                translate.X = zoomAndPanCanvas.Width;
2787
                translate.Y = zoomAndPanCanvas.Height;
2788
            }
2789
            else
2790
            {
2791
                translate.X = 0;
2792
                translate.Y = zoomAndPanCanvas.Height;
2793
            }
2794

    
2795
            zoomAndPanControl.RotationAngle = rotate.Angle;
2796
            //회전 잠시 대기(강인구)
2797
            //_imageViewer.RotateAngle = rotate.Angle;
2798

    
2799
            //RotateTransform rotateTransform = new RotateTransform(rotate.Angle);
2800
            //_imageViewer1.RenderTransform = rotateTransform;
2801

    
2802
            if (!testPanel2.IsHidden)
2803
            {
2804
                zoomAndPanControl2.RotationAngle = rotate.Angle;
2805
                //회전 잠시 대기(강인구)
2806
                //_imageViewer_Compare.RotateAngle = rotate.Angle;
2807

    
2808
                //_imageViewer_Compare.RenderTransform = rotateTransform;
2809

    
2810
                zoomAndPanCanvas2.Width = zoomAndPanCanvas.Width;
2811
                zoomAndPanCanvas2.Height = zoomAndPanCanvas.Height;
2812
            }
2813

    
2814
            ViewerDataModel.Instance.ContentWidth = zoomAndPanCanvas.Width;
2815
            ViewerDataModel.Instance.ContentHeight = zoomAndPanCanvas.Height;
2816
            ViewerDataModel.Instance.AngleOffsetX = translate.X;
2817
            ViewerDataModel.Instance.AngleOffsetY = translate.Y;
2818
            ViewerDataModel.Instance.Angle = rotate.Angle;
2819

    
2820

    
2821
        }
2822

    
2823
        private void zoomAndPanControl_MouseDown(object sender, MouseButtonEventArgs e)
2824
        {
2825
            InkControl_Convert();
2826

    
2827
            var text_item = ViewerDataModel.Instance.MarkupControls_USER.Where(data =>
2828
            (data as TextControl) != null && (data as TextControl).Text == "" || (data as ArrowTextControl) != null && (data as ArrowTextControl).ArrowText == "").FirstOrDefault();
2829

    
2830
            if(text_item != null && (currentControl as ArrowTextControl) == null)
2831
            {
2832
                ViewerDataModel.Instance.MarkupControls_USER.Remove(text_item);
2833
            }
2834

    
2835
            foreach (var arrow_text in ViewerDataModel.Instance.MarkupControls_USER)
2836
            {
2837
                if (arrow_text as ArrowTextControl != null)
2838
                {
2839
                    (arrow_text as ArrowTextControl).Base_TextBox.IsHitTestVisible = false;
2840
                    //(arrow_text as ArrowTextControl).Base_TextBox.Focusable = true;
2841
                }
2842
            }
2843

    
2844
            if(currentControl == null)
2845
            {
2846
                var text_item_ = ViewerDataModel.Instance.MarkupControls_USER.Where(data => (data as TextControl) != null && (data as TextControl).Base_TextBox.Visibility == Visibility.Visible).FirstOrDefault();
2847
                if (text_item_ != null)
2848
                {
2849
                    (text_item_ as TextControl).Base_TextBlock.Visibility = Visibility.Visible;
2850
                    (text_item_ as TextControl).Base_TextBox.Visibility = Visibility.Collapsed;
2851
                    (text_item_ as TextControl).IsEditing = false;
2852
                    (text_item_ as TextControl).EnableEditing = false;
2853
                }
2854

    
2855
                var Arrowtext_item_ = ViewerDataModel.Instance.MarkupControls_USER.Where(data => (data as ArrowTextControl) != null && (data as ArrowTextControl).IsEditingMode == true).FirstOrDefault();
2856
                if (Arrowtext_item_ != null)
2857
                {
2858
                    //(text_item_ as ArrowTextControl).Base_TextBlock.Visibility = Visibility.Visible;
2859
                    //(text_item_ as ArrowTextControl).Base_TextBox.Visibility = Visibility.Collapsed;
2860
                    //(Arrowtext_item_ as ArrowTextControl).IsEditing = false;
2861
                    //(Arrowtext_item_ as ArrowTextControl).EnableEditing = false;
2862
                    //(Arrowtext_item_ as ArrowTextControl).Base_TextBox.Focusable = false;
2863

    
2864
                    (Arrowtext_item_ as ArrowTextControl).IsEditingMode = false;
2865
                    (Arrowtext_item_ as ArrowTextControl).Base_TextBox.Focusable = false;
2866
                }
2867
            }
2868

    
2869

    
2870
            if (currentControl != null && currentControl.GetType().Name == "TextControl")
2871
            {
2872
                //(currentControl as TextControl).Base_TextBlock.Visibility = System.Windows.Visibility.Visible;
2873
                //(currentControl as TextControl).Base_TextBox.Visibility = System.Windows.Visibility.Collapsed;
2874
                //(currentControl as TextControl).IsEditing = false;
2875
                //(currentControl as TextControl).EnableEditing = false;
2876
                //currentControl = null;
2877
            }
2878

    
2879
            double Ang = 0;
2880
            if (rotate.Angle != 0)
2881
            {
2882
                Ang = 360 - rotate.Angle;
2883
            }
2884

    
2885
            move = new Move();
2886

    
2887
            //if (e.OriginalSource is Canvas)
2888
            //{
2889
            //    (e.OriginalSource as Canvas).Focus();
2890
            //}
2891

    
2892
            if (e.OriginalSource is System.Windows.Controls.Image)
2893
            {
2894
                (e.OriginalSource as System.Windows.Controls.Image).Focus();
2895
            }
2896

    
2897
            mouseButtonDown = e.ChangedButton;
2898
            if (mouseButtonDown == MouseButton.Left)
2899
            {
2900
                canvasDrawingMouseDownPoint = e.GetPosition(drawingRotateCanvas);
2901
                canvasZoomPanningMouseDownPoint = e.GetPosition(zoomAndPanCanvas);
2902

    
2903
                this.cursor = Cursors.Arrow;
2904
                SetCursor();
2905

    
2906
                if (!ViewerDataModel.Instance.IsPressCtrl)
2907
                {
2908
                    ReleaseAdorner();
2909
                }
2910
            }
2911
            if (mouseButtonDown == MouseButton.Middle)
2912
            {
2913
                canvasZoommovingMouseDownPoint = e.GetPosition(zoomAndPanCanvas);
2914
                cursor = Cursors.SizeAll;
2915
                SetCursor();
2916
            }
2917
            if (mouseButtonDown == MouseButton.Right)
2918
            {
2919
                canvasZoommovingMouseDownPoint = e.GetPosition(zoomAndPanCanvas);
2920
                cursor = Cursors.SizeAll;
2921
                SetCursor();
2922
            }
2923
            else if (mouseButtonDown == MouseButton.XButton1)
2924
            {
2925
                if (this.pageNavigator.CurrentPage.PageNumber + 1 <= this.pageNavigator.PageCount)
2926
                {
2927
                    this.pageNavigator.GotoPage(this.pageNavigator._NextPage.PageNumber + 1);
2928
                }
2929

    
2930
                this.pageNavigator.GotoPage(this.pageNavigator._NextPage.PageNumber);
2931

    
2932
            }
2933
            else if (mouseButtonDown == MouseButton.XButton2)
2934
            {
2935
                if (this.pageNavigator.CurrentPage.PageNumber > 1)
2936
                {
2937
                    this.pageNavigator.GotoPage(this.pageNavigator.CurrentPage.PageNumber - 1);
2938
                }
2939
            }
2940

    
2941
            //캡쳐 모드 설정
2942
            if (mouseHandlingMode == MouseHandlingMode.Capture && mouseButtonDown == MouseButton.Left)
2943
            {
2944
                dragCaptureBorder.Visibility = Visibility.Visible;
2945
                isLeftMouseButtonDownOnWindow = true;
2946
            }
2947

    
2948
            if (mouseButtonDown == MouseButton.Left && ViewerDataModel.Instance.MarkupControls_USER.Count > 0 && mouseHandlingMode != MouseHandlingMode.Drawing && currentControl == null)
2949
            {
2950

    
2951
                if (mouseHandlingMode == MouseHandlingMode.Selecting)
2952
                {
2953
                    if (SelectLayer.Children.Count == 0)
2954
                    {
2955
                        isLeftMouseButtonDownOnWindow = true;
2956
                        mouseHandlingMode = MouseHandlingMode.Selecting;
2957
                    }
2958

    
2959
                    if (controlType == ControlType.None)
2960
                    {
2961
                        isLeftMouseButtonDownOnWindow = true;
2962
                    }
2963
                }
2964

    
2965

    
2966
                var control = ViewerDataModel.Instance.MarkupControls_USER.Where(data => data.IsMouseOver).FirstOrDefault();
2967
                if (control != null)
2968
                {
2969
                    //강인구 추가 컨트롤 누르고 멀티 선택(다시확인필요)
2970
                    AdornerFinal final;
2971
                    List<Point> p_set = new List<Point>();
2972
                    List<CommentUserInfo> comment = new List<CommentUserInfo>();
2973
                    ViewerDataModel.Instance.MarkupControls.Remove(control);
2974
                    ViewerDataModel.Instance.MarkupControls_USER.Remove(control);
2975
                    multi_Undo_Data = new Multi_Undo_data();
2976

    
2977
                    //강인구 Undo/Redo 보류
2978
                    UndoData = new Undo_data()
2979
                    {
2980
                        IsUndo = false,
2981
                        Event = Event_Type.Select,
2982
                        EventTime = DateTime.Now,
2983
                        Markup_List = new List<Multi_Undo_data>()
2984
                    };
2985

    
2986
                    if (!ViewerDataModel.Instance.IsPressCtrl)
2987
                    {
2988
                        ReleaseAdorner();
2989
                        final = new AdornerFinal(control);
2990
                        //단일 컨트롤 언두 저장
2991

    
2992
                        Control_Style(control);
2993
                        UndoData.Markup_List.Add(multi_Undo_Data);
2994

    
2995
                        if ((control as IPath) != null)
2996
                        {
2997
                            if ((control as IPath).LineSize != 0)
2998
                            {
2999
                                ViewerDataModel.Instance.LineSize = (control as IPath).LineSize;
3000
                            }
3001
                        }
3002
                        if ((control as IShapeControl) != null)
3003
                        {
3004
                            if ((control as IShapeControl).Paint == PaintSet.Hatch)
3005
                            {
3006
                                ViewerDataModel.Instance.checkHatchShape = true;
3007
                            }
3008
                            else if ((control as IShapeControl).Paint == PaintSet.Fill)
3009
                            {
3010
                                ViewerDataModel.Instance.checkFillShape = true;
3011
                            }
3012
                            else
3013
                            {
3014
                                ViewerDataModel.Instance.checkHatchShape = false;
3015
                                ViewerDataModel.Instance.checkFillShape = false;
3016
                            }
3017
                            ViewerDataModel.Instance.paintSet = (control as IShapeControl).Paint;
3018
                        }
3019
                        //SelectLayer.Children.Add(final);
3020
                        if ((control as IPath) != null)
3021
                        {
3022
                            if ((control as IPath).LineSize != 0)
3023
                            {
3024
                                ViewerDataModel.Instance.LineSize = (control as IPath).LineSize;
3025
                            }
3026
                        }
3027
                        ViewerDataModel.Instance.ControlOpacity = control.Opacity;
3028
                    }
3029
                    else
3030
                    {
3031
                        comment = AddAdorner();
3032
                        comment.Add(control);
3033

    
3034
                        Control_Style(control);
3035
                        UndoData.Markup_List.Add(multi_Undo_Data);
3036

    
3037
                        final = new AdornerFinal(comment);
3038
                        //다중 컨트롤 언두 저장
3039
                    }
3040

    
3041
                    ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
3042
                    {
3043
                        ViewerDataModel.Instance.UndoDataList.Remove(i);
3044
                    });
3045

    
3046
                    ViewerDataModel.Instance.UndoDataList.Add(UndoData);
3047

    
3048
                    SelectLayer.Children.Add(final);
3049

    
3050
                    //Control_Init(control);
3051

    
3052

    
3053
                    
3054

    
3055

    
3056
                    //강인구 폰트 변경 보류
3057

    
3058
                    //if ((currentControl as TextControl) != null)
3059
                    //{
3060
                    //    if ((control as TextControl).TextStyle == FontStyles.Italic)
3061
                    //    {
3062
                    //        ViewerDataModel.Instance.checkTextStyle = true;
3063
                    //    }
3064
                    //    else
3065
                    //    {
3066
                    //        ViewerDataModel.Instance.checkTextStyle = false;
3067
                    //    }
3068

    
3069
                    //    if((currentControl as TextControl).TextStyle == FontStyles.Italic)
3070
                    //    {
3071

    
3072
                    //    }
3073
                    //    if((currentControl as TextControl).TextWeight == FontWeights.Heavy)
3074
                    //    {
3075

    
3076
                    //    }
3077
                    //    if((currentControl as TextControl).UnderLine == TextDecorations.Underline)
3078
                    //    {
3079

    
3080
                    //    }
3081
                    //}
3082
                    //else if ((currentControl as ArrowTextControl) != null)
3083
                    //{
3084
                    //    if (this.ParentOfType<MainWindow>().dzTopMenu.btnItalic.IsChecked == true)
3085
                    //    {
3086
                    //        (currentControl as ArrowTextControl).TextStyle = FontStyles.Italic;
3087
                    //    }
3088
                    //    if (this.ParentOfType<MainWindow>().dzTopMenu.btnBold.IsChecked == true)
3089
                    //    {
3090
                    //        (currentControl as ArrowTextControl).TextWeight = FontWeights.Heavy;
3091
                    //    }
3092
                    //    if (this.ParentOfType<MainWindow>().dzTopMenu.btnUnderLine.IsChecked == true)
3093
                    //    {
3094
                    //        (currentControl as ArrowTextControl).UnderLine = TextDecorations.Underline;
3095
                    //    }
3096
                    //}
3097

    
3098
                    mouseHandlingMode = MouseHandlingMode.Adorner;
3099
                }
3100
            }
3101

    
3102
            else if (mouseHandlingMode == MouseHandlingMode.Drawing)
3103
            {
3104
                init();
3105
                //강인구 추가(우 클릭 일 경우 커서 변경 하지 않음)
3106
                if (cursor != Cursors.SizeAll)
3107
                {
3108
                    cursor = Cursors.Cross;
3109
                    SetCursor();
3110
                }
3111
                //currentControl.IsNew = true;
3112
                bool init_user = false;
3113
                foreach (var user in gridViewMarkup.Items)
3114
                {
3115
                    if ((user as MarkupInfoItem).UserID == App.ViewInfo.UserID)
3116
                    {
3117
                        init_user = true;
3118
                    }
3119
                }
3120
                if (init_user && gridViewMarkup.SelectedItems.Where(d => (d as MarkupInfoItem).UserID == App.ViewInfo.UserID).FirstOrDefault() == null && e.LeftButton == MouseButtonState.Pressed)
3121
                //if (PreviewUserMarkupInfoItem == null && gridViewMarkup.SelectedItems.Where(d => (d as MarkupInfoItem).UserID == App.ViewInfo.UserID).FirstOrDefault() == null && e.LeftButton == MouseButtonState.Pressed)
3122
                //if (PreviewUserMarkupInfoItem == null && gridViewMarkup.SelectedItems.Where(d => (d as MarkupInfoItem).UserID == App.ViewInfo.UserID).FirstOrDefault() == null)
3123
                {
3124
                    RadWindow.Alert(new DialogParameters
3125
                    {
3126
                        Theme = new VisualStudio2013Theme(),
3127
                        Header = "안내",
3128
                        Content = "기존의 코멘트가 존재합니다. 사용자 리스트에서 먼저 선택해주세요",
3129
                    });
3130
                    return;
3131
                }
3132
                else
3133
                {
3134
                    var item = gridViewMarkup.SelectedItems.Where(d => (d as MarkupInfoItem).UserID == App.ViewInfo.UserID).FirstOrDefault() as MarkupInfoItem;
3135
                    if (item != null)
3136
                    {
3137
                        App.Custom_ViewInfoId = item.MarkupInfoID;
3138
                    }
3139
                }
3140

    
3141
                multi_Undo_Data = new Multi_Undo_data();
3142
                //강인구 Undo/Redo 보류
3143
                UndoData = new Undo_data()
3144
                {
3145
                    IsUndo = false,
3146
                    Event = Event_Type.Create,
3147
                    EventTime = DateTime.Now,
3148
                    Markup_List = new List<Multi_Undo_data>()
3149
                };
3150

    
3151
                switch (controlType)
3152
                {
3153
                    case ControlType.Rectangle:
3154
                        {
3155
                            if (mouseButtonDown == MouseButton.Left)
3156
                            {
3157
                                if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3158
                                {
3159
                                    if (currentControl is RectangleControl)
3160
                                    {
3161
                                        CreateControl();
3162

    
3163
                                        (currentControl as RectangleControl).ApplyOverViewData();
3164
                                        currentControl = null;
3165
                                        this.cursor = Cursors.Arrow;
3166
                                    }
3167
                                    else
3168
                                    {
3169
                                        currentControl = new RectangleControl
3170
                                        {
3171
                                            Background = new SolidColorBrush(Colors.Black),
3172
                                            ControlType = ControlType.Rectangle
3173
                                        };
3174

    
3175
                                        currentControl.CommentID = Save.shortGuid();
3176
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3177
                                        currentControl.IsNew = true;
3178
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3179

    
3180
                                        currentControl.SetValue(Canvas.ZIndexProperty, 3);
3181
                                    }
3182
                                }
3183
                            }
3184
                        }
3185
                        break;
3186
                    case ControlType.RectCloud:
3187
                        {
3188
                            if (mouseButtonDown == MouseButton.Left)
3189
                            {
3190
                                if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3191
                                {
3192
                                    if (currentControl is RectCloudControl)
3193
                                    {
3194
                                        CreateControl();
3195

    
3196
                                        (currentControl as RectCloudControl).ApplyOverViewData();
3197
                                        //controlType = ControlType.None;
3198
                                        currentControl = null;
3199
                                        //mouseHandlingMode = MouseHandlingMode.Selecting;
3200
                                        this.cursor = Cursors.Arrow;
3201
                                    }
3202
                                    else
3203
                                    {
3204
                                        currentControl = new RectCloudControl
3205
                                        {
3206
                                            Background = new SolidColorBrush(Colors.Black)
3207
                                        };
3208

    
3209
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3210
                                        currentControl.CommentID = Save.shortGuid();
3211
                                        currentControl.IsNew = true;
3212
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3213
                                    }
3214
                                }
3215
                            }
3216
                        }
3217
                        break;
3218
                    case ControlType.Circle:
3219
                        {
3220
                            if (mouseButtonDown == MouseButton.Left)
3221
                            {
3222
                                if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3223
                                {
3224
                                    if (currentControl is CircleControl)
3225
                                    {
3226
                                        CreateControl();
3227

    
3228
                                        (currentControl as CircleControl).ApplyOverViewData();
3229
                                        //controlType = ControlType.None;
3230
                                        currentControl = null;
3231
                                    }
3232
                                    else
3233
                                    {
3234
                                        currentControl = new CircleControl
3235
                                        {
3236
                                            Background = new SolidColorBrush(Colors.Black)
3237
                                        };
3238

    
3239
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3240
                                        currentControl.CommentID = Save.shortGuid();
3241
                                        currentControl.IsNew = true;
3242
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3243
                                    }
3244
                                }
3245
                            }
3246
                        }
3247
                        break;
3248
                    case ControlType.Triangle:
3249
                        {
3250
                            if (mouseButtonDown == MouseButton.Left)
3251
                            {
3252
                                if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3253
                                {
3254
                                    if (currentControl is TriControl)
3255
                                    {
3256
                                        var content = currentControl as TriControl;
3257
                                        if (content.MidPoint == new Point(0, 0))
3258
                                        {
3259
                                            content.MidPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
3260
                                        }
3261
                                        else
3262
                                        {
3263
                                            CreateControl();
3264

    
3265
                                            (currentControl as TriControl).ApplyOverViewData();
3266
                                            //controlType = ControlType.None;
3267
                                            currentControl = null;
3268
                                        }
3269
                                    }
3270
                                    else
3271
                                    {
3272
                                        currentControl = new TriControl
3273
                                        {
3274
                                            StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y),
3275
                                            Background = new SolidColorBrush(Colors.Black),
3276
                                        };
3277

    
3278
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3279
                                        currentControl.CommentID = Save.shortGuid();
3280
                                        currentControl.IsNew = true;
3281
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3282
                                    }
3283
                                }
3284
                            }
3285
                        }
3286
                        break;
3287
                    case ControlType.SingleLine:
3288
                        {
3289
                            if (mouseButtonDown == MouseButton.Left)
3290
                            {
3291
                                if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3292
                                {
3293
                                    if (currentControl is LineControl)
3294
                                    {
3295
                                        CreateControl();
3296

    
3297
                                        (currentControl as LineControl).ApplyOverViewData();
3298
                                        //controlType = ControlType.None;
3299
                                        currentControl = null;
3300
                                        this.MainAngle.Visibility = Visibility.Collapsed;
3301
                                    }
3302
                                    else
3303
                                    {
3304
                                        currentControl = new LineControl
3305
                                        {
3306
                                            Background = new SolidColorBrush(Colors.Black)
3307
                                        };
3308

    
3309
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3310
                                        currentControl.CommentID = Save.shortGuid();
3311
                                        currentControl.IsNew = true;
3312
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3313
                                        this.MainAngle.Visibility = Visibility.Visible;
3314
                                    }
3315
                                }
3316
                            }
3317
                        }
3318
                        break;
3319
                    case ControlType.CancelLine:
3320
                        {
3321
                            if (mouseButtonDown == MouseButton.Left)
3322
                            {
3323
                                if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3324
                                {
3325
                                    if (currentControl is LineControl)
3326
                                    {
3327
                                        CreateControl();
3328

    
3329
                                        (currentControl as LineControl).ApplyOverViewData();
3330
                                        //controlType = ControlType.None;
3331
                                        currentControl = null;
3332
                                        this.MainAngle.Visibility = Visibility.Collapsed;
3333
                                    }
3334
                                    else
3335
                                    {
3336
                                        currentControl = new LineControl
3337
                                        {
3338
                                            Background = new SolidColorBrush(Colors.Black)
3339
                                        };
3340

    
3341
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3342
                                        currentControl.CommentID = Save.shortGuid();
3343
                                        currentControl.IsNew = true;
3344
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3345
                                        this.MainAngle.Visibility = Visibility.Visible;
3346
                                    }
3347
                                }
3348
                            }
3349
                        }
3350
                        break;
3351
                    case ControlType.ArrowLine:
3352
                        {
3353
                            if (mouseButtonDown == MouseButton.Left)
3354
                            {
3355
                                if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3356
                                {
3357
                                    if (currentControl is LineControl)
3358
                                    {
3359
                                        CreateControl();
3360

    
3361
                                        (currentControl as LineControl).ApplyOverViewData();
3362
                                        //controlType = ControlType.None;
3363
                                        currentControl = null;
3364
                                        this.MainAngle.Visibility = Visibility.Collapsed;
3365
                                    }
3366
                                    else
3367
                                    {
3368
                                        currentControl = new LineControl
3369
                                        {
3370
                                            Background = new SolidColorBrush(Colors.Black)
3371
                                        };
3372

    
3373
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3374
                                        currentControl.CommentID = Save.shortGuid();
3375
                                        currentControl.IsNew = true;
3376
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3377
                                        this.MainAngle.Visibility = Visibility.Visible;
3378
                                    }
3379
                                }
3380
                            }
3381
                        }
3382
                        break;
3383
                    case ControlType.TwinLine:
3384
                        {
3385
                            if (mouseButtonDown == MouseButton.Left)
3386
                            {
3387
                                if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3388
                                {
3389
                                    if (currentControl is LineControl)
3390
                                    {
3391
                                        CreateControl();
3392

    
3393
                                        (currentControl as LineControl).ApplyOverViewData();
3394
                                        //controlType = ControlType.None;
3395
                                        currentControl = null;
3396
                                        this.MainAngle.Visibility = Visibility.Collapsed;
3397
                                    }
3398
                                    else
3399
                                    {
3400
                                        currentControl = new LineControl
3401
                                        {
3402
                                            Background = new SolidColorBrush(Colors.Black)
3403
                                        };
3404
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3405
                                        currentControl.CommentID = Save.shortGuid();
3406
                                        currentControl.IsNew = true;
3407
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3408
                                        this.MainAngle.Visibility = Visibility.Visible;
3409
                                    }
3410
                                }
3411
                            }
3412
                        }
3413
                        break;
3414
                    case ControlType.DimLine:
3415
                        {
3416
                            if (mouseButtonDown == MouseButton.Left)
3417
                            {
3418
                                if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3419
                                {
3420
                                    if (currentControl is LineControl)
3421
                                    {
3422
                                        CreateControl();
3423

    
3424
                                        (currentControl as LineControl).ApplyOverViewData();
3425
                                        //controlType = ControlType.None;
3426
                                        currentControl = null;
3427
                                        this.MainAngle.Visibility = Visibility.Collapsed;
3428
                                    }
3429
                                    else
3430
                                    {
3431
                                        currentControl = new LineControl
3432
                                        {
3433
                                            Background = new SolidColorBrush(Colors.Black)
3434
                                        };
3435
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3436
                                        currentControl.CommentID = Save.shortGuid();
3437
                                        currentControl.IsNew = true;
3438
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3439
                                        this.MainAngle.Visibility = Visibility.Visible;
3440
                                    }
3441
                                }
3442
                            }
3443
                        }
3444
                        break;
3445
                    case ControlType.ChainLine:
3446
                        {
3447
                            if (currentControl is PolygonControl)
3448
                            {
3449
                                var control = currentControl as PolygonControl;
3450

    
3451
                                if (mouseButtonDown == MouseButton.Right)
3452
                                {
3453
                                    CreateControl();
3454

    
3455
                                    (currentControl as PolygonControl).ApplyOverViewData();
3456
                                    //controlType = ControlType.None;
3457
                                    currentControl = null;
3458
                                    return;
3459
                                }
3460

    
3461
                                if (!control.IsCompleted)
3462
                                {
3463
                                    //control.PointC.pointSet.Add(control.EndPoint);
3464
                                    control.PointSet.Add(control.EndPoint);
3465
                                }
3466
                                //else
3467
                                //{
3468
                                //    var firstPoint = control.PointC.pointSet.First();
3469

    
3470
                                //    //control.PointC.pointSet.Add(new Point(firstPoint.X, firstPoint.Y));
3471
                                //    control.PointC.pointSet.Add(firstPoint);
3472

    
3473
                                //    control.SetPolyPath();
3474

    
3475
                                //    controlType = ControlType.None;
3476

    
3477
                                //    currentControl = null;
3478
                                //}
3479
                            }
3480
                            else
3481
                            {
3482
                                if (mouseButtonDown == MouseButton.Left)
3483
                                {
3484
                                    currentControl = new PolygonControl
3485
                                    {
3486
                                        PointSet = new List<Point>(),
3487
                                        //강인구 추가(ChainLine일때는 채우기 스타일을 주지 않기 위해 설정)
3488
                                        ControlType = ControlType.ChainLine,
3489
                                        DashSize = ViewerDataModel.Instance.DashSize,
3490
                                        LineSize = ViewerDataModel.Instance.LineSize,
3491
                                        //PointC = new StylusPointSet()
3492
                                    };
3493

    
3494
                                    if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3495
                                    {
3496
                                        var polygonControl = (currentControl as PolygonControl);
3497
                                        currentControl.CommentID = Save.shortGuid();
3498
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3499
                                        currentControl.IsNew = true;
3500
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3501
                                        //currentControl.OnApplyTemplate();
3502
                                        //polygonControl.PointC.pointSet.Add(canvasDrawingMouseDownPoint);
3503
                                        //polygonControl.PointC.pointSet.Add(canvasDrawingMouseDownPoint);
3504
                                        polygonControl.PointSet.Add(canvasDrawingMouseDownPoint);
3505
                                        polygonControl.PointSet.Add(canvasDrawingMouseDownPoint);
3506
                                    }
3507
                                }
3508
                            }
3509
                        }
3510
                        break;
3511
                    case ControlType.ArcLine:
3512
                        {
3513
                            if (mouseButtonDown == MouseButton.Left)
3514
                            {
3515
                                if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3516
                                {
3517
                                    if (currentControl is ArcControl)
3518
                                    {
3519
                                        CreateControl();
3520

    
3521
                                        (currentControl as ArcControl).ApplyOverViewData();
3522
                                        //controlType = ControlType.None;
3523
                                        currentControl = null;
3524
                                        this.MainAngle.Visibility = Visibility.Collapsed;
3525
                                    }
3526
                                    else
3527
                                    {
3528
                                        currentControl = new ArcControl
3529
                                        {
3530
                                            Background = new SolidColorBrush(Colors.Black)
3531
                                        };
3532
                                        currentControl.CommentID = Save.shortGuid();
3533
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3534
                                        currentControl.IsNew = true;
3535
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3536
                                        this.MainAngle.Visibility = Visibility.Visible;
3537
                                    }
3538
                                }
3539
                            }
3540
                            else if (mouseButtonDown == MouseButton.Right)
3541
                            {
3542
                                if (currentControl != null)
3543
                                {
3544
                                    (currentControl as ArcControl).setClock();
3545
                                }
3546

    
3547
                            }
3548

    
3549
                        }
3550
                        break;
3551
                    case ControlType.ArcArrow:
3552
                        {
3553
                            if (mouseButtonDown == MouseButton.Left)
3554
                            {
3555
                                if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3556
                                {
3557
                                    if (currentControl is ArcControl)
3558
                                    {
3559
                                        CreateControl();
3560

    
3561
                                        (currentControl as ArcControl).ApplyOverViewData();
3562
                                        //controlType = ControlType.None;
3563
                                        currentControl = null;
3564
                                        this.MainAngle.Visibility = Visibility.Collapsed;
3565
                                    }
3566
                                    else
3567
                                    {
3568
                                        currentControl = new ArcControl
3569
                                        {
3570
                                            Background = new SolidColorBrush(Colors.Red),
3571
                                        };
3572
                                        currentControl.CommentID = Save.shortGuid();
3573
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3574
                                        currentControl.IsNew = true;
3575
                                        (currentControl as IMarkupCommonData).ControlType = ControlType.ArcArrow;
3576
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3577
                                        this.MainAngle.Visibility = Visibility.Visible;
3578
                                    }
3579
                                }
3580
                            }
3581
                            else if (mouseButtonDown == MouseButton.Right)
3582
                            {
3583
                                (currentControl as ArcControl).setClock();
3584
                            }
3585
                        }
3586
                        break;
3587
                    case ControlType.ArrowMultiLine:
3588
                        {
3589
                            if (mouseButtonDown == MouseButton.Left)
3590
                            {
3591
                                if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3592
                                {
3593

    
3594
                                    if (currentControl is ArrowControl_Multi)
3595
                                    {
3596
                                        var content = currentControl as ArrowControl_Multi;
3597
                                        if (content.MiddlePoint == new Point(0, 0))
3598
                                        {
3599
                                            content.MiddlePoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
3600
                                        }
3601
                                        else
3602
                                        {
3603
                                            CreateControl();
3604

    
3605
                                            (currentControl as ArrowControl_Multi).ApplyOverViewData();
3606
                                            //controlType = ControlType.None;
3607
                                            currentControl = null;
3608
                                            this.MainAngle.Visibility = Visibility.Collapsed;
3609
                                        }
3610
                                    }
3611
                                    else
3612
                                    {
3613
                                        currentControl = new ArrowControl_Multi
3614
                                        {
3615
                                            StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y),
3616
                                            Background = new SolidColorBrush(Colors.Black)
3617
                                        };
3618
                                        currentControl.CommentID = Save.shortGuid();
3619
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3620
                                        currentControl.IsNew = true;
3621
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3622
                                        this.MainAngle.Visibility = Visibility.Visible;
3623
                                    }
3624

    
3625
                                    //if (currentControl is ArrowControl_Multi)
3626
                                    //{
3627
                                    //    (currentControl as ArrowControl_Multi).ApplyOverViewData();
3628
                                    //    controlType = ControlType.None;
3629
                                    //    currentControl = null;
3630
                                    //}
3631
                                    //else
3632
                                    //{
3633
                                    //    currentControl = new ArrowControl_Multi
3634
                                    //    {
3635
                                    //        Background = new SolidColorBrush(Colors.Black)
3636
                                    //    };
3637

    
3638
                                    //    DataModel.Instance.MarkupControls.Add(currentControl);
3639
                                    //}
3640

    
3641

    
3642

    
3643
                                }
3644
                            }
3645
                        }
3646
                        break;
3647
                    case ControlType.PolygonCloud:
3648
                        {
3649
                            if (currentControl is CloudControl)
3650
                            {
3651
                                var control = currentControl as CloudControl;
3652
                                //control.Paint = PaintSet.Cloud;
3653
                                if (mouseButtonDown == MouseButton.Right)
3654
                                {
3655
                                    control.IsCompleted = true;
3656
                                }
3657

    
3658
                                if (!control.IsCompleted)
3659
                                {
3660
                                    //control.PointC.pointSet.Add(control.EndPoint);
3661
                                    control.PointSet.Add(control.EndPoint);
3662
                                }
3663
                                else
3664
                                {
3665
                                    CreateControl();
3666

    
3667
                                    control.isTransOn = true;
3668
                                    //var firstPoint = control.PointC.pointSet.First();
3669
                                    var firstPoint = control.PointSet.First();
3670

    
3671
                                    //control.PointC.pointSet.Add(firstPoint);
3672
                                    control.PointSet.Add(firstPoint);
3673
                                    control.DrawingCloud();
3674
                                    control.ApplyOverViewData();
3675

    
3676
                                    //controlType = ControlType.None;
3677

    
3678
                                    currentControl = null;
3679
                                }
3680
                            }
3681
                            else
3682
                            {
3683
                                if (mouseButtonDown == MouseButton.Left)
3684
                                {
3685
                                    currentControl = new CloudControl
3686
                                    {
3687
                                        PointSet = new List<Point>(),
3688
                                        PointC = new StylusPointSet()
3689
                                    };
3690

    
3691
                                    if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3692
                                    {
3693
                                        var polygonControl = (currentControl as CloudControl);
3694
                                        currentControl.CommentID = Save.shortGuid();
3695
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3696
                                        currentControl.IsNew = true;
3697
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3698
                                        //currentControl.OnApplyTemplate();
3699

    
3700
                                        polygonControl.PointSet.Add(canvasDrawingMouseDownPoint);
3701
                                        polygonControl.PointSet.Add(canvasDrawingMouseDownPoint);
3702
                                        //polygonControl.PointC.pointSet.Add(canvasZoomPanningMouseDownPoint);
3703
                                        //polygonControl.PointC.pointSet.Add(canvasZoomPanningMouseDownPoint);
3704

    
3705
                                    }
3706
                                }
3707
                            }
3708
                        }
3709
                        break;
3710
                    case ControlType.ImgControl:
3711
                        {
3712
                            if (mouseButtonDown == MouseButton.Left)
3713
                            {
3714
                                if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3715
                                {
3716
                                    if (currentControl is ImgControl)
3717
                                    {
3718
                                        CreateControl();
3719
                                        (currentControl as ImgControl).ApplyOverViewData();
3720

    
3721
                                        //controlType = ControlType.None;
3722
                                        currentControl = null;
3723
                                    }
3724
                                    else
3725
                                    {
3726
                                        string extension = System.IO.Path.GetExtension(filename).ToUpper();
3727
                                        if (extension == ".PNG" || extension == ".JPEG" || extension == ".GIF" || extension == ".BMP" || extension == ".JPG")
3728
                                        {
3729
                                            Image img = new Image();
3730
                                            img.Source = new BitmapImage(new Uri(filename));
3731

    
3732
                                            currentControl = new ImgControl
3733
                                            {
3734
                                                Background = new SolidColorBrush(Colors.Black),
3735
                                                PointSet = new List<Point>(),
3736
                                                FilePath = filename,
3737
                                                ImageData = img.Source,
3738
                                                StartPoint = canvasDrawingMouseDownPoint,
3739
                                                EndPoint = new Point(canvasDrawingMouseDownPoint.X + 100, canvasDrawingMouseDownPoint.Y + 100),
3740
                                                TopRightPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y + 100),
3741
                                                LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X + 100, canvasDrawingMouseDownPoint.Y)
3742
                                            };
3743

    
3744
                                            currentControl.CommentID = Save.shortGuid();
3745
                                            currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3746
                                            currentControl.IsNew = true;
3747
                                            ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3748
                                        }
3749
                                    }
3750
                                }
3751
                            }
3752
                        }
3753
                        break;
3754
                    case ControlType.Date:
3755
                        {
3756
                            if (mouseButtonDown == MouseButton.Left)
3757
                            {
3758
                                if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3759
                                {
3760
                                    if (currentControl is DateControl)
3761
                                    {
3762
                                        CreateControl();
3763
                                        (currentControl as DateControl).ApplyOverViewData();
3764
                                        //controlType = ControlType.None;
3765
                                        currentControl = null;
3766

    
3767
                                        if (Common.ViewerDataModel.Instance.SelectedControl == "Batch")
3768
                                        {
3769
                                            controlType = ControlType.None;
3770
                                            IsSwingMode = false;
3771
                                            Common.ViewerDataModel.Instance.SelectedControl = "";
3772
                                            Common.ViewerDataModel.Instance.ControlTag = null;
3773
                                            mouseHandlingMode = MouseHandlingMode.None;
3774
                                            this.ParentOfType<MainWindow>().dzTopMenu.btn_Batch.IsChecked = false;
3775
                                            txtBatch.Visibility = Visibility.Collapsed;
3776

    
3777
                                        }
3778
                                    }
3779
                                    else
3780
                                    {
3781
                                        currentControl = new DateControl
3782
                                        {
3783
                                            Background = new SolidColorBrush(Colors.Black)
3784
                                        };
3785
                                        //inkDrawingCanvas.Children.Add(currentControl);
3786
                                        //InkCanvas.SetLeft(currentControl, canvasDrawingMouseDownPoint.X);
3787
                                        //InkCanvas.SetTop(currentControl, canvasDrawingMouseDownPoint.Y);
3788
                                        currentControl.CommentID = Save.shortGuid();
3789
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3790
                                        currentControl.IsNew = true;
3791
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3792
                                        //DataModel.Instance.MarkupControls.Add(currentControl);
3793
                                    }
3794
                                }
3795
                            }
3796
                        }
3797
                        break;
3798
                    case ControlType.TextControl:
3799
                        {
3800
                            if (mouseButtonDown == MouseButton.Left)
3801
                            {
3802
                                if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3803
                                {
3804

    
3805
                                    currentControl = new TextControl
3806
                                    {
3807
                                        //ControlType = PaintSet.Rect
3808
                                        ControlType = controlType
3809
                                    };
3810

    
3811
                                    //if (currentControl is TextControl)
3812
                                    //{
3813
                                    //    //currentControl.SetValue(Canvas.ZIndexProperty, 2);
3814
                                    //    //(currentControl as TextControl).Base_TextBox.Text = (currentControl as TextControl).Text;
3815
                                    //    //(currentControl as TextControl).Base_TextBox.Visibility = System.Windows.Visibility.Visible;
3816
                                    //    //(currentControl as TextControl).Base_TextBlock.Visibility = System.Windows.Visibility.Collapsed;
3817
                                    //    //(currentControl as TextControl).Angle = Ang;
3818
                                    //    //currentControl.Focus();
3819
                                    //}
3820
                                    //else
3821
                                    //{
3822
                                    //currentControl = new TextControl();
3823
                                        currentControl.CommentID = Save.shortGuid();
3824
                                        currentControl.IsNew = true;
3825
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3826
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3827
                                        currentControl.SetValue(Canvas.ZIndexProperty, 2);
3828
                                        currentControl.SetValue(TextControl.CanvasXProperty, canvasDrawingMouseDownPoint.X);
3829
                                        currentControl.SetValue(TextControl.CanvasYProperty, canvasDrawingMouseDownPoint.Y);
3830
                                        currentControl.Focus();
3831
                                        (currentControl as TextControl).ApplyOverViewData();
3832
                                        (currentControl as TextControl).ControlType_No = 0;
3833
                                        (currentControl as TextControl).Angle -= rotate.Angle;
3834
                                        (currentControl as TextControl).IsHighLight = ViewerDataModel.Instance.checkHighShape;
3835

    
3836
                                        CreateControl();
3837

    
3838
                                        currentControl = null;
3839
                                    //}
3840

    
3841
                                    //controlType = ControlType.None;
3842
                                    //currentControl = null;
3843

    
3844
                                }
3845
                            }
3846
                        }
3847
                        break;
3848
                    case ControlType.TextBorder:
3849
                        {
3850
                            if (mouseButtonDown == MouseButton.Left)
3851
                            {
3852
                                if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3853
                                {
3854
                                    currentControl = new TextControl
3855
                                    {
3856
                                        //ControlType = PaintSet.Rect
3857
                                        ControlType = controlType
3858
                                    };
3859

    
3860

    
3861
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3862
                                    currentControl.CommentID = Save.shortGuid();
3863
                                    currentControl.IsNew = true;
3864
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3865
                                    currentControl.SetValue(Canvas.ZIndexProperty, 3);
3866
                                    currentControl.SetValue(TextControl.CanvasXProperty, canvasDrawingMouseDownPoint.X);
3867
                                    currentControl.SetValue(TextControl.CanvasYProperty, canvasDrawingMouseDownPoint.Y);
3868
                                    currentControl.Focus();
3869
                                    (currentControl as TextControl).ControlType_No = 1;
3870
                                    (currentControl as TextControl).Angle = Ang;
3871
                                    (currentControl as TextControl).IsHighLight = ViewerDataModel.Instance.checkHighShape;
3872
                                    //controlType = ControlType.None;
3873
                                    CreateControl();
3874

    
3875
                                    currentControl = null;
3876
                                }
3877
                            }
3878
                        }
3879
                        break;
3880
                    case ControlType.TextCloud:
3881
                        {
3882
                            if (mouseButtonDown == MouseButton.Left)
3883
                            {
3884
                                if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3885
                                {
3886
                                    currentControl = new TextControl
3887
                                    {
3888
                                        //Paint = PaintSet.Cloud
3889
                                        ControlType = controlType
3890
                                    };
3891
                                    currentControl.CommentID = Save.shortGuid();
3892
                                    currentControl.IsNew = true;
3893
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3894
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3895

    
3896
                                    currentControl.SetValue(Canvas.ZIndexProperty, 3);
3897
                                    currentControl.SetValue(TextControl.CanvasXProperty, canvasDrawingMouseDownPoint.X);
3898
                                    currentControl.SetValue(TextControl.CanvasYProperty, canvasDrawingMouseDownPoint.Y);
3899
                                    currentControl.Focus();
3900

    
3901
                                    (currentControl as TextControl).Angle = Ang;
3902
                                    (currentControl as TextControl).ControlType_No = 2;
3903
                                    (currentControl as TextControl).IsHighLight = ViewerDataModel.Instance.checkHighShape;
3904

    
3905
                                    CreateControl();
3906
                                    //controlType = ControlType.None;
3907
                                    currentControl = null;
3908
                                }
3909
                            }
3910
                        }
3911
                        break;
3912
                    case ControlType.ArrowTextControl:
3913
                        {
3914
                            if (mouseButtonDown == MouseButton.Left)
3915
                            {
3916
                                if (currentControl is ArrowTextControl)
3917
                                {
3918
                                    CreateControl();
3919
                                    //controlType = ControlType.None;
3920

    
3921
                                    (currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false;
3922
                                    (currentControl as ArrowTextControl).IsEditing = false;
3923
                                    (currentControl as ArrowTextControl).EnableEditing = false;
3924
                                    currentControl = null;
3925
                                    this.MainAngle.Visibility = Visibility.Collapsed;
3926

    
3927
                                }
3928
                                else
3929
                                {
3930
                                    if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3931
                                    {
3932
                                        currentControl = new ArrowTextControl();
3933
                                        currentControl.CommentID = Save.shortGuid();
3934
                                        currentControl.IsNew = true;
3935
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3936
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3937

    
3938
                                        currentControl.SetValue(Canvas.ZIndexProperty, 3);
3939

    
3940
                                        currentControl.SetValue(ArrowTextControl.StartPointProperty, canvasDrawingMouseDownPoint);
3941

    
3942
                                        currentControl.SetValue(ArrowTextControl.EndPointProperty, canvasDrawingMouseDownPoint);
3943

    
3944
                                        (currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape;
3945

    
3946
                                        (currentControl as ArrowTextControl).ApplyTemplate();
3947

    
3948
                                        (currentControl as ArrowTextControl).Base_TextBox.Focus();
3949
                                        this.MainAngle.Visibility = Visibility.Visible;
3950
                                        //currentControl.Focus();
3951
                                    }
3952
                                }
3953
                            }
3954
                        }
3955
                        break;
3956
                    case ControlType.ArrowTransTextControl:
3957
                        {
3958
                            if (mouseButtonDown == MouseButton.Left)
3959
                            {
3960
                                if (currentControl is ArrowTextControl)
3961
                                {
3962
                                    CreateControl();
3963
                                    (currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false;
3964
                                    //controlType = ControlType.None;
3965
                                    currentControl = null;
3966
                                    this.MainAngle.Visibility = Visibility.Collapsed;
3967
                                }
3968
                                else
3969
                                {
3970
                                    if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3971
                                    {
3972
                                        currentControl = new ArrowTextControl();
3973
                                        currentControl.CommentID = Save.shortGuid();
3974
                                        currentControl.IsNew = true;
3975
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3976
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3977

    
3978
                                        currentControl.SetValue(Canvas.ZIndexProperty, 3);
3979

    
3980
                                        currentControl.SetValue(ArrowTextControl.StartPointProperty, canvasDrawingMouseDownPoint);
3981

    
3982
                                        currentControl.SetValue(ArrowTextControl.EndPointProperty, canvasDrawingMouseDownPoint);
3983

    
3984
                                        (currentControl as ArrowTextControl).isFixed = true;
3985
                                        (currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape;
3986

    
3987
                                        (currentControl as ArrowTextControl).ApplyTemplate();
3988

    
3989
                                        (currentControl as ArrowTextControl).Base_TextBox.Focus();
3990
                                        this.MainAngle.Visibility = Visibility.Visible;
3991
                                        //currentControl.Focus();
3992
                                    }
3993
                                }
3994
                            }
3995
                        }
3996
                        break;
3997
                    case ControlType.ArrowTextBorderControl:
3998
                        {
3999
                            if (mouseButtonDown == MouseButton.Left)
4000
                            {
4001
                                if (currentControl is ArrowTextControl)
4002
                                {
4003
                                    CreateControl();
4004
                                    (currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false;
4005
                                    //controlType = ControlType.None;
4006
                                    currentControl = null;
4007
                                    this.MainAngle.Visibility = Visibility.Collapsed;
4008
                                }
4009
                                else
4010
                                {
4011
                                    if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4012
                                    {
4013
                                        currentControl = new ArrowTextControl()
4014
                                        {
4015
                                            ArrowTextStyle = MarkupToPDF.Controls.Text.ArrowTextControl.ArrowTextStyleSet.Rect
4016
                                        };
4017
                                        currentControl.CommentID = Save.shortGuid();
4018
                                        currentControl.IsNew = true;
4019
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4020
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4021

    
4022
                                        currentControl.SetValue(Canvas.ZIndexProperty, 3);
4023

    
4024
                                        currentControl.SetValue(ArrowTextControl.StartPointProperty, canvasDrawingMouseDownPoint);
4025

    
4026
                                        currentControl.SetValue(ArrowTextControl.EndPointProperty, canvasDrawingMouseDownPoint);
4027
                                        (currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape;
4028

    
4029
                                        (currentControl as ArrowTextControl).ApplyTemplate();
4030

    
4031
                                        (currentControl as ArrowTextControl).Base_TextBox.Focus();
4032
                                        this.MainAngle.Visibility = Visibility.Visible;
4033
                                        //currentControl.Focus();
4034
                                    }
4035
                                }
4036
                            }
4037
                        }
4038
                        break;
4039
                    case ControlType.ArrowTransTextBorderControl:
4040
                        {
4041
                            if (mouseButtonDown == MouseButton.Left)
4042
                            {
4043
                                if (currentControl is ArrowTextControl)
4044
                                {
4045
                                    CreateControl();
4046
                                    //controlType = ControlType.None;
4047
                                    (currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false;
4048
                                    currentControl = null;
4049
                                    this.MainAngle.Visibility = Visibility.Collapsed;
4050
                                }
4051
                                else
4052
                                {
4053
                                    if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4054
                                    {
4055
                                        currentControl = new ArrowTextControl()
4056
                                        {
4057
                                            ArrowTextStyle = MarkupToPDF.Controls.Text.ArrowTextControl.ArrowTextStyleSet.Rect
4058
                                        };
4059
                                        currentControl.CommentID = Save.shortGuid();
4060
                                        currentControl.IsNew = true;
4061
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4062
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4063

    
4064
                                        currentControl.SetValue(Canvas.ZIndexProperty, 3);
4065

    
4066
                                        currentControl.SetValue(ArrowTextControl.StartPointProperty, canvasDrawingMouseDownPoint);
4067

    
4068
                                        currentControl.SetValue(ArrowTextControl.EndPointProperty, canvasDrawingMouseDownPoint);
4069

    
4070
                                        (currentControl as ArrowTextControl).isFixed = true;
4071
                                        (currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape;
4072

    
4073
                                        (currentControl as ArrowTextControl).ApplyTemplate();
4074

    
4075
                                        (currentControl as ArrowTextControl).Base_TextBox.Focus();
4076
                                        this.MainAngle.Visibility = Visibility.Visible;
4077
                                        //currentControl.Focus();
4078
                                    }
4079
                                }
4080
                            }
4081
                        }
4082
                        break;
4083
                    case ControlType.ArrowTextCloudControl:
4084
                        {
4085
                            if (mouseButtonDown == MouseButton.Left)
4086
                            {
4087
                                if (currentControl is ArrowTextControl)
4088
                                {
4089
                                    CreateControl();
4090
                                    //controlType = ControlType.None;
4091
                                    (currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false;
4092
                                    currentControl = null;
4093
                                    this.MainAngle.Visibility = Visibility.Collapsed;
4094
                                }
4095
                                else
4096
                                {
4097
                                    if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4098
                                    {
4099
                                        currentControl = new ArrowTextControl()
4100
                                        {
4101
                                            ArrowTextStyle = MarkupToPDF.Controls.Text.ArrowTextControl.ArrowTextStyleSet.Cloud
4102
                                        };
4103
                                        currentControl.CommentID = Save.shortGuid();
4104
                                        currentControl.IsNew = true;
4105
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4106
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4107

    
4108
                                        currentControl.SetValue(Canvas.ZIndexProperty, 3);
4109

    
4110
                                        currentControl.SetValue(ArrowTextControl.StartPointProperty, canvasDrawingMouseDownPoint);
4111

    
4112
                                        currentControl.SetValue(ArrowTextControl.EndPointProperty, canvasDrawingMouseDownPoint);
4113
                                        (currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape;
4114
                                        (currentControl as ArrowTextControl).ApplyTemplate();
4115

    
4116
                                        (currentControl as ArrowTextControl).Base_TextBox.Focus();
4117
                                        this.MainAngle.Visibility = Visibility.Visible;
4118
                                        //currentControl.Focus();
4119
                                    }
4120
                                }
4121
                            }
4122
                        }
4123
                        break;
4124
                    case ControlType.ArrowTransTextCloudControl:
4125
                        {
4126
                            if (mouseButtonDown == MouseButton.Left)
4127
                            {
4128
                                if (currentControl is ArrowTextControl)
4129
                                {
4130
                                    CreateControl();
4131
                                    //controlType = ControlType.None;
4132
                                    (currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false;
4133
                                    currentControl = null;
4134
                                    this.MainAngle.Visibility = Visibility.Collapsed;
4135
                                }
4136
                                else
4137
                                {
4138
                                    if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4139
                                    {
4140
                                        currentControl = new ArrowTextControl()
4141
                                        {
4142
                                            ArrowTextStyle = MarkupToPDF.Controls.Text.ArrowTextControl.ArrowTextStyleSet.Cloud
4143
                                        };
4144
                                        currentControl.CommentID = Save.shortGuid();
4145
                                        currentControl.IsNew = true;
4146
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4147
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4148

    
4149
                                        currentControl.SetValue(Canvas.ZIndexProperty, 3);
4150

    
4151
                                        currentControl.SetValue(ArrowTextControl.StartPointProperty, canvasDrawingMouseDownPoint);
4152

    
4153
                                        currentControl.SetValue(ArrowTextControl.EndPointProperty, canvasDrawingMouseDownPoint);
4154

    
4155
                                        (currentControl as ArrowTextControl).isFixed = true;
4156
                                        (currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape;
4157

    
4158
                                        (currentControl as ArrowTextControl).ApplyTemplate();
4159

    
4160
                                        (currentControl as ArrowTextControl).Base_TextBox.Focus();
4161
                                        //currentControl.Focus();
4162
                                        this.MainAngle.Visibility = Visibility.Visible;
4163
                                    }
4164
                                }
4165
                            }
4166
                        }
4167
                        break;
4168
                    case ControlType.PolygonControl:
4169
                        {
4170
                            if (currentControl is PolygonControl)
4171
                            {
4172
                                var control = currentControl as PolygonControl;
4173

    
4174
                                if (mouseButtonDown == MouseButton.Right)
4175
                                {
4176
                                    control.IsCompleted = true;
4177
                                }
4178

    
4179
                                if (!control.IsCompleted)
4180
                                {
4181
                                    //control.PointC.pointSet.Add(control.EndPoint);
4182
                                    control.PointSet.Add(control.EndPoint);
4183
                                }
4184
                                else
4185
                                {
4186
                                    //control.IsSelected = true;
4187
                                    var firstPoint = control.PointSet.First();
4188
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
4189
                                    control.LineSize = ViewerDataModel.Instance.LineSize;
4190
                                    control.PointSet.Add(firstPoint);
4191

    
4192
                                    control.SetPolyPath();
4193

    
4194
                                    control.ApplyOverViewData();
4195

    
4196
                                    CreateControl();
4197

    
4198
                                    //controlType = ControlType.None;
4199

    
4200
                                    currentControl = null;
4201
                                }
4202
                            }
4203
                            else
4204
                            {
4205
                                if (mouseButtonDown == MouseButton.Left)
4206
                                {
4207
                                    currentControl = new PolygonControl
4208
                                    {
4209
                                        PointSet = new List<Point>(),
4210
                                        //PointC = new StylusPointSet()
4211
                                    };
4212

    
4213
                                    if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4214
                                    {
4215
                                        var polygonControl = (currentControl as PolygonControl);
4216
                                        currentControl.CommentID = Save.shortGuid();
4217
                                        currentControl.IsNew = true;
4218
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4219
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4220
                                        //currentControl.OnApplyTemplate();
4221
                                        polygonControl.PointSet.Add(canvasDrawingMouseDownPoint);
4222
                                        polygonControl.PointSet.Add(canvasDrawingMouseDownPoint);
4223
                                    }
4224
                                }
4225
                            }
4226
                        }
4227
                        break;
4228
                    //강인구 추가
4229
                    case ControlType.Sign:
4230
                        {
4231
                            if (mouseButtonDown == MouseButton.Left)
4232
                            {
4233
                                if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4234
                                {
4235
                                    if (currentControl is SignControl)
4236
                                    {
4237
                                        CreateControl();
4238
                                        currentControl = null;
4239
                                        if (Common.ViewerDataModel.Instance.SelectedControl == "Batch")
4240
                                        {
4241
                                            txtBatch.Text = "Date Control을 그립니다.";
4242
                                            controlType = ControlType.Date;
4243
                                        }
4244
                                    }
4245
                                    else
4246
                                    {
4247
                                        currentControl = new SignControl
4248
                                        {
4249
                                            Background = new SolidColorBrush(Colors.Black),
4250
                                            //UserNumber = "H2011357",
4251
                                            UserNumber = App.ViewInfo.UserID,
4252
                                            StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y),
4253
                                            EndPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y),
4254
                                            ControlType = ControlType.Sign
4255
                                        };
4256

    
4257
                                        currentControl.CommentID = Save.shortGuid();
4258
                                        currentControl.IsNew = true;
4259
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4260
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4261
                                        //currentControl.ApplyTemplate();
4262
                                    }
4263
                                }
4264
                            }
4265
                        }
4266
                        break;
4267
                    case ControlType.Mark:
4268
                        {
4269
                            if (mouseButtonDown == MouseButton.Left)
4270
                            {
4271
                                if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4272
                                {
4273
                                    if (currentControl is RectangleControl)
4274
                                    {
4275
                                        CreateControl();
4276
                                        (currentControl as RectangleControl).ApplyOverViewData();
4277
                                        //controlType = ControlType.None;
4278
                                        currentControl = null;
4279
                                        //mouseHandlingMode = MouseHandlingMode.Selecting;
4280
                                        this.cursor = Cursors.Arrow;
4281

    
4282
                                        if (Common.ViewerDataModel.Instance.SelectedControl == "Batch")
4283
                                        {
4284
                                            txtBatch.Text = "Sign Control을 그립니다.";
4285
                                            controlType = ControlType.Sign;
4286
                                        }
4287
                                    }
4288
                                    else
4289
                                    {
4290
                                        currentControl = new RectangleControl
4291
                                        {
4292
                                            Background = new SolidColorBrush(Colors.Black),
4293
                                            Paint = PaintSet.Fill
4294
                                        };
4295

    
4296
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4297
                                        currentControl.CommentID = Save.shortGuid();
4298
                                        currentControl.IsNew = true;
4299
                                        (currentControl as RectangleControl).DashSize = ViewerDataModel.Instance.DashSize;
4300
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4301
                                    }
4302
                                }
4303
                            }
4304
                        }
4305
                        break;
4306
                    case ControlType.Symbol:
4307
                        {
4308
                            if (mouseButtonDown == MouseButton.Left)
4309
                            {
4310
                                if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4311
                                {
4312
                                    if (currentControl is SymControl)
4313
                                    {
4314
                                        CreateControl();
4315
                                        //(currentControl as SymControlN).ApplyOverViewData();
4316
                                        //controlType = ControlType.None;
4317
                                        currentControl = null;
4318
                                        //mouseHandlingMode = MouseHandlingMode.Selecting;
4319
                                        this.cursor = Cursors.Arrow;
4320
                                    }
4321
                                    else
4322
                                    {
4323
                                        currentControl = new SymControl
4324
                                        {
4325
                                            StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y),
4326
                                            Background = new SolidColorBrush(Colors.Black),
4327
                                            ControlType = ControlType.Symbol
4328
                                        };
4329

    
4330
                                        currentControl.IsNew = true;
4331
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4332
                                        currentControl.CommentID = Save.shortGuid();
4333
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4334
                                    }
4335
                                }
4336
                            }
4337
                        }
4338
                        break;
4339
                    case ControlType.Stamp:
4340
                        {
4341
                            if (mouseButtonDown == MouseButton.Left)
4342
                            {
4343
                                if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4344
                                {
4345
                                    if (currentControl is SymControlN)
4346
                                    {
4347
                                        CreateControl();
4348
                                        currentControl = null;
4349
                                        this.cursor = Cursors.Arrow;
4350
                                    }
4351
                                    else
4352
                                    {
4353
                                        currentControl = new SymControlN
4354
                                        {
4355
                                            StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y),
4356
                                            Background = new SolidColorBrush(Colors.Black),
4357
                                            ControlType = ControlType.Stamp
4358
                                        };
4359

    
4360
                                        currentControl.IsNew = true;
4361
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4362
                                        currentControl.CommentID = Save.shortGuid();
4363
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4364
                                    }
4365
                                }
4366
                            }
4367
                        }
4368
                        break;
4369
                    case ControlType.PenControl:
4370
                        {
4371
                            //this.inkBoard.CaptureMouse();
4372

    
4373
                            if (inkBoard.Tag.ToString() == "Ink")
4374
                            {
4375
                                inkBoard.IsEnabled = true;
4376
                                StartNewStroke(canvasDrawingMouseDownPoint);
4377
                            }
4378
                            else if (inkBoard.Tag.ToString() == "EraseByPoint")
4379
                            {
4380
                                RemovePointStroke(canvasDrawingMouseDownPoint);
4381
                            }
4382
                            else if (inkBoard.Tag.ToString() == "EraseByStroke")
4383
                            {
4384
                                RemoveLineStroke(canvasDrawingMouseDownPoint);
4385
                            }
4386
                            IsDrawing = true;
4387
                            return;
4388
                        }
4389
                        break;
4390
                    default:
4391
                        if (currentControl != null)
4392
                        {
4393
                            currentControl.CommentID = null;
4394
                            currentControl.IsNew = false;
4395
                        }
4396
                        break;
4397
                }
4398

    
4399
            }
4400

    
4401
            else if (mouseButtonDown == MouseButton.Left && mouseHandlingMode == MouseHandlingMode.Selecting)
4402
            {
4403
                //bool Flag = true;
4404
                //ControlList = new List<object>();
4405
                //if (selected_item == null)
4406
                //{
4407
                //    selected_item = new Dictionary<Geometry, string>();
4408
                //}
4409
                //if (selected_item.Count > 0)
4410
                //{
4411
                //    mouseHandlingMode = MouseHandlingMode.Drawing;
4412

    
4413
                //    foreach (var item in ViewerDataModel.Instance.MarkupControls_USER)
4414
                //    {
4415
                //        ControlList.Add(item);
4416
                //    }
4417
                //    controlType = move.control_Move_R(ControlList, canvasDrawingMouseDownPoint);
4418
                //    currentControl = move.CurrentControl;
4419
                //}
4420
                //else
4421
                //{
4422
                //    isLeftMouseButtonDownOnWindow = true;
4423
                //}
4424
                if (controlType == ControlType.None)
4425
                {
4426
                    //init();
4427
                    //cursor = Cursors.Cross;
4428
                    //SetCursor();
4429
                    mouseHandlingMode = MouseHandlingMode.Selecting;
4430
                    this.cursor = Cursors.Arrow;
4431
                    inkDrawingCanvas.IsEnabled = false;
4432
                    isLeftMouseButtonDownOnWindow = true;
4433
                }
4434
            }
4435

    
4436
            if (mouseHandlingMode != MouseHandlingMode.None && mouseButtonDown == MouseButton.Left)
4437
            {
4438
                if (mouseHandlingMode == MouseHandlingMode.Adorner && SelectLayer.Children.Count > 0)
4439
                {
4440
                    bool mouseOff = false;
4441
                    foreach (var item in SelectLayer.Children)
4442
                    {
4443
                        if (item is AdornerFinal)
4444
                        {
4445

    
4446
                            var over = (item as AdornerFinal).MemberSet.Where(data => data.DrawingData.IsMouseOver).FirstOrDefault();
4447
                            if (over != null)
4448
                            {
4449
                                mouseOff = true;
4450
                            }
4451
                        }
4452
                    }
4453

    
4454
                    if (!mouseOff)
4455
                    {
4456
                        ReleaseAdorner();
4457
                    }
4458
                }
4459
                //if (mouseHandlingMode == MouseHandlingMode.Adorner && ViewerDataModel.Instance.MarkupControls.Where(data => data.IsMouseOver).FirstOrDefault() == null && SelectLayer.Children.Count >0)
4460
                //{
4461

    
4462
                //}
4463
                zoomAndPanControl.CaptureMouse();
4464
                e.Handled = true;
4465
            }
4466

    
4467
            //txtDrawingCanvasDownPoint_X.Text = string.Format("{0:f2}", canvasDrawingMouseDownPoint.X);
4468
            //txtDrawingCanvasDownPoint_Y.Text = string.Format("{0:f2}", canvasDrawingMouseDownPoint.Y);
4469

    
4470
            //txtZoomCanvasDownPoint_X.Text = string.Format("{0:f2}", canvasZoomPanningMouseDownPoint.X);
4471
            //txtZoomCanvasDownPoint_Y.Text = string.Format("{0:f2}", canvasZoomPanningMouseDownPoint.Y);
4472
        }
4473
        //int maxViewerWidth;
4474
        //int maxViewerHeight;
4475
        //int minViewerTop;
4476
        //int minViewerLeft;
4477

    
4478
        private void RemoveLineStroke(Point P)
4479
        {
4480
            var control = ViewerDataModel.Instance.MarkupControls_USER.Where(data => data.IsMouseOver).FirstOrDefault();
4481
            if (control != null)
4482
            {
4483
                UndoData = new Undo_data()
4484
                {
4485
                    IsUndo = false,
4486
                    Event = Event_Type.Delete,
4487
                    EventTime = DateTime.Now,
4488
                    Markup_List = new List<Multi_Undo_data>()
4489
                };
4490

    
4491

    
4492
                multi_Undo_Data.Markup = control as MarkupToPDF.Common.CommentUserInfo;
4493
                UndoData.Markup_List.Add(multi_Undo_Data);
4494
                multi_Undo_Data = new Multi_Undo_data();
4495

    
4496
                ViewerDataModel.Instance.MarkupControls_USER.Remove(control);
4497
                var Item_ = ViewerDataModel.Instance.MarkupList_USER.Where(d => d.ID == (control as MarkupToPDF.Common.CommentUserInfo).CommentID).FirstOrDefault();
4498
                ViewerDataModel.Instance.MarkupList_USER.Remove(Item_);
4499

    
4500

    
4501
                ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
4502
                {
4503
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
4504
                });
4505
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
4506

    
4507
                //if (control as PolygonControl != null)
4508
                //{
4509
                //    if ((control as PolygonControl).ControlType == ControlType.Ink)
4510
                //    {
4511
                //        ViewerDataModel.Instance.MarkupControls_USER.Remove(control);
4512
                //        var Item_ = ViewerDataModel.Instance.MarkupList_USER.Where(d => d.ID == (control as MarkupToPDF.Common.CommentUserInfo).CommentID).FirstOrDefault();
4513
                //        ViewerDataModel.Instance.MarkupList_USER.Remove(Item_);
4514
                //    }
4515
                //}
4516
            }
4517

    
4518
            //StrokeCollection hits = inkBoard.Strokes.HitTest(P);
4519
            //inkBoard.Strokes.Remove(hits);
4520
        }
4521

    
4522
        private void RemovePointStroke(Point P)
4523
        {
4524
            //StrokeCollection hits = inkBoard.Strokes.HitTest(P);
4525
            foreach (Stroke hits in inkBoard.Strokes)
4526
            {
4527
                foreach (StylusPoint sty in hits.StylusPoints)
4528
                {
4529

    
4530
                }
4531
                if (hits.HitTest(P))
4532
                {
4533
                    inkBoard.Strokes.Remove(hits);
4534
                    return;
4535
                }
4536
            }
4537
        }
4538

    
4539
        private void StartNewStroke(Point P)
4540
        {
4541
            strokePoints = new StylusPointCollection();
4542
            StylusPoint segment1Start = new StylusPoint(P.X, P.Y);
4543
            strokePoints.Add(segment1Start);
4544
            stroke = new Stroke(strokePoints);
4545

    
4546
            stroke.DrawingAttributes.Color = Colors.Red;
4547
            stroke.DrawingAttributes.Width = 4;
4548
            stroke.DrawingAttributes.Height = 4;
4549

    
4550
            inkBoard.Strokes.Add(stroke);
4551

    
4552
            //inkBoard.Strokes.Add(stroke);
4553
        }
4554

    
4555
        private void btnConsolidate_Click(object sender, RoutedEventArgs e)
4556
        {
4557
            ConsolidationMethod();
4558
        }
4559

    
4560
        public void ConsolidationMethod()
4561
        {
4562
            ChangeCommentReact();
4563

    
4564
            if (this.gridViewMarkup.SelectedItems.Count == 0)
4565
            {
4566
                this.ParentOfType<MainWindow>().DialogMessage_Alert("Please select at least one user", "Alert");
4567
            }
4568
            else
4569
            {
4570

    
4571
                if (ViewerDataModel.Instance.MarkupList_USER.Count > 0)
4572
                {
4573
                    this.ParentOfType<MainWindow>().dzTopMenu.SaveEvent(null, null);
4574
                }
4575
                //if (ViewerDataModel.Instance.MarkupControls_USER.Count() > 0 || this.gridViewMarkup.SelectedItems.Count > 0)
4576
                //{
4577
                //    this.ParentOfType<MainWindow>().dzTopMenu.SaveEvent(null, null);
4578
                //}
4579

    
4580
                //if (ViewerDataModel.Instance.MarkupControls_USER.Count() > 0)
4581
                //{
4582
                //    this.ParentOfType<MainWindow>().dzTopMenu.SaveEvent(null, null);
4583
                //}
4584

    
4585
                ViewerDataModel.Instance.IsConsolidate = true;
4586
                this.ParentOfType<MainWindow>().dzTopMenu.SaveEvent(null, null);
4587
                List<KCOMDataModel.DataModel.MARKUP_DATA> instanceDataSet = new List<KCOMDataModel.DataModel.MARKUP_DATA>();
4588
                using (KCOMDataModel.DataModel.CIEntities Entity = new KCOMDataModel.DataModel.CIEntities(KCOMDataModel.Common.ConnectStringBuilder.ProjectCIConnectString(App.ViewInfo.ProjectNO).ToString()))
4589
                {
4590
                    var markupInfo = Entity.MARKUP_INFO.Where(entity => entity.DOCINFO_ID == _DocInfo.ID).OrderByDescending(i => i.CONSOLIDATE).OrderByDescending(j => j.CREATE_TIME).FirstOrDefault();
4591
                    if (markupInfo.CONSOLIDATE == 1)
4592
                    {
4593
                        markupInfo.AVOID_CONSOLIDATE = 1;
4594
                    }
4595

    
4596
                    foreach (MarkupInfoItem item in this.gridViewMarkup.SelectedItems)
4597
                    {
4598
                        Entity.MARKUP_DATA.Where(data => data.MARKUPINFO_VERSION_ID == item.MarkupVersionID).ToList().ForEach(d =>
4599
                          {
4600
                              instanceDataSet.Add(d);
4601
                          });
4602
                    }
4603

    
4604
                    KCOMDataModel.DataModel.MARKUP_INFO info = new KCOMDataModel.DataModel.MARKUP_INFO();
4605
                    info.ID = Save.shortGuid();
4606
                    info.CONSOLIDATE = 1;
4607
                    info.CREATE_TIME = DateTime.Now;
4608
                    info.DOCINFO_ID = _DocInfo.ID;
4609
                    info.UPDATE_TIME = DateTime.Now;
4610
                    info.USER_ID = App.ViewInfo.UserID;
4611
                    info.AVOID_CONSOLIDATE = 0;
4612

    
4613
                    Entity.MARKUP_INFO.AddObject(info);
4614
                    Entity.SaveChanges();
4615

    
4616

    
4617
                    KCOMDataModel.DataModel.MARKUP_INFO_VERSION info2 = new KCOMDataModel.DataModel.MARKUP_INFO_VERSION
4618
                    {
4619
                        ID = Save.shortGuid(),
4620
                        CREATE_DATE = DateTime.Now,
4621
                        MARKUP_INFO = info,
4622
                    };
4623
                    Entity.SaveChanges();
4624

    
4625
                    foreach (var item in instanceDataSet)
4626
                    {
4627
                        Entity.MARKUP_DATA.AddObject(new KCOMDataModel.DataModel.MARKUP_DATA
4628
                        {
4629
                            ID = Save.shortGuid(),
4630
                            DATA = item.DATA,
4631
                            DATA_TYPE = item.DATA_TYPE,
4632
                            PAGENUMBER = item.PAGENUMBER,
4633
                            MARKUP_INFO_VERSION = info2
4634
                        });
4635
                    }
4636
                    Entity.SaveChanges();
4637
                    this.BaseClient.GetMarkupInfoItemsAsync(App.ViewInfo.ProjectNO, _DocInfo.ID);
4638
                }
4639
            }
4640
        }
4641

    
4642
        private void btnConsolidate_Loaded(object sender, RoutedEventArgs e)
4643
        {
4644
            if (App.ViewInfo != null)
4645
            {
4646
                btnConsolidate = (sender as RadRibbonButton);
4647
                if (!App.ViewInfo.NewCommentPermission)
4648
                {
4649
                    (sender as RadRibbonButton).Visibility = System.Windows.Visibility.Collapsed;
4650
                    //instanceTop = this.ParentOfType<MainWindow>().dzTopMenu;
4651
                    //instanceTop.btnSwing.Visibility = Visibility.Collapsed;
4652
                    //instanceTop.cbSwingMode.Visibility = Visibility.Collapsed;
4653

    
4654
                    //instanceTop.btnExportPDF.Visibility = Visibility.Visible;
4655
                    //instanceTop.btnExportPrint.Visibility = Visibility.Visible;
4656
                }
4657
            }
4658
        }
4659

    
4660
        private void btnTeamConsolidate_Click(object sender, RoutedEventArgs e)
4661
        {
4662

    
4663
        }
4664

    
4665
        private void btnTeamConsolidate_Loaded(object sender, RoutedEventArgs e)
4666
        {
4667
            btnTeamConsolidate = sender as RadRibbonButton;
4668
            if (App.ViewInfo != null)
4669
            {
4670
                if (!App.ViewInfo.CreateFinalPDFPermission) //파이널이 True가 아니면
4671
                {
4672
                    if (btnConsolidate != null)
4673
                    {
4674
                        btnConsolidate.Visibility = Visibility.Collapsed;
4675
                    }
4676

    
4677
                    if (!App.ViewInfo.NewCommentPermission)
4678
                    {
4679
                        btnTeamConsolidate.Visibility = Visibility.Collapsed;
4680
                    }
4681
                }
4682
                else
4683
                {
4684
                    btnTeamConsolidate.Visibility = Visibility.Collapsed;
4685
                }
4686
            }
4687
        }
4688

    
4689
        private void FinalPDFEvent(object sender, RoutedEventArgs e)
4690
        {
4691
            //this.ParentOfType<MainWindow>().dzTopMenu.SaveEvent(null, null);
4692

    
4693
            var item = gridViewMarkup.Items.Cast<MarkupInfoItem>().Where(d => d.Consolidate == 1 && d.AvoidConsolidate == 0).FirstOrDefault();
4694
            if (item != null)
4695
            {
4696
                BaseClient.SetFinalPDFAsync(_ViewInfo.ProjectNO, _DocInfo.ID, item.MarkupInfoID, _ViewInfo.UserID);
4697
            }
4698
            else
4699
            {
4700
                DialogMessage_Alert("Consolidation 된 코멘트가 존재하지 않습니다", "안내");
4701
            }
4702
        }
4703

    
4704
        private void btnFinalPDF_Loaded(object sender, RoutedEventArgs e)
4705
        {
4706
            btnFinalPDF = sender as RadRibbonButton;
4707
            if (App.ViewInfo != null)
4708
            {
4709
                if (!App.ViewInfo.CreateFinalPDFPermission) //파이널이 True가 아니면
4710
                {
4711
                    btnFinalPDF.Visibility = System.Windows.Visibility.Collapsed;
4712
                    if (btnConsolidate != null)
4713
                    {
4714
                        btnConsolidate.Visibility = Visibility.Collapsed;
4715
                    }
4716
                }
4717
            }
4718
        }
4719

    
4720
        private void Button_Click(object sender, RoutedEventArgs e)
4721
        {
4722

    
4723
            //bool isGO = false;
4724
            //imageViewer.MouseLeftButtonDown += (sen, ea) =>
4725
            //  {
4726
            //      isGO = true;
4727
            //  };
4728
            //imageViewer.MouseLeftButtonUp += (sen, ea) =>
4729
            //{
4730
            //    isGO = false;
4731
            //};
4732
            //imageViewer.SizeMode = SizeMode.Fit;
4733
            //imageViewer.InteractiveMode = InteractiveMode.UserRectangle;
4734
            //imageViewer.InteractiveUserRectangle += (sen, ea) =>
4735
            //{
4736
            //    System.Diagnostics.Debug.WriteLine(ea.Bounds);
4737
            //    if (ea.Status == InteractiveModeStatus.End)
4738
            //    {
4739
            //        //zoomAndPanControl.ZoomTo(ea.Bounds);
4740
            //        zoomAndPanControl.ZoomTo(ea.Bounds);
4741
            //    }
4742

    
4743
            //};
4744

    
4745
            //Canvas.SetZIndex(imageViewer, 10);
4746
            //gather information on the viewer
4747

    
4748

    
4749
            //System.Windows.Forms.OpenFileDialog dialog = new System.Windows.Forms.OpenFileDialog();
4750
            //var result = dialog.ShowDialog();
4751
            //if (result == System.Windows.Forms.DialogResult.OK)
4752
            //{
4753
            //    using (Leadtools.Codecs.RasterCodecs codecs = new Leadtools.Codecs.RasterCodecs())
4754
            //    {
4755
            //        imageViewer.Image = codecs.Load(dialog.FileName, 0, Leadtools.Codecs.CodecsLoadByteOrder.Gray, 1, 1);
4756
            //        //imageViewer.Image = codecs.Load(dialog.FileName, 24, Leadtools.Codecs.CodecsLoadByteOrder.BgrOrGray, 1, 1);
4757
            //        //imageViewer.Image.AnimationBackground = Leadtools.RasterColor.White;
4758

    
4759
            //        //var d = imageViewer.Image.CreateThumbnail(100, 100, 24, Leadtools.RasterViewPerspective.TopLeft, Leadtools.RasterSizeFlags.None);
4760
            //        //RasterImageViewer vvv = new RasterImageViewer();
4761
            //        //vvv.Image = d;
4762
            //        //zoomAndPanCanvas.Children.Add(vvv);
4763

    
4764
            //        zoomAndPanCanvas.Width = Convert.ToDouble(imageViewer.Image.ImageWidth);
4765
            //        zoomAndPanCanvas.Height = Convert.ToDouble(imageViewer.Image.ImageHeight);
4766

    
4767
            //        Common.ViewerDataModel.Instance.ContentWidth = zoomAndPanCanvas.Width;
4768
            //        Common.ViewerDataModel.Instance.ContentHeight = zoomAndPanCanvas.Height;
4769
            //        //zoomAndPanControl.AnimatedScaleToFit();
4770
            //        zoomAndPanControl.ScaleToFit();
4771
            //    }
4772
            //}
4773

    
4774
        }//괄호 다시 확인 필요
4775

    
4776
        //강인구 추가
4777
        //가로 세로 동일한 컨트롤 그리기(계산 다시 필요)
4778
        private Point ShiftDrawing(Point StartP, Point EndP)
4779
        {
4780
            Point Return_Point = EndP;
4781
            //Shift key를 눌렀을때만 발동
4782
            if (ViewerDataModel.Instance.IsPressShift)
4783
            {
4784
                Square square = new Square();
4785
                double pt_X = 0;
4786
                double pt_Y = 0;
4787
                double result = 0;
4788

    
4789
                //pt_X = Math.Max(StartP.X, EndP.X) - Math.Min(StartP.X, EndP.X);
4790
                //pt_Y = Math.Max(StartP.Y, EndP.Y) - Math.Min(StartP.Y, EndP.Y);
4791
                if (EndP.X > StartP.X && EndP.Y > StartP.Y)
4792
                {
4793
                    pt_X = EndP.X - StartP.X;
4794
                    pt_Y = EndP.Y - StartP.Y;
4795
                }
4796
                else if (EndP.X < StartP.X && EndP.Y > StartP.Y)
4797
                {
4798
                    pt_X = StartP.X - EndP.X;
4799
                    pt_Y = EndP.Y - StartP.Y;
4800
                }
4801
                else if (EndP.X > StartP.X && EndP.Y < StartP.Y)
4802
                {
4803
                    pt_X = EndP.X - StartP.X;
4804
                    pt_Y = StartP.Y - EndP.Y
4805
;
4806
                }
4807
                result = Math.Max(pt_X, pt_Y) - Math.Min(pt_X, pt_Y);
4808
                if (pt_X < pt_Y)
4809
                {
4810
                    Return_Point = new Point(EndP.X + result, EndP.Y);
4811
                }
4812
                else
4813
                {
4814
                    Return_Point = new Point(EndP.X, EndP.Y + result);
4815
                }
4816
            }
4817

    
4818
            return Return_Point;
4819
        }
4820

    
4821
        private void SyncCompare_Click(object sender, RoutedEventArgs e)
4822
        {
4823
            if (CompareMode.IsChecked)
4824
            {
4825
                if (ViewerDataModel.Instance.PageBalanceMode && ViewerDataModel.Instance.PageBalanceNumber == 0)
4826
                {
4827
                    ViewerDataModel.Instance.PageBalanceNumber = 1;
4828
                }
4829
                if (ViewerDataModel.Instance.PageNumber == 0)
4830
                {
4831
                    ViewerDataModel.Instance.PageNumber = 1;
4832
                }
4833

    
4834
                //BaseClient.GetCompareRectAsync(_ViewInfo.ProjectNO, _ViewInfo.DocumentItemID, CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber.ToString(), ViewerDataModel.Instance.PageBalanceMode ? ViewerDataModel.Instance.PageBalanceNumber.ToString() : pageNavigator.CurrentPage.PageNumber.ToString());
4835
                BaseClient.GetCompareRectAsync(_ViewInfo.ProjectNO, _ViewInfo.DocumentItemID, CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber.ToString(), ViewerDataModel.Instance.PageNumber.ToString());
4836

    
4837
                //string originFile = String.Format(@"http://cloud.devdoftech.co.kr:5977/TileSource/{0}_Tile/{1}/{2}/{3}.png", _ViewInfo.ProjectNO, (Convert.ToInt32(_ViewInfo.DocumentItemID) / 100).ToString(), _ViewInfo.DocumentItemID, pageNavigator.CurrentPage.PageNumber);
4838
                //string targetFile = String.Format(@"http://cloud.devdoftech.co.kr:5977/TileSource/{0}_Tile/{1}/{2}/{3}.png", _ViewInfo.ProjectNO, (Convert.ToInt32(CurrentRev.DOCUMENT_ID) / 100).ToString(), CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber);
4839

    
4840
                //MARKUS.CompareLib compareLib = new MARKUS.CompareLib();
4841
                //System.IO.Stream resultOrigin = compareLib.ChangeCmpUrlToPng(originFile);
4842
                //System.IO.Stream resultTarget = compareLib.ChangeCmpUrlToPng(targetFile);
4843

    
4844
                //var resultOrigin = compareLib.ChangeCmpUrlToPng_File(originFile);
4845
                //var resultTarget = compareLib.ChangeCmpUrlToPng_File(targetFile);
4846

    
4847
                //string outPutFile = compareLib.ImageCompare_File(resultOrigin, resultTarget);
4848
                //var result = compareLib.GetBoundBoxInImage(outPutFile);
4849

    
4850
                //SolidColorBrush mySolidColorBrush = new SolidColorBrush();
4851
                //mySolidColorBrush.Color = Color.FromArgb(255, 255, 255, 0);
4852

    
4853
                //result.ForEach(d =>
4854
                //{
4855
                //    d.Width = d.Width * 3;
4856
                //    d.Height = d.Height * 3;
4857
                //    var point = MathSet.getRectMiddlePoint(d);
4858
                //    Ellipse myEllipse = new Ellipse();
4859
                //    myEllipse.Fill = new SolidColorBrush(Colors.Red);
4860
                //    myEllipse.Opacity = 1;
4861
                //        //myEllipse.StrokeThickness = 2;
4862
                //        //myEllipse.Stroke = Brushes.Black;
4863
                //        myEllipse.Width = d.Width;
4864
                //    myEllipse.Height = d.Height;
4865
                //    Canvas.SetLeft(myEllipse, d.X - ((point.X - d.X) / 2.0));
4866
                //    Canvas.SetTop(myEllipse, d.Y - ((point.Y - d.Y) / 2.0));
4867
                //    myEllipse.RenderTransformOrigin = point;
4868
                //    canvas_compareBorder.Children.Add(myEllipse);
4869
                //});
4870

    
4871
                //da.From = 0.8;
4872
                //da.To = 0;
4873
                //da.Duration = new Duration(TimeSpan.FromSeconds(1));
4874
                //da.AutoReverse = true;
4875
                //canvas_compareBorder.BeginAnimation(OpacityProperty, da);
4876
            }
4877
            else
4878
            {
4879
                da.From = 1;
4880
                da.To = 1;
4881
                da.Duration = new Duration(TimeSpan.FromSeconds(9999));
4882
                da.AutoReverse = false;
4883
                canvas_compareBorder.Children.Clear();
4884
                canvas_compareBorder.BeginAnimation(OpacityProperty, da);
4885
            }
4886
        }
4887

    
4888
        private void SyncUserListExpender_Click(object sender, RoutedEventArgs e)
4889
        {
4890
            if (UserList.IsChecked)
4891
            {
4892
                this.gridViewRevMarkup.Visibility = Visibility.Visible;
4893
            }
4894
            else
4895
            {
4896
                this.gridViewRevMarkup.Visibility = Visibility.Collapsed;
4897
            }
4898
            //if ((sender as RadToggleButton).IsChecked == true)
4899
            //{
4900
            //    this.gridViewRevMarkup.Visibility = Visibility.Visible;
4901
            //}
4902
            //else
4903
            //{
4904
            //    this.gridViewRevMarkup.Visibility = Visibility.Collapsed;
4905
            //}
4906
        }
4907

    
4908
        private void SyncPageBalance_Click(object sender, RoutedEventArgs e)
4909
        {
4910
            //ViewerDataModel.Instance.PageBalanceNumber = ViewerDataModel.Instance.PageBalanceNumber <= 0 ? Convert.ToInt32((sender as System.Windows.Controls.Control).Tag) : ViewerDataModel.Instance.PageBalanceNumber;
4911
            //ViewerDataModel.Instance.PageBalanceNumber = 0;
4912

    
4913

    
4914
            if (BalanceMode.IsChecked)
4915
            {
4916
                ViewerDataModel.Instance.PageBalanceMode = true;
4917
            }
4918
            else
4919
            {
4920
                ViewerDataModel.Instance.PageBalanceMode = false;
4921
                ViewerDataModel.Instance.PageBalanceNumber = 0;
4922
            }
4923
            //if ((sender as RadToggleButton).IsChecked == true)
4924
            //{
4925
            //    ViewerDataModel.Instance.PageBalanceMode = true;
4926
            //}
4927
            //else
4928
            //{
4929
            //    ViewerDataModel.Instance.PageBalanceMode = false;
4930
            //    ViewerDataModel.Instance.PageBalanceNumber = 0;
4931
            //}
4932
        }
4933

    
4934
        private void SyncExit_Click(object sender, RoutedEventArgs e)
4935
        {
4936
            //초기화
4937
            testPanel2.IsHidden = true;
4938
            ViewerDataModel.Instance.PageBalanceMode = false;
4939
            ViewerDataModel.Instance.PageBalanceNumber = 0;
4940
            ViewerDataModel.Instance.PageNumber = 0;
4941
            ViewerDataModel.Instance.MarkupControls_Sync.Clear();
4942
            this.gridViewRevMarkup.Visibility = Visibility.Collapsed;
4943
            UserList.IsChecked = false;
4944
            BalanceMode.IsChecked = false;
4945
        }
4946

    
4947
        private void SyncPageChange_Click(object sender, RoutedEventArgs e)
4948
        {
4949
            if ((sender as System.Windows.Controls.Control).Tag != null)
4950
            {
4951
                //Compare 초기화
4952
                CompareMode.IsChecked = false;
4953
                var balancePoint = Convert.ToInt32((sender as System.Windows.Controls.Control).Tag);
4954

    
4955
                //if (ViewerDataModel.Instance.PageBalanceNumber == 0)
4956
                //{
4957
                //    ViewerDataModel.Instance.PageBalanceNumber = 1;
4958
                //}
4959

    
4960
                if (ViewerDataModel.Instance.PageNumber == 0)
4961
                {
4962
                    ViewerDataModel.Instance.PageNumber = 1;
4963
                }
4964

    
4965
                if (ViewerDataModel.Instance.PageBalanceNumber == pageNavigator.PageCount)
4966
                {
4967
                }
4968
                else
4969
                {
4970
                    ViewerDataModel.Instance.PageBalanceNumber += balancePoint;
4971
                }
4972
                //else if ((ViewerDataModel.Instance.PageBalanceNumber + balancePoint) >= 1)
4973
                //{
4974
                //    //ViewerDataModel.Instance.PageBalanceNumber += balancePoint;
4975
                //    ViewerDataModel.Instance.PageBalanceNumber += balancePoint;
4976
                //}
4977

    
4978
                if (ViewerDataModel.Instance.PageNumber == pageNavigator.PageCount && balancePoint > 0)
4979
                {
4980

    
4981
                }
4982
                else if ((ViewerDataModel.Instance.PageNumber + balancePoint) >= 1)
4983
                {
4984
                    ViewerDataModel.Instance.PageNumber += balancePoint;
4985
                }
4986

    
4987
                if (!testPanel2.IsHidden)
4988
                {
4989
                    //using (Leadtools.Codecs.RasterCodecs codecs = new Leadtools.Codecs.RasterCodecs())
4990
                    //{
4991
                    if (IsSyncPDFMode)
4992
                    {
4993
                        Get_FinalImage.Get_PdfImage get_PdfImage = new Get_FinalImage.Get_PdfImage();
4994
                        var pdfpath = new BitmapImage(new Uri(get_PdfImage.Run(CurrentRev.TO_VENDOR, App.ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, ViewerDataModel.Instance.PageNumber)));
4995

    
4996
                        if (pdfpath.IsDownloading)
4997
                        {
4998
                            pdfpath.DownloadCompleted += (ex, arg) =>
4999
                            {
5000
                                ViewerDataModel.Instance.ImageViewPath_C = pdfpath;
5001
                                ViewerDataModel.Instance.ImageViewWidth_C = pdfpath.PixelWidth;
5002
                                ViewerDataModel.Instance.ImageViewHeight_C = pdfpath.PixelHeight;
5003
                                zoomAndPanCanvas2.Width = pdfpath.PixelWidth;
5004
                                zoomAndPanCanvas2.Height = pdfpath.PixelHeight;
5005
                            };
5006
                        }
5007
                        else
5008
                        {
5009
                            ViewerDataModel.Instance.ImageViewPath_C = pdfpath;
5010
                            ViewerDataModel.Instance.ImageViewWidth_C = pdfpath.PixelWidth;
5011
                            ViewerDataModel.Instance.ImageViewHeight_C = pdfpath.PixelHeight;
5012

    
5013
                            zoomAndPanCanvas2.Width = pdfpath.PixelWidth;
5014
                            zoomAndPanCanvas2.Height = pdfpath.PixelHeight;
5015
                        }
5016

    
5017

    
5018
                        //PDF Mode 잠시대기
5019
                        //Leadtools.Pdf.PDFDocument dpc = new Leadtools.Pdf.PDFDocument(ViewerDataModel.Instance.GetStreamFromUrl(CurrentRev.TO_VENDOR));
5020
                        //var image = dpc.GetPageImage(codecs, ViewerDataModel.Instance.PageNumber);
5021
                        //Leadtools.ImageProcessing.SizeCommand size = new Leadtools.ImageProcessing.SizeCommand((int)imageViewer.Image.Width, (int)imageViewer.Image.Height, Leadtools.RasterSizeFlags.Resample);
5022
                        //size.Run(image);
5023
                        //image.XResolution = 150;
5024
                        //image.YResolution = 150;
5025
                        //imageViewer_Compare.Image = image;
5026
                    }
5027
                    else
5028
                    {
5029
                        //var uri = String.Format(@"http://cloud.devdoftech.co.kr:5977/TileSource/{0}_Tile/{1}/{2}/{3}.cmp", _ViewInfo.ProjectNO, (Convert.ToInt32(CurrentRev.DOCUMENT_ID) / 100).ToString(), CurrentRev.DOCUMENT_ID, ViewerDataModel.Instance.PageBalanceNumber);
5030
                        //var uri = String.Format(@"http://cloud.devdoftech.co.kr:5977/TileSource/{0}_Tile/{1}/{2}/{3}.cmp", _ViewInfo.ProjectNO, (Convert.ToInt32(CurrentRev.DOCUMENT_ID) / 100).ToString(), CurrentRev.DOCUMENT_ID, ViewerDataModel.Instance.PageNumber);
5031
                        var uri = String.Format(@"http://cloud.devdoftech.co.kr:5977/TileSource/{0}_Tile/{1}/{2}/{3}.png", _ViewInfo.ProjectNO, (Convert.ToInt32(CurrentRev.DOCUMENT_ID) / 100).ToString(), CurrentRev.DOCUMENT_ID, ViewerDataModel.Instance.PageNumber);
5032
                        //imageViewer_Compare.Image = codecs.Load(ViewerDataModel.Instance.GetStreamFromUrl(uri), 0, Leadtools.Codecs.CodecsLoadByteOrder.BgrOrGray, 1, 1);
5033

    
5034
                        var defaultBitmapImage_Compare = new BitmapImage(new Uri(uri));
5035

    
5036
                        ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare;
5037
                        ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth;
5038
                        ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight;
5039

    
5040
                        zoomAndPanCanvas2.Width = defaultBitmapImage_Compare.PixelWidth;
5041
                        zoomAndPanCanvas2.Height = defaultBitmapImage_Compare.PixelHeight;
5042

    
5043
                        if (defaultBitmapImage_Compare.IsDownloading)
5044
                        {
5045
                            defaultBitmapImage_Compare.DownloadCompleted += (ex, arg) =>
5046
                            {
5047
                                ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare;
5048
                                ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth;
5049
                                ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight;
5050

    
5051
                                zoomAndPanCanvas2.Width = defaultBitmapImage_Compare.PixelWidth;
5052
                                zoomAndPanCanvas2.Height = defaultBitmapImage_Compare.PixelHeight;
5053
                            };
5054
                        }
5055
                    }
5056

    
5057
                    //강인구 추가(페이지 이동시 코멘트 재 호출)
5058
                    ViewerDataModel.Instance.MarkupControls_Sync.Clear();
5059
                    List<MarkupInfoItem> gridSelectionRevItem = gridViewRevMarkup.SelectedItems.Cast<MarkupInfoItem>().ToList();
5060

    
5061
                    foreach (var item in gridSelectionRevItem)
5062
                    {
5063
                        item.MarkupList.Where(pageItem => pageItem.PageNumber == ViewerDataModel.Instance.PageNumber).ToList().ForEach(delegate (MarkupItem markupitem)
5064
                        {
5065
                            layerControl.markupParse(markupitem.Data, Common.ViewerDataModel.Instance.MarkupControls_Sync, item.DisplayColor, "", item.MarkupInfoID);
5066
                        });
5067
                    }
5068

    
5069

    
5070
                    //zoomAndPanCanvas2.Width = imageViewer_Compare.Image.Width;
5071
                    //zoomAndPanCanvas2.Height = imageViewer_Compare.Image.Height;
5072
                    //강인구 추가
5073
                    zoomAndPanControl2.ZoomTo(new Rect
5074
                    {
5075
                        X = 0,
5076
                        Y = 0,
5077
                        Width = Math.Max(zoomAndPanCanvas.Width, zoomAndPanCanvas2.Width),
5078
                        Height = Math.Max(zoomAndPanCanvas.Height, zoomAndPanCanvas2.Height),
5079
                    });
5080
                    //}
5081
                    //tlSyncRev.Text = String.Format("Rev. {0}", CurrentRev.RevNo);
5082
                    //tlSyncPageNum.Text = String.Format("Current Page : {0}", ViewerDataModel.Instance.PageBalanceNumber);
5083
                    tlSyncPageNum.Text = String.Format("Current Page : {0}", ViewerDataModel.Instance.PageNumber);
5084

    
5085
                }
5086
            }
5087
        }
5088

    
5089
        private void SyncChange_Click(object sender, RoutedEventArgs e)
5090
        {
5091
            //if ((sender as RadToggleButton).IsChecked)
5092
            if (MarkupMode.IsChecked)
5093
            {
5094
                //(sender as RadToggleButton).Content = "PDF Mode";
5095
                IsSyncPDFMode = true;
5096

    
5097
                var uri = CurrentRev.TO_VENDOR;
5098
                //Leadtools.Pdf.PDFDocument dpc = new Leadtools.Pdf.PDFDocument(ViewerDataModel.Instance.GetStreamFromUrl(uri));
5099
                //using (Leadtools.Codecs.RasterCodecs codecs = new Leadtools.Codecs.RasterCodecs())
5100
                //{
5101
                //if (ViewerDataModel.Instance.PageBalanceNumber == 0)
5102
                //{
5103
                //    ViewerDataModel.Instance.PageBalanceNumber = 1;
5104
                //}
5105
                if (ViewerDataModel.Instance.PageNumber == 0)
5106
                {
5107
                    ViewerDataModel.Instance.PageNumber = 1;
5108
                }
5109

    
5110
                //var image = dpc.GetPageImage(codecs, ViewerDataModel.Instance.PageBalanceNumber);
5111

    
5112
                //PDF모드 잠시 대기(강인구)
5113
                Get_FinalImage.Get_PdfImage get_PdfImage = new Get_FinalImage.Get_PdfImage();
5114
                var pdfpath = new BitmapImage(new Uri(get_PdfImage.Run(CurrentRev.TO_VENDOR, App.ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, ViewerDataModel.Instance.PageNumber)));
5115

    
5116
                //System.Net.WebClient client = new System.Net.WebClient();
5117
                //byte[] imageBytes = client.DownloadData(new Uri(get_PdfImage.Run(CurrentRev.TO_VENDOR, App.ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, ViewerDataModel.Instance.PageNumber)));
5118
                //System.Drawing.Image img;
5119
                //System.IO.MemoryStream ms = new System.IO.MemoryStream(imageBytes, 0, imageBytes.Length);
5120
                //ms.Write(imageBytes, 0, imageBytes.Length);
5121
                //img = System.Drawing.Image.FromStream(ms, true);//Exception occurs here
5122

    
5123
                if (pdfpath.IsDownloading)
5124
                {
5125
                    pdfpath.DownloadCompleted += (ex, arg) =>
5126
                    {
5127
                        ViewerDataModel.Instance.ImageViewPath_C = pdfpath;
5128
                        ViewerDataModel.Instance.ImageViewWidth_C = pdfpath.PixelWidth;
5129
                        ViewerDataModel.Instance.ImageViewHeight_C = pdfpath.PixelHeight;
5130
                        zoomAndPanCanvas2.Width = pdfpath.PixelWidth;
5131
                        zoomAndPanCanvas2.Height = pdfpath.PixelHeight;
5132
                    };
5133
                }
5134
                else
5135
                {
5136
                    ViewerDataModel.Instance.ImageViewPath_C = pdfpath;
5137
                    ViewerDataModel.Instance.ImageViewWidth_C = pdfpath.PixelWidth;
5138
                    ViewerDataModel.Instance.ImageViewHeight_C = pdfpath.PixelHeight;
5139

    
5140
                    zoomAndPanCanvas2.Width = pdfpath.PixelWidth;
5141
                    zoomAndPanCanvas2.Height = pdfpath.PixelHeight;
5142
                }
5143

    
5144
                //var image = dpc.GetPageImage(codecs, ViewerDataModel.Instance.PageNumber);
5145
                //Leadtools.ImageProcessing.SizeCommand size = new Leadtools.ImageProcessing.SizeCommand((int)imageViewer.Image.Width, (int)imageViewer.Image.Height, Leadtools.RasterSizeFlags.Resample);
5146
                //size.Run(image);
5147
                //image.XResolution = 150;
5148
                //image.YResolution = 150;
5149
                //imageViewer_Compare.Image = image;
5150
                //}
5151
            }
5152
            else
5153
            {
5154
                //(sender as RadToggleButton).Content = "Markup Mode";
5155
                IsSyncPDFMode = false;
5156

    
5157
                //using (Leadtools.Codecs.RasterCodecs codecs = new Leadtools.Codecs.RasterCodecs())
5158
                //{
5159
                //var uri = String.Format(@"http://cloud.devdoftech.co.kr:5977/TileSource/{0}_Tile/{1}/{2}/{3}.cmp", _ViewInfo.ProjectNO, (Convert.ToInt32(CurrentRev.DOCUMENT_ID) / 100).ToString(), CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber);
5160
                var uri = String.Format(@"http://cloud.devdoftech.co.kr:5977/TileSource/{0}_Tile/{1}/{2}/{3}.png", _ViewInfo.ProjectNO, (Convert.ToInt32(CurrentRev.DOCUMENT_ID) / 100).ToString(), CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber);
5161

    
5162
                var defaultBitmapImage_Compare = new BitmapImage(new Uri(uri));
5163

    
5164
                ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare;
5165
                ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth;
5166
                ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight;
5167

    
5168
                if (defaultBitmapImage_Compare.IsDownloading)
5169
                {
5170
                    defaultBitmapImage_Compare.DownloadCompleted += (ex, arg) =>
5171
                    {
5172
                        ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare;
5173
                        ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth;
5174
                        ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight;
5175
                    };
5176
                }
5177

    
5178
                //imageViewer_Compare.Image = codecs.Load(ViewerDataModel.Instance.GetStreamFromUrl(uri), 0, Leadtools.Codecs.CodecsLoadByteOrder.BgrOrGray, 1, 1);
5179
                zoomAndPanControl2.ApplyTemplate();
5180
                zoomAndPanControl2.UpdateLayout();
5181
                zoomAndPanCanvas2.Width = Convert.ToDouble(Common.ViewerDataModel.Instance.ContentWidth);
5182
                zoomAndPanCanvas2.Height = Convert.ToDouble(Common.ViewerDataModel.Instance.ContentHeight);
5183
                //}
5184
            }
5185

    
5186
            //var options = new Leadtools.Documents.LoadDocumentAsyncOptions();
5187
            //options.FirstPageNumber = pageNavigator.CurrentPage.PageNumber;
5188
            //options.LastPageNumber = pageNavigator.CurrentPage.PageNumber;
5189
            ////options.LoadEmbeddedAnnotations = true;
5190
            ////options.UseCache = true;
5191
            //options.Completed += (sen, ea) =>
5192
            //{
5193
            //    //ea.Document.Pages[0].GetAnnotations(true);
5194
            //    //SetAnnotations
5195
            //    imageViewer_Compare.Image = ea.Document.Pages[0].GetImage();
5196

    
5197
            //    zoomAndPanCanvas2.Width = Convert.ToDouble(imageViewer_Compare.Image.Width);
5198
            //    zoomAndPanCanvas2.Height = Convert.ToDouble(imageViewer_Compare.Image.Height);
5199
            //};
5200
            //var uri = new Uri("http://cloud.devdoftech.co.kr:5977/FinalPDF/000000_app/VPCS_DOCLIB/111111/11111111/ToVendor/TEST_C_A.pdf");
5201
            //Leadtools.Documents.DocumentFactory.LoadFromUriAsync(uri, options);
5202

    
5203

    
5204
        }
5205

    
5206
        private void RadButton_Click(object sender, RoutedEventArgs e)
5207
        {
5208
            gridViewHistory_Busy.IsBusy = true;
5209

    
5210
            RadButton instance = sender as RadButton;
5211
            if (instance.CommandParameter != null)
5212
            {
5213
                CurrentRev = instance.CommandParameter as VPRevision;
5214
                BaseClient.GetSyncMarkupInfoItemsCompleted += (sen, ea) =>
5215
                {
5216
                    if (ea.Error == null && ea.Result != null)
5217
                    {
5218
                        testPanel2.IsHidden = false;
5219
                        //testList.ItemsSource = ea.Result;
5220

    
5221
                        ViewerDataModel.Instance._markupInfoRevList = SetDisplayColor(ea.Result, _ViewInfo.UserID);
5222
                        gridViewRevMarkup.ItemsSource = ViewerDataModel.Instance._markupInfoRevList;
5223

    
5224
                        //using (Leadtools.Codecs.RasterCodecs codecs = new Leadtools.Codecs.RasterCodecs())
5225
                        //{
5226
                        //var uri = String.Format(@"http://cloud.devdoftech.co.kr:5977/TileSource/{0}_Tile/{1}/{2}/{3}.cmp", _ViewInfo.ProjectNO, (Convert.ToInt32(CurrentRev.DOCUMENT_ID) / 100).ToString(), CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber);
5227
                        var uri = String.Format(@"http://cloud.devdoftech.co.kr:5977/TileSource/{0}_Tile/{1}/{2}/{3}.png", _ViewInfo.ProjectNO, (Convert.ToInt32(CurrentRev.DOCUMENT_ID) / 100).ToString(), CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber);
5228

    
5229
                        Sync_Offset_Point = new Point(zoomAndPanControl.ContentOffsetX, zoomAndPanControl.ContentOffsetY);
5230

    
5231
                        var defaultBitmapImage_Compare = new BitmapImage(new Uri(uri));
5232

    
5233
                        ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare;
5234
                        ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth;
5235
                        ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight;
5236

    
5237
                        if (defaultBitmapImage_Compare.IsDownloading)
5238
                        {
5239
                            defaultBitmapImage_Compare.DownloadCompleted += (ex, arg) =>
5240
                            {
5241
                                ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare;
5242
                                ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth;
5243
                                ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight;
5244
                            };
5245
                        }
5246

    
5247
                        //imageViewer_Compare.Image = codecs.Load(ViewerDataModel.Instance.GetStreamFromUrl(uri), 0, Leadtools.Codecs.CodecsLoadByteOrder.BgrOrGray, 1, 1);
5248

    
5249
                        zoomAndPanCanvas2.Width = Convert.ToDouble(Common.ViewerDataModel.Instance.ContentWidth);
5250
                        zoomAndPanCanvas2.Height = Convert.ToDouble(Common.ViewerDataModel.Instance.ContentHeight);
5251
                        zoomAndPanControl2.RotationAngle = zoomAndPanControl.RotationAngle;
5252
                        //대기(강인구)
5253
                        //imageViewer_Compare.RotateAngle = imageViewer.RotateAngle;
5254
                        zoomAndPanControl2.ApplyTemplate();
5255
                        zoomAndPanControl2.UpdateLayout();
5256

    
5257
                        if (Sync_Offset_Point != new Point(zoomAndPanControl.ContentOffsetX, zoomAndPanControl.ContentOffsetY))
5258
                        {
5259
                            zoomAndPanControl.ContentOffsetX = Sync_Offset_Point.X;
5260
                            zoomAndPanControl.ContentOffsetY = Sync_Offset_Point.Y;
5261
                        }
5262
                        //}
5263

    
5264
                        tlSyncRev.Text = String.Format("Rev. {0}", CurrentRev.RevNo);
5265
                        tlSyncPageNum.Text = String.Format("Current Page : {0}", pageNavigator.CurrentPage.PageNumber);
5266
                        gridViewHistory_Busy.IsBusy = false;
5267
                    }
5268
                };
5269
                BaseClient.GetSyncMarkupInfoItemsAsync(_ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, _ViewInfo.UserID);
5270
            }
5271
        }
5272

    
5273
        public void Sync_Event(VPRevision Currnet_Rev)
5274
        {
5275
            CurrentRev = Currnet_Rev;
5276

    
5277
            BaseClient.GetSyncMarkupInfoItemsCompleted += (sen, ea) =>
5278
            {
5279
                if (ea.Error == null && ea.Result != null)
5280
                {
5281
                    testPanel2.IsHidden = false;
5282
                    //testList.ItemsSource = ea.Result;
5283

    
5284
                    ViewerDataModel.Instance._markupInfoRevList = SetDisplayColor(ea.Result, _ViewInfo.UserID);
5285
                    gridViewRevMarkup.ItemsSource = ViewerDataModel.Instance._markupInfoRevList;
5286

    
5287
                    //using (Leadtools.Codecs.RasterCodecs codecs = new Leadtools.Codecs.RasterCodecs())
5288
                    //{
5289
                    //var uri = String.Format(@"http://cloud.devdoftech.co.kr:5977/TileSource/{0}_Tile/{1}/{2}/{3}.cmp", _ViewInfo.ProjectNO, (Convert.ToInt32(CurrentRev.DOCUMENT_ID) / 100).ToString(), CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber);
5290
                    var uri = String.Format(@"http://cloud.devdoftech.co.kr:5977/TileSource/{0}_Tile/{1}/{2}/{3}.png", _ViewInfo.ProjectNO, (Convert.ToInt32(CurrentRev.DOCUMENT_ID) / 100).ToString(), CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber);
5291

    
5292
                    Sync_Offset_Point = new Point(zoomAndPanControl.ContentOffsetX, zoomAndPanControl.ContentOffsetY);
5293

    
5294
                    var defaultBitmapImage_Compare = new BitmapImage(new Uri(uri));
5295

    
5296
                    ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare;
5297
                    ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth;
5298
                    ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight;
5299

    
5300
                    if (defaultBitmapImage_Compare.IsDownloading)
5301
                    {
5302
                        defaultBitmapImage_Compare.DownloadCompleted += (ex, arg) =>
5303
                        {
5304
                            ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare;
5305
                            ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth;
5306
                            ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight;
5307
                        };
5308
                    }
5309

    
5310
                    //imageViewer_Compare.Image = codecs.Load(ViewerDataModel.Instance.GetStreamFromUrl(uri), 0, Leadtools.Codecs.CodecsLoadByteOrder.BgrOrGray, 1, 1);
5311

    
5312
                    zoomAndPanCanvas2.Width = Convert.ToDouble(Common.ViewerDataModel.Instance.ContentWidth);
5313
                    zoomAndPanCanvas2.Height = Convert.ToDouble(Common.ViewerDataModel.Instance.ContentHeight);
5314
                    zoomAndPanControl2.ApplyTemplate();
5315
                    zoomAndPanControl2.UpdateLayout();
5316

    
5317
                    if (Sync_Offset_Point != new Point(zoomAndPanControl.ContentOffsetX, zoomAndPanControl.ContentOffsetY))
5318
                    {
5319
                        zoomAndPanControl.ContentOffsetX = Sync_Offset_Point.X;
5320
                        zoomAndPanControl.ContentOffsetY = Sync_Offset_Point.Y;
5321
                    }
5322
                    //}
5323

    
5324
                    tlSyncRev.Text = String.Format("Rev. {0}", CurrentRev.RevNo);
5325
                    tlSyncPageNum.Text = String.Format("Current Page : {0}", pageNavigator.CurrentPage.PageNumber);
5326
                    gridViewHistory_Busy.IsBusy = false;
5327
                }
5328
            };
5329
            BaseClient.GetSyncMarkupInfoItemsAsync(_ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, _ViewInfo.UserID);
5330

    
5331

    
5332
        }
5333

    
5334
        private void PdfLink_ButtonDown(object sender, MouseButtonEventArgs e)
5335
        {
5336
            if (sender is Image)
5337
            {
5338
                if ((sender as Image).Tag != null)
5339
                {
5340
                    var pdfUrl = (sender as Image).Tag.ToString();
5341
                    System.Diagnostics.Process.Start(pdfUrl);
5342
                }
5343
                else
5344
                {
5345
                    this.ParentOfType<MainWindow>().DialogMessage_Alert("문서 정보가 잘못 되었습니다", "안내");
5346
                }
5347
            }
5348
        }
5349

    
5350
        private void Create_Symbol(object sender, RoutedEventArgs e)
5351
        {
5352
            MarkupToPDF.Controls.Parsing.LayerControl.MarkupReturn markupReturn = new MarkupToPDF.Controls.Parsing.LayerControl.MarkupReturn();
5353
            MarkupToPDF.Controls.Parsing.LayerControl layer = new MarkupToPDF.Controls.Parsing.LayerControl();
5354

    
5355
            if (SelectLayer.Children.Count < 1) //선택된 것이 없으면
5356
            {
5357
                DialogMessage_Alert("Please Select Controls", "Alert");
5358
            }
5359
            else //선택된 것이 있으면
5360
            {
5361
                string MarkupData = "";
5362
                adorner_ = new AdornerFinal();
5363

    
5364
                foreach (var item in SelectLayer.Children)
5365
                {
5366
                    if (item.GetType().Name == "AdornerFinal")
5367
                    {
5368
                        adorner_ = (item as Controls.AdornerFinal);
5369
                        foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
5370
                        {
5371
                            if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
5372
                            {
5373
                                markupReturn = layer.MarkupToString(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo, App.ViewInfo.UserID);
5374
                                MarkupData += markupReturn.ConvertData;
5375
                            }
5376
                        }
5377
                    }
5378
                }
5379
                DialogParameters parameters = new DialogParameters()
5380
                {
5381
                    Closed = (obj, args) => this.MarkupNamePromptClose(MarkupData, args),
5382
                    DefaultPromptResultValue = "Custom State",
5383
                    Content = "Name :",
5384
                    Header = "Insert Custom Symbol Name",
5385
                    Theme = new VisualStudio2013Theme(),
5386
                    ModalBackground = new SolidColorBrush { Color = Colors.Black, Opacity = 0.6 },
5387
                };
5388
                RadWindow.Prompt(parameters);
5389
            }
5390

    
5391
        }
5392

    
5393
        private void MarkupNamePromptClose(string data, WindowClosedEventArgs args)
5394
        {
5395
            Save save = new Save();
5396

    
5397
            if (args.DialogResult.Value)
5398
            {
5399
                PngBitmapEncoder _Encoder = symImage(data);
5400

    
5401
                System.IO.MemoryStream fs = new System.IO.MemoryStream();
5402
                _Encoder.Save(fs);
5403
                System.Drawing.Image ImgOut = System.Drawing.Image.FromStream(fs);
5404

    
5405
                byte[] Img_byte = fs.ToArray();
5406

    
5407
                kr.co.devdoftech.cloud.FileUpload fileUploader = new kr.co.devdoftech.cloud.FileUpload();
5408
                filename = fileUploader.Run(App.ViewInfo.ProjectNO, _DocItem.DOCUMENT_NO, App.ViewInfo.UserID, Save.shortGuid() + ".png", Img_byte);
5409

    
5410
                save.SymbolSave(args.PromptResult, filename, data);
5411
            }
5412
        }
5413

    
5414
        public PngBitmapEncoder symImage(string data)
5415
        {
5416

    
5417
            Canvas _canvas = new Canvas();
5418
            _canvas.Background = Brushes.White;
5419
            _canvas.Width = adorner_.BorderSize.Width;
5420
            _canvas.Height = adorner_.BorderSize.Height;
5421
            layerControl.markupParse(data, _canvas, "#FFFF0000", "");
5422

    
5423
            BitmapEncoder encoder = new PngBitmapEncoder();
5424

    
5425

    
5426
            RenderTargetBitmap renderBitmap = new RenderTargetBitmap((int)_canvas.Width + 50, (int)_canvas.Height + 50, 96d, 96d, PixelFormats.Pbgra32);
5427

    
5428
            DrawingVisual dv = new DrawingVisual();
5429

    
5430
            _canvas.Measure(new System.Windows.Size(adorner_.BorderSize.Width + 50, adorner_.BorderSize.Height + 50));
5431
            //_canvas.Arrange(new Rect(new System.Windows.Point { X = -adorner_.BorderSize.X - 50, Y = -adorner_.BorderSize.Y - 50 }, new Point(adorner_.BorderSize.Width + 20, adorner_.BorderSize.Height + 20)));
5432
            _canvas.Arrange(new Rect(new System.Windows.Point { X = -adorner_.BorderSize.X - 20, Y = -adorner_.BorderSize.Y - 20 }, new Point(adorner_.BorderSize.Width + 20, adorner_.BorderSize.Height + 20)));
5433

    
5434
            using (DrawingContext ctx = dv.RenderOpen())
5435
            {
5436
                VisualBrush vb = new VisualBrush(_canvas);
5437
                //ctx.DrawRectangle(vb, null, new Rect(new System.Windows.Point { X = -adorner_.BorderSize.X - 20, Y = -adorner_.BorderSize.Y - 20 }, new Point(adorner_.BorderSize.Width + 20, adorner_.BorderSize.Height + 20)));
5438
                ctx.DrawRectangle(vb, null, new Rect(new System.Windows.Point { X = -adorner_.BorderSize.X, Y = -adorner_.BorderSize.Y }, new Point(adorner_.BorderSize.Width + 20, adorner_.BorderSize.Height + 20)));
5439
            }
5440

    
5441
            try
5442
            {
5443
                renderBitmap.Render(dv);
5444

    
5445
                GC.Collect();
5446
                GC.WaitForPendingFinalizers();
5447
                GC.Collect();
5448
                //bitmap.Render(controlToConvert);
5449
                // encode png data
5450
                PngBitmapEncoder pngEncoder = new PngBitmapEncoder();
5451
                // puch rendered bitmap into it
5452
                pngEncoder.Interlace = PngInterlaceOption.Off;
5453
                pngEncoder.Frames.Add(BitmapFrame.Create(renderBitmap));
5454
                return pngEncoder;
5455

    
5456
            }
5457
            catch (Exception ex)
5458
            {
5459
                return null;
5460
            }
5461

    
5462
        }
5463

    
5464
        public void DialogMessage_Alert(string content, string header)
5465
        {
5466
            var box = new TextBlock();
5467
            box.MinWidth = 400;
5468
            box.FontSize = 11;
5469
            //box.FontSize = 12;
5470
            box.Text = content;
5471
            box.TextWrapping = System.Windows.TextWrapping.Wrap;
5472

    
5473
            DialogParameters parameters = new DialogParameters()
5474
            {
5475
                Content = box,
5476
                Header = header,
5477
                Theme = new VisualStudio2013Theme(),
5478
                ModalBackground = new SolidColorBrush { Color = Colors.Black, Opacity = 0.6 },
5479
            };
5480
            RadWindow.Alert(parameters);
5481
        }
5482

    
5483
        #region 캡쳐 기능
5484

    
5485
        public BitmapSource CutAreaToImage(int x, int y, int width, int height)
5486
        {
5487
            if (x < 0)
5488
            {
5489
                width += x;
5490
                x = 0;
5491
            }
5492
            if (y < 0)
5493
            {
5494
                height += y;
5495
                y = 0;
5496

    
5497
                width = (int)zoomAndPanCanvas.ActualWidth - x;
5498
            }
5499
            if (x + width > zoomAndPanCanvas.ActualWidth)
5500
            {
5501
                width = (int)zoomAndPanCanvas.ActualWidth - x;
5502
            }
5503
            if (y + height > zoomAndPanCanvas.ActualHeight)
5504
            {
5505
                height = (int)zoomAndPanCanvas.ActualHeight - y;
5506
            }
5507

    
5508
            byte[] pixels = CopyPixels(x, y, width, height);
5509

    
5510
            int stride = (width * canvasImage.Format.BitsPerPixel + 7) / 8;
5511

    
5512
            return BitmapSource.Create(width, height, 96, 96, PixelFormats.Pbgra32, null, pixels, stride);
5513
        }
5514

    
5515
        public byte[] CopyPixels(int x, int y, int width, int height)
5516
        {
5517
            byte[] pixels = new byte[width * height * 4];
5518
            int stride = (width * canvasImage.Format.BitsPerPixel + 7) / 8;
5519

    
5520
            // Canvas 이미지에서 객체 역역만큼 픽셀로 복사
5521
            canvasImage.CopyPixels(new Int32Rect(x, y, width, height), pixels, stride, 0);
5522

    
5523
            return pixels;
5524
        }
5525

    
5526
        public RenderTargetBitmap ConverterBitmapImage(FrameworkElement element)
5527
        {
5528
            DrawingVisual drawingVisual = new DrawingVisual();
5529
            DrawingContext drawingContext = drawingVisual.RenderOpen();
5530

    
5531
            // 해당 객체의 그래픽요소로 사각형의 그림을 그립니다.
5532
            drawingContext.DrawRectangle(new VisualBrush(element), null,
5533
                new Rect(new Point(0, 0), new Point(element.ActualWidth, element.ActualHeight)));
5534
            drawingContext.Close();
5535

    
5536
            // 비트맵으로 변환합니다.
5537
            RenderTargetBitmap target =
5538
                new RenderTargetBitmap((int)element.ActualWidth, (int)element.ActualHeight,
5539
                96, 96, System.Windows.Media.PixelFormats.Pbgra32);
5540

    
5541
            target.Render(drawingVisual);
5542
            return target;
5543
        }
5544

    
5545
        public void Save_Capture(BitmapSource source, int x, int y, int width, int height)
5546
        {
5547
            KCOM.Common.Converter.FileStreamToBase64 streamToBase64 = new Common.Converter.FileStreamToBase64();
5548
            KCOMDataModel.DataModel.CHECK_LIST check_;
5549
            string Result = streamToBase64.ImageToBase64(source);
5550
            KCOMDataModel.DataModel.CHECK_LIST Item = new KCOMDataModel.DataModel.CHECK_LIST();
5551

    
5552
            using (KCOMDataModel.DataModel.CIEntities Entity = new KCOMDataModel.DataModel.CIEntities(KCOMDataModel.Common.ConnectStringBuilder.ProjectCIConnectString(App.ViewInfo.ProjectNO).ToString()))
5553
            {
5554
                Item = Entity.CHECK_LIST.Where(i => i.ID == ViewerDataModel.Instance.CheckList_ID).FirstOrDefault();
5555

    
5556
                //새로운 데이터 추가
5557
                if (Item == null)
5558
                {
5559
                    check_ = new KCOMDataModel.DataModel.CHECK_LIST
5560
                    {
5561
                        ID = Save.shortGuid(),
5562
                        USER_ID = App.ViewInfo.UserID,
5563
                        IMAGE_URL = Result,
5564
                        IMAGE_ANCHOR = x + "," + y + "," + width + "," + height,
5565
                        PAGENUMBER = this.pageNavigator.CurrentPage.PageNumber,
5566
                        REVISION = ViewerDataModel.Instance.SystemMain.dzMainMenu.CurrentDoc.Revision,
5567
                        DOCUMENT_ID = App.ViewInfo.DocumentItemID,
5568
                        PROJECT_NO = App.ViewInfo.ProjectNO,
5569
                        STATUS = "False",
5570
                        CREATE_TIME = DateTime.Now,
5571
                        UPDATE_TIME = DateTime.Now,
5572
                        DOCUMENT_NO = _DocItem.DOCUMENT_NO,
5573
                        STATUS_DESC_OPEN = "Vendor 반영 필요",
5574
                    };
5575

    
5576
                    Entity.CHECK_LIST.AddObject(check_);
5577
                }
5578
                //기존에 있던 데이터 업데이트
5579
                else
5580
                {
5581
                    Item.IMAGE_URL = Result;
5582
                    Item.IMAGE_ANCHOR = x + "," + y + "," + width + "," + height;
5583
                    Item.PAGENUMBER = this.pageNavigator.CurrentPage.PageNumber;
5584
                }
5585

    
5586
                //Item.REV_0 = "Test";
5587

    
5588
                try
5589
                {
5590
                    Entity.SaveChanges();
5591
                }
5592
                catch (Exception ex)
5593
                {
5594

    
5595
                }
5596
                //Entity.SaveChanges();
5597
            }
5598
        }
5599

    
5600
        public void Set_Capture()
5601
        {
5602
            //double x = Canvas.GetLeft(dragCaptureBorder);
5603
            //double y = Canvas.GetTop(dragCaptureBorder);
5604
            double x = canvasDrawingMouseDownPoint.X;
5605
            double y = canvasDrawingMouseDownPoint.Y;
5606
            double width = dragCaptureBorder.Width;
5607
            double height = dragCaptureBorder.Height;
5608

    
5609
            if (width > 5 || height > 5)
5610
            {
5611
                canvasImage = ConverterBitmapImage(zoomAndPanCanvas);
5612
                BitmapSource source = CutAreaToImage((int)x, (int)y, (int)width, (int)height);
5613
                Save_Capture(source, (int)x, (int)y, (int)width, (int)height);
5614
            }
5615
        }
5616
        #endregion
5617

    
5618
        public void CreateControl()
5619
        {
5620
            ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
5621
            {
5622
                ViewerDataModel.Instance.UndoDataList.Remove(i);
5623
            });
5624
            multi_Undo_Data.Markup = currentControl;
5625
            UndoData.Markup_List.Add(multi_Undo_Data);
5626
            ViewerDataModel.Instance.UndoDataList.Add(UndoData);
5627
        }
5628

    
5629
        public Multi_Undo_data Control_Style(CommentUserInfo control)
5630
        {
5631
            multi_Undo_Data = new Multi_Undo_data();
5632

    
5633
            multi_Undo_Data.Markup = control;
5634

    
5635
            if ((control as IShapeControl) != null)
5636
            {
5637
                multi_Undo_Data.paint = (control as IShapeControl).Paint;
5638
            }
5639
            if ((control as IDashControl) != null)
5640
            {
5641
                multi_Undo_Data.DashSize = (control as IDashControl).DashSize;
5642
            }
5643
            if ((control as IPath) != null)
5644
            {
5645
                multi_Undo_Data.LineSize = (control as IPath).LineSize;
5646
            }
5647
            if ((control as UIElement) != null)
5648
            {
5649
                multi_Undo_Data.Opacity = (control as UIElement).Opacity;
5650
            }
5651

    
5652
            return multi_Undo_Data;
5653
        }
5654

    
5655
        public void Undo()
5656
        {
5657
            Undo_data undo = new Undo_data();
5658
            AdornerFinal final;
5659
            ReleaseAdorner();
5660

    
5661
            undo = ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == false).ToList().OrderByDescending(order => order.EventTime).FirstOrDefault();
5662
            if (undo == null)
5663
                return;
5664

    
5665
            switch (undo.Event)
5666
            {
5667
                case (Event_Type.Create):
5668
                    {
5669
                        foreach (var item in undo.Markup_List)
5670
                        {
5671
                            ViewerDataModel.Instance.MarkupControls_USER.Remove((item.Markup));
5672
                        }
5673
                    }
5674
                    break;
5675
                case (Event_Type.Delete):
5676
                    {
5677
                        foreach (var item in undo.Markup_List)
5678
                        {
5679
                            ViewerDataModel.Instance.MarkupControls_USER.Add(item.Markup);
5680

    
5681
                            //final = new AdornerFinal(item.Markup);
5682
                            //SelectLayer.Children.Add(final);
5683
                        }
5684
                    }
5685
                    break;
5686
                case (Event_Type.Thumb):
5687
                    {
5688
                        List<CommentUserInfo> comment = new List<CommentUserInfo>();
5689

    
5690
                        foreach (var item in undo.Markup_List)
5691
                        {
5692
                            ViewerDataModel.Instance.MarkupControls_USER.Remove((item.Markup));
5693

    
5694
                            if ((item.Markup as IViewBox) != null)
5695
                            {
5696
                                (item.Markup as IViewBox).Angle = item.Angle;
5697
                            }
5698
                            if ((item.Markup as TextControl) != null)
5699
                            {
5700
                                (item.Markup as TextControl).Angle = item.Angle;
5701
                                Canvas.SetLeft((item.Markup as TextControl), item.PointSet[0].X);
5702
                                Canvas.SetTop((item.Markup as TextControl), item.PointSet[0].Y);
5703
                            }
5704
                            else
5705
                            {
5706
                                (item.Markup as IPath).PointSet = item.PointSet;
5707
                                (item.Markup as IPath).updateControl();
5708
                            }
5709

    
5710
                            comment.Add(item.Markup);
5711
                        }
5712
                        final = new AdornerFinal(comment);
5713
                        SelectLayer.Children.Add(final);
5714
                        ReleaseAdorner();
5715
                    }
5716
                    break;
5717
                case (Event_Type.Select):
5718
                    {
5719
                        ReleaseAdorner();
5720
                        List<CommentUserInfo> comment = new List<CommentUserInfo>();
5721

    
5722
                        foreach (var item in undo.Markup_List)
5723
                        {
5724
                            ViewerDataModel.Instance.MarkupControls_USER.Remove((item.Markup));
5725

    
5726
                            if ((item.Markup as IPath) != null)
5727
                            {
5728
                                (item.Markup as IPath).LineSize = item.LineSize;
5729
                            }
5730
                            if ((item.Markup as UIElement) != null)
5731
                            {
5732
                                (item.Markup as UIElement).Opacity = item.Opacity;
5733
                            }
5734
                            if ((item.Markup as IDashControl) != null)
5735
                            {
5736
                                (item.Markup as IDashControl).DashSize = item.DashSize;
5737
                            }
5738
                            if ((item.Markup as IShapeControl) != null)
5739
                            {
5740
                                (item.Markup as IShapeControl).Paint = item.paint;
5741
                            }
5742

    
5743
                            comment.Add(item.Markup);
5744
                        }
5745

    
5746
                        final = new AdornerFinal(comment);
5747
                        SelectLayer.Children.Add(final);
5748
                    }
5749
                    break;
5750
                case (Event_Type.Option):
5751
                    {
5752
                        List<CommentUserInfo> comment = new List<CommentUserInfo>();
5753

    
5754
                        foreach (var item in undo.Markup_List)
5755
                        {
5756
                            ViewerDataModel.Instance.MarkupControls_USER.Remove(item.Markup);
5757

    
5758
                            if (undo.LineSize != 0 && item.Markup as IPath != null)
5759
                            {
5760
                                (item.Markup as IPath).LineSize = undo.LineSize;
5761
                            }
5762
                            else if (undo.Opacity != 0 && item.Markup as UIElement != null)
5763
                            {
5764
                                (item.Markup as UIElement).Opacity = undo.Opacity;
5765
                            }
5766
                            else if (undo.DashSize != null && item.Markup as IDashControl != null)
5767
                            {
5768
                                (item.Markup as IDashControl).DashSize = undo.DashSize;
5769
                            }
5770
                            else if (undo.Interval != 0 && item.Markup as LineControl != null)
5771
                            {
5772
                                (item.Markup as LineControl).Interval = undo.Interval;
5773
                            }
5774
                            else if (item.Markup as IShapeControl != null)
5775
                            {
5776
                                (item.Markup as IShapeControl).Paint = undo.paint;
5777
                            }
5778
                            comment.Add(item.Markup);
5779
                        }
5780
                        final = new AdornerFinal(comment);
5781
                        SelectLayer.Children.Add(final);
5782
                    }
5783
                    break;
5784
            }
5785
            ViewerDataModel.Instance.UndoDataList.Where(data => data.EventTime == undo.EventTime).ToList().OrderByDescending(order => order.EventTime).ToList().ForEach(i =>
5786
           {
5787
               i.IsUndo = true;
5788
           });
5789
        }
5790

    
5791
        public void Redo()
5792
        {
5793
            AdornerFinal final;
5794
            Undo_data redo = new Undo_data();
5795
            redo = ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().OrderBy(order => order.EventTime).FirstOrDefault();
5796
            ReleaseAdorner();
5797
            if (redo == null)
5798
                return;
5799

    
5800
            switch (redo.Event)
5801
            {
5802
                case (Event_Type.Create):
5803
                    {
5804
                        foreach (var item in redo.Markup_List)
5805
                        {
5806
                            ViewerDataModel.Instance.MarkupControls_USER.Add(item.Markup);
5807
                        }
5808
                    }
5809
                    break;
5810
                case (Event_Type.Delete):
5811
                    {
5812
                        foreach (var item in redo.Markup_List)
5813
                        {
5814
                            ViewerDataModel.Instance.MarkupControls_USER.Remove(item.Markup);
5815
                        }
5816
                    }
5817
                    break;
5818
                case (Event_Type.Thumb):
5819
                    {
5820
                        List<CommentUserInfo> comment = new List<CommentUserInfo>();
5821

    
5822
                        foreach (var item in redo.Markup_List)
5823
                        {
5824
                            ViewerDataModel.Instance.MarkupControls_USER.Remove((item.Markup as CommentUserInfo));
5825

    
5826
                            if ((item.Markup as IViewBox) != null)
5827
                            {
5828
                                (item.Markup as IViewBox).Angle = item.Angle;
5829
                            }
5830
                            if ((item.Markup as TextControl) != null)
5831
                            {
5832
                                //(item.Markup as TextControl).CanvasX = item.PointSet[0].X;
5833
                                //(item.Markup as TextControl).CanvasY = item.PointSet[0].Y;
5834

    
5835
                                (item.Markup as TextControl).Angle = item.Angle;
5836

    
5837
                                Canvas.SetLeft((item.Markup as TextControl), item.PointSet[0].X);
5838
                                Canvas.SetTop((item.Markup as TextControl), item.PointSet[0].Y);
5839
                            }
5840
                            else
5841
                            {
5842
                                (item.Markup as IPath).PointSet = item.PointSet;
5843
                                (item.Markup as IPath).updateControl();
5844
                            }
5845
                            comment.Add(item.Markup);
5846
                        }
5847
                        final = new AdornerFinal(comment);
5848
                        SelectLayer.Children.Add(final);
5849
                        ReleaseAdorner();
5850
                    }
5851
                    break;
5852
                case (Event_Type.Select):
5853
                    {
5854
                        List<CommentUserInfo> comment = new List<CommentUserInfo>();
5855

    
5856
                        foreach (var item in redo.Markup_List)
5857
                        {
5858
                            ViewerDataModel.Instance.MarkupControls_USER.Remove(item.Markup);
5859

    
5860
                            if ((item.Markup as IPath) != null)
5861
                            {
5862
                                (item.Markup as IPath).LineSize = item.LineSize;
5863
                            }
5864
                            if ((item.Markup as UIElement) != null)
5865
                            {
5866
                                (item.Markup as UIElement).Opacity = item.Opacity;
5867
                            }
5868
                            if ((item.Markup as IDashControl) != null)
5869
                            {
5870
                                (item.Markup as IDashControl).DashSize = item.DashSize;
5871
                            }
5872
                            if ((item.Markup as IShapeControl) != null)
5873
                            {
5874
                                (item.Markup as IShapeControl).Paint = item.paint;
5875
                            }
5876

    
5877
                            comment.Add(item.Markup);
5878
                        }
5879
                        final = new AdornerFinal(comment);
5880
                        SelectLayer.Children.Add(final);
5881
                    }
5882
                    break;
5883
                case (Event_Type.Option):
5884
                    {
5885
                        List<CommentUserInfo> comment = new List<CommentUserInfo>();
5886

    
5887
                        foreach (var item in redo.Markup_List)
5888
                        {
5889
                            ViewerDataModel.Instance.MarkupControls_USER.Remove(item.Markup);
5890
                            if (redo.LineSize != 0 && item.Markup as IPath != null)
5891
                            {
5892
                                (item.Markup as IPath).LineSize = redo.LineSize;
5893
                            }
5894
                            else if (redo.Opacity != 0 && item.Markup as UIElement != null)
5895
                            {
5896
                                (item.Markup as UIElement).Opacity = redo.Opacity;
5897
                            }
5898
                            else if (redo.DashSize != null && item.Markup as IDashControl != null)
5899
                            {
5900
                                (item.Markup as IDashControl).DashSize = redo.DashSize;
5901
                            }
5902
                            else if(redo.Interval != 0 && item.Markup as LineControl != null)
5903
                            {
5904
                                (item.Markup as LineControl).Interval = redo.Interval;
5905
                            }
5906
                            else if (item.Markup as IShapeControl != null)
5907
                            {
5908
                                (item.Markup as IShapeControl).Paint = redo.paint;
5909
                            }
5910
                            comment.Add(item.Markup);
5911
                        }
5912
                        final = new AdornerFinal(comment);
5913
                        SelectLayer.Children.Add(final);
5914
                    }
5915
                    break;
5916
            }
5917

    
5918
            ViewerDataModel.Instance.UndoDataList.Where(data => data.EventTime == redo.EventTime).ToList().OrderByDescending(order => order.EventTime).ToList().ForEach(i =>
5919
            {
5920
                i.IsUndo = false;
5921
            });
5922
        }
5923

    
5924
        private void Comment_Move(object sender, MouseButtonEventArgs e)
5925
        {
5926
            string Select_ID = (((e.Source as Telerik.Windows.Controls.RadButton).DataContext) as IKCOM.MarkupInfoItem).UserID;
5927
            foreach (var items in ViewerDataModel.Instance._markupInfoRevList)
5928
            {
5929
                if (items.UserID == Select_ID)
5930
                {
5931
                    foreach (var item in items.MarkupList)
5932
                    {
5933
                        if (item.PageNumber == pageNavigator.CurrentPage.PageNumber)
5934
                        {
5935
                            layerControl.markupParseEx(item.Data, Common.ViewerDataModel.Instance.MarkupControls_USER, "#FFFF0000", "", items.MarkupInfoID, Save.shortGuid());
5936
                        }
5937
                    }
5938
                }
5939
            }
5940
        }
5941

    
5942
        public void InkControl_Convert()
5943
        {
5944
            if (inkBoard.Strokes.Count > 0)
5945
            {
5946
                inkBoard.Strokes.ToList().ForEach(stroke =>
5947
                {
5948
                    List<Stroke> removingStroke = new List<Stroke>();
5949
                    StrokeCollection stC = new StrokeCollection();
5950
                    //for (int i = 0; i <= inkBoard.Strokes.Count - 1; i++)
5951
                    //{
5952
                    //    removingStroke.Add(inkBoard.Strokes[i]);
5953
                    //}
5954

    
5955
                    removingStroke.Add(stroke);
5956

    
5957
                    InkToPath ip = new InkToPath();
5958
                    List<Point> inkPointSet = new List<Point>();
5959
                    PolygonControl pc = null;
5960
                    //InkControl pc = null;
5961
                    //pc = new InkControl()
5962
                    pc = new PolygonControl()
5963
                    {
5964
                        //PointC = new List<StylusPointSet>(),
5965
                        Angle = 0,
5966
                        PointSet = new List<Point>(),
5967
                        ControlType = ControlType.Ink
5968
                    };
5969
                    foreach (var item in removingStroke)
5970
                    {
5971
                        //pc.PointC.Add(new StylusPointSet() { pointSet = ip.StrokeGetPointsPlus(item) });
5972
                        inkPointSet.AddRange(ip.StrokeGetPointsPlus(item));
5973
                        inkBoard.Strokes.Remove(item);
5974
                    }
5975
                    if (inkPointSet.Count != 0)
5976
                    {
5977

    
5978
                        //강인구 추가(PenControl Undo Redo 추가)
5979
                        UndoData = new Undo_data()
5980
                        {
5981
                            IsUndo = false,
5982
                            Event = Event_Type.Create,
5983
                            EventTime = DateTime.Now,
5984
                            Markup_List = new List<Multi_Undo_data>()
5985
                        };
5986

    
5987
                        pc.StartPoint = inkPointSet[0];
5988
                        pc.EndPoint = inkPointSet[inkPointSet.Count - 1];
5989
                        pc.PointSet = inkPointSet;
5990
                        pc.LineSize = 3;
5991
                        pc.CommentID = Save.shortGuid();
5992
                        //pc.StrokeColor = new SolidColorBrush(MarkupToPDF.Controls.Common.ValueConverter.StringToColorConverter.Parse("ff18b7fc"));
5993
                        pc.StrokeColor = new SolidColorBrush(Colors.Red);
5994
                        ViewerDataModel.Instance.MarkupControls_USER.Add(pc);
5995
                        pc.SetPolyPath();
5996

    
5997
                        ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
5998
                        {
5999
                            ViewerDataModel.Instance.UndoDataList.Remove(i);
6000
                        });
6001
                        multi_Undo_Data.Markup = pc as CommentUserInfo;
6002
                        UndoData.Markup_List.Add(multi_Undo_Data);
6003
                        ViewerDataModel.Instance.UndoDataList.Add(UndoData);
6004
                    }
6005
                });
6006

    
6007
            }
6008
        }
6009
    }
6010
}
클립보드 이미지 추가 (최대 크기: 500 MB)