프로젝트

일반

사용자정보

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

markus / KCOM / Views / MainMenu.xaml.cs @ e17af42b

이력 | 보기 | 이력해설 | 다운로드 (291 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.Bold;
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.Bold;
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
                        if ((control as TextControl) != null)
3030
                        {
3031
                            if ((control as TextControl).TextStyle == FontStyles.Italic)
3032
                            {
3033
                                ViewerDataModel.Instance.checkTextStyle = true;
3034
                            }
3035
                            else
3036
                            {
3037
                                ViewerDataModel.Instance.checkTextStyle = false;
3038
                            }
3039

    
3040
                            if ((control as TextControl).TextStyle == FontStyles.Italic)
3041
                            {
3042
                                ViewerDataModel.Instance.checkTextStyle = true;
3043
                            }
3044
                            else
3045
                            {
3046
                                ViewerDataModel.Instance.checkTextStyle = false;
3047
                            }
3048
                            if ((control as TextControl).TextWeight == FontWeights.Bold)
3049
                            {
3050
                                ViewerDataModel.Instance.checkTextWeight = true;
3051
                            }
3052
                            else
3053
                            {
3054
                                ViewerDataModel.Instance.checkTextWeight = false;
3055
                            }
3056
                            if ((control as TextControl).UnderLine == TextDecorations.Underline)
3057
                            {
3058
                                ViewerDataModel.Instance.checkUnderLine = true;
3059
                            }
3060
                            else
3061
                            {
3062
                                ViewerDataModel.Instance.checkUnderLine = false;
3063
                            }
3064

    
3065
                            ViewerDataModel.Instance.TextSize = (control as TextControl).TextSize;
3066
                            ViewerDataModel.Instance.checkHighlight = (control as TextControl).IsHighLight;
3067
                            
3068
                        }
3069
                        else if ((control as ArrowTextControl) != null)
3070
                        {
3071
                            //if (this.ParentOfType<MainWindow>().dzTopMenu.btnItalic.IsChecked == true)
3072
                            //{
3073
                            //    (control as ArrowTextControl).TextStyle = FontStyles.Italic;
3074
                            //}
3075
                            //if (this.ParentOfType<MainWindow>().dzTopMenu.btnBold.IsChecked == true)
3076
                            //{
3077
                            //    (control as ArrowTextControl).TextWeight = FontWeights.Bold;
3078
                            //}
3079
                            //if (this.ParentOfType<MainWindow>().dzTopMenu.btnUnderLine.IsChecked == true)
3080
                            //{
3081
                            //    (control as ArrowTextControl).UnderLine = TextDecorations.Underline;
3082
                            //}
3083
                            if ((control as ArrowTextControl).TextStyle == FontStyles.Italic)
3084
                            {
3085
                                ViewerDataModel.Instance.checkTextStyle = true;
3086
                            }
3087
                            else
3088
                            {
3089
                                ViewerDataModel.Instance.checkTextStyle = false;
3090
                            }
3091

    
3092
                            if ((control as ArrowTextControl).TextStyle == FontStyles.Italic)
3093
                            {
3094
                                ViewerDataModel.Instance.checkTextStyle = true;
3095
                            }
3096
                            else
3097
                            {
3098
                                ViewerDataModel.Instance.checkTextStyle = false;
3099
                            }
3100
                            if ((control as ArrowTextControl).TextWeight == FontWeights.Bold)
3101
                            {
3102
                                ViewerDataModel.Instance.checkTextWeight = true;
3103
                            }
3104
                            else
3105
                            {
3106
                                ViewerDataModel.Instance.checkTextWeight = false;
3107
                            }
3108
                            if ((control as ArrowTextControl).UnderLine == TextDecorations.Underline)
3109
                            {
3110
                                ViewerDataModel.Instance.checkUnderLine = true;
3111
                            }
3112
                            else
3113
                            {
3114
                                ViewerDataModel.Instance.checkUnderLine = false;
3115
                            }
3116
                            ViewerDataModel.Instance.checkHighlight = (control as ArrowTextControl).isHighLight;
3117
                            ViewerDataModel.Instance.TextSize = (control as ArrowTextControl).TextSize;
3118
                        }
3119

    
3120
                    }
3121
                    else
3122
                    {
3123
                        comment = AddAdorner();
3124
                        comment.Add(control);
3125

    
3126
                        Control_Style(control);
3127
                        UndoData.Markup_List.Add(multi_Undo_Data);
3128

    
3129
                        final = new AdornerFinal(comment);
3130
                        //다중 컨트롤 언두 저장
3131
                    }
3132

    
3133
                    ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
3134
                    {
3135
                        ViewerDataModel.Instance.UndoDataList.Remove(i);
3136
                    });
3137

    
3138
                    ViewerDataModel.Instance.UndoDataList.Add(UndoData);
3139

    
3140
                    SelectLayer.Children.Add(final);
3141

    
3142
                    //Control_Init(control);
3143

    
3144

    
3145
                    
3146

    
3147

    
3148
                    //강인구 폰트 변경 보류
3149

    
3150
                    //if ((currentControl as TextControl) != null)
3151
                    //{
3152
                    //    if ((control as TextControl).TextStyle == FontStyles.Italic)
3153
                    //    {
3154
                    //        ViewerDataModel.Instance.checkTextStyle = true;
3155
                    //    }
3156
                    //    else
3157
                    //    {
3158
                    //        ViewerDataModel.Instance.checkTextStyle = false;
3159
                    //    }
3160

    
3161
                    //    if((currentControl as TextControl).TextStyle == FontStyles.Italic)
3162
                    //    {
3163

    
3164
                    //    }
3165
                    //    if((currentControl as TextControl).TextWeight == FontWeights.Bold)
3166
                    //    {
3167

    
3168
                    //    }
3169
                    //    if((currentControl as TextControl).UnderLine == TextDecorations.Underline)
3170
                    //    {
3171

    
3172
                    //    }
3173
                    //}
3174
                    //else if ((currentControl as ArrowTextControl) != null)
3175
                    //{
3176
                    //    if (this.ParentOfType<MainWindow>().dzTopMenu.btnItalic.IsChecked == true)
3177
                    //    {
3178
                    //        (currentControl as ArrowTextControl).TextStyle = FontStyles.Italic;
3179
                    //    }
3180
                    //    if (this.ParentOfType<MainWindow>().dzTopMenu.btnBold.IsChecked == true)
3181
                    //    {
3182
                    //        (currentControl as ArrowTextControl).TextWeight = FontWeights.Bold;
3183
                    //    }
3184
                    //    if (this.ParentOfType<MainWindow>().dzTopMenu.btnUnderLine.IsChecked == true)
3185
                    //    {
3186
                    //        (currentControl as ArrowTextControl).UnderLine = TextDecorations.Underline;
3187
                    //    }
3188
                    //}
3189

    
3190
                    mouseHandlingMode = MouseHandlingMode.Adorner;
3191
                }
3192
            }
3193

    
3194
            else if (mouseHandlingMode == MouseHandlingMode.Drawing)
