프로젝트

일반

사용자정보

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

markus / KCOM / Views / MainMenu.xaml.cs @ 3a52c0a7

이력 | 보기 | 이력해설 | 다운로드 (254 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
            App.splashString(ISplashMessage.MAINMENU_0);            
242
            //InitializeComponent();    
243
            this.Loaded += MainMenu_Loaded;
244
        }
245

    
246
        public class TempDt
247
        {
248
            public int PageNumber { get; set; }
249
            public string CommentID { get; set; }
250
            public string ConvertData { get; set; }
251
            public int DATA_TYPE { get; set; }
252
            public string MarkupInfoID { get; set; }
253
            public int IsUpdate { get; set; }
254
        }
255

    
256
        List<TempDt> tempDtList = new List<TempDt>();
257

    
258
        private void SetCursor()
259
        {
260
            this.Cursor = cursor;
261
        }
262

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

    
273
            return false;
274
        }
275

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

    
299
            return false;
300
        }
301

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

    
308
            
309
            ViewerDataModel.Instance._markupInfoList.Remove(item);
310

    
311
            ViewerDataModel.Instance.MarkupControls.Where(data => data.MarkupInfoID == item.MarkupInfoID).ToList().ForEach(a =>
312
            {
313
                ViewerDataModel.Instance.MarkupControls.Remove(a);
314
            });
315

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

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

    
330
            gridViewMarkup.ItemsSource = ViewerDataModel.Instance._markupInfoList;
331

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

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

    
392
                        Button content = (sender as Button);
393
                        MarkupInfoItem item = content.CommandParameter as MarkupInfoItem;
394

    
395
                        DeleteItem(item);
396
                    }
397
                }
398
            };
399
            RadWindow.Confirm(parameters);
400
        }
401

    
402
        System.Windows.Media.Animation.DoubleAnimation da = new System.Windows.Media.Animation.DoubleAnimation();
403

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

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

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

    
435
        
436

    
437
        private void timercallback(Object o)
438
        {
439
            Stopwatch sw = new Stopwatch();
440
            sw.Start();
441
            TempFile.TempFileAdd();
442
            sw.Stop();
443

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

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

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

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

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

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

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

    
521
        DispatcherTimer renderTesttimer;
522

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

    
535
            #region 페이지가 벗어난 경우
536

    
537
            if (BalancePoint < 1)
538
            {
539
                BalancePoint = 1;
540
                ViewerDataModel.Instance.PageBalanceNumber = 0;
541
            }
542

    
543
            if (pageNavigator.PageCount < BalancePoint)
544
            {
545
                BalancePoint = pageNavigator.PageCount;
546
                ViewerDataModel.Instance.PageBalanceNumber = 0;
547
            }
548

    
549
            #endregion
550

    
551
            ViewerDataModel.Instance.PageNumber = BalancePoint;
552

    
553
            var pageWidth = Convert.ToDouble(e.CurrentPage.PAGE_WIDTH);
554
            var pageHeight = Convert.ToDouble(e.CurrentPage.PAGE_HEIGHT);
555
            var pageUri = pageNavigator.CurrentPage.PageUri;
556
            var contentScale = zoomAndPanControl.ContentScale;
557

    
558
            #region 페이지 이미지 로딩 수정
559

    
560
            // ViewerDataModel.Instance.ImageViewPath = await ImageSourceHelper.GetDownloadImageAsync(pageUri, pageWidth * contentScale, pageHeight * contentScale);
561
            try
562
            {
563
                ViewerDataModel.Instance.ImageViewPath = await ImageSourceHelper.GetDownloadImageAsync(pageUri, pageWidth, pageHeight);
564
                
565
            }
566
            catch (Exception ex)
567
            {
568
                ViewerDataModel.Instance.ImageViewPath = null;
569
                string imgfailedmsg = string.Format(CommonLib.Common.GetAlertMessageString("GetImageResourceFailed", "MSG", "해당 문서의 {0} Page Convert가 정상적이지 않습니다. 관리자에게 문의해 주세요."), pageNavigator.CurrentPage.PageNumber);                
570
                DialogMessage_Alert(imgfailedmsg, "Warning");
571
                App.FileLogger.Fatal(ex);
572
            }
573
            ScaleImage(pageWidth, pageHeight);
574

    
575
            ViewerDataModel.Instance.ImageViewWidth = pageWidth;
576
            ViewerDataModel.Instance.ImageViewHeight = pageHeight;
577

    
578
            zoomAndPanCanvas.Width = pageWidth;
579
            zoomAndPanCanvas.Height = pageHeight;
580

    
581
            Common.ViewerDataModel.Instance.ContentWidth = pageWidth;
582
            Common.ViewerDataModel.Instance.ContentHeight = pageHeight;
583

    
584
            inkBoard.Width = pageWidth;
585
            inkBoard.Height = pageHeight;
586

    
587
            #endregion
588

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

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

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

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

    
645
                    ViewerDataModel.Instance.ImageViewPath_C = null;                    
646

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

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

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

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

    
686
            this.pageNavigator.ChangePage(e.PageNumber);
687
        }
688

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

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

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

    
731
            if (!testPanel2.IsHidden)
732
            {
733
                ViewerDataModel.Instance.Sync_ContentOffsetX = zoomAndPanControl.ContentOffsetX;
734
                ViewerDataModel.Instance.Sync_ContentOffsetY = zoomAndPanControl.ContentOffsetY;
735
                ViewerDataModel.Instance.Sync_ContentScale = zoomAndPanControl.ContentScale;
736

    
737
                Common.ViewerDataModel.Instance.MarkupControls_Sync.Clear();
738
                List<MarkupInfoItem> gridSelectionRevItem = gridViewRevMarkup.SelectedItems.Cast<MarkupInfoItem>().ToList();
739

    
740

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

    
750
            var instanceMain = this.ParentOfType<MainWindow>();
751
            instanceMain.dzTopMenu.tlcurrentPage.Text = e.CurrentPage.PAGE_NUMBER.ToString();
752
            instanceMain.dzTopMenu.tlcurrentPage_readonly.Text = e.CurrentPage.PAGE_NUMBER.ToString();
753

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

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

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

    
814
        private void zoomAndPanControl_MouseWheel(object sender, MouseWheelEventArgs e)
815
        {
816
            if (e.MiddleButton == MouseButtonState.Pressed)
817
            {
818

    
819
            }
820
            e.Handled = true;
821
            if (e.Delta > 0)
822
            {
823
                Point currentContentMousePoint = e.GetPosition(zoomAndPanCanvas);
824
                ZoomIn(currentContentMousePoint);
825
            }
826
            else
827
            {
828
                Point currentContentMousePoint = e.GetPosition(zoomAndPanCanvas);
829
                ZoomOut(currentContentMousePoint);
830
            }
831
        }
832

    
833
        private void zoomAndPanControl2_MouseWheel(object sender, MouseWheelEventArgs e)
834
        {
835
            e.Handled = true;
836
            if (e.Delta > 0)
837
            {
838
                Point currentContentMousePoint = e.GetPosition(zoomAndPanCanvas2);
839
                ZoomIn_Sync(currentContentMousePoint);
840
            }
841
            else
842
            {
843
                Point currentContentMousePoint = e.GetPosition(zoomAndPanCanvas2);
844
                ZoomOut_Sync(currentContentMousePoint);
845
            }
846
        }
847

    
848
        #region ZoomIn & ZoomOut
849

    
850
        private void ZoomOut_Executed(object sender, ExecutedRoutedEventArgs e)
851
        {
852
            ZoomOut(new Point(zoomAndPanControl.ContentZoomFocusX,
853
                zoomAndPanControl.ContentZoomFocusY));
854
        }
855

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

    
862

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

    
876
            if (zoomAndPanControl2 != null && Sync.IsChecked)
877
            {
878
                zoomAndPanControl2.ZoomAboutPoint(zoomAndPanControl.ContentScale, contentZoomCenter);
879
            }
880
        }
881

    
882
        private void ZoomIn(Point contentZoomCenter)
883
        {
884
            if (zoomAndPanControl.ContentScale > 0.19)
885
            {
886
                zoomAndPanControl.ZoomAboutPoint(zoomAndPanControl.ContentScale + 0.2, contentZoomCenter);
887
            }
888
            else
889
            {
890
                zoomAndPanControl.ZoomAboutPoint(zoomAndPanControl.ContentScale * 2, contentZoomCenter);
891
            }
892

    
893
            if (zoomAndPanControl2 != null && Sync.IsChecked)
894
            {
895
                zoomAndPanControl2.ZoomAboutPoint(zoomAndPanControl.ContentScale, contentZoomCenter);
896
            }
897

    
898
        }
899

    
900
        private void ZoomOut_Sync(Point contentZoomCenter)
901
        {
902
            if (zoomAndPanControl2.ContentScale > 0.39)
903
            {
904
                zoomAndPanControl2.ZoomAboutPoint(zoomAndPanControl2.ContentScale - 0.2, contentZoomCenter);
905
            }
906
            else
907
            {
908
                zoomAndPanControl2.ZoomAboutPoint(zoomAndPanControl2.ContentScale / 2, contentZoomCenter);
909
            }
910

    
911
            if (Sync.IsChecked)
912
            {
913
                zoomAndPanControl.ZoomAboutPoint(zoomAndPanControl2.ContentScale, contentZoomCenter);
914
            }
915
        }
916

    
917
        private void ZoomIn_Sync(Point contentZoomCenter)
918
        {
919
            if (zoomAndPanControl2.ContentScale > 0.19)
920
            {
921
                zoomAndPanControl2.ZoomAboutPoint(zoomAndPanControl2.ContentScale + 0.2, contentZoomCenter);
922
            }
923
            else
924
            {
925
                zoomAndPanControl2.ZoomAboutPoint(zoomAndPanControl2.ContentScale * 2, contentZoomCenter);
926
            }
927

    
928
            if (Sync.IsChecked)
929
            {
930
                zoomAndPanControl.ZoomAboutPoint(zoomAndPanControl2.ContentScale, contentZoomCenter);
931
            }
932
        }
933

    
934
        private void ZoomOut()
935
        {
936
            zoomAndPanControl.ContentScale -= 0.1;
937
            //if (zoomAndPanControl2 != null)
938
            //{
939
            //    zoomAndPanControl2.ContentScale -= 0.1;
940
            //}
941
        }
942

    
943
        private void ZoomIn()
944
        {
945
            zoomAndPanControl.ContentScale += 0.1;
946
            //if (zoomAndPanControl2 != null)
947
            //{
948
            //    zoomAndPanControl2.ContentScale += 0.1;
949
            //}
950
        }
951

    
952
        #endregion
953

    
954
        private void init()
955
        {
956
            foreach (var item in ViewerDataModel.Instance.MarkupControls)
957
            {
958

    
959
                ControlList.Clear();
960
                listBox.Items.Clear();
961
                selected_item.Clear();
962

    
963
                (item as IMarkupCommonData).IsSelected = false;
964
            }
965

    
966
        }
967

    
968
        private HitTestResultBehavior MyCallback(HitTestResult result)
969
        {
970
            //this.cursor = Cursors.UpArrow;
971
            var element = result.VisualHit;
972
            while (element != null && !(element is CommentUserInfo))
973
                element = VisualTreeHelper.GetParent(element);
974

    
975
            if (element == null)
976
            {
977
                return HitTestResultBehavior.Stop;
978
            }
979
            else
980
            {
981
                if (element is CommentUserInfo)
982
                {
983
                    if (!hitList.Contains(element))
984
                    {
985
                        hitList.Add((CommentUserInfo)element);
986
                    }
987
                    else
988
                    {
989
                        return HitTestResultBehavior.Stop;
990
                    }
991
                }
992
            }
993
            return HitTestResultBehavior.Continue;
994
        }
995

    
996
        public void ReleaseSelectPath()
997
        {
998
            if (SelectionPath == null)
999
            {
1000
                SelectionPath = new Path();
1001
                SelectionPath.Name = "";
1002
            }
1003
            if (SelectionPath.Name != "")
1004
            {
1005
                SelectionPath.Name = "None";
1006
            }
1007
            SelectionPath.Opacity = 0.01;
1008
            SelectionPath.RenderTransform = null;
1009
            SelectionPath.RenderTransformOrigin = new Point(0, 0);
1010
        }
1011

    
1012
        #region 컨트롤 초기화 
1013
        public void Control_Init(object control)
1014
        {
1015
            if (L_Size != 0 && (control as IPath) != null)
1016
            {
1017
                (control as IPath).LineSize = L_Size;
1018
                L_Size = 0;
1019
            }
1020

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

    
1107
        public void firstCondition_MouseLeave(object sender, MouseEventArgs e)
1108
        {
1109
            //Control_Init(e.Source);
1110
        }
1111
        //private Window _dragdropWindow = null;
1112

    
1113
        [DllImport("user32.dll")]
1114
        [return: MarshalAs(UnmanagedType.Bool)]
1115
        internal static extern bool GetCursorPos(ref Win32Point pt);
1116

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

    
1134

    
1135
               if (this._dragdropWindow != null)
1136
               {
1137
                   this._dragdropWindow.Close();
1138
                   this._dragdropWindow = null;
1139
               }
1140

    
1141
               symbol_id = id;
1142
               symbol_group_id = group_id;
1143
               symbol_SelectedIndex = SelectedIndex;
1144
               symbol_Data = Data_;
1145
               symbol_img = img;
1146

    
1147

    
1148
               CreateDragDropWindow2(img);
1149
              
1150
    }
1151

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

    
1172
            Win32Point w32Mouse = new Win32Point();
1173
            GetCursorPos(ref w32Mouse);
1174

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

    
1187
                Point currentPos = e.GetPosition(rect);
1188

    
1189
                floatingTip.HorizontalOffset = currentPos.X + 20;
1190
                floatingTip.VerticalOffset = currentPos.Y;
1191
            }
1192

    
1193
            getCurrentPoint = e.GetPosition(drawingRotateCanvas);
1194
            
1195
            if ((e.MiddleButton == MouseButtonState.Pressed) || (e.RightButton == MouseButtonState.Pressed))
1196
            {
1197
                SetCursor();
1198
                Point currentCanvasDrawingMouseMovePoint = e.GetPosition(drawingRotateCanvas);
1199
                Point currentCanvasZoomPanningMouseMovePoint = e.GetPosition(zoomAndPanCanvas);
1200

    
1201
                Vector dragOffset = currentCanvasZoomPanningMouseMovePoint - canvasZoommovingMouseDownPoint;
1202
                zoomAndPanControl.ContentOffsetX -= dragOffset.X;
1203
                zoomAndPanControl.ContentOffsetY -= dragOffset.Y;
1204

    
1205
                if (Sync.IsChecked)
1206
                {
1207
                    ViewerDataModel.Instance.Sync_ContentOffsetX = zoomAndPanControl.ContentOffsetX;
1208
                    ViewerDataModel.Instance.Sync_ContentOffsetY = zoomAndPanControl.ContentOffsetY;
1209
                }
1210
            }
1211

    
1212
            if (mouseHandlingMode == MouseHandlingMode.Drawing && currentControl != null)
1213
            {
1214
                Point currentCanvasDrawingMouseMovePoint = e.GetPosition(drawingRotateCanvas);
1215
                Point currentCanvasZoomPanningMouseMovePoint = e.GetPosition(zoomAndPanCanvas);
1216
                SetCursor();
1217

    
1218
                if (currentControl != null)
1219
                {
1220
                    double moveX = currentCanvasDrawingMouseMovePoint.X - canvasDrawingMouseDownPoint.X;
1221
                    double moveY = currentCanvasDrawingMouseMovePoint.Y - canvasDrawingMouseDownPoint.Y;
1222
                    //강인구 추가
1223
                    currentControl.Opacity = ViewerDataModel.Instance.ControlOpacity;
1224

    
1225
                    if ((currentControl as IPath) != null)
1226
                    {
1227
                        (currentControl as IPath).LineSize = ViewerDataModel.Instance.LineSize;
1228
                    }
1229
                    if ((currentControl as LineControl) != null)
1230
                    {
1231
                        (currentControl as LineControl).Interval = ViewerDataModel.Instance.Interval;
1232
                    }
1233

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

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

    
1352
                        case ControlType.ArcLine:
1353
                            {
1354
                                var control = currentControl as ArcControl;
1355
                                if (control != null)
1356
                                {
1357
                                    control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1358
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1359
                                }
1360
                            }
1361
                            break;
1362

    
1363
                        case ControlType.ArcArrow:
1364
                            {
1365
                                var control = currentControl as ArrowArcControl;
1366
                                if (control != null)
1367
                                {
1368
                                    control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1369
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1370
                                }
1371
                            }
1372
                            break;
1373

    
1374
                        case ControlType.ArrowMultiLine:
1375
                            {
1376
                                var control = currentControl as ArrowControl_Multi;
1377
                                if (control != null)
1378
                                {
1379
                                    control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1380
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1381
                                }
1382
                            }
1383
                            break;
1384

    
1385
                        case ControlType.Circle:
1386
                            {
1387
                                if (currentControl != null)
1388
                                {
1389
                                    currentControl.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1390
                                    (currentControl as CircleControl).DashSize = ViewerDataModel.Instance.DashSize;
1391
                                    (currentControl as CircleControl).Paint = ViewerDataModel.Instance.paintSet;
1392
                                }
1393
                            }
1394
                            break;
1395

    
1396
                        case ControlType.PolygonCloud:
1397
                            {
1398
                                var control = currentControl as CloudControl;
1399
                                if (control != null)
1400
                                {
1401
                                    control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1402
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1403
                                    control.Paint = ViewerDataModel.Instance.paintSet;
1404
                                }
1405
                            }
1406
                            break;
1407

    
1408
                        case ControlType.Triangle:
1409
                            {
1410
                                var control = currentControl as TriControl;
1411
                                if (control != null)
1412
                                {
1413
                                    control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1414
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1415
                                    control.Paint = ViewerDataModel.Instance.paintSet;
1416
                                }
1417
                            }
1418
                            break;
1419

    
1420
                        case ControlType.ImgControl:
1421
                            {
1422
                                var control = currentControl as ImgControl;
1423
                                if (control != null)
1424
                                {
1425
                                    control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1426
                                }
1427
                            }
1428
                            break;
1429

    
1430
                        case ControlType.Date:
1431
                            {
1432
                                var control = currentControl as DateControl;
1433
                                if (control != null)
1434
                                {
1435
                                    control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1436
                                }
1437
                            }
1438
                            break;
1439

    
1440
                        case ControlType.ArrowTextControl:
1441
                        case ControlType.ArrowTransTextControl:
1442
                        case ControlType.ArrowTextBorderControl:
1443
                        case ControlType.ArrowTransTextBorderControl:
1444
                        case ControlType.ArrowTextCloudControl:
1445
                        case ControlType.ArrowTransTextCloudControl:
1446
                            {
1447
                                var control = currentControl as ArrowTextControl;
1448
                                if (control != null)
1449
                                {
1450
                                    control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1451
                                }
1452
                            }
1453
                            break;
1454
                        case ControlType.PolygonControl:
1455
                        case ControlType.ChainLine:
1456
                            {
1457
                                var control = currentControl as PolygonControl;
1458
                                if (control != null)
1459
                                {
1460
                                    control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1461
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1462
                                    control.Paint = ViewerDataModel.Instance.paintSet;
1463
                                }
1464
                            }
1465
                            break;
1466
                        case ControlType.Sign:
1467
                            {
1468
                                var control = currentControl as SignControl;
1469
                                if (control != null)
1470
                                {
1471
                                    control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1472
                                }
1473
                            }
1474
                            break;
1475
                        case ControlType.Symbol:
1476
                            {
1477
                                var control = currentControl as SymControl;
1478
                                if (control != null)
1479
                                {
1480
                                    control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1481
                                }
1482
                            }
1483
                            break;
1484
                        case ControlType.Stamp:
1485
                            {
1486
                                var control = currentControl as SymControlN;
1487
                                if (control != null)
1488
                                {
1489
                                    if (control.STAMP != null)
1490
                                    {
1491
                                        control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1492
                                    }
1493
                                    else
1494
                                    {
1495
                                        currentControl = null;
1496
                                        this.cursor = new Cursor(MainWindow.CursorChange().StreamSource);
1497
                                        DialogMessage_Alert("Approved Stamp 가 등록되어 있지 않습니다. \n관리자에게 문의하세요.", "안내");
1498
                                    }
1499
                                }                                    
1500
                            }
1501
                            break;
1502
                        case ControlType.Rectangle:
1503
                        case ControlType.Mark:
1504
                            {
1505
                                var control = currentControl as RectangleControl;
1506
                                if (control != null)
1507
                                {
1508
                                    control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1509
                                    if(control.ControlType == ControlType.Mark) control.Paint = PaintSet.Fill;
1510
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1511
                                }
1512
                            }
1513
                            break;
1514
                        case ControlType.PenControl:
1515
                            {
1516
                                stroke.StylusPoints.Add(new StylusPoint(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y));
1517
                                //inkBoard.Strokes.Add(stroke);
1518
                            }
1519
                            break;
1520
                        default:
1521
                            break;
1522
                    }
1523
                }
1524
            }
1525
            else if(mouseHandlingMode == MouseHandlingMode.Drawing && e.LeftButton == MouseButtonState.Pressed)
