프로젝트

일반

사용자정보

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

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

이력 | 보기 | 이력해설 | 다운로드 (255 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
using System;
9
using System.Collections.Generic;
10
using System.Linq;
11
using System.Text;
12
using System.Windows;
13
using System.Windows.Controls;
14
using System.Windows.Data;
15
using System.Windows.Documents;
16
using System.Windows.Input;
17
using System.Windows.Media;
18
using System.Windows.Media.Imaging;
19
using System.Windows.Navigation;
20
using System.Windows.Shapes;
21
using KCOM.Common;
22
using IKCOM;
23
using System.Windows.Ink;
24
using System.Collections.ObjectModel;
25
using Telerik.Windows.Controls;
26
using KCOM.Events;
27
using System.Reflection;
28
using MarkupToPDF.Common;
29
using KCOM.Controls;
30
using KCOMDataModel.DataModel;
31
using System.Xml;
32
using static KCOM.TempFile;
33
using System.Windows.Threading;
34
using System.Diagnostics;
35
using System.Threading;
36
using System.Windows.Resources;
37
using Svg2Xaml;
38
using System.Runtime.InteropServices;
39
using System.Windows.Media.Effects;
40
using MarkupToPDF.Controls.Cad;
41
using MarkupToPDF.Controls.Parsing;
42
using Telerik.Windows.Data;
43
using System.ComponentModel;
44
using static KCOM.Controls.Sample;
45
using winform = System.Windows.Forms;
46
namespace KCOM.Views
47
{
48
    public static class ControlExtensions
49
    {
50
        public static T Clone<T>(this T controlToClone)
51
            where T : System.Windows.Controls.Control
52
        {
53
            System.Reflection.PropertyInfo[] controlProperties = typeof(T).GetProperties(System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance);
54

    
55
            T instance = Activator.CreateInstance<T>();
56

    
57
            foreach (PropertyInfo propInfo in controlProperties)
58
            {
59
                if (propInfo.CanWrite)
60
                {
61
                    if (propInfo.Name != "WindowTarget")
62
                        propInfo.SetValue(instance, propInfo.GetValue(controlToClone, null), null);
63
                }
64
            }
65
            return instance;
66
        }
67
    }
68

    
69
    public class MyConsole
70
    {
71
        private readonly System.Threading.ManualResetEvent _readLineSignal;
72
        private string _lastLine;
73
        public MyConsole()
74
        {
75
            _readLineSignal = new System.Threading.ManualResetEvent(false);
76
            Gui = new TextBox();
77
            Gui.AcceptsReturn = true;
78
            Gui.KeyUp += OnKeyUp;
79
        }
80

    
81
        private void OnKeyUp(object sender, KeyEventArgs e)
82
        {
83
            // this is always fired on UI thread
84
            if (e.Key == Key.Enter)
85
            {
86
                // quick and dirty, but that is not relevant to your question
87
                _lastLine = Gui.Text.Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries).Last();
88
                // now, when you detected that user typed a line, set signal
89
                _readLineSignal.Set();
90
            }
91
        }
92

    
93
        public TextBox Gui { get; private set; }
94

    
95
        public string ReadLine()
96
        {
97
            // that should always be called from non-ui thread
98
            if (Gui.Dispatcher.CheckAccess())
99
                throw new Exception("Cannot be called on UI thread");
100
            // reset signal
101
            _readLineSignal.Reset();
102
            // wait until signal is set. This call is blocking, but since we are on non-ui thread - there is no problem with that
103
            _readLineSignal.WaitOne();
104
            // we got signalled - return line user typed.
105
            return _lastLine;
106
        }
107

    
108
        public void WriteLine(string line)
109
        {
110
            if (!Gui.Dispatcher.CheckAccess())
111
            {
112
                Gui.Dispatcher.Invoke(new Action(() => WriteLine(line)));
113
                return;
114
            }
115

    
116
            Gui.Text += line + Environment.NewLine;
117
        }
118
    }
119

    
120
    /// <summary>
121
    /// MainMenu.xaml에 대한 상호 작용 논리
122
    /// </summary>
123
    public partial class MainMenu : UserControl
124
    {
125
        #region 프로퍼티
126
        public CommentUserInfo currentControl { get; set; }
127
        public ControlType controlType { get; set; }
128
        private Move move = new Move();
129
        private double[] rotateValue = { 0, 90, 180, 270 };
130
        public MouseHandlingMode mouseHandlingMode = MouseHandlingMode.None;
131
        private static readonly double DragThreshold = 5;
132
        private System.Windows.Input.Cursor cursor { get; set; }
133
        private Point canvasDrawingMouseDownPoint;
134
        public string filename { get; set; }
135
        private Point canvasZoomPanningMouseDownPoint;
136
        public Point getCurrentPoint;
137
        private Point canvasZoommovingMouseDownPoint;
138
        List<object> ControlList = new List<object>();
139
        private ListBox listBox = new ListBox();
140
        private Dictionary<Geometry, string> selected_item = new Dictionary<Geometry, string>();
141
        private bool isDraggingSelectionRect = false;
142
        DrawingAttributes inkDA = new DrawingAttributes();
143
        private VPRevision CurrentRev { get; set; }
144
        public RadRibbonButton btnConsolidate { get; set; }
145
        public RadRibbonButton btnFinalPDF { get; set; }
146
        public RadRibbonButton btnTeamConsolidate { get; set; }
147
        public RadRibbonButton btnConsolidateFinalPDF { get; set; }
148
        public RadRibbonButton btnAdjust { get; set; }
149

    
150
        public string Filename_ { get; set; }
151
        public double L_Size = 0;
152
        public AdornerFinal adorner_;
153
        public Multi_Undo_data multi_Undo_Data;
154
        public string Symbol_ID = "";
155
        /// <summary>
156
        /// Set to 'true' when the left mouse-button is down.
157
        /// </summary>
158
        public bool isLeftMouseButtonDownOnWindow = false;
159

    
160
        public InkPresenter _InkBoard = null;
161
        Stroke stroke;
162
        Boolean IsDrawing = false;
163
        StylusPointCollection strokePoints;
164
        //StylusPointCollection erasePoints;
165
        RenderTargetBitmap canvasImage;
166
        Point Sync_Offset_Point;
167

    
168
        //강인구 테스트
169
        private Path _SelectionPath { get; set; }
170
        public Path SelectionPath
171
        {
172
            get
173
            {
174
                return _SelectionPath;
175
            }
176
            set
177
            {
178
                if (_SelectionPath != value)
179
                {
180
                    _SelectionPath = value;
181
                    RaisePropertyChanged("SelectionPath");
182

    
183
                }
184
            }
185
        }
186

    
187
        private System.Windows.Controls.Image _imageViewer { get; set; }
188
        public System.Windows.Controls.Image imageViewer
189
        {
190
            get
191
            {
192
                if (_imageViewer == null)
193
                {
194
                    _imageViewer = new System.Windows.Controls.Image();
195
                    return _imageViewer;
196
                }
197
                else
198
                {
199
                    return _imageViewer;
200
                }
201
            }
202
            set
203
            {
204
                if (_imageViewer != value)
205
                {
206
                    _imageViewer = value;
207
                }
208
            }
209
        }
210

    
211
        public bool IsSyncPDFMode { get; set; }
212

    
213
        private System.Windows.Controls.Image _imageViewer_Compare { get; set; }
214
        public System.Windows.Controls.Image imageViewer_Compare
215
        {
216
            get
217
            {
218
                if (_imageViewer_Compare == null)
219
                {
220
                    _imageViewer_Compare = new System.Windows.Controls.Image();
221
                    return _imageViewer_Compare;
222
                }
223
                else
224
                {
225
                    return _imageViewer_Compare;
226
                }
227
            }
228
            set
229
            {
230
                if (_imageViewer_Compare != value)
231
                {
232
                    _imageViewer_Compare = value;
233
                }
234
            }
235
        }
236

    
237
        #endregion
238

    
239
        public MainMenu()
240
        {
241
            if (!App.IsDesignMode)
242
            {
243
                App.splashString(ISplashMessage.MAINMENU_0);
244
                //InitializeComponent();    
245
                this.Loaded += MainMenu_Loaded;
246
            }
247
        }
248

    
249
        public class TempDt
250
        {
251
            public int PageNumber { get; set; }
252
            public string CommentID { get; set; }
253
            public string ConvertData { get; set; }
254
            public int DATA_TYPE { get; set; }
255
            public string MarkupInfoID { get; set; }
256
            public int IsUpdate { get; set; }
257
        }
258

    
259
        List<TempDt> tempDtList = new List<TempDt>();
260

    
261
        private void SetCursor()
262
        {
263
            this.Cursor = cursor;
264
        }
265

    
266
        private bool IsDrawingEnable(Point _canvasZoomPanningMouseDownPoint)
267
        {
268
            if ((_canvasZoomPanningMouseDownPoint.X > 0 &&
269
                zoomAndPanCanvas.ActualWidth > _canvasZoomPanningMouseDownPoint.X) &&
270
                (_canvasZoomPanningMouseDownPoint.Y > 0 &&
271
                zoomAndPanCanvas.ActualHeight > _canvasZoomPanningMouseDownPoint.Y))
272
            {
273
                return true;
274
            }
275

    
276
            return false;
277
        }
278

    
279
        private bool IsRotationDrawingEnable(Point _canvasZoomPanningMouseDownPoint)
280
        {
281
            if (rotate.Angle == 90 || rotate.Angle == 270)
282
            {
283
                if ((_canvasZoomPanningMouseDownPoint.X > 0 &&
284
                zoomAndPanCanvas.ActualHeight > _canvasZoomPanningMouseDownPoint.X) &&
285
                (_canvasZoomPanningMouseDownPoint.Y > 0 &&
286
                zoomAndPanCanvas.ActualWidth > _canvasZoomPanningMouseDownPoint.Y))
287
                {
288
                    return true;
289
                }
290
            }
291
            else
292
            {
293
                if ((_canvasZoomPanningMouseDownPoint.X > 0 &&
294
                zoomAndPanCanvas.ActualWidth > _canvasZoomPanningMouseDownPoint.X) &&
295
                (_canvasZoomPanningMouseDownPoint.Y > 0 &&
296
                zoomAndPanCanvas.ActualHeight > _canvasZoomPanningMouseDownPoint.Y))
297
                {
298
                    return true;
299
                }
300
            }
301

    
302
            return false;
303
        }
304

    
305
        public void DeleteItem(MarkupInfoItem item)
306
        {
307
            if (PreviewUserMarkupInfoItem != null && item.Consolidate == 1 && item.AvoidConsolidate == 0)
308
            {
309
                App.Custom_ViewInfoId = PreviewUserMarkupInfoItem.MarkupInfoID;           }
310

    
311
            
312
            ViewerDataModel.Instance._markupInfoList.Remove(item);
313

    
314
            ViewerDataModel.Instance.MarkupControls.Where(data => data.MarkupInfoID == item.MarkupInfoID).ToList().ForEach(a =>
315
            {
316
                ViewerDataModel.Instance.MarkupControls.Remove(a);
317
            });
318

    
319
            ViewerDataModel.Instance.MarkupControls_USER.Where(data => data.MarkupInfoID == item.MarkupInfoID).ToList().ForEach(a =>
320
            {
321
                ViewerDataModel.Instance.MarkupControls_USER.Remove(a);
322
                ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.MarkupListUpdate(
323
                null, Event_Type.Delete, a.CommentID, null);
324
            });
325

    
326
            ViewerDataModel.Instance.MyMarkupList.Where(data => data.MarkupInfoID == item.MarkupInfoID).ToList().ForEach(a =>
327
            {
328
                ViewerDataModel.Instance.MyMarkupList.Remove(a);
329
                //임시파일에서도 삭제
330
                TempFile.DelTemp(a.ID, this.ParentOfType<MainWindow>().dzMainMenu.pageNavigator.CurrentPage.PageNumber.ToString());                
331
            });
332

    
333
            gridViewMarkup.ItemsSource = ViewerDataModel.Instance._markupInfoList;
334

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

    
366
        /// <summary>
367
        /// delete selected comments
368
        /// </summary>
369
        /// <param name="sender"></param>
370
        /// <param name="e"></param>
371
        public void DeleteCommentEvent(object sender, RoutedEventArgs e)
372
        {
373
            DialogParameters parameters = new DialogParameters()
374
            {
375
                Owner = Application.Current.MainWindow,
376
                Content = new TextBlock()
377
                { 
378
                    MinWidth = 400,
379
                    FontSize = 11,
380
                    Text = "정말 삭제 하시겠습니까?",
381
                    TextWrapping = System.Windows.TextWrapping.Wrap
382
                },
383
                Header = "Confirm",
384
                Theme = new VisualStudio2013Theme(),
385
                ModalBackground = new SolidColorBrush { Color = Colors.Black, Opacity = 0.6 },
386
                OkButtonContent = "Yes",
387
                CancelButtonContent = "No",
388
                Closed = delegate (object windowSender, WindowClosedEventArgs wc)
389
                {
390
                    if(wc.DialogResult == true)
391
                    {
392
                        //선택된 어도너가 있을시 삭제가 되지 않음
393
                        SelectionSet.Instance.UnSelect(this);
394

    
395
                        Button content = (sender as Button);
396
                        MarkupInfoItem item = content.CommandParameter as MarkupInfoItem;
397

    
398
                        DeleteItem(item);
399
                    }
400
                }
401
            };
402
            RadWindow.Confirm(parameters);
403
        }
404

    
405
        System.Windows.Media.Animation.DoubleAnimation da = new System.Windows.Media.Animation.DoubleAnimation();
406

    
407
        private static Timer timer;
408
        private int InitInterval = KCOM.Properties.Settings.Default.InitInterval;
409
        private void MainMenu_Loaded(object sender, RoutedEventArgs e)
410
        {
411
            InitializeComponent();            
412
            //System.Diagnostics.Debug.WriteLine("MainMenu() : " + sw.ElapsedMilliseconds.ToString() + "ms");
413

    
414
            if (App.ParameterMode)
415
            {
416
                App.splashString(ISplashMessage.MAINMENU_1);
417
                this.pageNavigator.PageChanging += pageNavigator_PageChanging;
418
                this.pageNavigator.PageChanged += PageNavigator_PageChanged;
419
                imageViewer_Compare = new Image();
420
                ViewerDataModel.Instance.Capture_Opacity = 0;
421
                da.From = 0.8;
422
                da.To = 0;
423
                da.Duration = new Duration(TimeSpan.FromSeconds(1));
424
                da.AutoReverse = true;
425
                da.RepeatBehavior = System.Windows.Media.Animation.RepeatBehavior.Forever;
426

    
427
                if (!App.ViewInfo.CreateFinalPDFPermission && !App.ViewInfo.NewCommentPermission)
428
                {
429
                    this.SymbolPane.Visibility = Visibility.Collapsed;
430
                    this.FavoritePane.Visibility = Visibility.Collapsed;
431
                    this.drawingRotateCanvas.IsHitTestVisible = false;
432
                }
433
                thumbnailPanel.Width = Convert.ToInt32(CommonLib.Common.GetConfigString("SetThumbnail", "WIDTH", "250"));
434
            }
435
            timer = new Timer(timercallback, null, 0, InitInterval * 60000);
436
        }
437

    
438
        
439

    
440
        private void timercallback(Object o)
441
        {
442
            Stopwatch sw = new Stopwatch();
443
            sw.Start();
444
            TempFile.TempFileAdd();
445
            sw.Stop();
446

    
447
            Dispatcher.InvokeAsync(new Action(delegate
448
            {
449
               if (this.ParentOfType<MainWindow>().dzTopMenu.cbAutoSave.IsChecked == true) //Auto Save Checked?
450
                {
451
                    timer.Change(((int)this.ParentOfType<MainWindow>().dzTopMenu.cbSaveInterval.Value * 60000) / 2, sw.ElapsedMilliseconds); //Timer Setting
452
                }
453
            }));
454

    
455
            ////GC.Collect();
456
        }
457
        
458
        /// <summary>
459
        /// update my markuplist
460
        ///  - update existing markup data if already exist
461
        ///  - add new markup data if control is new
462
        /// </summary>
463
        public void UpdateMyMarkupList()
464
        {
465
            Logger.sendCheckLog("pageNavigator_PageChanging_ChangeCommentReact", 1);
466

    
467
            /// add or update markup list
468
            foreach (var control in ViewerDataModel.Instance.MarkupControls_USER)
469
            {
470
                var root = MarkupParser.MarkupToString(control, App.ViewInfo.UserID);
471

    
472
                var exist = ViewerDataModel.Instance.MyMarkupList.Where(data => data.ID == root.CommentID).FirstOrDefault();
473
                if (exist != null) //신규 추가 된 코멘트
474
                {
475
                    if (exist.Data != root.ConvertData) //코멘트가 같은지
476
                    {
477
                        exist.Data = root.ConvertData;
478
                        exist.IsUpdate = true;
479
                    }
480
                }
481
                else if (root.CommentID != null)
482
                {
483
                    ViewerDataModel.Instance.MyMarkupList.Add(new MarkupItemEx
484
                    {
485
                        ID = control.CommentID,
486
                        Data = root.ConvertData,
487
                        Data_Type = root.DATA_TYPE,
488
                        MarkupInfoID = App.Custom_ViewInfoId,
489
                        PageNumber = this.pageNavigator.CurrentPage.PageNumber,
490
                        Symbol_ID = control.SymbolID,
491
                        //Group_ID = control.GroupID,
492
                    });
493
                }
494
            }
495

    
496
            /// delete markup list
497
            int iPageNo = this.pageNavigator.CurrentPage.PageNumber;
498
            var deleted = (from markup in ViewerDataModel.Instance.MyMarkupList
499
                          where (markup.PageNumber == iPageNo) && (null == ViewerDataModel.Instance.MarkupControls_USER.Where(control => control.CommentID == markup.ID).FirstOrDefault())
500
                          select markup).ToList();
501
            foreach(var markup in deleted) ViewerDataModel.Instance.MyMarkupList.Remove(markup);
502
            /// up to here
503

    
504
            //if (modified)
505
            //{
506
            //    if (ViewerDataModel.Instance._markupInfoList.Where(info => info.UserID == PreviewUserMarkupInfoItem.UserID).FirstOrDefault() == null)
507
            //    {
508
            //        ComingNewBieEnd = true;
509
            //        ViewerDataModel.Instance._markupInfoList.Insert(0, PreviewUserMarkupInfoItem);
510
            //        PreviewUserMarkupInfoItem.IsPreviewUser = false;
511
            //        gridViewMarkup.ItemsSource = null;
512
            //        gridViewMarkup.ItemsSource = ViewerDataModel.Instance._markupInfoList;
513
            //        gridViewMarkup.SelectedItem = PreviewUserMarkupInfoItem;
514

    
515
            //        GroupDescriptor descriptor = new GroupDescriptor();
516
            //        descriptor.Member = "Depatment";
517
            //        descriptor.DisplayContent = "DEPT";
518
            //        descriptor.SortDirection = ListSortDirection.Ascending;
519
            //        gridViewMarkup.GroupDescriptors.Add(descriptor);
520
            //    }
521
            //}
522
        }
523

    
524
        DispatcherTimer renderTesttimer;
525

    
526
        /// <summary>
527
        /// start page changing
528
        ///  - save controls if page is modified
529
        ///  - starting download page image
530
        /// </summary>
531
        /// <param name="sender"></param>
532
        /// <param name="e"></param>
533
        private async void pageNavigator_PageChanging(object sender, Controls.Sample.PageChangeEventArgs e)
534
        {
535
            CompareMode.IsChecked = false;
536
            var BalancePoint = ViewerDataModel.Instance.PageBalanceMode == true ? e.PageNumber + ViewerDataModel.Instance.PageBalanceNumber : e.PageNumber;
537

    
538
            #region 페이지가 벗어난 경우
539

    
540
            if (BalancePoint < 1)
541
            {
542
                BalancePoint = 1;
543
                ViewerDataModel.Instance.PageBalanceNumber = 0;
544
            }
545

    
546
            if (pageNavigator.PageCount < BalancePoint)
547
            {
548
                BalancePoint = pageNavigator.PageCount;
549
                ViewerDataModel.Instance.PageBalanceNumber = 0;
550
            }
551

    
552
            #endregion
553

    
554
            ViewerDataModel.Instance.PageNumber = BalancePoint;
555

    
556
            var pageWidth = Convert.ToDouble(e.CurrentPage.PAGE_WIDTH);
557
            var pageHeight = Convert.ToDouble(e.CurrentPage.PAGE_HEIGHT);
558
            var pageUri = pageNavigator.CurrentPage.PageUri;
559
            var contentScale = zoomAndPanControl.ContentScale;
560

    
561
            #region 페이지 이미지 로딩 수정
562

    
563
            // ViewerDataModel.Instance.ImageViewPath = await ImageSourceHelper.GetDownloadImageAsync(pageUri, pageWidth * contentScale, pageHeight * contentScale);
564
            try
565
            {
566
                ViewerDataModel.Instance.ImageViewPath = await ImageSourceHelper.GetDownloadImageAsync(pageUri, pageWidth, pageHeight);
567

    
568
            }
569
            catch (Exception ex)
570
            {
571
                ViewerDataModel.Instance.ImageViewPath = null;
572
                string imgfailedmsg = string.Format(CommonLib.Common.GetAlertMessageString("GetImageResourceFailed", "MSG", "해당 문서의 {0} Page Convert가 정상적이지 않습니다. 관리자에게 문의해 주세요."), pageNavigator.CurrentPage.PageNumber);                
573
                DialogMessage_Alert(imgfailedmsg, "Warning");
574
                App.FileLogger.Fatal(ex);
575
            }
576
            ScaleImage(pageWidth, pageHeight);
577

    
578
            ViewerDataModel.Instance.ImageViewWidth = pageWidth;
579
            ViewerDataModel.Instance.ImageViewHeight = pageHeight;
580

    
581
            zoomAndPanCanvas.Width = pageWidth;
582
            zoomAndPanCanvas.Height = pageHeight;
583

    
584
            Common.ViewerDataModel.Instance.ContentWidth = pageWidth;
585
            Common.ViewerDataModel.Instance.ContentHeight = pageHeight;
586

    
587
            inkBoard.Width = pageWidth;
588
            inkBoard.Height = pageHeight;
589

    
590
            #endregion
591

    
592
            if (!testPanel2.IsHidden)
593
            {
594
                Logger.sendCheckLog("pageNavigator_PageChanging_!testPanel2.IsHidden 일 때", 1);
595
                //PDF모드일때 잠시 대기(강인구)
596
                if (IsSyncPDFMode)
597
                {
598
                    Get_FinalImage.Get_PdfImage get_PdfImage = new Get_FinalImage.Get_PdfImage();
599
                    var pdfpath = new BitmapImage(new Uri(get_PdfImage.Run(CurrentRev.TO_VENDOR, App.ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, ViewerDataModel.Instance.PageNumber)));
600

    
601
                    Logger.sendCheckLog("pageNavigator_PageChanging_pdfpath Image Downloading", 1);
602
                    if (pdfpath.IsDownloading)
603
                    {
604
                        pdfpath.DownloadCompleted += (ex, arg) =>
605
                        {
606
                            Logger.sendCheckLog("pageNavigator_PageChanging_pdfpath Image DownloadCompleted", 1);
607
                            ViewerDataModel.Instance.ImageViewPath_C = pdfpath;
608
                            ViewerDataModel.Instance.ImageViewWidth_C = pdfpath.PixelWidth;
609
                            ViewerDataModel.Instance.ImageViewHeight_C = pdfpath.PixelHeight;
610
                            zoomAndPanCanvas2.Width = pdfpath.PixelWidth;
611
                            zoomAndPanCanvas2.Height = pdfpath.PixelHeight;
612
                        };
613
                    }
614
                    else
615
                    {
616
                        Logger.sendCheckLog("pageNavigator_PageChanging_pdfpath Image Page Setting", 1);
617
                        ViewerDataModel.Instance.ImageViewPath_C = pdfpath;
618
                        ViewerDataModel.Instance.ImageViewWidth_C = pdfpath.PixelWidth;
619
                        ViewerDataModel.Instance.ImageViewHeight_C = pdfpath.PixelHeight;
620

    
621
                        zoomAndPanCanvas2.Width = pdfpath.PixelWidth;
622
                        zoomAndPanCanvas2.Height = pdfpath.PixelHeight;
623
                    }
624
                }
625
                else
626
                {
627
                    Logger.sendCheckLog("pageNavigator_PageChanging_uri2 값 설정", 1);
628
                    string uri2 = "";
629
                    if (userData.COMPANY != "EXT")
630
                    {
631
                        uri2 = String.Format(CommonLib.Common.GetConfigString("mainServerImageWebPath", "URL", "", App.isExternal), _ViewInfo.ProjectNO, (Convert.ToUInt32(CurrentRev.DOCUMENT_ID) / 100).ToString(), CurrentRev.DOCUMENT_ID, BalancePoint);
632
                    }
633
                    else
634
                    {
635
                        uri2 = String.Format(CommonLib.Common.GetConfigString("subServerImageWebPath", "URL", "", App.isExternal), _ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, BalancePoint);
636
                    }
637

    
638
                    Logger.sendCheckLog("pageNavigator_PageChanging_defaultBitmapImage_Compare BitmapImage 설정", 1);
639
                    var defaultBitmapImage_Compare = new BitmapImage();
640
                    defaultBitmapImage_Compare.BeginInit();
641
                    defaultBitmapImage_Compare.CreateOptions = BitmapCreateOptions.IgnoreImageCache;
642
                    defaultBitmapImage_Compare.CacheOption = BitmapCacheOption.OnLoad;
643
                    defaultBitmapImage_Compare.UriSource = new Uri(uri2);
644
                    //defaultBitmapImage_Compare.DecodePixelWidth = Int32.Parse(e.CurrentPage.PAGE_WIDTH);
645
                    //defaultBitmapImage_Compare.DecodePixelHeight = Int32.Parse(e.CurrentPage.PAGE_HEIGHT);
646
                    defaultBitmapImage_Compare.EndInit();
647

    
648
                    ViewerDataModel.Instance.ImageViewPath_C = null;                    
649

    
650
                    Logger.sendCheckLog("pageNavigator_PageChanging_zoomAndPanControl ZoomTo 설정", 1);
651
                    zoomAndPanControl.ZoomTo(new Rect
652
                    {
653
                        X = 0,
654
                        Y = 0,
655
                        Width = Math.Max(zoomAndPanCanvas.Width, zoomAndPanCanvas2.Width),
656
                        Height = Math.Max(zoomAndPanCanvas.Height, zoomAndPanCanvas2.Height),
657
                    });
658

    
659
                    Logger.sendCheckLog("pageNavigator_PageChanging_defaultBitmapImage_Compare Downloading", 1);
660
                    if (defaultBitmapImage_Compare.IsDownloading)
661
                    {
662
                        defaultBitmapImage_Compare.DownloadCompleted += (ex, arg) =>
663
                        {
664
                            defaultBitmapImage_Compare.Freeze();
665
                            ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare;
666
                            ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth;
667
                            ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight;
668
                            ComparePanel.UpdateLayout();
669
                            zoomAndPanCanvas2.Width = defaultBitmapImage_Compare.PixelWidth;
670
                            zoomAndPanCanvas2.Height = defaultBitmapImage_Compare.PixelHeight;
671

    
672
                            zoomAndPanControl.ZoomTo(new Rect
673
                            {
674
                                X = 0,
675
                                Y = 0,
676
                                Width = Math.Max(zoomAndPanCanvas.Width, zoomAndPanCanvas2.Width),
677
                                Height = Math.Max(zoomAndPanCanvas.Height, zoomAndPanCanvas2.Height),
678
                            });
679

    
680
                            //defaultBitmapImage_Compare dispose
681
                            defaultBitmapImage_Compare = null;
682
                            GC.Collect();
683
                        };
684
                    }
685
                }
686
                tlSyncPageNum.Text = String.Format("Current Page : {0}", BalancePoint);
687
            }
688

    
689
            this.pageNavigator.ChangePage(e.PageNumber);
690
        }
691

    
692
        /// <summary>
693
        /// called after page is changed
694
        /// </summary>
695
        /// <param name="sender"></param>
696
        /// <param name="e"></param>
697
        private void PageNavigator_PageChanged(object sender, Sample.PageChangeEventArgs e)
698
        {
699
            if (zoomAndPanCanvas2.Width.IsNaN())
700
            {
701
                zoomAndPanControl.ZoomTo(new Rect { X = 0, Y = 0, Width = zoomAndPanCanvas.Width, Height = zoomAndPanCanvas.Height });
702
            }
703

    
704
            /// 컨트롤을 새로 생성한다.
705
            Common.ViewerDataModel.Instance.MarkupControls_USER.Clear();    //전체 제거
706
            Common.ViewerDataModel.Instance.MarkupControls.Clear();         //전체 제거
707
            foreach (var markup in ViewerDataModel.Instance.MyMarkupList.Where(param => param.PageNumber == ViewerDataModel.Instance.PageNumber))
708
            {
709
                var info = ViewerDataModel.Instance._markupInfoList.Where(param => param.MarkupInfoID == markup.MarkupInfoID).FirstOrDefault();
710
                if (info != null)
711
                {
712
                    string sColor = (info.UserID == App.ViewInfo.UserID) ? "#FFFF0000" : info.DisplayColor;
713
                    if (info.UserID == App.ViewInfo.UserID)
714
                    {
715
                        var control = MarkupParser.ParseEx(App.ViewInfo.ProjectNO, markup.Data, Common.ViewerDataModel.Instance.MarkupControls_USER, sColor, "",
716
                                        markup.MarkupInfoID, markup.ID);
717
                        control.Visibility = Visibility.Hidden;
718
                    }
719
                    else
720
                    {
721
                        var control = MarkupParser.ParseEx(App.ViewInfo.ProjectNO, markup.Data, Common.ViewerDataModel.Instance.MarkupControls, sColor, "",
722
                                                                markup.MarkupInfoID, markup.ID);
723
                        control.Visibility = Visibility.Hidden;
724
                    }
725
                }
726
            };
727
            /// up to here
728

    
729
            /// fire selection event
730
            List<MarkupInfoItem> gridSelectionItem = gridViewMarkup.SelectedItems.Cast<MarkupInfoItem>().ToList(); //선택 된 마크업
731
            this.gridViewMarkup.UnselectAll();
732
            this.gridViewMarkup.Select(gridSelectionItem);
733

    
734
            if (!testPanel2.IsHidden)
735
            {
736
                ViewerDataModel.Instance.Sync_ContentOffsetX = zoomAndPanControl.ContentOffsetX;
737
                ViewerDataModel.Instance.Sync_ContentOffsetY = zoomAndPanControl.ContentOffsetY;
738
                ViewerDataModel.Instance.Sync_ContentScale = zoomAndPanControl.ContentScale;
739

    
740
                Common.ViewerDataModel.Instance.MarkupControls_Sync.Clear();
741
                List<MarkupInfoItem> gridSelectionRevItem = gridViewRevMarkup.SelectedItems.Cast<MarkupInfoItem>().ToList();
742

    
743

    
744
                foreach (var item in gridSelectionRevItem)
745
                {
746
                    item.MarkupList.Where(pageItem => pageItem.PageNumber == ViewerDataModel.Instance.PageNumber).ToList().ForEach(delegate (MarkupItem markupitem)
747
                    {
748
                        MarkupParser.ParseEx(App.ViewInfo.ProjectNO, markupitem.Data, Common.ViewerDataModel.Instance.MarkupControls_Sync, item.DisplayColor, "", item.MarkupInfoID);
749
                    });
750
                }
751
            }
752

    
753
            var instanceMain = this.ParentOfType<MainWindow>();
754
            instanceMain.dzTopMenu.tlcurrentPage.Text = e.CurrentPage.PAGE_NUMBER.ToString();
755
            instanceMain.dzTopMenu.tlcurrentPage_readonly.Text = e.CurrentPage.PAGE_NUMBER.ToString();
756

    
757
            instanceMain.dzTopMenu.rotateOffSet = 0;
758
            var pageinfo = this.CurrentDoc.docInfo.DOCPAGE.Where(p => p.PAGE_NUMBER == e.CurrentPage.PAGE_NUMBER).FirstOrDefault();
759
            drawingPannelRotate(pageinfo.PAGE_ANGLE);
760

    
761
            SetCommentPages(true);
762
        }
763

    
764
        public void SetCommentPages(bool onlyMe = false)
765
        {
766
            Logger.sendCheckLog("pageNavigator_PageChanging_SetCommentPages Setting", 1);
767
            List<UsersCommentPagesMember> _pages = new List<UsersCommentPagesMember>();
768
            foreach (var item in ViewerDataModel.Instance._markupInfoList)
769
            {
770
                //Comment 가 존재할 경우에만 Thumbnail 에 추가
771
                if(item.MarkupList != null)
772
                {
773
                    UsersCommentPagesMember instance = new UsersCommentPagesMember();
774
                    instance.UserName = item.UserName;
775
                    instance.Depart = item.Depatment;
776
                    instance.MarkupInfoID = item.MarkupInfoID;
777
                    instance.IsSelected = true;
778
                    instance.isConSolidation = item.Consolidate;
779
                    instance.SetColor = item.DisplayColor;
780
                    if (item.UserID == App.ViewInfo.UserID && item.MarkupInfoID == item.MarkupInfoID)
781
                    {
782
                        instance.PageNumber = ViewerDataModel.Instance.MyMarkupList.Select(d => d.PageNumber).ToList();
783
                    }
784
                    else
785
                    {
786
                        instance.PageNumber = ViewerDataModel.Instance.MarkupList_Pre.Where(data => data.MarkupInfoID == item.MarkupInfoID).Select(d => d.PageNumber).ToList();
787
                    }
788
                    _pages.Add(instance);
789
                }                   
790
            }
791
            
792
            this.pageNavigator.SetCommentList(_pages.ToList());
793

    
794
        }
795

    
796
        public void MarkupitemViewUpdate(string markupinfo_id)
797
        {
798
            //db에 업데이트 한 list 를 view 에 업데이트
799
            string sDocID = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu._DocInfo.ID;
800
            List<MarkupInfoItem> results = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.GetMarkupInfoItems(App.ViewInfo.ProjectNO, sDocID);
801
            MarkupInfoItem dbinfo = results.Where(x => x.MarkupInfoID == markupinfo_id).FirstOrDefault();
802
            MarkupInfoItem viewinfo = Common.ViewerDataModel.Instance._markupInfoList.Where(x => x.MarkupInfoID == markupinfo_id).FirstOrDefault();
803
            if (dbinfo.MarkupList.Count > 0)
804
            {
805
                if (viewinfo.MarkupList != null)
806
                {
807
                    viewinfo.MarkupList.Clear();
808
                    viewinfo.MarkupList = null;
809
                }
810
                viewinfo.MarkupList = new List<MarkupItem>();
811
                foreach (var item in dbinfo.MarkupList)
812
                {
813
                    viewinfo.MarkupList.Add(item);
814
                }
815
            }
816
        }
817

    
818
        private void zoomAndPanControl_MouseWheel(object sender, MouseWheelEventArgs e)
819
        {
820
            if (e.MiddleButton == MouseButtonState.Pressed)
821
            {
822

    
823
            }
824
            e.Handled = true;
825
            if (e.Delta > 0)
826
            {
827
                Point currentContentMousePoint = e.GetPosition(zoomAndPanCanvas);
828
                System.Diagnostics.Debug.WriteLine($"Zoom : {currentContentMousePoint.X} {currentContentMousePoint.Y}");
829
                ZoomIn(currentContentMousePoint);
830
            }
831
            else
832
            {
833
                Point currentContentMousePoint = e.GetPosition(zoomAndPanCanvas);
834
                System.Diagnostics.Debug.WriteLine($"Zoom : {currentContentMousePoint.X} {currentContentMousePoint.Y}");
835
                ZoomOut(currentContentMousePoint);
836
            }
837
        }
838

    
839
        private void zoomAndPanControl2_MouseWheel(object sender, MouseWheelEventArgs e)
840
        {
841
            e.Handled = true;
842
            if (e.Delta > 0)
843
            {
844
                Point currentContentMousePoint = e.GetPosition(zoomAndPanCanvas2);
845
                ZoomIn_Sync(currentContentMousePoint);
846
            }
847
            else
848
            {
849
                Point currentContentMousePoint = e.GetPosition(zoomAndPanCanvas2);
850
                ZoomOut_Sync(currentContentMousePoint);
851
            }
852
        }
853

    
854
        #region ZoomIn & ZoomOut
855

    
856
        private void ZoomOut_Executed(object sender, ExecutedRoutedEventArgs e)
857
        {
858
            ZoomOut(new Point(zoomAndPanControl.ContentZoomFocusX,
859
                zoomAndPanControl.ContentZoomFocusY));
860
        }
861

    
862
        private void ZoomIn_Executed(object sender, ExecutedRoutedEventArgs e)
863
        {
864
            ZoomIn(new Point(zoomAndPanControl.ContentZoomFocusX,
865
                zoomAndPanControl.ContentZoomFocusY));
866
        }
867

    
868

    
869
        //강인구 추가 (줌 인아웃 수치 변경)
870
        //큰해상도의 문서일 경우 줌 인 아웃시 사이즈 변동이 큼
871
        private void ZoomOut(Point contentZoomCenter)
872
        {
873
            if (zoomAndPanControl.ContentScale > 0.39)
874
            {
875
                zoomAndPanControl.ZoomAboutPoint(zoomAndPanControl.ContentScale - 0.2, contentZoomCenter);
876
            }
877
            else
878
            {
879
                zoomAndPanControl.ZoomAboutPoint(zoomAndPanControl.ContentScale / 2, contentZoomCenter);
880
            }
881

    
882
            if (zoomAndPanControl2 != null && Sync.IsChecked)
883
            {
884
                zoomAndPanControl2.ZoomAboutPoint(zoomAndPanControl.ContentScale, contentZoomCenter);
885
            }
886
        }
887

    
888
        private void ZoomIn(Point contentZoomCenter)
889
        {
890
            if (zoomAndPanControl.ContentScale > 0.19)
891
            {
892
                zoomAndPanControl.ZoomAboutPoint(zoomAndPanControl.ContentScale + 0.2, contentZoomCenter);
893
            }
894
            else
895
            {
896
                zoomAndPanControl.ZoomAboutPoint(zoomAndPanControl.ContentScale * 2, contentZoomCenter);
897
            }
898

    
899
            if (zoomAndPanControl2 != null && Sync.IsChecked)
900
            {
901
                zoomAndPanControl2.ZoomAboutPoint(zoomAndPanControl.ContentScale, contentZoomCenter);
902
            }
903

    
904
        }
905

    
906
        private void ZoomOut_Sync(Point contentZoomCenter)
907
        {
908
            if (zoomAndPanControl2.ContentScale > 0.39)
909
            {
910
                zoomAndPanControl2.ZoomAboutPoint(zoomAndPanControl2.ContentScale - 0.2, contentZoomCenter);
911
            }
912
            else
913
            {
914
                zoomAndPanControl2.ZoomAboutPoint(zoomAndPanControl2.ContentScale / 2, contentZoomCenter);
915
            }
916

    
917
            if (Sync.IsChecked)
918
            {
919
                zoomAndPanControl.ZoomAboutPoint(zoomAndPanControl2.ContentScale, contentZoomCenter);
920
            }
921
        }
922

    
923
        private void ZoomIn_Sync(Point contentZoomCenter)
924
        {
925
            if (zoomAndPanControl2.ContentScale > 0.19)
926
            {
927
                zoomAndPanControl2.ZoomAboutPoint(zoomAndPanControl2.ContentScale + 0.2, contentZoomCenter);
928
            }
929
            else
930
            {
931
                zoomAndPanControl2.ZoomAboutPoint(zoomAndPanControl2.ContentScale * 2, contentZoomCenter);
932
            }
933

    
934
            if (Sync.IsChecked)
935
            {
936
                zoomAndPanControl.ZoomAboutPoint(zoomAndPanControl2.ContentScale, contentZoomCenter);
937
            }
938
        }
939

    
940
        private void ZoomOut()
941
        {
942
            zoomAndPanControl.ContentScale -= 0.1;
943
            //if (zoomAndPanControl2 != null)
944
            //{
945
            //    zoomAndPanControl2.ContentScale -= 0.1;
946
            //}
947
        }
948

    
949
        private void ZoomIn()
950
        {
951
            zoomAndPanControl.ContentScale += 0.1;
952
            //if (zoomAndPanControl2 != null)
953
            //{
954
            //    zoomAndPanControl2.ContentScale += 0.1;
955
            //}
956
        }
957

    
958
        #endregion
959

    
960
        private void init()
961
        {
962
            foreach (var item in ViewerDataModel.Instance.MarkupControls)
963
            {
964

    
965
                ControlList.Clear();
966
                listBox.Items.Clear();
967
                selected_item.Clear();
968

    
969
                (item as IMarkupCommonData).IsSelected = false;
970
            }
971

    
972
        }
973

    
974
        private HitTestResultBehavior MyCallback(HitTestResult result)
975
        {
976
            //this.cursor = Cursors.UpArrow;
977
            var element = result.VisualHit;
978
            while (element != null && !(element is CommentUserInfo))
979
                element = VisualTreeHelper.GetParent(element);
980

    
981
            if (element == null)
982
            {
983
                return HitTestResultBehavior.Stop;
984
            }
985
            else
986
            {
987
                if (element is CommentUserInfo)
988
                {
989
                    if (!hitList.Contains(element))
990
                    {
991
                        hitList.Add((CommentUserInfo)element);
992
                    }
993
                    else
994
                    {
995
                        return HitTestResultBehavior.Stop;
996
                    }
997
                }
998
            }
999
            return HitTestResultBehavior.Continue;
1000
        }
1001

    
1002
        public void ReleaseSelectPath()
1003
        {
1004
            if (SelectionPath == null)
1005
            {
1006
                SelectionPath = new Path();
1007
                SelectionPath.Name = "";
1008
            }
1009
            if (SelectionPath.Name != "")
1010
            {
1011
                SelectionPath.Name = "None";
1012
            }
1013
            SelectionPath.Opacity = 0.01;
1014
            SelectionPath.RenderTransform = null;
1015
            SelectionPath.RenderTransformOrigin = new Point(0, 0);
1016
        }
1017

    
1018
        #region 컨트롤 초기화 
1019
        public void Control_Init(object control)
1020
        {
1021
            if (L_Size != 0 && (control as IPath) != null)
1022
            {
1023
                (control as IPath).LineSize = L_Size;
1024
                L_Size = 0;
1025
            }
1026

    
1027
            switch (control.GetType().Name)
1028
            {
1029
                case "RectangleControl":
1030
                    {
1031
                        (control as RectangleControl).StrokeColor = Brushes.Red;
1032
                    }
1033
                    break;
1034
                case "CircleControl":
1035
                    {
1036
                        (control as CircleControl).StrokeColor = Brushes.Red;
1037
                    }
1038
                    break;
1039
                case "TriControl":
1040
                    {
1041
                        (control as TriControl).StrokeColor = Brushes.Red;
1042
                    }
1043
                    break;
1044
                case "RectCloudControl":
1045
                    {
1046
                        (control as RectCloudControl).StrokeColor = Brushes.Red;
1047
                    }
1048
                    break;
1049
                case "CloudControl":
1050
                    {
1051
                        (control as CloudControl).StrokeColor = Brushes.Red;
1052
                    }
1053
                    break;
1054
                case "PolygonControl":
1055
                    {
1056
                        (control as PolygonControl).StrokeColor = Brushes.Red;
1057
                    }
1058
                    break;
1059
                case "ArcControl":
1060
                    {
1061
                        (control as ArcControl).StrokeColor = Brushes.Red;
1062
                    }
1063
                    break;
1064
                case "ArrowArcControl":
1065
                    {
1066
                        (control as ArrowArcControl).StrokeColor = Brushes.Red;
1067
                    }
1068
                    break;
1069
                case "LineControl":
1070
                    {
1071
                        (control as LineControl).StrokeColor = Brushes.Red;
1072
                    }
1073
                    break;
1074
                case "ArrowControl_Multi":
1075
                    {
1076
                        (control as ArrowControl_Multi).StrokeColor = Brushes.Red;
1077
                    }
1078
                    break;
1079
                case "TextControl":
1080
                    {
1081
                        (control as TextControl).BackInnerColor = new SolidColorBrush(Color.FromArgb(Convert.ToByte(255 * 0.6), Colors.White.R, Colors.White.G, Colors.White.B));
1082
                    }
1083
                    break;
1084
                case "ArrowTextControl":
1085
                    {
1086
                        (control as ArrowTextControl).BackInnerColor = new SolidColorBrush(Color.FromArgb(Convert.ToByte(255 * 0.6), Colors.White.R, Colors.White.G, Colors.White.B));
1087
                    }
1088
                    break;
1089
                case "InsideWhiteControl":
1090
                    {
1091
                        (control as InsideWhiteControl).StrokeColor = Brushes.White;
1092
                    }
1093
                    break;
1094
                case "OverlapWhiteControl":
1095
                    {
1096
                        (control as OverlapWhiteControl).StrokeColor = Brushes.White;
1097
                    }
1098
                    break;
1099
                case "ClipWhiteControl":
1100
                    {
1101
                        (control as ClipWhiteControl).StrokeColor = Brushes.White;
1102
                    }
1103
                    break;
1104
                case "CoordinateControl":
1105
                    {
1106
                        (control as CoordinateControl).StrokeColor = Brushes.Black;
1107
                    }
1108
                    break;
1109
            }
1110
        }
1111
        #endregion
1112

    
1113
        public void firstCondition_MouseLeave(object sender, MouseEventArgs e)
1114
        {
1115
            //Control_Init(e.Source);
1116
        }
1117
        //private Window _dragdropWindow = null;
1118

    
1119
        [DllImport("user32.dll")]
1120
        [return: MarshalAs(UnmanagedType.Bool)]
1121
        internal static extern bool GetCursorPos(ref Win32Point pt);
1122

    
1123
        [StructLayout(LayoutKind.Sequential)]
1124
        internal struct Win32Point
1125
        {
1126
            public Int32 X;
1127
            public Int32 Y;
1128
        };
1129
        /*
1130
       public string symbol_id = null;
1131
       public long symbol_group_id;
1132
       public int symbol_SelectedIndex;
1133
       public ImageSource symbol_img;
1134
       public string symbol_Data = null;
1135
       public void symboldata(string id, long group_id, int SelectedIndex, string Data_, ImageSource img)
1136
       {
1137
           PlaceImageSymbol(symbol_id, symbol_group_id, symbol_SelectedIndex, new Point(zoomAndPanCanvas.ActualWidth / 2,
1138
               zoomAndPanCanvas.ActualHeight / 2));
1139

    
1140

    
1141
               if (this._dragdropWindow != null)
1142
               {
1143
                   this._dragdropWindow.Close();
1144
                   this._dragdropWindow = null;
1145
               }
1146

    
1147
               symbol_id = id;
1148
               symbol_group_id = group_id;
1149
               symbol_SelectedIndex = SelectedIndex;
1150
               symbol_Data = Data_;
1151
               symbol_img = img;
1152

    
1153

    
1154
               CreateDragDropWindow2(img);
1155
              
1156
    }
1157

    
1158
    private void CreateDragDropWindow2(ImageSource image)
1159
        {
1160
            this._dragdropWindow = new Window();
1161
            _dragdropWindow.Cursor = new Cursor(MainWindow.CursorChange().StreamSource);
1162
            _dragdropWindow.WindowStyle = WindowStyle.None;
1163
            _dragdropWindow.AllowsTransparency = true;           
1164
            _dragdropWindow.AllowDrop = false;
1165
            _dragdropWindow.Background = null;
1166
            _dragdropWindow.IsHitTestVisible = false;
1167
            _dragdropWindow.SizeToContent = SizeToContent.WidthAndHeight;
1168
            _dragdropWindow.Topmost = true;
1169
            _dragdropWindow.ShowInTaskbar = false;
1170
            
1171
            Rectangle r = new Rectangle();
1172
            r.Width = image.Width;
1173
            r.Height = image.Height;
1174
            r.Opacity = 0.5;            
1175
            r.Fill = new ImageBrush(image);
1176
            this._dragdropWindow.Content = r;
1177

    
1178
            Win32Point w32Mouse = new Win32Point();
1179
            GetCursorPos(ref w32Mouse);
1180

    
1181
            //w32Mouse.X = getCurrentPoint.X;
1182
            this._dragdropWindow.Left = w32Mouse.X - (image.Width / 2);
1183
            this._dragdropWindow.Top = w32Mouse.Y - (image.Height / 2); 
1184
            this._dragdropWindow.Show();
1185
        }
1186
         */
1187
        private void zoomAndPanControl_MouseMove(object sender, MouseEventArgs e)
1188
        {
1189
            if (Common.ViewerDataModel.Instance.SelectedControl == "Batch")
1190
            {
1191
                if (!floatingTip.IsOpen) { floatingTip.IsOpen = true; }
1192

    
1193
                Point currentPos = e.GetPosition(rect);
1194

    
1195
                floatingTip.HorizontalOffset = currentPos.X + 20;
1196
                floatingTip.VerticalOffset = currentPos.Y;
1197
            }
1198

    
1199
            getCurrentPoint = e.GetPosition(drawingRotateCanvas);
1200
            
1201
            if ((e.MiddleButton == MouseButtonState.Pressed) || (e.RightButton == MouseButtonState.Pressed))
1202
            {
1203
                SetCursor();
1204
                Point currentCanvasDrawingMouseMovePoint = e.GetPosition(drawingRotateCanvas);
1205
                Point currentCanvasZoomPanningMouseMovePoint = e.GetPosition(zoomAndPanCanvas);
1206

    
1207
                Vector dragOffset = currentCanvasZoomPanningMouseMovePoint - canvasZoommovingMouseDownPoint;
1208
                zoomAndPanControl.ContentOffsetX -= dragOffset.X;
1209
                zoomAndPanControl.ContentOffsetY -= dragOffset.Y;
1210

    
1211
                if (Sync.IsChecked)
1212
                {
1213
                    ViewerDataModel.Instance.Sync_ContentOffsetX = zoomAndPanControl.ContentOffsetX;
1214
                    ViewerDataModel.Instance.Sync_ContentOffsetY = zoomAndPanControl.ContentOffsetY;
1215
                }
1216
            }
1217

    
1218
            if (mouseHandlingMode == MouseHandlingMode.Drawing && currentControl != null)
1219
            {
1220
                Point currentCanvasDrawingMouseMovePoint = e.GetPosition(drawingRotateCanvas);
1221
                Point currentCanvasZoomPanningMouseMovePoint = e.GetPosition(zoomAndPanCanvas);
1222
                SetCursor();
1223

    
1224
                if (currentControl != null)
1225
                {
1226
                    double moveX = currentCanvasDrawingMouseMovePoint.X - canvasDrawingMouseDownPoint.X;
1227
                    double moveY = currentCanvasDrawingMouseMovePoint.Y - canvasDrawingMouseDownPoint.Y;
1228
                    //강인구 추가
1229
                    currentControl.Opacity = ViewerDataModel.Instance.ControlOpacity;
1230

    
1231
                    if ((currentControl as IPath) != null)
1232
                    {
1233
                        (currentControl as IPath).LineSize = ViewerDataModel.Instance.LineSize;
1234
                    }
1235
                    if ((currentControl as LineControl) != null)
1236
                    {
1237
                        (currentControl as LineControl).Interval = ViewerDataModel.Instance.Interval;
1238
                    }
1239

    
1240
                    if ((currentControl as IShapeControl) != null)
1241
                    {
1242
                        (currentControl as IShapeControl).Paint = ViewerDataModel.Instance.paintSet;
1243
                    }
1244
                    if ((currentControl as TextControl) != null)
1245
                    {
1246
                        if (this.ParentOfType<MainWindow>().dzTopMenu.btnItalic.IsChecked == true)
1247
                        {
1248
                            (currentControl as TextControl).TextStyle = FontStyles.Italic;
1249
                        }
1250
                        if (this.ParentOfType<MainWindow>().dzTopMenu.btnBold.IsChecked == true)
1251
                        {
1252
                            (currentControl as TextControl).TextWeight = FontWeights.Bold;
1253
                        }
1254
                        if (this.ParentOfType<MainWindow>().dzTopMenu.btnUnderLine.IsChecked == true)
1255
                        {
1256
                            (currentControl as TextControl).UnderLine = TextDecorations.Underline;
1257
                        }
1258
                    }
1259
                    else if ((currentControl as ArrowTextControl) != null)
1260
                    {
1261
                        if (this.ParentOfType<MainWindow>().dzTopMenu.btnItalic.IsChecked == true)
1262
                        {
1263
                            (currentControl as ArrowTextControl).TextStyle = FontStyles.Italic;
1264
                        }
1265
                        if (this.ParentOfType<MainWindow>().dzTopMenu.btnBold.IsChecked == true)
1266
                        {
1267
                            (currentControl as ArrowTextControl).TextWeight = FontWeights.Bold;
1268
                        }
1269
                        if (this.ParentOfType<MainWindow>().dzTopMenu.btnUnderLine.IsChecked == true)
1270
                        {
1271
                            (currentControl as ArrowTextControl).UnderLine = TextDecorations.Underline;
1272
                        }
1273
                    }
1274
                    else if ((currentControl as RectCloudControl) != null)
1275
                    {
1276
                        (currentControl as RectCloudControl).ArcLength = ViewerDataModel.Instance.ArcLength;
1277
                    }
1278
                    else if ((currentControl as CloudControl) != null)
1279
                    {
1280
                        (currentControl as CloudControl).ArcLength = ViewerDataModel.Instance.ArcLength;
1281
                    }
1282

    
1283
                    switch (controlType)
1284
                    {
1285
                        case (ControlType.Coordinate):
1286
                            {
1287
                                var control = currentControl as CoordinateControl;
1288
                                if (control != null)
1289
                                {
1290
                                    control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1291
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1292
                                    control.Paint = ViewerDataModel.Instance.paintSet;
1293
                                }
1294
                            }
1295
                            break;
1296
                        case (ControlType.InsideWhite):
1297
                            {
1298
                                var control = currentControl as InsideWhiteControl;
1299
                                if (control != null)
1300
                                {
1301
                                    control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1302
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1303
                                    control.Paint = ViewerDataModel.Instance.paintSet;
1304
                                    control.Paint = PaintSet.Fill;
1305
                                }
1306
                            }
1307
                            break;
1308
                        case ControlType.OverlapWhite:
1309
                            {
1310
                                var control = currentControl as OverlapWhiteControl;
1311
                                if (control != null)
1312
                                {
1313
                                    control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1314
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1315
                                    control.Paint = ViewerDataModel.Instance.paintSet;
1316
                                    control.Paint = PaintSet.Fill;
1317
                                }
1318
                            }
1319
                            break;
1320
                        case ControlType.ClipWhite:
1321
                            {
1322
                                var control = currentControl as ClipWhiteControl;
1323
                                if (control != null)
1324
                                {
1325
                                    control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1326
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1327
                                    control.Paint = ViewerDataModel.Instance.paintSet;
1328
                                    control.Paint = PaintSet.Fill;
1329
                                }
1330
                            }
1331
                            break;
1332
                        case ControlType.RectCloud:
1333
                            {
1334
                                var control = currentControl as RectCloudControl;
1335
                                if (control != null)
1336
                                {
1337
                                    control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1338
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1339
                                    control.Paint = ViewerDataModel.Instance.paintSet;
1340
                                }
1341
                            }
1342
                            break;
1343
                        case ControlType.SingleLine:
1344
                        case ControlType.CancelLine:
1345
                        case ControlType.ArrowLine:
1346
                        case ControlType.TwinLine:
1347
                        case ControlType.DimLine:
1348
                            {
1349
                                var control = currentControl as LineControl;
1350
                                if (control != null)
1351
                                {
1352
                                    control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1353
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1354
                                }
1355
                                
1356
                            }
1357
                            break;
1358

    
1359
                        case ControlType.ArcLine:
1360
                            {
1361
                                var control = currentControl as ArcControl;
1362
                                if (control != null)
1363
                                {
1364
                                    control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1365
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1366
                                }
1367
                            }
1368
                            break;
1369

    
1370
                        case ControlType.ArcArrow:
1371
                            {
1372
                                var control = currentControl as ArrowArcControl;
1373
                                if (control != null)
1374
                                {
1375
                                    control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1376
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1377
                                }
1378
                            }
1379
                            break;
1380

    
1381
                        case ControlType.ArrowMultiLine:
1382
                            {
1383
                                var control = currentControl as ArrowControl_Multi;
1384
                                if (control != null)
1385
                                {
1386
                                    control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1387
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1388
                                }
1389
                            }
1390
                            break;
1391

    
1392
                        case ControlType.Circle:
1393
                            {
1394
                                if (currentControl != null)
1395
                                {
1396
                                    currentControl.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1397
                                    (currentControl as CircleControl).DashSize = ViewerDataModel.Instance.DashSize;
1398
                                    (currentControl as CircleControl).Paint = ViewerDataModel.Instance.paintSet;
1399
                                }
1400
                            }
1401
                            break;
1402

    
1403
                        case ControlType.PolygonCloud:
1404
                            {
1405
                                var control = currentControl as CloudControl;
1406
                                if (control != null)
1407
                                {
1408
                                    control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1409
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1410
                                    control.Paint = ViewerDataModel.Instance.paintSet;
1411
                                }
1412
                            }
1413
                            break;
1414

    
1415
                        case ControlType.Triangle:
1416
                            {
1417
                                var control = currentControl as TriControl;
1418
                                if (control != null)
1419
                                {
1420
                                    control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1421
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1422
                                    control.Paint = ViewerDataModel.Instance.paintSet;
1423
                                }
1424
                            }
1425
                            break;
1426

    
1427
                        case ControlType.ImgControl:
1428
                            {
1429
                                var control = currentControl as ImgControl;
1430
                                if (control != null)
1431
                                {
1432
                                    control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1433
                                }
1434
                            }
1435
                            break;
1436

    
1437
                        case ControlType.Date:
1438
                            {
1439
                                var control = currentControl as DateControl;
1440
                                if (control != null)
1441
                                {
1442
                                    control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1443
                                }
1444
                            }
1445
                            break;
1446

    
1447
                        case ControlType.ArrowTextControl:
1448
                        case ControlType.ArrowTransTextControl:
1449
                        case ControlType.ArrowTextBorderControl:
1450
                        case ControlType.ArrowTransTextBorderControl:
1451
                        case ControlType.ArrowTextCloudControl:
1452
                        case ControlType.ArrowTransTextCloudControl:
1453
                            {
1454
                                var control = currentControl as ArrowTextControl;
1455
                                if (control != null)
1456
                                {
1457
                                    control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1458
                                }
1459
                            }
1460
                            break;
1461
                        case ControlType.PolygonControl:
1462
                        case ControlType.ChainLine:
1463
                            {
1464
                                var control = currentControl as PolygonControl;
1465
                                if (control != null)
1466
                                {
1467
                                    control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1468
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1469
                                    control.Paint = ViewerDataModel.Instance.paintSet;
1470
                                }
1471
                            }
1472
                            break;
1473
                        case ControlType.Sign:
1474
                            {
1475
                                var control = currentControl as SignControl;
1476
                                if (control != null)
1477
                                {
1478
                                    control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1479
                                }
1480
                            }
1481
                            break;
1482
                        case ControlType.Symbol:
1483
                            {
1484
                                var control = currentControl as SymControl;
1485
                                if (control != null)
1486
                                {
1487
                                    control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1488
                                }
1489
                            }
1490
                            break;
1491
                        case ControlType.Stamp:
1492
                            {
1493
                                var control = currentControl as SymControlN;
1494
                                if (control != null)
1495
                                {
1496
                                    if (control.STAMP != null)
1497
                                    {
1498
                                        control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1499
                                    }
1500
                                    else
1501
                                    {
1502
                                        currentControl = null;
1503
                                        this.cursor = new Cursor(MainWindow.CursorChange().StreamSource);
1504
                                        DialogMessage_Alert("Approved Stamp 가 등록되어 있지 않습니다. \n관리자에게 문의하세요.", "안내");
1505
                                    }
1506
                                }                                    
1507
                            }
1508
                            break;
1509
                        case ControlType.Rectangle:
1510
                        case ControlType.Mark:
1511
                            {
1512
                                var control = currentControl as RectangleControl;
1513
                                if (control != null)
1514
                                {
1515
                                    control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1516
                                    if(control.ControlType == ControlType.Mark) control.Paint = PaintSet.Fill;
1517
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1518
                                }
1519
                            }
1520
                            break;
1521
                        case ControlType.PenControl:
1522
                            {
1523
                                stroke.StylusPoints.Add(new StylusPoint(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y));
1524
                                //inkBoard.Strokes.Add(stroke);
1525
                            }
1526
                            break;
1527
                        default:
1528
                            break;
1529
                    }
1530

    
1531
                    if (ViewerDataModel.Instance.AngleVisibility == Visibility.Visible)
1532
                    {
1533
                        ViewerDataModel.Instance.Angle = currentControl.Angle;
1534
                    }
1535
                }
1536
            }
1537
            else if(mouseHandlingMode == MouseHandlingMode.Drawing && e.LeftButton == MouseButtonState.Pressed)
1538
            {
1539
                Point currentCanvasDrawingMouseMovePoint = e.GetPosition(drawingRotateCanvas);
1540
                Point currentCanvasZoomPanningMouseMovePoint = e.GetPosition(zoomAndPanCanvas);
1541
                SetCursor();
1542
                if (currentControl == null)
1543
                {
1544
                    switch (controlType)
1545
                    {
1546
                        case ControlType.PenControl:
1547
                            {
1548
                                if (inkBoard.Tag.ToString() == "Ink")
1549
                                {
1550
                                    stroke.StylusPoints.Add(new StylusPoint(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y));
1551
                                }
1552
                                else if (inkBoard.Tag.ToString() == "EraseByPoint")
1553
                                {
1554
                                    RemovePointStroke(currentCanvasDrawingMouseMovePoint);
1555
                                }
1556
                                else if (inkBoard.Tag.ToString() == "EraseByStroke")
1557
                                {
1558
                                    RemoveLineStroke(currentCanvasDrawingMouseMovePoint);
1559
                                }
1560

    
1561
                                //inkBoard.Strokes.Add(stroke);
1562
                            }
1563
                            break;
1564
                    }
1565
                    return;
1566
                }
1567
            }
1568
            else if (((e.LeftButton == MouseButtonState.Pressed) && mouseHandlingMode == MouseHandlingMode.Selecting) || 
1569
                ((e.LeftButton == MouseButtonState.Pressed) && mouseHandlingMode == MouseHandlingMode.Capture) || 
1570
                ((e.LeftButton == MouseButtonState.Pressed) && mouseHandlingMode == MouseHandlingMode.DragZoom))
1571
            {
1572
                Point curMouseDownPoint = e.GetPosition(drawingRotateCanvas);
1573

    
1574
                if (isDraggingSelectionRect)
1575
                {
1576
                    UpdateDragSelectionRect(canvasDrawingMouseDownPoint, curMouseDownPoint);
1577
                    e.Handled = true;
1578
                }
1579
                else if (isLeftMouseButtonDownOnWindow)
1580
                {
1581
                    var dragDelta = curMouseDownPoint - canvasDrawingMouseDownPoint;
1582
                    double dragDistance = Math.Abs(dragDelta.Length);
1583

    
1584
                    if (dragDistance > DragThreshold)
1585
                    {
1586
                        isDraggingSelectionRect = true;
1587
                        InitDragSelectionRect(canvasDrawingMouseDownPoint, curMouseDownPoint);
1588
                    }
1589

    
1590
                    e.Handled = true;
1591
                }
1592

    
1593
                if (canvasDrawingMouseDownPoint == curMouseDownPoint)
1594
                {
1595
                }
1596
                else
1597
                {
1598
                    e.Handled = true;
1599
                }
1600
            }
1601
            /*
1602
            else if ((e.LeftButton == MouseButtonState.Pressed) && mouseHandlingMode == MouseHandlingMode.DragSymbol)
1603
            { //symbol      
1604
                if(_dragdropWindow != null)
1605
                {
1606
                    Win32Point w32Mouse = new Win32Point();
1607
                    GetCursorPos(ref w32Mouse);
1608

    
1609
                    this._dragdropWindow.Left = w32Mouse.X - (symbol_img.Width / 2);
1610
                    this._dragdropWindow.Top = w32Mouse.Y - (symbol_img.Height / 2);
1611
                }                
1612
            }
1613
            */
1614
            else if ((e.LeftButton == MouseButtonState.Released) && (e.MiddleButton == MouseButtonState.Released) && 
1615
                (e.RightButton == MouseButtonState.Released) && ViewerDataModel.Instance.MarkupControls_USER.Count > 0)
1616
            {
1617
                var control = ViewerDataModel.Instance.MarkupControls_USER.Where(data => data.IsMouseOver).FirstOrDefault();
1618
                if(control != null)
1619
                {
1620
                    this.cursor = Cursors.Hand;
1621
                    SetCursor();
1622
                }
1623
                else
1624
                {
1625
                    this.cursor = new Cursor(MainWindow.CursorChange().StreamSource);
1626
                    SetCursor();
1627
                }
1628
            }
1629
            else
1630
            {
1631
            }
1632
        }
1633

    
1634
        private void zoomAndPanControl2_MouseMove(object sender, MouseEventArgs e)
1635
        {
1636
            if ((e.MiddleButton == MouseButtonState.Pressed) || (e.RightButton == MouseButtonState.Pressed))
1637
            {
1638
                SetCursor();
1639
                Point currentCanvasDrawingMouseMovePoint = e.GetPosition(drawingRotateCanvas2);
1640
                Point currentCanvasZoomPanningMouseMovePoint = e.GetPosition(zoomAndPanCanvas2);
1641

    
1642
                Vector dragOffset = currentCanvasZoomPanningMouseMovePoint - canvasZoommovingMouseDownPoint;
1643

    
1644
                ViewerDataModel.Instance.Sync_ContentOffsetX -= dragOffset.X;
1645
                ViewerDataModel.Instance.Sync_ContentOffsetY -= dragOffset.Y;
1646

    
1647
                if (Sync.IsChecked)
1648
                {
1649
                    zoomAndPanControl.ContentOffsetX = ViewerDataModel.Instance.Sync_ContentOffsetX;
1650
                    zoomAndPanControl.ContentOffsetY = ViewerDataModel.Instance.Sync_ContentOffsetY;
1651
                }
1652
            }
1653
        }
1654

    
1655
        private List<CommentUserInfo> hitList = new List<CommentUserInfo>();
1656

    
1657
        private EllipseGeometry hitArea = new EllipseGeometry();
1658

    
1659
        private void zoomAndPanControl_MouseUp(object sender, MouseButtonEventArgs e)
1660
        {
1661
            IsDrawing = false;
1662

    
1663
            if (mouseHandlingMode != MouseHandlingMode.None)
1664
            {
1665
                if (mouseHandlingMode == MouseHandlingMode.Drawing)
1666
                {
1667
                    this.cursor = new Cursor(MainWindow.CursorChange().StreamSource);
1668

    
1669
                    SetCursor();
1670

    
1671
                    switch (controlType)
1672
                    {
1673
                        case ControlType.None:
1674
                            break;
1675
                        case ControlType.Rectangle:
1676
                            {
1677

    
1678
                            }
1679
                            break;
1680
                        case ControlType.PenControl:
1681
                            {
1682

    
1683
                            }
1684
                            break;
1685
                        default:
1686
                            break;
1687
                    }                    
1688
                }
1689
                else if (mouseHandlingMode == MouseHandlingMode.Selecting && e.ChangedButton == MouseButton.Left || mouseHandlingMode == MouseHandlingMode.Capture && e.ChangedButton == MouseButton.Left || mouseHandlingMode == MouseHandlingMode.DragZoom && e.ChangedButton == MouseButton.Left)
1690
                {
1691
                    if (isLeftMouseButtonDownOnWindow)
1692
                    {
1693
                        bool wasDragSelectionApplied = false;
1694

    
1695
                        if (isDraggingSelectionRect)
1696
                        {
1697
                            if (mouseHandlingMode == MouseHandlingMode.Capture && controlType == ControlType.ImgControl)
1698
                            {
1699
                                dragCaptureBorder.Visibility = Visibility.Collapsed;
1700
                                mouseHandlingMode = MouseHandlingMode.None;
1701
                                Point endPoint = e.GetPosition(zoomAndPanCanvas);
1702
                                symbolselectindex = symbolPanel_Instance.RadTab.SelectedIndex;
1703
                                Set_Symbol_Capture(endPoint);
1704
                                ViewerDataModel.Instance.ViewVisible = Visibility.Collapsed;
1705
                                ViewerDataModel.Instance.ViewVisible = Visibility.Visible;                                
1706
                                ViewerDataModel.Instance.Capture_Opacity = 0;
1707
                            }
1708
                            else if (mouseHandlingMode == MouseHandlingMode.Capture)
1709
                            {
1710
                                dragCaptureBorder.Visibility = Visibility.Collapsed;
1711
                                mouseHandlingMode = MouseHandlingMode.None;
1712
                                Set_Capture();
1713

    
1714
                                ViewerDataModel.Instance.ViewVisible = Visibility.Collapsed;
1715
                                ViewerDataModel.Instance.ViewVisible = Visibility.Visible;
1716
                                ViewerDataModel.Instance.Capture_Opacity = 0;
1717
                            }
1718
                            else if (mouseHandlingMode == MouseHandlingMode.Selecting)
1719
                            {
1720
                                ApplyDragSelectionRect();
1721
                            }
1722
                            else
1723
                            {
1724
                                double x = Canvas.GetLeft(dragZoomBorder);
1725
                                double y = Canvas.GetTop(dragZoomBorder);
1726
                                double width = dragZoomBorder.Width;
1727
                                double height = dragZoomBorder.Height;
1728
                                Rect dragRect = new Rect(x, y, width, height);
1729

    
1730
                                ViewerDataModel.Instance.SystemMain.dzMainMenu.zoomAndPanControl.ZoomTo(dragRect);
1731

    
1732
                                dragZoomBorder.Visibility = Visibility.Collapsed;
1733
                            }
1734

    
1735
                            isDraggingSelectionRect = false;
1736
                            e.Handled = true;
1737
                            wasDragSelectionApplied = true;
1738
                        }
1739

    
1740
                        if (isLeftMouseButtonDownOnWindow)
1741
                        {
1742
                            isLeftMouseButtonDownOnWindow = false;
1743
                            this.ReleaseMouseCapture();
1744
                            e.Handled = true;
1745
                        }
1746

    
1747
                        if (!wasDragSelectionApplied)
1748
                        {
1749
                            init();
1750
                        }
1751
                    }
1752
                }
1753
                else if (e.RightButton == MouseButtonState.Pressed)
1754
                {
1755
                    this.cursor = new Cursor(MainWindow.CursorChange().StreamSource);
1756
                    SetCursor();
1757
                }
1758

    
1759
                zoomAndPanControl.ReleaseMouseCapture();
1760

    
1761

    
1762
                e.Handled = true;
1763
            }
1764
            else
1765
            {
1766
                this.cursor = new Cursor(MainWindow.CursorChange().StreamSource);
1767
                SetCursor();
1768
            }
1769

    
1770
            ///mouseButtonDown = MouseButton.Left;
1771
            //controlType = ControlType.SingleLine;
1772
        }
1773

    
1774
        public void Set_Symbol_Capture(Point endPoint)
1775
        {       
1776
            double x = canvasDrawingMouseDownPoint.X;
1777
            double y = canvasDrawingMouseDownPoint.Y;
1778
            if(x > endPoint.X)
1779
            {
1780
                x = endPoint.X;
1781
                y = endPoint.Y;
1782
            }
1783

    
1784
            double width = dragCaptureBorder.Width;
1785
            double height = dragCaptureBorder.Height;
1786

    
1787
            canvasImage = ConverterBitmapImage(zoomAndPanCanvas);
1788

    
1789
            if (x < 0)
1790
            {
1791
                width += x;
1792
                x = 0;
1793
            }
1794
            if (y < 0)
1795
            {
1796
                height += y;
1797
                y = 0;
1798

    
1799
                width = (int)canvasImage.PixelWidth - x;
1800
            }
1801
            if (x + width > canvasImage.PixelWidth)
1802
            {
1803
                width = (int)canvasImage.PixelWidth - x;
1804
            }
1805
            if (y + height > canvasImage.PixelHeight)
1806
            {
1807
                height = (int)canvasImage.PixelHeight - y;
1808
            }
1809
            var rect = new Int32Rect((int)x, (int)y, (int)width, (int)height);
1810

    
1811
            string uri = "";
1812
            if (userData.COMPANY != "EXT")
1813
            {
1814
                uri = String.Format(CommonLib.Common.GetConfigString("mainServerImageWebPath", "URL", "", App.isExternal), _ViewInfo.ProjectNO,
1815
                    (Convert.ToInt32(_ViewInfo.DocumentItemID) / 100).ToString(), _ViewInfo.DocumentItemID, Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber);
1816
            }
1817
            else
1818
            {
1819
                uri = String.Format(CommonLib.Common.GetConfigString("subServerImageWebPath", "URL", "", App.isExternal), _ViewInfo.ProjectNO, _ViewInfo.DocumentItemID,
1820
                    Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber);
1821
            }
1822

    
1823
            var defaultBitmapImage = new BitmapImage();
1824
            defaultBitmapImage.BeginInit();
1825
            defaultBitmapImage.CreateOptions = BitmapCreateOptions.IgnoreImageCache;
1826
            defaultBitmapImage.CacheOption = BitmapCacheOption.OnLoad;
1827
            defaultBitmapImage.UriSource = new Uri(uri);
1828
            defaultBitmapImage.EndInit();
1829

    
1830
            //GC.Collect();
1831

    
1832
            if (defaultBitmapImage.IsDownloading)
1833
            {
1834
                defaultBitmapImage.DownloadCompleted += (ex, arg) =>
1835
                {
1836
                    defaultBitmapImage.Freeze();
1837
                    //GC.Collect();
1838
                    BitmapSource bs = new CroppedBitmap(defaultBitmapImage, rect);
1839
                    Save_Symbol_Capture(bs, (int)x, (int)y, (int)width, (int)height);
1840
                };
1841
            }
1842
        }
1843

    
1844
        private void zoomAndPanControl2_MouseUp(object sender, MouseButtonEventArgs e)
1845
        {
1846
            ///mouseButtonDown = MouseButton.Left;
1847
        }
1848

    
1849
        private void zoomAndPanControl_MouseLeave(object sender, MouseEventArgs e)
1850
        {
1851
            ///mouseButtonDown = MouseButton.Left;
1852
            //this.cursor = new Cursor(MainWindow.CursorChange().StreamSource);
1853
        }
1854

    
1855
        private void zoomAndPanControl_MouseDoubleClick(object sender, MouseButtonEventArgs e)
1856
        {
1857

    
1858
        }
1859

    
1860
        /// <summary>
1861
        /// select items by dragging
1862
        /// </summary>
1863
        private void ApplyDragSelectionRect()
1864
        {
1865
            dragSelectionBorder.Visibility = Visibility.Collapsed;
1866

    
1867
            double x = Canvas.GetLeft(dragSelectionBorder);
1868
            double y = Canvas.GetTop(dragSelectionBorder);
1869
            double width = dragSelectionBorder.Width;
1870
            double height = dragSelectionBorder.Height;
1871
            Boolean Flag = false;
1872
            List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>();
1873
            var Items = ViewerDataModel.Instance.MarkupControls_USER.Where(d => d.Visibility != Visibility.Hidden).ToList();
1874

    
1875
            Rect dragRect = new Rect(x, y, width, height);
1876
            ///dragRect.Inflate(width / 10, height / 10);
1877

    
1878
            foreach (var item in Items)
1879
            {
1880
                Flag = SelectionSet.Instance.SelectControl(item, dragRect);
1881

    
1882
                if (Flag)
1883
                {
1884
                    adornerSet.Add(item);
1885
                    ViewerDataModel.Instance.MarkupControls_USER.Remove(item);
1886
                    Control_Style(item);
1887
                }
1888
            }
1889
            if (adornerSet.Count > 0)
1890
            {
1891
                Controls.AdornerFinal final = new Controls.AdornerFinal(adornerSet);
1892
                SelectLayer.Children.Add(final);
1893
            }
1894
        }
1895

    
1896
        private void InitDragSelectionRect(Point pt1, Point pt2)
1897
        {
1898
            //캡쳐 중
1899
            if (mouseHandlingMode == MouseHandlingMode.Capture)
1900
            {
1901
                dragCaptureBorder.Visibility = Visibility.Visible;
1902
            }
1903
            //선택 중
1904
            else if (mouseHandlingMode == MouseHandlingMode.Selecting)
1905
            {
1906

    
1907
                dragSelectionBorder.Visibility = Visibility.Visible;
1908
            }
1909
            else
1910
            {
1911
                dragZoomBorder.Visibility = Visibility.Visible;
1912
            }
1913
            UpdateDragSelectionRect(pt1, pt2);
1914
        }
1915

    
1916
        /// <summary>
1917
        /// Update the position and size of the rectangle used for drag selection.
1918
        /// </summary>
1919
        private void UpdateDragSelectionRect(Point pt1, Point pt2)
1920
        {
1921
            double x, y, width, height;
1922

    
1923
            //
1924
            // Determine x,y,width and height of the rect inverting the points if necessary.
1925
            // 
1926

    
1927
            if (pt2.X < pt1.X)
1928
            {
1929
                x = pt2.X;
1930
                width = pt1.X - pt2.X;
1931
            }
1932
            else
1933
            {
1934
                x = pt1.X;
1935
                width = pt2.X - pt1.X;
1936
            }
1937

    
1938
            if (pt2.Y < pt1.Y)
1939
            {
1940
                y = pt2.Y;
1941
                height = pt1.Y - pt2.Y;
1942
            }
1943
            else
1944
            {
1945
                y = pt1.Y;
1946
                height = pt2.Y - pt1.Y;
1947
            }
1948

    
1949
            //
1950
            // Update the coordinates of the rectangle used for drag selection.
1951
            //
1952
            //캡쳐 중
1953
            if (mouseHandlingMode == MouseHandlingMode.Capture)
1954
            {
1955
                Canvas.SetLeft(dragCaptureBorder, x);
1956
                Canvas.SetTop(dragCaptureBorder, y);
1957
                dragCaptureBorder.Width = width;
1958
                dragCaptureBorder.Height = height;
1959
            }
1960
            //선택 중
1961
            else if (mouseHandlingMode == MouseHandlingMode.Selecting)
1962
            {
1963
                Canvas.SetLeft(dragSelectionBorder, x);
1964
                Canvas.SetTop(dragSelectionBorder, y);
1965
                dragSelectionBorder.Width = width;
1966
                dragSelectionBorder.Height = height;
1967
            }
1968
            else
1969
            {
1970
                Canvas.SetLeft(dragZoomBorder, x);
1971
                Canvas.SetTop(dragZoomBorder, y);
1972
                dragZoomBorder.Width = width;
1973
                dragZoomBorder.Height = height;
1974
            }
1975
        }
1976

    
1977
        private void drawingPannelRotate(double angle)
1978
        {
1979
            Logger.sendCheckLog("pageNavigator_PageChanging_drawingPannelRotate Setting", 1);
1980
            rotate.Angle = angle;
1981
            var rotationNum = Math.Abs((rotate.Angle / 90));
1982

    
1983
            if (angle == 90 || angle == 270)
1984
            {
1985
                double emptySize = zoomAndPanCanvas.Width;
1986
                zoomAndPanCanvas.Width = zoomAndPanCanvas.Height;
1987
                zoomAndPanCanvas.Height = emptySize;
1988
            }
1989
            if (angle == 0)
1990
            {
1991
                translate.X = 0;
1992
                translate.Y = 0;
1993
            }
1994
            else if (angle == 90)
1995
            {
1996
                translate.X = zoomAndPanCanvas.Width;
1997
                translate.Y = 0;
1998
            }
1999
            else if (angle == 180)
2000
            {
2001
                translate.X = zoomAndPanCanvas.Width;
2002
                translate.Y = zoomAndPanCanvas.Height;
2003
            }
2004
            else
2005
            {
2006
                translate.X = 0;
2007
                translate.Y = zoomAndPanCanvas.Height;
2008
            }
2009

    
2010
            zoomAndPanControl.RotationAngle = rotate.Angle;
2011

    
2012

    
2013
            if (!testPanel2.IsHidden)
2014
            {
2015
                zoomAndPanControl2.RotationAngle = rotate.Angle;
2016
                zoomAndPanCanvas2.Width = zoomAndPanCanvas.Width;
2017
                zoomAndPanCanvas2.Height = zoomAndPanCanvas.Height;
2018
            }
2019

    
2020
            ViewerDataModel.Instance.ContentWidth = zoomAndPanCanvas.Width;
2021
            ViewerDataModel.Instance.ContentHeight = zoomAndPanCanvas.Height;
2022
            ViewerDataModel.Instance.AngleOffsetX = translate.X;
2023
            ViewerDataModel.Instance.AngleOffsetY = translate.Y;
2024
            ViewerDataModel.Instance.Angle = rotate.Angle;
2025
        }
2026

    
2027
        private void syncPannelRotate(double angle)
2028
        {
2029
            //Logger.sendCheckLog("pageNavigator_PageChanging_drawingPannelRotate Setting", 1);
2030
            rotate.Angle = angle;
2031
            var rotationNum = Math.Abs((rotate.Angle / 90));
2032

    
2033
            if (angle == 90 || angle == 270)
2034
            {
2035
                double emptySize = zoomAndPanCanvas2.Width;
2036
                zoomAndPanCanvas2.Width = zoomAndPanCanvas2.Height;
2037
                zoomAndPanCanvas2.Height = emptySize;
2038
            }
2039
            if (angle == 0)
2040
            {
2041
                translate2.X = 0;
2042
                translate2.Y = 0;
2043
            }
2044
            else if (angle == 90)
2045
            {
2046
                translate2.X = zoomAndPanCanvas2.Width;
2047
                translate2.Y = 0;
2048
            }
2049
            else if (angle == 180)
2050
            {
2051
                translate2.X = zoomAndPanCanvas2.Width;
2052
                translate2.Y = zoomAndPanCanvas2.Height;
2053
            }
2054
            else
2055
            {
2056
                translate2.X = 0;
2057
                translate2.Y = zoomAndPanCanvas2.Height;
2058
            }
2059

    
2060
            zoomAndPanControl2.RotationAngle = rotate.Angle;
2061
        }
2062

    
2063
        public void PlaceImageSymbol(string id, long group_id, int SelectedIndex, Point canvasZoomPanningMouseDownPoint)
2064
        {
2065
            string Data_ = "";
2066

    
2067
            try
2068
            {
2069
                Logger.sendReqLog("GetSymbolImageURL: ", id + "," + SelectedIndex, 1);
2070
                Data_ = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.GetSymbolImageURL(id, SelectedIndex);
2071
                if (Data_ != null || Data_ != "")
2072
                {
2073
                    Logger.sendResLog("GetSymbolImageURL", "TRUE", 1);
2074
                }
2075
                else
2076
                {
2077
                    Logger.sendResLog("GetSymbolImageURL", "FALSE", 1);
2078
                }
2079

    
2080
                //MARKUP_DATA_GROUP mARKUP_DATA_GROUP = new MARKUP_DATA_GROUP
2081
                //{
2082
                //    SYMBOL_ID = id,//InnerItem.Symbol_ID
2083
                //    STATE = 0,
2084
                //};
2085
                if (Data_ != null)
2086
                {
2087
                    Image img = new Image();
2088
                    //img.Source = new System.Windows.Media.Imaging.BitmapImage(new Uri(Data_));
2089
                    if (Data_.Contains(".svg"))
2090
                    {
2091
                        byte[] imageData = null;
2092
                        DrawingImage image = null;
2093
                        using (System.Net.WebClient web = new System.Net.WebClient())
2094
                        {
2095
                            imageData = web.DownloadData(new Uri(Data_));
2096
                            System.IO.Stream stream = new System.IO.MemoryStream(imageData);
2097
                            image = SvgReader.Load(stream);
2098
                        }
2099
                        img.Source = image;
2100
                    }
2101
                    else
2102
                    {
2103
                        img.Source = new BitmapImage(new Uri(Data_));
2104
                    }
2105

    
2106
                    var currentControl = new MarkupToPDF.Controls.Etc.ImgControl
2107
                    {
2108
                        PointSet = new List<Point>(),
2109
                        FilePath = Data_,
2110
                        ImageData = img.Source,
2111
                        StartPoint = canvasZoomPanningMouseDownPoint,
2112
                        EndPoint = new Point(canvasZoomPanningMouseDownPoint.X + img.Source.Width, 
2113
                        canvasZoomPanningMouseDownPoint.Y + img.Source.Height),
2114
                        TopRightPoint = new Point(canvasZoomPanningMouseDownPoint.X+img.Source.Width,
2115
                        canvasZoomPanningMouseDownPoint.Y),
2116
                        LeftBottomPoint = new Point(canvasZoomPanningMouseDownPoint.X,
2117
                        canvasZoomPanningMouseDownPoint.Y + img.Source.Height)
2118
                    };
2119

    
2120
                    currentControl.PointSet = new List<Point>
2121
                                        {
2122
                                            currentControl.StartPoint,
2123
                                            currentControl.LeftBottomPoint,
2124
                                            currentControl.EndPoint,
2125
                                            currentControl.TopRightPoint,
2126
                                        };
2127
                    Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
2128
                    UndoData = new Undo_data()
2129
                    {
2130
                        IsUndo = false,
2131
                        Event = Event_Type.Create,
2132
                        EventTime = DateTime.Now,
2133
                        Markup_List = new List<Multi_Undo_data>()
2134
                    };
2135
                    ViewerDataModel.Instance.UndoDataList.Where(data1 => data1.IsUndo == true).ToList().ForEach(i =>
2136
                    {
2137
                        ViewerDataModel.Instance.UndoDataList.Remove(i);
2138
                    });
2139

    
2140
                    //multi_Undo_Data = dzMainMenu.Control_Style(currentControl as MarkupToPDF.Common.CommentUserInfo);
2141
                    multi_Undo_Data = Control_Style(currentControl as MarkupToPDF.Common.CommentUserInfo);
2142
                    UndoData.Markup_List.Add(multi_Undo_Data);
2143
                    ViewerDataModel.Instance.UndoDataList.Add(UndoData);
2144

    
2145
                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl as MarkupToPDF.Common.CommentUserInfo);
2146
                    currentControl.CommentID = Commons.shortGuid();
2147
                    currentControl.SymbolID = id;
2148
                    currentControl.GroupID = group_id;
2149
                    currentControl.ApplyTemplate();
2150
                    currentControl.SetImage();
2151

    
2152
                    ViewerDataModel.Instance.MarkupControls_USER.Remove(currentControl as MarkupToPDF.Common.CommentUserInfo);
2153
                    Controls.AdornerFinal final = new Controls.AdornerFinal(currentControl as MarkupToPDF.Common.CommentUserInfo);
2154
                    SelectLayer.Children.Add(final);
2155
                }
2156
            }
2157
            catch (Exception ex)
2158
            {
2159
                this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert(ex.Message, "Error");
2160
            }
2161
        }
2162

    
2163
        private void zoomAndPanControl_MouseDown(object sender, MouseButtonEventArgs e)
2164
        {            
2165
            var set_option = this.ParentOfType<MainWindow>().dzTopMenu.Parent.ChildrenOfType<RadNumericUpDown>().Where(item => item.IsKeyboardFocusWithin).FirstOrDefault();
2166
            if (set_option != null && !string.IsNullOrEmpty(set_option.ContentText))
2167
            {
2168
                set_option.Value = double.Parse(set_option.ContentText);
2169
                //set_option.Focusable = false;
2170
                zoomAndPanControl.Focus();
2171
            }
2172

    
2173
            ConvertInkControlToPolygon();
2174

    
2175
            ///TODO:
2176
            var text_item = ViewerDataModel.Instance.MarkupControls_USER.Where(data =>
2177
            (data as TextControl) != null && (data as TextControl).Text == "" || (data as ArrowTextControl) != null && (data as ArrowTextControl).ArrowText == "").FirstOrDefault();
2178

    
2179
            if (text_item != null && (currentControl as ArrowTextControl) == null)
2180
            {
2181
                ViewerDataModel.Instance.MarkupControls_USER.Remove(text_item);
2182
            }
2183
            /// up to here
2184

    
2185
            foreach (var item in ViewerDataModel.Instance.MarkupControls_USER)
2186
            {
2187
                if (item as ArrowTextControl != null)
2188
                {
2189
                    (item as ArrowTextControl).Base_TextBox.IsHitTestVisible = false;
2190
                }
2191
                else if (item as TextControl != null)
2192
                {
2193
                    (item as TextControl).Base_TextBox.IsHitTestVisible = false;
2194
                }
2195
            }
2196

    
2197
            //if (currentControl != null)
2198
            {
2199
                var text_item_ = ViewerDataModel.Instance.MarkupControls_USER.Where(data => (data as TextControl) != null && (data as TextControl).IsEditingMode == true).FirstOrDefault();
2200
                if (text_item_ != null)
2201
                {
2202
                    (text_item_ as TextControl).Base_TextBlock.Visibility = Visibility.Visible;
2203
                    (text_item_ as TextControl).Base_TextBox.Visibility = Visibility.Collapsed;
2204
                    (text_item_ as TextControl).IsEditingMode = false;                    
2205
                    currentControl = null;
2206
                }
2207

    
2208
                var Arrowtext_item_ = ViewerDataModel.Instance.MarkupControls_USER.Where(data => (data as ArrowTextControl) != null && (data as ArrowTextControl).IsEditingMode == true).FirstOrDefault();
2209
                if (Arrowtext_item_ != null && ((Arrowtext_item_ as ArrowTextControl).IsNew == false))
2210
                {
2211
                    (Arrowtext_item_ as ArrowTextControl).IsEditingMode = false;
2212
                    (Arrowtext_item_ as ArrowTextControl).Base_TextBox.Focusable = false;
2213
                    currentControl = null;
2214
                }
2215
            }
2216

    
2217
            double Ang = 0;                                          
2218
            if (rotate.Angle != 0)
2219
            {
2220
                Ang = 360 - rotate.Angle;
2221
            }
2222

    
2223
            if (e.OriginalSource is System.Windows.Controls.Image)
2224
            {
2225
                (e.OriginalSource as System.Windows.Controls.Image).Focus();
2226
            }
2227
            /*
2228
            if (mouseHandlingMode == MouseHandlingMode.DragSymbol && e.LeftButton == MouseButtonState.Pressed)
2229
            {                
2230
                canvasZoomPanningMouseDownPoint = e.GetPosition(zoomAndPanCanvas);
2231
                if(symbol_id != null)
2232
                {
2233
                    PlaceImageSymbol(symbol_id, symbol_group_id, symbol_SelectedIndex, canvasZoomPanningMouseDownPoint);
2234
                }                
2235
            }
2236

    
2237
            if (mouseHandlingMode == MouseHandlingMode.DragSymbol && e.RightButton == MouseButtonState.Pressed)
2238
            {
2239
                if (this._dragdropWindow != null)
2240
                {
2241
                    this._dragdropWindow.Close();
2242
                    this._dragdropWindow = null;
2243
                    symbol_id = null;
2244
                }
2245
            }
2246
            */
2247

    
2248
            if (e.LeftButton == MouseButtonState.Pressed)
2249
            {
2250
                canvasDrawingMouseDownPoint = e.GetPosition(drawingRotateCanvas);
2251
                canvasZoomPanningMouseDownPoint = e.GetPosition(zoomAndPanCanvas);
2252

    
2253
                this.cursor = new Cursor(MainWindow.CursorChange().StreamSource);
2254
                SetCursor();
2255

    
2256
                if (!ViewerDataModel.Instance.IsPressCtrl) SelectionSet.Instance.UnSelect(this);
2257
            }
2258

    
2259
            if (e.MiddleButton == MouseButtonState.Pressed)
2260
            {
2261
                canvasZoommovingMouseDownPoint = e.GetPosition(zoomAndPanCanvas);
2262
                cursor = Cursors.SizeAll;
2263
                SetCursor();
2264
            }
2265
            if (e.RightButton == MouseButtonState.Pressed)
2266
            {
2267
                canvasZoommovingMouseDownPoint = e.GetPosition(zoomAndPanCanvas);
2268
                cursor = Cursors.SizeAll;
2269
                SetCursor();
2270
            }
2271
            else if (e.XButton1 == MouseButtonState.Pressed)
2272
            {
2273
                if (this.pageNavigator.CurrentPage.PageNumber + 1 <= this.pageNavigator.PageCount)
2274
                {
2275
                    this.pageNavigator.GotoPage(this.pageNavigator.CurrentPage.PageNumber + 1);
2276
                }
2277

    
2278
                //this.pageNavigator.GotoPage(this.pageNavigator._NextPage.PageNumber);
2279

    
2280
            }
2281
            else if (e.XButton2 == MouseButtonState.Pressed)
2282
            {
2283
                if (this.pageNavigator.CurrentPage.PageNumber > 1)
2284
                {
2285
                    this.pageNavigator.GotoPage(this.pageNavigator.CurrentPage.PageNumber - 1);
2286
                }
2287
            }
2288

    
2289
            if (e.LeftButton == MouseButtonState.Pressed && mouseHandlingMode != MouseHandlingMode.Drawing && currentControl == null)
2290
            {
2291
                if (mouseHandlingMode == MouseHandlingMode.Selecting)
2292
                {
2293
                    if (SelectLayer.Children.Count == 0)
2294
                    {
2295
                        isLeftMouseButtonDownOnWindow = true;
2296
                        mouseHandlingMode = MouseHandlingMode.Selecting;
2297
                    }
2298

    
2299
                    if (controlType == ControlType.None)
2300
                    {
2301
                        isLeftMouseButtonDownOnWindow = true;
2302
                    }
2303
                }
2304

    
2305
                /// 캡쳐 모드 설정
2306
                if (mouseHandlingMode == MouseHandlingMode.Capture)
2307
                {
2308
                    dragCaptureBorder.Visibility = Visibility.Visible;
2309
                    isLeftMouseButtonDownOnWindow = true;
2310
                }
2311

    
2312
                /// 줌 모드 설정
2313
                if (mouseHandlingMode == MouseHandlingMode.DragZoom)
2314
                {
2315
                    isLeftMouseButtonDownOnWindow = true;
2316
                }
2317

    
2318
                var control = ViewerDataModel.Instance.MarkupControls_USER.Where(data => data.IsMouseOver).FirstOrDefault();
2319
                if (control != null)
2320
                {
2321
                    AdornerFinal final = null;
2322

    
2323
                    if (!ViewerDataModel.Instance.IsPressCtrl)
2324
                    {
2325
                        /// 기존 selection 해제
2326
                        SelectionSet.Instance.UnSelect(this);
2327

    
2328
                        final = new AdornerFinal(control);
2329

    
2330
                        this.Control_Style(control);
2331

    
2332
                        if ((control as IPath) != null)
2333
                        {
2334
                            if ((control as IPath).LineSize != 0)
2335
                            {
2336
                                ViewerDataModel.Instance.LineSize = (control as IPath).LineSize;
2337
                            }
2338
                        }
2339
                        if ((control as IShapeControl) != null)
2340
                        {
2341
                            if ((control as IShapeControl).Paint == PaintSet.Hatch)
2342
                            {
2343
                                ViewerDataModel.Instance.checkHatchShape = true;
2344
                            }
2345
                            else if ((control as IShapeControl).Paint == PaintSet.Fill)
2346
                            {
2347
                                ViewerDataModel.Instance.checkFillShape = true;
2348
                            }
2349
                            else
2350
                            {
2351
                                ViewerDataModel.Instance.checkHatchShape = false;
2352
                                ViewerDataModel.Instance.checkFillShape = false;
2353
                            }
2354
                            ViewerDataModel.Instance.paintSet = (control as IShapeControl).Paint;
2355
                        }
2356

    
2357
                        ViewerDataModel.Instance.ControlOpacity = control.Opacity;
2358

    
2359
                        if ((control as TextControl) != null)
2360
                        {
2361
                            if(!((control as TextControl).EnableEditing)) {
2362
                                (control as TextControl).EnableEditing = true;
2363
                            }
2364
                            if ((control as TextControl).TextStyle == FontStyles.Italic)
2365
                            {
2366
                                ViewerDataModel.Instance.checkTextStyle = true;
2367
                            }
2368
                            else
2369
                            {
2370
                                ViewerDataModel.Instance.checkTextStyle = false;
2371
                            }
2372
                            if ((control as TextControl).TextWeight == FontWeights.Bold)
2373
                            {
2374
                                ViewerDataModel.Instance.checkTextWeight = true;
2375
                            }
2376
                            else
2377
                            {
2378
                                ViewerDataModel.Instance.checkTextWeight = false;
2379
                            }
2380
                            if ((control as TextControl).UnderLine == TextDecorations.Underline)
2381
                            {
2382
                                ViewerDataModel.Instance.checkUnderLine = true;
2383
                            }
2384
                            else
2385
                            {
2386
                                ViewerDataModel.Instance.checkUnderLine = false;
2387
                            }
2388
                            ViewerDataModel.Instance.TextSize = (control as TextControl).TextSize;
2389
                            ViewerDataModel.Instance.checkHighlight = (control as TextControl).IsHighLight;
2390

    
2391
                        }
2392
                        else if ((control as ArrowTextControl) != null)
2393
                        {
2394
                            if (!((control as ArrowTextControl).EnableEditing))
2395
                            {
2396
                                (control as ArrowTextControl).EnableEditing = true;
2397
                            }
2398
                            if ((control as ArrowTextControl).TextStyle == FontStyles.Italic)
2399
                            {
2400
                                ViewerDataModel.Instance.checkTextStyle = true;
2401
                            }
2402
                            else
2403
                            {
2404
                                ViewerDataModel.Instance.checkTextStyle = false;
2405
                            }
2406
                            if ((control as ArrowTextControl).TextWeight == FontWeights.Bold)
2407
                            {
2408
                                ViewerDataModel.Instance.checkTextWeight = true;
2409
                            }
2410
                            else
2411
                            {
2412
                                ViewerDataModel.Instance.checkTextWeight = false;
2413
                            }
2414
                            if ((control as ArrowTextControl).UnderLine == TextDecorations.Underline)
2415
                            {
2416
                                ViewerDataModel.Instance.checkUnderLine = true;
2417
                            }
2418
                            else
2419
                            {
2420
                                ViewerDataModel.Instance.checkUnderLine = false;
2421
                            }
2422
                            ViewerDataModel.Instance.checkHighlight = (control as ArrowTextControl).isHighLight;
2423
                            ViewerDataModel.Instance.TextSize = (control as ArrowTextControl).TextSize;
2424
                        }
2425
                        else if ((control as RectCloudControl) != null)
2426
                        {
2427
                            ViewerDataModel.Instance.ArcLength = (control as RectCloudControl).ArcLength;
2428
                        }
2429
                        else if ((control as CloudControl) != null)
2430
                        {
2431
                            ViewerDataModel.Instance.ArcLength = (control as CloudControl).ArcLength;
2432
                        }
2433
                    }
2434
                    else
2435
                    {
2436
                        List<CommentUserInfo> comment = SelectionSet.Instance.SelectedItems;
2437
                        SelectionSet.Instance.UnSelect(this);
2438
                        comment.Add(control);
2439

    
2440
                        Control_Style(control);
2441

    
2442
                        final = new AdornerFinal(comment);
2443
                    }
2444

    
2445
                    if (final != null)
2446
                    {
2447
                        this.SelectLayer.Children.Add(final);
2448
                    }
2449
                }              
2450
            }
2451
            else if (mouseHandlingMode == MouseHandlingMode.Drawing)
2452
            {               
2453
                init();
2454
                //강인구 추가(우 클릭 일 경우 커서 변경 하지 않음)
2455
                if (cursor != Cursors.SizeAll)
2456
                {
2457
                    cursor = Cursors.Cross;
2458
                    SetCursor();
2459
                }
2460
                bool init_user = false;
2461
                foreach (var user in gridViewMarkup.Items)
2462
                {
2463
                    if ((user as MarkupInfoItem).UserID == App.ViewInfo.UserID)
2464
                    {
2465
                        init_user = true;
2466
                    }
2467
                }
2468
                if (init_user && gridViewMarkup.SelectedItems.Where(d => (d as MarkupInfoItem).UserID == App.ViewInfo.UserID).FirstOrDefault() == null && e.LeftButton == MouseButtonState.Pressed)
2469
                {
2470
                    RadWindow.Alert(new DialogParameters
2471
                    {
2472
                        Owner = Application.Current.MainWindow,
2473
                        Theme = new VisualStudio2013Theme(),
2474
                        Header = "안내",
2475
                        Content = "기존의 코멘트가 존재합니다. 사용자 리스트에서 먼저 선택해주세요",
2476
                    });
2477
                    return;
2478
                }
2479
                else
2480
                {
2481
                    var item = gridViewMarkup.SelectedItems.Where(d => (d as MarkupInfoItem).UserID == App.ViewInfo.UserID).FirstOrDefault() as MarkupInfoItem;
2482
                    if (item != null)
2483
                    {
2484
                        App.Custom_ViewInfoId = item.MarkupInfoID;
2485
                    }
2486
                }
2487

    
2488
                switch (controlType)
2489
                {
2490
                    case ControlType.Coordinate:
2491
                        {
2492
                            if (e.LeftButton == MouseButtonState.Pressed)
2493
                            {
2494
                                if (currentControl is CoordinateControl)
2495
                                {
2496
                                    if (IsGetoutpoint((currentControl as CoordinateControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
2497
                                    {
2498
                                        return;
2499
                                    }
2500

    
2501
                                    CreateCommand.Instance.Execute(currentControl);
2502

    
2503
                                    currentControl = null;
2504
                                    this.cursor = Cursors.Arrow;
2505
                                }
2506
                                else
2507
                                {
2508
                                    this.ParentOfType<MainWindow>().dzTopMenu._SaveEvent(null, null);
2509
                                    if (ViewerDataModel.Instance.MyMarkupList.Where(d => d.PageNumber == Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber
2510
                                     && d.Data_Type == Convert.ToInt32(MarkupToPDF.Controls.Common.ControlType.Coordinate)).Count() > 0)
2511
                                    {
2512
                                        currentControl = null;
2513
                                        this.cursor = Cursors.Arrow;
2514
                                        Common.ViewerDataModel.Instance.SystemMain.DialogMessage_Alert("이미 해당 페이지의 도면 영역을 설정하셨습니다.", "Notice");
2515
                                        return;
2516
                                    }
2517
                                    else
2518
                                    {
2519
                                        currentControl = new CoordinateControl
2520
                                        {
2521
                                            Background = new SolidColorBrush(Colors.Black),
2522
                                            StartPoint = this.canvasDrawingMouseDownPoint,
2523
                                            ControlType = ControlType.Coordinate
2524
                                        };
2525

    
2526
                                        currentControl.CommentID = Commons.shortGuid();
2527
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
2528
                                        currentControl.IsNew = true;
2529

    
2530
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
2531

    
2532
                                        currentControl.SetValue(Canvas.ZIndexProperty, 3);
2533
                                    }
2534
                                }
2535
                            }
2536
                        }
2537
                        break;
2538
                    case ControlType.InsideWhite:
2539
                        {
2540
                            if (e.LeftButton == MouseButtonState.Pressed)
2541
                            {
2542
                                if (currentControl is InsideWhiteControl)
2543
                                {
2544
                                    if (IsGetoutpoint((currentControl as InsideWhiteControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
2545
                                    {
2546
                                        return;
2547
                                    }
2548

    
2549
                                    CreateCommand.Instance.Execute(currentControl);
2550

    
2551
                                    currentControl = null;
2552
                                    this.cursor = Cursors.Arrow;
2553
                                }
2554
                                else
2555
                                {
2556
                                    currentControl = new InsideWhiteControl
2557
                                    {
2558
                                        Background = new SolidColorBrush(Colors.Black),
2559
                                        StartPoint = this.canvasDrawingMouseDownPoint,
2560
                                        ControlType = ControlType.InsideWhite
2561
                                    };
2562

    
2563
                                    currentControl.CommentID = Commons.shortGuid();
2564
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
2565
                                    currentControl.IsNew = true;
2566
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
2567

    
2568
                                    currentControl.SetValue(Canvas.ZIndexProperty, 3);
2569
                                }
2570
                            }
2571
                        }
2572
                        break;
2573
                    case ControlType.OverlapWhite:
2574
                        {
2575
                            if (e.LeftButton == MouseButtonState.Pressed)
2576
                            {
2577
                                if (currentControl is OverlapWhiteControl)
2578
                                {
2579
                                    if (IsGetoutpoint((currentControl as OverlapWhiteControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
2580
                                    {
2581
                                        return;
2582
                                    }
2583

    
2584
                                    CreateCommand.Instance.Execute(currentControl);
2585

    
2586
                                    currentControl = null;
2587
                                    this.cursor = Cursors.Arrow;
2588
                                }
2589
                                else
2590
                                {
2591
                                    currentControl = new OverlapWhiteControl
2592
                                    {
2593
                                        Background = new SolidColorBrush(Colors.Black),
2594
                                        StartPoint = this.canvasDrawingMouseDownPoint,
2595
                                        ControlType = ControlType.OverlapWhite
2596
                                    };
2597

    
2598
                                    currentControl.CommentID = Commons.shortGuid();
2599
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
2600
                                    currentControl.IsNew = true;
2601
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
2602

    
2603
                                    currentControl.SetValue(Canvas.ZIndexProperty, 3);
2604
                                }
2605
                            }
2606
                        }
2607
                        break;
2608
                    case ControlType.ClipWhite:
2609
                        {
2610
                            if (e.LeftButton == MouseButtonState.Pressed)
2611
                            {
2612
                                if (currentControl is ClipWhiteControl)
2613
                                {
2614
                                    if (IsGetoutpoint((currentControl as ClipWhiteControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
2615
                                    {
2616
                                        return;
2617
                                    }
2618

    
2619
                                    CreateCommand.Instance.Execute(currentControl);
2620

    
2621
                                    currentControl = null;
2622
                                    this.cursor = Cursors.Arrow;
2623
                                }
2624
                                else
2625
                                {
2626
                                    currentControl = new ClipWhiteControl
2627
                                    {
2628
                                        Background = new SolidColorBrush(Colors.Black),
2629
                                        StartPoint = this.canvasDrawingMouseDownPoint,
2630
                                        ControlType = ControlType.ClipWhite
2631
                                    };
2632

    
2633
                                    currentControl.CommentID = Commons.shortGuid();
2634
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
2635
                                    currentControl.IsNew = true;
2636
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
2637

    
2638
                                    currentControl.SetValue(Canvas.ZIndexProperty, 3);
2639
                                }
2640
                            }
2641
                        }
2642
                        break;
2643
                    case ControlType.Rectangle:
2644
                        {
2645
                            if (e.LeftButton == MouseButtonState.Pressed)
2646
                            {
2647
                                if (currentControl is RectangleControl)
2648
                                {
2649
                                    //20180906 LJY TEST IsRotationDrawingEnable
2650
                                    if (IsGetoutpoint((currentControl as RectangleControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
2651
                                    {
2652
                                        return;
2653
                                    }
2654

    
2655
                                    CreateCommand.Instance.Execute(currentControl);
2656
                                    currentControl = null;
2657
                                    this.cursor = new Cursor(MainWindow.CursorChange().StreamSource);
2658
                                }
2659
                                else
2660
                                {
2661
                                    currentControl = new RectangleControl
2662
                                    {
2663
                                        Background = new SolidColorBrush(Colors.Black),
2664
                                        StartPoint = this.canvasDrawingMouseDownPoint,
2665
                                        ControlType = ControlType.Rectangle
2666
                                    };
2667

    
2668
                                    currentControl.CommentID = Commons.shortGuid();
2669
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
2670
                                    currentControl.IsNew = true;
2671
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
2672

    
2673
                                    currentControl.SetValue(Canvas.ZIndexProperty, 3);
2674
                                }
2675
                            }
2676
                        }
2677
                        break;
2678
                    case ControlType.RectCloud:
2679
                        {
2680
                            if (e.LeftButton == MouseButtonState.Pressed)
2681
                            {
2682
                                if (currentControl is RectCloudControl)
2683
                                {
2684
                                    //20180906 LJY TEST IsRotationDrawingEnable
2685
                                    if (IsGetoutpoint((currentControl as RectCloudControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
2686
                                    {
2687
                                        return;
2688
                                    }
2689

    
2690
                                    CreateCommand.Instance.Execute(currentControl);
2691

    
2692
                                    currentControl = null;
2693
                                
2694
                                    this.cursor = new Cursor(MainWindow.CursorChange().StreamSource);
2695
                                }
2696
                                else
2697
                                {
2698
                                    currentControl = new RectCloudControl
2699
                                    {
2700
                                        StartPoint = this.canvasDrawingMouseDownPoint,
2701
                                        ControlType = ControlType.RectCloud,
2702
                                        Background = new SolidColorBrush(Colors.Black)
2703
                                    };
2704

    
2705
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
2706
                                    currentControl.CommentID = Commons.shortGuid();
2707
                                    currentControl.IsNew = true;
2708
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
2709
                                }
2710
                            }
2711
                        }
2712
                        break;
2713
                    case ControlType.Circle:
2714
                        {
2715
                            if (e.LeftButton == MouseButtonState.Pressed)
2716
                            {
2717
                                if (currentControl is CircleControl)
2718
                                {
2719
                                    //20180906 LJY TEST IsRotationDrawingEnable
2720
                                    if (IsGetoutpoint((currentControl as CircleControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
2721
                                    {
2722
                                        return;
2723
                                    }
2724

    
2725
                                    CreateCommand.Instance.Execute(currentControl);
2726

    
2727
                                    currentControl = null;
2728
                                }
2729
                                else
2730
                                {
2731
                                    currentControl = new CircleControl
2732
                                    {
2733
                                        StartPoint = this.canvasDrawingMouseDownPoint,
2734
                                        LeftBottomPoint = this.canvasDrawingMouseDownPoint,
2735
                                        Background = new SolidColorBrush(Colors.Black)
2736
                                    };
2737

    
2738
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
2739
                                    currentControl.CommentID = Commons.shortGuid();
2740
                                    currentControl.IsNew = true;
2741
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
2742
                                }
2743
                            }
2744
                        }
2745
                        break;
2746
                    case ControlType.Triangle:
2747
                        {
2748
                            if (e.LeftButton == MouseButtonState.Pressed)
2749
                            {
2750
                                if (currentControl is TriControl)
2751
                                {
2752
                                    var content = currentControl as TriControl;
2753
                                    if (content.MidPoint == new Point(0, 0))
2754
                                    {
2755
                                        content.MidPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
2756
                                    }
2757
                                    else
2758
                                    {
2759
                                        //20180906 LJY TEST IsRotationDrawingEnable
2760
                                        if (IsGetoutpoint((currentControl as TriControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
2761
                                        {
2762
                                            return;
2763
                                        }
2764

    
2765
                                        CreateCommand.Instance.Execute(currentControl);
2766

    
2767
                                        currentControl = null;
2768
                                    }
2769
                                }
2770
                                else
2771
                                {
2772
                                    currentControl = new TriControl
2773
                                    {
2774
                                        StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y),
2775
                                        Background = new SolidColorBrush(Colors.Black),
2776
                                    };
2777

    
2778
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
2779
                                    currentControl.CommentID = Commons.shortGuid();
2780
                                    currentControl.IsNew = true;
2781
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
2782
                                }
2783
                            }
2784
                        }
2785
                        break;
2786
                    case ControlType.CancelLine:
2787
                    case ControlType.SingleLine:
2788
                    case ControlType.ArrowLine:
2789
                    case ControlType.TwinLine:
2790
                    case ControlType.DimLine:
2791
                        {
2792
                            if (e.LeftButton == MouseButtonState.Pressed)
2793
                            {
2794
                                if (currentControl is LineControl)
2795
                                {
2796
                                    //20180906 LJY TEST IsRotationDrawingEnable
2797
                                    if (IsGetoutpoint((currentControl as LineControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
2798
                                    {
2799
                                        return;
2800
                                    }
2801

    
2802
                                    CreateCommand.Instance.Execute(currentControl);
2803
                                    currentControl = null;
2804
                                    ViewerDataModel.Instance.AngleVisibility = Visibility.Collapsed;
2805
                                }
2806
                                else
2807
                                {
2808
                                    currentControl = new LineControl
2809
                                    {
2810
                                        ControlType = this.controlType,
2811
                                        StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y),
2812
                                        Background = new SolidColorBrush(Colors.Black)
2813
                                    };
2814

    
2815
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
2816
                                    currentControl.CommentID = Commons.shortGuid();
2817
                                    currentControl.IsNew = true;
2818
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
2819
                                    ViewerDataModel.Instance.AngleVisibility = Visibility.Visible;
2820
                                }
2821
                            }
2822
                        }
2823
                        break;
2824
                    case ControlType.PolygonControl:
2825
                        {
2826
                            if (currentControl is PolygonControl)
2827
                            {
2828
                                var control = currentControl as PolygonControl;
2829

    
2830
                                if (e.RightButton == MouseButtonState.Pressed)
2831
                                {
2832
                                    control.IsCompleted = true;
2833
                                }
2834

    
2835
                                if (!control.IsCompleted)
2836
                                {
2837
                                    control.PointSet.Add(control.EndPoint);
2838
                                }
2839
                                else
2840
                                {
2841
                                    //20180906 LJY TEST IsRotationDrawingEnable
2842
                                    if (IsGetoutpoint((currentControl as PolygonControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
2843
                                    {
2844
                                        return;
2845
                                    }
2846

    
2847
                                    var firstPoint = control.PointSet.First();
2848
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
2849
                                    control.LineSize = ViewerDataModel.Instance.LineSize;
2850
                                    control.PointSet.Add(firstPoint);
2851

    
2852
                                    control.ApplyOverViewData();
2853

    
2854
                                    CreateCommand.Instance.Execute(currentControl);
2855
                                    control.UpdateControl();
2856
                                    currentControl = null;
2857
                                }
2858
                            }
2859
                            else
2860
                            {
2861
                                if (e.LeftButton == MouseButtonState.Pressed)
2862
                                {
2863
                                    currentControl = new PolygonControl
2864
                                    {
2865
                                        PointSet = new List<Point>(),
2866
                                    };
2867

    
2868
                                    var polygonControl = (currentControl as PolygonControl);
2869
                                    currentControl.CommentID = Commons.shortGuid();
2870
                                    currentControl.IsNew = true;
2871
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
2872
                                    polygonControl.StartPoint = canvasDrawingMouseDownPoint;
2873
                                    polygonControl.EndPoint = canvasDrawingMouseDownPoint;
2874
                                    polygonControl.PointSet.Add(canvasDrawingMouseDownPoint);
2875
                                    polygonControl.PointSet.Add(canvasDrawingMouseDownPoint);
2876
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
2877
                                    polygonControl.ApplyTemplate();
2878
                                    polygonControl.Visibility = Visibility.Visible;
2879
                                }
2880
                            }
2881
                        }
2882
                        break;
2883
                    case ControlType.ChainLine:
2884
                        {
2885
                            if (currentControl is PolygonControl)
2886
                            {
2887
                                var control = currentControl as PolygonControl;
2888

    
2889
                                if (e.RightButton == MouseButtonState.Pressed)
2890
                                {
2891
                                    //20180906 LJY TEST IsRotationDrawingEnable
2892
                                    if (IsGetoutpoint((currentControl as PolygonControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
2893
                                    {
2894
                                        return;
2895
                                    }
2896

    
2897
                                    CreateCommand.Instance.Execute(currentControl);
2898

    
2899
                                    currentControl = null;
2900
                                    ViewerDataModel.Instance.AngleVisibility = Visibility.Collapsed;
2901
                                    return;
2902
                                }
2903

    
2904
                                if (!control.IsCompleted)
2905
                                {
2906
                                    control.PointSet.Add(control.EndPoint);
2907
                                    ViewerDataModel.Instance.AngleVisibility = Visibility.Visible;
2908
                                }
2909
                            }
2910
                            else
2911
                            {
2912
                                if (e.LeftButton == MouseButtonState.Pressed)
2913
                                {
2914
                                    MainAngle.Visibility = Visibility.Visible;
2915
                                    currentControl = new PolygonControl
2916
                                    {
2917
                                        PointSet = new List<Point>(),
2918
                                        //강인구 추가(ChainLine일때는 채우기 스타일을 주지 않기 위해 설정)
2919
                                        ControlType = ControlType.ChainLine,
2920
                                        DashSize = ViewerDataModel.Instance.DashSize,
2921
                                        LineSize = ViewerDataModel.Instance.LineSize,
2922
                                        //PointC = new StylusPointSet()
2923
                                    };
2924

    
2925
                                    //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
2926
                                    //{
2927
                                        var polygonControl = (currentControl as PolygonControl);
2928
                                        currentControl.CommentID = Commons.shortGuid();
2929
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
2930
                                        currentControl.IsNew = true;
2931
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
2932
                                        //currentControl.OnApplyTemplate();
2933
                                        //polygonControl.PointC.pointSet.Add(canvasDrawingMouseDownPoint);
2934
                                        //polygonControl.PointC.pointSet.Add(canvasDrawingMouseDownPoint);
2935
                                        polygonControl.PointSet.Add(canvasDrawingMouseDownPoint);
2936
                                        polygonControl.PointSet.Add(canvasDrawingMouseDownPoint);
2937
                                    //}
2938
                                }
2939
                            }
2940
                        }
2941
                        break;
2942
                    case ControlType.ArcLine:
2943
                        {
2944
                            if (e.LeftButton == MouseButtonState.Pressed)
2945
                            {
2946
                                if (currentControl is ArcControl)
2947
                                {
2948
                                    //20180906 LJY TEST IsRotationDrawingEnable
2949
                                    if (IsGetoutpoint((currentControl as ArcControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
2950
                                    {
2951
                                        return;
2952
                                    }
2953

    
2954
                                    CreateCommand.Instance.Execute(currentControl);
2955

    
2956
                                    currentControl = null;
2957
                                    ViewerDataModel.Instance.AngleVisibility = Visibility.Collapsed;
2958
                                }
2959
                                else
2960
                                {
2961
                                    currentControl = new ArcControl
2962
                                    {
2963
                                        StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y),
2964
                                        Background = new SolidColorBrush(Colors.Black)
2965
                                    };
2966
                                    currentControl.CommentID = Commons.shortGuid();
2967
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
2968
                                    currentControl.IsNew = true;
2969
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
2970
                                    ViewerDataModel.Instance.AngleVisibility = Visibility.Visible;
2971
                                }
2972
                            }
2973
                            else if (e.RightButton == MouseButtonState.Pressed)
2974
                            {
2975
                                if (currentControl != null)
2976
                                {
2977
                                    (currentControl as ArcControl).setClock();
2978
                                    (currentControl as ArcControl).MidPoint = new Point(0, 0);
2979
                                }
2980
                            }
2981
                        }
2982
                        break;
2983
                    case ControlType.ArcArrow:
2984
                        {
2985
                            if (e.LeftButton == MouseButtonState.Pressed)
2986
                            {
2987
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
2988
                                //{
2989
                                if (currentControl is ArrowArcControl)
2990
                                {
2991
                                    //20180906 LJY TEST IsRotationDrawingEnable
2992
                                    if (IsGetoutpoint((currentControl as ArrowArcControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
2993
                                    {
2994
                                        return;
2995
                                    }
2996

    
2997
                                    CreateCommand.Instance.Execute(currentControl);
2998

    
2999
                                    currentControl = null;
3000
                                    ViewerDataModel.Instance.AngleVisibility = Visibility.Collapsed;
3001
                                }
3002
                                else
3003
                                {
3004
                                    currentControl = new ArrowArcControl
3005
                                    {
3006
                                        StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y),
3007
                                        Background = new SolidColorBrush(Colors.Black)
3008
                                    };
3009
                                    currentControl.CommentID = Commons.shortGuid();
3010
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3011
                                    currentControl.IsNew = true;
3012
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3013
                                    ViewerDataModel.Instance.AngleVisibility = Visibility.Visible;
3014
                                }
3015
                                //}
3016
                            }
3017
                            else if (e.RightButton == MouseButtonState.Pressed)
3018
                            {
3019
                                if (currentControl != null)
3020
                                {
3021
                                    (currentControl as ArrowArcControl).setClock();
3022
                                    (currentControl as ArrowArcControl).MidPoint = new Point(0, 0);
3023
                                    //(currentControl as ArcControl).ApplyTemplate();
3024
                                }
3025
                            }
3026
                        }
3027
                        break;
3028
                    case ControlType.ArrowMultiLine:
3029
                        {
3030
                            if (e.LeftButton == MouseButtonState.Pressed)
3031
                            {
3032
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3033
                                //{
3034

    
3035
                                    if (currentControl is ArrowControl_Multi)
3036
                                    {
3037
                                        var content = currentControl as ArrowControl_Multi;
3038
                                        if (content.MiddlePoint == new Point(0, 0))
3039
                                        {
3040
                                            if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift)
3041
                                            {
3042
                                                content.MiddlePoint = content.EndPoint;
3043
                                            }
3044
                                            else
3045
                                            {
3046
                                                content.MiddlePoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
3047
                                            }
3048
                                        }
3049
                                        else
3050
                                        {
3051
                                            //20180906 LJY TEST IsRotationDrawingEnable
3052
                                            if (IsGetoutpoint((currentControl as ArrowControl_Multi).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3053
                                            {
3054
                                                return;
3055
                                            }
3056

    
3057
                                            CreateCommand.Instance.Execute(currentControl);
3058

    
3059
                                            currentControl = null;
3060
                                            ViewerDataModel.Instance.AngleVisibility = Visibility.Collapsed;
3061
                                        }
3062
                                    }
3063
                                    else
3064
                                    {
3065
                                        currentControl = new ArrowControl_Multi
3066
                                        {
3067
                                            StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y),
3068
                                            Background = new SolidColorBrush(Colors.Black)
3069
                                        };
3070
                                        currentControl.CommentID = Commons.shortGuid();
3071
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3072
                                        currentControl.IsNew = true;
3073
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3074
                                        ViewerDataModel.Instance.AngleVisibility = Visibility.Visible;
3075
                                    }
3076
                                //}
3077
                            }
3078
                        }
3079
                        break;
3080
                    case ControlType.PolygonCloud:
3081
                        {
3082
                            if (currentControl is CloudControl)
3083
                            {
3084
                                var control = currentControl as CloudControl;
3085
                                if (e.RightButton == MouseButtonState.Pressed)
3086
                                {
3087
                                    control.IsCompleted = true;
3088
                                }
3089

    
3090
                                if (!control.IsCompleted)
3091
                                {
3092
                                    control.PointSet.Add(control.EndPoint);
3093
                                }
3094
                                else
3095
                                {
3096
                                    //20180906 LJY TEST IsRotationDrawingEnable
3097
                                    if (IsGetoutpoint((currentControl as CloudControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3098
                                    {
3099
                                        return;
3100
                                    }
3101

    
3102
                                    CreateCommand.Instance.Execute(currentControl);
3103

    
3104
                                    control.isTransOn = true;
3105
                                    var firstPoint = control.PointSet.First();
3106

    
3107
                                    control.PointSet.Add(firstPoint);
3108
                                    control.DrawingCloud();
3109
                                    control.ApplyOverViewData();
3110

    
3111
                                    currentControl = null;
3112
                                }
3113
                            }
3114
                            else
3115
                            {
3116
                                if (e.LeftButton == MouseButtonState.Pressed)
3117
                                {
3118
                                    currentControl = new CloudControl
3119
                                    {
3120
                                        PointSet = new List<Point>(),
3121
                                        PointC = new StylusPointSet()
3122
                                    };
3123

    
3124
                                    //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3125
                                    //{
3126
                                        var polygonControl = (currentControl as CloudControl);
3127
                                        currentControl.CommentID = Commons.shortGuid();
3128
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3129
                                        currentControl.IsNew = true;
3130
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3131

    
3132
                                        polygonControl.PointSet.Add(canvasDrawingMouseDownPoint);
3133
                                        polygonControl.PointSet.Add(canvasDrawingMouseDownPoint);
3134
                                    
3135
                                    //}
3136
                                }
3137
                            }
3138
                        }
3139
                        break;
3140
                    case ControlType.ImgControl:
3141
                        {
3142
                            if (e.LeftButton == MouseButtonState.Pressed)
3143
                            {
3144
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3145
                                //{
3146
                                    if (currentControl is ImgControl)
3147
                                    {
3148
                                        //20180906 LJY TEST IsRotationDrawingEnable
3149
                                        if (IsGetoutpoint((currentControl as ImgControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3150
                                        {
3151
                                            return;
3152
                                        }
3153

    
3154
                                        CreateCommand.Instance.Execute(currentControl);
3155
                                        controlType = ControlType.ImgControl;
3156
                                        currentControl = null;
3157
                                    }
3158
                                    else
3159
                                    {
3160
                                        
3161
                                        string extension = System.IO.Path.GetExtension(filename).ToUpper();
3162
                                        if (extension == ".PNG" || extension == ".JPEG" || extension == ".GIF" || extension == ".BMP" || extension == ".JPG" || extension == ".SVG")
3163
                                        {
3164
                                            Image img = new Image();
3165
                                            if (filename.Contains(".svg"))
3166
                                            {
3167
                                                byte[] imageData = null;
3168
                                                DrawingImage image = null;
3169
                                                using (System.Net.WebClient web = new System.Net.WebClient())
3170
                                                {
3171
                                                    imageData = web.DownloadData(new Uri(filename));
3172
                                                    System.IO.Stream stream = new System.IO.MemoryStream(imageData);
3173
                                                    image = SvgReader.Load(stream);
3174
                                                }
3175
                                                img.Source = image;
3176
                                            }
3177
                                            else
3178
                                            {
3179
                                                img.Source = new BitmapImage(new Uri(filename));
3180
                                            }
3181

    
3182
                                            currentControl = new ImgControl
3183
                                            {
3184
                                                    Background = new SolidColorBrush(Colors.Black),
3185
                                                    PointSet = new List<Point>(),
3186
                                                    FilePath = filename,
3187
                                                    ImageData = img.Source,
3188
                                                    StartPoint = canvasDrawingMouseDownPoint,
3189
                                                    EndPoint = new Point(canvasDrawingMouseDownPoint.X + 100, canvasDrawingMouseDownPoint.Y + 100),
3190
                                                    TopRightPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y + 100),
3191
                                                    LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X + 100, canvasDrawingMouseDownPoint.Y),
3192
                                                    ControlType = ControlType.ImgControl
3193
                                                };
3194

    
3195
                                        
3196
                                                currentControl.CommentID = Commons.shortGuid();                                            
3197
                                                currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3198
                                                currentControl.IsNew = true;
3199
                                                ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3200

    
3201
                                                //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정  
3202
                                                (currentControl as ImgControl).Angle -= rotate.Angle;
3203
                                        }
3204
                                    }
3205
                                //}
3206
                            }
3207
                        }
3208
                        break;
3209
                    case ControlType.Date:
3210
                        {
3211
                            if (e.LeftButton == MouseButtonState.Pressed)
3212
                            {
3213
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3214
                                //{
3215
                                    if (currentControl is DateControl)
3216
                                    {
3217
                                        //20180906 LJY TEST IsRotationDrawingEnable
3218
                                        if (IsGetoutpoint((currentControl as DateControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3219
                                        {
3220
                                            return;
3221
                                        }
3222

    
3223
                                        CreateCommand.Instance.Execute(currentControl);
3224
                                        currentControl = null;
3225

    
3226
                                        if (Common.ViewerDataModel.Instance.SelectedControl == "Batch")
3227
                                        {
3228
                                            controlType = ControlType.None;
3229
                                            IsSwingMode = false;
3230
                                            Common.ViewerDataModel.Instance.SelectedControl = "";
3231
                                            Common.ViewerDataModel.Instance.ControlTag = null;
3232
                                            mouseHandlingMode = MouseHandlingMode.None;
3233
                                            this.ParentOfType<MainWindow>().dzTopMenu.btn_Batch.IsChecked = false;
3234
                                            txtBatch.Visibility = Visibility.Collapsed;
3235

    
3236
                                        }
3237
                                    }
3238
                                    else
3239
                                    {
3240
                                        currentControl = new DateControl
3241
                                        {
3242
                                            StartPoint = canvasDrawingMouseDownPoint,
3243
                                            Background = new SolidColorBrush(Colors.Black)
3244
                                        };
3245
                                        currentControl.CommentID = Commons.shortGuid();
3246
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3247
                                        currentControl.IsNew = true;
3248
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3249

    
3250
                                        //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 
3251
                                        (currentControl as DateControl).Angle -= rotate.Angle;
3252
                                }
3253
                                //}
3254
                            }
3255
                        }
3256
                        break;
3257
                    case ControlType.TextControl:
3258
                        {
3259
                            if (e.LeftButton == MouseButtonState.Pressed)
3260
                            {
3261
                                if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3262
                                {
3263
                                    currentControl = new TextControl
3264
                                    {
3265
                                        ControlType = controlType
3266
                                    };
3267
                                    (currentControl as TextControl).TextSize = ViewerDataModel.Instance.TextSize;
3268
                                    currentControl.CommentID = Commons.shortGuid();
3269
                                    currentControl.IsNew = true;
3270
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3271
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3272
                                    currentControl.SetValue(Canvas.ZIndexProperty, 3);
3273

    
3274
                                    currentControl.SetValue(TextControl.CanvasXProperty, canvasDrawingMouseDownPoint.X);
3275
                                    currentControl.SetValue(TextControl.CanvasYProperty, canvasDrawingMouseDownPoint.Y);
3276
                                    
3277
                                    (currentControl as TextControl).ControlType_No = 0;
3278
                                    (currentControl as TextControl).Angle -= rotate.Angle;
3279
                                    (currentControl as TextControl).IsHighLight = ViewerDataModel.Instance.checkHighShape;
3280
                                    (currentControl as TextControl).ApplyTemplate();
3281
                                    (currentControl as TextControl).Base_TextBox.Focus();
3282
                                    (currentControl as TextControl).SetFontFamily(new FontFamily(this.ParentOfType<MainWindow>().dzTopMenu.comboFontFamily.Text));
3283
                                    CreateCommand.Instance.Execute(currentControl);
3284
                                }
3285
                            }
3286
                        }
3287
                        break;
3288
                    case ControlType.TextBorder:
3289
                        {
3290
                            if (e.LeftButton == MouseButtonState.Pressed)
3291
                            {
3292
                                if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3293
                                {
3294
                                    currentControl = new TextControl
3295
                                    {
3296
                                        ControlType = controlType
3297
                                    };
3298

    
3299
                                    (currentControl as TextControl).TextSize = ViewerDataModel.Instance.TextSize;
3300
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3301
                                    currentControl.CommentID = Commons.shortGuid();
3302
                                    currentControl.IsNew = true;
3303
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3304
                                    currentControl.SetValue(Canvas.ZIndexProperty, 3);
3305
                                    currentControl.SetValue(TextControl.CanvasXProperty, canvasDrawingMouseDownPoint.X);
3306
                                    currentControl.SetValue(TextControl.CanvasYProperty, canvasDrawingMouseDownPoint.Y);
3307
                                    
3308
                                    (currentControl as TextControl).ControlType_No = 1;
3309
                                    (currentControl as TextControl).Angle = Ang;
3310
                                    (currentControl as TextControl).IsHighLight = ViewerDataModel.Instance.checkHighShape;
3311
                                    (currentControl as TextControl).ApplyTemplate();
3312
                                    (currentControl as TextControl).Base_TextBox.Focus();
3313
                                    (currentControl as TextControl).SetFontFamily(new FontFamily(this.ParentOfType<MainWindow>().dzTopMenu.comboFontFamily.Text));
3314
                                    CreateCommand.Instance.Execute(currentControl);
3315
                                }
3316
                            }
3317
                        }
3318
                        break;
3319
                    case ControlType.TextCloud:
3320
                        {
3321
                            if (e.LeftButton == MouseButtonState.Pressed)
3322
                            {
3323
                                if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3324
                                {
3325
                                    currentControl = new TextControl
3326
                                    {
3327
                                        ControlType = controlType
3328
                                    };
3329

    
3330
                                    (currentControl as TextControl).TextSize = ViewerDataModel.Instance.TextSize;
3331
                                    currentControl.CommentID = Commons.shortGuid();
3332
                                    currentControl.IsNew = true;
3333
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3334
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3335

    
3336
                                    currentControl.SetValue(Canvas.ZIndexProperty, 3);
3337
                                    currentControl.SetValue(TextControl.CanvasXProperty, canvasDrawingMouseDownPoint.X);
3338
                                    currentControl.SetValue(TextControl.CanvasYProperty, canvasDrawingMouseDownPoint.Y);                                    
3339

    
3340
                                    (currentControl as TextControl).Angle = Ang;
3341
                                    (currentControl as TextControl).ControlType_No = 2;
3342
                                    (currentControl as TextControl).IsHighLight = ViewerDataModel.Instance.checkHighShape;
3343
                                    (currentControl as TextControl).ApplyTemplate();
3344
                                    (currentControl as TextControl).Base_TextBox.Focus();
3345
                                    CreateCommand.Instance.Execute(currentControl);
3346
                                    (currentControl as TextControl).SetFontFamily(new FontFamily(this.ParentOfType<MainWindow>().dzTopMenu.comboFontFamily.Text));
3347
                                    //currentControl = null;
3348
                                }
3349
                            }
3350
                        }
3351
                        break;
3352
                    case ControlType.ArrowTextControl:
3353
                         {
3354
                            if (e.LeftButton == MouseButtonState.Pressed)
3355
                            {
3356
                                if (currentControl is ArrowTextControl)
3357
                                {
3358
                                    //20180906 LJY TEST IsRotationDrawingEnable
3359
                                    if (IsGetoutpoint((currentControl as ArrowTextControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3360
                                    {
3361
                                        return;
3362
                                    }
3363

    
3364
                                    CreateCommand.Instance.Execute(currentControl);
3365

    
3366
                                    (currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false;
3367
                                    (currentControl as ArrowTextControl).EnableEditing = false;
3368
                                    (currentControl as ArrowTextControl).IsNew = false;
3369
                                    currentControl = null;
3370
                                }
3371
                                else
3372
                                {
3373
                                    //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3374
                                    //{
3375
                                        currentControl = new ArrowTextControl();
3376
                                        currentControl.CommentID = Commons.shortGuid();
3377
                                        currentControl.IsNew = true;
3378
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3379
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3380

    
3381
                                        currentControl.SetValue(Canvas.ZIndexProperty, 3);
3382
                                        currentControl.SetValue(ArrowTextControl.StartPointProperty, canvasDrawingMouseDownPoint);
3383
                                        currentControl.SetValue(ArrowTextControl.EndPointProperty, canvasDrawingMouseDownPoint);
3384
                                        (currentControl as ArrowTextControl).TextSize = ViewerDataModel.Instance.TextSize;
3385
                                        (currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape;
3386

    
3387
                                        //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 
3388
                                        (currentControl as ArrowTextControl).Angle -= rotate.Angle;
3389

    
3390
                                        (currentControl as ArrowTextControl).ApplyTemplate();
3391
                                        (currentControl as ArrowTextControl).Base_TextBox.Focus();
3392
                                        (currentControl as ArrowTextControl).SetFontFamily(new FontFamily(this.ParentOfType<MainWindow>().dzTopMenu.comboFontFamily.Text));
3393
                                        ViewerDataModel.Instance.AngleVisibility = Visibility.Visible;
3394

    
3395
                                    
3396
                                    //}
3397
                                }
3398
                            }
3399
                        }
3400
                        break;
3401
                    case ControlType.ArrowTransTextControl:
3402
                        {
3403
                            if (e.LeftButton == MouseButtonState.Pressed)
3404
                            {
3405
                                if (currentControl is ArrowTextControl)
3406
                                {
3407
                                    //20180906 LJY TEST IsRotationDrawingEnable
3408
                                    if (IsGetoutpoint((currentControl as ArrowTextControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3409
                                    {
3410
                                        return;
3411
                                    }
3412

    
3413
                                    CreateCommand.Instance.Execute(currentControl);
3414

    
3415
                                    (currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false;
3416
                                    
3417
                                    currentControl.IsNew = false;
3418
                                    currentControl = null;
3419
                                    ViewerDataModel.Instance.AngleVisibility = Visibility.Collapsed;
3420
                                }
3421
                                else
3422
                                {
3423
                                    //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3424
                                    //{
3425
                                    currentControl = new ArrowTextControl()
3426
                                    {
3427
                                        ControlType = ControlType.ArrowTransTextControl
3428
                                    };
3429
                                    currentControl.CommentID = Commons.shortGuid();
3430
                                    currentControl.IsNew = true;
3431
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3432
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3433
                                    currentControl.SetValue(Canvas.ZIndexProperty, 3);
3434
                                    currentControl.SetValue(ArrowTextControl.StartPointProperty, canvasDrawingMouseDownPoint);
3435
                                    currentControl.SetValue(ArrowTextControl.EndPointProperty, canvasDrawingMouseDownPoint);                  
3436
                                    (currentControl as ArrowTextControl).TextSize = ViewerDataModel.Instance.TextSize;
3437
                                    (currentControl as ArrowTextControl).isFixed = true;
3438
                                    (currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape;
3439

    
3440
                                    //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 
3441
                                    (currentControl as ArrowTextControl).Angle -= rotate.Angle;
3442

    
3443
                                    (currentControl as ArrowTextControl).ApplyTemplate();
3444
                                    (currentControl as ArrowTextControl).Base_TextBox.Focus();
3445
                                    (currentControl as ArrowTextControl).isTrans = true;
3446
                                    (currentControl as ArrowTextControl).SetFontFamily(new FontFamily(this.ParentOfType<MainWindow>().dzTopMenu.comboFontFamily.Text));
3447
                                }
3448
                            }
3449
                        }
3450
                        break;
3451
                    case ControlType.ArrowTextBorderControl:
3452
                         {
3453
                            if (e.LeftButton == MouseButtonState.Pressed)
3454
                            {
3455
                                if (currentControl is ArrowTextControl)
3456
                                {
3457
                                    //20180906 LJY TEST IsRotationDrawingEnable
3458
                                    if (IsGetoutpoint((currentControl as ArrowTextControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3459
                                    {
3460
                                        return;
3461
                                    }
3462

    
3463
                                    CreateCommand.Instance.Execute(currentControl);
3464
                                    (currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false;
3465
                                    currentControl.IsNew = false;
3466
                                    currentControl = null;
3467
                                    ViewerDataModel.Instance.AngleVisibility = Visibility.Collapsed;
3468
                                }
3469
                                else
3470
                                {
3471
                                    //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3472
                                    //{
3473
                                        currentControl = new ArrowTextControl()
3474
                                        {
3475
                                            ArrowTextStyle = MarkupToPDF.Controls.Text.ArrowTextControl.ArrowTextStyleSet.Rect
3476
                                        };
3477
                                        currentControl.CommentID = Commons.shortGuid();
3478
                                        currentControl.IsNew = true;
3479
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3480
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3481

    
3482
                                        currentControl.SetValue(Canvas.ZIndexProperty, 3);
3483

    
3484
                                        currentControl.SetValue(ArrowTextControl.StartPointProperty, canvasDrawingMouseDownPoint);
3485

    
3486
                                        currentControl.SetValue(ArrowTextControl.EndPointProperty, canvasDrawingMouseDownPoint);
3487
                                        (currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape;
3488
                                        (currentControl as ArrowTextControl).TextSize = ViewerDataModel.Instance.TextSize;
3489
                                        (currentControl as ArrowTextControl).SetFontFamily(new FontFamily(this.ParentOfType<MainWindow>().dzTopMenu.comboFontFamily.Text));
3490
                                        //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 
3491
                                        (currentControl as ArrowTextControl).Angle -= rotate.Angle;
3492
                                        (currentControl as ArrowTextControl).ApplyTemplate();
3493
                                        (currentControl as ArrowTextControl).Base_TextBox.Focus();
3494
                                        ViewerDataModel.Instance.AngleVisibility = Visibility.Visible;                                    
3495
                                    //}
3496
                                }
3497
                            }
3498
                        }
3499
                        break;
3500
                    case ControlType.ArrowTransTextBorderControl:
3501
                        {
3502
                            if (e.LeftButton == MouseButtonState.Pressed)
3503
                            {
3504
                                if (currentControl is ArrowTextControl)
3505
                                {
3506
                                    //20180906 LJY TEST IsRotationDrawingEnable
3507
                                    if (IsGetoutpoint((currentControl as ArrowTextControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3508
                                    {
3509
                                        return;
3510
                                    }
3511
                                    CreateCommand.Instance.Execute(currentControl);
3512
                                    (currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false;
3513
                                    currentControl.IsNew = false;
3514
                                    currentControl = null;
3515

    
3516
                                    ViewerDataModel.Instance.AngleVisibility = Visibility.Collapsed;
3517
                                }
3518
                                else
3519
                                {
3520
                                    //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3521
                                    //{
3522
                                    
3523

    
3524
                                    currentControl = new ArrowTextControl()
3525
                                    {
3526
                                        ArrowTextStyle = MarkupToPDF.Controls.Text.ArrowTextControl.ArrowTextStyleSet.Rect,
3527
                                        ControlType = ControlType.ArrowTransTextBorderControl
3528

    
3529
                                    };
3530
                                        currentControl.CommentID = Commons.shortGuid();
3531
                                        currentControl.IsNew = true;
3532
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3533
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3534

    
3535
                                        currentControl.SetValue(Canvas.ZIndexProperty, 3);
3536

    
3537
                                        currentControl.SetValue(ArrowTextControl.StartPointProperty, canvasDrawingMouseDownPoint);
3538
                                        currentControl.SetValue(ArrowTextControl.EndPointProperty, canvasDrawingMouseDownPoint);                                    
3539
                                        (currentControl as ArrowTextControl).TextSize = ViewerDataModel.Instance.TextSize;
3540
                                        (currentControl as ArrowTextControl).isFixed = true;
3541
                                        (currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape;
3542
                                     
3543
                                        //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정  
3544
                                        (currentControl as ArrowTextControl).Angle -= rotate.Angle;
3545
                                        (currentControl as ArrowTextControl).ApplyTemplate();
3546
                                        (currentControl as ArrowTextControl).SetFontFamily(new FontFamily(this.ParentOfType<MainWindow>().dzTopMenu.comboFontFamily.Text));
3547
                                        (currentControl as ArrowTextControl).Base_TextBox.Focus();                                 
3548
                                        ViewerDataModel.Instance.AngleVisibility = Visibility.Visible;
3549
                                    
3550
                                    //20180911 LJY
3551
                                        (currentControl as ArrowTextControl).isTrans = true;
3552
                                    
3553

    
3554
                                    //}
3555
                                }
3556
                            }
3557
                        }
3558
                        break;
3559
                    case ControlType.ArrowTextCloudControl:
3560
                        {
3561
                            if (e.LeftButton == MouseButtonState.Pressed)
3562
                            {
3563
                                if (currentControl is ArrowTextControl)
3564
                                {
3565
                                    //20180906 LJY TEST IsRotationDrawingEnable
3566
                                    if (IsGetoutpoint((currentControl as ArrowTextControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3567
                                    {
3568
                                        return;
3569
                                    }
3570
                                    CreateCommand.Instance.Execute(currentControl);
3571
                                    (currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false;
3572
                                    currentControl.IsNew = false;
3573
                                    currentControl = null;
3574
                                    ViewerDataModel.Instance.AngleVisibility = Visibility.Collapsed;
3575
                                }
3576
                                else
3577
                                {
3578
                                    //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3579
                                    //{
3580
                                        currentControl = new ArrowTextControl()
3581
                                        {
3582
                                            ArrowTextStyle = MarkupToPDF.Controls.Text.ArrowTextControl.ArrowTextStyleSet.Cloud
3583
                                        };
3584
                                        currentControl.CommentID = Commons.shortGuid();
3585
                                        currentControl.IsNew = true;
3586
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3587
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3588

    
3589
                                        currentControl.SetValue(Canvas.ZIndexProperty, 3);
3590
                                        currentControl.SetValue(ArrowTextControl.StartPointProperty, canvasDrawingMouseDownPoint);
3591
                                        currentControl.SetValue(ArrowTextControl.EndPointProperty, canvasDrawingMouseDownPoint);                                 
3592
                                        (currentControl as ArrowTextControl).TextSize = ViewerDataModel.Instance.TextSize;
3593
                                        (currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape;
3594
                                        (currentControl as ArrowTextControl).SetFontFamily(new FontFamily(this.ParentOfType<MainWindow>().dzTopMenu.comboFontFamily.Text));
3595
                                        //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정  
3596
                                        (currentControl as ArrowTextControl).Angle -= rotate.Angle;
3597
                                    
3598
                                        (currentControl as ArrowTextControl).ApplyTemplate();
3599
                                        (currentControl as ArrowTextControl).Base_TextBox.Focus();
3600
                                        ViewerDataModel.Instance.AngleVisibility = Visibility.Visible;                                        
3601
                                    //}
3602
                                }
3603
                            }
3604
                        }
3605
                        break;
3606
                    case ControlType.ArrowTransTextCloudControl:
3607
                        {
3608
                            if (e.LeftButton == MouseButtonState.Pressed)
3609
                            {
3610
                                if (currentControl is ArrowTextControl)
3611
                                {
3612
                                    //20180906 LJY TEST IsRotationDrawingEnable
3613
                                    if (IsGetoutpoint((currentControl as ArrowTextControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3614
                                    {
3615
                                        return;
3616
                                    }
3617
                                    CreateCommand.Instance.Execute(currentControl);
3618
                                    (currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false;
3619
                                    currentControl.IsNew = false;
3620
                                    currentControl = null;
3621
                                    ViewerDataModel.Instance.AngleVisibility = Visibility.Collapsed;
3622
                                }
3623
                                else
3624
                                {
3625
                                    //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3626
                                    //{
3627
                                        currentControl = new ArrowTextControl()
3628
                                        {
3629
                                            ArrowTextStyle = MarkupToPDF.Controls.Text.ArrowTextControl.ArrowTextStyleSet.Cloud,
3630
                                            ControlType = ControlType.ArrowTransTextCloudControl
3631

    
3632
                                        };
3633
                                        currentControl.CommentID = Commons.shortGuid();
3634
                                        currentControl.IsNew = true; 
3635
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3636
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3637
                                        currentControl.SetValue(Canvas.ZIndexProperty, 3);
3638

    
3639
                                        currentControl.SetValue(ArrowTextControl.StartPointProperty, canvasDrawingMouseDownPoint);
3640
                                        currentControl.SetValue(ArrowTextControl.EndPointProperty, canvasDrawingMouseDownPoint);                                        
3641
                                        (currentControl as ArrowTextControl).TextSize = ViewerDataModel.Instance.TextSize;
3642
                                        (currentControl as ArrowTextControl).isFixed = true;
3643
                                        (currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape;
3644

    
3645
                                        //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 
3646
                                        (currentControl as ArrowTextControl).Angle -= rotate.Angle;
3647
                                        (currentControl as ArrowTextControl).SetFontFamily(new FontFamily(this.ParentOfType<MainWindow>().dzTopMenu.comboFontFamily.Text));
3648
                                        (currentControl as ArrowTextControl).ApplyTemplate();
3649
                                        (currentControl as ArrowTextControl).Base_TextBox.Focus();
3650
                                        ViewerDataModel.Instance.AngleVisibility = Visibility.Visible;  
3651
                                    
3652
                                    //20180911 LJY
3653
                                        (currentControl as ArrowTextControl).isTrans = true;
3654
                                    //}
3655
                                }
3656
                            }
3657
                        }
3658
                        break;
3659
                    //강인구 추가
3660
                    case ControlType.Sign:
3661
                        {
3662
                            if (e.LeftButton == MouseButtonState.Pressed)
3663
                            {
3664
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3665
                                //{
3666
                                    var _sign = GetUserSign.GetSign(App.ViewInfo.UserID, App.ViewInfo.ProjectNO,App.isExternal);
3667

    
3668
                                    if (_sign == null)
3669
                                    {
3670
                                        txtBatch.Visibility = Visibility.Collapsed;
3671
                                        mouseHandlingMode = IKCOM.MouseHandlingMode.None;
3672
                                        controlType = ControlType.None;
3673

    
3674
                                        this.ParentOfType<MainWindow>().DialogMessage_Alert("등록된 Sign이 없습니다.", "Alert");
3675
                                        this.ParentOfType<MainWindow>().ChildrenOfType<RadToggleButton>().Where(data => data.IsChecked == true).FirstOrDefault().IsChecked = false;
3676
                                        return;
3677
                                    }
3678

    
3679
                                    if (currentControl is SignControl)
3680
                                    {
3681
                                        //20180906 LJY TEST IsRotationDrawingEnable
3682
                                        if (IsGetoutpoint((currentControl as SignControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3683
                                        {
3684
                                            return;
3685
                                        }
3686

    
3687
                                        CreateCommand.Instance.Execute(currentControl);
3688
                                        currentControl = null;
3689
                                        if (Common.ViewerDataModel.Instance.SelectedControl == "Batch")
3690
                                        {
3691
                                            txtBatch.Text = "Place Date";
3692
                                            controlType = ControlType.Date;
3693
                                        }
3694
                                    }
3695
                                    else
3696
                                    {
3697
                                        currentControl = new SignControl
3698
                                        {
3699
                                            Background = new SolidColorBrush(Colors.Black),
3700
                                            UserNumber = App.ViewInfo.UserID,
3701
                                            ProjectNO = App.ViewInfo.ProjectNO,
3702
                                            StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y),
3703
                                            EndPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y),
3704
                                            ControlType = ControlType.Sign
3705
                                        };
3706

    
3707
                                        currentControl.CommentID = Commons.shortGuid();
3708
                                        currentControl.IsNew = true;
3709
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3710
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3711

    
3712
                                        //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 
3713
                                        (currentControl as SignControl).Angle -= rotate.Angle;                                    
3714
                                }
3715
                                //}
3716
                            }
3717
                        }
3718
                        break;
3719
                    case ControlType.Mark:
3720
                        {
3721
                            if (e.LeftButton == MouseButtonState.Pressed)
3722
                            {
3723
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3724
                                //{
3725
                                    if (currentControl is RectangleControl)
3726
                                    {
3727
                                        //20180906 LJY TEST IsRotationDrawingEnable
3728
                                        if (IsGetoutpoint((currentControl as RectangleControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3729
                                        {
3730
                                            return;
3731
                                        }
3732

    
3733
                                        CreateCommand.Instance.Execute(currentControl);
3734
                                        (currentControl as RectangleControl).ApplyOverViewData();
3735
                                        currentControl = null;
3736
                                    
3737
                                        this.cursor = new Cursor(MainWindow.CursorChange().StreamSource);
3738

    
3739
                                        if (Common.ViewerDataModel.Instance.SelectedControl == "Batch")
3740
                                        {
3741
                                            txtBatch.Text = "Place Signature";
3742
                                            controlType = ControlType.Sign;
3743
                                        }
3744
                                    }
3745
                                    else
3746
                                    {
3747
                                        currentControl = new RectangleControl
3748
                                        {
3749
                                            StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y),
3750
                                            Background = new SolidColorBrush(Colors.Black),
3751
                                            ControlType = ControlType.Mark ,
3752
                                            Paint = PaintSet.Fill
3753
                                        };
3754

    
3755
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3756
                                        currentControl.CommentID = Commons.shortGuid();
3757
                                        currentControl.IsNew = true;
3758
                                        (currentControl as RectangleControl).DashSize = ViewerDataModel.Instance.DashSize;
3759
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3760
                                    }
3761
                                //}
3762
                            }
3763
                        }
3764
                        break;
3765
                    case ControlType.Symbol:
3766
                        {
3767
                            if (e.LeftButton == MouseButtonState.Pressed)
3768
                            {
3769
                                if (currentControl is SymControl)
3770
                                {
3771
                                    //20180906 LJY TEST IsRotationDrawingEnable
3772
                                    if (IsGetoutpoint((currentControl as SymControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3773
                                    {
3774
                                        return;
3775
                                    }
3776
                                    CreateCommand.Instance.Execute(currentControl);
3777
                                    currentControl = null;
3778
                                
3779
                                    this.cursor = new Cursor(MainWindow.CursorChange().StreamSource);
3780
                                }
3781
                                else
3782
                                {
3783
                                    currentControl = new SymControl
3784
                                    {
3785
                                        StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y),
3786
                                        Background = new SolidColorBrush(Colors.Black),
3787
                                        LineSize = ViewerDataModel.Instance.LineSize + 3,
3788
                                        ControlType = ControlType.Symbol
3789
                                    };
3790

    
3791
                                    currentControl.IsNew = true;
3792
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3793
                                    currentControl.CommentID = Commons.shortGuid();
3794
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3795

    
3796
                                    //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정  
3797
                                    (currentControl as SymControl).Angle -= rotate.Angle;
3798
                                }
3799
                                //}
3800
                            }
3801
                        }
3802
                        break;
3803
                    case ControlType.Stamp:
3804
                        {
3805
                            if (e.LeftButton == MouseButtonState.Pressed)
3806
                            {
3807
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3808
                                //{
3809
                                    if (currentControl is SymControlN)
3810
                                    {
3811
                                        //20180906 LJY TEST IsRotationDrawingEnable
3812
                                        if (IsGetoutpoint((currentControl as SymControlN).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3813
                                        {
3814
                                            return;
3815
                                        }
3816

    
3817
                                        CreateCommand.Instance.Execute(currentControl);
3818
                                        currentControl = null;
3819
                                   
3820

    
3821
                                    this.cursor = new Cursor(MainWindow.CursorChange().StreamSource);
3822
                                    }
3823
                                    else
3824
                                    {
3825
                                        currentControl = new SymControlN
3826
                                        {
3827
                                            StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y),
3828
                                            Background = new SolidColorBrush(Colors.Black),
3829
                                            STAMP = App.SystemInfo.STAMP,                                            
3830
                                            ControlType = ControlType.Stamp
3831
                                        };
3832

    
3833
                                        currentControl.IsNew = true;
3834
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3835
                                        currentControl.CommentID = Commons.shortGuid();
3836
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3837
                                        //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정  
3838
                                        (currentControl as SymControlN).Angle -= rotate.Angle;
3839
                                }                                    
3840
                                //}
3841
                            }
3842
                        }
3843
                        break;
3844
                    case ControlType.PenControl:
3845
                        {
3846
                            if (inkBoard.Tag.ToString() == "Ink")
3847
                            {
3848
                                inkBoard.IsEnabled = true;
3849
                                StartNewStroke(canvasDrawingMouseDownPoint);
3850
                            }
3851
                            else if (inkBoard.Tag.ToString() == "EraseByPoint")
3852
                            {
3853
                                RemovePointStroke(canvasDrawingMouseDownPoint);
3854
                            }
3855
                            else if (inkBoard.Tag.ToString() == "EraseByStroke")
3856
                            {
3857
                                RemoveLineStroke(canvasDrawingMouseDownPoint);
3858
                            }
3859
                            IsDrawing = true;
3860
                            return;
3861
                        }
3862
                    default:
3863
                        if (currentControl != null)
3864
                        {
3865
                            currentControl.CommentID = null;
3866
                            currentControl.IsNew = false;
3867
                        }
3868
                        break;
3869
                }
3870
            }
3871
            if (mouseHandlingMode != MouseHandlingMode.None && e.LeftButton == MouseButtonState.Pressed)
3872
            {
3873
                if (mouseHandlingMode == MouseHandlingMode.Adorner && SelectLayer.Children.Count > 0)
3874
                {
3875
                    bool mouseOff = false;
3876
                    foreach (var item in SelectLayer.Children)
3877
                    {
3878
                        if (item is AdornerFinal)
3879
                        {
3880

    
3881
                            var over = (item as AdornerFinal).Members.Where(data => data.DrawingData.IsMouseOver).FirstOrDefault();
3882
                            if (over != null)
3883
                            {
3884
                                mouseOff = true;
3885
                            }
3886
                        }
3887
                    }
3888

    
3889
                    if (!mouseOff)
3890
                    {
3891
                        SelectionSet.Instance.UnSelect(this);
3892
                    }
3893
                }
3894
                zoomAndPanControl.CaptureMouse();
3895
                e.Handled = true;
3896
            }
3897
          
3898
        }
3899

    
3900
        private void zoomAndPanControl2_MouseDown(object sender, MouseButtonEventArgs e)
3901
        {
3902
            ///mouseButtonDown = e.ChangedButton;
3903
            canvasZoommovingMouseDownPoint = e.GetPosition(zoomAndPanCanvas2);
3904
        }
3905

    
3906
        private void RemoveLineStroke(Point P)
3907
        {
3908
            var control = ViewerDataModel.Instance.MarkupControls_USER.Where(data => data.IsMouseOver).FirstOrDefault();
3909
            if (control != null)
3910
            {
3911
                DeleteCommand.Instance.Execute(new List<CommentUserInfo>() { control });
3912
            }
3913
        }
3914

    
3915
        private void RemovePointStroke(Point P)
3916
        {
3917
            foreach (Stroke hits in inkBoard.Strokes)
3918
            {
3919
                foreach (StylusPoint sty in hits.StylusPoints)
3920
                {
3921

    
3922
                }
3923
                if (hits.HitTest(P))
3924
                {
3925
                    inkBoard.Strokes.Remove(hits);
3926
                    return;
3927
                }
3928
            }
3929
        }
3930

    
3931
        private void StartNewStroke(Point P)
3932
        {
3933
            strokePoints = new StylusPointCollection();
3934
            StylusPoint segment1Start = new StylusPoint(P.X, P.Y);
3935
            strokePoints.Add(segment1Start);
3936
            stroke = new Stroke(strokePoints);
3937

    
3938
            stroke.DrawingAttributes.Color = Colors.Red;
3939
            stroke.DrawingAttributes.Width = 4;
3940
            stroke.DrawingAttributes.Height = 4;
3941

    
3942
            inkBoard.Strokes.Add(stroke);
3943
        }
3944

    
3945
        private void btnConsolidate_Click(object sender, RoutedEventArgs e)
3946
        {
3947
            ConsolidationMethod();
3948
        }
3949

    
3950
        /// <summary>
3951
        /// execute TeamConsolidationCommand
3952
        /// </summary>
3953
        public void TeamConsolidationMethod()
3954
        {
3955
            this.UpdateMyMarkupList();
3956
            if (this.gridViewMarkup.SelectedItems.Count == 0)
3957
            {
3958
                this.ParentOfType<MainWindow>().DialogMessage_Alert("Please select at least one user", "Alert");
3959
            }
3960
            else
3961
            {
3962

    
3963
                ViewerDataModel.Instance.IsConsolidate = true;
3964
                this.ParentOfType<MainWindow>().dzTopMenu._SaveEvent(null, null);
3965

    
3966
                foreach (MarkupInfoItem item in this.gridViewMarkup.SelectedItems)
3967
                {
3968
                    if (!this.userData.DEPARTMENT.Equals(item.Depatment))
3969
                    {
3970
                        this.ParentOfType<MainWindow>().DialogMessage_Alert("Please select at your department", "Alert");
3971
                        return;
3972
                    }                    
3973
                }
3974
                List<MarkupInfoItem> MarkupInfoList = new List<MarkupInfoItem>();
3975
                foreach (MarkupInfoItem item in this.gridViewMarkup.SelectedItems)
3976
                {
3977
                    MarkupInfoList.Add(item);
3978
                }
3979
                TeamConsolidateCommand.Instance.Execute(MarkupInfoList);
3980
            }
3981
        }
3982

    
3983
        public void ConsolidationMethod()
3984
        {
3985
            if (this.gridViewMarkup.SelectedItems.Count == 0)
3986
            {
3987
                this.ParentOfType<MainWindow>().DialogMessage_Alert("Please select at least one user", "Alert");
3988
            }
3989
            else
3990
            {
3991
                List<IKCOM.MarkupInfoItem> MySelectItem = new List<IKCOM.MarkupInfoItem>();
3992
                foreach (var item in this.gridViewMarkup.SelectedItems)
3993
                {
3994
                    MySelectItem.Add(item as IKCOM.MarkupInfoItem);
3995
                }
3996
                int iPageNo = Convert.ToInt32(this.ParentOfType<MainWindow>().dzTopMenu.tlcurrentPage.Text);
3997
                
3998
                ConsolidateCommand.Instance.Execute(MySelectItem, iPageNo);
3999
            }
4000
        }
4001

    
4002
        private void btnConsolidate_Loaded(object sender, RoutedEventArgs e)
4003
        {
4004
            if (App.ViewInfo != null)
4005
            {
4006
                btnConsolidate = (sender as RadRibbonButton);
4007
                if (!App.ViewInfo.NewCommentPermission)
4008
                {
4009
                    (sender as RadRibbonButton).Visibility = System.Windows.Visibility.Collapsed;
4010
                }
4011
            }
4012
        }
4013

    
4014
        private void btnTeamConsolidate_Click(object sender, RoutedEventArgs e)
4015
        {
4016
            TeamConsolidationMethod();
4017
        }
4018

    
4019
        private void btnTeamConsolidate_Loaded(object sender, RoutedEventArgs e)
4020
        {
4021
            btnTeamConsolidate = sender as RadRibbonButton;
4022
            if (App.ViewInfo != null)
4023
            {
4024
                if (!App.ViewInfo.CreateFinalPDFPermission) //파이널이 True가 아니면
4025
                {
4026
                    if (btnConsolidate != null)
4027
                    {
4028
                        btnConsolidate.Visibility = Visibility.Collapsed;
4029
                    }
4030

    
4031
                    if (!App.ViewInfo.NewCommentPermission)
4032
                    {
4033
                        btnTeamConsolidate.Visibility = Visibility.Collapsed;
4034
                    }
4035
                }
4036
                else
4037
                {
4038
                    btnTeamConsolidate.Visibility = Visibility.Collapsed;
4039
                }
4040
            }
4041
        }
4042

    
4043
        private void FinalPDFEvent(object sender, RoutedEventArgs e)
4044
        {
4045
            var item = gridViewMarkup.Items.Cast<MarkupInfoItem>().Where(d => d.Consolidate == 1 && d.AvoidConsolidate == 0).FirstOrDefault();
4046
            if(item != null)
4047
            {
4048
                if (BaseClient.FinalPDF_GetFinalPDFStatus(_DocInfo.ID, item.MarkupInfoID, _ViewInfo.UserID))
4049
                {
4050
                    Logger.sendReqLog("SetFinalPDFAsync", _ViewInfo.ProjectNO + "," + _DocInfo.ID + "," + item.MarkupInfoID + "," + _ViewInfo.UserID, 1);
4051
                    BaseClient.SetFinalPDFAsync(_ViewInfo.ProjectNO, _DocInfo.ID, item.MarkupInfoID, _ViewInfo.UserID);
4052
                }
4053
                else
4054
                {
4055
                    DialogMessage_Alert("Merged PDF가 수행중입니다", "안내");
4056
                }
4057
            }else{
4058
                //Consolidate 가 없는 경우
4059
                DialogMessage_Alert("Consolidation 된 코멘트가 존재하지 않습니다", "안내");
4060
            }
4061
            
4062
        }
4063

    
4064
        private void btnFinalPDF_Loaded(object sender, RoutedEventArgs e)
4065
        {
4066
            btnFinalPDF = sender as RadRibbonButton;
4067
            if (App.ViewInfo != null)
4068
            {
4069
                if (!App.ViewInfo.CreateFinalPDFPermission) //파이널이 True가 아니면
4070
                {
4071
                    btnFinalPDF.Visibility = System.Windows.Visibility.Collapsed;
4072
                    if (btnConsolidate != null)
4073
                    {
4074
                        btnConsolidate.Visibility = Visibility.Collapsed;
4075
                    }
4076
                }
4077
            }
4078
        }
4079

    
4080
        private void ConsolidateFinalPDFEvent(object sender, RoutedEventArgs e)
4081
        {
4082
            UpdateMyMarkupList();
4083

    
4084
            if (this.gridViewMarkup.SelectedItems.Count == 0)
4085
            {
4086
                this.ParentOfType<MainWindow>().DialogMessage_Alert("Please select at least one user", "Alert");
4087
            }
4088
            else
4089
            {
4090
                ViewerDataModel.Instance.IsConsolidate = true;
4091
                this.ParentOfType<MainWindow>().dzTopMenu._SaveEvent(null, null);
4092
                List<KCOMDataModel.DataModel.MARKUP_DATA> instanceDataSet = new List<KCOMDataModel.DataModel.MARKUP_DATA>();
4093

    
4094
                string project_no = App.ViewInfo.ProjectNO;
4095
                string doc_id = _DocInfo.ID;
4096
                string user_id = App.ViewInfo.UserID;
4097
                List<MarkupInfoItem> markupInfoItems = new List<MarkupInfoItem>();
4098
                foreach (MarkupInfoItem item in this.gridViewMarkup.SelectedItems)
4099
                {
4100
                    markupInfoItems.Add(item);
4101
                }
4102
                Logger.sendReqLog("Consolidate", project_no + "," + user_id + "," + doc_id + "," + markupInfoItems, 1);
4103
                Logger.sendResLog("Consolidate", this.BaseClient.Consolidate(project_no, user_id, doc_id, markupInfoItems).ToString(), 1);
4104
                Logger.sendReqLog("GetMarkupInfoItemsAsync", App.ViewInfo.ProjectNO + "," + _DocInfo.ID, 1);
4105
                var items = this.BaseClient.GetMarkupInfoItems(App.ViewInfo.ProjectNO, _DocInfo.ID);
4106

    
4107
                var item2 = items.Where(d => d.Consolidate == 1 && d.AvoidConsolidate == 0).FirstOrDefault();
4108
                if (item2 != null)
4109
                {
4110
                    Logger.sendReqLog("SetFinalPDFAsync", _ViewInfo.ProjectNO + "," + _DocInfo.ID + "," + item2.MarkupInfoID + "," + _ViewInfo.UserID, 1);
4111

    
4112
                    BaseClient.SetFinalPDFAsync(_ViewInfo.ProjectNO, _DocInfo.ID, item2.MarkupInfoID, _ViewInfo.UserID);
4113
                    BaseClient.GetMarkupInfoItemsAsync(App.ViewInfo.ProjectNO, _DocInfo.ID);
4114
                }
4115
                else
4116
                {
4117
                    DialogMessage_Alert("Consolidation 된 코멘트가 존재하지 않습니다", "안내");
4118
                }
4119
            }
4120
        }
4121

    
4122
        private void btnConsolidateFinalPDF_Loaded(object sender, RoutedEventArgs e)
4123
        {
4124
            btnConsolidateFinalPDF = (sender as RadRibbonButton);
4125

    
4126
            if (App.ViewInfo != null)
4127
            {
4128
                if (!App.ViewInfo.NewCommentPermission || !App.ViewInfo.CreateFinalPDFPermission)
4129
                {
4130
                    btnConsolidateFinalPDF.Visibility = System.Windows.Visibility.Collapsed;
4131
                }
4132
            }
4133
        }
4134

    
4135
        private void btnAdjustEvent(object sender, RoutedEventArgs e)
4136
        {
4137
            //Controls.AdjustList adjustList = new AdjustList();
4138
            //adjustList.ShowDialogCenter();
4139

    
4140
            //if (adjustList.DialogResult == true)
4141
            //{
4142
            //    System.Diagnostics.Debug.WriteLine("성공");
4143
            //}
4144
        }
4145

    
4146

    
4147
        private void btnAdjust_Loaded(object sender, RoutedEventArgs e)
4148
        {
4149
            btnAdjust = (sender as RadRibbonButton);
4150

    
4151
            if (App.ViewInfo != null)
4152
            {
4153
                if (!App.ViewInfo.NewCommentPermission || !App.ViewInfo.CreateFinalPDFPermission)
4154
                {
4155
                    btnAdjust.Visibility = System.Windows.Visibility.Collapsed;
4156
                }
4157
            }
4158
        }
4159

    
4160
        private void SyncCompare_Click(object sender, RoutedEventArgs e)
4161
        {
4162
            SetCompareRect();
4163
        }
4164

    
4165
        /// <summary>
4166
        /// 문서 Comprare 
4167
        /// </summary>
4168
        private void SetCompareRect()
4169
        { 
4170
            if (CompareMode.IsChecked)
4171
            {
4172
                if (ViewerDataModel.Instance.PageBalanceMode && ViewerDataModel.Instance.PageBalanceNumber == 0)
4173
                {
4174
                    ViewerDataModel.Instance.PageBalanceNumber = 1;
4175
                }
4176
                if (ViewerDataModel.Instance.PageNumber == 0)
4177
                {
4178
                    ViewerDataModel.Instance.PageNumber = 1;
4179
                }
4180

    
4181
                Logger.sendReqLog("GetCompareRectAsync", _ViewInfo.ProjectNO + "," + _ViewInfo.DocumentItemID + "," + CurrentRev.DOCUMENT_ID +
4182
                    "," + pageNavigator.CurrentPage.PageNumber.ToString() + "," + ViewerDataModel.Instance.PageNumber.ToString() + "," +
4183
                    userData.COMPANY != "EXT" ? "true" : "false", 1);
4184

    
4185
                BaseClient.GetCompareRectAsync(_ViewInfo.ProjectNO, _ViewInfo.DocumentItemID, CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber.ToString(), ViewerDataModel.Instance.PageNumber.ToString(), userData.COMPANY != "EXT" ? "true" : "false");
4186
            }
4187
            else
4188
            {
4189
                ClearCompareRect();
4190
            }
4191
        }
4192

    
4193
        /// <summary>
4194
        /// Compare된 영역을 초기화
4195
        /// </summary>
4196
        private void ClearCompareRect()
4197
        {
4198
            da.From = 1;
4199
            da.To = 1;
4200
            da.Duration = new Duration(TimeSpan.FromSeconds(9999));
4201
            da.AutoReverse = false;
4202
            canvas_compareBorder.Children.Clear();
4203
            canvas_compareBorder.BeginAnimation(OpacityProperty, da);
4204
        }
4205

    
4206
        private void Sync_Click(object sender, RoutedEventArgs e)
4207
        {
4208
            if (Sync.IsChecked)
4209
            {
4210
                ViewerDataModel.Instance.Sync_ContentOffsetX = zoomAndPanControl.ContentOffsetX;
4211
                ViewerDataModel.Instance.Sync_ContentOffsetY = zoomAndPanControl.ContentOffsetY;
4212
                ViewerDataModel.Instance.Sync_ContentScale = zoomAndPanControl.ContentScale;
4213
            }
4214
        }
4215

    
4216
        private void SyncUserListExpender_Click(object sender, RoutedEventArgs e)
4217
        {
4218
            if (UserList.IsChecked)
4219
            {
4220
                this.gridViewRevMarkup.Visibility = Visibility.Visible;
4221
            }
4222
            else
4223
            {
4224
                this.gridViewRevMarkup.Visibility = Visibility.Collapsed;
4225
            }
4226
        }
4227

    
4228
        private void SyncPageBalance_Click(object sender, RoutedEventArgs e)
4229
        {
4230

    
4231
            if (BalanceMode.IsChecked)
4232
            {
4233
                ViewerDataModel.Instance.PageBalanceMode = true;
4234
            }
4235
            else
4236
            {
4237
                ViewerDataModel.Instance.PageBalanceMode = false;
4238
                ViewerDataModel.Instance.PageBalanceNumber = 0;
4239
            }
4240
        }
4241

    
4242
        private void SyncExit_Click(object sender, RoutedEventArgs e)
4243
        {
4244
            //초기화
4245
            testPanel2.IsHidden = true;
4246
            ViewerDataModel.Instance.PageBalanceMode = false;
4247
            ViewerDataModel.Instance.PageBalanceNumber = 0;
4248
            ViewerDataModel.Instance.PageNumber = 0;
4249
            ViewerDataModel.Instance.MarkupControls_Sync.Clear();
4250
            this.gridViewRevMarkup.Visibility = Visibility.Collapsed;
4251
            UserList.IsChecked = false;
4252
            BalanceMode.IsChecked = false;
4253
        }
4254

    
4255
        private void SyncPageChange_Click(object sender, RoutedEventArgs e)
4256
        {
4257
            if ((sender as System.Windows.Controls.Control).Tag != null)
4258
            {
4259
                //Compare 초기화
4260
                CompareMode.IsChecked = false;
4261
                var balancePoint = Convert.ToInt32((sender as System.Windows.Controls.Control).Tag);
4262

    
4263
                if (ViewerDataModel.Instance.PageNumber == 0)
4264
                {
4265
                    ViewerDataModel.Instance.PageNumber = 1;
4266
                }
4267

    
4268
                if (ViewerDataModel.Instance.PageBalanceNumber == pageNavigator.PageCount)
4269
                {
4270
                }
4271
                else
4272
                {
4273
                    ViewerDataModel.Instance.PageBalanceNumber += balancePoint;
4274
                }
4275

    
4276
                if (ViewerDataModel.Instance.PageNumber == pageNavigator.PageCount && balancePoint > 0)
4277
                {
4278

    
4279
                }
4280
                else if ((ViewerDataModel.Instance.PageNumber + balancePoint) >= 1)
4281
                {
4282
                    ViewerDataModel.Instance.PageNumber += balancePoint;
4283
                }
4284

    
4285
                if (!testPanel2.IsHidden)
4286
                {
4287
                    if (IsSyncPDFMode)
4288
                    {
4289
                        Get_FinalImage.Get_PdfImage get_PdfImage = new Get_FinalImage.Get_PdfImage();
4290
                        var pdfpath = new BitmapImage(new Uri(get_PdfImage.Run(CurrentRev.TO_VENDOR, App.ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, ViewerDataModel.Instance.PageNumber)));
4291

    
4292
                        if (pdfpath.IsDownloading)
4293
                        {
4294
                            pdfpath.DownloadCompleted += (ex, arg) =>
4295
                            {
4296
                                ViewerDataModel.Instance.ImageViewPath_C = pdfpath;
4297
                                ViewerDataModel.Instance.ImageViewWidth_C = pdfpath.PixelWidth;
4298
                                ViewerDataModel.Instance.ImageViewHeight_C = pdfpath.PixelHeight;
4299
                                zoomAndPanCanvas2.Width = pdfpath.PixelWidth;
4300
                                zoomAndPanCanvas2.Height = pdfpath.PixelHeight;
4301
                            };
4302
                        }
4303
                        else
4304
                        {
4305
                            ViewerDataModel.Instance.ImageViewPath_C = pdfpath;
4306
                            ViewerDataModel.Instance.ImageViewWidth_C = pdfpath.PixelWidth;
4307
                            ViewerDataModel.Instance.ImageViewHeight_C = pdfpath.PixelHeight;
4308

    
4309
                            zoomAndPanCanvas2.Width = pdfpath.PixelWidth;
4310
                            zoomAndPanCanvas2.Height = pdfpath.PixelHeight;
4311
                        }
4312

    
4313
                    }
4314
                    else
4315
                    {
4316
                        string uri = "";
4317

    
4318
                        if (userData.COMPANY != "EXT")
4319
                        {
4320
                            uri = String.Format(CommonLib.Common.GetConfigString("mainServerImageWebPath", "URL", "", App.isExternal), _ViewInfo.ProjectNO, (Convert.ToUInt32(CurrentRev.DOCUMENT_ID) / 100).ToString(), CurrentRev.DOCUMENT_ID, ViewerDataModel.Instance.PageNumber);
4321
                        }
4322
                        else
4323
                        {
4324
                            uri = String.Format(CommonLib.Common.GetConfigString("subServerImageWebPath", "URL", "", App.isExternal), _ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, ViewerDataModel.Instance.PageNumber);
4325
                        }
4326

    
4327
                        var defaultBitmapImage_Compare = new BitmapImage(new Uri(uri));
4328

    
4329
                        ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare;
4330
                        ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth;
4331
                        ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight;
4332

    
4333
                        zoomAndPanCanvas2.Width = defaultBitmapImage_Compare.PixelWidth;
4334
                        zoomAndPanCanvas2.Height = defaultBitmapImage_Compare.PixelHeight;
4335

    
4336
                        if (defaultBitmapImage_Compare.IsDownloading)
4337
                        {
4338
                            defaultBitmapImage_Compare.DownloadCompleted += (ex, arg) =>
4339
                            {
4340
                                ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare;
4341
                                ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth;
4342
                                ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight;
4343

    
4344
                                zoomAndPanCanvas2.Width = defaultBitmapImage_Compare.PixelWidth;
4345
                                zoomAndPanCanvas2.Height = defaultBitmapImage_Compare.PixelHeight;
4346
                            };
4347
                        }
4348
                    }
4349

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

    
4354
                    foreach (var item in gridSelectionRevItem)
4355
                    {
4356
                        item.MarkupList.Where(pageItem => pageItem.PageNumber == ViewerDataModel.Instance.PageNumber).ToList().ForEach(delegate (MarkupItem markupitem)
4357
                        {
4358
                            MarkupParser.ParseEx(App.ViewInfo.ProjectNO, markupitem.Data, Common.ViewerDataModel.Instance.MarkupControls_Sync, item.DisplayColor, "", item.MarkupInfoID);
4359
                        });
4360
                    }
4361

    
4362
                    //강인구 추가
4363
                    zoomAndPanControl2.ZoomTo(new Rect
4364
                    {
4365
                        X = 0,
4366
                        Y = 0,
4367
                        Width = Math.Max(zoomAndPanCanvas.Width, zoomAndPanCanvas2.Width),
4368
                        Height = Math.Max(zoomAndPanCanvas.Height, zoomAndPanCanvas2.Height),
4369
                    });
4370

    
4371
                    tlSyncPageNum.Text = String.Format("Current Page : {0}", ViewerDataModel.Instance.PageNumber);
4372

    
4373
                }
4374
            }
4375
        }
4376

    
4377
        private void SyncChange_Click(object sender, RoutedEventArgs e)
4378
        {
4379
            if (MarkupMode.IsChecked)
4380
            {
4381
                IsSyncPDFMode = true;
4382

    
4383
                var uri = CurrentRev.TO_VENDOR;
4384

    
4385
                if (ViewerDataModel.Instance.PageNumber == 0)
4386
                {
4387
                    ViewerDataModel.Instance.PageNumber = 1;
4388
                }
4389

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

    
4394
                if (pdfpath.IsDownloading)
4395
                {
4396
                    pdfpath.DownloadCompleted += (ex, arg) =>
4397
                    {
4398
                        ViewerDataModel.Instance.ImageViewPath_C = pdfpath;
4399
                        ViewerDataModel.Instance.ImageViewWidth_C = pdfpath.PixelWidth;
4400
                        ViewerDataModel.Instance.ImageViewHeight_C = pdfpath.PixelHeight;
4401
                        zoomAndPanCanvas2.Width = pdfpath.PixelWidth;
4402
                        zoomAndPanCanvas2.Height = pdfpath.PixelHeight;
4403
                    };
4404
                }
4405
                else
4406
                {
4407
                    ViewerDataModel.Instance.ImageViewPath_C = pdfpath;
4408
                    ViewerDataModel.Instance.ImageViewWidth_C = pdfpath.PixelWidth;
4409
                    ViewerDataModel.Instance.ImageViewHeight_C = pdfpath.PixelHeight;
4410

    
4411
                    zoomAndPanCanvas2.Width = pdfpath.PixelWidth;
4412
                    zoomAndPanCanvas2.Height = pdfpath.PixelHeight;
4413
                }
4414
            }
4415
            else
4416
            {
4417
                IsSyncPDFMode = false;
4418
                string uri = "";
4419
                if (userData.COMPANY != "EXT")
4420
                {
4421
                    uri = String.Format(CommonLib.Common.GetConfigString("mainServerImageWebPath", "URL", "", App.isExternal), _ViewInfo.ProjectNO, (Convert.ToUInt32(CurrentRev.DOCUMENT_ID) / 100).ToString(), CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber);
4422
                }
4423
                else
4424
                {
4425
                    uri = String.Format(CommonLib.Common.GetConfigString("subServerImageWebPath", "URL", "", App.isExternal), _ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber);
4426
                }
4427

    
4428
                var defaultBitmapImage_Compare = new BitmapImage(new Uri(uri));
4429

    
4430
                ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare;
4431
                ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth;
4432
                ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight;
4433

    
4434
                if (defaultBitmapImage_Compare.IsDownloading)
4435
                {
4436
                    defaultBitmapImage_Compare.DownloadCompleted += (ex, arg) =>
4437
                    {
4438
                        ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare;
4439
                        ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth;
4440
                        ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight;
4441
                    };
4442
                }
4443
                zoomAndPanControl2.ApplyTemplate();
4444
                zoomAndPanControl2.UpdateLayout();
4445
                zoomAndPanCanvas2.Width = Convert.ToDouble(Common.ViewerDataModel.Instance.ContentWidth);
4446
                zoomAndPanCanvas2.Height = Convert.ToDouble(Common.ViewerDataModel.Instance.ContentHeight);
4447
            }
4448
        }
4449

    
4450
        private async void RadButton_Click(object sender, RoutedEventArgs e)
4451
        {
4452
            gridViewHistory_Busy.IsBusy = true;
4453

    
4454
            RadButton instance = sender as RadButton;
4455
            if (instance.CommandParameter != null)
4456
            {
4457
                CurrentRev = instance.CommandParameter as VPRevision;
4458
                System.EventHandler<ServiceDeepView.GetSyncMarkupInfoItemsCompletedEventArgs> GetSyncMarkupInfoItemshandler = null;
4459

    
4460
                GetSyncMarkupInfoItemshandler = (sen, ea) =>
4461
                {
4462
                    if (ea.Error == null && ea.Result != null)
4463
                    {
4464
                        testPanel2.IsHidden = false;
4465

    
4466
                        ViewerDataModel.Instance._markupInfoRevList.Clear();
4467
                        foreach(var info in ea.Result)
4468
                        {
4469
                            if(info.UserID == App.ViewInfo.UserID)
4470
                            {
4471
                                info.userDelete = true;
4472
                                info.DisplayColor = "FFFF0000";
4473
                            }
4474
                            else
4475
                            {
4476
                                info.userDelete = false;
4477
                            }
4478
                            ViewerDataModel.Instance._markupInfoRevList.Add(info);
4479
                        }
4480
                        gridViewRevMarkup.ItemsSource = ViewerDataModel.Instance._markupInfoRevList;
4481

    
4482
                        string uri = "";
4483
                        if (userData.COMPANY != "EXT")
4484
                        {
4485
                            uri = String.Format(CommonLib.Common.GetConfigString("mainServerImageWebPath", "URL", "", App.isExternal), _ViewInfo.ProjectNO, (Convert.ToUInt32(CurrentRev.DOCUMENT_ID) / 100).ToString(), CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber);
4486
                        }
4487
                        else
4488
                        {
4489
                            uri = String.Format(CommonLib.Common.GetConfigString("subServerImageWebPath", "URL", "", App.isExternal), _ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber);
4490
                        }
4491

    
4492
                        Sync_Offset_Point = new Point(zoomAndPanControl.ContentOffsetX, zoomAndPanControl.ContentOffsetY);
4493

    
4494
                        var defaultBitmapImage_Compare = ImageSourceHelper.GetDownloadImage(uri);
4495

    
4496
                        ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare;
4497
                        ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth;
4498
                        ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight;
4499
                        zoomAndPanCanvas2.Width = defaultBitmapImage_Compare.PixelWidth;
4500
                        zoomAndPanCanvas2.Height = defaultBitmapImage_Compare.PixelHeight;
4501
                        
4502
                        zoomAndPanControl2.ApplyTemplate();
4503
                        zoomAndPanControl2.UpdateLayout();
4504
                        //syncPannelRotate(zoomAndPanControl.RotationAngle);
4505
                        if (Sync_Offset_Point != new Point(zoomAndPanControl.ContentOffsetX, zoomAndPanControl.ContentOffsetY))
4506
                        {
4507
                            zoomAndPanControl.ContentOffsetX = Sync_Offset_Point.X;
4508
                            zoomAndPanControl.ContentOffsetY = Sync_Offset_Point.Y;
4509
                        }
4510

    
4511
                        ViewerDataModel.Instance.Sync_ContentOffsetX = Sync_Offset_Point.X;
4512
                        ViewerDataModel.Instance.Sync_ContentOffsetY = Sync_Offset_Point.Y;
4513
                        ViewerDataModel.Instance.Sync_ContentScale = zoomAndPanControl.ContentScale;
4514

    
4515
                        tlSyncRev.Text = String.Format("Rev. {0}", CurrentRev.RevNo);
4516
                        tlSyncPageNum.Text = String.Format("Current Page : {0}", pageNavigator.CurrentPage.PageNumber);
4517
                        gridViewHistory_Busy.IsBusy = false;
4518
                    }
4519

    
4520
                    Logger.sendResLog("GetSyncMarkupInfoItemsCompleted", "UserState : " + ea.UserState + "\r Result :" + ea.Result + "\r Cancelled :" + ea.Cancelled + "\r Error :" + ea.Error, 1);
4521

    
4522
                    if (GetSyncMarkupInfoItemshandler != null)
4523
                    {
4524
                        BaseClient.GetSyncMarkupInfoItemsCompleted -= GetSyncMarkupInfoItemshandler;
4525
                    }
4526

    
4527
                    ClearCompareRect();
4528
                    SetCompareRect();
4529
                };
4530

    
4531
                /// 중복 실행이 발생하여 수정함.
4532
                BaseClient.GetSyncMarkupInfoItemsCompleted += GetSyncMarkupInfoItemshandler;
4533
                BaseClient.GetSyncMarkupInfoItemsAsync(_ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, _ViewInfo.UserID);
4534

    
4535
                Logger.sendReqLog("GetSyncMarkupInfoItemsAsync", _ViewInfo.ProjectNO + "," + CurrentRev.DOCUMENT_ID + "," + _ViewInfo.UserID, 1);
4536
            }
4537
        }
4538

    
4539
        private void EnsembleLink_Button_Click(object sender, RoutedEventArgs e)
4540
        {
4541
            try
4542
            {
4543
                if (sender is RadButton)
4544
                {
4545
                    if ((sender as RadButton).Tag != null)
4546
                    {
4547
                        var url = (sender as RadButton).Tag.ToString();
4548
                        System.Diagnostics.Process.Start(url);
4549
                    }
4550
                    else
4551
                    {
4552
                        this.ParentOfType<MainWindow>().DialogMessage_Alert("Link 정보가 잘못 되었습니다", "안내");
4553
                    }
4554
                }
4555
            }
4556
            catch (Exception ex)
4557
            {
4558
                Logger.sendResLog("EnsembleLink_Button_Click", ex.Message, 0);
4559
            }
4560
        }
4561

    
4562
        public void Sync_Event(VPRevision Currnet_Rev)
4563
        {
4564
            CurrentRev = Currnet_Rev;
4565

    
4566
            BaseClient.GetSyncMarkupInfoItemsCompleted += (sen, ea) =>
4567
            {
4568
                if (ea.Error == null && ea.Result != null)
4569
                {
4570
                    testPanel2.IsHidden = false;
4571

    
4572
                    ViewerDataModel.Instance._markupInfoRevList.Clear();
4573
                    foreach(var info in ea.Result)
4574
                    {
4575
                        if(info.UserID == App.ViewInfo.UserID)
4576
                        {
4577
                            info.userDelete = true;
4578
                            info.DisplayColor = "FFFF0000";
4579
                        }
4580
                        else
4581
                        {
4582
                            info.userDelete = false;
4583
                        }
4584
                        ViewerDataModel.Instance._markupInfoRevList.Add(info);
4585
                    }
4586
                    gridViewRevMarkup.ItemsSource = ViewerDataModel.Instance._markupInfoRevList;
4587

    
4588
                    string uri = "";
4589
                    if (userData.COMPANY != "EXT")
4590
                    {
4591
                        uri = String.Format(CommonLib.Common.GetConfigString("mainServerImageWebPath", "URL", "", App.isExternal), _ViewInfo.ProjectNO, (Convert.ToUInt32(CurrentRev.DOCUMENT_ID) / 100).ToString(), CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber);
4592
                    }
4593
                    else
4594
                    {
4595
                        uri = String.Format(CommonLib.Common.GetConfigString("subServerImageWebPath", "URL", "", App.isExternal), _ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber);
4596
                    }
4597

    
4598
                    Sync_Offset_Point = new Point(zoomAndPanControl.ContentOffsetX, zoomAndPanControl.ContentOffsetY);
4599

    
4600
                    var defaultBitmapImage_Compare = new BitmapImage(new Uri(uri));
4601

    
4602
                    ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare;
4603
                    ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth;
4604
                    ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight;
4605

    
4606
                    if (defaultBitmapImage_Compare.IsDownloading)
4607
                    {
4608
                        defaultBitmapImage_Compare.DownloadCompleted += (ex, arg) =>
4609
                        {
4610
                            ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare;
4611
                            ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth;
4612
                            ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight;
4613
                        };
4614
                    }
4615

    
4616

    
4617
                    zoomAndPanCanvas2.Width = Convert.ToDouble(Common.ViewerDataModel.Instance.ContentWidth);
4618
                    zoomAndPanCanvas2.Height = Convert.ToDouble(Common.ViewerDataModel.Instance.ContentHeight);
4619
                    zoomAndPanControl2.ApplyTemplate();
4620
                    zoomAndPanControl2.UpdateLayout();
4621

    
4622
                    if (Sync_Offset_Point != new Point(zoomAndPanControl.ContentOffsetX, zoomAndPanControl.ContentOffsetY))
4623
                    {
4624
                        zoomAndPanControl.ContentOffsetX = Sync_Offset_Point.X;
4625
                        zoomAndPanControl.ContentOffsetY = Sync_Offset_Point.Y;
4626
                    }
4627
                    //}
4628

    
4629
                    tlSyncRev.Text = String.Format("Rev. {0}", CurrentRev.RevNo);
4630
                    tlSyncPageNum.Text = String.Format("Current Page : {0}", pageNavigator.CurrentPage.PageNumber);
4631
                    gridViewHistory_Busy.IsBusy = false;
4632
                }
4633
                Logger.sendResLog("GetSyncMarkupInfoItemsCompleted", "UserState : " + ea.UserState + "\r Result :" + ea.Result + "\r Cancelled :" + ea.Cancelled + "\r Error :" + ea.Error, 1);
4634

    
4635
            };
4636
            Logger.sendReqLog("GetSyncMarkupInfoItemsAsync", _ViewInfo.ProjectNO + "," + CurrentRev.DOCUMENT_ID + "," + _ViewInfo.UserID, 1);
4637
            BaseClient.GetSyncMarkupInfoItemsAsync(_ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, _ViewInfo.UserID);
4638
        }
4639

    
4640
        private void PdfLink_ButtonDown(object sender, MouseButtonEventArgs e)
4641
        {
4642
            if (sender is Image)
4643
            {
4644
                if ((sender as Image).Tag != null)
4645
                {
4646
                    var pdfUrl = (sender as Image).Tag.ToString();
4647
                    System.Diagnostics.Process.Start(pdfUrl);
4648
                }
4649
                else
4650
                {
4651
                    this.ParentOfType<MainWindow>().DialogMessage_Alert("문서 정보가 잘못 되었습니다", "안내");
4652
                }
4653
            }
4654
        }
4655

    
4656
        private void Create_Symbol(object sender, RoutedEventArgs e)
4657
        {
4658
            MarkupToPDF.Controls.Parsing.MarkupParser.MarkupReturn markupReturn = new MarkupToPDF.Controls.Parsing.MarkupParser.MarkupReturn();
4659

    
4660
            if (SelectLayer.Children.Count < 1) //선택된 것이 없으면
4661
            {
4662
                DialogMessage_Alert("Please Select Controls", "Alert");
4663
            }
4664
            else //선택된 것이 있으면
4665
            {
4666
                string MarkupData = "";
4667
                adorner_ = new AdornerFinal();
4668

    
4669
                foreach (var item in SelectLayer.Children)
4670
                {
4671
                    if (item.GetType().Name == "AdornerFinal")
4672
                    {
4673
                        adorner_ = (item as Controls.AdornerFinal);
4674
                        foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
4675
                        {
4676
                            if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
4677
                            {
4678
                                markupReturn = MarkupParser.MarkupToString(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo, App.ViewInfo.UserID);
4679
                                MarkupData += markupReturn.ConvertData;
4680
                            }
4681
                        }
4682
                    }
4683
                }
4684
                DialogParameters parameters = new DialogParameters()
4685
                {
4686
                    Owner = Application.Current.MainWindow,
4687
                    Closed = (obj, args) => this.MarkupNamePromptClose(MarkupData, args),
4688
                    DefaultPromptResultValue = "Custom State",
4689
                    Content = "Name :",
4690
                    Header = "Insert Custom Symbol Name",
4691
                    Theme = new VisualStudio2013Theme(),
4692
                    ModalBackground = new SolidColorBrush { Color = Colors.Black, Opacity = 0.6 },
4693
                };
4694
                RadWindow.Prompt(parameters);
4695
            }
4696

    
4697
        }
4698
        public int symbolselectindex = 0;
4699
        private void SymbolMarkupNamePromptClose(byte[] Img_byte, string data, WindowClosedEventArgs args)
4700
        {
4701
            //Save save = new Save();
4702
            try
4703
            {
4704
                string svgfilename = null;
4705
                if (symbolname != null)
4706
                {
4707
                    if (symbolpng == true || symbolsvg == true)
4708
                    {
4709
                        kr.co.devdoftech.cloud.FileUpload fileUploader = new kr.co.devdoftech.cloud.FileUpload();
4710
                        string guid = Commons.shortGuid();
4711

    
4712
                        fileUploader.RunAsync(App.ViewInfo.ProjectNO, _DocItem.DOCUMENT_NO, App.ViewInfo.UserID, guid + ".png", Img_byte);
4713
                        //Check_Uri.UriCheck();
4714
                        fileUploader.RunCompleted += (ex, arg) =>
4715
                        {
4716
                            filename = arg.Result;
4717
                            if (symbolpng == true)
4718
                            {
4719
                                if (filename != null)
4720
                                { 
4721
                                    if (symbolselectindex == 0)
4722
                                    {
4723
                                        SymbolSave(symbolname, filename, data);
4724
                                    }
4725
                                    else
4726
                                    {
4727
                                        SymbolSave_Public(symbolname, filename, data, ViewerDataModel.Instance.SystemMain.dzMainMenu.userData.DEPARTMENT);
4728
                                    }
4729
                                    DataBind();
4730
                                }                                
4731
                            }
4732

    
4733
                            if (symbolsvg == true)
4734
                            {
4735
                                try
4736
                                {
4737
                                    var defaultBitmapImage = new BitmapImage();
4738
                                    defaultBitmapImage.BeginInit();
4739
                                    defaultBitmapImage.CreateOptions = BitmapCreateOptions.IgnoreImageCache;
4740
                                    defaultBitmapImage.CacheOption = BitmapCacheOption.OnLoad;
4741
                                    Check_Uri.UriCheck(filename);
4742
                                    defaultBitmapImage.UriSource = new Uri(filename);
4743
                                    defaultBitmapImage.EndInit();
4744

    
4745
                                    System.Drawing.Bitmap image;
4746

    
4747
                                    if (defaultBitmapImage.IsDownloading)
4748
                                    {
4749
                                        defaultBitmapImage.DownloadCompleted += (ex2, arg2) =>
4750
                                        {
4751
                                            defaultBitmapImage.Freeze();
4752
                                            image = GetBitmap(defaultBitmapImage);
4753
                                            image.Save(@AppDomain.CurrentDomain.BaseDirectory + "potrace.bmp", System.Drawing.Imaging.ImageFormat.Bmp);
4754
                                            Process potrace = new Process
4755
                                            {
4756
                                                StartInfo = new ProcessStartInfo
4757
                                                {
4758
                                                    FileName = @AppDomain.CurrentDomain.BaseDirectory + "potrace.exe",
4759
                                                    Arguments = "-b svg " + @AppDomain.CurrentDomain.BaseDirectory + "potrace.bmp",
4760
                                                    RedirectStandardInput = true,
4761
                                                    RedirectStandardOutput = true,
4762
                                                    RedirectStandardError = true,
4763
                                                    UseShellExecute = false,
4764
                                                    CreateNoWindow = true,
4765
                                                    WindowStyle = ProcessWindowStyle.Hidden
4766
                                                },
4767
                                            };
4768

    
4769
                                            StringBuilder svgBuilder = new StringBuilder();
4770
                                            potrace.OutputDataReceived += (object sender2, DataReceivedEventArgs e2) =>
4771
                                            {
4772
                                                svgBuilder.AppendLine(e2.Data);
4773
                                            };
4774

    
4775
                                            potrace.EnableRaisingEvents = true;
4776
                                            potrace.Start();
4777
                                            potrace.Exited += (sender, e) =>
4778
                                            {
4779
                                                byte[] bytes = System.IO.File.ReadAllBytes(@AppDomain.CurrentDomain.BaseDirectory + "potrace.svg");
4780
                                                svgfilename = fileUploader.Run(App.ViewInfo.ProjectNO, _DocItem.DOCUMENT_NO, App.ViewInfo.UserID, guid + ".svg", bytes);
4781
                                                Check_Uri.UriCheck(svgfilename);
4782
                                                if (symbolselectindex == 0)
4783
                                                {
4784
                                                    SymbolSave(symbolname, svgfilename, data);
4785
                                                }
4786
                                                else
4787
                                                {
4788
                                                    SymbolSave_Public(symbolname, svgfilename, data, ViewerDataModel.Instance.SystemMain.dzMainMenu.userData.DEPARTMENT);
4789
                                                }
4790

    
4791
                                                DataBind();
4792
                                            };
4793
                                            potrace.WaitForExit();
4794
                                        };
4795
                                    }
4796
                                    else
4797
                                    {
4798
                                        //GC.Collect();
4799
                                    }
4800
                                }
4801
                                catch(Exception ee)
4802
                                {
4803
                                    DialogMessage_Alert("" + ee, "Alert");
4804
                                }
4805
                            }
4806
                        };                                             
4807
                    }
4808
                }
4809
            }
4810
            catch (Exception e)
4811
            {
4812
                //DialogMessage_Alert(e + "", "Alert");
4813
            }            
4814
        }
4815

    
4816
        public void SymbolSave(string Name, string Url, string Data)
4817
        {
4818
            try
4819
            {
4820
                SYMBOL_PRIVATE symbol_private = new SYMBOL_PRIVATE
4821
                {
4822
                    ID = Commons.shortGuid(),
4823
                    MEMBER_USER_ID = App.ViewInfo.UserID,
4824
                    NAME = Name,
4825
                    IMAGE_URL = Url,
4826
                    DATA = Data
4827
                };
4828

    
4829
                Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.SaveSymbolCompleted += BaseClient_SaveSymbolCompleted;
4830
                Logger.sendReqLog("SaveSymbolAsync: ", symbol_private.ID + "," + symbol_private.MEMBER_USER_ID + "," + symbol_private.NAME + "," + symbol_private.IMAGE_URL + "," + symbol_private.DATA, 1);
4831
                Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.SaveSymbolAsync(symbol_private);
4832
            }
4833
            catch (Exception)
4834
            {
4835
                throw;
4836
            }
4837
        }
4838

    
4839
        public void SymbolSave_Public(string Name, string Url, string Data, string Department)
4840
        {
4841
            try
4842
            {
4843
                SYMBOL_PUBLIC symbol_public = new SYMBOL_PUBLIC
4844
                {
4845
                    ID = Commons.shortGuid(),
4846
                    DEPARTMENT = Department,
4847
                    NAME = Name,
4848
                    IMAGE_URL = Url,
4849
                    DATA = Data
4850
                };
4851
                Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.AddPublicSymbolCompleted += BaseClient_AddPublicSymbolCompleted;
4852
                Logger.sendReqLog("AddPublicSymbol: ", symbol_public.ID + "," + symbol_public.DEPARTMENT + "," + symbol_public.NAME + "," + symbol_public.IMAGE_URL + "," + symbol_public.DATA, 1);
4853
                Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.AddPublicSymbol(symbol_public);
4854
            }
4855
            catch (Exception)
4856
            {
4857
                throw;
4858
            }
4859
        }
4860

    
4861
        private void BaseClient_AddPublicSymbolCompleted(object sender, ServiceDeepView.AddPublicSymbolCompletedEventArgs e)
4862
        {           
4863
            Logger.sendResLog("AddPublicSymbolCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1);
4864
            DataBind();
4865
        }
4866

    
4867
        private void BaseClient_SaveSymbolCompleted(object sender, ServiceDeepView.SaveSymbolCompletedEventArgs e)
4868
        {
4869
            Logger.sendResLog("RenameSymbolCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1);
4870
            DataBind();
4871
        }
4872
        private void DataBind()
4873
        {
4874
            try
4875
            {
4876
                Symbol_Custom Custom = new Symbol_Custom();
4877
                List<Symbol_Custom> Custom_List = new List<Symbol_Custom>();
4878
                
4879
                var symbol_Private = BaseClient.GetSymbolList(App.ViewInfo.UserID);
4880
                foreach (var item in symbol_Private)
4881
                {
4882
                    Custom.Name = item.NAME;
4883
                    Custom.ImageUri = item.IMAGE_URL;
4884
                    Custom.ID = item.ID;
4885
                    Custom_List.Add(Custom);
4886
                    Custom = new Symbol_Custom();
4887
                }
4888
                symbolPanel_Instance.lstSymbolPrivate.ItemsSource = Custom_List;
4889
                
4890
                Custom = new Symbol_Custom();
4891
                Custom_List = new List<Symbol_Custom>();
4892

    
4893
                symbolPanel_Instance.deptlist.ItemsSource = BaseClient.GetPublicSymbolDeptList();
4894

    
4895
                List<SYMBOL_PUBLIC> symbol_Public;
4896

    
4897
                if (symbolPanel_Instance.deptlist.SelectedValue != null)
4898
                {
4899
                    symbol_Public = BaseClient.GetPublicSymbolList(symbolPanel_Instance.deptlist.SelectedValue.ToString());
4900
                }
4901
                else
4902
                {
4903
                    symbol_Public = BaseClient.GetPublicSymbolList(null);
4904
                }
4905
                foreach (var item in symbol_Public)
4906
                {
4907
                    Custom.Name = item.NAME;
4908
                    Custom.ImageUri = item.IMAGE_URL;
4909
                    Custom.ID = item.ID;
4910
                    Custom_List.Add(Custom);
4911
                    Custom = new Symbol_Custom();
4912
                }
4913
                symbolPanel_Instance.lstSymbolPublic.ItemsSource = Custom_List;
4914
                BaseClient.Close();                
4915
            }
4916
            catch(Exception e)
4917
            {
4918
                //DialogMessage_Alert("DataBind", "Alert");
4919
            }
4920
            
4921
        }
4922
        private void MarkupNamePromptClose(string data, WindowClosedEventArgs args)
4923
        {
4924
            try
4925
            {
4926
                if (args.PromptResult != null)
4927
                {
4928
                    if (args.DialogResult.Value)
4929
                    {
4930
                        PngBitmapEncoder _Encoder = symImage(data);
4931

    
4932
                        System.IO.MemoryStream fs = new System.IO.MemoryStream();
4933
                        _Encoder.Save(fs);
4934
                        System.Drawing.Image ImgOut = System.Drawing.Image.FromStream(fs);
4935

    
4936
                        byte[] Img_byte = fs.ToArray();
4937

    
4938
                        kr.co.devdoftech.cloud.FileUpload fileUploader = new kr.co.devdoftech.cloud.FileUpload();
4939
                        filename = fileUploader.Run(App.ViewInfo.ProjectNO, _DocItem.DOCUMENT_NO, App.ViewInfo.UserID, Commons.shortGuid() + ".png", Img_byte);
4940
                        Check_Uri.UriCheck(filename);
4941
                        if (symbolPanel_Instance.RadTab.SelectedIndex == 0)
4942
                        {
4943
                            SaveCommand.Instance.SymbolSave(args.PromptResult, filename, data);
4944
                        }
4945
                        else
4946
                        {
4947
                            SaveCommand.Instance.SymbolSave_Public(args.PromptResult, filename, data, ViewerDataModel.Instance.SystemMain.dzMainMenu.userData.DEPARTMENT);
4948
                        }
4949
                        DataBind();
4950
                    }
4951
                }
4952
            }
4953
            catch(Exception ex)
4954
            {
4955
                DialogMessage_Alert("" + ex, "Alert");
4956
            }
4957
        }
4958

    
4959
        public PngBitmapEncoder symImage(string data)
4960
        {
4961

    
4962
            Canvas _canvas = new Canvas();
4963
            _canvas.Background = Brushes.White;
4964
            _canvas.Width = adorner_.BorderSize.Width;
4965
            _canvas.Height = adorner_.BorderSize.Height;
4966
            MarkupParser.Parse(App.ViewInfo.ProjectNO, data, _canvas, "#FFFF0000", "");
4967

    
4968
            BitmapEncoder encoder = new PngBitmapEncoder();
4969

    
4970

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

    
4973
            DrawingVisual dv = new DrawingVisual();
4974

    
4975
            _canvas.Measure(new System.Windows.Size(adorner_.BorderSize.Width + 50, adorner_.BorderSize.Height + 50));
4976
            _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)));
4977

    
4978
            using (DrawingContext ctx = dv.RenderOpen())
4979
            {
4980
                VisualBrush vb = new VisualBrush(_canvas);
4981
                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)));
4982
            }
4983

    
4984
            try
4985
            {
4986
                renderBitmap.Render(dv);
4987

    
4988
                //GC.Collect();
4989
                GC.WaitForPendingFinalizers();
4990
                //GC.Collect();
4991
                // encode png data
4992
                PngBitmapEncoder pngEncoder = new PngBitmapEncoder();
4993
                // puch rendered bitmap into it
4994
                pngEncoder.Interlace = PngInterlaceOption.Off;
4995
                pngEncoder.Frames.Add(BitmapFrame.Create(renderBitmap));
4996
                return pngEncoder;
4997

    
4998
            }
4999
            catch //(Exception ex)
5000
            {
5001
                return null;
5002
            }
5003

    
5004
        }
5005

    
5006
        public void DialogMessage_Alert(string content, string header)
5007
        {
5008
            DialogParameters parameters = new DialogParameters()
5009
            {
5010
                Owner = this.ParentOfType<MainWindow>(),
5011
                Content = new TextBlock()
5012
                { 
5013
                    MinWidth = 400,
5014
                    FontSize = 11,
5015
                    Text = content,
5016
                    TextWrapping = System.Windows.TextWrapping.Wrap
5017
                },
5018
                Header = header,
5019
                Theme = new VisualStudio2013Theme(),
5020
                ModalBackground = new SolidColorBrush { Color = Colors.Black, Opacity = 0.6 },
5021
            };            
5022
            RadWindow.Alert(parameters);
5023
        }
5024

    
5025
        #region 캡쳐 기능
5026

    
5027
        public BitmapSource CutAreaToImage(int x, int y, int width, int height)
5028
        {
5029
            if (x < 0)
5030
            {
5031
                width += x;
5032
                x = 0;
5033
            }
5034
            if (y < 0)
5035
            {
5036
                height += y;
5037
                y = 0;
5038

    
5039
                width = (int)zoomAndPanCanvas.ActualWidth - x;
5040
            }
5041
            if (x + width > zoomAndPanCanvas.ActualWidth)
5042
            {
5043
                width = (int)zoomAndPanCanvas.ActualWidth - x;
5044
            }
5045
            if (y + height > zoomAndPanCanvas.ActualHeight)
5046
            {
5047
                height = (int)zoomAndPanCanvas.ActualHeight - y;
5048
            }
5049

    
5050
            byte[] pixels = CopyPixels(x, y, width, height);
5051

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

    
5054
            return BitmapSource.Create(width, height, 96, 96, PixelFormats.Pbgra32, null, pixels, stride);
5055
        }
5056

    
5057
        public byte[] CopyPixels(int x, int y, int width, int height)
5058
        {
5059
            byte[] pixels = new byte[width * height * 4];
5060
            int stride = (width * canvasImage.Format.BitsPerPixel + 7) / 8;
5061

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

    
5065
            return pixels;
5066
        }
5067

    
5068
        public RenderTargetBitmap ConverterBitmapImage(FrameworkElement element)
5069
        {
5070
            DrawingVisual drawingVisual = new DrawingVisual();
5071
            DrawingContext drawingContext = drawingVisual.RenderOpen();
5072

    
5073
            // 해당 객체의 그래픽요소로 사각형의 그림을 그립니다.
5074
            drawingContext.DrawRectangle(new VisualBrush(element), null,
5075
                new Rect(new Point(0, 0), new Point(element.ActualWidth, element.ActualHeight)));
5076
            drawingContext.Close();
5077

    
5078
            // 비트맵으로 변환합니다.
5079
            RenderTargetBitmap target =
5080
                new RenderTargetBitmap((int)element.ActualWidth, (int)element.ActualHeight,
5081
                96, 96, System.Windows.Media.PixelFormats.Pbgra32);
5082

    
5083
            target.Render(drawingVisual);
5084
            return target;
5085
        }
5086

    
5087
        System.Drawing.Bitmap GetBitmap(BitmapSource source)
5088
        {
5089
            System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(source.PixelWidth, source.PixelHeight, System.Drawing.Imaging.PixelFormat.Format32bppPArgb);
5090
            System.Drawing.Imaging.BitmapData data = bmp.LockBits(new System.Drawing.Rectangle(System.Drawing.Point.Empty, bmp.Size), System.Drawing.Imaging.ImageLockMode.WriteOnly, System.Drawing.Imaging.PixelFormat.Format32bppPArgb);
5091
            source.CopyPixels(Int32Rect.Empty, data.Scan0, data.Height * data.Stride, data.Stride);
5092
            bmp.UnlockBits(data);
5093
            return bmp;
5094
        }
5095
        public string symbolname = null;
5096
        public bool symbolsvg = true;
5097
        public bool symbolpng = true;
5098

    
5099
        public void Save_Symbol_Capture(BitmapSource source, int x, int y, int width, int height)
5100
        {
5101
            System.Drawing.Bitmap image = GetBitmap(source);
5102
            //흰색 제거
5103
            //image.MakeTransparent(System.Drawing.Color.White);
5104

    
5105
            var imageStream = new System.IO.MemoryStream();
5106
            byte[] imageBytes = null;
5107
            using (imageStream)
5108
            {
5109
                image.Save(imageStream, System.Drawing.Imaging.ImageFormat.Png);
5110
                // test.Save(@"E:\test.png", System.Drawing.Imaging.ImageFormat.Png);
5111
                imageStream.Position = 0;
5112
                imageBytes = imageStream.ToArray();
5113
            }
5114

    
5115
            SymbolPrompt symbolPrompt = new SymbolPrompt();
5116

    
5117
            RadWindow CheckPop = new RadWindow();
5118
            //Alert check = new Alert(Msg);
5119

    
5120
            CheckPop = new RadWindow
5121
            {
5122
                MinWidth = 400,
5123
                MinHeight = 100,
5124
               // Closed = (obj, args) => this.SymbolMarkupNamePromptClose(imageBytes, "", args),
5125
                Header = "Alert",
5126
                Content = symbolPrompt,
5127
                //DialogResult = 
5128
                ResizeMode = System.Windows.ResizeMode.NoResize,
5129
                WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen,
5130
                IsTopmost = true,
5131
            };
5132
            CheckPop.Closed += (obj, args) => this.SymbolMarkupNamePromptClose(imageBytes, "", args);
5133
            StyleManager.SetTheme(CheckPop, new Office2013Theme());
5134
            CheckPop.ShowDialog();
5135

    
5136
            /*
5137
            DialogParameters parameters = new DialogParameters()
5138
            {
5139
                Owner = Application.Current.MainWindow,
5140
                Closed = (obj, args) => this.SymbolMarkupNamePromptClose(imageBytes, "", args),
5141
                DefaultPromptResultValue = "Custom State",
5142
                Content = "Name :",
5143
                Header = "Insert Custom Symbol Name",
5144
                Theme = new VisualStudio2013Theme(),
5145
                ModalBackground = new SolidColorBrush { Color = Colors.Black, Opacity = 0.6 },
5146
            };            
5147
            RadWindow.Prompt(parameters);
5148
            */
5149
        }
5150

    
5151
        public void Save_Capture(BitmapSource source, int x, int y, int width, int height)
5152
        {
5153
            KCOM.Common.Converter.FileStreamToBase64 streamToBase64 = new Common.Converter.FileStreamToBase64();
5154
            KCOMDataModel.DataModel.CHECK_LIST check_;
5155
            string Result = streamToBase64.ImageToBase64(source);
5156
            KCOMDataModel.DataModel.CHECK_LIST Item = new KCOMDataModel.DataModel.CHECK_LIST();
5157
            string projectno = App.ViewInfo.ProjectNO;
5158
            string checklist_id = ViewerDataModel.Instance.CheckList_ID;
5159

    
5160
            Logger.sendReqLog("GetCheckList", projectno + "," + checklist_id, 1);
5161
            Item = this.BaseClient.GetCheckList(projectno, checklist_id);
5162
            if (Item != null)
5163
            {
5164
                Logger.sendResLog("GetCheckList", "TRUE", 1);
5165
            }
5166
            else
5167
            {
5168
                Logger.sendResLog("GetCheckList", "FALSE", 1);
5169
            }
5170

    
5171
            if (Item == null)
5172
            {
5173
                check_ = new KCOMDataModel.DataModel.CHECK_LIST
5174
                {
5175
                    ID = Commons.shortGuid(),
5176
                    USER_ID = App.ViewInfo.UserID,
5177
                    IMAGE_URL = Result,
5178
                    IMAGE_ANCHOR = x + "," + y + "," + width + "," + height,
5179
                    PAGENUMBER = this.pageNavigator.CurrentPage.PageNumber,
5180
                    REVISION = ViewerDataModel.Instance.SystemMain.dzMainMenu.CurrentDoc.Revision,
5181
                    DOCUMENT_ID = App.ViewInfo.DocumentItemID,
5182
                    PROJECT_NO = App.ViewInfo.ProjectNO,
5183
                    STATUS = "False",
5184
                    CREATE_TIME = DateTime.Now,
5185
                    UPDATE_TIME = DateTime.Now,
5186
                    DOCUMENT_NO = _DocItem.DOCUMENT_NO,
5187
                    STATUS_DESC_OPEN = "Vendor 반영 필요",
5188
                };
5189
                Logger.sendReqLog("AddCheckList", projectno + "," + check_, 1);
5190
                Logger.sendResLog("AddCheckList", this.BaseClient.AddCheckList(projectno, check_).ToString(), 1);
5191
                //this.BaseClient.AddCheckList(projectno, check_);
5192
            }
5193
            else
5194
            {
5195
                Item.IMAGE_URL = Result;
5196
                Item.IMAGE_ANCHOR = x + "," + y + "," + width + "," + height;
5197
                Item.PAGENUMBER = this.pageNavigator.CurrentPage.PageNumber;
5198
                Logger.sendReqLog("SaveCheckList", projectno + "," + checklist_id + "," + Item, 1);
5199
                Logger.sendResLog("SaveCheckList", this.BaseClient.SaveCheckList(projectno, checklist_id, Item).ToString(), 1);
5200
                //this.BaseClient.SaveCheckList(projectno, checklist_id, Item);
5201
            }
5202

    
5203
        }
5204

    
5205
        public void Set_Capture()
5206
        {
5207
            double x = canvasDrawingMouseDownPoint.X;
5208
            double y = canvasDrawingMouseDownPoint.Y;
5209
            double width = dragCaptureBorder.Width;
5210
            double height = dragCaptureBorder.Height;
5211

    
5212
            if (width > 5 || height > 5)
5213
            {
5214
                canvasImage = ConverterBitmapImage(zoomAndPanCanvas);
5215
                BitmapSource source = CutAreaToImage((int)x, (int)y, (int)width, (int)height);
5216
                Save_Capture(source, (int)x, (int)y, (int)width, (int)height);
5217
            }
5218
        }
5219
        #endregion
5220

    
5221
        public Multi_Undo_data Control_Style(CommentUserInfo control)
5222
        {
5223
            multi_Undo_Data = new Multi_Undo_data();
5224

    
5225
            multi_Undo_Data.Markup = control;
5226

    
5227
            if ((control as IShapeControl) != null)
5228
            {
5229
                multi_Undo_Data.paint = (control as IShapeControl).Paint;
5230
            }
5231
            if ((control as IDashControl) != null)
5232
            {
5233
                multi_Undo_Data.DashSize = (control as IDashControl).DashSize;
5234
            }
5235
            if ((control as IPath) != null)
5236
            {
5237
                multi_Undo_Data.LineSize = (control as IPath).LineSize;
5238
            }
5239
            if ((control as UIElement) != null)
5240
            {
5241
                multi_Undo_Data.Opacity = (control as UIElement).Opacity;
5242
            }
5243

    
5244
            return multi_Undo_Data;
5245
        }
5246

    
5247
        private void Comment_Move(object sender, MouseButtonEventArgs e)
5248
        {
5249
            string Select_ID = (((e.Source as Telerik.Windows.Controls.RadButton).DataContext) as IKCOM.MarkupInfoItem).UserID;
5250
            foreach (var items in ViewerDataModel.Instance._markupInfoRevList)
5251
            {
5252
                if (items.UserID == Select_ID)
5253
                {
5254
                    foreach (var item in items.MarkupList)
5255
                    {
5256
                        if (item.PageNumber == pageNavigator.CurrentPage.PageNumber)
5257
                        {
5258
                            MarkupParser.ParseEx(App.ViewInfo.ProjectNO, item.Data, Common.ViewerDataModel.Instance.MarkupControls_USER, "#FFFF0000", "", 
5259
                                items.MarkupInfoID, Commons.shortGuid());
5260
                        }
5261
                    }
5262
                }
5263
            }
5264
        }
5265

    
5266
        /// <summary>
5267
        /// convert inkcontrol to polygoncontrol
5268
        /// </summary>
5269
        public void ConvertInkControlToPolygon()
5270
        {
5271
            if (inkBoard.Strokes.Count > 0)
5272
            {
5273
                inkBoard.Strokes.ToList().ForEach(stroke =>
5274
                {
5275
                    InkToPath ip = new InkToPath();
5276

    
5277
                    List<Point> inkPointSet = new List<Point>();
5278
                    inkPointSet.AddRange(ip.GetPointsFrom(stroke));
5279

    
5280
                    PolygonControl pc = new PolygonControl()
5281
                    {
5282
                        Angle = 0,
5283
                        PointSet = inkPointSet,
5284
                        ControlType = ControlType.Ink
5285
                    };
5286
                    pc.StartPoint = inkPointSet[0];
5287
                    pc.EndPoint = inkPointSet[inkPointSet.Count - 1];
5288
                    pc.LineSize = 3;
5289
                    pc.CommentID = Commons.shortGuid();
5290
                    pc.StrokeColor = new SolidColorBrush(Colors.Red);
5291

    
5292
                    if (pc.PointSet.Count > 0)
5293
                    {
5294
                        CreateCommand.Instance.Execute(pc);
5295
                        ViewerDataModel.Instance.MarkupControls_USER.Add(pc);
5296
                    }
5297
                });
5298
                inkBoard.Strokes.Clear();
5299
            }
5300
        }
5301

    
5302
        /// <summary>
5303
        /// 캔버스에 그릴때 모든 포인트가 캔버스를 벗어 났는지 체크하여 넘겨줌
5304
        /// </summary>
5305
        /// <author>ingu</author>
5306
        /// <date>2018.06.05</date>
5307
        /// <param name="getPoint"></param>
5308
        /// <returns></returns>
5309
        private bool IsGetoutpoint(Point getPoint)
5310
        {
5311
            if (getPoint == new Point())
5312
            {
5313
                ViewerDataModel.Instance.MarkupControls_USER.Remove(currentControl);
5314
                currentControl = null;
5315
                return true;
5316
            }
5317

    
5318
            return false;
5319
        }
5320

    
5321
        private void zoomAndPanControl_DragOver(object sender, DragEventArgs e)
5322
        {
5323
            e.Effects = DragDropEffects.Copy;
5324
        }
5325

    
5326
        private void zoomAndPanControl_DragEnter(object sender, DragEventArgs e)
5327
        {
5328
            e.Effects = DragDropEffects.Copy;
5329
        }
5330

    
5331
        private void zoomAndPanControl_DragLeave(object sender, DragEventArgs e)
5332
        {
5333
            e.Effects = DragDropEffects.None;
5334
        }
5335

    
5336
        private void ZoomAndPanControl_ScaleChanged(object sender, RoutedEventArgs e)
5337
        {
5338
            var pageWidth = ViewerDataModel.Instance.ImageViewWidth;
5339
            var pageHeight = ViewerDataModel.Instance.ImageViewHeight;
5340

    
5341
            ScaleImage(pageWidth, pageHeight);
5342
        }
5343

    
5344
        /// <summary>
5345
        /// 페이지를 scale의 변화에 맞춰서 DecodePixel을 변경한다.
5346
        /// </summary>
5347
        /// <param name="pageWidth">원본 사이즈</param>
5348
        /// <param name="pageHeight">원본 사이즈</param>
5349
        /// <returns></returns>
5350
        private void ScaleImage(double pageWidth,double pageHeight)
5351
        {
5352
            //mainPanel.Scale = zoomAndPanControl.ContentScale;// (zoomAndPanControl.ContentScale >= 0.1) ? 1 : zoomAndPanControl.ContentScale;
5353
        }
5354

    
5355
        private void thumbnailPanel_SizeChanged(object sender, SizeChangedEventArgs e)
5356
        {
5357
            CommonLib.Common.WriteConfigString("SetThumbnail", "WIDTH", thumbnailPanel.Width.ToString());
5358
        }
5359

    
5360
        private void UserControl_LayoutUpdated(object sender, EventArgs e)
5361
        {
5362
            System.Diagnostics.Debug.WriteLine("layupdated");
5363
            if (Common.ViewerDataModel.Instance.MarkupControls_USER?.Count() > 0)
5364
            {
5365
                ViewerDataModel.Instance.OnLoadPage();
5366
            }
5367
        }
5368

    
5369

    
5370

    
5371
        /*
5372
        private void zoomAndPanControl_Drop(object sender, DragEventArgs e)
5373
        {
5374
            try
5375
            {
5376
                if (e.Data.GetDataPresent(typeof(string)))
5377
                {
5378
                    this.getCurrentPoint = e.GetPosition(drawingRotateCanvas);
5379
                    string dragData = e.Data.GetData(typeof(string)) as string;
5380
                    Move_Symbol(sender, dragData);
5381
                }
5382
            }
5383
            catch (Exception ex)
5384
            {
5385
                Logger.sendResLog("zoomAndPanControl_Drop", ex.ToString(), 0);
5386
            }            
5387
        }
5388
        */
5389
    }
5390
}
클립보드 이미지 추가 (최대 크기: 500 MB)