3195
            {
3196
                init();
3197
                //강인구 추가(우 클릭 일 경우 커서 변경 하지 않음)
3198
                if (cursor != Cursors.SizeAll)
3199
                {
3200
                    cursor = Cursors.Cross;
3201
                    SetCursor();
3202
                }
3203
                //currentControl.IsNew = true;
3204
                bool init_user = false;
3205
                foreach (var user in gridViewMarkup.Items)
3206
                {
3207
                    if ((user as MarkupInfoItem).UserID == App.ViewInfo.UserID)
3208
                    {
3209
                        init_user = true;
3210
                    }
3211
                }
3212
                if (init_user && gridViewMarkup.SelectedItems.Where(d => (d as MarkupInfoItem).UserID == App.ViewInfo.UserID).FirstOrDefault() == null && e.LeftButton == MouseButtonState.Pressed)
3213
                //if (PreviewUserMarkupInfoItem == null && gridViewMarkup.SelectedItems.Where(d => (d as MarkupInfoItem).UserID == App.ViewInfo.UserID).FirstOrDefault() == null && e.LeftButton == MouseButtonState.Pressed)
3214
                //if (PreviewUserMarkupInfoItem == null && gridViewMarkup.SelectedItems.Where(d => (d as MarkupInfoItem).UserID == App.ViewInfo.UserID).FirstOrDefault() == null)
3215
                {
3216
                    RadWindow.Alert(new DialogParameters
3217
                    {
3218
                        Theme = new VisualStudio2013Theme(),
3219
                        Header = "안내",
3220
                        Content = "기존의 코멘트가 존재합니다. 사용자 리스트에서 먼저 선택해주세요",
3221
                    });
3222
                    return;
3223
                }
3224
                else
3225
                {
3226
                    var item = gridViewMarkup.SelectedItems.Where(d => (d as MarkupInfoItem).UserID == App.ViewInfo.UserID).FirstOrDefault() as MarkupInfoItem;
3227
                    if (item != null)
3228
                    {
3229
                        App.Custom_ViewInfoId = item.MarkupInfoID;
3230
                    }
3231
                }
3232

    
3233
                multi_Undo_Data = new Multi_Undo_data();
3234
                //강인구 Undo/Redo 보류
3235
                UndoData = new Undo_data()
3236
                {
3237
                    IsUndo = false,
3238
                    Event = Event_Type.Create,
3239
                    EventTime = DateTime.Now,
3240
                    Markup_List = new List<Multi_Undo_data>()
3241
                };
3242

    
3243
                switch (controlType)
3244
                {
3245
                    case ControlType.Rectangle:
3246
                        {
3247
                            if (mouseButtonDown == MouseButton.Left)
3248
                            {
3249
                                if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3250
                                {
3251
                                    if (currentControl is RectangleControl)
3252
                                    {
3253
                                        CreateControl();
3254

    
3255
                                        (currentControl as RectangleControl).ApplyOverViewData();
3256
                                        currentControl = null;
3257
                                        this.cursor = Cursors.Arrow;
3258
                                    }
3259
                                    else
3260
                                    {
3261
                                        currentControl = new RectangleControl
3262
                                        {
3263
                                            Background = new SolidColorBrush(Colors.Black),
3264
                                            ControlType = ControlType.Rectangle
3265
                                        };
3266

    
3267
                                        currentControl.CommentID = Save.shortGuid();
3268
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3269
                                        currentControl.IsNew = true;
3270
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3271

    
3272
                                        currentControl.SetValue(Canvas.ZIndexProperty, 3);
3273
                                    }
3274
                                }
3275
                            }
3276
                        }
3277
                        break;
3278
                    case ControlType.RectCloud:
3279
                        {
3280
                            if (mouseButtonDown == MouseButton.Left)
3281
                            {
3282
                                if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3283
                                {
3284
                                    if (currentControl is RectCloudControl)
3285
                                    {
3286
                                        CreateControl();
3287

    
3288
                                        (currentControl as RectCloudControl).ApplyOverViewData();
3289
                                        //controlType = ControlType.None;
3290
                                        currentControl = null;
3291
                                        //mouseHandlingMode = MouseHandlingMode.Selecting;
3292
                                        this.cursor = Cursors.Arrow;
3293
                                    }
3294
                                    else
3295
                                    {
3296
                                        currentControl = new RectCloudControl
3297
                                        {
3298
                                            Background = new SolidColorBrush(Colors.Black)
3299
                                        };
3300

    
3301
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3302
                                        currentControl.CommentID = Save.shortGuid();
3303
                                        currentControl.IsNew = true;
3304
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3305
                                    }
3306
                                }
3307
                            }
3308
                        }
3309
                        break;
3310
                    case ControlType.Circle:
3311
                        {
3312
                            if (mouseButtonDown == MouseButton.Left)
3313
                            {
3314
                                if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3315
                                {
3316
                                    if (currentControl is CircleControl)
3317
                                    {
3318
                                        CreateControl();
3319

    
3320
                                        (currentControl as CircleControl).ApplyOverViewData();
3321
                                        //controlType = ControlType.None;
3322
                                        currentControl = null;
3323
                                    }
3324
                                    else
3325
                                    {
3326
                                        currentControl = new CircleControl
3327
                                        {
3328
                                            Background = new SolidColorBrush(Colors.Black)
3329
                                        };
3330

    
3331
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3332
                                        currentControl.CommentID = Save.shortGuid();
3333
                                        currentControl.IsNew = true;
3334
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3335
                                    }
3336
                                }
3337
                            }
3338
                        }
3339
                        break;
3340
                    case ControlType.Triangle:
3341
                        {
3342
                            if (mouseButtonDown == MouseButton.Left)
3343
                            {
3344
                                if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3345
                                {
3346
                                    if (currentControl is TriControl)
3347
                                    {
3348
                                        var content = currentControl as TriControl;
3349
                                        if (content.MidPoint == new Point(0, 0))
3350
                                        {
3351
                                            content.MidPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
3352
                                        }
3353
                                        else
3354
                                        {
3355
                                            CreateControl();
3356

    
3357
                                            (currentControl as TriControl).ApplyOverViewData();
3358
                                            //controlType = ControlType.None;
3359
                                            currentControl = null;
3360
                                        }
3361
                                    }
3362
                                    else
3363
                                    {
3364
                                        currentControl = new TriControl
3365
                                        {
3366
                                            StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y),
3367
                                            Background = new SolidColorBrush(Colors.Black),
3368
                                        };
3369

    
3370
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3371
                                        currentControl.CommentID = Save.shortGuid();
3372
                                        currentControl.IsNew = true;
3373
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3374
                                    }
3375
                                }
3376
                            }
3377
                        }
3378
                        break;
3379
                    case ControlType.SingleLine:
3380
                        {
3381
                            if (mouseButtonDown == MouseButton.Left)
3382
                            {
3383
                                if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3384
                                {
3385
                                    if (currentControl is LineControl)
3386
                                    {
3387
                                        CreateControl();
3388

    
3389
                                        (currentControl as LineControl).ApplyOverViewData();
3390
                                        //controlType = ControlType.None;
3391
                                        currentControl = null;
3392
                                        this.MainAngle.Visibility = Visibility.Collapsed;
3393
                                    }
3394
                                    else
3395
                                    {
3396
                                        currentControl = new LineControl
3397
                                        {
3398
                                            Background = new SolidColorBrush(Colors.Black)
3399
                                        };
3400

    
3401
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3402
                                        currentControl.CommentID = Save.shortGuid();
3403
                                        currentControl.IsNew = true;
3404
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3405
                                        this.MainAngle.Visibility = Visibility.Visible;
3406
                                    }
3407
                                }
3408
                            }
3409
                        }
3410
                        break;
3411
                    case ControlType.CancelLine:
3412
                        {
3413
                            if (mouseButtonDown == MouseButton.Left)
3414
                            {
3415
                                if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3416
                                {
3417
                                    if (currentControl is LineControl)
3418
                                    {
3419
                                        CreateControl();
3420

    
3421
                                        (currentControl as LineControl).ApplyOverViewData();
3422
                                        //controlType = ControlType.None;
3423
                                        currentControl = null;
3424
                                        this.MainAngle.Visibility = Visibility.Collapsed;
3425
                                    }
3426
                                    else
3427
                                    {
3428
                                        currentControl = new LineControl
3429
                                        {
3430
                                            Background = new SolidColorBrush(Colors.Black)
3431
                                        };
3432

    
3433
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3434
                                        currentControl.CommentID = Save.shortGuid();
3435
                                        currentControl.IsNew = true;
3436
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3437
                                        this.MainAngle.Visibility = Visibility.Visible;
3438
                                    }
3439
                                }
3440
                            }
3441
                        }
3442
                        break;
3443
                    case ControlType.ArrowLine:
3444
                        {
3445
                            if (mouseButtonDown == MouseButton.Left)
3446
                            {
3447
                                if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3448
                                {
3449
                                    if (currentControl is LineControl)
3450
                                    {
3451
                                        CreateControl();
3452

    
3453
                                        (currentControl as LineControl).ApplyOverViewData();
3454
                                        //controlType = ControlType.None;
3455
                                        currentControl = null;
3456
                                        this.MainAngle.Visibility = Visibility.Collapsed;
3457
                                    }
3458
                                    else
3459
                                    {
3460
                                        currentControl = new LineControl
3461
                                        {
3462
                                            Background = new SolidColorBrush(Colors.Black)
3463
                                        };
3464

    
3465
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3466
                                        currentControl.CommentID = Save.shortGuid();
3467
                                        currentControl.IsNew = true;
3468
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3469
                                        this.MainAngle.Visibility = Visibility.Visible;
3470
                                    }
3471
                                }
3472
                            }
3473
                        }
3474
                        break;
3475
                    case ControlType.TwinLine:
3476
                        {
3477
                            if (mouseButtonDown == MouseButton.Left)
3478
                            {
3479
                                if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3480
                                {
3481
                                    if (currentControl is LineControl)
3482
                                    {
3483
                                        CreateControl();
3484

    
3485
                                        (currentControl as LineControl).ApplyOverViewData();
3486
                                        //controlType = ControlType.None;
3487
                                        currentControl = null;
3488
                                        this.MainAngle.Visibility = Visibility.Collapsed;
3489
                                    }
3490
                                    else
3491
                                    {
3492
                                        currentControl = new LineControl
3493
                                        {
3494
                                            Background = new SolidColorBrush(Colors.Black)
3495
                                        };
3496
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3497
                                        currentControl.CommentID = Save.shortGuid();
3498
                                        currentControl.IsNew = true;
3499
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3500
                                        this.MainAngle.Visibility = Visibility.Visible;
3501
                                    }
3502
                                }
3503
                            }
3504
                        }
3505
                        break;
3506
                    case ControlType.DimLine:
3507
                        {
3508
                            if (mouseButtonDown == MouseButton.Left)
3509
                            {
3510
                                if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3511
                                {
3512
                                    if (currentControl is LineControl)
3513
                                    {
3514
                                        CreateControl();
3515

    
3516
                                        (currentControl as LineControl).ApplyOverViewData();
3517
                                        //controlType = ControlType.None;
3518
                                        currentControl = null;
3519
                                        this.MainAngle.Visibility = Visibility.Collapsed;
3520
                                    }
3521
                                    else
3522
                                    {
3523
                                        currentControl = new LineControl
3524
                                        {
3525
                                            Background = new SolidColorBrush(Colors.Black)
3526
                                        };
3527
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3528
                                        currentControl.CommentID = Save.shortGuid();
3529
                                        currentControl.IsNew = true;
3530
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3531
                                        this.MainAngle.Visibility = Visibility.Visible;
3532
                                    }
3533
                                }
3534
                            }
3535
                        }
3536
                        break;
3537
                    case ControlType.ChainLine:
3538
                        {
3539
                            if (currentControl is PolygonControl)
3540
                            {
3541
                                var control = currentControl as PolygonControl;
3542

    
3543
                                if (mouseButtonDown == MouseButton.Right)
3544
                                {
3545
                                    CreateControl();
3546

    
3547
                                    (currentControl as PolygonControl).ApplyOverViewData();
3548
                                    //controlType = ControlType.None;
3549
                                    currentControl = null;
3550
                                    return;
3551
                                }
3552

    
3553
                                if (!control.IsCompleted)
3554
                                {
3555
                                    //control.PointC.pointSet.Add(control.EndPoint);
3556
                                    control.PointSet.Add(control.EndPoint);
3557
                                }
3558
                                //else
3559
                                //{
3560
                                //    var firstPoint = control.PointC.pointSet.First();
3561

    
3562
                                //    //control.PointC.pointSet.Add(new Point(firstPoint.X, firstPoint.Y));
3563
                                //    control.PointC.pointSet.Add(firstPoint);
3564

    
3565
                                //    control.SetPolyPath();
3566

    
3567
                                //    controlType = ControlType.None;
3568

    
3569
                                //    currentControl = null;
3570
                                //}
3571
                            }
3572
                            else
3573
                            {
3574
                                if (mouseButtonDown == MouseButton.Left)
3575
                                {
3576
                                    currentControl = new PolygonControl
3577
                                    {
3578
                                        PointSet = new List<Point>(),
3579
                                        //강인구 추가(ChainLine일때는 채우기 스타일을 주지 않기 위해 설정)
3580
                                        ControlType = ControlType.ChainLine,
3581
                                        DashSize = ViewerDataModel.Instance.DashSize,
3582
                                        LineSize = ViewerDataModel.Instance.LineSize,
3583
                                        //PointC = new StylusPointSet()
3584
                                    };
3585

    
3586
                                    if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3587
                                    {
3588
                                        var polygonControl = (currentControl as PolygonControl);
3589
                                        currentControl.CommentID = Save.shortGuid();
3590
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3591
                                        currentControl.IsNew = true;
3592
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3593
                                        //currentControl.OnApplyTemplate();
3594
                                        //polygonControl.PointC.pointSet.Add(canvasDrawingMouseDownPoint);
3595
                                        //polygonControl.PointC.pointSet.Add(canvasDrawingMouseDownPoint);
3596
                                        polygonControl.PointSet.Add(canvasDrawingMouseDownPoint);
3597
                                        polygonControl.PointSet.Add(canvasDrawingMouseDownPoint);
3598
                                    }
3599
                                }
3600
                            }
3601
                        }
3602
                        break;
3603
                    case ControlType.ArcLine:
3604
                        {
3605
                            if (mouseButtonDown == MouseButton.Left)
3606
                            {
3607
                                if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3608
                                {
3609
                                    if (currentControl is ArcControl)
3610
                                    {
3611
                                        CreateControl();
3612

    
3613
                                        (currentControl as ArcControl).ApplyOverViewData();
3614
                                        //controlType = ControlType.None;
3615
                                        currentControl = null;
3616
                                        this.MainAngle.Visibility = Visibility.Collapsed;
3617
                                    }
3618
                                    else
3619
                                    {
3620
                                        currentControl = new ArcControl
3621
                                        {
3622
                                            Background = new SolidColorBrush(Colors.Black)
3623
                                        };
3624
                                        currentControl.CommentID = Save.shortGuid();
3625
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3626
                                        currentControl.IsNew = true;
3627
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3628
                                        this.MainAngle.Visibility = Visibility.Visible;
3629
                                    }
3630
                                }
3631
                            }
3632
                            else if (mouseButtonDown == MouseButton.Right)
3633
                            {
3634
                                if (currentControl != null)
3635
                                {
3636
                                    (currentControl as ArcControl).setClock();
3637
                                }
3638

    
3639
                            }
3640

    
3641
                        }
3642
                        break;
3643
                    case ControlType.ArcArrow:
3644
                        {
3645
                            if (mouseButtonDown == MouseButton.Left)
3646
                            {
3647
                                if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3648
                                {
3649
                                    if (currentControl is ArcControl)
3650
                                    {
3651
                                        CreateControl();
3652

    
3653
                                        (currentControl as ArcControl).ApplyOverViewData();
3654
                                        //controlType = ControlType.None;
3655
                                        currentControl = null;
3656
                                        this.MainAngle.Visibility = Visibility.Collapsed;
3657
                                    }
3658
                                    else
3659
                                    {
3660
                                        currentControl = new ArcControl
3661
                                        {
3662
                                            Background = new SolidColorBrush(Colors.Red),
3663
                                        };
3664
                                        currentControl.CommentID = Save.shortGuid();
3665
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3666
                                        currentControl.IsNew = true;
3667
                                        (currentControl as IMarkupCommonData).ControlType = ControlType.ArcArrow;
3668
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3669
                                        this.MainAngle.Visibility = Visibility.Visible;
3670
                                    }
3671
                                }
3672
                            }
3673
                            else if (mouseButtonDown == MouseButton.Right)
3674
                            {
3675
                                (currentControl as ArcControl).setClock();
3676
                            }
3677
                        }
3678
                        break;
3679
                    case ControlType.ArrowMultiLine:
3680
                        {
3681
                            if (mouseButtonDown == MouseButton.Left)
3682
                            {
3683
                                if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3684
                                {
3685

    
3686
                                    if (currentControl is ArrowControl_Multi)
3687
                                    {
3688
                                        var content = currentControl as ArrowControl_Multi;
3689
                                        if (content.MiddlePoint == new Point(0, 0))
3690
                                        {
3691
                                            content.MiddlePoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
3692
                                        }
3693
                                        else
3694
                                        {
3695
                                            CreateControl();
3696

    
3697
                                            (currentControl as ArrowControl_Multi).ApplyOverViewData();
3698
                                            //controlType = ControlType.None;
3699
                                            currentControl = null;
3700
                                            this.MainAngle.Visibility = Visibility.Collapsed;
3701
                                        }
3702
                                    }
3703
                                    else
3704
                                    {
3705
                                        currentControl = new ArrowControl_Multi
3706
                                        {
3707
                                            StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y),
3708
                                            Background = new SolidColorBrush(Colors.Black)
3709
                                        };
3710
                                        currentControl.CommentID = Save.shortGuid();
3711
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3712
                                        currentControl.IsNew = true;
3713
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3714
                                        this.MainAngle.Visibility = Visibility.Visible;
3715
                                    }
3716

    
3717
                                    //if (currentControl is ArrowControl_Multi)
3718
                                    //{
3719
                                    //    (currentControl as ArrowControl_Multi).ApplyOverViewData();
3720
                                    //    controlType = ControlType.None;
3721
                                    //    currentControl = null;
3722
                                    //}
3723
                                    //else
3724
                                    //{
3725
                                    //    currentControl = new ArrowControl_Multi
3726
                                    //    {
3727
                                    //        Background = new SolidColorBrush(Colors.Black)
3728
                                    //    };
3729

    
3730
                                    //    DataModel.Instance.MarkupControls.Add(currentControl);
3731
                                    //}
3732

    
3733

    
3734

    
3735
                                }
3736
                            }
3737
                        }
3738
                        break;
3739
                    case ControlType.PolygonCloud:
3740
                        {
3741
                            if (currentControl is CloudControl)
3742
                            {
3743
                                var control = currentControl as CloudControl;
3744
                                //control.Paint = PaintSet.Cloud;
3745
                                if (mouseButtonDown == MouseButton.Right)
3746
                                {
3747
                                    control.IsCompleted = true;
3748
                                }
3749

    
3750
                                if (!control.IsCompleted)
3751
                                {
3752
                                    //control.PointC.pointSet.Add(control.EndPoint);
3753
                                    control.PointSet.Add(control.EndPoint);
3754
                                }
3755
                                else
3756
                                {
3757
                                    CreateControl();
3758

    
3759
                                    control.isTransOn = true;
3760
                                    //var firstPoint = control.PointC.pointSet.First();
3761
                                    var firstPoint = control.PointSet.First();
3762

    
3763
                                    //control.PointC.pointSet.Add(firstPoint);
3764
                                    control.PointSet.Add(firstPoint);
3765
                                    control.DrawingCloud();
3766
                                    control.ApplyOverViewData();
3767

    
3768
                                    //controlType = ControlType.None;
3769

    
3770
                                    currentControl = null;
3771
                                }
3772
                            }
3773
                            else
3774
                            {
3775
                                if (mouseButtonDown == MouseButton.Left)
3776
                                {
3777
                                    currentControl = new CloudControl
3778
                                    {
3779
                                        PointSet = new List<Point>(),
3780
                                        PointC = new StylusPointSet()
3781
                                    };
3782

    
3783
                                    if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3784
                                    {
3785
                                        var polygonControl = (currentControl as CloudControl);
3786
                                        currentControl.CommentID = Save.shortGuid();
3787
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3788
                                        currentControl.IsNew = true;
3789
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3790
                                        //currentControl.OnApplyTemplate();
3791

    
3792
                                        polygonControl.PointSet.Add(canvasDrawingMouseDownPoint);
3793
                                        polygonControl.PointSet.Add(canvasDrawingMouseDownPoint);
3794
                                        //polygonControl.PointC.pointSet.Add(canvasZoomPanningMouseDownPoint);
3795
                                        //polygonControl.PointC.pointSet.Add(canvasZoomPanningMouseDownPoint);
3796

    
3797
                                    }
3798
                                }
3799
                            }
3800
                        }
3801
                        break;
3802
                    case ControlType.ImgControl:
3803
                        {
3804
                            if (mouseButtonDown == MouseButton.Left)
3805
                            {
3806
                                if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3807
                                {
3808
                                    if (currentControl is ImgControl)
3809
                                    {
3810
                                        CreateControl();
3811
                                        (currentControl as ImgControl).ApplyOverViewData();
3812

    
3813
                                        //controlType = ControlType.None;
3814
                                        currentControl = null;
3815
                                    }
3816
                                    else
3817
                                    {
3818
                                        string extension = System.IO.Path.GetExtension(filename).ToUpper();
3819
                                        if (extension == ".PNG" || extension == ".JPEG" || extension == ".GIF" || extension == ".BMP" || extension == ".JPG")
3820
                                        {
3821
                                            Image img = new Image();
3822
                                            img.Source = new BitmapImage(new Uri(filename));
3823

    
3824
                                            currentControl = new ImgControl
3825
                                            {
3826
                                                Background = new SolidColorBrush(Colors.Black),
3827
                                                PointSet = new List<Point>(),
3828
                                                FilePath = filename,
3829
                                                ImageData = img.Source,
3830
                                                StartPoint = canvasDrawingMouseDownPoint,
3831
                                                EndPoint = new Point(canvasDrawingMouseDownPoint.X + 100, canvasDrawingMouseDownPoint.Y + 100),
3832
                                                TopRightPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y + 100),
3833
                                                LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X + 100, canvasDrawingMouseDownPoint.Y)
3834
                                            };
3835

    
3836
                                            currentControl.CommentID = Save.shortGuid();
3837
                                            currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3838
                                            currentControl.IsNew = true;
3839
                                            ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3840
                                        }
3841
                                    }
3842
                                }
3843
                            }
3844
                        }
3845
                        break;
3846
                    case ControlType.Date:
3847
                        {
3848
                            if (mouseButtonDown == MouseButton.Left)
3849
                            {
3850
                                if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3851
                                {
3852
                                    if (currentControl is DateControl)
3853
                                    {
3854
                                        CreateControl();
3855
                                        (currentControl as DateControl).ApplyOverViewData();
3856
                                        //controlType = ControlType.None;
3857
                                        currentControl = null;
3858

    
3859
                                        if (Common.ViewerDataModel.Instance.SelectedControl == "Batch")
3860
                                        {
3861
                                            controlType = ControlType.None;
3862
                                            IsSwingMode = false;
3863
                                            Common.ViewerDataModel.Instance.SelectedControl = "";
3864
                                            Common.ViewerDataModel.Instance.ControlTag = null;
3865
                                            mouseHandlingMode = MouseHandlingMode.None;
3866
                                            this.ParentOfType<MainWindow>().dzTopMenu.btn_Batch.IsChecked = false;
3867
                                            txtBatch.Visibility = Visibility.Collapsed;
3868

    
3869
                                        }
3870
                                    }
3871
                                    else
3872
                                    {
3873
                                        currentControl = new DateControl
3874
                                        {
3875
                                            Background = new SolidColorBrush(Colors.Black)
3876
                                        };
3877
                                        //inkDrawingCanvas.Children.Add(currentControl);
3878
                                        //InkCanvas.SetLeft(currentControl, canvasDrawingMouseDownPoint.X);
3879
                                        //InkCanvas.SetTop(currentControl, canvasDrawingMouseDownPoint.Y);
3880
                                        currentControl.CommentID = Save.shortGuid();
3881
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3882
                                        currentControl.IsNew = true;
3883
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3884
                                        //DataModel.Instance.MarkupControls.Add(currentControl);
3885
                                    }
3886
                                }
3887
                            }
3888
                        }