1526
            {
1527
                Point currentCanvasDrawingMouseMovePoint = e.GetPosition(drawingRotateCanvas);
1528
                Point currentCanvasZoomPanningMouseMovePoint = e.GetPosition(zoomAndPanCanvas);
1529
                SetCursor();
1530
                if (currentControl == null)
1531
                {
1532
                    switch (controlType)
1533
                    {
1534
                        case ControlType.PenControl:
1535
                            {
1536
                                if (inkBoard.Tag.ToString() == "Ink")
1537
                                {
1538
                                    stroke.StylusPoints.Add(new StylusPoint(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y));
1539
                                }
1540
                                else if (inkBoard.Tag.ToString() == "EraseByPoint")
1541
                                {
1542
                                    RemovePointStroke(currentCanvasDrawingMouseMovePoint);
1543
                                }
1544
                                else if (inkBoard.Tag.ToString() == "EraseByStroke")
1545
                                {
1546
                                    RemoveLineStroke(currentCanvasDrawingMouseMovePoint);
1547
                                }
1548

    
1549
                                //inkBoard.Strokes.Add(stroke);
1550
                            }
1551
                            break;
1552
                    }
1553
                    return;
1554
                }
1555
            }
1556
            else if (((e.LeftButton == MouseButtonState.Pressed) && mouseHandlingMode == MouseHandlingMode.Selecting) || 
1557
                ((e.LeftButton == MouseButtonState.Pressed) && mouseHandlingMode == MouseHandlingMode.Capture) || 
1558
                ((e.LeftButton == MouseButtonState.Pressed) && mouseHandlingMode == MouseHandlingMode.DragZoom))
1559
            {
1560
                Point curMouseDownPoint = e.GetPosition(drawingRotateCanvas);
1561

    
1562
                if (isDraggingSelectionRect)
1563
                {
1564
                    UpdateDragSelectionRect(canvasDrawingMouseDownPoint, curMouseDownPoint);
1565
                    e.Handled = true;
1566
                }
1567
                else if (isLeftMouseButtonDownOnWindow)
1568
                {
1569
                    var dragDelta = curMouseDownPoint - canvasDrawingMouseDownPoint;
1570
                    double dragDistance = Math.Abs(dragDelta.Length);
1571

    
1572
                    if (dragDistance > DragThreshold)
1573
                    {
1574
                        isDraggingSelectionRect = true;
1575
                        InitDragSelectionRect(canvasDrawingMouseDownPoint, curMouseDownPoint);
1576
                    }
1577

    
1578
                    e.Handled = true;
1579
                }
1580

    
1581
                if (canvasDrawingMouseDownPoint == curMouseDownPoint)
1582
                {
1583
                }
1584
                else
1585
                {
1586
                    e.Handled = true;
1587
                }
1588
            }
1589
            /*
1590
            else if ((e.LeftButton == MouseButtonState.Pressed) && mouseHandlingMode == MouseHandlingMode.DragSymbol)
1591
            { //symbol      
1592
                if(_dragdropWindow != null)
1593
                {
1594
                    Win32Point w32Mouse = new Win32Point();
1595
                    GetCursorPos(ref w32Mouse);
1596

    
1597
                    this._dragdropWindow.Left = w32Mouse.X - (symbol_img.Width / 2);
1598
                    this._dragdropWindow.Top = w32Mouse.Y - (symbol_img.Height / 2);
1599
                }                
1600
            }
1601
            */
1602
            else if ((e.LeftButton == MouseButtonState.Released) && (e.MiddleButton == MouseButtonState.Released) && 
1603
                (e.RightButton == MouseButtonState.Released) && ViewerDataModel.Instance.MarkupControls_USER.Count > 0)
1604
            {
1605
                var control = ViewerDataModel.Instance.MarkupControls_USER.Where(data => data.IsMouseOver).FirstOrDefault();
1606
                if(control != null)
1607
                {
1608
                    this.cursor = Cursors.Hand;
1609
                    SetCursor();
1610
                }
1611
                else
1612
                {
1613
                    this.cursor = new Cursor(MainWindow.CursorChange().StreamSource);
1614
                    SetCursor();
1615
                }
1616
            }
1617
            else
1618
            {
1619
            }
1620
        }
1621

    
1622
        private void zoomAndPanControl2_MouseMove(object sender, MouseEventArgs e)
1623
        {
1624
            if ((e.MiddleButton == MouseButtonState.Pressed) || (e.RightButton == MouseButtonState.Pressed))
1625
            {
1626
                SetCursor();
1627
                Point currentCanvasDrawingMouseMovePoint = e.GetPosition(drawingRotateCanvas2);
1628
                Point currentCanvasZoomPanningMouseMovePoint = e.GetPosition(zoomAndPanCanvas2);
1629

    
1630
                Vector dragOffset = currentCanvasZoomPanningMouseMovePoint - canvasZoommovingMouseDownPoint;
1631

    
1632
                ViewerDataModel.Instance.Sync_ContentOffsetX -= dragOffset.X;
1633
                ViewerDataModel.Instance.Sync_ContentOffsetY -= dragOffset.Y;
1634

    
1635
                if (Sync.IsChecked)
1636
                {
1637
                    zoomAndPanControl.ContentOffsetX = ViewerDataModel.Instance.Sync_ContentOffsetX;
1638
                    zoomAndPanControl.ContentOffsetY = ViewerDataModel.Instance.Sync_ContentOffsetY;
1639
                }
1640
            }
1641
        }
1642

    
1643
        private List<CommentUserInfo> hitList = new List<CommentUserInfo>();
1644

    
1645
        private EllipseGeometry hitArea = new EllipseGeometry();
1646

    
1647
        private void zoomAndPanControl_MouseUp(object sender, MouseButtonEventArgs e)
1648
        {
1649
            IsDrawing = false;
1650

    
1651
            if (mouseHandlingMode != MouseHandlingMode.None)
1652
            {
1653
                if (mouseHandlingMode == MouseHandlingMode.Drawing)
1654
                {
1655
                    this.cursor = new Cursor(MainWindow.CursorChange().StreamSource);
1656

    
1657
                    SetCursor();
1658

    
1659
                    switch (controlType)
1660
                    {
1661
                        case ControlType.None:
1662
                            break;
1663
                        case ControlType.Rectangle:
1664
                            {
1665

    
1666
                            }
1667
                            break;
1668
                        case ControlType.PenControl:
1669
                            {
1670

    
1671
                            }
1672
                            break;
1673
                        default:
1674
                            break;
1675
                    }                    
1676
                }
1677
                else if (mouseHandlingMode == MouseHandlingMode.Selecting && e.ChangedButton == MouseButton.Left || mouseHandlingMode == MouseHandlingMode.Capture && e.ChangedButton == MouseButton.Left || mouseHandlingMode == MouseHandlingMode.DragZoom && e.ChangedButton == MouseButton.Left)
1678
                {
1679
                    if (isLeftMouseButtonDownOnWindow)
1680
                    {
1681
                        bool wasDragSelectionApplied = false;
1682

    
1683
                        if (isDraggingSelectionRect)
1684
                        {
1685
                            if (mouseHandlingMode == MouseHandlingMode.Capture && controlType == ControlType.ImgControl)
1686
                            {
1687
                                dragCaptureBorder.Visibility = Visibility.Collapsed;
1688
                                mouseHandlingMode = MouseHandlingMode.None;
1689
                                Point endPoint = e.GetPosition(zoomAndPanCanvas);
1690
                                symbolselectindex = symbolPanel_Instance.RadTab.SelectedIndex;
1691
                                Set_Symbol_Capture(endPoint);
1692
                                ViewerDataModel.Instance.ViewVisible = Visibility.Collapsed;
1693
                                ViewerDataModel.Instance.ViewVisible = Visibility.Visible;                                
1694
                                ViewerDataModel.Instance.Capture_Opacity = 0;
1695
                            }
1696
                            else if (mouseHandlingMode == MouseHandlingMode.Capture)
1697
                            {
1698
                                dragCaptureBorder.Visibility = Visibility.Collapsed;
1699
                                mouseHandlingMode = MouseHandlingMode.None;
1700
                                Set_Capture();
1701

    
1702
                                ViewerDataModel.Instance.ViewVisible = Visibility.Collapsed;
1703
                                ViewerDataModel.Instance.ViewVisible = Visibility.Visible;
1704
                                ViewerDataModel.Instance.Capture_Opacity = 0;
1705
                            }
1706
                            else if (mouseHandlingMode == MouseHandlingMode.Selecting)
1707
                            {
1708
                                ApplyDragSelectionRect();
1709
                            }
1710
                            else
1711
                            {
1712
                                double x = Canvas.GetLeft(dragZoomBorder);
1713
                                double y = Canvas.GetTop(dragZoomBorder);
1714
                                double width = dragZoomBorder.Width;
1715
                                double height = dragZoomBorder.Height;
1716
                                Rect dragRect = new Rect(x, y, width, height);
1717

    
1718
                                ViewerDataModel.Instance.SystemMain.dzMainMenu.zoomAndPanControl.ZoomTo(dragRect);
1719

    
1720
                                dragZoomBorder.Visibility = Visibility.Collapsed;
1721
                            }
1722

    
1723
                            isDraggingSelectionRect = false;
1724
                            e.Handled = true;
1725
                            wasDragSelectionApplied = true;
1726
                        }
1727

    
1728
                        if (isLeftMouseButtonDownOnWindow)
1729
                        {
1730
                            isLeftMouseButtonDownOnWindow = false;
1731
                            this.ReleaseMouseCapture();
1732
                            e.Handled = true;
1733
                        }
1734

    
1735
                        if (!wasDragSelectionApplied)
1736
                        {
1737
                            init();
1738
                        }
1739
                    }
1740
                }
1741
                else if (e.RightButton == MouseButtonState.Pressed)
1742
                {
1743
                    this.cursor = new Cursor(MainWindow.CursorChange().StreamSource);
1744
                    SetCursor();
1745
                }
1746

    
1747
                zoomAndPanControl.ReleaseMouseCapture();
1748

    
1749

    
1750
                e.Handled = true;
1751
            }
1752
            else
1753
            {
1754
                this.cursor = new Cursor(MainWindow.CursorChange().StreamSource);
1755
                SetCursor();
1756
            }
1757

    
1758
            ///mouseButtonDown = MouseButton.Left;
1759
            //controlType = ControlType.SingleLine;
1760
        }
1761

    
1762
        public void Set_Symbol_Capture(Point endPoint)
1763
        {       
1764
            double x = canvasDrawingMouseDownPoint.X;
1765
            double y = canvasDrawingMouseDownPoint.Y;
1766
            if(x > endPoint.X)
1767
            {
1768
                x = endPoint.X;
1769
                y = endPoint.Y;
1770
            }
1771

    
1772
            double width = dragCaptureBorder.Width;
1773
            double height = dragCaptureBorder.Height;
1774

    
1775
            canvasImage = ConverterBitmapImage(zoomAndPanCanvas);
1776

    
1777
            if (x < 0)
1778
            {
1779
                width += x;
1780
                x = 0;
1781
            }
1782
            if (y < 0)
1783
            {
1784
                height += y;
1785
                y = 0;
1786

    
1787
                width = (int)canvasImage.PixelWidth - x;
1788
            }
1789
            if (x + width > canvasImage.PixelWidth)
1790
            {
1791
                width = (int)canvasImage.PixelWidth - x;
1792
            }
1793
            if (y + height > canvasImage.PixelHeight)
1794
            {
1795
                height = (int)canvasImage.PixelHeight - y;
1796
            }
1797
            var rect = new Int32Rect((int)x, (int)y, (int)width, (int)height);
1798

    
1799
            string uri = "";
1800
            if (userData.COMPANY != "EXT")
1801
            {
1802
                uri = String.Format(CommonLib.Common.GetConfigString("mainServerImageWebPath", "URL", "", App.isExternal), _ViewInfo.ProjectNO,
1803
                    (Convert.ToInt32(_ViewInfo.DocumentItemID) / 100).ToString(), _ViewInfo.DocumentItemID, Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber);
1804
            }
1805
            else
1806
            {
1807
                uri = String.Format(CommonLib.Common.GetConfigString("subServerImageWebPath", "URL", "", App.isExternal), _ViewInfo.ProjectNO, _ViewInfo.DocumentItemID,
1808
                    Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber);
1809
            }
1810

    
1811
            var defaultBitmapImage = new BitmapImage();
1812
            defaultBitmapImage.BeginInit();
1813
            defaultBitmapImage.CreateOptions = BitmapCreateOptions.IgnoreImageCache;
1814
            defaultBitmapImage.CacheOption = BitmapCacheOption.OnLoad;
1815
            defaultBitmapImage.UriSource = new Uri(uri);
1816
            defaultBitmapImage.EndInit();
1817

    
1818
            //GC.Collect();
1819

    
1820
            if (defaultBitmapImage.IsDownloading)
1821
            {
1822
                defaultBitmapImage.DownloadCompleted += (ex, arg) =>
1823
                {
1824
                    defaultBitmapImage.Freeze();
1825
                    //GC.Collect();
1826
                    BitmapSource bs = new CroppedBitmap(defaultBitmapImage, rect);
1827
                    Save_Symbol_Capture(bs, (int)x, (int)y, (int)width, (int)height);
1828
                };
1829
            }
1830
        }
1831

    
1832
        private void zoomAndPanControl2_MouseUp(object sender, MouseButtonEventArgs e)
1833
        {
1834
            ///mouseButtonDown = MouseButton.Left;
1835
        }
1836

    
1837
        private void zoomAndPanControl_MouseLeave(object sender, MouseEventArgs e)
1838
        {
1839
            ///mouseButtonDown = MouseButton.Left;
1840
            //this.cursor = new Cursor(MainWindow.CursorChange().StreamSource);
1841
        }
1842

    
1843
        private void zoomAndPanControl_MouseDoubleClick(object sender, MouseButtonEventArgs e)
1844
        {
1845

    
1846
        }
1847

    
1848
        /// <summary>
1849
        /// select items by dragging
1850
        /// </summary>
1851
        private void ApplyDragSelectionRect()
1852
        {
1853
            dragSelectionBorder.Visibility = Visibility.Collapsed;
1854

    
1855
            double x = Canvas.GetLeft(dragSelectionBorder);
1856
            double y = Canvas.GetTop(dragSelectionBorder);
1857
            double width = dragSelectionBorder.Width;
1858
            double height = dragSelectionBorder.Height;
1859
            Boolean Flag = false;
1860
            List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>();
1861
            var Items = ViewerDataModel.Instance.MarkupControls_USER.Where(d => d.Visibility != Visibility.Hidden).ToList();
1862

    
1863
            Rect dragRect = new Rect(x, y, width, height);
1864
            ///dragRect.Inflate(width / 10, height / 10);
1865

    
1866
            foreach (var item in Items)
1867
            {
1868
                Flag = SelectionSet.Instance.SelectControl(item, dragRect);
1869

    
1870
                if (Flag)
1871
                {
1872
                    adornerSet.Add(item);
1873
                    ViewerDataModel.Instance.MarkupControls_USER.Remove(item);
1874
                    Control_Style(item);
1875
                }
1876
            }
1877
            if (adornerSet.Count > 0)
1878
            {
1879
                Controls.AdornerFinal final = new Controls.AdornerFinal(adornerSet);
1880
                SelectLayer.Children.Add(final);
1881
            }
1882
        }
1883

    
1884
        private void InitDragSelectionRect(Point pt1, Point pt2)
1885
        {
1886
            //캡쳐 중
1887
            if (mouseHandlingMode == MouseHandlingMode.Capture)
1888
            {
1889
                dragCaptureBorder.Visibility = Visibility.Visible;
1890
            }
1891
            //선택 중
1892
            else if (mouseHandlingMode == MouseHandlingMode.Selecting)
1893
            {
1894

    
1895
                dragSelectionBorder.Visibility = Visibility.Visible;
1896
            }
1897
            else
1898
            {
1899
                dragZoomBorder.Visibility = Visibility.Visible;
1900
            }
1901
            UpdateDragSelectionRect(pt1, pt2);
1902
        }
1903

    
1904
        /// <summary>
1905
        /// Update the position and size of the rectangle used for drag selection.
1906
        /// </summary>
1907
        private void UpdateDragSelectionRect(Point pt1, Point pt2)
1908
        {
1909
            double x, y, width, height;
1910

    
1911
            //
1912
            // Determine x,y,width and height of the rect inverting the points if necessary.
1913
            // 
1914

    
1915
            if (pt2.X < pt1.X)
1916
            {
1917
                x = pt2.X;
1918
                width = pt1.X - pt2.X;
1919
            }
1920
            else
1921
            {
1922
                x = pt1.X;
1923
                width = pt2.X - pt1.X;
1924
            }
1925

    
1926
            if (pt2.Y < pt1.Y)
1927
            {
1928
                y = pt2.Y;
1929
                height = pt1.Y - pt2.Y;
1930
            }
1931
            else
1932
            {
1933
                y = pt1.Y;
1934
                height = pt2.Y - pt1.Y;
1935
            }
1936

    
1937
            //
1938
            // Update the coordinates of the rectangle used for drag selection.
1939
            //
1940
            //캡쳐 중
1941
            if (mouseHandlingMode == MouseHandlingMode.Capture)
1942
            {
1943
                Canvas.SetLeft(dragCaptureBorder, x);
1944
                Canvas.SetTop(dragCaptureBorder, y);
1945
                dragCaptureBorder.Width = width;
1946
                dragCaptureBorder.Height = height;
1947
            }
1948
            //선택 중
1949
            else if (mouseHandlingMode == MouseHandlingMode.Selecting)
1950
            {
1951
                Canvas.SetLeft(dragSelectionBorder, x);
1952
                Canvas.SetTop(dragSelectionBorder, y);
1953
                dragSelectionBorder.Width = width;
1954
                dragSelectionBorder.Height = height;
1955
            }
1956
            else
1957
            {
1958
                Canvas.SetLeft(dragZoomBorder, x);
1959
                Canvas.SetTop(dragZoomBorder, y);
1960
                dragZoomBorder.Width = width;
1961
                dragZoomBorder.Height = height;
1962
            }
1963
        }
1964

    
1965
        private void drawingPannelRotate(double angle)
1966
        {
1967
            Logger.sendCheckLog("pageNavigator_PageChanging_drawingPannelRotate Setting", 1);
1968
            rotate.Angle = angle;
1969
            var rotationNum = Math.Abs((rotate.Angle / 90));
1970

    
1971
            if (angle == 90 || angle == 270)
1972
            {
1973
                double emptySize = zoomAndPanCanvas.Width;
1974
                zoomAndPanCanvas.Width = zoomAndPanCanvas.Height;
1975
                zoomAndPanCanvas.Height = emptySize;
1976
            }
1977
            if (angle == 0)
1978
            {
1979
                translate.X = 0;
1980
                translate.Y = 0;
1981
            }
1982
            else if (angle == 90)
1983
            {
1984
                translate.X = zoomAndPanCanvas.Width;
1985
                translate.Y = 0;
1986
            }
1987
            else if (angle == 180)
1988
            {
1989
                translate.X = zoomAndPanCanvas.Width;
1990
                translate.Y = zoomAndPanCanvas.Height;
1991
            }
1992
            else
1993
            {
1994
                translate.X = 0;
1995
                translate.Y = zoomAndPanCanvas.Height;
1996
            }
1997

    
1998
            zoomAndPanControl.RotationAngle = rotate.Angle;
1999

    
2000

    
2001
            if (!testPanel2.IsHidden)
2002
            {
2003
                zoomAndPanControl2.RotationAngle = rotate.Angle;
2004
                zoomAndPanCanvas2.Width = zoomAndPanCanvas.Width;
2005
                zoomAndPanCanvas2.Height = zoomAndPanCanvas.Height;
2006
            }
2007

    
2008
            ViewerDataModel.Instance.ContentWidth = zoomAndPanCanvas.Width;
2009
            ViewerDataModel.Instance.ContentHeight = zoomAndPanCanvas.Height;
2010
            ViewerDataModel.Instance.AngleOffsetX = translate.X;
2011
            ViewerDataModel.Instance.AngleOffsetY = translate.Y;
2012
            ViewerDataModel.Instance.Angle = rotate.Angle;
2013
        }
2014

    
2015
        private void syncPannelRotate(double angle)
2016
        {
2017
            //Logger.sendCheckLog("pageNavigator_PageChanging_drawingPannelRotate Setting", 1);
2018
            rotate.Angle = angle;
2019
            var rotationNum = Math.Abs((rotate.Angle / 90));
2020

    
2021
            if (angle == 90 || angle == 270)
2022
            {
2023
                double emptySize = zoomAndPanCanvas2.Width;
2024
                zoomAndPanCanvas2.Width = zoomAndPanCanvas2.Height;
2025
                zoomAndPanCanvas2.Height = emptySize;
2026
            }
2027
            if (angle == 0)
2028
            {
2029
                translate2.X = 0;
2030
                translate2.Y = 0;
2031
            }
2032
            else if (angle == 90)
2033
            {
2034
                translate2.X = zoomAndPanCanvas2.Width;
2035
                translate2.Y = 0;
2036
            }
2037
            else if (angle == 180)
2038
            {
2039
                translate2.X = zoomAndPanCanvas2.Width;
2040
                translate2.Y = zoomAndPanCanvas2.Height;
2041
            }
2042
            else
2043
            {
2044
                translate2.X = 0;
2045
                translate2.Y = zoomAndPanCanvas2.Height;
2046
            }
2047

    
2048
            zoomAndPanControl2.RotationAngle = rotate.Angle;
2049
        }
2050

    
2051
        public void PlaceImageSymbol(string id, long group_id, int SelectedIndex, Point canvasZoomPanningMouseDownPoint)