3889
                        break;
3890
                    case ControlType.TextControl:
3891
                        {
3892
                            if (mouseButtonDown == MouseButton.Left)
3893
                            {
3894
                                if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3895
                                {
3896

    
3897
                                    currentControl = new TextControl
3898
                                    {
3899
                                        //ControlType = PaintSet.Rect
3900
                                        ControlType = controlType
3901
                                    };
3902

    
3903
                                    //if (currentControl is TextControl)
3904
                                    //{
3905
                                    //    //currentControl.SetValue(Canvas.ZIndexProperty, 2);
3906
                                    //    //(currentControl as TextControl).Base_TextBox.Text = (currentControl as TextControl).Text;
3907
                                    //    //(currentControl as TextControl).Base_TextBox.Visibility = System.Windows.Visibility.Visible;
3908
                                    //    //(currentControl as TextControl).Base_TextBlock.Visibility = System.Windows.Visibility.Collapsed;
3909
                                    //    //(currentControl as TextControl).Angle = Ang;
3910
                                    //    //currentControl.Focus();
3911
                                    //}
3912
                                    //else
3913
                                    //{
3914
                                    //currentControl = new TextControl();
3915
                                        currentControl.CommentID = Save.shortGuid();
3916
                                        currentControl.IsNew = true;
3917
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3918
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3919
                                        currentControl.SetValue(Canvas.ZIndexProperty, 2);
3920
                                        currentControl.SetValue(TextControl.CanvasXProperty, canvasDrawingMouseDownPoint.X);
3921
                                        currentControl.SetValue(TextControl.CanvasYProperty, canvasDrawingMouseDownPoint.Y);
3922
                                        currentControl.Focus();
3923
                                        (currentControl as TextControl).ApplyOverViewData();
3924
                                        (currentControl as TextControl).ControlType_No = 0;
3925
                                        (currentControl as TextControl).Angle -= rotate.Angle;
3926
                                        (currentControl as TextControl).IsHighLight = ViewerDataModel.Instance.checkHighShape;
3927

    
3928
                                        CreateControl();
3929

    
3930
                                        currentControl = null;
3931
                                    //}
3932

    
3933
                                    //controlType = ControlType.None;
3934
                                    //currentControl = null;
3935

    
3936
                                }
3937
                            }
3938
                        }
3939
                        break;
3940
                    case ControlType.TextBorder:
3941
                        {
3942
                            if (mouseButtonDown == MouseButton.Left)
3943
                            {
3944
                                if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3945
                                {
3946
                                    currentControl = new TextControl
3947
                                    {
3948
                                        //ControlType = PaintSet.Rect
3949
                                        ControlType = controlType
3950
                                    };
3951

    
3952

    
3953
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3954
                                    currentControl.CommentID = Save.shortGuid();
3955
                                    currentControl.IsNew = true;
3956
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3957
                                    currentControl.SetValue(Canvas.ZIndexProperty, 3);
3958
                                    currentControl.SetValue(TextControl.CanvasXProperty, canvasDrawingMouseDownPoint.X);
3959
                                    currentControl.SetValue(TextControl.CanvasYProperty, canvasDrawingMouseDownPoint.Y);
3960
                                    currentControl.Focus();
3961
                                    (currentControl as TextControl).ControlType_No = 1;
3962
                                    (currentControl as TextControl).Angle = Ang;
3963
                                    (currentControl as TextControl).IsHighLight = ViewerDataModel.Instance.checkHighShape;
3964
                                    //controlType = ControlType.None;
3965
                                    CreateControl();
3966

    
3967
                                    currentControl = null;
3968
                                }
3969
                            }
3970
                        }
3971
                        break;
3972
                    case ControlType.TextCloud:
3973
                        {
3974
                            if (mouseButtonDown == MouseButton.Left)
3975
                            {
3976
                                if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3977
                                {
3978
                                    currentControl = new TextControl
3979
                                    {
3980
                                        //Paint = PaintSet.Cloud
3981
                                        ControlType = controlType
3982
                                    };
3983
                                    currentControl.CommentID = Save.shortGuid();
3984
                                    currentControl.IsNew = true;
3985
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3986
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3987

    
3988
                                    currentControl.SetValue(Canvas.ZIndexProperty, 3);
3989
                                    currentControl.SetValue(TextControl.CanvasXProperty, canvasDrawingMouseDownPoint.X);
3990
                                    currentControl.SetValue(TextControl.CanvasYProperty, canvasDrawingMouseDownPoint.Y);
3991
                                    currentControl.Focus();
3992

    
3993
                                    (currentControl as TextControl).Angle = Ang;
3994
                                    (currentControl as TextControl).ControlType_No = 2;
3995
                                    (currentControl as TextControl).IsHighLight = ViewerDataModel.Instance.checkHighShape;
3996

    
3997
                                    CreateControl();
3998
                                    //controlType = ControlType.None;
3999
                                    currentControl = null;
4000
                                }
4001
                            }
4002
                        }
4003
                        break;
4004
                    case ControlType.ArrowTextControl:
4005
                        {
4006
                            if (mouseButtonDown == MouseButton.Left)
4007
                            {
4008
                                if (currentControl is ArrowTextControl)
4009
                                {
4010
                                    CreateControl();
4011
                                    //controlType = ControlType.None;
4012

    
4013
                                    (currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false;
4014
                                    (currentControl as ArrowTextControl).IsEditing = false;
4015
                                    (currentControl as ArrowTextControl).EnableEditing = false;
4016
                                    currentControl = null;
4017
                                    this.MainAngle.Visibility = Visibility.Collapsed;
4018

    
4019
                                }
4020
                                else
4021
                                {
4022
                                    if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4023
                                    {
4024
                                        currentControl = new ArrowTextControl();
4025
                                        currentControl.CommentID = Save.shortGuid();
4026
                                        currentControl.IsNew = true;
4027
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4028
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4029

    
4030
                                        currentControl.SetValue(Canvas.ZIndexProperty, 3);
4031

    
4032
                                        currentControl.SetValue(ArrowTextControl.StartPointProperty, canvasDrawingMouseDownPoint);
4033

    
4034
                                        currentControl.SetValue(ArrowTextControl.EndPointProperty, canvasDrawingMouseDownPoint);
4035

    
4036
                                        (currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape;
4037

    
4038
                                        (currentControl as ArrowTextControl).ApplyTemplate();
4039

    
4040
                                        (currentControl as ArrowTextControl).Base_TextBox.Focus();
4041
                                        this.MainAngle.Visibility = Visibility.Visible;
4042
                                        //currentControl.Focus();
4043
                                    }
4044
                                }
4045
                            }
4046
                        }
4047
                        break;
4048
                    case ControlType.ArrowTransTextControl:
4049
                        {
4050
                            if (mouseButtonDown == MouseButton.Left)
4051
                            {
4052
                                if (currentControl is ArrowTextControl)
4053
                                {
4054
                                    CreateControl();
4055
                                    (currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false;
4056
                                    //controlType = ControlType.None;
4057
                                    currentControl = null;
4058
                                    this.MainAngle.Visibility = Visibility.Collapsed;
4059
                                }
4060
                                else
4061
                                {
4062
                                    if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4063
                                    {
4064
                                        currentControl = new ArrowTextControl();
4065
                                        currentControl.CommentID = Save.shortGuid();
4066
                                        currentControl.IsNew = true;
4067
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4068
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4069

    
4070
                                        currentControl.SetValue(Canvas.ZIndexProperty, 3);
4071

    
4072
                                        currentControl.SetValue(ArrowTextControl.StartPointProperty, canvasDrawingMouseDownPoint);
4073

    
4074
                                        currentControl.SetValue(ArrowTextControl.EndPointProperty, canvasDrawingMouseDownPoint);
4075

    
4076
                                        (currentControl as ArrowTextControl).isFixed = true;
4077
                                        (currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape;
4078

    
4079
                                        (currentControl as ArrowTextControl).ApplyTemplate();
4080

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

    
4114
                                        currentControl.SetValue(Canvas.ZIndexProperty, 3);
4115

    
4116
                                        currentControl.SetValue(ArrowTextControl.StartPointProperty, canvasDrawingMouseDownPoint);
4117

    
4118
                                        currentControl.SetValue(ArrowTextControl.EndPointProperty, canvasDrawingMouseDownPoint);
4119
                                        (currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape;
4120

    
4121
                                        (currentControl as ArrowTextControl).ApplyTemplate();
4122

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

    
4156
                                        currentControl.SetValue(Canvas.ZIndexProperty, 3);
4157

    
4158
                                        currentControl.SetValue(ArrowTextControl.StartPointProperty, canvasDrawingMouseDownPoint);
4159

    
4160
                                        currentControl.SetValue(ArrowTextControl.EndPointProperty, canvasDrawingMouseDownPoint);
4161

    
4162
                                        (currentControl as ArrowTextControl).isFixed = true;
4163
                                        (currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape;
4164

    
4165
                                        (currentControl as ArrowTextControl).ApplyTemplate();
4166

    
4167
                                        (currentControl as ArrowTextControl).Base_TextBox.Focus();
4168
                                        this.MainAngle.Visibility = Visibility.Visible;
4169
                                        //currentControl.Focus();
4170
                                    }
4171
                                }
4172
                            }
4173
                        }
4174
                        break;
4175
                    case ControlType.ArrowTextCloudControl:
4176
                        {
4177
                            if (mouseButtonDown == MouseButton.Left)
4178
                            {
4179
                                if (currentControl is ArrowTextControl)
4180
                                {
4181
                                    CreateControl();
4182
                                    //controlType = ControlType.None;
4183
                                    (currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false;
4184
                                    currentControl = null;
4185
                                    this.MainAngle.Visibility = Visibility.Collapsed;
4186
                                }
4187
                                else
4188
                                {
4189
                                    if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4190
                                    {
4191
                                        currentControl = new ArrowTextControl()
4192
                                        {
4193
                                            ArrowTextStyle = MarkupToPDF.Controls.Text.ArrowTextControl.ArrowTextStyleSet.Cloud
4194
                                        };
4195
                                        currentControl.CommentID = Save.shortGuid();
4196
                                        currentControl.IsNew = true;
4197
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4198
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4199

    
4200
                                        currentControl.SetValue(Canvas.ZIndexProperty, 3);
4201

    
4202
                                        currentControl.SetValue(ArrowTextControl.StartPointProperty, canvasDrawingMouseDownPoint);
4203

    
4204
                                        currentControl.SetValue(ArrowTextControl.EndPointProperty, canvasDrawingMouseDownPoint);
4205
                                        (currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape;
4206
                                        (currentControl as ArrowTextControl).ApplyTemplate();
4207

    
4208
                                        (currentControl as ArrowTextControl).Base_TextBox.Focus();
4209
                                        this.MainAngle.Visibility = Visibility.Visible;
4210
                                        //currentControl.Focus();
4211
                                    }
4212
                                }
4213
                            }
4214
                        }
4215
                        break;
4216
                    case ControlType.ArrowTransTextCloudControl:
4217
                        {
4218
                            if (mouseButtonDown == MouseButton.Left)
4219
                            {
4220
                                if (currentControl is ArrowTextControl)
4221
                                {
4222
                                    CreateControl();
4223
                                    //controlType = ControlType.None;
4224
                                    (currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false;
4225
                                    currentControl = null;
4226
                                    this.MainAngle.Visibility = Visibility.Collapsed;
4227
                                }
4228
                                else
4229
                                {
4230
                                    if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4231
                                    {
4232
                                        currentControl = new ArrowTextControl()
4233
                                        {
4234
                                            ArrowTextStyle = MarkupToPDF.Controls.Text.ArrowTextControl.ArrowTextStyleSet.Cloud
4235
                                        };
4236
                                        currentControl.CommentID = Save.shortGuid();
4237
                                        currentControl.IsNew = true;
4238
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4239
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4240

    
4241
                                        currentControl.SetValue(Canvas.ZIndexProperty, 3);
4242

    
4243
                                        currentControl.SetValue(ArrowTextControl.StartPointProperty, canvasDrawingMouseDownPoint);
4244

    
4245
                                        currentControl.SetValue(ArrowTextControl.EndPointProperty, canvasDrawingMouseDownPoint);
4246

    
4247
                                        (currentControl as ArrowTextControl).isFixed = true;
4248
                                        (currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape;
4249

    
4250
                                        (currentControl as ArrowTextControl).ApplyTemplate();
4251

    
4252
                                        (currentControl as ArrowTextControl).Base_TextBox.Focus();
4253
                                        //currentControl.Focus();
4254
                                        this.MainAngle.Visibility = Visibility.Visible;
4255
                                    }
4256
                                }
4257
                            }
4258
                        }
4259
                        break;
4260
                    case ControlType.PolygonControl:
4261
                        {
4262
                            if (currentControl is PolygonControl)
4263
                            {
4264
                                var control = currentControl as PolygonControl;
4265

    
4266
                                if (mouseButtonDown == MouseButton.Right)
4267
                                {
4268
                                    control.IsCompleted = true;
4269
                                }
4270

    
4271
                                if (!control.IsCompleted)
4272
                                {
4273
                                    //control.PointC.pointSet.Add(control.EndPoint);
4274
                                    control.PointSet.Add(control.EndPoint);
4275
                                }
4276
                                else
4277
                                {
4278
                                    //control.IsSelected = true;
4279
                                    var firstPoint = control.PointSet.First();
4280
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
4281
                                    control.LineSize = ViewerDataModel.Instance.LineSize;
4282
                                    control.PointSet.Add(firstPoint);
4283

    
4284
                                    control.SetPolyPath();
4285

    
4286
                                    control.ApplyOverViewData();
4287

    
4288
                                    CreateControl();
4289

    
4290
                                    //controlType = ControlType.None;
4291

    
4292
                                    currentControl = null;
4293
                                }
4294
                            }
4295
                            else
4296
                            {
4297
                                if (mouseButtonDown == MouseButton.Left)
4298
                                {
4299
                                    currentControl = new PolygonControl
4300
                                    {
4301
                                        PointSet = new List<Point>(),
4302
                                        //PointC = new StylusPointSet()
4303
                                    };
4304

    
4305
                                    if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4306
                                    {
4307
                                        var polygonControl = (currentControl as PolygonControl);
4308
                                        currentControl.CommentID = Save.shortGuid();
4309
                                        currentControl.IsNew = true;
4310
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4311
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4312
                                        //currentControl.OnApplyTemplate();
4313
                                        polygonControl.PointSet.Add(canvasDrawingMouseDownPoint);
4314
                                        polygonControl.PointSet.Add(canvasDrawingMouseDownPoint);
4315
                                    }
4316
                                }
4317
                            }
4318
                        }
4319
                        break;
4320
                    //강인구 추가
4321
                    case ControlType.Sign:
4322
                        {
4323
                            if (mouseButtonDown == MouseButton.Left)
4324
                            {
4325
                                if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4326
                                {
4327
                                    if (currentControl is SignControl)
4328
                                    {
4329
                                        CreateControl();
4330
                                        currentControl = null;
4331
                                        if (Common.ViewerDataModel.Instance.SelectedControl == "Batch")
4332
                                        {
4333
                                            txtBatch.Text = "Date Control을 그립니다.";
4334
                                            controlType = ControlType.Date;
4335
                                        }
4336
                                    }
4337
                                    else
4338
                                    {
4339
                                        currentControl = new SignControl
4340
                                        {
4341
                                            Background = new SolidColorBrush(Colors.Black),
4342
                                            //UserNumber = "H2011357",
4343
                                            UserNumber = App.ViewInfo.UserID,
4344
                                            StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y),
4345
                                            EndPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y),
4346
                                            ControlType = ControlType.Sign
4347
                                        };
4348

    
4349
                                        currentControl.CommentID = Save.shortGuid();
4350
                                        currentControl.IsNew = true;
4351
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4352
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4353
                                        //currentControl.ApplyTemplate();
4354
                                    }
4355
                                }
4356
                            }
4357
                        }
4358
                        break;
4359
                    case ControlType.Mark:
4360
                        {
4361
                            if (mouseButtonDown == MouseButton.Left)
4362
                            {
4363
                                if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4364
                                {
4365
                                    if (currentControl is RectangleControl)
4366
                                    {
4367
                                        CreateControl();
4368
                                        (currentControl as RectangleControl).ApplyOverViewData();
4369
                                        //controlType = ControlType.None;
4370
                                        currentControl = null;
4371
                                        //mouseHandlingMode = MouseHandlingMode.Selecting;
4372
                                        this.cursor = Cursors.Arrow;
4373

    
4374
                                        if (Common.ViewerDataModel.Instance.SelectedControl == "Batch")
4375
                                        {
4376
                                            txtBatch.Text = "Sign Control을 그립니다.";
4377
                                            controlType = ControlType.Sign;
4378
                                        }
4379
                                    }
4380
                                    else
4381
                                    {
4382
                                        currentControl = new RectangleControl
4383
                                        {
4384
                                            Background = new SolidColorBrush(Colors.Black),
4385
                                            Paint = PaintSet.Fill
4386
                                        };
4387

    
4388
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4389
                                        currentControl.CommentID = Save.shortGuid();
4390
                                        currentControl.IsNew = true;
4391
                                        (currentControl as RectangleControl).DashSize = ViewerDataModel.Instance.DashSize;
4392
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4393
                                    }
4394
                                }
4395
                            }
4396
                        }
4397
                        break;
4398
                    case ControlType.Symbol:
4399
                        {
4400
                            if (mouseButtonDown == MouseButton.Left)
4401
                            {
4402
                                if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4403
                                {
4404
                                    if (currentControl is SymControl)
4405
                                    {
4406
                                        CreateControl();
4407
                                        //(currentControl as SymControlN).ApplyOverViewData();
4408
                                        //controlType = ControlType.None;
4409
                                        currentControl = null;
4410
                                        //mouseHandlingMode = MouseHandlingMode.Selecting;
4411
                                        this.cursor = Cursors.Arrow;
4412
                                    }
4413
                                    else
4414
                                    {
4415
                                        currentControl = new SymControl
4416
                                        {
4417
                                            StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y),
4418
                                            Background = new SolidColorBrush(Colors.Black),
4419
                                            ControlType = ControlType.Symbol
4420
                                        };
4421

    
4422
                                        currentControl.IsNew = true;
4423
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4424
                                        currentControl.CommentID = Save.shortGuid();
4425
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4426
                                    }
4427
                                }
4428
                            }
4429
                        }
4430
                        break;
4431
                    case ControlType.Stamp:
4432
                        {
4433
                            if (mouseButtonDown == MouseButton.Left)
4434
                            {
4435
                                if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4436
                                {
4437
                                    if (currentControl is SymControlN)
4438
                                    {
4439
                                        CreateControl();
4440
                                        currentControl = null;
4441
                                        this.cursor = Cursors.Arrow;
4442
                                    }
4443
                                    else
4444
                                    {
4445
                                        currentControl = new SymControlN
4446
                                        {
4447
                                            StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y),
4448
                                            Background = new SolidColorBrush(Colors.Black),
4449
                                            ControlType = ControlType.Stamp
4450
                                        };
4451

    
4452
                                        currentControl.IsNew = true;
4453
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4454
                                        currentControl.CommentID = Save.shortGuid();
4455
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4456
                                    }
4457
                                }
4458
                            }
4459
                        }
4460
                        break;
4461
                    case ControlType.PenControl:
4462
                        {
4463
                            //this.inkBoard.CaptureMouse();
4464

    
4465
                            if (inkBoard.Tag.ToString() == "Ink")
4466
                            {
4467
                                inkBoard.IsEnabled = true;
4468
                                StartNewStroke(canvasDrawingMouseDownPoint);
4469
                            }
4470
                            else if (inkBoard.Tag.ToString() == "EraseByPoint")
4471
                            {
4472
                                RemovePointStroke(canvasDrawingMouseDownPoint);
4473
                            }
4474
                            else if (inkBoard.Tag.ToString() == "EraseByStroke")
4475
                            {
4476
                                RemoveLineStroke(canvasDrawingMouseDownPoint);
4477
                            }
4478
                            IsDrawing = true;
4479
                            return;
4480
                        }
4481
                        break;
4482
                    default:
4483
                        if (currentControl != null)
4484
                        {
4485
                            currentControl.CommentID = null;
4486
                            currentControl.IsNew = false;
4487
                        }
4488
                        break;
4489
                }
4490

    
4491
            }
4492

    
4493
            else if (mouseButtonDown == MouseButton.Left && mouseHandlingMode == MouseHandlingMode.Selecting)
4494
            {
4495
                //bool Flag = true;
4496
                //ControlList = new List<object>();
4497
                //if (selected_item == null)
4498
                //{
4499
                //    selected_item = new Dictionary<Geometry, string>();
4500
                //}
4501
                //if (selected_item.Count > 0)
4502
                //{
4503
                //    mouseHandlingMode = MouseHandlingMode.Drawing;
4504

    
4505
                //    foreach (var item in ViewerDataModel.Instance.MarkupControls_USER)
4506
                //    {
4507
                //        ControlList.Add(item);
4508
                //    }
4509
                //    controlType = move.control_Move_R(ControlList, canvasDrawingMouseDownPoint);
4510
                //    currentControl = move.CurrentControl;
4511
                //}
4512
                //else
4513
                //{
4514
                //    isLeftMouseButtonDownOnWindow = true;
4515
                //}
4516
                if (controlType == ControlType.None)
4517
                {
4518
                    //init();
4519
                    //cursor = Cursors.Cross;
4520
                    //SetCursor();
4521
                    mouseHandlingMode = MouseHandlingMode.Selecting;
4522
                    this.cursor = Cursors.Arrow;
4523
                    inkDrawingCanvas.IsEnabled = false;
4524
                    isLeftMouseButtonDownOnWindow = true;
4525
                }
4526
            }
4527

    
4528
            if (mouseHandlingMode != MouseHandlingMode.None && mouseButtonDown == MouseButton.Left)
4529
            {
4530
                if (mouseHandlingMode == MouseHandlingMode.Adorner && SelectLayer.Children.Count > 0)
4531
                {
4532
                    bool mouseOff = false;
4533
                    foreach (var item in SelectLayer.Children)
4534
                    {
4535
                        if (item is AdornerFinal)
4536
                        {
4537

    
4538
                            var over = (item as AdornerFinal).MemberSet.Where(data => data.DrawingData.IsMouseOver).FirstOrDefault();
4539
                            if (over != null)
4540
                            {
4541
                                mouseOff = true;
4542
                            }
4543
                        }
4544
                    }
4545

    
4546
                    if (!mouseOff)
4547
                    {
4548
                        ReleaseAdorner();
4549
                    }
4550
                }
4551
                //if (mouseHandlingMode == MouseHandlingMode.Adorner && ViewerDataModel.Instance.MarkupControls.Where(data => data.IsMouseOver).FirstOrDefault() == null && SelectLayer.Children.Count >0)
4552
                //{
4553

    
4554
                //}
4555
                zoomAndPanControl.CaptureMouse();
4556
                e.Handled = true;
4557
            }
4558

    
4559
            //txtDrawingCanvasDownPoint_X.Text = string.Format("{0:f2}", canvasDrawingMouseDownPoint.X);
4560
            //txtDrawingCanvasDownPoint_Y.Text = string.Format("{0:f2}", canvasDrawingMouseDownPoint.Y);
4561

    
4562
            //txtZoomCanvasDownPoint_X.Text = string.Format("{0:f2}", canvasZoomPanningMouseDownPoint.X);
4563
            //txtZoomCanvasDownPoint_Y.Text = string.Format("{0:f2}", canvasZoomPanningMouseDownPoint.Y);
4564
        }
4565
        //int maxViewerWidth;
4566
        //int maxViewerHeight;
4567
        //int minViewerTop;
4568
        //int minViewerLeft;
4569

    
4570
        private void RemoveLineStroke(Point P)
4571
        {
4572
            var control = ViewerDataModel.Instance.MarkupControls_USER.Where(data => data.IsMouseOver).FirstOrDefault();
4573
            if (control != null)
4574
            {
4575
                UndoData = new Undo_data()
4576
                {
4577
                    IsUndo = false,
4578
                    Event = Event_Type.Delete,
4579
                    EventTime = DateTime.Now,
4580
                    Markup_List = new List<Multi_Undo_data>()
4581
                };
4582

    
4583

    
4584
                multi_Undo_Data.Markup = control as MarkupToPDF.Common.CommentUserInfo;
4585
                UndoData.Markup_List.Add(multi_Undo_Data);
4586
                multi_Undo_Data = new Multi_Undo_data();
4587

    
4588
                ViewerDataModel.Instance.MarkupControls_USER.Remove(control);
4589
                var Item_ = ViewerDataModel.Instance.MarkupList_USER.Where(d => d.ID == (control as MarkupToPDF.Common.CommentUserInfo).CommentID).FirstOrDefault();
4590
                ViewerDataModel.Instance.MarkupList_USER.Remove(Item_);
4591

    
4592

    
4593
                ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
4594
                {
4595
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
4596
                });
4597
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
4598

    
4599
                //if (control as PolygonControl != null)
4600
                //{
4601
                //    if ((control as PolygonControl).ControlType == ControlType.Ink)
4602
                //    {
4603
                //        ViewerDataModel.Instance.MarkupControls_USER.Remove(control);
4604
                //        var Item_ = ViewerDataModel.Instance.MarkupList_USER.Where(d => d.ID == (control as MarkupToPDF.Common.CommentUserInfo).CommentID).FirstOrDefault();
4605
                //        ViewerDataModel.Instance.MarkupList_USER.Remove(Item_);
4606
                //    }
4607
                //}
4608
            }
4609

    
4610
            //StrokeCollection hits = inkBoard.Strokes.HitTest(P);
4611
            //inkBoard.Strokes.Remove(hits);
4612
        }
4613

    
4614
        private void RemovePointStroke(Point P)
4615
        {
4616
            //StrokeCollection hits = inkBoard.Strokes.HitTest(P);
4617
            foreach (Stroke hits in inkBoard.Strokes)
4618
            {
4619
                foreach (StylusPoint sty in hits.StylusPoints)
4620
                {
4621

    
4622
                }
4623
                if (hits.HitTest(P))
4624
                {
4625
                    inkBoard.Strokes.Remove(hits);
4626
                    return;
4627
                }
4628
            }
4629
        }
4630

    
4631
        private void StartNewStroke(Point P)
4632
        {
4633
            strokePoints = new StylusPointCollection();
4634
            StylusPoint segment1Start = new StylusPoint(P.X, P.Y);
4635
            strokePoints.Add(segment1Start);
4636
            stroke = new Stroke(strokePoints);
4637

    
4638
            stroke.DrawingAttributes.Color = Colors.Red;
4639
            stroke.DrawingAttributes.Width = 4;
4640
            stroke.DrawingAttributes.Height = 4;
4641

    
4642
            inkBoard.Strokes.Add(stroke);
4643

    
4644
            //inkBoard.Strokes.Add(stroke);
4645
        }
4646

    
4647
        private void btnConsolidate_Click(object sender, RoutedEventArgs e)
4648
        {
4649
            ConsolidationMethod();
4650
        }
4651

    
4652
        public void ConsolidationMethod()
4653
        {
4654
            ChangeCommentReact();
4655

    
4656
            if (this.gridViewMarkup.SelectedItems.Count == 0)
4657
            {
4658
                this.ParentOfType<MainWindow>().DialogMessage_Alert("Please select at least one user", "Alert");
4659
            }
4660
            else
4661
            {
4662

    
4663
                if (ViewerDataModel.Instance.MarkupList_USER.Count > 0)
4664
                {
4665
                    this.ParentOfType<MainWindow>().dzTopMenu.SaveEvent(null, null);
4666
                }
4667
                //if (ViewerDataModel.Instance.MarkupControls_USER.Count() > 0 || this.gridViewMarkup.SelectedItems.Count > 0)
4668
                //{
4669
                //    this.ParentOfType<MainWindow>().dzTopMenu.SaveEvent(null, null);
4670
                //}
4671

    
4672
                //if (ViewerDataModel.Instance.MarkupControls_USER.Count() > 0)
4673
                //{
4674
                //    this.ParentOfType<MainWindow>().dzTopMenu.SaveEvent(null, null);
4675
                //}
4676

    
4677
                ViewerDataModel.Instance.IsConsolidate = true;
4678
                this.ParentOfType<MainWindow>().dzTopMenu.SaveEvent(null, null);
4679
                List<KCOMDataModel.DataModel.MARKUP_DATA> instanceDataSet = new List<KCOMDataModel.DataModel.MARKUP_DATA>();
4680
                using (KCOMDataModel.DataModel.CIEntities Entity = new KCOMDataModel.DataModel.CIEntities(KCOMDataModel.Common.ConnectStringBuilder.ProjectCIConnectString(App.ViewInfo.ProjectNO).ToString()))
4681
                {
4682
                    var markupInfo = Entity.MARKUP_INFO.Where(entity => entity.DOCINFO_ID == _DocInfo.ID).OrderByDescending(i => i.CONSOLIDATE).OrderByDescending(j => j.CREATE_TIME).FirstOrDefault();
4683
                    if (markupInfo.CONSOLIDATE == 1)
4684
                    {
4685
                        markupInfo.AVOID_CONSOLIDATE = 1;
4686
                    }
4687

    
4688
                    foreach (MarkupInfoItem item in this.gridViewMarkup.SelectedItems)
4689
                    {
4690
                        Entity.MARKUP_DATA.Where(data => data.MARKUPINFO_VERSION_ID == item.MarkupVersionID).ToList().ForEach(d =>
4691
                          {
4692
                              instanceDataSet.Add(d);
4693
                          });
4694
                    }
4695

    
4696
                    KCOMDataModel.DataModel.MARKUP_INFO info = new KCOMDataModel.DataModel.MARKUP_INFO();
4697
                    info.ID = Save.shortGuid();
4698
                    info.CONSOLIDATE = 1;
4699
                    info.CREATE_TIME = DateTime.Now;
4700
                    info.DOCINFO_ID = _DocInfo.ID;
4701
                    info.UPDATE_TIME = DateTime.Now;
4702
                    info.USER_ID = App.ViewInfo.UserID;
4703
                    info.AVOID_CONSOLIDATE = 0;
4704

    
4705
                    Entity.MARKUP_INFO.AddObject(info);
4706
                    Entity.SaveChanges();
4707

    
4708

    
4709
                    KCOMDataModel.DataModel.MARKUP_INFO_VERSION info2 = new KCOMDataModel.DataModel.MARKUP_INFO_VERSION
4710
                    {
4711
                        ID = Save.shortGuid(),
4712
                        CREATE_DATE = DateTime.Now,
4713
                        MARKUP_INFO = info,
4714
                    };
4715
                    Entity.SaveChanges();
4716

    
4717
                    foreach (var item in instanceDataSet)
4718
                    {
4719
                        Entity.MARKUP_DATA.AddObject(new KCOMDataModel.DataModel.MARKUP_DATA
4720
                        {
4721
                            ID = Save.shortGuid(),
4722
                            DATA = item.DATA,
4723
                            DATA_TYPE = item.DATA_TYPE,
4724
                            PAGENUMBER = item.PAGENUMBER,
4725
                            MARKUP_INFO_VERSION = info2
4726
                        });
4727
                    }
4728
                    Entity.SaveChanges();
4729
                    this.BaseClient.GetMarkupInfoItemsAsync(App.ViewInfo.ProjectNO, _DocInfo.ID);
4730
                }
4731
            }
4732
        }
4733

    
4734
        private void btnConsolidate_Loaded(object sender, RoutedEventArgs e)
4735
        {
4736
            if (App.ViewInfo != null)
4737
            {
4738
                btnConsolidate = (sender as RadRibbonButton);
4739
                if (!App.ViewInfo.NewCommentPermission)
4740
                {
4741
                    (sender as RadRibbonButton).Visibility = System.Windows.Visibility.Collapsed;
4742
                    //instanceTop = this.ParentOfType<MainWindow>().dzTopMenu;
4743
                    //instanceTop.btnSwing.Visibility = Visibility.Collapsed;
4744
                    //instanceTop.cbSwingMode.Visibility = Visibility.Collapsed;
4745

    
4746
                    //instanceTop.btnExportPDF.Visibility = Visibility.Visible;
4747
                    //instanceTop.btnExportPrint.Visibility = Visibility.Visible;
4748
                }
4749
            }
4750
        }
4751

    
4752
        private void btnTeamConsolidate_Click(object sender, RoutedEventArgs e)
4753
        {
4754

    
4755
        }
4756

    
4757
        private void btnTeamConsolidate_Loaded(object sender, RoutedEventArgs e)
4758
        {
4759
            btnTeamConsolidate = sender as RadRibbonButton;
4760
            if (App.ViewInfo != null)
4761
            {
4762
                if (!App.ViewInfo.CreateFinalPDFPermission) //파이널이 True가 아니면
4763
                {
4764
                    if (btnConsolidate != null)
4765
                    {
4766
                        btnConsolidate.Visibility = Visibility.Collapsed;
4767
                    }
4768

    
4769
                    if (!App.ViewInfo.NewCommentPermission)
4770
                    {
4771
                        btnTeamConsolidate.Visibility = Visibility.Collapsed;
4772
                    }
4773
                }
4774
                else
4775
                {
4776
                    btnTeamConsolidate.Visibility = Visibility.Collapsed;
4777
                }
4778
            }
4779
        }
4780

    
4781
        private void FinalPDFEvent(object sender, RoutedEventArgs e)
4782
        {
4783
            //this.ParentOfType<MainWindow>().dzTopMenu.SaveEvent(null, null);
4784

    
4785
            var item = gridViewMarkup.Items.Cast<MarkupInfoItem>().Where(d => d.Consolidate == 1 && d.AvoidConsolidate == 0).FirstOrDefault();
4786
            if (item != null)
4787
            {
4788
                BaseClient.SetFinalPDFAsync(_ViewInfo.ProjectNO, _DocInfo.ID, item.MarkupInfoID, _ViewInfo.UserID);
4789
            }
4790
            else
4791
            {
4792
                DialogMessage_Alert("Consolidation 된 코멘트가 존재하지 않습니다", "안내");
4793
            }
4794
        }
4795

    
4796
        private void btnFinalPDF_Loaded(object sender, RoutedEventArgs e)
4797
        {
4798
            btnFinalPDF = sender as RadRibbonButton;
4799
            if (App.ViewInfo != null)
4800
            {
4801
                if (!App.ViewInfo.CreateFinalPDFPermission) //파이널이 True가 아니면
4802
                {
4803
                    btnFinalPDF.Visibility = System.Windows.Visibility.Collapsed;
4804
                    if (btnConsolidate != null)
4805
                    {
4806
                        btnConsolidate.Visibility = Visibility.Collapsed;
4807
                    }
4808
                }
4809
            }
4810
        }
4811

    
4812
        private void Button_Click(object sender, RoutedEventArgs e)
4813
        {
4814

    
4815
            //bool isGO = false;
4816
            //imageViewer.MouseLeftButtonDown += (sen, ea) =>
4817
            //  {
4818
            //      isGO = true;
4819
            //  };
4820
            //imageViewer.MouseLeftButtonUp += (sen, ea) =>
4821
            //{
4822
            //    isGO = false;
4823
            //};
4824
            //imageViewer.SizeMode = SizeMode.Fit;
4825
            //imageViewer.InteractiveMode = InteractiveMode.UserRectangle;
4826
            //imageViewer.InteractiveUserRectangle += (sen, ea) =>
4827
            //{
4828
            //    System.Diagnostics.Debug.WriteLine(ea.Bounds);
4829
            //    if (ea.Status == InteractiveModeStatus.End)
4830
            //    {
4831
            //        //zoomAndPanControl.ZoomTo(ea.Bounds);
4832
            //        zoomAndPanControl.ZoomTo(ea.Bounds);
4833
            //    }
4834

    
4835
            //};
4836

    
4837
            //Canvas.SetZIndex(imageViewer, 10);
4838
            //gather information on the viewer
4839

    
4840

    
4841
            //System.Windows.Forms.OpenFileDialog dialog = new System.Windows.Forms.OpenFileDialog();
4842
            //var result = dialog.ShowDialog();
4843
            //if (result == System.Windows.Forms.DialogResult.OK)
4844
            //{
4845
            //    using (Leadtools.Codecs.RasterCodecs codecs = new Leadtools.Codecs.RasterCodecs())
4846
            //    {
4847
            //        imageViewer.Image = codecs.Load(dialog.FileName, 0, Leadtools.Codecs.CodecsLoadByteOrder.Gray, 1, 1);
4848
            //        //imageViewer.Image = codecs.Load(dialog.FileName, 24, Leadtools.Codecs.CodecsLoadByteOrder.BgrOrGray, 1, 1);
4849
            //        //imageViewer.Image.AnimationBackground = Leadtools.RasterColor.White;
4850

    
4851
            //        //var d = imageViewer.Image.CreateThumbnail(100, 100, 24, Leadtools.RasterViewPerspective.TopLeft, Leadtools.RasterSizeFlags.None);
4852
            //        //RasterImageViewer vvv = new RasterImageViewer();
4853
            //        //vvv.Image = d;
4854
            //        //zoomAndPanCanvas.Children.Add(vvv);
4855

    
4856
            //        zoomAndPanCanvas.Width = Convert.ToDouble(imageViewer.Image.ImageWidth);
4857
            //        zoomAndPanCanvas.Height = Convert.ToDouble(imageViewer.Image.ImageHeight);
4858

    
4859
            //        Common.ViewerDataModel.Instance.ContentWidth = zoomAndPanCanvas.Width;
4860
            //        Common.ViewerDataModel.Instance.ContentHeight = zoomAndPanCanvas.Height;
4861
            //        //zoomAndPanControl.AnimatedScaleToFit();
4862
            //        zoomAndPanControl.ScaleToFit();
4863
            //    }
4864
            //}
4865

    
4866
        }//괄호 다시 확인 필요
4867

    
4868
        //강인구 추가
4869
        //가로 세로 동일한 컨트롤 그리기(계산 다시 필요)
4870
        private Point ShiftDrawing(Point StartP, Point EndP)
4871
        {
4872
            Point Return_Point = EndP;
4873
            //Shift key를 눌렀을때만 발동
4874
            if (ViewerDataModel.Instance.IsPressShift)
4875
            {
4876
                Square square = new Square();
4877
                double pt_X = 0;
4878
                double pt_Y = 0;
4879
                double result = 0;
4880

    
4881
                //pt_X = Math.Max(StartP.X, EndP.X) - Math.Min(StartP.X, EndP.X);
4882
                //pt_Y = Math.Max(StartP.Y, EndP.Y) - Math.Min(StartP.Y, EndP.Y);
4883
                if (EndP.X > StartP.X && EndP.Y > StartP.Y)
4884
                {
4885
                    pt_X = EndP.X - StartP.X;
4886
                    pt_Y = EndP.Y - StartP.Y;
4887
                }
4888
                else if (EndP.X < StartP.X && EndP.Y > StartP.Y)
4889
                {
4890
                    pt_X = StartP.X - EndP.X;
4891
                    pt_Y = EndP.Y - StartP.Y;
4892
                }
4893
                else if (EndP.X > StartP.X && EndP.Y < StartP.Y)
4894
                {
4895
                    pt_X = EndP.X - StartP.X;
4896
                    pt_Y = StartP.Y - EndP.Y
4897
;
4898
                }
4899
                result = Math.Max(pt_X, pt_Y) - Math.Min(pt_X, pt_Y);
4900
                if (pt_X < pt_Y)
4901
                {
4902
                    Return_Point = new Point(EndP.X + result, EndP.Y);
4903
                }
4904
                else
4905
                {
4906
                    Return_Point = new Point(EndP.X, EndP.Y + result);
4907
                }
4908
            }
4909

    
4910
            return Return_Point;
4911
        }
4912

    
4913
        private void SyncCompare_Click(object sender, RoutedEventArgs e)
4914
        {
4915
            if (CompareMode.IsChecked)
4916
            {
4917
                if (ViewerDataModel.Instance.PageBalanceMode && ViewerDataModel.Instance.PageBalanceNumber == 0)
4918
                {
4919
                    ViewerDataModel.Instance.PageBalanceNumber = 1;
4920
                }
4921
                if (ViewerDataModel.Instance.PageNumber == 0)
4922
                {
4923
                    ViewerDataModel.Instance.PageNumber = 1;
4924
                }
4925

    
4926
                //BaseClient.GetCompareRectAsync(_ViewInfo.ProjectNO, _ViewInfo.DocumentItemID, CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber.ToString(), ViewerDataModel.Instance.PageBalanceMode ? ViewerDataModel.Instance.PageBalanceNumber.ToString() : pageNavigator.CurrentPage.PageNumber.ToString());
4927
                BaseClient.GetCompareRectAsync(_ViewInfo.ProjectNO, _ViewInfo.DocumentItemID, CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber.ToString(), ViewerDataModel.Instance.PageNumber.ToString());
4928

    
4929
                //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);
4930
                //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);
4931

    
4932
                //MARKUS.CompareLib compareLib = new MARKUS.CompareLib();
4933
                //System.IO.Stream resultOrigin = compareLib.ChangeCmpUrlToPng(originFile);
4934
                //System.IO.Stream resultTarget = compareLib.ChangeCmpUrlToPng(targetFile);
4935

    
4936
                //var resultOrigin = compareLib.ChangeCmpUrlToPng_File(originFile);
4937
                //var resultTarget = compareLib.ChangeCmpUrlToPng_File(targetFile);
4938

    
4939
                //string outPutFile = compareLib.ImageCompare_File(resultOrigin, resultTarget);
4940
                //var result = compareLib.GetBoundBoxInImage(outPutFile);
4941

    
4942
                //SolidColorBrush mySolidColorBrush = new SolidColorBrush();
4943
                //mySolidColorBrush.Color = Color.FromArgb(255, 255, 255, 0);
4944

    
4945
                //result.ForEach(d =>
4946
                //{
4947
                //    d.Width = d.Width * 3;
4948
                //    d.Height = d.Height * 3;
4949
                //    var point = MathSet.getRectMiddlePoint(d);
4950
                //    Ellipse myEllipse = new Ellipse();
4951
                //    myEllipse.Fill = new SolidColorBrush(Colors.Red);
4952
                //    myEllipse.Opacity = 1;
4953
                //        //myEllipse.StrokeThickness = 2;
4954
                //        //myEllipse.Stroke = Brushes.Black;
4955
                //        myEllipse.Width = d.Width;
4956
                //    myEllipse.Height = d.Height;
4957
                //    Canvas.SetLeft(myEllipse, d.X - ((point.X - d.X) / 2.0));
4958
                //    Canvas.SetTop(myEllipse, d.Y - ((point.Y - d.Y) / 2.0));
4959
                //    myEllipse.RenderTransformOrigin = point;
4960
                //    canvas_compareBorder.Children.Add(myEllipse);
4961
                //});
4962

    
4963
                //da.From = 0.8;
4964
                //da.To = 0;
4965
                //da.Duration = new Duration(TimeSpan.FromSeconds(1));
4966
                //da.AutoReverse = true;
4967
                //canvas_compareBorder.BeginAnimation(OpacityProperty, da);
4968
            }
4969
            else
4970
            {
4971
                da.From = 1;
4972
                da.To = 1;
4973
                da.Duration = new Duration(TimeSpan.FromSeconds(9999));
4974
                da.AutoReverse = false;
4975
                canvas_compareBorder.Children.Clear();
4976
                canvas_compareBorder.BeginAnimation(OpacityProperty, da);
4977
            }
4978
        }
4979

    
4980
        private void SyncUserListExpender_Click(object sender, RoutedEventArgs e)
4981
        {
4982
            if (UserList.IsChecked)
4983
            {
4984
                this.gridViewRevMarkup.Visibility = Visibility.Visible;
4985
            }
4986
            else
4987
            {
4988
                this.gridViewRevMarkup.Visibility = Visibility.Collapsed;
4989
            }
4990
            //if ((sender as RadToggleButton).IsChecked == true)
4991
            //{
4992
            //    this.gridViewRevMarkup.Visibility = Visibility.Visible;
4993
            //}
4994
            //else
4995
            //{
4996
            //    this.gridViewRevMarkup.Visibility = Visibility.Collapsed;
4997
            //}
4998
        }
4999

    
5000
        private void SyncPageBalance_Click(object sender, RoutedEventArgs e)
5001
        {
5002
            //ViewerDataModel.Instance.PageBalanceNumber = ViewerDataModel.Instance.PageBalanceNumber <= 0 ? Convert.ToInt32((sender as System.Windows.Controls.Control).Tag) : ViewerDataModel.Instance.PageBalanceNumber;
5003
            //ViewerDataModel.Instance.PageBalanceNumber = 0;
5004

    
5005

    
5006
            if (BalanceMode.IsChecked)
5007
            {
5008
                ViewerDataModel.Instance.PageBalanceMode = true;
5009
            }
5010
            else
5011
            {
5012
                ViewerDataModel.Instance.PageBalanceMode = false;
5013
                ViewerDataModel.Instance.PageBalanceNumber = 0;
5014
            }
5015
            //if ((sender as RadToggleButton).IsChecked == true)
5016
            //{
5017
            //    ViewerDataModel.Instance.PageBalanceMode = true;
5018
            //}
5019
            //else
5020
            //{
5021
            //    ViewerDataModel.Instance.PageBalanceMode = false;
5022
            //    ViewerDataModel.Instance.PageBalanceNumber = 0;
5023
            //}
5024
        }
5025

    
5026
        private void SyncExit_Click(object sender, RoutedEventArgs e)
5027
        {
5028
            //초기화
5029
            testPanel2.IsHidden = true;
5030
            ViewerDataModel.Instance.PageBalanceMode = false;
5031
            ViewerDataModel.Instance.PageBalanceNumber = 0;
5032
            ViewerDataModel.Instance.PageNumber = 0;
5033
            ViewerDataModel.Instance.MarkupControls_Sync.Clear();
5034
            this.gridViewRevMarkup.Visibility = Visibility.Collapsed;
5035
            UserList.IsChecked = false;
5036
            BalanceMode.IsChecked = false;
5037
        }
5038

    
5039
        private void SyncPageChange_Click(object sender, RoutedEventArgs e)
5040
        {
5041
            if ((sender as System.Windows.Controls.Control).Tag != null)
5042
            {
5043
                //Compare 초기화
5044
                CompareMode.IsChecked = false;
5045
                var balancePoint = Convert.ToInt32((sender as System.Windows.Controls.Control).Tag);
5046

    
5047
                //if (ViewerDataModel.Instance.PageBalanceNumber == 0)
5048
                //{
5049
                //    ViewerDataModel.Instance.PageBalanceNumber = 1;
5050
                //}
5051

    
5052
                if (ViewerDataModel.Instance.PageNumber == 0)
5053
                {
5054
                    ViewerDataModel.Instance.PageNumber = 1;
5055
                }
5056

    
5057
                if (ViewerDataModel.Instance.PageBalanceNumber == pageNavigator.PageCount)
5058
                {
5059
                }
5060
                else
5061
                {
5062
                    ViewerDataModel.Instance.PageBalanceNumber += balancePoint;
5063
                }
5064
                //else if ((ViewerDataModel.Instance.PageBalanceNumber + balancePoint) >= 1)
5065
                //{
5066
                //    //ViewerDataModel.Instance.PageBalanceNumber += balancePoint;
5067
                //    ViewerDataModel.Instance.PageBalanceNumber += balancePoint;
5068
                //}
5069

    
5070
                if (ViewerDataModel.Instance.PageNumber == pageNavigator.PageCount && balancePoint > 0)
5071
                {
5072

    
5073
                }
5074
                else if ((ViewerDataModel.Instance.PageNumber + balancePoint) >= 1)
5075
                {
5076
                    ViewerDataModel.Instance.PageNumber += balancePoint;
5077
                }
5078

    
5079
                if (!testPanel2.IsHidden)
5080
                {
5081
                    //using (Leadtools.Codecs.RasterCodecs codecs = new Leadtools.Codecs.RasterCodecs())
5082
                    //{
5083
                    if (IsSyncPDFMode)
5084
                    {
5085
                        Get_FinalImage.Get_PdfImage get_PdfImage = new Get_FinalImage.Get_PdfImage();
5086
                        var pdfpath = new BitmapImage(new Uri(get_PdfImage.Run(CurrentRev.TO_VENDOR, App.ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, ViewerDataModel.Instance.PageNumber)));
5087

    
5088
                        if (pdfpath.IsDownloading)
5089
                        {
5090
                            pdfpath.DownloadCompleted += (ex, arg) =>
5091
                            {
5092
                                ViewerDataModel.Instance.ImageViewPath_C = pdfpath;
5093
                                ViewerDataModel.Instance.ImageViewWidth_C = pdfpath.PixelWidth;
5094
                                ViewerDataModel.Instance.ImageViewHeight_C = pdfpath.PixelHeight;
5095
                                zoomAndPanCanvas2.Width = pdfpath.PixelWidth;
5096
                                zoomAndPanCanvas2.Height = pdfpath.PixelHeight;
5097
                            };
5098
                        }
5099
                        else
5100
                        {
5101
                            ViewerDataModel.Instance.ImageViewPath_C = pdfpath;
5102
                            ViewerDataModel.Instance.ImageViewWidth_C = pdfpath.PixelWidth;
5103
                            ViewerDataModel.Instance.ImageViewHeight_C = pdfpath.PixelHeight;
5104

    
5105
                            zoomAndPanCanvas2.Width = pdfpath.PixelWidth;
5106
                            zoomAndPanCanvas2.Height = pdfpath.PixelHeight;
5107
                        }
5108

    
5109

    
5110
                        //PDF Mode 잠시대기
5111
                        //Leadtools.Pdf.PDFDocument dpc = new Leadtools.Pdf.PDFDocument(ViewerDataModel.Instance.GetStreamFromUrl(CurrentRev.TO_VENDOR));
5112
                        //var image = dpc.GetPageImage(codecs, ViewerDataModel.Instance.PageNumber);
5113
                        //Leadtools.ImageProcessing.SizeCommand size = new Leadtools.ImageProcessing.SizeCommand((int)imageViewer.Image.Width, (int)imageViewer.Image.Height, Leadtools.RasterSizeFlags.Resample);
5114
                        //size.Run(image);
5115
                        //image.XResolution = 150;
5116
                        //image.YResolution = 150;
5117
                        //imageViewer_Compare.Image = image;
5118
                    }
5119
                    else
5120
                    {
5121
                        //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);
5122
                        //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);
5123
                        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);
5124
                        //imageViewer_Compare.Image = codecs.Load(ViewerDataModel.Instance.GetStreamFromUrl(uri), 0, Leadtools.Codecs.CodecsLoadByteOrder.BgrOrGray, 1, 1);
5125

    
5126
                        var defaultBitmapImage_Compare = new BitmapImage(new Uri(uri));
5127

    
5128
                        ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare;
5129
                        ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth;
5130
                        ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight;
5131

    
5132
                        zoomAndPanCanvas2.Width = defaultBitmapImage_Compare.PixelWidth;
5133
                        zoomAndPanCanvas2.Height = defaultBitmapImage_Compare.PixelHeight;
5134

    
5135
                        if (defaultBitmapImage_Compare.IsDownloading)
5136
                        {
5137
                            defaultBitmapImage_Compare.DownloadCompleted += (ex, arg) =>
5138
                            {
5139
                                ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare;
5140
                                ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth;
5141
                                ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight;
5142

    
5143
                                zoomAndPanCanvas2.Width = defaultBitmapImage_Compare.PixelWidth;
5144
                                zoomAndPanCanvas2.Height = defaultBitmapImage_Compare.PixelHeight;
5145
                            };
5146
                        }
5147
                    }
5148

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

    
5153
                    foreach (var item in gridSelectionRevItem)
5154
                    {
5155
                        item.MarkupList.Where(pageItem => pageItem.PageNumber == ViewerDataModel.Instance.PageNumber).ToList().ForEach(delegate (MarkupItem markupitem)
5156
                        {
5157
                            layerControl.markupParse(markupitem.Data, Common.ViewerDataModel.Instance.MarkupControls_Sync, item.DisplayColor, "", item.MarkupInfoID);
5158
                        });
5159
                    }
5160

    
5161

    
5162
                    //zoomAndPanCanvas2.Width = imageViewer_Compare.Image.Width;
5163
                    //zoomAndPanCanvas2.Height = imageViewer_Compare.Image.Height;
5164
                    //강인구 추가
5165
                    zoomAndPanControl2.ZoomTo(new Rect
5166
                    {
5167
                        X = 0,
5168
                        Y = 0,
5169
                        Width = Math.Max(zoomAndPanCanvas.Width, zoomAndPanCanvas2.Width),
5170
                        Height = Math.Max(zoomAndPanCanvas.Height, zoomAndPanCanvas2.Height),
5171
                    });
5172
                    //}
5173
                    //tlSyncRev.Text = String.Format("Rev. {0}", CurrentRev.RevNo);
5174
                    //tlSyncPageNum.Text = String.Format("Current Page : {0}", ViewerDataModel.Instance.PageBalanceNumber);
5175
                    tlSyncPageNum.Text = String.Format("Current Page : {0}", ViewerDataModel.Instance.PageNumber);
5176

    
5177
                }
5178
            }
5179
        }
5180

    
5181
        private void SyncChange_Click(object sender, RoutedEventArgs e)
5182
        {
5183
            //if ((sender as RadToggleButton).IsChecked)
5184
            if (MarkupMode.IsChecked)
5185
            {
5186
                //(sender as RadToggleButton).Content = "PDF Mode";
5187
                IsSyncPDFMode = true;
5188

    
5189
                var uri = CurrentRev.TO_VENDOR;
5190
                //Leadtools.Pdf.PDFDocument dpc = new Leadtools.Pdf.PDFDocument(ViewerDataModel.Instance.GetStreamFromUrl(uri));
5191
                //using (Leadtools.Codecs.RasterCodecs codecs = new Leadtools.Codecs.RasterCodecs())
5192
                //{
5193
                //if (ViewerDataModel.Instance.PageBalanceNumber == 0)
5194
                //{
5195
                //    ViewerDataModel.Instance.PageBalanceNumber = 1;
5196
                //}
5197
                if (ViewerDataModel.Instance.PageNumber == 0)
5198
                {
5199
                    ViewerDataModel.Instance.PageNumber = 1;
5200
                }
5201

    
5202
                //var image = dpc.GetPageImage(codecs, ViewerDataModel.Instance.PageBalanceNumber);
5203

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

    
5208
                //System.Net.WebClient client = new System.Net.WebClient();
5209
                //byte[] imageBytes = client.DownloadData(new Uri(get_PdfImage.Run(CurrentRev.TO_VENDOR, App.ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, ViewerDataModel.Instance.PageNumber)));
5210
                //System.Drawing.Image img;
5211
                //System.IO.MemoryStream ms = new System.IO.MemoryStream(imageBytes, 0, imageBytes.Length);
5212
                //ms.Write(imageBytes, 0, imageBytes.Length);
5213
                //img = System.Drawing.Image.FromStream(ms, true);//Exception occurs here
5214

    
5215
                if (pdfpath.IsDownloading)
5216
                {
5217
                    pdfpath.DownloadCompleted += (ex, arg) =>
5218
                    {
5219
                        ViewerDataModel.Instance.ImageViewPath_C = pdfpath;
5220
                        ViewerDataModel.Instance.ImageViewWidth_C = pdfpath.PixelWidth;
5221
                        ViewerDataModel.Instance.ImageViewHeight_C = pdfpath.PixelHeight;
5222
                        zoomAndPanCanvas2.Width = pdfpath.PixelWidth;
5223
                        zoomAndPanCanvas2.Height = pdfpath.PixelHeight;
5224
                    };
5225
                }
5226
                else
5227
                {
5228
                    ViewerDataModel.Instance.ImageViewPath_C = pdfpath;
5229
                    ViewerDataModel.Instance.ImageViewWidth_C = pdfpath.PixelWidth;
5230
                    ViewerDataModel.Instance.ImageViewHeight_C = pdfpath.PixelHeight;
5231

    
5232
                    zoomAndPanCanvas2.Width = pdfpath.PixelWidth;
5233
                    zoomAndPanCanvas2.Height = pdfpath.PixelHeight;
5234
                }
5235

    
5236
                //var image = dpc.GetPageImage(codecs, ViewerDataModel.Instance.PageNumber);
5237
                //Leadtools.ImageProcessing.SizeCommand size = new Leadtools.ImageProcessing.SizeCommand((int)imageViewer.Image.Width, (int)imageViewer.Image.Height, Leadtools.RasterSizeFlags.Resample);
5238
                //size.Run(image);
5239
                //image.XResolution = 150;
5240
                //image.YResolution = 150;
5241
                //imageViewer_Compare.Image = image;
5242
                //}
5243
            }
5244
            else
5245
            {
5246
                //(sender as RadToggleButton).Content = "Markup Mode";
5247
                IsSyncPDFMode = false;
5248

    
5249
                //using (Leadtools.Codecs.RasterCodecs codecs = new Leadtools.Codecs.RasterCodecs())
5250
                //{
5251
                //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);
5252
                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);
5253

    
5254
                var defaultBitmapImage_Compare = new BitmapImage(new Uri(uri));
5255

    
5256
                ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare;
5257
                ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth;
5258
                ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight;
5259

    
5260
                if (defaultBitmapImage_Compare.IsDownloading)
5261
                {
5262
                    defaultBitmapImage_Compare.DownloadCompleted += (ex, arg) =>
5263
                    {
5264
                        ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare;
5265
                        ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth;
5266
                        ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight;
5267
                    };
5268
                }
5269

    
5270
                //imageViewer_Compare.Image = codecs.Load(ViewerDataModel.Instance.GetStreamFromUrl(uri), 0, Leadtools.Codecs.CodecsLoadByteOrder.BgrOrGray, 1, 1);
5271
                zoomAndPanControl2.ApplyTemplate();
5272
                zoomAndPanControl2.UpdateLayout();
5273
                zoomAndPanCanvas2.Width = Convert.ToDouble(Common.ViewerDataModel.Instance.ContentWidth);
5274
                zoomAndPanCanvas2.Height = Convert.ToDouble(Common.ViewerDataModel.Instance.ContentHeight);
5275
                //}
5276
            }
5277

    
5278
            //var options = new Leadtools.Documents.LoadDocumentAsyncOptions();
5279
            //options.FirstPageNumber = pageNavigator.CurrentPage.PageNumber;
5280
            //options.LastPageNumber = pageNavigator.CurrentPage.PageNumber;
5281
            ////options.LoadEmbeddedAnnotations = true;
5282
            ////options.UseCache = true;
5283
            //options.Completed += (sen, ea) =>
5284
            //{
5285
            //    //ea.Document.Pages[0].GetAnnotations(true);
5286
            //    //SetAnnotations
5287
            //    imageViewer_Compare.Image = ea.Document.Pages[0].GetImage();
5288

    
5289
            //    zoomAndPanCanvas2.Width = Convert.ToDouble(imageViewer_Compare.Image.Width);
5290
            //    zoomAndPanCanvas2.Height = Convert.ToDouble(imageViewer_Compare.Image.Height);
5291
            //};
5292
            //var uri = new Uri("http://cloud.devdoftech.co.kr:5977/FinalPDF/000000_app/VPCS_DOCLIB/111111/11111111/ToVendor/TEST_C_A.pdf");
5293
            //Leadtools.Documents.DocumentFactory.LoadFromUriAsync(uri, options);
5294

    
5295

    
5296
        }