2052
        {
2053
            string Data_ = "";
2054

    
2055
            try
2056
            {
2057
                Logger.sendReqLog("GetSymbolImageURL: ", id + "," + SelectedIndex, 1);
2058
                Data_ = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.GetSymbolImageURL(id, SelectedIndex);
2059
                if (Data_ != null || Data_ != "")
2060
                {
2061
                    Logger.sendResLog("GetSymbolImageURL", "TRUE", 1);
2062
                }
2063
                else
2064
                {
2065
                    Logger.sendResLog("GetSymbolImageURL", "FALSE", 1);
2066
                }
2067

    
2068
                //MARKUP_DATA_GROUP mARKUP_DATA_GROUP = new MARKUP_DATA_GROUP
2069
                //{
2070
                //    SYMBOL_ID = id,//InnerItem.Symbol_ID
2071
                //    STATE = 0,
2072
                //};
2073
                if (Data_ != null)
2074
                {
2075
                    Image img = new Image();
2076
                    //img.Source = new System.Windows.Media.Imaging.BitmapImage(new Uri(Data_));
2077
                    if (Data_.Contains(".svg"))
2078
                    {
2079
                        byte[] imageData = null;
2080
                        DrawingImage image = null;
2081
                        using (System.Net.WebClient web = new System.Net.WebClient())
2082
                        {
2083
                            imageData = web.DownloadData(new Uri(Data_));
2084
                            System.IO.Stream stream = new System.IO.MemoryStream(imageData);
2085
                            image = SvgReader.Load(stream);
2086
                        }
2087
                        img.Source = image;
2088
                    }
2089
                    else
2090
                    {
2091
                        img.Source = new BitmapImage(new Uri(Data_));
2092
                    }
2093

    
2094
                    var currentControl = new MarkupToPDF.Controls.Etc.ImgControl
2095
                    {
2096
                        PointSet = new List<Point>(),
2097
                        FilePath = Data_,
2098
                        ImageData = img.Source,
2099
                        StartPoint = canvasZoomPanningMouseDownPoint,
2100
                        EndPoint = new Point(canvasZoomPanningMouseDownPoint.X + img.Source.Width, 
2101
                        canvasZoomPanningMouseDownPoint.Y + img.Source.Height),
2102
                        TopRightPoint = new Point(canvasZoomPanningMouseDownPoint.X+img.Source.Width,
2103
                        canvasZoomPanningMouseDownPoint.Y),
2104
                        LeftBottomPoint = new Point(canvasZoomPanningMouseDownPoint.X,
2105
                        canvasZoomPanningMouseDownPoint.Y + img.Source.Height)
2106
                    };
2107

    
2108
                    currentControl.PointSet = new List<Point>
2109
                                        {
2110
                                            currentControl.StartPoint,
2111
                                            currentControl.LeftBottomPoint,
2112
                                            currentControl.EndPoint,
2113
                                            currentControl.TopRightPoint,
2114
                                        };
2115
                    Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
2116
                    UndoData = new Undo_data()
2117
                    {
2118
                        IsUndo = false,
2119
                        Event = Event_Type.Create,
2120
                        EventTime = DateTime.Now,
2121
                        Markup_List = new List<Multi_Undo_data>()
2122
                    };
2123
                    ViewerDataModel.Instance.UndoDataList.Where(data1 => data1.IsUndo == true).ToList().ForEach(i =>
2124
                    {
2125
                        ViewerDataModel.Instance.UndoDataList.Remove(i);
2126
                    });
2127

    
2128
                    //multi_Undo_Data = dzMainMenu.Control_Style(currentControl as MarkupToPDF.Common.CommentUserInfo);
2129
                    multi_Undo_Data = Control_Style(currentControl as MarkupToPDF.Common.CommentUserInfo);
2130
                    UndoData.Markup_List.Add(multi_Undo_Data);
2131
                    ViewerDataModel.Instance.UndoDataList.Add(UndoData);
2132

    
2133
                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl as MarkupToPDF.Common.CommentUserInfo);
2134
                    currentControl.CommentID = Commons.shortGuid();
2135
                    currentControl.SymbolID = id;
2136
                    currentControl.GroupID = group_id;
2137
                    currentControl.ApplyTemplate();
2138
                    currentControl.SetImage();
2139

    
2140
                    ViewerDataModel.Instance.MarkupControls_USER.Remove(currentControl as MarkupToPDF.Common.CommentUserInfo);
2141
                    Controls.AdornerFinal final = new Controls.AdornerFinal(currentControl as MarkupToPDF.Common.CommentUserInfo);
2142
                    SelectLayer.Children.Add(final);
2143
                }
2144
            }
2145
            catch (Exception ex)
2146
            {
2147
                this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert(ex.Message, "Error");
2148
            }
2149
        }
2150

    
2151
        private void zoomAndPanControl_MouseDown(object sender, MouseButtonEventArgs e)