5297

    
5298
        private void RadButton_Click(object sender, RoutedEventArgs e)
5299
        {
5300
            gridViewHistory_Busy.IsBusy = true;
5301

    
5302
            RadButton instance = sender as RadButton;
5303
            if (instance.CommandParameter != null)
5304
            {
5305
                CurrentRev = instance.CommandParameter as VPRevision;
5306
                BaseClient.GetSyncMarkupInfoItemsCompleted += (sen, ea) =>
5307
                {
5308
                    if (ea.Error == null && ea.Result != null)
5309
                    {
5310
                        testPanel2.IsHidden = false;
5311
                        //testList.ItemsSource = ea.Result;
5312

    
5313
                        ViewerDataModel.Instance._markupInfoRevList = SetDisplayColor(ea.Result, _ViewInfo.UserID);
5314
                        gridViewRevMarkup.ItemsSource = ViewerDataModel.Instance._markupInfoRevList;
5315

    
5316
                        //using (Leadtools.Codecs.RasterCodecs codecs = new Leadtools.Codecs.RasterCodecs())
5317
                        //{
5318
                        //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);
5319
                        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);
5320

    
5321
                        Sync_Offset_Point = new Point(zoomAndPanControl.ContentOffsetX, zoomAndPanControl.ContentOffsetY);
5322

    
5323
                        var defaultBitmapImage_Compare = new BitmapImage(new Uri(uri));
5324

    
5325
                        ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare;
5326
                        ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth;
5327
                        ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight;
5328

    
5329
                        if (defaultBitmapImage_Compare.IsDownloading)
5330
                        {
5331
                            defaultBitmapImage_Compare.DownloadCompleted += (ex, arg) =>
5332
                            {
5333
                                ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare;
5334
                                ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth;
5335
                                ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight;
5336
                            };
5337
                        }
5338

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

    
5341
                        zoomAndPanCanvas2.Width = Convert.ToDouble(Common.ViewerDataModel.Instance.ContentWidth);
5342
                        zoomAndPanCanvas2.Height = Convert.ToDouble(Common.ViewerDataModel.Instance.ContentHeight);
5343
                        zoomAndPanControl2.RotationAngle = zoomAndPanControl.RotationAngle;
5344
                        //대기(강인구)
5345
                        //imageViewer_Compare.RotateAngle = imageViewer.RotateAngle;
5346
                        zoomAndPanControl2.ApplyTemplate();
5347
                        zoomAndPanControl2.UpdateLayout();
5348

    
5349
                        if (Sync_Offset_Point != new Point(zoomAndPanControl.ContentOffsetX, zoomAndPanControl.ContentOffsetY))
5350
                        {
5351
                            zoomAndPanControl.ContentOffsetX = Sync_Offset_Point.X;
5352
                            zoomAndPanControl.ContentOffsetY = Sync_Offset_Point.Y;
5353
                        }
5354
                        //}
5355

    
5356
                        tlSyncRev.Text = String.Format("Rev. {0}", CurrentRev.RevNo);
5357
                        tlSyncPageNum.Text = String.Format("Current Page : {0}", pageNavigator.CurrentPage.PageNumber);
5358
                        gridViewHistory_Busy.IsBusy = false;
5359
                    }
5360
                };
5361
                BaseClient.GetSyncMarkupInfoItemsAsync(_ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, _ViewInfo.UserID);
5362
            }