2152
        {            
2153
            var set_option = this.ParentOfType<MainWindow>().dzTopMenu.Parent.ChildrenOfType<RadNumericUpDown>().Where(item => item.IsKeyboardFocusWithin).FirstOrDefault();
2154
            if (set_option != null && !string.IsNullOrEmpty(set_option.ContentText))
2155
            {
2156
                set_option.Value = double.Parse(set_option.ContentText);
2157
                //set_option.Focusable = false;
2158
                zoomAndPanControl.Focus();
2159
            }
2160

    
2161
            ConvertInkControlToPolygon();
2162

    
2163
            ///TODO:
2164
            var text_item = ViewerDataModel.Instance.MarkupControls_USER.Where(data =>
2165
            (data as TextControl) != null && (data as TextControl).Text == "" || (data as ArrowTextControl) != null && (data as ArrowTextControl).ArrowText == "").FirstOrDefault();
2166

    
2167
            if (text_item != null && (currentControl as ArrowTextControl) == null)
2168
            {
2169
                ViewerDataModel.Instance.MarkupControls_USER.Remove(text_item);
2170
            }
2171
            /// up to here
2172

    
2173
            foreach (var item in ViewerDataModel.Instance.MarkupControls_USER)
2174
            {
2175
                if (item as ArrowTextControl != null)
2176
                {
2177
                    (item as ArrowTextControl).Base_TextBox.IsHitTestVisible = false;
2178
                }
2179
                else if (item as TextControl != null)
2180
                {
2181
                    (item as TextControl).Base_TextBox.IsHitTestVisible = false;
2182
                }
2183
            }
2184

    
2185
            //if (currentControl != null)
2186
            {
2187
                var text_item_ = ViewerDataModel.Instance.MarkupControls_USER.Where(data => (data as TextControl) != null && (data as TextControl).IsEditingMode == true).FirstOrDefault();
2188
                if (text_item_ != null)
2189
                {
2190
                    (text_item_ as TextControl).Base_TextBlock.Visibility = Visibility.Visible;
2191
                    (text_item_ as TextControl).Base_TextBox.Visibility = Visibility.Collapsed;
2192
                    (text_item_ as TextControl).IsEditingMode = false;                    
2193
                    currentControl = null;
2194
                }
2195

    
2196
                var Arrowtext_item_ = ViewerDataModel.Instance.MarkupControls_USER.Where(data => (data as ArrowTextControl) != null && (data as ArrowTextControl).IsEditingMode == true).FirstOrDefault();
2197
                if (Arrowtext_item_ != null && ((Arrowtext_item_ as ArrowTextControl).IsNew == false))
2198
                {
2199
                    (Arrowtext_item_ as ArrowTextControl).IsEditingMode = false;
2200
                    (Arrowtext_item_ as ArrowTextControl).Base_TextBox.Focusable = false;
2201
                    currentControl = null;
2202
                }
2203
            }
2204

    
2205
            double Ang = 0;                                          
2206
            if (rotate.Angle != 0)
2207
            {
2208
                Ang = 360 - rotate.Angle;
2209
            }
2210

    
2211
            if (e.OriginalSource is System.Windows.Controls.Image)
2212
            {
2213
                (e.OriginalSource as System.Windows.Controls.Image).Focus();
2214
            }
2215
            /*
2216
            if (mouseHandlingMode == MouseHandlingMode.DragSymbol && e.LeftButton == MouseButtonState.Pressed)
2217
            {                
2218
                canvasZoomPanningMouseDownPoint = e.GetPosition(zoomAndPanCanvas);
2219
                if(symbol_id != null)
2220
                {
2221
                    PlaceImageSymbol(symbol_id, symbol_group_id, symbol_SelectedIndex, canvasZoomPanningMouseDownPoint);
2222
                }                
2223
            }
2224

    
2225
            if (mouseHandlingMode == MouseHandlingMode.DragSymbol && e.RightButton == MouseButtonState.Pressed)
2226
            {
2227
                if (this._dragdropWindow != null)
2228
                {
2229
                    this._dragdropWindow.Close();
2230
                    this._dragdropWindow = null;
2231
                    symbol_id = null;
2232
                }
2233
            }
2234
            */
2235

    
2236
            if (e.LeftButton == MouseButtonState.Pressed)
2237
            {
2238
                canvasDrawingMouseDownPoint = e.GetPosition(drawingRotateCanvas);
2239
                canvasZoomPanningMouseDownPoint = e.GetPosition(zoomAndPanCanvas);
2240

    
2241
                this.cursor = new Cursor(MainWindow.CursorChange().StreamSource);
2242
                SetCursor();
2243

    
2244
                if (!ViewerDataModel.Instance.IsPressCtrl) SelectionSet.Instance.UnSelect(this);
2245
            }
2246

    
2247
            if (e.MiddleButton == MouseButtonState.Pressed)
2248
            {
2249
                canvasZoommovingMouseDownPoint = e.GetPosition(zoomAndPanCanvas);
2250
                cursor = Cursors.SizeAll;
2251
                SetCursor();
2252
            }
2253
            if (e.RightButton == MouseButtonState.Pressed)
2254
            {
2255
                canvasZoommovingMouseDownPoint = e.GetPosition(zoomAndPanCanvas);
2256
                cursor = Cursors.SizeAll;
2257
                SetCursor();
2258
            }
2259
            else if (e.XButton1 == MouseButtonState.Pressed)
2260
            {
2261
                if (this.pageNavigator.CurrentPage.PageNumber + 1 <= this.pageNavigator.PageCount)
2262
                {
2263
                    this.pageNavigator.GotoPage(this.pageNavigator.CurrentPage.PageNumber + 1);
2264
                }
2265

    
2266
                //this.pageNavigator.GotoPage(this.pageNavigator._NextPage.PageNumber);
2267

    
2268
            }
2269
            else if (e.XButton2 == MouseButtonState.Pressed)
2270
            {
2271
                if (this.pageNavigator.CurrentPage.PageNumber > 1)
2272
                {
2273
                    this.pageNavigator.GotoPage(this.pageNavigator.CurrentPage.PageNumber - 1);
2274
                }
2275
            }
2276

    
2277
            if (e.LeftButton == MouseButtonState.Pressed && mouseHandlingMode != MouseHandlingMode.Drawing && currentControl == null)
2278
            {
2279
                if (mouseHandlingMode == MouseHandlingMode.Selecting)
2280
                {
2281
                    if (SelectLayer.Children.Count == 0)
2282
                    {
2283
                        isLeftMouseButtonDownOnWindow = true;
2284
                        mouseHandlingMode = MouseHandlingMode.Selecting;
2285
                    }
2286

    
2287
                    if (controlType == ControlType.None)
2288
                    {
2289
                        isLeftMouseButtonDownOnWindow = true;
2290
                    }
2291
                }
2292

    
2293
                /// 캡쳐 모드 설정
2294
                if (mouseHandlingMode == MouseHandlingMode.Capture)
2295
                {
2296
                    dragCaptureBorder.Visibility = Visibility.Visible;
2297
                    isLeftMouseButtonDownOnWindow = true;
2298
                }
2299

    
2300
                /// 줌 모드 설정
2301
                if (mouseHandlingMode == MouseHandlingMode.DragZoom)
2302
                {
2303
                    isLeftMouseButtonDownOnWindow = true;
2304
                }
2305

    
2306
                var control = ViewerDataModel.Instance.MarkupControls_USER.Where(data => data.IsMouseOver).FirstOrDefault();
2307
                if (control != null)
2308
                {
2309
                    AdornerFinal final = null;
2310

    
2311
                    if (!ViewerDataModel.Instance.IsPressCtrl)
2312
                    {
2313
                        /// 기존 selection 해제
2314
                        SelectionSet.Instance.UnSelect(this);
2315

    
2316
                        final = new AdornerFinal(control);
2317

    
2318
                        this.Control_Style(control);
2319

    
2320
                        if ((control as IPath) != null)
2321
                        {
2322
                            if ((control as IPath).LineSize != 0)
2323
                            {
2324
                                ViewerDataModel.Instance.LineSize = (control as IPath).LineSize;
2325
                            }
2326
                        }
2327
                        if ((control as IShapeControl) != null)
2328
                        {
2329
                            if ((control as IShapeControl).Paint == PaintSet.Hatch)
2330
                            {
2331
                                ViewerDataModel.Instance.checkHatchShape = true;
2332
                            }
2333
                            else if ((control as IShapeControl).Paint == PaintSet.Fill)
2334
                            {
2335
                                ViewerDataModel.Instance.checkFillShape = true;
2336
                            }
2337
                            else
2338
                            {
2339
                                ViewerDataModel.Instance.checkHatchShape = false;
2340
                                ViewerDataModel.Instance.checkFillShape = false;
2341
                            }
2342
                            ViewerDataModel.Instance.paintSet = (control as IShapeControl).Paint;
2343
                        }
2344

    
2345
                        ViewerDataModel.Instance.ControlOpacity = control.Opacity;
2346

    
2347
                        if ((control as TextControl) != null)
2348
                        {
2349
                            if(!((control as TextControl).EnableEditing)) {
2350
                                (control as TextControl).EnableEditing = true;
2351
                            }
2352
                            if ((control as TextControl).TextStyle == FontStyles.Italic)
2353
                            {
2354
                                ViewerDataModel.Instance.checkTextStyle = true;
2355
                            }
2356
                            else
2357
                            {
2358
                                ViewerDataModel.Instance.checkTextStyle = false;
2359
                            }
2360
                            if ((control as TextControl).TextWeight == FontWeights.Bold)
2361
                            {
2362
                                ViewerDataModel.Instance.checkTextWeight = true;
2363
                            }
2364
                            else
2365
                            {
2366
                                ViewerDataModel.Instance.checkTextWeight = false;
2367
                            }
2368
                            if ((control as TextControl).UnderLine == TextDecorations.Underline)
2369
                            {
2370
                                ViewerDataModel.Instance.checkUnderLine = true;
2371
                            }
2372
                            else
2373
                            {
2374
                                ViewerDataModel.Instance.checkUnderLine = false;
2375
                            }
2376
                            ViewerDataModel.Instance.TextSize = (control as TextControl).TextSize;
2377
                            ViewerDataModel.Instance.checkHighlight = (control as TextControl).IsHighLight;
2378

    
2379
                        }
2380
                        else if ((control as ArrowTextControl) != null)
2381
                        {
2382
                            if (!((control as ArrowTextControl).EnableEditing))
2383
                            {
2384
                                (control as ArrowTextControl).EnableEditing = true;
2385
                            }
2386
                            if ((control as ArrowTextControl).TextStyle == FontStyles.Italic)
2387
                            {
2388
                                ViewerDataModel.Instance.checkTextStyle = true;
2389
                            }
2390
                            else
2391
                            {
2392
                                ViewerDataModel.Instance.checkTextStyle = false;
2393
                            }
2394
                            if ((control as ArrowTextControl).TextWeight == FontWeights.Bold)
2395
                            {
2396
                                ViewerDataModel.Instance.checkTextWeight = true;
2397
                            }
2398
                            else
2399
                            {
2400
                                ViewerDataModel.Instance.checkTextWeight = false;
2401
                            }
2402
                            if ((control as ArrowTextControl).UnderLine == TextDecorations.Underline)
2403
                            {
2404
                                ViewerDataModel.Instance.checkUnderLine = true;
2405
                            }
2406
                            else
2407
                            {
2408
                                ViewerDataModel.Instance.checkUnderLine = false;
2409
                            }
2410
                            ViewerDataModel.Instance.checkHighlight = (control as ArrowTextControl).isHighLight;
2411
                            ViewerDataModel.Instance.TextSize = (control as ArrowTextControl).TextSize;
2412
                        }
2413
                        else if ((control as RectCloudControl) != null)
2414
                        {
2415
                            ViewerDataModel.Instance.ArcLength = (control as RectCloudControl).ArcLength;
2416
                        }
2417
                        else if ((control as CloudControl) != null)
2418
                        {
2419
                            ViewerDataModel.Instance.ArcLength = (control as CloudControl).ArcLength;
2420
                        }
2421
                    }
2422
                    else
2423
                    {
2424
                        List<CommentUserInfo> comment = SelectionSet.Instance.SelectedItems;
2425
                        SelectionSet.Instance.UnSelect(this);
2426
                        comment.Add(control);
2427

    
2428
                        Control_Style(control);
2429

    
2430
                        final = new AdornerFinal(comment);
2431
                    }
2432

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

    
2476
                switch (controlType)
2477
                {
2478
                    case ControlType.Coordinate:
2479
                        {
2480
                            if (e.LeftButton == MouseButtonState.Pressed)
2481
                            {
2482
                                if (currentControl is CoordinateControl)
2483
                                {
2484
                                    if (IsGetoutpoint((currentControl as CoordinateControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
2485
                                    {
2486
                                        return;
2487
                                    }
2488

    
2489
                                    CreateCommand.Instance.Execute(currentControl);
2490

    
2491
                                    currentControl = null;
2492
                                    this.cursor = Cursors.Arrow;
2493
                                }
2494
                                else
2495
                                {
2496
                                    this.ParentOfType<MainWindow>().dzTopMenu._SaveEvent(null, null);
2497
                                    if (ViewerDataModel.Instance.MyMarkupList.Where(d => d.PageNumber == Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber
2498
                                     && d.Data_Type == Convert.ToInt32(MarkupToPDF.Controls.Common.ControlType.Coordinate)).Count() > 0)
2499
                                    {
2500
                                        currentControl = null;
2501
                                        this.cursor = Cursors.Arrow;
2502
                                        Common.ViewerDataModel.Instance.SystemMain.DialogMessage_Alert("이미 해당 페이지의 도면 영역을 설정하셨습니다.", "Notice");
2503
                                        return;
2504
                                    }
2505
                                    else
2506
                                    {
2507
                                        currentControl = new CoordinateControl
2508
                                        {
2509
                                            Background = new SolidColorBrush(Colors.Black),
2510
                                            StartPoint = this.canvasDrawingMouseDownPoint,
2511
                                            ControlType = ControlType.Coordinate
2512
                                        };
2513

    
2514
                                        currentControl.CommentID = Commons.shortGuid();
2515
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
2516
                                        currentControl.IsNew = true;
2517

    
2518
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
2519

    
2520
                                        currentControl.SetValue(Canvas.ZIndexProperty, 3);
2521
                                    }
2522
                                }
2523
                            }
2524
                        }
2525
                        break;
2526
                    case ControlType.InsideWhite:
2527
                        {
2528
                            if (e.LeftButton == MouseButtonState.Pressed)
2529
                            {
2530
                                if (currentControl is InsideWhiteControl)
2531
                                {
2532
                                    if (IsGetoutpoint((currentControl as InsideWhiteControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
2533
                                    {
2534
                                        return;
2535
                                    }
2536

    
2537
                                    CreateCommand.Instance.Execute(currentControl);
2538

    
2539
                                    currentControl = null;
2540
                                    this.cursor = Cursors.Arrow;
2541
                                }
2542
                                else
2543
                                {
2544
                                    currentControl = new InsideWhiteControl
2545
                                    {
2546
                                        Background = new SolidColorBrush(Colors.Black),
2547
                                        StartPoint = this.canvasDrawingMouseDownPoint,
2548
                                        ControlType = ControlType.InsideWhite
2549
                                    };
2550

    
2551
                                    currentControl.CommentID = Commons.shortGuid();
2552
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
2553
                                    currentControl.IsNew = true;
2554
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
2555

    
2556
                                    currentControl.SetValue(Canvas.ZIndexProperty, 3);
2557
                                }
2558
                            }
2559
                        }
2560
                        break;
2561
                    case ControlType.OverlapWhite:
2562
                        {
2563
                            if (e.LeftButton == MouseButtonState.Pressed)
2564
                            {
2565
                                if (currentControl is OverlapWhiteControl)
2566
                                {
2567
                                    if (IsGetoutpoint((currentControl as OverlapWhiteControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
2568
                                    {
2569
                                        return;
2570
                                    }
2571

    
2572
                                    CreateCommand.Instance.Execute(currentControl);
2573

    
2574
                                    currentControl = null;
2575
                                    this.cursor = Cursors.Arrow;
2576
                                }
2577
                                else
2578
                                {
2579
                                    currentControl = new OverlapWhiteControl
2580
                                    {
2581
                                        Background = new SolidColorBrush(Colors.Black),
2582
                                        StartPoint = this.canvasDrawingMouseDownPoint,
2583
                                        ControlType = ControlType.OverlapWhite
2584
                                    };
2585

    
2586
                                    currentControl.CommentID = Commons.shortGuid();
2587
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
2588
                                    currentControl.IsNew = true;
2589
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
2590

    
2591
                                    currentControl.SetValue(Canvas.ZIndexProperty, 3);
2592
                                }
2593
                            }
2594
                        }
2595
                        break;
2596
                    case ControlType.ClipWhite:
2597
                        {
2598
                            if (e.LeftButton == MouseButtonState.Pressed)
2599
                            {
2600
                                if (currentControl is ClipWhiteControl)
2601
                                {
2602
                                    if (IsGetoutpoint((currentControl as ClipWhiteControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
2603
                                    {
2604
                                        return;
2605
                                    }
2606

    
2607
                                    CreateCommand.Instance.Execute(currentControl);
2608

    
2609
                                    currentControl = null;
2610
                                    this.cursor = Cursors.Arrow;
2611
                                }
2612
                                else
2613
                                {
2614
                                    currentControl = new ClipWhiteControl
2615
                                    {
2616
                                        Background = new SolidColorBrush(Colors.Black),
2617
                                        StartPoint = this.canvasDrawingMouseDownPoint,
2618
                                        ControlType = ControlType.ClipWhite
2619
                                    };
2620

    
2621
                                    currentControl.CommentID = Commons.shortGuid();
2622
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
2623
                                    currentControl.IsNew = true;
2624
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
2625

    
2626
                                    currentControl.SetValue(Canvas.ZIndexProperty, 3);
2627
                                }
2628
                            }
2629
                        }
2630
                        break;
2631
                    case ControlType.Rectangle:
2632
                        {
2633
                            if (e.LeftButton == MouseButtonState.Pressed)
2634
                            {
2635
                                if (currentControl is RectangleControl)
2636
                                {
2637
                                    //20180906 LJY TEST IsRotationDrawingEnable
2638
                                    if (IsGetoutpoint((currentControl as RectangleControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
2639
                                    {
2640
                                        return;
2641
                                    }
2642

    
2643
                                    CreateCommand.Instance.Execute(currentControl);
2644
                                    currentControl = null;
2645
                                    this.cursor = new Cursor(MainWindow.CursorChange().StreamSource);
2646
                                }
2647
                                else
2648
                                {
2649
                                    currentControl = new RectangleControl
2650
                                    {
2651
                                        Background = new SolidColorBrush(Colors.Black),
2652
                                        StartPoint = this.canvasDrawingMouseDownPoint,
2653
                                        ControlType = ControlType.Rectangle
2654
                                    };
2655

    
2656
                                    currentControl.CommentID = Commons.shortGuid();
2657
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
2658
                                    currentControl.IsNew = true;
2659
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
2660

    
2661
                                    currentControl.SetValue(Canvas.ZIndexProperty, 3);
2662
                                }
2663
                            }
2664
                        }
2665
                        break;
2666
                    case ControlType.RectCloud:
2667
                        {
2668
                            if (e.LeftButton == MouseButtonState.Pressed)
2669
                            {
2670
                                if (currentControl is RectCloudControl)
2671
                                {
2672
                                    //20180906 LJY TEST IsRotationDrawingEnable
2673
                                    if (IsGetoutpoint((currentControl as RectCloudControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
2674
                                    {
2675
                                        return;
2676
                                    }
2677

    
2678
                                    CreateCommand.Instance.Execute(currentControl);
2679

    
2680
                                    currentControl = null;
2681
                                
2682
                                    this.cursor = new Cursor(MainWindow.CursorChange().StreamSource);
2683
                                }
2684
                                else
2685
                                {
2686
                                    currentControl = new RectCloudControl
2687
                                    {
2688
                                        StartPoint = this.canvasDrawingMouseDownPoint,
2689
                                        ControlType = ControlType.RectCloud,
2690
                                        Background = new SolidColorBrush(Colors.Black)
2691
                                    };
2692

    
2693
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
2694
                                    currentControl.CommentID = Commons.shortGuid();
2695
                                    currentControl.IsNew = true;
2696
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
2697
                                }
2698
                            }
2699
                        }
2700
                        break;
2701
                    case ControlType.Circle:
2702
                        {
2703
                            if (e.LeftButton == MouseButtonState.Pressed)
2704
                            {
2705
                                if (currentControl is CircleControl)
2706
                                {
2707
                                    //20180906 LJY TEST IsRotationDrawingEnable
2708
                                    if (IsGetoutpoint((currentControl as CircleControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
2709
                                    {
2710
                                        return;
2711
                                    }
2712

    
2713
                                    CreateCommand.Instance.Execute(currentControl);
2714

    
2715
                                    currentControl = null;
2716
                                }
2717
                                else
2718
                                {
2719
                                    currentControl = new CircleControl
2720
                                    {
2721
                                        StartPoint = this.canvasDrawingMouseDownPoint,
2722
                                        LeftBottomPoint = this.canvasDrawingMouseDownPoint,
2723
                                        Background = new SolidColorBrush(Colors.Black)
2724
                                    };
2725

    
2726
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
2727
                                    currentControl.CommentID = Commons.shortGuid();
2728
                                    currentControl.IsNew = true;
2729
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
2730
                                }
2731
                            }
2732
                        }
2733
                        break;
2734
                    case ControlType.Triangle:
2735
                        {
2736
                            if (e.LeftButton == MouseButtonState.Pressed)
2737
                            {
2738
                                if (currentControl is TriControl)
2739
                                {
2740
                                    var content = currentControl as TriControl;
2741
                                    if (content.MidPoint == new Point(0, 0))
2742
                                    {
2743
                                        content.MidPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
2744
                                    }
2745
                                    else
2746
                                    {
2747
                                        //20180906 LJY TEST IsRotationDrawingEnable
2748
                                        if (IsGetoutpoint((currentControl as TriControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
2749
                                        {
2750
                                            return;
2751
                                        }
2752

    
2753
                                        CreateCommand.Instance.Execute(currentControl);
2754

    
2755
                                        currentControl = null;
2756
                                    }
2757
                                }
2758
                                else
2759
                                {
2760
                                    currentControl = new TriControl
2761
                                    {
2762
                                        StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y),
2763
                                        Background = new SolidColorBrush(Colors.Black),
2764
                                    };
2765

    
2766
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
2767
                                    currentControl.CommentID = Commons.shortGuid();
2768
                                    currentControl.IsNew = true;
2769
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
2770
                                }
2771
                            }
2772
                        }
2773
                        break;
2774
                    case ControlType.CancelLine:
2775
                    case ControlType.SingleLine:
2776
                    case ControlType.ArrowLine:
2777
                    case ControlType.TwinLine:
2778
                    case ControlType.DimLine:
2779
                        {
2780
                            if (e.LeftButton == MouseButtonState.Pressed)
2781
                            {
2782
                                if (currentControl is LineControl)
2783
                                {
2784
                                    //20180906 LJY TEST IsRotationDrawingEnable
2785
                                    if (IsGetoutpoint((currentControl as LineControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
2786
                                    {
2787
                                        return;
2788
                                    }
2789

    
2790
                                    CreateCommand.Instance.Execute(currentControl);
2791
                                    currentControl = null;
2792
                                    this.MainAngle.Visibility = Visibility.Collapsed;
2793
                                }
2794
                                else
2795
                                {
2796
                                    currentControl = new LineControl
2797
                                    {
2798
                                        ControlType = this.controlType,
2799
                                        StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y),
2800
                                        Background = new SolidColorBrush(Colors.Black)
2801
                                    };
2802

    
2803
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
2804
                                    currentControl.CommentID = Commons.shortGuid();
2805
                                    currentControl.IsNew = true;
2806
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
2807
                                    this.MainAngle.Visibility = Visibility.Visible;
2808
                                }
2809
                            }
2810
                        }
2811
                        break;
2812
                    case ControlType.PolygonControl:
2813
                        {
2814
                            if (currentControl is PolygonControl)
2815
                            {
2816
                                var control = currentControl as PolygonControl;
2817

    
2818
                                if (e.RightButton == MouseButtonState.Pressed)
2819
                                {
2820
                                    control.IsCompleted = true;
2821
                                }
2822

    
2823
                                if (!control.IsCompleted)
2824
                                {
2825
                                    control.PointSet.Add(control.EndPoint);
2826
                                }
2827
                                else
2828
                                {
2829
                                    //20180906 LJY TEST IsRotationDrawingEnable
2830
                                    if (IsGetoutpoint((currentControl as PolygonControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
2831
                                    {
2832
                                        return;
2833
                                    }
2834

    
2835
                                    var firstPoint = control.PointSet.First();
2836
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
2837
                                    control.LineSize = ViewerDataModel.Instance.LineSize;
2838
                                    control.PointSet.Add(firstPoint);
2839

    
2840
                                    control.ApplyOverViewData();
2841

    
2842
                                    CreateCommand.Instance.Execute(currentControl);
2843
                                    control.UpdateControl();
2844
                                    currentControl = null;
2845
                                }
2846
                            }
2847
                            else
2848
                            {
2849
                                if (e.LeftButton == MouseButtonState.Pressed)
2850
                                {
2851
                                    currentControl = new PolygonControl
2852
                                    {
2853
                                        PointSet = new List<Point>(),
2854
                                    };
2855

    
2856
                                    var polygonControl = (currentControl as PolygonControl);
2857
                                    currentControl.CommentID = Commons.shortGuid();
2858
                                    currentControl.IsNew = true;
2859
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
2860
                                    polygonControl.StartPoint = canvasDrawingMouseDownPoint;
2861
                                    polygonControl.EndPoint = canvasDrawingMouseDownPoint;
2862
                                    polygonControl.PointSet.Add(canvasDrawingMouseDownPoint);
2863
                                    polygonControl.PointSet.Add(canvasDrawingMouseDownPoint);
2864
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
2865
                                    polygonControl.ApplyTemplate();
2866
                                    polygonControl.Visibility = Visibility.Visible;
2867
                                }
2868
                            }
2869
                        }
2870
                        break;
2871
                    case ControlType.ChainLine:
2872
                        {
2873
                            if (currentControl is PolygonControl)
2874
                            {
2875
                                var control = currentControl as PolygonControl;
2876

    
2877
                                if (e.RightButton == MouseButtonState.Pressed)
2878
                                {
2879
                                    //20180906 LJY TEST IsRotationDrawingEnable
2880
                                    if (IsGetoutpoint((currentControl as PolygonControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
2881
                                    {
2882
                                        return;
2883
                                    }
2884

    
2885
                                    CreateCommand.Instance.Execute(currentControl);
2886

    
2887
                                    currentControl = null;
2888
                                    this.MainAngle.Visibility = Visibility.Collapsed;
2889
                                    return;
2890
                                }
2891

    
2892
                                if (!control.IsCompleted)
2893
                                {
2894
                                    control.PointSet.Add(control.EndPoint);
2895
                                    this.MainAngle.Visibility = Visibility.Visible;
2896
                                }
2897
                            }
2898
                            else
2899
                            {
2900
                                if (e.LeftButton == MouseButtonState.Pressed)
2901
                                {
2902
                                    MainAngle.Visibility = Visibility.Visible;
2903
                                    currentControl = new PolygonControl
2904
                                    {
2905
                                        PointSet = new List<Point>(),
2906
                                        //강인구 추가(ChainLine일때는 채우기 스타일을 주지 않기 위해 설정)
2907
                                        ControlType = ControlType.ChainLine,
2908
                                        DashSize = ViewerDataModel.Instance.DashSize,
2909
                                        LineSize = ViewerDataModel.Instance.LineSize,
2910
                                        //PointC = new StylusPointSet()
2911
                                    };
2912

    
2913
                                    //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
2914
                                    //{
2915
                                        var polygonControl = (currentControl as PolygonControl);
2916
                                        currentControl.CommentID = Commons.shortGuid();
2917
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
2918
                                        currentControl.IsNew = true;
2919
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
2920
                                        //currentControl.OnApplyTemplate();
2921
                                        //polygonControl.PointC.pointSet.Add(canvasDrawingMouseDownPoint);
2922
                                        //polygonControl.PointC.pointSet.Add(canvasDrawingMouseDownPoint);
2923
                                        polygonControl.PointSet.Add(canvasDrawingMouseDownPoint);
2924
                                        polygonControl.PointSet.Add(canvasDrawingMouseDownPoint);
2925
                                    //}
2926
                                }
2927
                            }
2928
                        }
2929
                        break;
2930
                    case ControlType.ArcLine:
2931
                        {
2932
                            if (e.LeftButton == MouseButtonState.Pressed)
2933
                            {
2934
                                if (currentControl is ArcControl)
2935
                                {
2936
                                    //20180906 LJY TEST IsRotationDrawingEnable
2937
                                    if (IsGetoutpoint((currentControl as ArcControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
2938
                                    {
2939
                                        return;
2940
                                    }
2941

    
2942
                                    CreateCommand.Instance.Execute(currentControl);
2943

    
2944
                                    currentControl = null;
2945
                                    this.MainAngle.Visibility = Visibility.Collapsed;
2946
                                }
2947
                                else
2948
                                {
2949
                                    currentControl = new ArcControl
2950
                                    {
2951
                                        StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y),
2952
                                        Background = new SolidColorBrush(Colors.Black)
2953
                                    };
2954
                                    currentControl.CommentID = Commons.shortGuid();
2955
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
2956
                                    currentControl.IsNew = true;
2957
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
2958
                                    this.MainAngle.Visibility = Visibility.Visible;
2959
                                }
2960
                            }
2961
                            else if (e.RightButton == MouseButtonState.Pressed)
2962
                            {
2963
                                if (currentControl != null)
2964
                                {
2965
                                    (currentControl as ArcControl).setClock();
2966
                                    (currentControl as ArcControl).MidPoint = new Point(0, 0);
2967
                                }
2968
                            }
2969
                        }
2970
                        break;
2971
                    case ControlType.ArcArrow:
2972
                        {
2973
                            if (e.LeftButton == MouseButtonState.Pressed)
2974
                            {
2975
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
2976
                                //{
2977
                                if (currentControl is ArrowArcControl)
2978
                                {
2979
                                    //20180906 LJY TEST IsRotationDrawingEnable
2980
                                    if (IsGetoutpoint((currentControl as ArrowArcControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
2981
                                    {
2982
                                        return;
2983
                                    }
2984

    
2985
                                    CreateCommand.Instance.Execute(currentControl);
2986

    
2987
                                    currentControl = null;
2988
                                    this.MainAngle.Visibility = Visibility.Collapsed;
2989
                                }
2990
                                else
2991
                                {
2992
                                    currentControl = new ArrowArcControl
2993
                                    {
2994
                                        StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y),
2995
                                        Background = new SolidColorBrush(Colors.Black)
2996
                                    };
2997
                                    currentControl.CommentID = Commons.shortGuid();
2998
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
2999
                                    currentControl.IsNew = true;
3000
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3001
                                    this.MainAngle.Visibility = Visibility.Visible;
3002
                                }
3003
                                //}
3004
                            }
3005
                            else if (e.RightButton == MouseButtonState.Pressed)
3006
                            {
3007
                                if (currentControl != null)
3008
                                {
3009
                                    (currentControl as ArrowArcControl).setClock();
3010
                                    (currentControl as ArrowArcControl).MidPoint = new Point(0, 0);
3011
                                    //(currentControl as ArcControl).ApplyTemplate();
3012
                                }
3013
                            }
3014
                        }
3015
                        break;
3016
                    case ControlType.ArrowMultiLine:
3017
                        {
3018
                            if (e.LeftButton == MouseButtonState.Pressed)
3019
                            {
3020
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3021
                                //{
3022

    
3023
                                    if (currentControl is ArrowControl_Multi)
3024
                                    {
3025
                                        var content = currentControl as ArrowControl_Multi;
3026
                                        if (content.MiddlePoint == new Point(0, 0))
3027
                                        {
3028
                                            if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift)
3029
                                            {
3030
                                                content.MiddlePoint = content.EndPoint;
3031
                                            }
3032
                                            else
3033
                                            {
3034
                                                content.MiddlePoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
3035
                                            }
3036
                                        }
3037
                                        else
3038
                                        {
3039
                                            //20180906 LJY TEST IsRotationDrawingEnable
3040
                                            if (IsGetoutpoint((currentControl as ArrowControl_Multi).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3041
                                            {
3042
                                                return;
3043
                                            }
3044

    
3045
                                            CreateCommand.Instance.Execute(currentControl);
3046

    
3047
                                            currentControl = null;
3048
                                            this.MainAngle.Visibility = Visibility.Collapsed;
3049
                                        }
3050
                                    }
3051
                                    else
3052
                                    {
3053
                                        currentControl = new ArrowControl_Multi
3054
                                        {
3055
                                            StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y),
3056
                                            Background = new SolidColorBrush(Colors.Black)
3057
                                        };
3058
                                        currentControl.CommentID = Commons.shortGuid();
3059
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3060
                                        currentControl.IsNew = true;
3061
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3062
                                        this.MainAngle.Visibility = Visibility.Visible;
3063
                                    }
3064
                                //}
3065
                            }
3066
                        }
3067
                        break;
3068
                    case ControlType.PolygonCloud:
3069
                        {
3070
                            if (currentControl is CloudControl)
3071
                            {
3072
                                var control = currentControl as CloudControl;
3073
                                if (e.RightButton == MouseButtonState.Pressed)
3074
                                {
3075
                                    control.IsCompleted = true;
3076
                                }
3077

    
3078
                                if (!control.IsCompleted)
3079
                                {
3080
                                    control.PointSet.Add(control.EndPoint);
3081
                                }
3082
                                else
3083
                                {
3084
                                    //20180906 LJY TEST IsRotationDrawingEnable
3085
                                    if (IsGetoutpoint((currentControl as CloudControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3086
                                    {
3087
                                        return;
3088
                                    }
3089

    
3090
                                    CreateCommand.Instance.Execute(currentControl);
3091

    
3092
                                    control.isTransOn = true;
3093
                                    var firstPoint = control.PointSet.First();
3094

    
3095
                                    control.PointSet.Add(firstPoint);
3096
                                    control.DrawingCloud();
3097
                                    control.ApplyOverViewData();
3098

    
3099
                                    currentControl = null;
3100
                                }
3101
                            }
3102
                            else
3103
                            {
3104
                                if (e.LeftButton == MouseButtonState.Pressed)
3105
                                {
3106
                                    currentControl = new CloudControl
3107
                                    {
3108
                                        PointSet = new List<Point>(),
3109
                                        PointC = new StylusPointSet()
3110
                                    };
3111

    
3112
                                    //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3113
                                    //{
3114
                                        var polygonControl = (currentControl as CloudControl);
3115
                                        currentControl.CommentID = Commons.shortGuid();
3116
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3117
                                        currentControl.IsNew = true;
3118
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3119

    
3120
                                        polygonControl.PointSet.Add(canvasDrawingMouseDownPoint);
3121
                                        polygonControl.PointSet.Add(canvasDrawingMouseDownPoint);
3122
                                    
3123
                                    //}
3124
                                }
3125
                            }
3126
                        }
3127
                        break;
3128
                    case ControlType.ImgControl:
3129
                        {
3130
                            if (e.LeftButton == MouseButtonState.Pressed)
3131
                            {
3132
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3133
                                //{
3134
                                    if (currentControl is ImgControl)
3135
                                    {
3136
                                        //20180906 LJY TEST IsRotationDrawingEnable
3137
                                        if (IsGetoutpoint((currentControl as ImgControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3138
                                        {
3139
                                            return;
3140
                                        }
3141

    
3142
                                        CreateCommand.Instance.Execute(currentControl);
3143
                                        controlType = ControlType.ImgControl;
3144
                                        currentControl = null;
3145
                                    }
3146
                                    else
3147
                                    {
3148
                                        
3149
                                        string extension = System.IO.Path.GetExtension(filename).ToUpper();
3150
                                        if (extension == ".PNG" || extension == ".JPEG" || extension == ".GIF" || extension == ".BMP" || extension == ".JPG" || extension == ".SVG")
3151
                                        {
3152
                                            Image img = new Image();
3153
                                            if (filename.Contains(".svg"))
3154
                                            {
3155
                                                byte[] imageData = null;
3156
                                                DrawingImage image = null;
3157
                                                using (System.Net.WebClient web = new System.Net.WebClient())
3158
                                                {
3159
                                                    imageData = web.DownloadData(new Uri(filename));
3160
                                                    System.IO.Stream stream = new System.IO.MemoryStream(imageData);
3161
                                                    image = SvgReader.Load(stream);
3162
                                                }
3163
                                                img.Source = image;
3164
                                            }
3165
                                            else
3166
                                            {
3167
                                                img.Source = new BitmapImage(new Uri(filename));
3168
                                            }
3169

    
3170
                                            currentControl = new ImgControl
3171
                                            {
3172
                                                    Background = new SolidColorBrush(Colors.Black),
3173
                                                    PointSet = new List<Point>(),
3174
                                                    FilePath = filename,
3175
                                                    ImageData = img.Source,
3176
                                                    StartPoint = canvasDrawingMouseDownPoint,
3177
                                                    EndPoint = new Point(canvasDrawingMouseDownPoint.X + 100, canvasDrawingMouseDownPoint.Y + 100),
3178
                                                    TopRightPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y + 100),
3179
                                                    LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X + 100, canvasDrawingMouseDownPoint.Y),
3180
                                                    ControlType = ControlType.ImgControl
3181
                                                };
3182

    
3183
                                        
3184
                                                currentControl.CommentID = Commons.shortGuid();                                            
3185
                                                currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3186
                                                currentControl.IsNew = true;
3187
                                                ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3188

    
3189
                                                //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정  
3190
                                                (currentControl as ImgControl).Angle -= rotate.Angle;
3191
                                        }
3192
                                    }
3193
                                //}
3194
                            }
3195
                        }
3196
                        break;
3197
                    case ControlType.Date:
3198
                        {
3199
                            if (e.LeftButton == MouseButtonState.Pressed)
3200
                            {
3201
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3202
                                //{
3203
                                    if (currentControl is DateControl)
3204
                                    {
3205
                                        //20180906 LJY TEST IsRotationDrawingEnable
3206
                                        if (IsGetoutpoint((currentControl as DateControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3207
                                        {
3208
                                            return;
3209
                                        }
3210

    
3211
                                        CreateCommand.Instance.Execute(currentControl);
3212
                                        currentControl = null;
3213

    
3214
                                        if (Common.ViewerDataModel.Instance.SelectedControl == "Batch")
3215
                                        {
3216
                                            controlType = ControlType.None;
3217
                                            IsSwingMode = false;
3218
                                            Common.ViewerDataModel.Instance.SelectedControl = "";
3219
                                            Common.ViewerDataModel.Instance.ControlTag = null;
3220
                                            mouseHandlingMode = MouseHandlingMode.None;
3221
                                            this.ParentOfType<MainWindow>().dzTopMenu.btn_Batch.IsChecked = false;
3222
                                            txtBatch.Visibility = Visibility.Collapsed;
3223

    
3224
                                        }
3225
                                    }
3226
                                    else
3227
                                    {
3228
                                        currentControl = new DateControl
3229
                                        {
3230
                                            StartPoint = canvasDrawingMouseDownPoint,
3231
                                            Background = new SolidColorBrush(Colors.Black)
3232
                                        };
3233
                                        currentControl.CommentID = Commons.shortGuid();
3234
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3235
                                        currentControl.IsNew = true;
3236
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3237

    
3238
                                        //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 
3239
                                        (currentControl as DateControl).Angle -= rotate.Angle;
3240
                                }
3241
                                //}
3242
                            }
3243
                        }
3244
                        break;
3245
                    case ControlType.TextControl:
3246
                        {
3247
                            if (e.LeftButton == MouseButtonState.Pressed)
3248
                            {
3249
                                if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3250
                                {
3251
                                    currentControl = new TextControl
3252
                                    {
3253
                                        ControlType = controlType
3254
                                    };
3255
                                    (currentControl as TextControl).TextSize = ViewerDataModel.Instance.TextSize;
3256
                                    currentControl.CommentID = Commons.shortGuid();
3257
                                    currentControl.IsNew = true;
3258
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3259
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3260
                                    currentControl.SetValue(Canvas.ZIndexProperty, 3);
3261

    
3262
                                    currentControl.SetValue(TextControl.CanvasXProperty, canvasDrawingMouseDownPoint.X);
3263
                                    currentControl.SetValue(TextControl.CanvasYProperty, canvasDrawingMouseDownPoint.Y);
3264
                                    
3265
                                    (currentControl as TextControl).ControlType_No = 0;
3266
                                    (currentControl as TextControl).Angle -= rotate.Angle;
3267
                                    (currentControl as TextControl).IsHighLight = ViewerDataModel.Instance.checkHighShape;
3268
                                    (currentControl as TextControl).ApplyTemplate();
3269
                                    (currentControl as TextControl).Base_TextBox.Focus();
3270
                                    (currentControl as TextControl).SetFontFamily(new FontFamily(this.ParentOfType<MainWindow>().dzTopMenu.comboFontFamily.Text));
3271
                                    CreateCommand.Instance.Execute(currentControl);
3272
                                }
3273
                            }
3274
                        }
3275
                        break;
3276
                    case ControlType.TextBorder:
3277
                        {
3278
                            if (e.LeftButton == MouseButtonState.Pressed)
3279
                            {
3280
                                if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3281
                                {
3282
                                    currentControl = new TextControl
3283
                                    {
3284
                                        ControlType = controlType
3285
                                    };
3286

    
3287
                                    (currentControl as TextControl).TextSize = ViewerDataModel.Instance.TextSize;
3288
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3289
                                    currentControl.CommentID = Commons.shortGuid();
3290
                                    currentControl.IsNew = true;
3291
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3292
                                    currentControl.SetValue(Canvas.ZIndexProperty, 3);
3293
                                    currentControl.SetValue(TextControl.CanvasXProperty, canvasDrawingMouseDownPoint.X);
3294
                                    currentControl.SetValue(TextControl.CanvasYProperty, canvasDrawingMouseDownPoint.Y);
3295
                                    
3296
                                    (currentControl as TextControl).ControlType_No = 1;
3297
                                    (currentControl as TextControl).Angle = Ang;
3298
                                    (currentControl as TextControl).IsHighLight = ViewerDataModel.Instance.checkHighShape;
3299
                                    (currentControl as TextControl).ApplyTemplate();
3300
                                    (currentControl as TextControl).Base_TextBox.Focus();
3301
                                    (currentControl as TextControl).SetFontFamily(new FontFamily(this.ParentOfType<MainWindow>().dzTopMenu.comboFontFamily.Text));
3302
                                    CreateCommand.Instance.Execute(currentControl);
3303
                                }
3304
                            }
3305
                        }
3306
                        break;
3307
                    case ControlType.TextCloud:
3308
                        {
3309
                            if (e.LeftButton == MouseButtonState.Pressed)
3310
                            {
3311
                                if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3312
                                {
3313
                                    currentControl = new TextControl
3314
                                    {
3315
                                        ControlType = controlType
3316
                                    };
3317

    
3318
                                    (currentControl as TextControl).TextSize = ViewerDataModel.Instance.TextSize;
3319
                                    currentControl.CommentID = Commons.shortGuid();
3320
                                    currentControl.IsNew = true;
3321
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3322
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3323

    
3324
                                    currentControl.SetValue(Canvas.ZIndexProperty, 3);
3325
                                    currentControl.SetValue(TextControl.CanvasXProperty, canvasDrawingMouseDownPoint.X);
3326
                                    currentControl.SetValue(TextControl.CanvasYProperty, canvasDrawingMouseDownPoint.Y);                                    
3327

    
3328
                                    (currentControl as TextControl).Angle = Ang;
3329
                                    (currentControl as TextControl).ControlType_No = 2;
3330
                                    (currentControl as TextControl).IsHighLight = ViewerDataModel.Instance.checkHighShape;
3331
                                    (currentControl as TextControl).ApplyTemplate();
3332
                                    (currentControl as TextControl).Base_TextBox.Focus();
3333
                                    CreateCommand.Instance.Execute(currentControl);
3334
                                    (currentControl as TextControl).SetFontFamily(new FontFamily(this.ParentOfType<MainWindow>().dzTopMenu.comboFontFamily.Text));
3335
                                    //currentControl = null;
3336
                                }
3337
                            }
3338
                        }
3339
                        break;
3340
                    case ControlType.ArrowTextControl:
3341
                         {
3342
                            if (e.LeftButton == MouseButtonState.Pressed)
3343
                            {
3344
                                if (currentControl is ArrowTextControl)
3345
                                {
3346
                                    //20180906 LJY TEST IsRotationDrawingEnable
3347
                                    if (IsGetoutpoint((currentControl as ArrowTextControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3348
                                    {
3349
                                        return;
3350
                                    }
3351

    
3352
                                    CreateCommand.Instance.Execute(currentControl);
3353

    
3354
                                    (currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false;
3355
                                    (currentControl as ArrowTextControl).EnableEditing = false;
3356
                                    (currentControl as ArrowTextControl).IsNew = false;
3357
                                    currentControl = null;
3358
                                }
3359
                                else
3360
                                {
3361
                                    //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3362
                                    //{
3363
                                        currentControl = new ArrowTextControl();
3364
                                        currentControl.CommentID = Commons.shortGuid();
3365
                                        currentControl.IsNew = true;
3366
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3367
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3368

    
3369
                                        currentControl.SetValue(Canvas.ZIndexProperty, 3);
3370
                                        currentControl.SetValue(ArrowTextControl.StartPointProperty, canvasDrawingMouseDownPoint);
3371
                                        currentControl.SetValue(ArrowTextControl.EndPointProperty, canvasDrawingMouseDownPoint);
3372
                                        (currentControl as ArrowTextControl).TextSize = ViewerDataModel.Instance.TextSize;
3373
                                        (currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape;
3374

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

    
3378
                                        (currentControl as ArrowTextControl).ApplyTemplate();
3379
                                        (currentControl as ArrowTextControl).Base_TextBox.Focus();
3380
                                        (currentControl as ArrowTextControl).SetFontFamily(new FontFamily(this.ParentOfType<MainWindow>().dzTopMenu.comboFontFamily.Text));
3381
                                        this.MainAngle.Visibility = Visibility.Visible;
3382

    
3383
                                    
3384
                                    //}
3385
                                }
3386
                            }
3387
                        }
3388
                        break;
3389
                    case ControlType.ArrowTransTextControl:
3390
                        {
3391
                            if (e.LeftButton == MouseButtonState.Pressed)
3392
                            {
3393
                                if (currentControl is ArrowTextControl)
3394
                                {
3395
                                    //20180906 LJY TEST IsRotationDrawingEnable
3396
                                    if (IsGetoutpoint((currentControl as ArrowTextControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3397
                                    {
3398
                                        return;
3399
                                    }
3400

    
3401
                                    CreateCommand.Instance.Execute(currentControl);
3402

    
3403
                                    (currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false;
3404
                                    
3405
                                    currentControl.IsNew = false;
3406
                                    currentControl = null;
3407
                                    this.MainAngle.Visibility = Visibility.Collapsed;
3408
                                }
3409
                                else
3410
                                {
3411
                                    //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3412
                                    //{
3413
                                    currentControl = new ArrowTextControl()
3414
                                    {
3415
                                        ControlType = ControlType.ArrowTransTextControl
3416
                                    };
3417
                                    currentControl.CommentID = Commons.shortGuid();
3418
                                    currentControl.IsNew = true;
3419
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3420
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3421
                                    currentControl.SetValue(Canvas.ZIndexProperty, 3);
3422
                                    currentControl.SetValue(ArrowTextControl.StartPointProperty, canvasDrawingMouseDownPoint);
3423
                                    currentControl.SetValue(ArrowTextControl.EndPointProperty, canvasDrawingMouseDownPoint);                  
3424
                                    (currentControl as ArrowTextControl).TextSize = ViewerDataModel.Instance.TextSize;
3425
                                    (currentControl as ArrowTextControl).isFixed = true;
3426
                                    (currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape;
3427

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

    
3431
                                    (currentControl as ArrowTextControl).ApplyTemplate();
3432
                                    (currentControl as ArrowTextControl).Base_TextBox.Focus();
3433
                                    (currentControl as ArrowTextControl).isTrans = true;
3434
                                    (currentControl as ArrowTextControl).SetFontFamily(new FontFamily(this.ParentOfType<MainWindow>().dzTopMenu.comboFontFamily.Text));
3435
                                }
3436
                            }
3437
                        }
3438
                        break;
3439
                    case ControlType.ArrowTextBorderControl:
3440
                         {
3441
                            if (e.LeftButton == MouseButtonState.Pressed)
3442
                            {
3443
                                if (currentControl is ArrowTextControl)
3444
                                {
3445
                                    //20180906 LJY TEST IsRotationDrawingEnable
3446
                                    if (IsGetoutpoint((currentControl as ArrowTextControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3447
                                    {
3448
                                        return;
3449
                                    }
3450

    
3451
                                    CreateCommand.Instance.Execute(currentControl);
3452
                                    (currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false;
3453
                                    currentControl.IsNew = false;
3454
                                    currentControl = null;
3455
                                    this.MainAngle.Visibility = Visibility.Collapsed;
3456
                                }
3457
                                else
3458
                                {
3459
                                    //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3460
                                    //{
3461
                                        currentControl = new ArrowTextControl()
3462
                                        {
3463
                                            ArrowTextStyle = MarkupToPDF.Controls.Text.ArrowTextControl.ArrowTextStyleSet.Rect
3464
                                        };
3465
                                        currentControl.CommentID = Commons.shortGuid();
3466
                                        currentControl.IsNew = true;
3467
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3468
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3469

    
3470
                                        currentControl.SetValue(Canvas.ZIndexProperty, 3);
3471

    
3472
                                        currentControl.SetValue(ArrowTextControl.StartPointProperty, canvasDrawingMouseDownPoint);
3473

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

    
3504
                                    this.MainAngle.Visibility = Visibility.Collapsed;
3505
                                }
3506
                                else
3507
                                {
3508
                                    //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3509
                                    //{
3510
                                    
3511

    
3512
                                    currentControl = new ArrowTextControl()
3513
                                    {
3514
                                        ArrowTextStyle = MarkupToPDF.Controls.Text.ArrowTextControl.ArrowTextStyleSet.Rect,
3515
                                        ControlType = ControlType.ArrowTransTextBorderControl
3516

    
3517
                                    };
3518
                                        currentControl.CommentID = Commons.shortGuid();
3519
                                        currentControl.IsNew = true;
3520
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3521
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3522

    
3523
                                        currentControl.SetValue(Canvas.ZIndexProperty, 3);
3524

    
3525
                                        currentControl.SetValue(ArrowTextControl.StartPointProperty, canvasDrawingMouseDownPoint);
3526
                                        currentControl.SetValue(ArrowTextControl.EndPointProperty, canvasDrawingMouseDownPoint);                                    
3527
                                        (currentControl as ArrowTextControl).TextSize = ViewerDataModel.Instance.TextSize;
3528
                                        (currentControl as ArrowTextControl).isFixed = true;
3529
                                        (currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape;
3530
                                     
3531
                                        //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정  
3532
                                        (currentControl as ArrowTextControl).Angle -= rotate.Angle;
3533
                                        (currentControl as ArrowTextControl).ApplyTemplate();
3534
                                        (currentControl as ArrowTextControl).SetFontFamily(new FontFamily(this.ParentOfType<MainWindow>().dzTopMenu.comboFontFamily.Text));
3535
                                        (currentControl as ArrowTextControl).Base_TextBox.Focus();                                 
3536
                                        this.MainAngle.Visibility = Visibility.Visible;
3537
                                    
3538
                                    //20180911 LJY
3539
                                        (currentControl as ArrowTextControl).isTrans = true;
3540
                                    
3541

    
3542
                                    //}
3543
                                }
3544
                            }
3545
                        }
3546
                        break;
3547
                    case ControlType.ArrowTextCloudControl:
3548
                        {
3549
                            if (e.LeftButton == MouseButtonState.Pressed)
3550
                            {
3551
                                if (currentControl is ArrowTextControl)
3552
                                {
3553
                                    //20180906 LJY TEST IsRotationDrawingEnable
3554
                                    if (IsGetoutpoint((currentControl as ArrowTextControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3555
                                    {
3556
                                        return;
3557
                                    }
3558
                                    CreateCommand.Instance.Execute(currentControl);
3559
                                    (currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false;
3560
                                    currentControl.IsNew = false;
3561
                                    currentControl = null;
3562
                                    this.MainAngle.Visibility = Visibility.Collapsed;
3563
                                }
3564
                                else
3565
                                {
3566
                                    //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3567
                                    //{
3568
                                        currentControl = new ArrowTextControl()
3569
                                        {
3570
                                            ArrowTextStyle = MarkupToPDF.Controls.Text.ArrowTextControl.ArrowTextStyleSet.Cloud
3571
                                        };
3572
                                        currentControl.CommentID = Commons.shortGuid();
3573
                                        currentControl.IsNew = true;
3574
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3575
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3576

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

    
3620
                                        };
3621
                                        currentControl.CommentID = Commons.shortGuid();
3622
                                        currentControl.IsNew = true; 
3623
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3624
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3625
                                        currentControl.SetValue(Canvas.ZIndexProperty, 3);
3626

    
3627
                                        currentControl.SetValue(ArrowTextControl.StartPointProperty, canvasDrawingMouseDownPoint);
3628
                                        currentControl.SetValue(ArrowTextControl.EndPointProperty, canvasDrawingMouseDownPoint);                                        
3629
                                        (currentControl as ArrowTextControl).TextSize = ViewerDataModel.Instance.TextSize;
3630
                                        (currentControl as ArrowTextControl).isFixed = true;
3631
                                        (currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape;
3632

    
3633
                                        //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 
3634
                                        (currentControl as ArrowTextControl).Angle -= rotate.Angle;
3635
                                        (currentControl as ArrowTextControl).SetFontFamily(new FontFamily(this.ParentOfType<MainWindow>().dzTopMenu.comboFontFamily.Text));
3636
                                        (currentControl as ArrowTextControl).ApplyTemplate();
3637
                                        (currentControl as ArrowTextControl).Base_TextBox.Focus();
3638
                                        this.MainAngle.Visibility = Visibility.Visible;  
3639
                                    
3640
                                    //20180911 LJY
3641
                                        (currentControl as ArrowTextControl).isTrans = true;
3642
                                    //}
3643
                                }
3644
                            }
3645
                        }
3646
                        break;
3647
                    //강인구 추가
3648
                    case ControlType.Sign:
3649
                        {
3650
                            if (e.LeftButton == MouseButtonState.Pressed)
3651
                            {
3652
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3653
                                //{
3654
                                    var _sign = GetUserSign.GetSign(App.ViewInfo.UserID, App.ViewInfo.ProjectNO,App.isExternal);
3655

    
3656
                                    if (_sign == null)
3657
                                    {
3658
                                        txtBatch.Visibility = Visibility.Collapsed;
3659
                                        mouseHandlingMode = IKCOM.MouseHandlingMode.None;
3660
                                        controlType = ControlType.None;
3661

    
3662
                                        this.ParentOfType<MainWindow>().DialogMessage_Alert("등록된 Sign이 없습니다.", "Alert");
3663
                                        this.ParentOfType<MainWindow>().ChildrenOfType<RadToggleButton>().Where(data => data.IsChecked == true).FirstOrDefault().IsChecked = false;
3664
                                        return;
3665
                                    }
3666

    
3667
                                    if (currentControl is SignControl)
3668
                                    {
3669
                                        //20180906 LJY TEST IsRotationDrawingEnable
3670
                                        if (IsGetoutpoint((currentControl as SignControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3671
                                        {
3672
                                            return;
3673
                                        }
3674

    
3675
                                        CreateCommand.Instance.Execute(currentControl);
3676
                                        currentControl = null;
3677
                                        if (Common.ViewerDataModel.Instance.SelectedControl == "Batch")
3678
                                        {
3679
                                            txtBatch.Text = "Place Date";
3680
                                            controlType = ControlType.Date;
3681
                                        }
3682
                                    }
3683
                                    else
3684
                                    {
3685
                                        currentControl = new SignControl
3686
                                        {
3687
                                            Background = new SolidColorBrush(Colors.Black),
3688
                                            UserNumber = App.ViewInfo.UserID,
3689
                                            ProjectNO = App.ViewInfo.ProjectNO,
3690
                                            StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y),
3691
                                            EndPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y),
3692
                                            ControlType = ControlType.Sign
3693
                                        };
3694

    
3695
                                        currentControl.CommentID = Commons.shortGuid();
3696
                                        currentControl.IsNew = true;
3697
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3698
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3699

    
3700
                                        //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 
3701
                                        (currentControl as SignControl).Angle -= rotate.Angle;                                    
3702
                                }
3703
                                //}
3704
                            }
3705
                        }
3706
                        break;
3707
                    case ControlType.Mark:
3708
                        {
3709
                            if (e.LeftButton == MouseButtonState.Pressed)
3710
                            {
3711
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3712
                                //{
3713
                                    if (currentControl is RectangleControl)
3714
                                    {
3715
                                        //20180906 LJY TEST IsRotationDrawingEnable
3716
                                        if (IsGetoutpoint((currentControl as RectangleControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3717
                                        {
3718
                                            return;
3719
                                        }
3720

    
3721
                                        CreateCommand.Instance.Execute(currentControl);
3722
                                        (currentControl as RectangleControl).ApplyOverViewData();
3723
                                        currentControl = null;
3724
                                    
3725
                                        this.cursor = new Cursor(MainWindow.CursorChange().StreamSource);
3726

    
3727
                                        if (Common.ViewerDataModel.Instance.SelectedControl == "Batch")
3728
                                        {
3729
                                            txtBatch.Text = "Place Signature";
3730
                                            controlType = ControlType.Sign;
3731
                                        }
3732
                                    }
3733
                                    else
3734
                                    {
3735
                                        currentControl = new RectangleControl
3736
                                        {
3737
                                            StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y),
3738
                                            Background = new SolidColorBrush(Colors.Black),
3739
                                            ControlType = ControlType.Mark ,
3740
                                            Paint = PaintSet.Fill
3741
                                        };
3742

    
3743
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3744
                                        currentControl.CommentID = Commons.shortGuid();
3745
                                        currentControl.IsNew = true;
3746
                                        (currentControl as RectangleControl).DashSize = ViewerDataModel.Instance.DashSize;
3747
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3748
                                    }
3749
                                //}
3750
                            }
3751
                        }
3752
                        break;
3753
                    case ControlType.Symbol:
3754
                        {
3755
                            if (e.LeftButton == MouseButtonState.Pressed)
3756
                            {
3757
                                if (currentControl is SymControl)
3758
                                {
3759
                                    //20180906 LJY TEST IsRotationDrawingEnable
3760
                                    if (IsGetoutpoint((currentControl as SymControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3761
                                    {
3762
                                        return;
3763
                                    }
3764
                                    CreateCommand.Instance.Execute(currentControl);
3765
                                    currentControl = null;
3766
                                
3767
                                    this.cursor = new Cursor(MainWindow.CursorChange().StreamSource);
3768
                                }
3769
                                else
3770
                                {
3771
                                    currentControl = new SymControl
3772
                                    {
3773
                                        StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y),
3774
                                        Background = new SolidColorBrush(Colors.Black),
3775
                                        LineSize = ViewerDataModel.Instance.LineSize + 3,
3776
                                        ControlType = ControlType.Symbol
3777
                                    };
3778

    
3779
                                    currentControl.IsNew = true;
3780
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3781
                                    currentControl.CommentID = Commons.shortGuid();
3782
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3783

    
3784
                                    //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정  
3785
                                    (currentControl as SymControl).Angle -= rotate.Angle;
3786
                                }
3787
                                //}
3788
                            }
3789
                        }
3790
                        break;
3791
                    case ControlType.Stamp:
3792
                        {
3793
                            if (e.LeftButton == MouseButtonState.Pressed)
3794
                            {
3795
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3796
                                //{
3797
                                    if (currentControl is SymControlN)
3798
                                    {
3799
                                        //20180906 LJY TEST IsRotationDrawingEnable
3800
                                        if (IsGetoutpoint((currentControl as SymControlN).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3801
                                        {
3802
                                            return;
3803
                                        }
3804

    
3805
                                        CreateCommand.Instance.Execute(currentControl);
3806
                                        currentControl = null;
3807
                                   
3808

    
3809
                                    this.cursor = new Cursor(MainWindow.CursorChange().StreamSource);
3810
                                    }
3811
                                    else
3812
                                    {
3813
                                        currentControl = new SymControlN
3814
                                        {
3815
                                            StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y),
3816
                                            Background = new SolidColorBrush(Colors.Black),
3817
                                            STAMP = App.SystemInfo.STAMP,                                            
3818
                                            ControlType = ControlType.Stamp
3819
                                        };
3820

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

    
3869
                            var over = (item as AdornerFinal).Members.Where(data => data.DrawingData.IsMouseOver).FirstOrDefault();
3870
                            if (over != null)
3871
                            {
3872
                                mouseOff = true;
3873
                            }
3874
                        }
3875
                    }
3876

    
3877
                    if (!mouseOff)
3878
                    {
3879
                        SelectionSet.Instance.UnSelect(this);
3880
                    }
3881
                }
3882
                zoomAndPanControl.CaptureMouse();
3883
                e.Handled = true;
3884
            }
3885
          
3886
        }
3887

    
3888
        private void zoomAndPanControl2_MouseDown(object sender, MouseButtonEventArgs e)
3889
        {
3890
            ///mouseButtonDown = e.ChangedButton;
3891
            canvasZoommovingMouseDownPoint = e.GetPosition(zoomAndPanCanvas2);
3892
        }
3893

    
3894
        private void RemoveLineStroke(Point P)
3895
        {
3896
            var control = ViewerDataModel.Instance.MarkupControls_USER.Where(data => data.IsMouseOver).FirstOrDefault();
3897
            if (control != null)
3898
            {
3899
                DeleteCommand.Instance.Execute(new List<CommentUserInfo>() { control });
3900
            }
3901
        }
3902

    
3903
        private void RemovePointStroke(Point P)
3904
        {
3905
            foreach (Stroke hits in inkBoard.Strokes)
3906
            {
3907
                foreach (StylusPoint sty in hits.StylusPoints)
3908
                {
3909

    
3910
                }
3911
                if (hits.HitTest(P))
3912
                {
3913
                    inkBoard.Strokes.Remove(hits);
3914
                    return;
3915
                }
3916
            }
3917
        }
3918

    
3919
        private void StartNewStroke(Point P)
3920
        {
3921
            strokePoints = new StylusPointCollection();
3922
            StylusPoint segment1Start = new StylusPoint(P.X, P.Y);
3923
            strokePoints.Add(segment1Start);
3924
            stroke = new Stroke(strokePoints);
3925

    
3926
            stroke.DrawingAttributes.Color = Colors.Red;
3927
            stroke.DrawingAttributes.Width = 4;
3928
            stroke.DrawingAttributes.Height = 4;
3929

    
3930
            inkBoard.Strokes.Add(stroke);
3931
        }
3932

    
3933
        private void btnConsolidate_Click(object sender, RoutedEventArgs e)
3934
        {
3935
            ConsolidationMethod();
3936
        }
3937

    
3938
        /// <summary>
3939
        /// execute TeamConsolidationCommand
3940
        /// </summary>
3941
        public void TeamConsolidationMethod()
3942
        {
3943
            this.UpdateMyMarkupList();
3944
            if (this.gridViewMarkup.SelectedItems.Count == 0)
3945
            {
3946
                this.ParentOfType<MainWindow>().DialogMessage_Alert("Please select at least one user", "Alert");
3947
            }
3948
            else
3949
            {
3950

    
3951
                ViewerDataModel.Instance.IsConsolidate = true;
3952
                this.ParentOfType<MainWindow>().dzTopMenu._SaveEvent(null, null);
3953

    
3954
                foreach (MarkupInfoItem item in this.gridViewMarkup.SelectedItems)
3955
                {
3956
                    if (!this.userData.DEPARTMENT.Equals(item.Depatment))
3957
                    {
3958
                        this.ParentOfType<MainWindow>().DialogMessage_Alert("Please select at your department", "Alert");
3959
                        return;
3960
                    }                    
3961
                }
3962
                List<MarkupInfoItem> MarkupInfoList = new List<MarkupInfoItem>();
3963
                foreach (MarkupInfoItem item in this.gridViewMarkup.SelectedItems)
3964
                {
3965
                    MarkupInfoList.Add(item);
3966
                }
3967
                TeamConsolidateCommand.Instance.Execute(MarkupInfoList);
3968
            }
3969
        }
3970

    
3971
        public void ConsolidationMethod()
3972
        {
3973
            if (this.gridViewMarkup.SelectedItems.Count == 0)
3974
            {
3975
                this.ParentOfType<MainWindow>().DialogMessage_Alert("Please select at least one user", "Alert");
3976
            }
3977
            else
3978
            {
3979
                List<IKCOM.MarkupInfoItem> MySelectItem = new List<IKCOM.MarkupInfoItem>();
3980
                foreach (var item in this.gridViewMarkup.SelectedItems)
3981
                {
3982
                    MySelectItem.Add(item as IKCOM.MarkupInfoItem);
3983
                }
3984
                int iPageNo = Convert.ToInt32(this.ParentOfType<MainWindow>().dzTopMenu.tlcurrentPage.Text);
3985
                
3986
                ConsolidateCommand.Instance.Execute(MySelectItem, iPageNo);
3987
            }
3988
        }
3989

    
3990
        private void btnConsolidate_Loaded(object sender, RoutedEventArgs e)
3991
        {
3992
            if (App.ViewInfo != null)
3993
            {
3994
                btnConsolidate = (sender as RadRibbonButton);
3995
                if (!App.ViewInfo.NewCommentPermission)
3996
                {
3997
                    (sender as RadRibbonButton).Visibility = System.Windows.Visibility.Collapsed;
3998
                }
3999
            }
4000
        }
4001

    
4002
        private void btnTeamConsolidate_Click(object sender, RoutedEventArgs e)
4003
        {
4004
            TeamConsolidationMethod();
4005
        }
4006

    
4007
        private void btnTeamConsolidate_Loaded(object sender, RoutedEventArgs e)
4008
        {
4009
            btnTeamConsolidate = sender as RadRibbonButton;
4010
            if (App.ViewInfo != null)
4011
            {
4012
                if (!App.ViewInfo.CreateFinalPDFPermission) //파이널이 True가 아니면
4013
                {
4014
                    if (btnConsolidate != null)
4015
                    {
4016
                        btnConsolidate.Visibility = Visibility.Collapsed;
4017
                    }
4018

    
4019
                    if (!App.ViewInfo.NewCommentPermission)
4020
                    {
4021
                        btnTeamConsolidate.Visibility = Visibility.Collapsed;
4022
                    }
4023
                }
4024
                else
4025
                {
4026
                    btnTeamConsolidate.Visibility = Visibility.Collapsed;
4027
                }
4028
            }
4029
        }
4030

    
4031
        private void FinalPDFEvent(object sender, RoutedEventArgs e)
4032
        {
4033
            var item = gridViewMarkup.Items.Cast<MarkupInfoItem>().Where(d => d.Consolidate == 1 && d.AvoidConsolidate == 0).FirstOrDefault();
4034
            if(item != null)
4035
            {
4036
                if (BaseClient.FinalPDF_GetFinalPDFStatus(_DocInfo.ID, item.MarkupInfoID, _ViewInfo.UserID))
4037
                {
4038
                    Logger.sendReqLog("SetFinalPDFAsync", _ViewInfo.ProjectNO + "," + _DocInfo.ID + "," + item.MarkupInfoID + "," + _ViewInfo.UserID, 1);
4039
                    BaseClient.SetFinalPDFAsync(_ViewInfo.ProjectNO, _DocInfo.ID, item.MarkupInfoID, _ViewInfo.UserID);
4040
                }
4041
                else
4042
                {
4043
                    DialogMessage_Alert("Merged PDF가 수행중입니다", "안내");
4044
                }
4045
            }else{
4046
                //Consolidate 가 없는 경우
4047
                DialogMessage_Alert("Consolidation 된 코멘트가 존재하지 않습니다", "안내");
4048
            }
4049
            
4050
        }
4051

    
4052
        private void btnFinalPDF_Loaded(object sender, RoutedEventArgs e)
4053
        {
4054
            btnFinalPDF = sender as RadRibbonButton;
4055
            if (App.ViewInfo != null)
4056
            {
4057
                if (!App.ViewInfo.CreateFinalPDFPermission) //파이널이 True가 아니면
4058
                {
4059
                    btnFinalPDF.Visibility = System.Windows.Visibility.Collapsed;
4060
                    if (btnConsolidate != null)
4061
                    {
4062
                        btnConsolidate.Visibility = Visibility.Collapsed;
4063
                    }
4064
                }
4065
            }
4066
        }
4067

    
4068
        private void ConsolidateFinalPDFEvent(object sender, RoutedEventArgs e)
4069
        {
4070
            UpdateMyMarkupList();
4071

    
4072
            if (this.gridViewMarkup.SelectedItems.Count == 0)
4073
            {
4074
                this.ParentOfType<MainWindow>().DialogMessage_Alert("Please select at least one user", "Alert");
4075
            }
4076
            else
4077
            {
4078
                ViewerDataModel.Instance.IsConsolidate = true;
4079
                this.ParentOfType<MainWindow>().dzTopMenu._SaveEvent(null, null);
4080
                List<KCOMDataModel.DataModel.MARKUP_DATA> instanceDataSet = new List<KCOMDataModel.DataModel.MARKUP_DATA>();
4081

    
4082
                string project_no = App.ViewInfo.ProjectNO;
4083
                string doc_id = _DocInfo.ID;
4084
                string user_id = App.ViewInfo.UserID;
4085
                List<MarkupInfoItem> markupInfoItems = new List<MarkupInfoItem>();
4086
                foreach (MarkupInfoItem item in this.gridViewMarkup.SelectedItems)
4087
                {
4088
                    markupInfoItems.Add(item);
4089
                }
4090
                Logger.sendReqLog("Consolidate", project_no + "," + user_id + "," + doc_id + "," + markupInfoItems, 1);
4091
                Logger.sendResLog("Consolidate", this.BaseClient.Consolidate(project_no, user_id, doc_id, markupInfoItems).ToString(), 1);
4092
                Logger.sendReqLog("GetMarkupInfoItemsAsync", App.ViewInfo.ProjectNO + "," + _DocInfo.ID, 1);
4093
                var items = this.BaseClient.GetMarkupInfoItems(App.ViewInfo.ProjectNO, _DocInfo.ID);
4094

    
4095
                var item2 = items.Where(d => d.Consolidate == 1 && d.AvoidConsolidate == 0).FirstOrDefault();
4096
                if (item2 != null)
4097
                {
4098
                    Logger.sendReqLog("SetFinalPDFAsync", _ViewInfo.ProjectNO + "," + _DocInfo.ID + "," + item2.MarkupInfoID + "," + _ViewInfo.UserID, 1);
4099

    
4100
                    BaseClient.SetFinalPDFAsync(_ViewInfo.ProjectNO, _DocInfo.ID, item2.MarkupInfoID, _ViewInfo.UserID);
4101
                    BaseClient.GetMarkupInfoItemsAsync(App.ViewInfo.ProjectNO, _DocInfo.ID);
4102
                }
4103
                else
4104
                {
4105
                    DialogMessage_Alert("Consolidation 된 코멘트가 존재하지 않습니다", "안내");
4106
                }
4107
            }
4108
        }
4109

    
4110
        private void btnConsolidateFinalPDF_Loaded(object sender, RoutedEventArgs e)
4111
        {
4112
            btnConsolidateFinalPDF = (sender as RadRibbonButton);
4113

    
4114
            if (App.ViewInfo != null)
4115
            {
4116
                if (!App.ViewInfo.NewCommentPermission || !App.ViewInfo.CreateFinalPDFPermission)
4117
                {
4118
                    btnConsolidateFinalPDF.Visibility = System.Windows.Visibility.Collapsed;
4119
                }
4120
            }
4121
        }
4122

    
4123
        private void btnAdjustEvent(object sender, RoutedEventArgs e)
4124
        {
4125
            //Controls.AdjustList adjustList = new AdjustList();
4126
            //adjustList.ShowDialogCenter();
4127

    
4128
            //if (adjustList.DialogResult == true)
4129
            //{
4130
            //    System.Diagnostics.Debug.WriteLine("성공");
4131
            //}
4132
        }
4133

    
4134

    
4135
        private void btnAdjust_Loaded(object sender, RoutedEventArgs e)
4136
        {
4137
            btnAdjust = (sender as RadRibbonButton);
4138

    
4139
            if (App.ViewInfo != null)
4140
            {
4141
                if (!App.ViewInfo.NewCommentPermission || !App.ViewInfo.CreateFinalPDFPermission)
4142
                {
4143
                    btnAdjust.Visibility = System.Windows.Visibility.Collapsed;
4144
                }
4145
            }
4146
        }
4147

    
4148
        private void SyncCompare_Click(object sender, RoutedEventArgs e)
4149
        {
4150
            SetCompareRect();
4151
        }
4152

    
4153
        /// <summary>
4154
        /// 문서 Comprare 
4155
        /// </summary>
4156
        private void SetCompareRect()
4157
        { 
4158
            if (CompareMode.IsChecked)
4159
            {
4160
                if (ViewerDataModel.Instance.PageBalanceMode && ViewerDataModel.Instance.PageBalanceNumber == 0)
4161
                {
4162
                    ViewerDataModel.Instance.PageBalanceNumber = 1;
4163
                }
4164
                if (ViewerDataModel.Instance.PageNumber == 0)
4165
                {
4166
                    ViewerDataModel.Instance.PageNumber = 1;
4167
                }
4168

    
4169
                Logger.sendReqLog("GetCompareRectAsync", _ViewInfo.ProjectNO + "," + _ViewInfo.DocumentItemID + "," + CurrentRev.DOCUMENT_ID +
4170
                    "," + pageNavigator.CurrentPage.PageNumber.ToString() + "," + ViewerDataModel.Instance.PageNumber.ToString() + "," +
4171
                    userData.COMPANY != "EXT" ? "true" : "false", 1);
4172

    
4173
                BaseClient.GetCompareRectAsync(_ViewInfo.ProjectNO, _ViewInfo.DocumentItemID, CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber.ToString(), ViewerDataModel.Instance.PageNumber.ToString(), userData.COMPANY != "EXT" ? "true" : "false");
4174
            }
4175
            else
4176
            {
4177
                ClearCompareRect();
4178
            }
4179
        }
4180

    
4181
        /// <summary>
4182
        /// Compare된 영역을 초기화
4183
        /// </summary>
4184
        private void ClearCompareRect()
4185
        {
4186
            da.From = 1;
4187
            da.To = 1;
4188
            da.Duration = new Duration(TimeSpan.FromSeconds(9999));
4189
            da.AutoReverse = false;
4190
            canvas_compareBorder.Children.Clear();
4191
            canvas_compareBorder.BeginAnimation(OpacityProperty, da);
4192
        }
4193

    
4194
        private void Sync_Click(object sender, RoutedEventArgs e)
4195
        {
4196
            if (Sync.IsChecked)
4197
            {
4198
                ViewerDataModel.Instance.Sync_ContentOffsetX = zoomAndPanControl.ContentOffsetX;
4199
                ViewerDataModel.Instance.Sync_ContentOffsetY = zoomAndPanControl.ContentOffsetY;
4200
                ViewerDataModel.Instance.Sync_ContentScale = zoomAndPanControl.ContentScale;
4201
            }
4202
        }
4203

    
4204
        private void SyncUserListExpender_Click(object sender, RoutedEventArgs e)
4205
        {
4206
            if (UserList.IsChecked)
4207
            {
4208
                this.gridViewRevMarkup.Visibility = Visibility.Visible;
4209
            }
4210
            else
4211
            {
4212
                this.gridViewRevMarkup.Visibility = Visibility.Collapsed;
4213
            }
4214
        }
4215

    
4216
        private void SyncPageBalance_Click(object sender, RoutedEventArgs e)
4217
        {
4218

    
4219
            if (BalanceMode.IsChecked)
4220
            {
4221
                ViewerDataModel.Instance.PageBalanceMode = true;
4222
            }
4223
            else
4224
            {
4225
                ViewerDataModel.Instance.PageBalanceMode = false;
4226
                ViewerDataModel.Instance.PageBalanceNumber = 0;
4227
            }
4228
        }
4229

    
4230
        private void SyncExit_Click(object sender, RoutedEventArgs e)
4231
        {
4232
            //초기화
4233
            testPanel2.IsHidden = true;
4234
            ViewerDataModel.Instance.PageBalanceMode = false;
4235
            ViewerDataModel.Instance.PageBalanceNumber = 0;
4236
            ViewerDataModel.Instance.PageNumber = 0;
4237
            ViewerDataModel.Instance.MarkupControls_Sync.Clear();
4238
            this.gridViewRevMarkup.Visibility = Visibility.Collapsed;
4239
            UserList.IsChecked = false;
4240
            BalanceMode.IsChecked = false;
4241
        }
4242

    
4243
        private void SyncPageChange_Click(object sender, RoutedEventArgs e)
4244
        {
4245
            if ((sender as System.Windows.Controls.Control).Tag != null)
4246
            {
4247
                //Compare 초기화
4248
                CompareMode.IsChecked = false;
4249
                var balancePoint = Convert.ToInt32((sender as System.Windows.Controls.Control).Tag);
4250

    
4251
                if (ViewerDataModel.Instance.PageNumber == 0)
4252
                {
4253
                    ViewerDataModel.Instance.PageNumber = 1;
4254
                }
4255

    
4256
                if (ViewerDataModel.Instance.PageBalanceNumber == pageNavigator.PageCount)
4257
                {
4258
                }
4259
                else
4260
                {
4261
                    ViewerDataModel.Instance.PageBalanceNumber += balancePoint;
4262
                }
4263

    
4264
                if (ViewerDataModel.Instance.PageNumber == pageNavigator.PageCount && balancePoint > 0)
4265
                {
4266

    
4267
                }
4268
                else if ((ViewerDataModel.Instance.PageNumber + balancePoint) >= 1)
4269
                {
4270
                    ViewerDataModel.Instance.PageNumber += balancePoint;
4271
                }
4272

    
4273
                if (!testPanel2.IsHidden)
4274
                {
4275
                    if (IsSyncPDFMode)
4276
                    {
4277
                        Get_FinalImage.Get_PdfImage get_PdfImage = new Get_FinalImage.Get_PdfImage();
4278
                        var pdfpath = new BitmapImage(new Uri(get_PdfImage.Run(CurrentRev.TO_VENDOR, App.ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, ViewerDataModel.Instance.PageNumber)));
4279

    
4280
                        if (pdfpath.IsDownloading)
4281
                        {
4282
                            pdfpath.DownloadCompleted += (ex, arg) =>
4283
                            {
4284
                                ViewerDataModel.Instance.ImageViewPath_C = pdfpath;
4285
                                ViewerDataModel.Instance.ImageViewWidth_C = pdfpath.PixelWidth;
4286
                                ViewerDataModel.Instance.ImageViewHeight_C = pdfpath.PixelHeight;
4287
                                zoomAndPanCanvas2.Width = pdfpath.PixelWidth;
4288
                                zoomAndPanCanvas2.Height = pdfpath.PixelHeight;
4289
                            };
4290
                        }
4291
                        else
4292
                        {
4293
                            ViewerDataModel.Instance.ImageViewPath_C = pdfpath;
4294
                            ViewerDataModel.Instance.ImageViewWidth_C = pdfpath.PixelWidth;
4295
                            ViewerDataModel.Instance.ImageViewHeight_C = pdfpath.PixelHeight;
4296

    
4297
                            zoomAndPanCanvas2.Width = pdfpath.PixelWidth;
4298
                            zoomAndPanCanvas2.Height = pdfpath.PixelHeight;
4299
                        }
4300

    
4301
                    }
4302
                    else
4303
                    {
4304
                        string uri = "";
4305

    
4306
                        if (userData.COMPANY != "EXT")
4307
                        {
4308
                            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);
4309
                        }
4310
                        else
4311
                        {
4312
                            uri = String.Format(CommonLib.Common.GetConfigString("subServerImageWebPath", "URL", "", App.isExternal), _ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, ViewerDataModel.Instance.PageNumber);
4313
                        }
4314

    
4315
                        var defaultBitmapImage_Compare = new BitmapImage(new Uri(uri));
4316

    
4317
                        ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare;
4318
                        ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth;
4319
                        ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight;
4320

    
4321
                        zoomAndPanCanvas2.Width = defaultBitmapImage_Compare.PixelWidth;
4322
                        zoomAndPanCanvas2.Height = defaultBitmapImage_Compare.PixelHeight;
4323

    
4324
                        if (defaultBitmapImage_Compare.IsDownloading)
4325
                        {
4326
                            defaultBitmapImage_Compare.DownloadCompleted += (ex, arg) =>
4327
                            {
4328
                                ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare;
4329
                                ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth;
4330
                                ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight;
4331

    
4332
                                zoomAndPanCanvas2.Width = defaultBitmapImage_Compare.PixelWidth;
4333
                                zoomAndPanCanvas2.Height = defaultBitmapImage_Compare.PixelHeight;
4334
                            };
4335
                        }
4336
                    }
4337

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

    
4342
                    foreach (var item in gridSelectionRevItem)
4343
                    {
4344
                        item.MarkupList.Where(pageItem => pageItem.PageNumber == ViewerDataModel.Instance.PageNumber).ToList().ForEach(delegate (MarkupItem markupitem)
4345
                        {
4346
                            MarkupParser.ParseEx(App.ViewInfo.ProjectNO, markupitem.Data, Common.ViewerDataModel.Instance.MarkupControls_Sync, item.DisplayColor, "", item.MarkupInfoID);
4347
                        });
4348
                    }
4349

    
4350
                    //강인구 추가
4351
                    zoomAndPanControl2.ZoomTo(new Rect
4352
                    {
4353
                        X = 0,
4354
                        Y = 0,
4355
                        Width = Math.Max(zoomAndPanCanvas.Width, zoomAndPanCanvas2.Width),
4356
                        Height = Math.Max(zoomAndPanCanvas.Height, zoomAndPanCanvas2.Height),
4357
                    });
4358

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

    
4361
                }
4362
            }
4363
        }
4364

    
4365
        private void SyncChange_Click(object sender, RoutedEventArgs e)
4366
        {
4367
            if (MarkupMode.IsChecked)
4368
            {
4369
                IsSyncPDFMode = true;
4370

    
4371
                var uri = CurrentRev.TO_VENDOR;
4372

    
4373
                if (ViewerDataModel.Instance.PageNumber == 0)
4374
                {
4375
                    ViewerDataModel.Instance.PageNumber = 1;
4376
                }
4377

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

    
4382
                if (pdfpath.IsDownloading)
4383
                {
4384
                    pdfpath.DownloadCompleted += (ex, arg) =>
4385
                    {
4386
                        ViewerDataModel.Instance.ImageViewPath_C = pdfpath;
4387
                        ViewerDataModel.Instance.ImageViewWidth_C = pdfpath.PixelWidth;
4388
                        ViewerDataModel.Instance.ImageViewHeight_C = pdfpath.PixelHeight;
4389
                        zoomAndPanCanvas2.Width = pdfpath.PixelWidth;
4390
                        zoomAndPanCanvas2.Height = pdfpath.PixelHeight;
4391
                    };
4392
                }
4393
                else
4394
                {
4395
                    ViewerDataModel.Instance.ImageViewPath_C = pdfpath;
4396
                    ViewerDataModel.Instance.ImageViewWidth_C = pdfpath.PixelWidth;
4397
                    ViewerDataModel.Instance.ImageViewHeight_C = pdfpath.PixelHeight;
4398

    
4399
                    zoomAndPanCanvas2.Width = pdfpath.PixelWidth;
4400
                    zoomAndPanCanvas2.Height = pdfpath.PixelHeight;
4401
                }
4402
            }
4403
            else
4404
            {
4405
                IsSyncPDFMode = false;
4406
                string uri = "";
4407
                if (userData.COMPANY != "EXT")
4408
                {
4409
                    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);
4410
                }
4411
                else
4412
                {
4413
                    uri = String.Format(CommonLib.Common.GetConfigString("subServerImageWebPath", "URL", "", App.isExternal), _ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber);
4414
                }
4415

    
4416
                var defaultBitmapImage_Compare = new BitmapImage(new Uri(uri));
4417

    
4418
                ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare;
4419
                ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth;
4420
                ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight;
4421

    
4422
                if (defaultBitmapImage_Compare.IsDownloading)
4423
                {
4424
                    defaultBitmapImage_Compare.DownloadCompleted += (ex, arg) =>
4425
                    {
4426
                        ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare;
4427
                        ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth;
4428
                        ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight;
4429
                    };
4430
                }
4431
                zoomAndPanControl2.ApplyTemplate();
4432
                zoomAndPanControl2.UpdateLayout();
4433
                zoomAndPanCanvas2.Width = Convert.ToDouble(Common.ViewerDataModel.Instance.ContentWidth);
4434
                zoomAndPanCanvas2.Height = Convert.ToDouble(Common.ViewerDataModel.Instance.ContentHeight);
4435
            }
4436
        }
4437

    
4438
        private async void RadButton_Click(object sender, RoutedEventArgs e)
4439
        {
4440
            gridViewHistory_Busy.IsBusy = true;
4441

    
4442
            RadButton instance = sender as RadButton;
4443
            if (instance.CommandParameter != null)
4444
            {
4445
                CurrentRev = instance.CommandParameter as VPRevision;
4446
                System.EventHandler<ServiceDeepView.GetSyncMarkupInfoItemsCompletedEventArgs> GetSyncMarkupInfoItemshandler = null;
4447

    
4448
                GetSyncMarkupInfoItemshandler = (sen, ea) =>
4449
                {
4450
                    if (ea.Error == null && ea.Result != null)
4451
                    {
4452
                        testPanel2.IsHidden = false;
4453

    
4454
                        ViewerDataModel.Instance._markupInfoRevList.Clear();
4455
                        foreach(var info in ea.Result)
4456
                        {
4457
                            if(info.UserID == App.ViewInfo.UserID)
4458
                            {
4459
                                info.userDelete = true;
4460
                                info.DisplayColor = "FFFF0000";
4461
                            }
4462
                            else
4463
                            {
4464
                                info.userDelete = false;
4465
                            }
4466
                            ViewerDataModel.Instance._markupInfoRevList.Add(info);
4467
                        }
4468
                        gridViewRevMarkup.ItemsSource = ViewerDataModel.Instance._markupInfoRevList;
4469

    
4470
                        string uri = "";
4471
                        if (userData.COMPANY != "EXT")
4472
                        {
4473
                            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);
4474
                        }
4475
                        else
4476
                        {
4477
                            uri = String.Format(CommonLib.Common.GetConfigString("subServerImageWebPath", "URL", "", App.isExternal), _ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber);
4478
                        }
4479

    
4480
                        Sync_Offset_Point = new Point(zoomAndPanControl.ContentOffsetX, zoomAndPanControl.ContentOffsetY);
4481

    
4482
                        var defaultBitmapImage_Compare = ImageSourceHelper.GetDownloadImage(uri);
4483

    
4484
                        ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare;
4485
                        ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth;
4486
                        ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight;
4487
                        zoomAndPanCanvas2.Width = defaultBitmapImage_Compare.PixelWidth;
4488
                        zoomAndPanCanvas2.Height = defaultBitmapImage_Compare.PixelHeight;
4489
                        
4490
                        zoomAndPanControl2.ApplyTemplate();
4491
                        zoomAndPanControl2.UpdateLayout();
4492
                        //syncPannelRotate(zoomAndPanControl.RotationAngle);
4493
                        if (Sync_Offset_Point != new Point(zoomAndPanControl.ContentOffsetX, zoomAndPanControl.ContentOffsetY))
4494
                        {
4495
                            zoomAndPanControl.ContentOffsetX = Sync_Offset_Point.X;
4496
                            zoomAndPanControl.ContentOffsetY = Sync_Offset_Point.Y;
4497
                        }
4498

    
4499
                        ViewerDataModel.Instance.Sync_ContentOffsetX = Sync_Offset_Point.X;
4500
                        ViewerDataModel.Instance.Sync_ContentOffsetY = Sync_Offset_Point.Y;
4501
                        ViewerDataModel.Instance.Sync_ContentScale = zoomAndPanControl.ContentScale;
4502

    
4503
                        tlSyncRev.Text = String.Format("Rev. {0}", CurrentRev.RevNo);
4504
                        tlSyncPageNum.Text = String.Format("Current Page : {0}", pageNavigator.CurrentPage.PageNumber);
4505
                        gridViewHistory_Busy.IsBusy = false;
4506
                    }
4507

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

    
4510
                    if (GetSyncMarkupInfoItemshandler != null)
4511
                    {
4512
                        BaseClient.GetSyncMarkupInfoItemsCompleted -= GetSyncMarkupInfoItemshandler;
4513
                    }
4514

    
4515
                    ClearCompareRect();
4516
                    SetCompareRect();
4517
                };
4518

    
4519
                /// 중복 실행이 발생하여 수정함.
4520
                BaseClient.GetSyncMarkupInfoItemsCompleted += GetSyncMarkupInfoItemshandler;
4521
                BaseClient.GetSyncMarkupInfoItemsAsync(_ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, _ViewInfo.UserID);
4522

    
4523
                Logger.sendReqLog("GetSyncMarkupInfoItemsAsync", _ViewInfo.ProjectNO + "," + CurrentRev.DOCUMENT_ID + "," + _ViewInfo.UserID, 1);
4524
            }
4525
        }
4526

    
4527
        private void EnsembleLink_Button_Click(object sender, RoutedEventArgs e)
4528
        {
4529
            try
4530
            {
4531
                if (sender is RadButton)
4532
                {
4533
                    if ((sender as RadButton).Tag != null)
4534
                    {
4535
                        var url = (sender as RadButton).Tag.ToString();
4536
                        System.Diagnostics.Process.Start(url);
4537
                    }
4538
                    else
4539
                    {
4540
                        this.ParentOfType<MainWindow>().DialogMessage_Alert("Link 정보가 잘못 되었습니다", "안내");
4541
                    }
4542
                }
4543
            }
4544
            catch (Exception ex)
4545
            {
4546
                Logger.sendResLog("EnsembleLink_Button_Click", ex.Message, 0);
4547
            }
4548
        }
4549

    
4550
        public void Sync_Event(VPRevision Currnet_Rev)
4551
        {
4552
            CurrentRev = Currnet_Rev;
4553

    
4554
            BaseClient.GetSyncMarkupInfoItemsCompleted += (sen, ea) =>
4555
            {
4556
                if (ea.Error == null && ea.Result != null)
4557
                {
4558
                    testPanel2.IsHidden = false;
4559

    
4560
                    ViewerDataModel.Instance._markupInfoRevList.Clear();
4561
                    foreach(var info in ea.Result)
4562
                    {
4563
                        if(info.UserID == App.ViewInfo.UserID)
4564
                        {
4565
                            info.userDelete = true;
4566
                            info.DisplayColor = "FFFF0000";
4567
                        }
4568
                        else
4569
                        {
4570
                            info.userDelete = false;
4571
                        }
4572
                        ViewerDataModel.Instance._markupInfoRevList.Add(info);
4573
                    }
4574
                    gridViewRevMarkup.ItemsSource = ViewerDataModel.Instance._markupInfoRevList;
4575

    
4576
                    string uri = "";
4577
                    if (userData.COMPANY != "EXT")
4578
                    {
4579
                        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);
4580
                    }
4581
                    else
4582
                    {
4583
                        uri = String.Format(CommonLib.Common.GetConfigString("subServerImageWebPath", "URL", "", App.isExternal), _ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber);
4584
                    }
4585

    
4586
                    Sync_Offset_Point = new Point(zoomAndPanControl.ContentOffsetX, zoomAndPanControl.ContentOffsetY);
4587

    
4588
                    var defaultBitmapImage_Compare = new BitmapImage(new Uri(uri));
4589

    
4590
                    ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare;
4591
                    ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth;
4592
                    ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight;
4593

    
4594
                    if (defaultBitmapImage_Compare.IsDownloading)
4595
                    {
4596
                        defaultBitmapImage_Compare.DownloadCompleted += (ex, arg) =>
4597
                        {
4598
                            ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare;
4599
                            ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth;
4600
                            ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight;
4601
                        };
4602
                    }
4603

    
4604

    
4605
                    zoomAndPanCanvas2.Width = Convert.ToDouble(Common.ViewerDataModel.Instance.ContentWidth);
4606
                    zoomAndPanCanvas2.Height = Convert.ToDouble(Common.ViewerDataModel.Instance.ContentHeight);
4607
                    zoomAndPanControl2.ApplyTemplate();
4608
                    zoomAndPanControl2.UpdateLayout();
4609

    
4610
                    if (Sync_Offset_Point != new Point(zoomAndPanControl.ContentOffsetX, zoomAndPanControl.ContentOffsetY))
4611
                    {
4612
                        zoomAndPanControl.ContentOffsetX = Sync_Offset_Point.X;
4613
                        zoomAndPanControl.ContentOffsetY = Sync_Offset_Point.Y;
4614
                    }
4615
                    //}
4616

    
4617
                    tlSyncRev.Text = String.Format("Rev. {0}", CurrentRev.RevNo);
4618
                    tlSyncPageNum.Text = String.Format("Current Page : {0}", pageNavigator.CurrentPage.PageNumber);
4619
                    gridViewHistory_Busy.IsBusy = false;
4620
                }
4621
                Logger.sendResLog("GetSyncMarkupInfoItemsCompleted", "UserState : " + ea.UserState + "\r Result :" + ea.Result + "\r Cancelled :" + ea.Cancelled + "\r Error :" + ea.Error, 1);
4622

    
4623
            };
4624
            Logger.sendReqLog("GetSyncMarkupInfoItemsAsync", _ViewInfo.ProjectNO + "," + CurrentRev.DOCUMENT_ID + "," + _ViewInfo.UserID, 1);
4625
            BaseClient.GetSyncMarkupInfoItemsAsync(_ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, _ViewInfo.UserID);
4626
        }
4627

    
4628
        private void PdfLink_ButtonDown(object sender, MouseButtonEventArgs e)
4629
        {
4630
            if (sender is Image)
4631
            {
4632
                if ((sender as Image).Tag != null)
4633
                {
4634
                    var pdfUrl = (sender as Image).Tag.ToString();
4635
                    System.Diagnostics.Process.Start(pdfUrl);
4636
                }
4637
                else
4638
                {
4639
                    this.ParentOfType<MainWindow>().DialogMessage_Alert("문서 정보가 잘못 되었습니다", "안내");
4640
                }
4641
            }
4642
        }
4643

    
4644
        private void Create_Symbol(object sender, RoutedEventArgs e)
4645
        {
4646
            MarkupToPDF.Controls.Parsing.MarkupParser.MarkupReturn markupReturn = new MarkupToPDF.Controls.Parsing.MarkupParser.MarkupReturn();
4647

    
4648
            if (SelectLayer.Children.Count < 1) //선택된 것이 없으면
4649
            {
4650
                DialogMessage_Alert("Please Select Controls", "Alert");
4651
            }
4652
            else //선택된 것이 있으면
4653
            {
4654
                string MarkupData = "";
4655
                adorner_ = new AdornerFinal();
4656

    
4657
                foreach (var item in SelectLayer.Children)
4658
                {
4659
                    if (item.GetType().Name == "AdornerFinal")
4660
                    {
4661
                        adorner_ = (item as Controls.AdornerFinal);
4662
                        foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
4663
                        {
4664
                            if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
4665
                            {
4666
                                markupReturn = MarkupParser.MarkupToString(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo, App.ViewInfo.UserID);
4667
                                MarkupData += markupReturn.ConvertData;
4668
                            }
4669
                        }
4670
                    }
4671
                }
4672
                DialogParameters parameters = new DialogParameters()
4673
                {
4674
                    Owner = Application.Current.MainWindow,
4675
                    Closed = (obj, args) => this.MarkupNamePromptClose(MarkupData, args),
4676
                    DefaultPromptResultValue = "Custom State",
4677
                    Content = "Name :",
4678
                    Header = "Insert Custom Symbol Name",
4679
                    Theme = new VisualStudio2013Theme(),
4680
                    ModalBackground = new SolidColorBrush { Color = Colors.Black, Opacity = 0.6 },
4681
                };
4682
                RadWindow.Prompt(parameters);
4683
            }
4684

    
4685
        }
4686
        public int symbolselectindex = 0;
4687
        private void SymbolMarkupNamePromptClose(byte[] Img_byte, string data, WindowClosedEventArgs args)
4688
        {
4689
            //Save save = new Save();
4690
            try
4691
            {
4692
                string svgfilename = null;
4693
                if (symbolname != null)
4694
                {
4695
                    if (symbolpng == true || symbolsvg == true)
4696
                    {
4697
                        kr.co.devdoftech.cloud.FileUpload fileUploader = new kr.co.devdoftech.cloud.FileUpload();
4698
                        string guid = Commons.shortGuid();
4699

    
4700
                        fileUploader.RunAsync(App.ViewInfo.ProjectNO, _DocItem.DOCUMENT_NO, App.ViewInfo.UserID, guid + ".png", Img_byte);
4701
                        //Check_Uri.UriCheck();
4702
                        fileUploader.RunCompleted += (ex, arg) =>
4703
                        {
4704
                            filename = arg.Result;
4705
                            if (symbolpng == true)
4706
                            {
4707
                                if (filename != null)
4708
                                { 
4709
                                    if (symbolselectindex == 0)
4710
                                    {
4711
                                        SymbolSave(symbolname, filename, data);
4712
                                    }
4713
                                    else
4714
                                    {
4715
                                        SymbolSave_Public(symbolname, filename, data, ViewerDataModel.Instance.SystemMain.dzMainMenu.userData.DEPARTMENT);
4716
                                    }
4717
                                    DataBind();
4718
                                }                                
4719
                            }
4720

    
4721
                            if (symbolsvg == true)
4722
                            {
4723
                                try
4724
                                {
4725
                                    var defaultBitmapImage = new BitmapImage();
4726
                                    defaultBitmapImage.BeginInit();
4727
                                    defaultBitmapImage.CreateOptions = BitmapCreateOptions.IgnoreImageCache;
4728
                                    defaultBitmapImage.CacheOption = BitmapCacheOption.OnLoad;
4729
                                    Check_Uri.UriCheck(filename);
4730
                                    defaultBitmapImage.UriSource = new Uri(filename);
4731
                                    defaultBitmapImage.EndInit();
4732

    
4733
                                    System.Drawing.Bitmap image;
4734

    
4735
                                    if (defaultBitmapImage.IsDownloading)
4736
                                    {
4737
                                        defaultBitmapImage.DownloadCompleted += (ex2, arg2) =>
4738
                                        {
4739
                                            defaultBitmapImage.Freeze();
4740
                                            image = GetBitmap(defaultBitmapImage);
4741
                                            image.Save(@AppDomain.CurrentDomain.BaseDirectory + "potrace.bmp", System.Drawing.Imaging.ImageFormat.Bmp);
4742
                                            Process potrace = new Process
4743
                                            {
4744
                                                StartInfo = new ProcessStartInfo
4745
                                                {
4746
                                                    FileName = @AppDomain.CurrentDomain.BaseDirectory + "potrace.exe",
4747
                                                    Arguments = "-b svg " + @AppDomain.CurrentDomain.BaseDirectory + "potrace.bmp",
4748
                                                    RedirectStandardInput = true,
4749
                                                    RedirectStandardOutput = true,
4750
                                                    RedirectStandardError = true,
4751
                                                    UseShellExecute = false,
4752
                                                    CreateNoWindow = true,
4753
                                                    WindowStyle = ProcessWindowStyle.Hidden
4754
                                                },
4755
                                            };
4756

    
4757
                                            StringBuilder svgBuilder = new StringBuilder();
4758
                                            potrace.OutputDataReceived += (object sender2, DataReceivedEventArgs e2) =>
4759
                                            {
4760
                                                svgBuilder.AppendLine(e2.Data);
4761
                                            };
4762

    
4763
                                            potrace.EnableRaisingEvents = true;
4764
                                            potrace.Start();
4765
                                            potrace.Exited += (sender, e) =>
4766
                                            {
4767
                                                byte[] bytes = System.IO.File.ReadAllBytes(@AppDomain.CurrentDomain.BaseDirectory + "potrace.svg");
4768
                                                svgfilename = fileUploader.Run(App.ViewInfo.ProjectNO, _DocItem.DOCUMENT_NO, App.ViewInfo.UserID, guid + ".svg", bytes);
4769
                                                Check_Uri.UriCheck(svgfilename);
4770
                                                if (symbolselectindex == 0)
4771
                                                {
4772
                                                    SymbolSave(symbolname, svgfilename, data);
4773
                                                }
4774
                                                else
4775
                                                {
4776
                                                    SymbolSave_Public(symbolname, svgfilename, data, ViewerDataModel.Instance.SystemMain.dzMainMenu.userData.DEPARTMENT);
4777
                                                }
4778

    
4779
                                                DataBind();
4780
                                            };
4781
                                            potrace.WaitForExit();
4782
                                        };
4783
                                    }
4784
                                    else
4785
                                    {
4786
                                        //GC.Collect();
4787
                                    }
4788
                                }
4789
                                catch(Exception ee)
4790
                                {
4791
                                    DialogMessage_Alert("" + ee, "Alert");
4792
                                }
4793
                            }
4794
                        };                                             
4795
                    }
4796
                }
4797
            }
4798
            catch (Exception e)
4799
            {
4800
                //DialogMessage_Alert(e + "", "Alert");
4801
            }            
4802
        }
4803

    
4804
        public void SymbolSave(string Name, string Url, string Data)
4805
        {
4806
            try
4807
            {
4808
                SYMBOL_PRIVATE symbol_private = new SYMBOL_PRIVATE
4809
                {
4810
                    ID = Commons.shortGuid(),
4811
                    MEMBER_USER_ID = App.ViewInfo.UserID,
4812
                    NAME = Name,
4813
                    IMAGE_URL = Url,
4814
                    DATA = Data
4815
                };
4816

    
4817
                Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.SaveSymbolCompleted += BaseClient_SaveSymbolCompleted;
4818
                Logger.sendReqLog("SaveSymbolAsync: ", symbol_private.ID + "," + symbol_private.MEMBER_USER_ID + "," + symbol_private.NAME + "," + symbol_private.IMAGE_URL + "," + symbol_private.DATA, 1);
4819
                Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.SaveSymbolAsync(symbol_private);
4820
            }
4821
            catch (Exception)
4822
            {
4823
                throw;
4824
            }
4825
        }
4826

    
4827
        public void SymbolSave_Public(string Name, string Url, string Data, string Department)
4828
        {
4829
            try
4830
            {
4831
                SYMBOL_PUBLIC symbol_public = new SYMBOL_PUBLIC
4832
                {
4833
                    ID = Commons.shortGuid(),
4834
                    DEPARTMENT = Department,
4835
                    NAME = Name,
4836
                    IMAGE_URL = Url,
4837
                    DATA = Data
4838
                };
4839
                Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.AddPublicSymbolCompleted += BaseClient_AddPublicSymbolCompleted;
4840
                Logger.sendReqLog("AddPublicSymbol: ", symbol_public.ID + "," + symbol_public.DEPARTMENT + "," + symbol_public.NAME + "," + symbol_public.IMAGE_URL + "," + symbol_public.DATA, 1);
4841
                Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.AddPublicSymbol(symbol_public);
4842
            }
4843
            catch (Exception)
4844
            {
4845
                throw;
4846
            }
4847
        }
4848

    
4849
        private void BaseClient_AddPublicSymbolCompleted(object sender, ServiceDeepView.AddPublicSymbolCompletedEventArgs e)
4850
        {           
4851
            Logger.sendResLog("AddPublicSymbolCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1);
4852
            DataBind();
4853
        }
4854

    
4855
        private void BaseClient_SaveSymbolCompleted(object sender, ServiceDeepView.SaveSymbolCompletedEventArgs e)
4856
        {
4857
            Logger.sendResLog("RenameSymbolCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1);
4858
            DataBind();
4859
        }
4860
        private void DataBind()
4861
        {
4862
            try
4863
            {
4864
                Symbol_Custom Custom = new Symbol_Custom();
4865
                List<Symbol_Custom> Custom_List = new List<Symbol_Custom>();
4866
                
4867
                var symbol_Private = BaseClient.GetSymbolList(App.ViewInfo.UserID);
4868
                foreach (var item in symbol_Private)
4869
                {
4870
                    Custom.Name = item.NAME;
4871
                    Custom.ImageUri = item.IMAGE_URL;
4872
                    Custom.ID = item.ID;
4873
                    Custom_List.Add(Custom);
4874
                    Custom = new Symbol_Custom();
4875
                }
4876
                symbolPanel_Instance.lstSymbolPrivate.ItemsSource = Custom_List;
4877
                
4878
                Custom = new Symbol_Custom();
4879
                Custom_List = new List<Symbol_Custom>();
4880

    
4881
                symbolPanel_Instance.deptlist.ItemsSource = BaseClient.GetPublicSymbolDeptList();
4882

    
4883
                List<SYMBOL_PUBLIC> symbol_Public;
4884

    
4885
                if (symbolPanel_Instance.deptlist.SelectedValue != null)
4886
                {
4887
                    symbol_Public = BaseClient.GetPublicSymbolList(symbolPanel_Instance.deptlist.SelectedValue.ToString());
4888
                }
4889
                else
4890
                {
4891
                    symbol_Public = BaseClient.GetPublicSymbolList(null);
4892
                }
4893
                foreach (var item in symbol_Public)
4894
                {
4895
                    Custom.Name = item.NAME;
4896
                    Custom.ImageUri = item.IMAGE_URL;
4897
                    Custom.ID = item.ID;
4898
                    Custom_List.Add(Custom);
4899
                    Custom = new Symbol_Custom();
4900
                }
4901
                symbolPanel_Instance.lstSymbolPublic.ItemsSource = Custom_List;
4902
                BaseClient.Close();                
4903
            }
4904
            catch(Exception e)
4905
            {
4906
                //DialogMessage_Alert("DataBind", "Alert");
4907
            }
4908
            
4909
        }
4910
        private void MarkupNamePromptClose(string data, WindowClosedEventArgs args)
4911
        {
4912
            try
4913
            {
4914
                if (args.PromptResult != null)
4915
                {
4916
                    if (args.DialogResult.Value)
4917
                    {
4918
                        PngBitmapEncoder _Encoder = symImage(data);
4919

    
4920
                        System.IO.MemoryStream fs = new System.IO.MemoryStream();
4921
                        _Encoder.Save(fs);
4922
                        System.Drawing.Image ImgOut = System.Drawing.Image.FromStream(fs);
4923

    
4924
                        byte[] Img_byte = fs.ToArray();
4925

    
4926
                        kr.co.devdoftech.cloud.FileUpload fileUploader = new kr.co.devdoftech.cloud.FileUpload();
4927
                        filename = fileUploader.Run(App.ViewInfo.ProjectNO, _DocItem.DOCUMENT_NO, App.ViewInfo.UserID, Commons.shortGuid() + ".png", Img_byte);
4928
                        Check_Uri.UriCheck(filename);
4929
                        if (symbolPanel_Instance.RadTab.SelectedIndex == 0)
4930
                        {
4931
                            SaveCommand.Instance.SymbolSave(args.PromptResult, filename, data);
4932
                        }
4933
                        else
4934
                        {
4935
                            SaveCommand.Instance.SymbolSave_Public(args.PromptResult, filename, data, ViewerDataModel.Instance.SystemMain.dzMainMenu.userData.DEPARTMENT);
4936
                        }
4937
                        DataBind();
4938
                    }
4939
                }
4940
            }
4941
            catch(Exception ex)
4942
            {
4943
                DialogMessage_Alert("" + ex, "Alert");
4944
            }
4945
        }
4946

    
4947
        public PngBitmapEncoder symImage(string data)
4948
        {
4949

    
4950
            Canvas _canvas = new Canvas();
4951
            _canvas.Background = Brushes.White;
4952
            _canvas.Width = adorner_.BorderSize.Width;
4953
            _canvas.Height = adorner_.BorderSize.Height;
4954
            MarkupParser.Parse(App.ViewInfo.ProjectNO, data, _canvas, "#FFFF0000", "");
4955

    
4956
            BitmapEncoder encoder = new PngBitmapEncoder();
4957

    
4958

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

    
4961
            DrawingVisual dv = new DrawingVisual();
4962

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

    
4966
            using (DrawingContext ctx = dv.RenderOpen())
4967
            {
4968
                VisualBrush vb = new VisualBrush(_canvas);
4969
                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)));
4970
            }
4971

    
4972
            try
4973
            {
4974
                renderBitmap.Render(dv);
4975

    
4976
                //GC.Collect();
4977
                GC.WaitForPendingFinalizers();
4978
                //GC.Collect();
4979
                // encode png data
4980
                PngBitmapEncoder pngEncoder = new PngBitmapEncoder();
4981
                // puch rendered bitmap into it
4982
                pngEncoder.Interlace = PngInterlaceOption.Off;
4983
                pngEncoder.Frames.Add(BitmapFrame.Create(renderBitmap));
4984
                return pngEncoder;
4985

    
4986
            }
4987
            catch //(Exception ex)
4988
            {
4989
                return null;
4990
            }
4991

    
4992
        }
4993

    
4994
        public void DialogMessage_Alert(string content, string header)
4995
        {
4996
            DialogParameters parameters = new DialogParameters()
4997
            {
4998
                Owner = this.ParentOfType<MainWindow>(),
4999
                Content = new TextBlock()
5000
                { 
5001
                    MinWidth = 400,
5002
                    FontSize = 11,
5003
                    Text = content,
5004
                    TextWrapping = System.Windows.TextWrapping.Wrap
5005
                },
5006
                Header = header,
5007
                Theme = new VisualStudio2013Theme(),
5008
                ModalBackground = new SolidColorBrush { Color = Colors.Black, Opacity = 0.6 },
5009
            };            
5010
            RadWindow.Alert(parameters);
5011
        }
5012

    
5013
        #region 캡쳐 기능
5014

    
5015
        public BitmapSource CutAreaToImage(int x, int y, int width, int height)
5016
        {
5017
            if (x < 0)
5018
            {
5019
                width += x;
5020
                x = 0;
5021
            }
5022
            if (y < 0)
5023
            {
5024
                height += y;
5025
                y = 0;
5026

    
5027
                width = (int)zoomAndPanCanvas.ActualWidth - x;
5028
            }
5029
            if (x + width > zoomAndPanCanvas.ActualWidth)
5030
            {
5031
                width = (int)zoomAndPanCanvas.ActualWidth - x;
5032
            }
5033
            if (y + height > zoomAndPanCanvas.ActualHeight)
5034
            {
5035
                height = (int)zoomAndPanCanvas.ActualHeight - y;
5036
            }
5037

    
5038
            byte[] pixels = CopyPixels(x, y, width, height);
5039

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

    
5042
            return BitmapSource.Create(width, height, 96, 96, PixelFormats.Pbgra32, null, pixels, stride);
5043
        }
5044

    
5045
        public byte[] CopyPixels(int x, int y, int width, int height)
5046
        {
5047
            byte[] pixels = new byte[width * height * 4];
5048
            int stride = (width * canvasImage.Format.BitsPerPixel + 7) / 8;
5049

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

    
5053
            return pixels;
5054
        }
5055

    
5056
        public RenderTargetBitmap ConverterBitmapImage(FrameworkElement element)
5057
        {
5058
            DrawingVisual drawingVisual = new DrawingVisual();
5059
            DrawingContext drawingContext = drawingVisual.RenderOpen();
5060

    
5061
            // 해당 객체의 그래픽요소로 사각형의 그림을 그립니다.
5062
            drawingContext.DrawRectangle(new VisualBrush(element), null,
5063
                new Rect(new Point(0, 0), new Point(element.ActualWidth, element.ActualHeight)));
5064
            drawingContext.Close();
5065

    
5066
            // 비트맵으로 변환합니다.
5067
            RenderTargetBitmap target =
5068
                new RenderTargetBitmap((int)element.ActualWidth, (int)element.ActualHeight,
5069
                96, 96, System.Windows.Media.PixelFormats.Pbgra32);
5070

    
5071
            target.Render(drawingVisual);
5072
            return target;
5073
        }
5074

    
5075
        System.Drawing.Bitmap GetBitmap(BitmapSource source)
5076
        {
5077
            System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(source.PixelWidth, source.PixelHeight, System.Drawing.Imaging.PixelFormat.Format32bppPArgb);
5078
            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);
5079
            source.CopyPixels(Int32Rect.Empty, data.Scan0, data.Height * data.Stride, data.Stride);
5080
            bmp.UnlockBits(data);
5081
            return bmp;
5082
        }
5083
        public string symbolname = null;
5084
        public bool symbolsvg = true;
5085
        public bool symbolpng = true;
5086

    
5087
        public void Save_Symbol_Capture(BitmapSource source, int x, int y, int width, int height)
5088
        {
5089
            System.Drawing.Bitmap image = GetBitmap(source);
5090
            //흰색 제거
5091
            //image.MakeTransparent(System.Drawing.Color.White);
5092

    
5093
            var imageStream = new System.IO.MemoryStream();
5094
            byte[] imageBytes = null;
5095
            using (imageStream)
5096
            {
5097
                image.Save(imageStream, System.Drawing.Imaging.ImageFormat.Png);
5098
                // test.Save(@"E:\test.png", System.Drawing.Imaging.ImageFormat.Png);
5099
                imageStream.Position = 0;
5100
                imageBytes = imageStream.ToArray();
5101
            }
5102

    
5103
            SymbolPrompt symbolPrompt = new SymbolPrompt();
5104

    
5105
            RadWindow CheckPop = new RadWindow();
5106
            //Alert check = new Alert(Msg);
5107

    
5108
            CheckPop = new RadWindow
5109
            {
5110
                MinWidth = 400,
5111
                MinHeight = 100,
5112
               // Closed = (obj, args) => this.SymbolMarkupNamePromptClose(imageBytes, "", args),
5113
                Header = "Alert",
5114
                Content = symbolPrompt,
5115
                //DialogResult = 
5116
                ResizeMode = System.Windows.ResizeMode.NoResize,
5117
                WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen,
5118
                IsTopmost = true,
5119
            };
5120
            CheckPop.Closed += (obj, args) => this.SymbolMarkupNamePromptClose(imageBytes, "", args);
5121
            StyleManager.SetTheme(CheckPop, new Office2013Theme());
5122
            CheckPop.ShowDialog();
5123

    
5124
            /*
5125
            DialogParameters parameters = new DialogParameters()
5126
            {
5127
                Owner = Application.Current.MainWindow,
5128
                Closed = (obj, args) => this.SymbolMarkupNamePromptClose(imageBytes, "", args),
5129
                DefaultPromptResultValue = "Custom State",
5130
                Content = "Name :",
5131
                Header = "Insert Custom Symbol Name",
5132
                Theme = new VisualStudio2013Theme(),
5133
                ModalBackground = new SolidColorBrush { Color = Colors.Black, Opacity = 0.6 },
5134
            };            
5135
            RadWindow.Prompt(parameters);
5136
            */
5137
        }
5138

    
5139
        public void Save_Capture(BitmapSource source, int x, int y, int width, int height)
5140
        {
5141
            KCOM.Common.Converter.FileStreamToBase64 streamToBase64 = new Common.Converter.FileStreamToBase64();
5142
            KCOMDataModel.DataModel.CHECK_LIST check_;
5143
            string Result = streamToBase64.ImageToBase64(source);
5144
            KCOMDataModel.DataModel.CHECK_LIST Item = new KCOMDataModel.DataModel.CHECK_LIST();
5145
            string projectno = App.ViewInfo.ProjectNO;
5146
            string checklist_id = ViewerDataModel.Instance.CheckList_ID;
5147

    
5148
            Logger.sendReqLog("GetCheckList", projectno + "," + checklist_id, 1);
5149
            Item = this.BaseClient.GetCheckList(projectno, checklist_id);
5150
            if (Item != null)
5151
            {
5152
                Logger.sendResLog("GetCheckList", "TRUE", 1);
5153
            }
5154
            else
5155
            {
5156
                Logger.sendResLog("GetCheckList", "FALSE", 1);
5157
            }
5158

    
5159
            if (Item == null)
5160
            {
5161
                check_ = new KCOMDataModel.DataModel.CHECK_LIST
5162
                {
5163
                    ID = Commons.shortGuid(),
5164
                    USER_ID = App.ViewInfo.UserID,
5165
                    IMAGE_URL = Result,
5166
                    IMAGE_ANCHOR = x + "," + y + "," + width + "," + height,
5167
                    PAGENUMBER = this.pageNavigator.CurrentPage.PageNumber,
5168
                    REVISION = ViewerDataModel.Instance.SystemMain.dzMainMenu.CurrentDoc.Revision,
5169
                    DOCUMENT_ID = App.ViewInfo.DocumentItemID,
5170
                    PROJECT_NO = App.ViewInfo.ProjectNO,
5171
                    STATUS = "False",
5172
                    CREATE_TIME = DateTime.Now,
5173
                    UPDATE_TIME = DateTime.Now,
5174
                    DOCUMENT_NO = _DocItem.DOCUMENT_NO,
5175
                    STATUS_DESC_OPEN = "Vendor 반영 필요",
5176
                };
5177
                Logger.sendReqLog("AddCheckList", projectno + "," + check_, 1);
5178
                Logger.sendResLog("AddCheckList", this.BaseClient.AddCheckList(projectno, check_).ToString(), 1);
5179
                //this.BaseClient.AddCheckList(projectno, check_);
5180
            }
5181
            else
5182
            {
5183
                Item.IMAGE_URL = Result;
5184
                Item.IMAGE_ANCHOR = x + "," + y + "," + width + "," + height;
5185
                Item.PAGENUMBER = this.pageNavigator.CurrentPage.PageNumber;
5186
                Logger.sendReqLog("SaveCheckList", projectno + "," + checklist_id + "," + Item, 1);
5187
                Logger.sendResLog("SaveCheckList", this.BaseClient.SaveCheckList(projectno, checklist_id, Item).ToString(), 1);
5188
                //this.BaseClient.SaveCheckList(projectno, checklist_id, Item);
5189
            }
5190

    
5191
        }
5192

    
5193
        public void Set_Capture()
5194
        {
5195
            double x = canvasDrawingMouseDownPoint.X;
5196
            double y = canvasDrawingMouseDownPoint.Y;
5197
            double width = dragCaptureBorder.Width;
5198
            double height = dragCaptureBorder.Height;
5199

    
5200
            if (width > 5 || height > 5)
5201
            {
5202
                canvasImage = ConverterBitmapImage(zoomAndPanCanvas);
5203
                BitmapSource source = CutAreaToImage((int)x, (int)y, (int)width, (int)height);
5204
                Save_Capture(source, (int)x, (int)y, (int)width, (int)height);
5205
            }
5206
        }
5207
        #endregion
5208

    
5209
        public Multi_Undo_data Control_Style(CommentUserInfo control)
5210
        {
5211
            multi_Undo_Data = new Multi_Undo_data();
5212

    
5213
            multi_Undo_Data.Markup = control;
5214

    
5215
            if ((control as IShapeControl) != null)
5216
            {
5217
                multi_Undo_Data.paint = (control as IShapeControl).Paint;
5218
            }
5219
            if ((control as IDashControl) != null)
5220
            {
5221
                multi_Undo_Data.DashSize = (control as IDashControl).DashSize;
5222
            }
5223
            if ((control as IPath) != null)
5224
            {
5225
                multi_Undo_Data.LineSize = (control as IPath).LineSize;
5226
            }
5227
            if ((control as UIElement) != null)
5228
            {
5229
                multi_Undo_Data.Opacity = (control as UIElement).Opacity;
5230
            }
5231

    
5232
            return multi_Undo_Data;
5233
        }
5234

    
5235
        private void Comment_Move(object sender, MouseButtonEventArgs e)
5236
        {
5237
            string Select_ID = (((e.Source as Telerik.Windows.Controls.RadButton).DataContext) as IKCOM.MarkupInfoItem).UserID;
5238
            foreach (var items in ViewerDataModel.Instance._markupInfoRevList)
5239
            {
5240
                if (items.UserID == Select_ID)
5241
                {
5242
                    foreach (var item in items.MarkupList)
5243
                    {
5244
                        if (item.PageNumber == pageNavigator.CurrentPage.PageNumber)
5245
                        {
5246
                            MarkupParser.ParseEx(App.ViewInfo.ProjectNO, item.Data, Common.ViewerDataModel.Instance.MarkupControls_USER, "#FFFF0000", "", 
5247
                                items.MarkupInfoID, Commons.shortGuid());
5248
                        }
5249
                    }
5250
                }
5251
            }
5252
        }
5253

    
5254
        /// <summary>
5255
        /// convert inkcontrol to polygoncontrol
5256
        /// </summary>
5257
        public void ConvertInkControlToPolygon()
5258
        {
5259
            if (inkBoard.Strokes.Count > 0)
5260
            {
5261
                inkBoard.Strokes.ToList().ForEach(stroke =>
5262
                {
5263
                    InkToPath ip = new InkToPath();
5264

    
5265
                    List<Point> inkPointSet = new List<Point>();
5266
                    inkPointSet.AddRange(ip.GetPointsFrom(stroke));
5267

    
5268
                    PolygonControl pc = new PolygonControl()
5269
                    {
5270
                        Angle = 0,
5271
                        PointSet = inkPointSet,
5272
                        ControlType = ControlType.Ink
5273
                    };
5274
                    pc.StartPoint = inkPointSet[0];
5275
                    pc.EndPoint = inkPointSet[inkPointSet.Count - 1];
5276
                    pc.LineSize = 3;
5277
                    pc.CommentID = Commons.shortGuid();
5278
                    pc.StrokeColor = new SolidColorBrush(Colors.Red);
5279

    
5280
                    if (pc.PointSet.Count > 0)
5281
                    {
5282
                        CreateCommand.Instance.Execute(pc);
5283
                        ViewerDataModel.Instance.MarkupControls_USER.Add(pc);
5284
                    }
5285
                });
5286
                inkBoard.Strokes.Clear();
5287
            }
5288
        }
5289

    
5290
        /// <summary>
5291
        /// 캔버스에 그릴때 모든 포인트가 캔버스를 벗어 났는지 체크하여 넘겨줌
5292
        /// </summary>
5293
        /// <author>ingu</author>
5294
        /// <date>2018.06.05</date>
5295
        /// <param name="getPoint"></param>
5296
        /// <returns></returns>
5297
        private bool IsGetoutpoint(Point getPoint)
5298
        {
5299
            if (getPoint == new Point())
5300
            {
5301
                ViewerDataModel.Instance.MarkupControls_USER.Remove(currentControl);
5302
                currentControl = null;
5303
                return true;
5304
            }
5305

    
5306
            return false;
5307
        }
5308

    
5309
        private void zoomAndPanControl_DragOver(object sender, DragEventArgs e)
5310
        {
5311
            e.Effects = DragDropEffects.Copy;
5312
        }
5313

    
5314
        private void zoomAndPanControl_DragEnter(object sender, DragEventArgs e)
5315
        {
5316
            e.Effects = DragDropEffects.Copy;
5317
        }
5318

    
5319
        private void zoomAndPanControl_DragLeave(object sender, DragEventArgs e)
5320
        {
5321
            e.Effects = DragDropEffects.None;
5322
        }
5323

    
5324
        private void ZoomAndPanControl_ScaleChanged(object sender, RoutedEventArgs e)
5325
        {
5326
            var pageWidth = ViewerDataModel.Instance.ImageViewWidth;
5327
            var pageHeight = ViewerDataModel.Instance.ImageViewHeight;
5328

    
5329
            ScaleImage(pageWidth, pageHeight);
5330
        }
5331

    
5332
        /// <summary>
5333
        /// 페이지를 scale의 변화에 맞춰서 DecodePixel을 변경한다.
5334
        /// </summary>
5335
        /// <param name="pageWidth">원본 사이즈</param>
5336
        /// <param name="pageHeight">원본 사이즈</param>
5337
        /// <returns></returns>
5338
        private void ScaleImage(double pageWidth,double pageHeight)
5339
        {
5340
            //mainPanel.Scale = zoomAndPanControl.ContentScale;// (zoomAndPanControl.ContentScale >= 0.1) ? 1 : zoomAndPanControl.ContentScale;
5341
        }
5342

    
5343
        private void thumbnailPanel_SizeChanged(object sender, SizeChangedEventArgs e)
5344
        {
5345
            CommonLib.Common.WriteConfigString("SetThumbnail", "WIDTH", thumbnailPanel.Width.ToString());
5346
        }
5347

    
5348

    
5349

    
5350
        /*
5351
        private void zoomAndPanControl_Drop(object sender, DragEventArgs e)
5352
        {
5353
            try
5354
            {
5355
                if (e.Data.GetDataPresent(typeof(string)))
5356
                {
5357
                    this.getCurrentPoint = e.GetPosition(drawingRotateCanvas);
5358
                    string dragData = e.Data.GetData(typeof(string)) as string;
5359
                    Move_Symbol(sender, dragData);
5360
                }
5361
            }
5362
            catch (Exception ex)
5363
            {
5364
                Logger.sendResLog("zoomAndPanControl_Drop", ex.ToString(), 0);
5365
            }            
5366
        }
5367
        */
5368
    }
5369
}
클립보드 이미지 추가 (최대 크기: 500 MB)