5363
        }
5364

    
5365
        public void Sync_Event(VPRevision Currnet_Rev)
5366
        {
5367
            CurrentRev = Currnet_Rev;
5368

    
5369
            BaseClient.GetSyncMarkupInfoItemsCompleted += (sen, ea) =>
5370
            {
5371
                if (ea.Error == null && ea.Result != null)
5372
                {
5373
                    testPanel2.IsHidden = false;
5374
                    //testList.ItemsSource = ea.Result;
5375

    
5376
                    ViewerDataModel.Instance._markupInfoRevList = SetDisplayColor(ea.Result, _ViewInfo.UserID);
5377
                    gridViewRevMarkup.ItemsSource = ViewerDataModel.Instance._markupInfoRevList;
5378

    
5379
                    //using (Leadtools.Codecs.RasterCodecs codecs = new Leadtools.Codecs.RasterCodecs())
5380
                    //{
5381
                    //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);
5382
                    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);
5383

    
5384
                    Sync_Offset_Point = new Point(zoomAndPanControl.ContentOffsetX, zoomAndPanControl.ContentOffsetY);
5385

    
5386
                    var defaultBitmapImage_Compare = new BitmapImage(new Uri(uri));
5387

    
5388
                    ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare;
5389
                    ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth;
5390
                    ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight;
5391

    
5392
                    if (defaultBitmapImage_Compare.IsDownloading)
5393
                    {
5394
                        defaultBitmapImage_Compare.DownloadCompleted += (ex, arg) =>
5395
                        {
5396
                            ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare;
5397
                            ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth;
5398
                            ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight;
5399
                        };
5400
                    }
5401

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

    
5404
                    zoomAndPanCanvas2.Width = Convert.ToDouble(Common.ViewerDataModel.Instance.ContentWidth);
5405
                    zoomAndPanCanvas2.Height = Convert.ToDouble(Common.ViewerDataModel.Instance.ContentHeight);
5406
                    zoomAndPanControl2.ApplyTemplate();
5407
                    zoomAndPanControl2.UpdateLayout();
5408

    
5409
                    if (Sync_Offset_Point != new Point(zoomAndPanControl.ContentOffsetX, zoomAndPanControl.ContentOffsetY))
5410
                    {
5411
                        zoomAndPanControl.ContentOffsetX = Sync_Offset_Point.X;
5412
                        zoomAndPanControl.ContentOffsetY = Sync_Offset_Point.Y;
5413
                    }
5414
                    //}
5415

    
5416
                    tlSyncRev.Text = String.Format("Rev. {0}", CurrentRev.RevNo);
5417
                    tlSyncPageNum.Text = String.Format("Current Page : {0}", pageNavigator.CurrentPage.PageNumber);
5418
                    gridViewHistory_Busy.IsBusy = false;
5419
                }
5420
            };
5421
            BaseClient.GetSyncMarkupInfoItemsAsync(_ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, _ViewInfo.UserID);
5422

    
5423

    
5424
        }
5425

    
5426
        private void PdfLink_ButtonDown(object sender, MouseButtonEventArgs e)
5427
        {
5428
            if (sender is Image)
5429
            {
5430
                if ((sender as Image).Tag != null)
5431
                {
5432
                    var pdfUrl = (sender as Image).Tag.ToString();
5433
                    System.Diagnostics.Process.Start(pdfUrl);
5434
                }
5435
                else
5436
                {
5437
                    this.ParentOfType<MainWindow>().DialogMessage_Alert("문서 정보가 잘못 되었습니다", "안내");
5438
                }
5439
            }
5440
        }
5441

    
5442
        private void Create_Symbol(object sender, RoutedEventArgs e)
5443
        {
5444
            MarkupToPDF.Controls.Parsing.LayerControl.MarkupReturn markupReturn = new MarkupToPDF.Controls.Parsing.LayerControl.MarkupReturn();
5445
            MarkupToPDF.Controls.Parsing.LayerControl layer = new MarkupToPDF.Controls.Parsing.LayerControl();
5446

    
5447
            if (SelectLayer.Children.Count < 1) //선택된 것이 없으면
5448
            {
5449
                DialogMessage_Alert("Please Select Controls", "Alert");
5450
            }
5451
            else //선택된 것이 있으면
5452
            {
5453
                string MarkupData = "";
5454
                adorner_ = new AdornerFinal();
5455

    
5456
                foreach (var item in SelectLayer.Children)
5457
                {
5458
                    if (item.GetType().Name == "AdornerFinal")
5459
                    {
5460
                        adorner_ = (item as Controls.AdornerFinal);
5461
                        foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
5462
                        {
5463
                            if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
5464
                            {
5465
                                markupReturn = layer.MarkupToString(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo, App.ViewInfo.UserID);
5466
                                MarkupData += markupReturn.ConvertData;
5467
                            }
5468
                        }
5469
                    }
5470
                }
5471
                DialogParameters parameters = new DialogParameters()
5472
                {
5473
                    Closed = (obj, args) => this.MarkupNamePromptClose(MarkupData, args),
5474
                    DefaultPromptResultValue = "Custom State",
5475
                    Content = "Name :",
5476
                    Header = "Insert Custom Symbol Name",
5477
                    Theme = new VisualStudio2013Theme(),
5478
                    ModalBackground = new SolidColorBrush { Color = Colors.Black, Opacity = 0.6 },
5479
                };
5480
                RadWindow.Prompt(parameters);
5481
            }
5482

    
5483
        }
5484

    
5485
        private void MarkupNamePromptClose(string data, WindowClosedEventArgs args)
5486
        {
5487
            Save save = new Save();
5488

    
5489
            if (args.DialogResult.Value)
5490
            {
5491
                PngBitmapEncoder _Encoder = symImage(data);
5492

    
5493
                System.IO.MemoryStream fs = new System.IO.MemoryStream();
5494
                _Encoder.Save(fs);
5495
                System.Drawing.Image ImgOut = System.Drawing.Image.FromStream(fs);
5496

    
5497
                byte[] Img_byte = fs.ToArray();
5498

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

    
5502
                save.SymbolSave(args.PromptResult, filename, data);
5503
            }
5504
        }
5505

    
5506
        public PngBitmapEncoder symImage(string data)
5507
        {
5508

    
5509
            Canvas _canvas = new Canvas();
5510
            _canvas.Background = Brushes.White;
5511
            _canvas.Width = adorner_.BorderSize.Width;
5512
            _canvas.Height = adorner_.BorderSize.Height;
5513
            layerControl.markupParse(data, _canvas, "#FFFF0000", "");
5514

    
5515
            BitmapEncoder encoder = new PngBitmapEncoder();
5516

    
5517

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

    
5520
            DrawingVisual dv = new DrawingVisual();
5521

    
5522
            _canvas.Measure(new System.Windows.Size(adorner_.BorderSize.Width + 50, adorner_.BorderSize.Height + 50));
5523
            //_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)));
5524
            _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)));
5525

    
5526
            using (DrawingContext ctx = dv.RenderOpen())
5527
            {
5528
                VisualBrush vb = new VisualBrush(_canvas);
5529
                //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)));
5530
                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)));
5531
            }
5532

    
5533
            try
5534
            {
5535
                renderBitmap.Render(dv);
5536

    
5537
                GC.Collect();
5538
                GC.WaitForPendingFinalizers();
5539
                GC.Collect();
5540
                //bitmap.Render(controlToConvert);
5541
                // encode png data
5542
                PngBitmapEncoder pngEncoder = new PngBitmapEncoder();
5543
                // puch rendered bitmap into it
5544
                pngEncoder.Interlace = PngInterlaceOption.Off;
5545
                pngEncoder.Frames.Add(BitmapFrame.Create(renderBitmap));
5546
                return pngEncoder;
5547

    
5548
            }
5549
            catch (Exception ex)
5550
            {
5551
                return null;
5552
            }
5553

    
5554
        }
5555

    
5556
        public void DialogMessage_Alert(string content, string header)
5557
        {
5558
            var box = new TextBlock();
5559
            box.MinWidth = 400;
5560
            box.FontSize = 11;
5561
            //box.FontSize = 12;
5562
            box.Text = content;
5563
            box.TextWrapping = System.Windows.TextWrapping.Wrap;
5564

    
5565
            DialogParameters parameters = new DialogParameters()
5566
            {
5567
                Content = box,
5568
                Header = header,
5569
                Theme = new VisualStudio2013Theme(),
5570
                ModalBackground = new SolidColorBrush { Color = Colors.Black, Opacity = 0.6 },
5571
            };
5572
            RadWindow.Alert(parameters);
5573
        }
5574

    
5575
        #region 캡쳐 기능
5576

    
5577
        public BitmapSource CutAreaToImage(int x, int y, int width, int height)
5578
        {
5579
            if (x < 0)
5580
            {
5581
                width += x;
5582
                x = 0;
5583
            }
5584
            if (y < 0)
5585
            {
5586
                height += y;
5587
                y = 0;
5588

    
5589
                width = (int)zoomAndPanCanvas.ActualWidth - x;
5590
            }
5591
            if (x + width > zoomAndPanCanvas.ActualWidth)
5592
            {
5593
                width = (int)zoomAndPanCanvas.ActualWidth - x;
5594
            }
5595
            if (y + height > zoomAndPanCanvas.ActualHeight)
5596
            {
5597
                height = (int)zoomAndPanCanvas.ActualHeight - y;
5598
            }
5599

    
5600
            byte[] pixels = CopyPixels(x, y, width, height);
5601

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

    
5604
            return BitmapSource.Create(width, height, 96, 96, PixelFormats.Pbgra32, null, pixels, stride);
5605
        }
5606

    
5607
        public byte[] CopyPixels(int x, int y, int width, int height)
5608
        {
5609
            byte[] pixels = new byte[width * height * 4];
5610
            int stride = (width * canvasImage.Format.BitsPerPixel + 7) / 8;
5611

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

    
5615
            return pixels;
5616
        }
5617

    
5618
        public RenderTargetBitmap ConverterBitmapImage(FrameworkElement element)
5619
        {
5620
            DrawingVisual drawingVisual = new DrawingVisual();
5621
            DrawingContext drawingContext = drawingVisual.RenderOpen();
5622

    
5623
            // 해당 객체의 그래픽요소로 사각형의 그림을 그립니다.
5624
            drawingContext.DrawRectangle(new VisualBrush(element), null,
5625
                new Rect(new Point(0, 0), new Point(element.ActualWidth, element.ActualHeight)));
5626
            drawingContext.Close();
5627

    
5628
            // 비트맵으로 변환합니다.
5629
            RenderTargetBitmap target =
5630
                new RenderTargetBitmap((int)element.ActualWidth, (int)element.ActualHeight,
5631
                96, 96, System.Windows.Media.PixelFormats.Pbgra32);
5632

    
5633
            target.Render(drawingVisual);
5634
            return target;
5635
        }
5636

    
5637
        public void Save_Capture(BitmapSource source, int x, int y, int width, int height)
5638
        {
5639
            KCOM.Common.Converter.FileStreamToBase64 streamToBase64 = new Common.Converter.FileStreamToBase64();
5640
            KCOMDataModel.DataModel.CHECK_LIST check_;
5641
            string Result = streamToBase64.ImageToBase64(source);
5642
            KCOMDataModel.DataModel.CHECK_LIST Item = new KCOMDataModel.DataModel.CHECK_LIST();
5643

    
5644
            using (KCOMDataModel.DataModel.CIEntities Entity = new KCOMDataModel.DataModel.CIEntities(KCOMDataModel.Common.ConnectStringBuilder.ProjectCIConnectString(App.ViewInfo.ProjectNO).ToString()))
5645
            {
5646
                Item = Entity.CHECK_LIST.Where(i => i.ID == ViewerDataModel.Instance.CheckList_ID).FirstOrDefault();
5647

    
5648
                //새로운 데이터 추가
5649
                if (Item == null)
5650
                {
5651
                    check_ = new KCOMDataModel.DataModel.CHECK_LIST
5652
                    {
5653
                        ID = Save.shortGuid(),
5654
                        USER_ID = App.ViewInfo.UserID,
5655
                        IMAGE_URL = Result,
5656
                        IMAGE_ANCHOR = x + "," + y + "," + width + "," + height,
5657
                        PAGENUMBER = this.pageNavigator.CurrentPage.PageNumber,
5658
                        REVISION = ViewerDataModel.Instance.SystemMain.dzMainMenu.CurrentDoc.Revision,
5659
                        DOCUMENT_ID = App.ViewInfo.DocumentItemID,
5660
                        PROJECT_NO = App.ViewInfo.ProjectNO,
5661
                        STATUS = "False",
5662
                        CREATE_TIME = DateTime.Now,
5663
                        UPDATE_TIME = DateTime.Now,
5664
                        DOCUMENT_NO = _DocItem.DOCUMENT_NO,
5665
                        STATUS_DESC_OPEN = "Vendor 반영 필요",
5666
                    };
5667

    
5668
                    Entity.CHECK_LIST.AddObject(check_);
5669
                }
5670
                //기존에 있던 데이터 업데이트
5671
                else
5672
                {
5673
                    Item.IMAGE_URL = Result;
5674
                    Item.IMAGE_ANCHOR = x + "," + y + "," + width + "," + height;
5675
                    Item.PAGENUMBER = this.pageNavigator.CurrentPage.PageNumber;
5676
                }
5677

    
5678
                //Item.REV_0 = "Test";
5679

    
5680
                try
5681
                {
5682
                    Entity.SaveChanges();
5683
                }
5684
                catch (Exception ex)
5685
                {
5686

    
5687
                }
5688
                //Entity.SaveChanges();
5689
            }
5690
        }
5691

    
5692
        public void Set_Capture()
5693
        {
5694
            //double x = Canvas.GetLeft(dragCaptureBorder);
5695
            //double y = Canvas.GetTop(dragCaptureBorder);
5696
            double x = canvasDrawingMouseDownPoint.X;
5697
            double y = canvasDrawingMouseDownPoint.Y;
5698
            double width = dragCaptureBorder.Width;
5699
            double height = dragCaptureBorder.Height;
5700

    
5701
            if (width > 5 || height > 5)
5702
            {
5703
                canvasImage = ConverterBitmapImage(zoomAndPanCanvas);
5704
                BitmapSource source = CutAreaToImage((int)x, (int)y, (int)width, (int)height);
5705
                Save_Capture(source, (int)x, (int)y, (int)width, (int)height);
5706
            }
5707
        }
5708
        #endregion
5709

    
5710
        public void CreateControl()
5711
        {
5712
            ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
5713
            {
5714
                ViewerDataModel.Instance.UndoDataList.Remove(i);
5715
            });
5716
            multi_Undo_Data.Markup = currentControl;
5717
            UndoData.Markup_List.Add(multi_Undo_Data);
5718
            ViewerDataModel.Instance.UndoDataList.Add(UndoData);
5719
        }
5720

    
5721
        public Multi_Undo_data Control_Style(CommentUserInfo control)
5722
        {
5723
            multi_Undo_Data = new Multi_Undo_data();
5724

    
5725
            multi_Undo_Data.Markup = control;
5726

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

    
5744
            return multi_Undo_Data;
5745
        }
5746

    
5747
        public void Undo()
5748
        {
5749
            Undo_data undo = new Undo_data();
5750
            AdornerFinal final;
5751
            ReleaseAdorner();
5752

    
5753
            undo = ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == false).ToList().OrderByDescending(order => order.EventTime).FirstOrDefault();
5754
            if (undo == null)
5755
                return;
5756

    
5757
            switch (undo.Event)
5758
            {
5759
                case (Event_Type.Create):
5760
                    {
5761
                        foreach (var item in undo.Markup_List)
5762
                        {
5763
                            ViewerDataModel.Instance.MarkupControls_USER.Remove((item.Markup));
5764
                        }
5765
                    }
5766
                    break;
5767
                case (Event_Type.Delete):
5768
                    {
5769
                        foreach (var item in undo.Markup_List)
5770
                        {
5771
                            ViewerDataModel.Instance.MarkupControls_USER.Add(item.Markup);
5772

    
5773
                            //final = new AdornerFinal(item.Markup);
5774
                            //SelectLayer.Children.Add(final);
5775
                        }
5776
                    }
5777
                    break;
5778
                case (Event_Type.Thumb):
5779
                    {
5780
                        List<CommentUserInfo> comment = new List<CommentUserInfo>();
5781

    
5782
                        foreach (var item in undo.Markup_List)
5783
                        {
5784
                            ViewerDataModel.Instance.MarkupControls_USER.Remove((item.Markup));
5785

    
5786
                            if ((item.Markup as IViewBox) != null)
5787
                            {
5788
                                (item.Markup as IViewBox).Angle = item.Angle;
5789
                            }
5790
                            if ((item.Markup as TextControl) != null)
5791
                            {
5792
                                (item.Markup as TextControl).Angle = item.Angle;
5793
                                Canvas.SetLeft((item.Markup as TextControl), item.PointSet[0].X);
5794
                                Canvas.SetTop((item.Markup as TextControl), item.PointSet[0].Y);
5795
                            }
5796
                            else
5797
                            {
5798
                                (item.Markup as IPath).PointSet = item.PointSet;
5799
                                (item.Markup as IPath).updateControl();
5800
                            }
5801

    
5802
                            comment.Add(item.Markup);
5803
                        }
5804
                        final = new AdornerFinal(comment);
5805
                        SelectLayer.Children.Add(final);
5806
                        ReleaseAdorner();
5807
                    }
5808
                    break;
5809
                case (Event_Type.Select):
5810
                    {
5811
                        ReleaseAdorner();
5812
                        List<CommentUserInfo> comment = new List<CommentUserInfo>();
5813

    
5814
                        foreach (var item in undo.Markup_List)
5815
                        {
5816
                            ViewerDataModel.Instance.MarkupControls_USER.Remove((item.Markup));
5817

    
5818
                            if ((item.Markup as IPath) != null)
5819
                            {
5820
                                (item.Markup as IPath).LineSize = item.LineSize;
5821
                            }
5822
                            if ((item.Markup as UIElement) != null)
5823
                            {
5824
                                (item.Markup as UIElement).Opacity = item.Opacity;
5825
                            }
5826
                            if ((item.Markup as IDashControl) != null)
5827
                            {
5828
                                (item.Markup as IDashControl).DashSize = item.DashSize;
5829
                            }
5830
                            if ((item.Markup as IShapeControl) != null)
5831
                            {
5832
                                (item.Markup as IShapeControl).Paint = item.paint;
5833
                            }
5834

    
5835
                            comment.Add(item.Markup);
5836
                        }
5837

    
5838
                        final = new AdornerFinal(comment);
5839
                        SelectLayer.Children.Add(final);
5840
                    }
5841
                    break;
5842
                case (Event_Type.Option):
5843
                    {
5844
                        List<CommentUserInfo> comment = new List<CommentUserInfo>();
5845

    
5846
                        foreach (var item in undo.Markup_List)
5847
                        {
5848
                            ViewerDataModel.Instance.MarkupControls_USER.Remove(item.Markup);
5849

    
5850
                            if (undo.LineSize != 0 && item.Markup as IPath != null)
5851
                            {
5852
                                (item.Markup as IPath).LineSize = undo.LineSize;
5853
                            }
5854
                            else if (undo.Opacity != 0 && item.Markup as UIElement != null)
5855
                            {
5856
                                (item.Markup as UIElement).Opacity = undo.Opacity;
5857
                            }
5858
                            else if (undo.DashSize != null && item.Markup as IDashControl != null)
5859
                            {
5860
                                (item.Markup as IDashControl).DashSize = undo.DashSize;
5861
                            }
5862
                            else if (undo.Interval != 0 && item.Markup as LineControl != null)
5863
                            {
5864
                                (item.Markup as LineControl).Interval = undo.Interval;
5865
                            }
5866
                            else if (item.Markup as IShapeControl != null)
5867
                            {
5868
                                (item.Markup as IShapeControl).Paint = undo.paint;
5869
                            }
5870
                            comment.Add(item.Markup);
5871
                        }
5872
                        final = new AdornerFinal(comment);
5873
                        SelectLayer.Children.Add(final);
5874
                    }
5875
                    break;
5876
            }
5877
            ViewerDataModel.Instance.UndoDataList.Where(data => data.EventTime == undo.EventTime).ToList().OrderByDescending(order => order.EventTime).ToList().ForEach(i =>
5878
           {
5879
               i.IsUndo = true;
5880
           });
5881
        }
5882

    
5883
        public void Redo()
5884
        {
5885
            AdornerFinal final;
5886
            Undo_data redo = new Undo_data();
5887
            redo = ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().OrderBy(order => order.EventTime).FirstOrDefault();
5888
            ReleaseAdorner();
5889
            if (redo == null)
5890
                return;
5891

    
5892
            switch (redo.Event)
5893
            {
5894
                case (Event_Type.Create):
5895
                    {
5896
                        foreach (var item in redo.Markup_List)
5897
                        {
5898
                            ViewerDataModel.Instance.MarkupControls_USER.Add(item.Markup);
5899
                        }
5900
                    }
5901
                    break;
5902
                case (Event_Type.Delete):
5903
                    {
5904
                        foreach (var item in redo.Markup_List)
5905
                        {
5906
                            ViewerDataModel.Instance.MarkupControls_USER.Remove(item.Markup);
5907
                        }
5908
                    }
5909
                    break;
5910
                case (Event_Type.Thumb):
5911
                    {
5912
                        List<CommentUserInfo> comment = new List<CommentUserInfo>();
5913

    
5914
                        foreach (var item in redo.Markup_List)
5915
                        {
5916
                            ViewerDataModel.Instance.MarkupControls_USER.Remove((item.Markup as CommentUserInfo));
5917

    
5918
                            if ((item.Markup as IViewBox) != null)
5919
                            {
5920
                                (item.Markup as IViewBox).Angle = item.Angle;
5921
                            }
5922
                            if ((item.Markup as TextControl) != null)
5923
                            {
5924
                                //(item.Markup as TextControl).CanvasX = item.PointSet[0].X;
5925
                                //(item.Markup as TextControl).CanvasY = item.PointSet[0].Y;
5926

    
5927
                                (item.Markup as TextControl).Angle = item.Angle;
5928

    
5929
                                Canvas.SetLeft((item.Markup as TextControl), item.PointSet[0].X);
5930
                                Canvas.SetTop((item.Markup as TextControl), item.PointSet[0].Y);
5931
                            }
5932
                            else
5933
                            {
5934
                                (item.Markup as IPath).PointSet = item.PointSet;
5935
                                (item.Markup as IPath).updateControl();
5936
                            }
5937
                            comment.Add(item.Markup);
5938
                        }
5939
                        final = new AdornerFinal(comment);
5940
                        SelectLayer.Children.Add(final);
5941
                        ReleaseAdorner();
5942
                    }
5943
                    break;
5944
                case (Event_Type.Select):
5945
                    {
5946
                        List<CommentUserInfo> comment = new List<CommentUserInfo>();
5947

    
5948
                        foreach (var item in redo.Markup_List)
5949
                        {
5950
                            ViewerDataModel.Instance.MarkupControls_USER.Remove(item.Markup);
5951

    
5952
                            if ((item.Markup as IPath) != null)
5953
                            {
5954
                                (item.Markup as IPath).LineSize = item.LineSize;
5955
                            }
5956
                            if ((item.Markup as UIElement) != null)
5957
                            {
5958
                                (item.Markup as UIElement).Opacity = item.Opacity;
5959
                            }
5960
                            if ((item.Markup as IDashControl) != null)
5961
                            {
5962
                                (item.Markup as IDashControl).DashSize = item.DashSize;
5963
                            }
5964
                            if ((item.Markup as IShapeControl) != null)
5965
                            {
5966
                                (item.Markup as IShapeControl).Paint = item.paint;
5967
                            }
5968

    
5969
                            comment.Add(item.Markup);
5970
                        }
5971
                        final = new AdornerFinal(comment);
5972
                        SelectLayer.Children.Add(final);
5973
                    }
5974
                    break;
5975
                case (Event_Type.Option):
5976
                    {
5977
                        List<CommentUserInfo> comment = new List<CommentUserInfo>();
5978

    
5979
                        foreach (var item in redo.Markup_List)
5980
                        {
5981
                            ViewerDataModel.Instance.MarkupControls_USER.Remove(item.Markup);
5982
                            if (redo.LineSize != 0 && item.Markup as IPath != null)
5983
                            {
5984
                                (item.Markup as IPath).LineSize = redo.LineSize;
5985
                            }
5986
                            else if (redo.Opacity != 0 && item.Markup as UIElement != null)
5987
                            {
5988
                                (item.Markup as UIElement).Opacity = redo.Opacity;
5989
                            }
5990
                            else if (redo.DashSize != null && item.Markup as IDashControl != null)
5991
                            {
5992
                                (item.Markup as IDashControl).DashSize = redo.DashSize;
5993
                            }
5994
                            else if(redo.Interval != 0 && item.Markup as LineControl != null)
5995
                            {
5996
                                (item.Markup as LineControl).Interval = redo.Interval;
5997
                            }
5998
                            else if (item.Markup as IShapeControl != null)
5999
                            {
6000
                                (item.Markup as IShapeControl).Paint = redo.paint;
6001
                            }
6002
                            comment.Add(item.Markup);
6003
                        }
6004
                        final = new AdornerFinal(comment);
6005
                        SelectLayer.Children.Add(final);
6006
                    }
6007
                    break;
6008
            }
6009

    
6010
            ViewerDataModel.Instance.UndoDataList.Where(data => data.EventTime == redo.EventTime).ToList().OrderByDescending(order => order.EventTime).ToList().ForEach(i =>
6011
            {
6012
                i.IsUndo = false;
6013
            });
6014
        }
6015

    
6016
        private void Comment_Move(object sender, MouseButtonEventArgs e)
6017
        {
6018
            string Select_ID = (((e.Source as Telerik.Windows.Controls.RadButton).DataContext) as IKCOM.MarkupInfoItem).UserID;
6019
            foreach (var items in ViewerDataModel.Instance._markupInfoRevList)
6020
            {
6021
                if (items.UserID == Select_ID)
6022
                {
6023
                    foreach (var item in items.MarkupList)
6024
                    {
6025
                        if (item.PageNumber == pageNavigator.CurrentPage.PageNumber)
6026
                        {
6027
                            layerControl.markupParseEx(item.Data, Common.ViewerDataModel.Instance.MarkupControls_USER, "#FFFF0000", "", items.MarkupInfoID, Save.shortGuid());
6028
                        }
6029
                    }
6030
                }
6031
            }
6032
        }
6033

    
6034
        public void InkControl_Convert()
6035
        {
6036
            if (inkBoard.Strokes.Count > 0)
6037
            {
6038
                inkBoard.Strokes.ToList().ForEach(stroke =>
6039
                {
6040
                    List<Stroke> removingStroke = new List<Stroke>();
6041
                    StrokeCollection stC = new StrokeCollection();
6042
                    //for (int i = 0; i <= inkBoard.Strokes.Count - 1; i++)
6043
                    //{
6044
                    //    removingStroke.Add(inkBoard.Strokes[i]);
6045
                    //}
6046

    
6047
                    removingStroke.Add(stroke);
6048

    
6049
                    InkToPath ip = new InkToPath();
6050
                    List<Point> inkPointSet = new List<Point>();
6051
                    PolygonControl pc = null;
6052
                    //InkControl pc = null;
6053
                    //pc = new InkControl()
6054
                    pc = new PolygonControl()
6055
                    {
6056
                        //PointC = new List<StylusPointSet>(),
6057
                        Angle = 0,
6058
                        PointSet = new List<Point>(),
6059
                        ControlType = ControlType.Ink
6060
                    };
6061
                    foreach (var item in removingStroke)
6062
                    {
6063
                        //pc.PointC.Add(new StylusPointSet() { pointSet = ip.StrokeGetPointsPlus(item) });
6064
                        inkPointSet.AddRange(ip.StrokeGetPointsPlus(item));
6065
                        inkBoard.Strokes.Remove(item);
6066
                    }
6067
                    if (inkPointSet.Count != 0)
6068
                    {
6069

    
6070
                        //강인구 추가(PenControl Undo Redo 추가)
6071
                        UndoData = new Undo_data()
6072
                        {
6073
                            IsUndo = false,
6074
                            Event = Event_Type.Create,
6075
                            EventTime = DateTime.Now,
6076
                            Markup_List = new List<Multi_Undo_data>()
6077
                        };
6078

    
6079
                        pc.StartPoint = inkPointSet[0];
6080
                        pc.EndPoint = inkPointSet[inkPointSet.Count - 1];
6081
                        pc.PointSet = inkPointSet;
6082
                        pc.LineSize = 3;
6083
                        pc.CommentID = Save.shortGuid();
6084
                        //pc.StrokeColor = new SolidColorBrush(MarkupToPDF.Controls.Common.ValueConverter.StringToColorConverter.Parse("ff18b7fc"));
6085
                        pc.StrokeColor = new SolidColorBrush(Colors.Red);
6086
                        ViewerDataModel.Instance.MarkupControls_USER.Add(pc);
6087
                        pc.SetPolyPath();
6088

    
6089
                        ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
6090
                        {
6091
                            ViewerDataModel.Instance.UndoDataList.Remove(i);
6092
                        });
6093
                        multi_Undo_Data.Markup = pc as CommentUserInfo;
6094
                        UndoData.Markup_List.Add(multi_Undo_Data);
6095
                        ViewerDataModel.Instance.UndoDataList.Add(UndoData);
6096
                    }
6097
                });
6098

    
6099
            }
6100
        }
6101
    }
6102
}
클립보드 이미지 추가 (최대 크기: 500 MB)