프로젝트

일반

사용자정보

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

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

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

1
using IKCOM;
2
using KCOM.Common;
3
using KCOM.Controls;
4
using KCOM.Events;
5
using KCOMDataModel.DataModel;
6
using MarkupToPDF.Common;
7
using MarkupToPDF.Controls.Cad;
8
using MarkupToPDF.Controls.Common;
9
using MarkupToPDF.Controls.Etc;
10
using MarkupToPDF.Controls.Line;
11
using MarkupToPDF.Controls.Parsing;
12
using MarkupToPDF.Controls.Polygon;
13
using MarkupToPDF.Controls.Shape;
14
using MarkupToPDF.Controls.Text;
15
using Svg2Xaml;
16
using System;
17
using System.Collections.Generic;
18
using System.Diagnostics;
19
using System.Linq;
20
using System.Reflection;
21
using System.Runtime.InteropServices;
22
using System.Text;
23
using System.Threading;
24
using System.Threading.Tasks;
25
using System.Web;
26
using System.Windows;
27
using System.Windows.Controls;
28
using System.Windows.Ink;
29
using System.Windows.Input;
30
using System.Windows.Media;
31
using System.Windows.Media.Imaging;
32
using System.Windows.Shapes;
33
using System.Windows.Threading;
34
using Telerik.Windows.Controls;
35
using Telerik.Windows.Data;
36
using static KCOM.TempFile;
37

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

    
47
            T instance = Activator.CreateInstance<T>();
48

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

    
61
    public class MyConsole
62
    {
63
        private readonly System.Threading.ManualResetEvent _readLineSignal;
64
        private string _lastLine;
65

    
66
        public MyConsole()
67
        {
68
            _readLineSignal = new System.Threading.ManualResetEvent(false);
69
            Gui = new TextBox();
70
            Gui.AcceptsReturn = true;
71
            Gui.KeyUp += OnKeyUp;
72
        }
73

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

    
86
        public TextBox Gui { get; private set; }
87

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

    
101
        public void WriteLine(string line)
102
        {
103
            if (!Gui.Dispatcher.CheckAccess())
104
            {
105
                Gui.Dispatcher.Invoke(new Action(() => WriteLine(line)));
106
                return;
107
            }
108

    
109
            Gui.Text += line + Environment.NewLine;
110
        }
111
    }
112

    
113
    /// <summary>
114
    /// MainMenu.xaml에 대한 상호 작용 논리
115
    /// </summary>
116
    public partial class MainMenu : UserControl
117
    {
118
        #region 프로퍼티
119

    
120
        public CommentUserInfo currentControl { get; set; }
121
        public ControlType controlType { get; set; }
122
        private Move move = new Move();
123
        private double[] rotateValue = { 0, 90, 180, 270 };
124
        public MouseHandlingMode mouseHandlingMode = MouseHandlingMode.None;
125
        private static readonly double DragThreshold = 5;
126
        private System.Windows.Input.Cursor cursor { get; set; }
127

    
128
        /// <summary>
129
        ///  문서의 마우스 위치
130
        /// </summary>
131
        public Point CanvasDrawingMouseDownPoint;
132

    
133
        public string filename { get; set; }
134
        private Point canvasZoomPanningMouseDownPoint;
135
        public Point getCurrentPoint;
136
        private Point canvasZoommovingMouseDownPoint;
137
        private List<object> ControlList = new List<object>();
138
        private ListBox listBox = new ListBox();
139
        private Dictionary<Geometry, string> selected_item = new Dictionary<Geometry, string>();
140
        private bool isDraggingSelectionRect = false;
141
        private DrawingAttributes inkDA = new DrawingAttributes();
142
        private VPRevision CurrentRev { get; set; }
143
        public RadRibbonButton btnConsolidate { get; set; }
144
        public RadRibbonButton btnFinalPDF { get; set; }
145
        public RadRibbonButton btnTeamConsolidate { get; set; }
146
        public RadRibbonButton btnConsolidateFinalPDF { get; set; }
147

    
148
        public string Filename_ { get; set; }
149
        public double L_Size = 0;
150
        public AdornerFinal adorner_;
151
        public Multi_Undo_data multi_Undo_Data;
152
        public string Symbol_ID = "";
153

    
154
        /// <summary>
155
        /// Set to 'true' when the left mouse-button is down.
156
        /// </summary>
157
        public bool isLeftMouseButtonDownOnWindow = false;
158

    
159
        public InkPresenter _InkBoard = null;
160
        private Stroke stroke;
161
        private Boolean IsDrawing = false;
162
        private StylusPointCollection strokePoints;
163

    
164
        //StylusPointCollection erasePoints;
165
        private RenderTargetBitmap canvasImage;
166

    
167
        private Point Sync_Offset_Point;
168

    
169
        //강인구 테스트
170
        private Path _SelectionPath { get; set; }
171

    
172
        public Path SelectionPath
173
        {
174
            get
175
            {
176
                return _SelectionPath;
177
            }
178
            set
179
            {
180
                if (_SelectionPath != value)
181
                {
182
                    _SelectionPath = value;
183
                    RaisePropertyChanged("SelectionPath");
184
                }
185
            }
186
        }
187

    
188
        private System.Windows.Controls.Image _imageViewer { get; set; }
189

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

    
213
        public bool IsSyncPDFMode { get; set; }
214

    
215
        private System.Windows.Controls.Image _imageViewer_Compare { get; set; }
216

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

    
240
        #endregion 프로퍼티
241

    
242
        public MainMenu()
243
        {
244
            //App.splashString(ISplashMessage.MAINMENU_0);
245
            InitializeComponent();
246

    
247
            //List<testItem> testItems = new List<testItem>
248
            //{
249
            //    new testItem{Title = "test1"},
250
            //    new testItem{Title = "test2"},
251
            //    new testItem{Title = "test3"},
252
            //    new testItem{Title = "test4"},
253
            //};
254

    
255
            //lstSymbolPrivate.ItemsSource = testItems;
256

    
257
            this.Loaded += MainMenu_Loaded;
258
        }
259

    
260
        public class TempDt
261
        {
262
            public int PageNumber { get; set; }
263
            public string CommentID { get; set; }
264
            public string ConvertData { get; set; }
265
            public int DATA_TYPE { get; set; }
266
            public string MarkupInfoID { get; set; }
267
            public int IsUpdate { get; set; }
268
        }
269

    
270
        private List<TempDt> tempDtList = new List<TempDt>();
271

    
272
        private void SetCursor()
273
        {
274
            this.Cursor = cursor;
275
        }
276

    
277
        /// <summary>
278
        /// get image url
279
        /// </summary>
280
        /// <author>humkyung</author>
281
        /// <param name="sDocumentID"></param>
282
        /// <returns></returns>
283
        public string GetImageURL(string sDocumentID, int iPageNo)
284
        {
285
            string uri = string.Empty;
286

    
287
            string sFolder = sDocumentID.All(char.IsDigit) ? (Convert.ToUInt32(sDocumentID) / 100).ToString() : (sDocumentID.Length >= 5 ? sDocumentID.Substring(0, 5) : sDocumentID);
288
            if (userData.COMPANY != "EXT")
289
            {
290
                uri = String.Format(CommonLib.Common.GetConfigString("mainServerImageWebPath", "URL", "", App.isExternal), _ViewInfo.ProjectNO, sFolder, sDocumentID, iPageNo);
291
            }
292
            else
293
            {
294
                uri = String.Format(CommonLib.Common.GetConfigString("subServerImageWebPath", "URL", "", App.isExternal), _ViewInfo.ProjectNO, sDocumentID, iPageNo);
295
            }
296

    
297
            return uri;
298
        }
299

    
300
        /// <summary>
301
        /// 외부망에서의 Original PDF Download 를 위한 리소스 web path 경로로 치환
302
        /// </summary>
303
        /// <returns></returns>
304
        public string GetOriginalPDFURL()
305
        {
306
            string uri = string.Empty;
307
            string sDocumentID = this._DocItem.DOCUMENT_ID;
308
            string filename = string.Empty;
309
            if (this._DocInfo.ORIGINAL_FILE.Contains("fileName"))
310
            {
311
                filename = HttpUtility.ParseQueryString(this._DocInfo.ORIGINAL_FILE).Get("fileName");
312
            }
313
            else
314
            {
315
                filename = System.IO.Path.GetFileName(this._DocInfo.ORIGINAL_FILE);
316
            }
317

    
318
            string sFolder = sDocumentID.All(char.IsDigit) ? (Convert.ToUInt32(sDocumentID) / 100).ToString() : (sDocumentID.Length >= 5 ? sDocumentID.Substring(0, 5) : sDocumentID);
319
            if (userData.COMPANY != "EXT")
320
            {
321
                uri = String.Format(CommonLib.Common.GetConfigString("mainServerImageWebPath", "URL", "", App.isExternal), _ViewInfo.ProjectNO, sFolder, sDocumentID, filename);
322
            }
323
            else
324
            {
325
                uri = String.Format(CommonLib.Common.GetConfigString("subServerImageWebPath", "URL", "", App.isExternal), _ViewInfo.ProjectNO, sDocumentID, filename);
326
            }
327
            uri = uri.Replace(".png", "");
328
            return uri;
329
        }
330

    
331
        private bool IsDrawingEnable(Point _canvasZoomPanningMouseDownPoint)
332
        {
333
            if ((_canvasZoomPanningMouseDownPoint.X > 0 &&
334
                zoomAndPanCanvas.ActualWidth > _canvasZoomPanningMouseDownPoint.X) &&
335
                (_canvasZoomPanningMouseDownPoint.Y > 0 &&
336
                zoomAndPanCanvas.ActualHeight > _canvasZoomPanningMouseDownPoint.Y))
337
            {
338
                return true;
339
            }
340

    
341
            return false;
342
        }
343

    
344
        private bool IsRotationDrawingEnable(Point _canvasZoomPanningMouseDownPoint)
345
        {
346
            if (rotate.Angle == 90 || rotate.Angle == 270)
347
            {
348
                if ((_canvasZoomPanningMouseDownPoint.X > 0 &&
349
                zoomAndPanCanvas.ActualHeight > _canvasZoomPanningMouseDownPoint.X) &&
350
                (_canvasZoomPanningMouseDownPoint.Y > 0 &&
351
                zoomAndPanCanvas.ActualWidth > _canvasZoomPanningMouseDownPoint.Y))
352
                {
353
                    return true;
354
                }
355
            }
356
            else
357
            {
358
                if ((_canvasZoomPanningMouseDownPoint.X > 0 &&
359
                zoomAndPanCanvas.ActualWidth > _canvasZoomPanningMouseDownPoint.X) &&
360
                (_canvasZoomPanningMouseDownPoint.Y > 0 &&
361
                zoomAndPanCanvas.ActualHeight > _canvasZoomPanningMouseDownPoint.Y))
362
                {
363
                    return true;
364
                }
365
            }
366

    
367
            return false;
368
        }
369

    
370
        public void DeleteItem(MarkupInfoItem item)
371
        {
372
            if (PreviewUserMarkupInfoItem != null && item.Consolidate == 1 && item.AvoidConsolidate == 0)
373
            {
374
                App.Custom_ViewInfoId = PreviewUserMarkupInfoItem.MarkupInfoID;
375
            }
376

    
377
            ViewerDataModel.Instance._markupInfoList.Remove(item);
378

    
379
            ViewerDataModel.Instance.MarkupControls.Where(data => data.MarkupInfoID == item.MarkupInfoID).ToList().ForEach(a =>
380
            {
381
                ViewerDataModel.Instance.MarkupControls.Remove(a);
382
            });
383

    
384
            ViewerDataModel.Instance.MarkupControls_USER.Where(data => data.MarkupInfoID == item.MarkupInfoID).ToList().ForEach(a =>
385
            {
386
                ViewerDataModel.Instance.MarkupControls_USER.Remove(a);
387
                ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.MarkupListUpdate(
388
                null, Event_Type.Delete, a.CommentID, null);
389
            });
390

    
391
            ViewerDataModel.Instance.MyMarkupList.Where(data => data.MarkupInfoID == item.MarkupInfoID).ToList().ForEach(a =>
392
            {
393
                ViewerDataModel.Instance.MyMarkupList.Remove(a);
394
                //임시파일에서도 삭제
395
                TempFile.DelTemp(a.ID, this.ParentOfType<MainWindow>().dzMainMenu.pageNavigator.CurrentPage.PageNumber.ToString());
396
            });
397

    
398
            gridViewMarkup.ItemsSource = ViewerDataModel.Instance._markupInfoList;
399

    
400
            if (PreviewUserMarkupInfoItem == null && gridViewMarkup.SelectedItems.Where(d => (d as MarkupInfoItem).UserID == App.ViewInfo.UserID).FirstOrDefault() == null)
401
            {
402
                if (gridViewMarkup.Items.Cast<MarkupInfoItem>().ToList().Where(d => d.UserID == App.ViewInfo.UserID).Count() == 0)
403
                {
404
                    var infoId = Commons.shortGuid();
405
                    PreviewUserMarkupInfoItem = new MarkupInfoItem
406
                    {
407
                        CreateTime = DateTime.Now,
408
                        Depatment = userData.DEPARTMENT,
409
                        UpdateTime = DateTime.Now,
410
                        DisplayColor = "#FFFF0000",
411
                        UserID = userData.ID,
412
                        UserName = userData.NAME,
413
                        PageCount = 1,
414
                        Description = "",
415
                        MarkupInfoID = infoId,
416
                        MarkupList = null,
417
                        MarkupVersionID = Commons.shortGuid(),
418
                        Consolidate = 0,
419
                        PartConsolidate = 0,
420
                        userDelete = true,
421
                        AvoidConsolidate = 0,
422
                        IsPreviewUser = true
423
                    };
424
                    App.Custom_ViewInfoId = infoId;
425
                }
426
            }
427
            //Logger.sendReqLog("DeleteMarkupAsync", App.ViewInfo.ProjectNO + "," + item.MarkupInfoID, 1);
428
            BaseClient.DeleteMarkupAsync(App.ViewInfo.ProjectNO, item.MarkupInfoID);
429
        }
430

    
431
        /// <summary>
432
        /// delete selected comments
433
        /// </summary>
434
        /// <param name="sender"></param>
435
        /// <param name="e"></param>
436
        public void DeleteCommentEvent(object sender, RoutedEventArgs e)
437
        {
438
            //정말 삭제 하시겠습니까?
439
            DialogParameters parameters = new DialogParameters()
440
            {
441
                Owner = Application.Current.MainWindow,
442
                Content = new TextBlock()
443
                {
444
                    MinWidth = 400,
445
                    FontSize = 11,
446
                    Text = "Are you sure you want to delete?",
447
                    TextWrapping = System.Windows.TextWrapping.Wrap
448
                },
449
                Header = "Confirm",
450
                Theme = new VisualStudio2013Theme(),
451
                ModalBackground = new SolidColorBrush { Color = Colors.Black, Opacity = 0.6 },
452
                OkButtonContent = "Yes",
453
                CancelButtonContent = "No",
454
                Closed = delegate (object windowSender, WindowClosedEventArgs wc)
455
                {
456
                    if (wc.DialogResult == true)
457
                    {
458
                        //선택된 어도너가 있을시 삭제가 되지 않음
459
                        SelectionSet.Instance.UnSelect(this);
460

    
461
                        Button content = (sender as Button);
462
                        MarkupInfoItem item = content.CommandParameter as MarkupInfoItem;
463

    
464
                        DeleteItem(item);
465
                    }
466
                }
467
            };
468
            RadWindow.Confirm(parameters);
469
        }
470

    
471
        private System.Windows.Media.Animation.DoubleAnimation da = new System.Windows.Media.Animation.DoubleAnimation();
472

    
473
        private static Timer timer;
474
        private int InitInterval = KCOM.Properties.Settings.Default.InitInterval;
475

    
476
        private void MainMenu_Loaded(object sender, RoutedEventArgs e)
477
        {
478
            //InitializeComponent();
479
            //System.Diagnostics.Debug.WriteLine("MainMenu() : " + sw.ElapsedMilliseconds.ToString() + "ms");
480

    
481
            if (App.ParameterMode)
482
            {
483

    
484
                App.splashString(ISplashMessage.MAINMENU_1);
485
                this.pageNavigator.ThumbInitialized += pageNavigator_ThumbInitialized;
486
                this.pageNavigator.PageChanging += pageNavigator_PageChanging;
487
                this.pageNavigator.PageChanged += PageNavigator_PageChanged;
488

    
489
                imageViewer_Compare = new Image();
490
                ViewerDataModel.Instance.Capture_Opacity = 0;
491
                da.From = 0.8;
492
                da.To = 0;
493
                da.Duration = new Duration(TimeSpan.FromSeconds(1));
494
                da.AutoReverse = true;
495
                da.RepeatBehavior = System.Windows.Media.Animation.RepeatBehavior.Forever;
496

    
497
                if (!App.ViewInfo.CreateFinalPDFPermission && !App.ViewInfo.NewCommentPermission)
498
                {
499
                    this.SymbolPane.Visibility = Visibility.Collapsed;
500
                    this.FavoritePane.Visibility = Visibility.Collapsed;
501
                    this.drawingRotateCanvas.IsHitTestVisible = false;
502
                }
503
                thumbnailPanel.Width = Convert.ToInt32(CommonLib.Common.GetConfigString("SetThumbnail", "WIDTH", "250"));
504
            }
505

    
506
            //timer = new Timer(timercallback, null, 0, InitInterval * 60000);
507
        }
508

    
509
        private void DownloadOriginalFile()
510
        {
511
            #region 임시파일 다운로드
512
            instnaceFile = System.IO.Path.Combine(System.IO.Path.GetTempPath(), "MARKUS", System.IO.Path.GetRandomFileName().Split('.')[0] + ".pdf");
513
            downloadurl = GetOriginalPDFURL();
514

    
515
            ViewerDataModel.Instance.OriginalTempFile = instnaceFile;
516
            
517
            string endpoint = Common.Commons.shortGuid() + "file";
518
            IIpc.WcfServer wcfServer = new IIpc.WcfServer(endpoint);
519
            wcfServer.IpcFileDownloadReceived += WcfServer_IpcFileDownloadReceived;
520
            wcfServer.Start();
521
            
522
            DownloadProcess.FileDownloader(endpoint, ViewerDataModel.Instance.IsAdmin, downloadurl, instnaceFile);
523
            #endregion
524
        }
525

    
526
        string instnaceFile;
527
        string downloadurl;
528

    
529
        private void WcfServer_IpcFileDownloadReceived(object sender, IIpc.IpcDownloadStatusArgs e)
530
        {
531
            Dispatcher.BeginInvoke((Action)delegate () { ViewerDataModel.Instance.DownloadFileProgress = (int)e.Progress; });
532

    
533
            if (e.IsFinish)
534
            {
535
                ViewerDataModel.Instance.SystemMain.dzMainMenu.searchPanel_Instance.SetSerachPDFFile(instnaceFile);
536
                ViewerDataModel.Instance.IsDownloadOriginal = true;
537
           
538
            }
539
        }
540

    
541
        private void timercallback(Object o)
542
        {
543
            Stopwatch sw = new Stopwatch();
544
            sw.Start();
545
            TempFile.TempFileAdd();
546
            sw.Stop();
547

    
548
            Dispatcher.InvokeAsync(new Action(delegate
549
            {
550
                if (this.ParentOfType<MainWindow>().dzTopMenu.cbAutoSave.IsChecked == true) //Auto Save Checked?
551
                {
552
                    timer.Change(((int)this.ParentOfType<MainWindow>().dzTopMenu.cbSaveInterval.Value * 60000) / 2, sw.ElapsedMilliseconds); //Timer Setting
553
                }
554
            }));
555

    
556
            ////GC.Collect();
557
        }
558

    
559
        /// <summary>
560
        /// update my markuplist
561
        ///  - update existing markup data if already exist
562
        ///  - add new markup data if control is new
563
        /// </summary>
564
        public void UpdateMyMarkupList()
565
        {
566
            Logger.sendCheckLog("pageNavigator_PageChanging_ChangeCommentReact", 1);
567

    
568
            /// add or update markup list
569
            foreach (var control in ViewerDataModel.Instance.MarkupControls_USER)
570
            {
571
                var root = MarkupParser.MarkupToString(control, App.ViewInfo.UserID);
572

    
573
                var exist = ViewerDataModel.Instance.MyMarkupList.Where(data => data.ID == root.CommentID).FirstOrDefault();
574
                if (exist != null) //신규 추가 된 코멘트
575
                {
576
                    if (exist.Data != root.ConvertData) //코멘트가 같은지
577
                    {
578
                        exist.Data = root.ConvertData;
579
                        exist.IsUpdate = true;
580
                    }
581
                }
582
                else if (root.CommentID != null)
583
                {
584
                    ViewerDataModel.Instance.MyMarkupList.Add(new MarkupItemEx
585
                    {
586
                        ID = control.CommentID,
587
                        Data = root.ConvertData,
588
                        Data_Type = root.DATA_TYPE,
589
                        MarkupInfoID = App.Custom_ViewInfoId,
590
                        PageNumber = this.pageNavigator.CurrentPage.PageNumber,
591
                        Symbol_ID = control.SymbolID,
592
                        //Group_ID = control.GroupID,
593
                    });
594
                }
595
            }
596

    
597
            //if (this.pageNavigator.CurrentPage != null)
598
            //{
599
            //    /// delete markup list
600
            //    int iPageNo = this.pageNavigator.CurrentPage.PageNumber;
601

    
602
            //    var deleted = (from markup in ViewerDataModel.Instance.MyMarkupList
603
            //                   where (markup.PageNumber == iPageNo)
604
            //                   && (null == ViewerDataModel.Instance.MarkupControls_USER.Where(control => control.CommentID == markup.ID).FirstOrDefault())
605
            //                   select markup).ToList();
606

    
607
            //    foreach (var markup in deleted)
608
            //    {
609
            //        ViewerDataModel.Instance.MyMarkupList.Remove(markup);
610
            //    }
611
            //}
612
            //else
613
            //{
614
            //    System.Diagnostics.Debug.WriteLine("UpdateMyMarkupList : this.pageNavigator.CurrentPage null ");
615
            //}
616

    
617
            /// up to here
618

    
619
            //if (modified)
620
            //{
621
            //    if (ViewerDataModel.Instance._markupInfoList.Where(info => info.UserID == PreviewUserMarkupInfoItem.UserID).FirstOrDefault() == null)
622
            //    {
623
            //        ComingNewBieEnd = true;
624
            //        ViewerDataModel.Instance._markupInfoList.Insert(0, PreviewUserMarkupInfoItem);
625
            //        PreviewUserMarkupInfoItem.IsPreviewUser = false;
626
            //        gridViewMarkup.ItemsSource = null;
627
            //        gridViewMarkup.ItemsSource = ViewerDataModel.Instance._markupInfoList;
628
            //        gridViewMarkup.SelectedItem = PreviewUserMarkupInfoItem;
629

    
630
            //        GroupDescriptor descriptor = new GroupDescriptor();
631
            //        descriptor.Member = "Depatment";
632
            //        descriptor.DisplayContent = "DEPT";
633
            //        descriptor.SortDirection = ListSortDirection.Ascending;
634
            //        gridViewMarkup.GroupDescriptors.Add(descriptor);
635
            //    }
636
            //}
637
        }
638

    
639
        /// <summary>
640
        /// start page changing
641
        ///  - save controls if page is modified
642
        ///  - starting download page image
643
        /// </summary>
644
        /// <param name="sender"></param>
645
        /// <param name="e"></param>
646
        private async void pageNavigator_PageChanging(object sender, Controls.Sample.PageChangeEventArgs e)
647
        {
648
            //await Task.Delay(10);
649

    
650
            // 마크업 로드
651
            //await this.Dispatcher.InvokeAsync(()=>MarkupLoad(e.PageNumber));
652

    
653
            ViewerDataModel.Instance.PageAngle = e.CurrentPage.PAGE_ANGLE;
654

    
655
            var token = ViewerDataModel.Instance.NewCancellationToken();
656
            
657
            await MarkupLoadAsync(e.PageNumber, ViewerDataModel.Instance.PageAngle, token);
658

    
659
            // 페이지 이미지 변경
660
            await PageChangingAsync(e.CurrentPage, e.PageNumber, token);
661
        }
662

    
663
        private async Task PageChangingAsync(DOCPAGE currentPage, int changePageNumber,CancellationToken token)
664
        {
665
            var BalancePoint = ViewerDataModel.Instance.PageBalanceMode == true ? changePageNumber + ViewerDataModel.Instance.PageBalanceNumber : changePageNumber;
666

    
667
            #region 페이지가 벗어난 경우
668

    
669
            if (BalancePoint < 1)
670
            {
671
                BalancePoint = 1;
672
                ViewerDataModel.Instance.PageBalanceNumber = 0;
673
            }
674

    
675
            if (pageNavigator.PageCount < BalancePoint)
676
            {
677
                BalancePoint = pageNavigator.PageCount;
678
                ViewerDataModel.Instance.PageBalanceNumber = 0;
679
            }
680

    
681
            #endregion 페이지가 벗어난 경우
682

    
683
            ViewerDataModel.Instance.SyncPageNumber = BalancePoint;
684

    
685
            var pageWidth = Convert.ToDouble(currentPage.PAGE_WIDTH);
686
            var pageHeight = Convert.ToDouble(currentPage.PAGE_HEIGHT);
687
            var contentScale = zoomAndPanControl.ContentScale;
688

    
689
            #region 페이지 이미지 로딩 수정
690

    
691
            ViewerDataModel.Instance.ImageViewPath = await App.PageStorage.GetPageImageAsync(token,changePageNumber);
692

    
693
            ScaleImage(pageWidth, pageHeight);
694

    
695
            ViewerDataModel.Instance.ImageViewWidth = pageWidth;
696
            ViewerDataModel.Instance.ImageViewHeight = pageHeight;
697

    
698
            zoomAndPanCanvas.Width = pageWidth;
699
            zoomAndPanCanvas.Height = pageHeight;
700

    
701
            Common.ViewerDataModel.Instance.ContentWidth = pageWidth;
702
            Common.ViewerDataModel.Instance.ContentHeight = pageHeight;
703

    
704
            inkBoard.Width = pageWidth;
705
            inkBoard.Height = pageHeight;
706

    
707
            #endregion 페이지 이미지 로딩 수정
708

    
709
            if (!testPanel2.IsHidden)
710
            {
711
                Logger.sendCheckLog("pageNavigator_PageChanging_!testPanel2.IsHidden 일 때", 1);
712
                //PDF모드일때 잠시 대기(강인구)
713
                if (IsSyncPDFMode)
714
                {
715
                    Get_FinalImage.Get_PdfImage get_PdfImage = new Get_FinalImage.Get_PdfImage();
716
                    var pdfpath = new BitmapImage(new Uri(get_PdfImage.Run(CurrentRev.TO_VENDOR, App.ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, ViewerDataModel.Instance.SyncPageNumber)));
717

    
718
                    Logger.sendCheckLog("pageNavigator_PageChanging_pdfpath Image Downloading", 1);
719
                    if (pdfpath.IsDownloading)
720
                    {
721
                        pdfpath.DownloadCompleted += (ex, arg) =>
722
                        {
723
                            Logger.sendCheckLog("pageNavigator_PageChanging_pdfpath Image DownloadCompleted", 1);
724
                            ViewerDataModel.Instance.ImageViewPath_C = pdfpath;
725
                            ViewerDataModel.Instance.ImageViewWidth_C = pdfpath.PixelWidth;
726
                            ViewerDataModel.Instance.ImageViewHeight_C = pdfpath.PixelHeight;
727
                            zoomAndPanCanvas2.Width = pdfpath.PixelWidth;
728
                            zoomAndPanCanvas2.Height = pdfpath.PixelHeight;
729
                        };
730
                    }
731
                    else
732
                    {
733
                        Logger.sendCheckLog("pageNavigator_PageChanging_pdfpath Image Page Setting", 1);
734
                        ViewerDataModel.Instance.ImageViewPath_C = pdfpath;
735
                        ViewerDataModel.Instance.ImageViewWidth_C = pdfpath.PixelWidth;
736
                        ViewerDataModel.Instance.ImageViewHeight_C = pdfpath.PixelHeight;
737

    
738
                        zoomAndPanCanvas2.Width = pdfpath.PixelWidth;
739
                        zoomAndPanCanvas2.Height = pdfpath.PixelHeight;
740
                    }
741
                }
742
                else
743
                {
744
                    Logger.sendCheckLog("Compare Image Download", 1);
745
                    string compareImageUri = this.GetImageURL(CurrentRev.DOCUMENT_ID, BalancePoint);
746
                    ComparePageLoad(compareImageUri,false);
747
                }
748

    
749
                tlSyncPageNum.Text = String.Format("Current Page : {0}", BalancePoint);
750
            }
751

    
752
            SearchFocusBorder.Visibility = Visibility.Collapsed;
753

    
754
            this.pageNavigator.ChangePage(changePageNumber);
755
        }
756

    
757
        private void ComparePageLoad(string pageUri, bool IsOriginalSize)
758
        {
759
            /// 현재 보고 있는 VP와 같은 크기로 로딩
760
            ViewerDataModel.Instance.ImageViewPath_C = null;
761

    
762
            if (IsOriginalSize && OriginalSizeMode.IsChecked)
763
            {
764
                ViewerDataModel.Instance.ImageViewPath_C = ImageSourceHelper.GetDownloadImage(pageUri);
765
            }
766
            else
767
            {
768
                var imageSize = new Size(ViewerDataModel.Instance.ImageViewWidth, ViewerDataModel.Instance.ImageViewHeight);
769
                ViewerDataModel.Instance.ImageViewPath_C = ImageSourceHelper.GetDownloadImage(pageUri, imageSize);
770
            }
771

    
772
            if (ViewerDataModel.Instance.ImageViewPath_C != null)
773
            {
774
                ViewerDataModel.Instance.ImageViewWidth_C = ViewerDataModel.Instance.ImageViewPath_C.PixelWidth;
775
                ViewerDataModel.Instance.ImageViewHeight_C = ViewerDataModel.Instance.ImageViewPath_C.PixelHeight;
776
                zoomAndPanCanvas2.Width = ViewerDataModel.Instance.ImageViewPath_C.PixelWidth;
777
                zoomAndPanCanvas2.Height = ViewerDataModel.Instance.ImageViewPath_C.PixelHeight;
778

    
779
                zoomAndPanControl.ZoomTo(new Rect
780
                {
781
                    X = 0,
782
                    Y = 0,
783
                    Width = Math.Max(zoomAndPanCanvas.Width, zoomAndPanCanvas2.Width),
784
                    Height = Math.Max(zoomAndPanCanvas.Height, zoomAndPanCanvas2.Height),
785
                });
786

    
787
                if (Sync.IsChecked)
788
                {
789
                    Sync_Click(null, new RoutedEventArgs());
790
                }
791

    
792
                if (CompareMode.IsChecked)
793
                {
794
                    SyncCompare_Click(null, new RoutedEventArgs());
795
                }
796
            }
797
        }
798

    
799
        /// <summary>
800
        /// called after page is changed
801
        /// </summary>
802
        /// <param name="sender"></param>
803
        /// <param name="e"></param>
804
        private async void PageNavigator_PageChanged(object sender, Sample.PageChangeEventArgs e)
805
        {
806
            //if (zoomAndPanCanvas.Width.IsNaN())
807
            //{
808
            //await zoomAndPanControl.Dispatcher.InvokeAsync(() =>
809
            //    zoomAndPanControl.ZoomTo(new Rect { X = 0, Y = 0, Width = zoomAndPanCanvas.Width, Height = zoomAndPanCanvas.Height })
810
            //    );
811
            //}
812

    
813
            var instanceMain = ViewerDataModel.Instance.SystemMain;
814

    
815
            instanceMain.dzMainMenu.CanvasDrawingMouseDownPoint = new Point(ViewerDataModel.Instance.ImageViewWidth / 2, ViewerDataModel.Instance.ImageViewHeight / 2);
816

    
817
            instanceMain.dzTopMenu.tlcurrentPage.Text = e.CurrentPage.PAGE_NUMBER.ToString();
818
            instanceMain.dzTopMenu.tlcurrentPage_readonly.Text = e.CurrentPage.PAGE_NUMBER.ToString();
819

    
820
            instanceMain.dzTopMenu.rotateOffSet = 0;
821
            var pageinfo = this.CurrentDoc.docInfo.DOCPAGE.Where(p => p.PAGE_NUMBER == e.CurrentPage.PAGE_NUMBER).FirstOrDefault();
822
            drawingPannelRotate(pageinfo.PAGE_ANGLE);
823

    
824
            /// 페이지의 모든 마크업을 로드한 후 호출
825
            /// 좌측 마크업 list의 아이템을 클릭하는 경우 MarkupControls_USER가 0으로 나와서 추가함.
826
            ViewerDataModel.Instance.LoadPageMarkupFinish(new Rect { X = 0, Y = 0, Width = zoomAndPanCanvas.Width, Height = zoomAndPanCanvas.Height });
827

    
828
            //Point startPoint = new Point(15, 15);
829

    
830
            //var markupinfo = ViewerDataModel.Instance._markupInfoList.Where(x => x.UserID == App.ViewInfo.UserID).First();
831

    
832
            ////var rect = GetRectControl(Convert.ToDouble(pageinfo.PAGE_WIDTH), Convert.ToDouble(pageinfo.PAGE_HEIGHT), markupinfo.UserID, markupinfo.MarkupInfoID, startPoint);
833

    
834
            ////var txtApproved = GetTextControl(Convert.ToDouble(pageinfo.PAGE_WIDTH), Convert.ToDouble(pageinfo.PAGE_HEIGHT), markupinfo.UserID, markupinfo.MarkupInfoID,
835
            ////                             "APPROVED",30, FontWeights.Bold, TextAlignment.Center, rect.ItemRect, 15);
836

    
837
            ////var txtCreator = GetTextControl(Convert.ToDouble(pageinfo.PAGE_WIDTH), Convert.ToDouble(pageinfo.PAGE_HEIGHT), markupinfo.UserID, markupinfo.MarkupInfoID
838
            ////                , "By HYOSUNG", 18, FontWeights.Bold, TextAlignment.Center, rect.ItemRect, txtApproved.StartPoint.Y + txtApproved.BoxHeight + 3);
839

    
840
            //var symCtrl = GetSymNControl(Convert.ToDouble(pageinfo.PAGE_WIDTH), Convert.ToDouble(pageinfo.PAGE_HEIGHT), markupinfo.UserID, markupinfo.MarkupInfoID, startPoint);
841

    
842
            //var bottom = Rect.Offset(symCtrl.ItemRect, new Vector(0, symCtrl.ItemRect.Height));
843

    
844
            //var txtOriginator = GetTextControl(Convert.ToDouble(pageinfo.PAGE_WIDTH), Convert.ToDouble(pageinfo.PAGE_HEIGHT), markupinfo.UserID, markupinfo.MarkupInfoID
845
            //               , App.ViewInfo.UserID, 18, FontWeights.Bold, TextAlignment.Left, bottom, bottom.Top + 3);
846

    
847
            //var dtfi = new System.Globalization.DateTimeFormatInfo { DateSeparator = "-", ShortDatePattern = @"yyyy/MM/dd" };
848

    
849
            //var txtDate = GetTextControl(Convert.ToDouble(pageinfo.PAGE_WIDTH), Convert.ToDouble(pageinfo.PAGE_HEIGHT), markupinfo.UserID, markupinfo.MarkupInfoID
850
            //               , DateTime.Now.ToString("d", dtfi), 18, FontWeights.Bold, TextAlignment.Left, bottom, txtOriginator.StartPoint.Y + txtOriginator.BoxHeight + 2);
851

    
852
            //ViewerDataModel.Instance.MarkupControls_USER.Add(symCtrl);
853
            ////ViewerDataModel.Instance.MarkupControls_USER.Add(txtApproved);
854
            ////ViewerDataModel.Instance.MarkupControls_USER.Add(txtCreator);
855
            //ViewerDataModel.Instance.MarkupControls_USER.Add(txtOriginator);
856
            //ViewerDataModel.Instance.MarkupControls_USER.Add(txtDate);
857

    
858
            //symCtrl.ApplyTemplate();
859
            ////txtApproved.ApplyTemplate();
860
            ////txtCreator.ApplyTemplate();
861
            //txtOriginator.ApplyTemplate();
862
            //txtDate.ApplyTemplate();
863

    
864
            ////SetTextControl(txtApproved);
865
            ////SetTextControl(txtCreator);
866
            //SetTextControl(txtOriginator);
867
            //SetTextControl(txtDate);
868

    
869
            //multi_Undo_Data = new Multi_Undo_data();
870

    
871
            //MarkupToPDF.Common.Undo_data UndoData = new Undo_data()
872
            //{
873
            //    IsUndo = false,
874
            //    Event = Event_Type.Create,
875
            //    EventTime = DateTime.Now,
876
            //    Markup_List = new List<Multi_Undo_data>()
877
            //};
878

    
879
            //multi_Undo_Data = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.Control_Style(symCtrl as MarkupToPDF.Common.CommentUserInfo);
880
            //UndoData.Markup_List.Add(multi_Undo_Data);
881

    
882
            ////multi_Undo_Data = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.Control_Style(txtApproved as MarkupToPDF.Common.CommentUserInfo);
883
            ////UndoData.Markup_List.Add(multi_Undo_Data);
884

    
885
            ////multi_Undo_Data = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.Control_Style(txtCreator as MarkupToPDF.Common.CommentUserInfo);
886
            ////UndoData.Markup_List.Add(multi_Undo_Data);
887

    
888
            //multi_Undo_Data = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.Control_Style(txtOriginator as MarkupToPDF.Common.CommentUserInfo);
889
            //UndoData.Markup_List.Add(multi_Undo_Data);
890

    
891
            //multi_Undo_Data = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.Control_Style(txtDate as MarkupToPDF.Common.CommentUserInfo);
892
            //UndoData.Markup_List.Add(multi_Undo_Data);
893

    
894
            //ViewerDataModel.Instance.UndoDataList.Add(UndoData);
895

    
896
            //System.Diagnostics.Debug.WriteLine(symCtrl.GetMarkupData(App.ViewInfo.UserID, 1, markupinfo.MarkupVersionID).DATA);
897
            ////System.Diagnostics.Debug.WriteLine(txtApproved.GetMarkupData(App.ViewInfo.UserID, 1, markupinfo.MarkupVersionID).DATA);
898
            ////System.Diagnostics.Debug.WriteLine(txtCreator.GetMarkupData(App.ViewInfo.UserID, 1, markupinfo.MarkupVersionID).DATA);
899
            //System.Diagnostics.Debug.WriteLine(txtOriginator.GetMarkupData(App.ViewInfo.UserID, 1, markupinfo.MarkupVersionID).DATA);
900
            //System.Diagnostics.Debug.WriteLine(txtDate.GetMarkupData(App.ViewInfo.UserID, 1, markupinfo.MarkupVersionID).DATA);
901
        }
902

    
903
        private void SetTextControl(TextControl textControl)
904
        {
905
            textControl.Base_TextBlock.Margin = new Thickness(0, 0, 10, 0);
906
            textControl.Base_TextBox.Visibility = Visibility.Collapsed;
907
            textControl.Base_TextBlock.Visibility = Visibility.Visible;
908
        }
909

    
910
        private SymControlN GetSymNControl(double PageWidth, double PageHeight, string userId, string markupInfoId, Point startPosition)
911
        {
912
            SymControlN result = null;
913

    
914
            try
915
            {
916
                double height = 80;
917
                double itemWidth = 180;
918

    
919
                System.Windows.Point startPoint = new System.Windows.Point(startPosition.X, startPosition.Y);
920
                System.Windows.Point endPoint = new System.Windows.Point(startPosition.X + itemWidth, startPosition.Y + height);
921
                System.Windows.Point leftBottomPoint = new System.Windows.Point(startPosition.X, startPosition.Y + height);
922
                System.Windows.Point topRightPoint = new System.Windows.Point(startPosition.X + itemWidth, startPosition.Y);
923

    
924
                result = new SymControlN
925
                {
926
                    CommentID = Commons.shortGuid(),
927
                    MarkupInfoID = markupInfoId,
928
                    UserID = userId,
929
                    PointSet = new List<Point> { startPoint, leftBottomPoint, endPoint, topRightPoint },
930
                    StartPoint = startPoint,
931
                    EndPoint = endPoint,
932
                    CommentAngle = 0,
933
                    LeftBottomPoint = leftBottomPoint,
934
                    TopRightPoint = topRightPoint,
935
                    Opacity = 1,
936
                    PathXathData = "eJy1Ul1PwjAU/SvN9c3EdY5g1FAShyIxRgygxsemu7AbupZ0Vae/3g42/Azxxfuw9Z7Tnpx72t6lo4zdyAIFyHUBqwptSgG596tTzkuVYyHLqCDlbGnnPlK24C9k5hVP4viIV7LQfOWwROOlJ2ug36tVo1Sq5cLZJ5P1e1OrKRtYbV3qnsqcrZcC9oZNARuvpCL/KiCODoHxfo//EJmg8tIsNLKpd+hVLmBIWkPd2iU2cnGoFprlpJYGyzBOt8WuyeCVJSNgUstCM/1WHNgDZT5oJ3E4M0Ja5F7A8QmwgTTPIYlrnAfgIIm6W2hmVy3CN9M3GUzsyznOyVAdTBlG+NxvxffXx37nOlF3Fx3vppNd5P6nnL8bnWHlU23VktUrAWe3t5Px/cU5sKE1/qFRuKi8k6nV2Qae0ltIshPXncPNtX25lZF19BY2Sn2maWGK8GQEDMIXHbB7dJ7Ur1RrUcDmbXx3l76y0eN4endz+Qd/yX/663xk2v7eAQ==",
937
                    Memo = null
938
                };
939
            }
940
            catch (Exception ex)
941
            {
942
                System.Diagnostics.Debug.WriteLine(ex.ToString());
943
            }
944

    
945
            return result;
946
        }
947

    
948
        private RectangleControl GetRectControl(double PageWidth, double PageHeight, string userId, string markupInfoId, Point startPosition)
949
        {
950
            RectangleControl result = null;
951

    
952
            try
953
            {
954
                double height = 80;
955
                double itemWidth = 180;
956

    
957
                System.Windows.Point startPoint = new System.Windows.Point(startPosition.X, startPosition.Y);
958
                System.Windows.Point endPoint = new System.Windows.Point(startPosition.X + itemWidth, startPosition.Y + height);
959
                System.Windows.Point leftBottomPoint = new System.Windows.Point(startPosition.X, startPosition.Y + height);
960
                System.Windows.Point topRightPoint = new System.Windows.Point(startPosition.X + itemWidth, startPosition.Y);
961

    
962
                result = new RectangleControl
963
                {
964
                    CommentID = Commons.shortGuid(),
965
                    MarkupInfoID = markupInfoId,
966
                    LineSize = 5,
967
                    Paint = MarkupToPDF.Controls.Common.PaintSet.None,
968
                    StartPoint = startPoint,
969
                    EndPoint = endPoint,
970
                    CommentAngle = 0,
971
                    StrokeColor = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromArgb(255, 255, 0x0, 0x0)),
972
                    //StrokeColor = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromArgb(255, 64, 224, 208)),
973
                    FillColor = null,
974
                    DashSize = new System.Windows.Media.DoubleCollection(new[] { 999999.0 }),
975
                    Opacity = 1,
976
                    LeftBottomPoint = leftBottomPoint,
977
                    TopRightPoint = topRightPoint,
978
                    PointSet = new List<Point> { startPoint, leftBottomPoint, endPoint, topRightPoint },
979
                    UserID = userId,
980
                    Memo = null
981
                };
982
            }
983
            catch (Exception ex)
984
            {
985
                System.Diagnostics.Debug.WriteLine(ex.ToString());
986
            }
987

    
988
            return result;
989
        }
990

    
991
        private TextControl GetTextControl(double PageWidth, double PageHeight, string userId, string markupInfoId, string Text, double fontSize, FontWeight fontWeight, TextAlignment textAlignment, Rect parentRect, double positionY)
992
        {
993
            TextControl result = null;
994

    
995
            try
996
            {
997
                var txtSize = ShapeMeasure(new TextBlock { Text = Text, FontSize = fontSize, FontWeight = fontWeight, FontFamily = new FontFamily("Tahoma") });
998

    
999
                double startPositionX = parentRect.X;
1000

    
1001
                switch (textAlignment)
1002
                {
1003
                    case TextAlignment.Right:
1004
                        startPositionX = parentRect.X + parentRect.Width - txtSize.Width;
1005
                        break;
1006

    
1007
                    case TextAlignment.Center:
1008
                        startPositionX = parentRect.X + parentRect.Width / 2 - txtSize.Width / 2 - 3;
1009
                        break;
1010
                }
1011

    
1012
                Point startPosition = new Point
1013
                {
1014
                    X = startPositionX,
1015
                    Y = positionY
1016
                };
1017

    
1018
                System.Windows.Point startPoint = new System.Windows.Point(startPosition.X, startPosition.Y);
1019
                System.Windows.Point endPoint = new System.Windows.Point(startPosition.X + txtSize.Width, startPosition.Y + txtSize.Height);
1020
                System.Windows.Point leftBottomPoint = new System.Windows.Point(startPosition.X, startPosition.Y + txtSize.Height);
1021
                System.Windows.Point topRightPoint = new System.Windows.Point(startPosition.X + txtSize.Width, startPosition.Y);
1022

    
1023
                result = new TextControl
1024
                {
1025
                    CommentID = Commons.shortGuid(),
1026
                    MarkupInfoID = markupInfoId,
1027
                    Text = Text,
1028
                    StartPoint = startPoint,
1029
                    EndPoint = endPoint,
1030
                    CanvasX = startPosition.X,
1031
                    CanvasY = startPosition.Y,
1032
                    BoxWidth = txtSize.Width,
1033
                    BoxHeight = txtSize.Height,
1034
                    ControlType_No = 0,
1035
                    LineSize = new Thickness(5),
1036
                    TextSize = fontSize,
1037
                    Foreground = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromArgb(255, 255, 0, 0)),
1038
                    FontSize = 10,
1039
                    UserID = userId,
1040
                    IsHighLight = false,
1041
                    CommentAngle = 0,
1042
                    PointSet = new List<Point>(),
1043
                    Opacity = 1,
1044
                    IsSelected = false,
1045
                    TextFamily = new FontFamily("Tahoma"),
1046
                    TextStyle = FontStyles.Normal,
1047
                    TextWeight = FontWeights.Bold
1048
                };
1049
            }
1050
            catch (Exception ex)
1051
            {
1052
            }
1053

    
1054
            return result;
1055
        }
1056

    
1057
        public static Size ShapeMeasure(UIElement e)
1058
        {
1059
            // Measured Size is bounded to be less than maxSize
1060
            Size maxSize = new Size(
1061
                 double.PositiveInfinity,
1062
                 double.PositiveInfinity);
1063
            e.Measure(maxSize);
1064
            return e.DesiredSize;
1065
        }
1066

    
1067
        private async Task MarkupLoadAsync(int pageNumber,Double PageAngle, CancellationToken cts)
1068
        {
1069
            System.Diagnostics.Stopwatch stopwatch = new Stopwatch();
1070
            stopwatch.Start();
1071

    
1072
            /// 컨트롤을 새로 생성한다.
1073
            Common.ViewerDataModel.Instance.MarkupControls_USER.Clear();    //전체 제거
1074
            Common.ViewerDataModel.Instance.MarkupControls.Clear();         //전체 제거
1075

    
1076
            System.Diagnostics.Debug.WriteLine("MarkupLoad - Clear " + new TimeSpan(stopwatch.ElapsedTicks).ToString());
1077

    
1078
            foreach (var markup in ViewerDataModel.Instance.MyMarkupList.Where(param => param.PageNumber == pageNumber))
1079
            {
1080
                if (cts.IsCancellationRequested)
1081
                {
1082
                    return;
1083
                }
1084

    
1085
                var info = ViewerDataModel.Instance._markupInfoList.Where(param => param.MarkupInfoID == markup.MarkupInfoID).FirstOrDefault();
1086
                if (info != null)
1087
                {
1088
                    string sColor = (info.UserID == App.ViewInfo.UserID) ? "#FFFF0000" : info.DisplayColor;
1089
                    if (info.UserID == App.ViewInfo.UserID)
1090
                    {
1091
                        var control = await MarkupParser.ParseExAsync(App.BaseAddress, cts, App.ViewInfo.ProjectNO, markup.Data, Common.ViewerDataModel.Instance.MarkupControls_USER, PageAngle, sColor, "",
1092
                                        markup.MarkupInfoID, markup.ID);
1093
                        control.Visibility = Visibility.Hidden;
1094
                    }
1095
                    else
1096
                    {
1097
                        var control = await MarkupParser.ParseExAsync(App.BaseAddress, cts, App.ViewInfo.ProjectNO, markup.Data, Common.ViewerDataModel.Instance.MarkupControls, PageAngle, sColor, "",
1098
                                                                markup.MarkupInfoID, markup.ID);
1099
                        control.Visibility = Visibility.Hidden;
1100
                    }
1101
                }
1102

    
1103
            };
1104
            /// up to here
1105

    
1106
            System.Diagnostics.Debug.WriteLine("MarkupLoad - MarkupParser " + new TimeSpan(stopwatch.ElapsedTicks).ToString());
1107

    
1108
            /// fire selection event
1109
            List<MarkupInfoItem> gridSelectionItem = gridViewMarkup.SelectedItems.Cast<MarkupInfoItem>().ToList(); //선택 된 마크업
1110
            this.gridViewMarkup.UnselectAll();
1111
            this.gridViewMarkup.Select(gridSelectionItem);
1112

    
1113
            if (!testPanel2.IsHidden)
1114
            {
1115
                ViewerDataModel.Instance.Sync_ContentOffsetX = zoomAndPanControl.ContentOffsetX;
1116
                ViewerDataModel.Instance.Sync_ContentOffsetY = zoomAndPanControl.ContentOffsetY;
1117
                ViewerDataModel.Instance.Sync_ContentScale = zoomAndPanControl.ContentScale;
1118

    
1119
                Common.ViewerDataModel.Instance.MarkupControls_Sync.Clear();
1120
                List<MarkupInfoItem> gridSelectionRevItem = gridViewRevMarkup.SelectedItems.Cast<MarkupInfoItem>().ToList();
1121

    
1122
                foreach (var item in gridSelectionRevItem)
1123
                {
1124
                    var markupitems = item.MarkupList.Where(pageItem => pageItem.PageNumber == pageNumber).ToList();
1125

    
1126
                    foreach (var markupitem in markupitems)
1127
                    {
1128
                        await MarkupParser.ParseExAsync(App.BaseAddress, ViewerDataModel.Instance.CancellationToken(), App.ViewInfo.ProjectNO, markupitem.Data, Common.ViewerDataModel.Instance.MarkupControls_Sync,PageAngle, item.DisplayColor, "", item.MarkupInfoID);
1129

    
1130
                        if (cts.IsCancellationRequested)
1131
                        {
1132
                            return;
1133
                        }
1134
                    }
1135
                }
1136
            }
1137

    
1138
            SetCommentPages(cts);
1139
        }
1140

    
1141
        public void SetCommentPages(CancellationToken? cts)
1142
        {
1143
            Logger.sendCheckLog("pageNavigator_PageChanging_SetCommentPages Setting", 1);
1144
            List<UsersCommentPagesMember> _pages = new List<UsersCommentPagesMember>();
1145
            foreach (var item in ViewerDataModel.Instance._markupInfoList)
1146
            {
1147
                //Comment 가 존재할 경우에만 Thumbnail 에 추가
1148
                if (item.MarkupList != null)
1149
                {
1150
                    UsersCommentPagesMember instance = new UsersCommentPagesMember();
1151
                    instance.UserName = item.UserName;
1152
                    instance.Depart = item.Depatment;
1153
                    instance.MarkupInfoID = item.MarkupInfoID;
1154
                    instance.IsSelected = true;
1155
                    instance.isConSolidation = item.Consolidate;
1156
                    instance.SetColor = item.DisplayColor;
1157
                    if (item.UserID == App.ViewInfo.UserID && item.MarkupInfoID == item.MarkupInfoID)
1158
                    {
1159
                        instance.PageNumber = ViewerDataModel.Instance.MyMarkupList.Select(d => d.PageNumber).ToList();
1160
                    }
1161
                    else
1162
                    {
1163
                        instance.PageNumber = ViewerDataModel.Instance.MarkupList_Pre.Where(data => data.MarkupInfoID == item.MarkupInfoID).Select(d => d.PageNumber).ToList();
1164
                    }
1165
                    _pages.Add(instance);
1166
                }
1167

    
1168
                if (cts != null)
1169
                {
1170
                    if (cts.Value.IsCancellationRequested)
1171
                        return;
1172
                }
1173
            }
1174

    
1175
            this.pageNavigator.SetCommentList(_pages.ToList(),cts);
1176
        }
1177

    
1178
        public void MarkupitemViewUpdate(string markupinfo_id)
1179
        {
1180
            //db에 업데이트 한 list 를 view 에 업데이트
1181
            string sDocID = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu._DocInfo.ID;
1182
            List<MarkupInfoItem> results = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.GetMarkupInfoItems(App.ViewInfo.ProjectNO, sDocID);
1183
            MarkupInfoItem dbinfo = results.Where(x => x.MarkupInfoID == markupinfo_id).FirstOrDefault();
1184
            MarkupInfoItem viewinfo = Common.ViewerDataModel.Instance._markupInfoList.Where(x => x.MarkupInfoID == markupinfo_id).FirstOrDefault();
1185
            if (dbinfo.MarkupList.Count > 0)
1186
            {
1187
                if (viewinfo.MarkupList != null)
1188
                {
1189
                    viewinfo.MarkupList.Clear();
1190
                    viewinfo.MarkupList = null;
1191
                }
1192
                viewinfo.MarkupList = new List<MarkupItem>();
1193
                foreach (var item in dbinfo.MarkupList)
1194
                {
1195
                    viewinfo.MarkupList.Add(item);
1196
                }
1197
            }
1198
        }
1199

    
1200
        private async void zoomAndPanControl_MouseWheel(object sender, MouseWheelEventArgs e)
1201
        {
1202
            var instance = ViewerDataModel.Instance;
1203

    
1204
            if (instance.IsWheelPageChanage)
1205
            {
1206
                return;
1207
            }
1208

    
1209
            if (instance.IsPressCtrl) // && !instance.IsWheelPageChanage)
1210
            {
1211
                int changePage = 0;
1212

    
1213
                if (e.Delta > 0)
1214
                {
1215
                    if (0 < instance.ContentOffsetY)
1216
                    {
1217
                        Vector dragOffset = new Vector(0, e.Delta);
1218
                        MoveZoomAndPanControl(dragOffset);
1219
                    }
1220
                    //else
1221
                    //{
1222
                    //    if (instance.SystemMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber > 1)
1223
                    //    {
1224
                    //        instance.IsWheelPageChanage = true;
1225
                    //        changePage -= 1;
1226
                    //    }
1227
                    //}
1228
                }
1229
                else if (e.Delta < 0)
1230
                {
1231
                    if (instance.ContentHeight > instance.ContentOffsetY + instance.ContentViewportHeight)
1232
                    {
1233
                        Vector dragOffset = new Vector(0, e.Delta);
1234
                        MoveZoomAndPanControl(dragOffset);
1235
                    }
1236
                    //else
1237
                    //{
1238
                    //    if (instance.SystemMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber < instance.SystemMain.dzMainMenu.pageNavigator.PageCount)
1239
                    //    {
1240
                    //        instance.IsWheelPageChanage = true;
1241
                    //        changePage += 1;
1242
                    //    }
1243
                    //}
1244
                }
1245

    
1246
                //if (changePage != 0)
1247
                //{
1248
                //    await Task.Factory.StartNew(() =>
1249
                //    {
1250
                //        double beforeScale = instance.ContentScale;
1251

    
1252
                //        EventHandler<Sample.PageChangeEventArgs> handler = null;
1253

    
1254
                //        handler = (snd, evt) =>
1255
                //        {
1256
                //            /// 최상단으로 이전 zoomScale로 위치한다
1257
                //            //Point currentContentMousePoint = e.GetPosition(zoomAndPanCanvas);
1258
                //            //zoomAndPanControl.ZoomAboutPoint(beforeScale, new Point(currentContentMousePoint.X, 0));
1259
                //            instance.IsWheelPageChanage = false;
1260
                //            pageNavigator.PageChanged -= handler;
1261
                //        };
1262

    
1263
                //        pageNavigator.PageChanged += handler;
1264

    
1265
                //        pageNavigator.GotoPage(Convert.ToInt32(instance.SystemMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber) + changePage);
1266
                //    });
1267

    
1268
                //}
1269
            }
1270
            else
1271
            {
1272
                e.Handled = true;
1273
                if (e.Delta > 0)
1274
                {
1275
                    Point currentContentMousePoint = e.GetPosition(zoomAndPanCanvas);
1276
                    ZoomIn(currentContentMousePoint);
1277
                }
1278
                else
1279
                {
1280
                    Point currentContentMousePoint = e.GetPosition(zoomAndPanCanvas);
1281
                    ZoomOut(currentContentMousePoint);
1282
                }
1283
            }
1284
        }
1285

    
1286
        private void zoomAndPanControl2_MouseWheel(object sender, MouseWheelEventArgs e)
1287
        {
1288
            e.Handled = true;
1289
            if (e.Delta > 0)
1290
            {
1291
                Point currentContentMousePoint = e.GetPosition(zoomAndPanCanvas2);
1292
                ZoomIn_Sync(currentContentMousePoint);
1293
            }
1294
            else
1295
            {
1296
                Point currentContentMousePoint = e.GetPosition(zoomAndPanCanvas2);
1297
                ZoomOut_Sync(currentContentMousePoint);
1298
            }
1299
        }
1300

    
1301
        #region ZoomIn & ZoomOut
1302

    
1303
        private void ZoomOut_Executed(object sender, ExecutedRoutedEventArgs e)
1304
        {
1305
            ZoomOut(new Point(zoomAndPanControl.ContentZoomFocusX,
1306
                zoomAndPanControl.ContentZoomFocusY));
1307
        }
1308

    
1309
        private void ZoomIn_Executed(object sender, ExecutedRoutedEventArgs e)
1310
        {
1311
            ZoomIn(new Point(zoomAndPanControl.ContentZoomFocusX,
1312
                zoomAndPanControl.ContentZoomFocusY));
1313
        }
1314

    
1315
        //강인구 추가 (줌 인아웃 수치 변경)
1316
        //큰해상도의 문서일 경우 줌 인 아웃시 사이즈 변동이 큼
1317
        private void ZoomOut(Point contentZoomCenter)
1318
        {
1319
            if (zoomAndPanControl.ContentScale > 0.39)
1320
            {
1321
                zoomAndPanControl.ZoomAboutPoint(zoomAndPanControl.ContentScale - 0.2, contentZoomCenter);
1322
            }
1323
            else
1324
            {
1325
                zoomAndPanControl.ZoomAboutPoint(zoomAndPanControl.ContentScale / 2, contentZoomCenter);
1326
            }
1327

    
1328
            if (zoomAndPanControl2 != null && Sync.IsChecked)
1329
            {
1330
                zoomAndPanControl2.ZoomAboutPoint(zoomAndPanControl.ContentScale, contentZoomCenter);
1331
            }
1332
        }
1333

    
1334
        private void ZoomIn(Point contentZoomCenter)
1335
        {
1336
            if (zoomAndPanControl.ContentScale > 0.19)
1337
            {
1338
                zoomAndPanControl.ZoomAboutPoint(zoomAndPanControl.ContentScale + 0.2, contentZoomCenter);
1339
            }
1340
            else
1341
            {
1342
                zoomAndPanControl.ZoomAboutPoint(zoomAndPanControl.ContentScale * 2, contentZoomCenter);
1343
            }
1344

    
1345
            if (zoomAndPanControl2 != null && Sync.IsChecked)
1346
            {
1347
                zoomAndPanControl2.ZoomAboutPoint(zoomAndPanControl.ContentScale, contentZoomCenter);
1348
            }
1349
        }
1350

    
1351
        private void ZoomOut_Sync(Point contentZoomCenter)
1352
        {
1353
            if (zoomAndPanControl2.ContentScale > 0.39)
1354
            {
1355
                zoomAndPanControl2.ZoomAboutPoint(zoomAndPanControl2.ContentScale - 0.2, contentZoomCenter);
1356
            }
1357
            else
1358
            {
1359
                zoomAndPanControl2.ZoomAboutPoint(zoomAndPanControl2.ContentScale / 2, contentZoomCenter);
1360
            }
1361

    
1362
            if (Sync.IsChecked)
1363
            {
1364
                zoomAndPanControl.ZoomAboutPoint(zoomAndPanControl2.ContentScale, contentZoomCenter);
1365
            }
1366
        }
1367

    
1368
        private void ZoomIn_Sync(Point contentZoomCenter)
1369
        {
1370
            if (zoomAndPanControl2.ContentScale > 0.19)
1371
            {
1372
                zoomAndPanControl2.ZoomAboutPoint(zoomAndPanControl2.ContentScale + 0.2, contentZoomCenter);
1373
            }
1374
            else
1375
            {
1376
                zoomAndPanControl2.ZoomAboutPoint(zoomAndPanControl2.ContentScale * 2, contentZoomCenter);
1377
            }
1378

    
1379
            if (Sync.IsChecked)
1380
            {
1381
                zoomAndPanControl.ZoomAboutPoint(zoomAndPanControl2.ContentScale, contentZoomCenter);
1382
            }
1383
        }
1384

    
1385
        private void ZoomOut()
1386
        {
1387
            zoomAndPanControl.ContentScale -= 0.1;
1388
            //if (zoomAndPanControl2 != null)
1389
            //{
1390
            //    zoomAndPanControl2.ContentScale -= 0.1;
1391
            //}
1392
        }
1393

    
1394
        private void ZoomIn()
1395
        {
1396
            zoomAndPanControl.ContentScale += 0.1;
1397
            //if (zoomAndPanControl2 != null)
1398
            //{
1399
            //    zoomAndPanControl2.ContentScale += 0.1;
1400
            //}
1401
        }
1402

    
1403
        #endregion ZoomIn & ZoomOut
1404

    
1405
        private void init()
1406
        {
1407
            foreach (var item in ViewerDataModel.Instance.MarkupControls)
1408
            {
1409
                ControlList.Clear();
1410
                listBox.Items.Clear();
1411
                selected_item.Clear();
1412

    
1413
                (item as IMarkupCommonData).IsSelected = false;
1414
            }
1415
        }
1416

    
1417
        private HitTestResultBehavior MyCallback(HitTestResult result)
1418
        {
1419
            //this.cursor = Cursors.UpArrow;
1420
            var element = result.VisualHit;
1421
            while (element != null && !(element is CommentUserInfo))
1422
                element = VisualTreeHelper.GetParent(element);
1423

    
1424
            if (element == null)
1425
            {
1426
                return HitTestResultBehavior.Stop;
1427
            }
1428
            else
1429
            {
1430
                if (element is CommentUserInfo)
1431
                {
1432
                    if (!hitList.Contains(element))
1433
                    {
1434
                        hitList.Add((CommentUserInfo)element);
1435
                    }
1436
                    else
1437
                    {
1438
                        return HitTestResultBehavior.Stop;
1439
                    }
1440
                }
1441
            }
1442
            return HitTestResultBehavior.Continue;
1443
        }
1444

    
1445
        public void ReleaseSelectPath()
1446
        {
1447
            if (SelectionPath == null)
1448
            {
1449
                SelectionPath = new Path();
1450
                SelectionPath.Name = "";
1451
            }
1452
            if (SelectionPath.Name != "")
1453
            {
1454
                SelectionPath.Name = "None";
1455
            }
1456
            SelectionPath.Opacity = 0.01;
1457
            SelectionPath.RenderTransform = null;
1458
            SelectionPath.RenderTransformOrigin = new Point(0, 0);
1459
        }
1460

    
1461
        #region 컨트롤 초기화
1462

    
1463
        public void Control_Init(object control)
1464
        {
1465
            if (L_Size != 0 && (control as IPath) != null)
1466
            {
1467
                (control as IPath).LineSize = L_Size;
1468
                L_Size = 0;
1469
            }
1470

    
1471
            switch (control.GetType().Name)
1472
            {
1473
                case "RectangleControl":
1474
                    {
1475
                        (control as RectangleControl).StrokeColor = Brushes.Red;
1476
                    }
1477
                    break;
1478

    
1479
                case "CircleControl":
1480
                    {
1481
                        (control as CircleControl).StrokeColor = Brushes.Red;
1482
                    }
1483
                    break;
1484

    
1485
                case "TriControl":
1486
                    {
1487
                        (control as TriControl).StrokeColor = Brushes.Red;
1488
                    }
1489
                    break;
1490

    
1491
                case "RectCloudControl":
1492
                    {
1493
                        (control as RectCloudControl).StrokeColor = Brushes.Red;
1494
                    }
1495
                    break;
1496

    
1497
                case "CloudControl":
1498
                    {
1499
                        (control as CloudControl).StrokeColor = Brushes.Red;
1500
                    }
1501
                    break;
1502

    
1503
                case "PolygonControl":
1504
                    {
1505
                        (control as PolygonControl).StrokeColor = Brushes.Red;
1506
                    }
1507
                    break;
1508

    
1509
                case "ArcControl":
1510
                    {
1511
                        (control as ArcControl).StrokeColor = Brushes.Red;
1512
                    }
1513
                    break;
1514

    
1515
                case "ArrowArcControl":
1516
                    {
1517
                        (control as ArrowArcControl).StrokeColor = Brushes.Red;
1518
                    }
1519
                    break;
1520

    
1521
                case "LineControl":
1522
                    {
1523
                        (control as LineControl).StrokeColor = Brushes.Red;
1524
                    }
1525
                    break;
1526

    
1527
                case "ArrowControl_Multi":
1528
                    {
1529
                        (control as ArrowControl_Multi).StrokeColor = Brushes.Red;
1530
                    }
1531
                    break;
1532

    
1533
                case "TextControl":
1534
                    {
1535
                        (control as TextControl).BackInnerColor = new SolidColorBrush(Color.FromArgb(Convert.ToByte(255 * 0.6), Colors.White.R, Colors.White.G, Colors.White.B));
1536
                    }
1537
                    break;
1538

    
1539
                case "ArrowTextControl":
1540
                    {
1541
                        (control as ArrowTextControl).BackInnerColor = new SolidColorBrush(Color.FromArgb(Convert.ToByte(255 * 0.6), Colors.White.R, Colors.White.G, Colors.White.B));
1542
                    }
1543
                    break;
1544

    
1545
                case "InsideWhiteControl":
1546
                    {
1547
                        (control as InsideWhiteControl).StrokeColor = Brushes.White;
1548
                    }
1549
                    break;
1550

    
1551
                case "OverlapWhiteControl":
1552
                    {
1553
                        (control as OverlapWhiteControl).StrokeColor = Brushes.White;
1554
                    }
1555
                    break;
1556

    
1557
                case "ClipWhiteControl":
1558
                    {
1559
                        (control as ClipWhiteControl).StrokeColor = Brushes.White;
1560
                    }
1561
                    break;
1562

    
1563
                case "CoordinateControl":
1564
                    {
1565
                        (control as CoordinateControl).StrokeColor = Brushes.Black;
1566
                    }
1567
                    break;
1568
            }
1569
        }
1570

    
1571
        #endregion 컨트롤 초기화
1572

    
1573
        public void firstCondition_MouseLeave(object sender, MouseEventArgs e)
1574
        {
1575
            //Control_Init(e.Source);
1576
        }
1577

    
1578
        //private Window _dragdropWindow = null;
1579

    
1580
        [DllImport("user32.dll")]
1581
        [return: MarshalAs(UnmanagedType.Bool)]
1582
        internal static extern bool GetCursorPos(ref Win32Point pt);
1583

    
1584
        [StructLayout(LayoutKind.Sequential)]
1585
        internal struct Win32Point
1586
        {
1587
            public Int32 X;
1588
            public Int32 Y;
1589
        };
1590

    
1591
        /*
1592
       public string symbol_id = null;
1593
       public long symbol_group_id;
1594
       public int symbol_SelectedIndex;
1595
       public ImageSource symbol_img;
1596
       public string symbol_Data = null;
1597
       public void symboldata(string id, long group_id, int SelectedIndex, string Data_, ImageSource img)
1598
       {
1599
           PlaceImageSymbol(symbol_id, symbol_group_id, symbol_SelectedIndex, new Point(zoomAndPanCanvas.ActualWidth / 2,
1600
               zoomAndPanCanvas.ActualHeight / 2));
1601

    
1602
               if (this._dragdropWindow != null)
1603
               {
1604
                   this._dragdropWindow.Close();
1605
                   this._dragdropWindow = null;
1606
               }
1607

    
1608
               symbol_id = id;
1609
               symbol_group_id = group_id;
1610
               symbol_SelectedIndex = SelectedIndex;
1611
               symbol_Data = Data_;
1612
               symbol_img = img;
1613

    
1614
               CreateDragDropWindow2(img);
1615
    }
1616

    
1617
    private void CreateDragDropWindow2(ImageSource image)
1618
        {
1619
            this._dragdropWindow = new Window();
1620
            _dragdropWindow.Cursor = new Cursor(App.DefaultArrowCursorStream);
1621
            _dragdropWindow.WindowStyle = WindowStyle.None;
1622
            _dragdropWindow.AllowsTransparency = true;
1623
            _dragdropWindow.AllowDrop = false;
1624
            _dragdropWindow.Background = null;
1625
            _dragdropWindow.IsHitTestVisible = false;
1626
            _dragdropWindow.SizeToContent = SizeToContent.WidthAndHeight;
1627
            _dragdropWindow.Topmost = true;
1628
            _dragdropWindow.ShowInTaskbar = false;
1629

    
1630
            Rectangle r = new Rectangle();
1631
            r.Width = image.Width;
1632
            r.Height = image.Height;
1633
            r.Opacity = 0.5;
1634
            r.Fill = new ImageBrush(image);
1635
            this._dragdropWindow.Content = r;
1636

    
1637
            Win32Point w32Mouse = new Win32Point();
1638
            GetCursorPos(ref w32Mouse);
1639

    
1640
            //w32Mouse.X = getCurrentPoint.X;
1641
            this._dragdropWindow.Left = w32Mouse.X - (image.Width / 2);
1642
            this._dragdropWindow.Top = w32Mouse.Y - (image.Height / 2);
1643
            this._dragdropWindow.Show();
1644
        }
1645

    
1646
         */
1647

    
1648
        public void MoveZoomAndPanControl(Vector dragOffset)
1649
        {
1650
            zoomAndPanControl.ContentOffsetX -= dragOffset.X;
1651
            zoomAndPanControl.ContentOffsetY -= dragOffset.Y;
1652

    
1653
            if (Sync.IsChecked)
1654
            {
1655
                ViewerDataModel.Instance.Sync_ContentOffsetX = zoomAndPanControl.ContentOffsetX;
1656
                ViewerDataModel.Instance.Sync_ContentOffsetY = zoomAndPanControl.ContentOffsetY;
1657
            }
1658
        }
1659

    
1660
        private void zoomAndPanControl_MouseMove(object sender, MouseEventArgs e)
1661
        {
1662
            if (Common.ViewerDataModel.Instance.SelectedControl == "Batch"
1663
                || Common.ViewerDataModel.Instance.SelectedControl == "MACRO")
1664
            //if(this.txtBatch.Visibility == Visibility.Visible)
1665
            {
1666
                if (!floatingTip.IsOpen) { floatingTip.IsOpen = true; }
1667

    
1668
                Point currentPos = e.GetPosition(rect);
1669

    
1670
                floatingTip.HorizontalOffset = currentPos.X + 20;
1671
                floatingTip.VerticalOffset = currentPos.Y;
1672
            }
1673

    
1674
            getCurrentPoint = e.GetPosition(drawingRotateCanvas);
1675

    
1676
            if ((e.MiddleButton == MouseButtonState.Pressed) || (e.RightButton == MouseButtonState.Pressed))
1677
            {
1678
                SetCursor();
1679
                Point currentCanvasDrawingMouseMovePoint = e.GetPosition(drawingRotateCanvas);
1680
                Point currentCanvasZoomPanningMouseMovePoint = e.GetPosition(zoomAndPanCanvas);
1681

    
1682
                Vector dragOffset = currentCanvasZoomPanningMouseMovePoint - canvasZoommovingMouseDownPoint;
1683

    
1684
                MoveZoomAndPanControl(dragOffset);
1685
            }
1686

    
1687
            if (mouseHandlingMode == MouseHandlingMode.Drawing && currentControl != null)
1688
            {
1689
                Point currentCanvasDrawingMouseMovePoint = e.GetPosition(drawingRotateCanvas);
1690
                Point currentCanvasZoomPanningMouseMovePoint = e.GetPosition(zoomAndPanCanvas);
1691
                SetCursor();
1692

    
1693
                if (currentControl != null)
1694
                {
1695
                    double moveX = currentCanvasDrawingMouseMovePoint.X - CanvasDrawingMouseDownPoint.X;
1696
                    double moveY = currentCanvasDrawingMouseMovePoint.Y - CanvasDrawingMouseDownPoint.Y;
1697
                    //강인구 추가
1698
                    currentControl.Opacity = ViewerDataModel.Instance.ControlOpacity;
1699

    
1700
                    if ((currentControl as IPath) != null)
1701
                    {
1702
                        (currentControl as IPath).LineSize = ViewerDataModel.Instance.LineSize;
1703
                    }
1704
                    if ((currentControl as LineControl) != null)
1705
                    {
1706
                        (currentControl as LineControl).Interval = ViewerDataModel.Instance.Interval;
1707
                    }
1708

    
1709
                    if ((currentControl as IShapeControl) != null)
1710
                    {
1711
                        (currentControl as IShapeControl).Paint = ViewerDataModel.Instance.paintSet;
1712
                    }
1713
                    if ((currentControl as TextControl) != null)
1714
                    {
1715
                        if (this.ParentOfType<MainWindow>().dzTopMenu.btnItalic.IsChecked == true)
1716
                        {
1717
                            (currentControl as TextControl).TextStyle = FontStyles.Italic;
1718
                        }
1719
                        if (this.ParentOfType<MainWindow>().dzTopMenu.btnBold.IsChecked == true)
1720
                        {
1721
                            (currentControl as TextControl).TextWeight = FontWeights.Bold;
1722
                        }
1723
                        if (this.ParentOfType<MainWindow>().dzTopMenu.btnUnderLine.IsChecked == true)
1724
                        {
1725
                            (currentControl as TextControl).UnderLine = TextDecorations.Underline;
1726
                        }
1727
                    }
1728
                    else if ((currentControl as ArrowTextControl) != null)
1729
                    {
1730
                        if (this.ParentOfType<MainWindow>().dzTopMenu.btnItalic.IsChecked == true)
1731
                        {
1732
                            (currentControl as ArrowTextControl).TextStyle = FontStyles.Italic;
1733
                        }
1734
                        if (this.ParentOfType<MainWindow>().dzTopMenu.btnBold.IsChecked == true)
1735
                        {
1736
                            (currentControl as ArrowTextControl).TextWeight = FontWeights.Bold;
1737
                        }
1738
                        if (this.ParentOfType<MainWindow>().dzTopMenu.btnUnderLine.IsChecked == true)
1739
                        {
1740
                            (currentControl as ArrowTextControl).UnderLine = TextDecorations.Underline;
1741
                        }
1742
                    }
1743
                    else if ((currentControl as RectCloudControl) != null)
1744
                    {
1745
                        (currentControl as RectCloudControl).ArcLength = ViewerDataModel.Instance.ArcLength;
1746
                    }
1747
                    else if ((currentControl as CloudControl) != null)
1748
                    {
1749
                        (currentControl as CloudControl).ArcLength = ViewerDataModel.Instance.ArcLength;
1750
                    }
1751

    
1752
                    #region // 모든 컨트롤의 공통기능 제어
1753

    
1754
                    if (controlType != ControlType.PenControl)
1755
                    {
1756
                        currentControl.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.IsAxisLock || ViewerDataModel.Instance.IsPressShift);
1757
                    }
1758

    
1759
                    #endregion // 모든 컨트롤의 공통기능 제어
1760

    
1761
                    #region // 각 컨트롤의 특별한 기능을 제어한다.
1762

    
1763
                    switch (controlType)
1764
                    {
1765
                        case (ControlType.Coordinate):
1766
                            {
1767
                                var control = currentControl as CoordinateControl;
1768
                                if (control != null)
1769
                                {
1770
                                    //control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1771
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1772
                                    control.Paint = ViewerDataModel.Instance.paintSet;
1773
                                }
1774
                            }
1775
                            break;
1776

    
1777
                        case (ControlType.InsideWhite):
1778
                            {
1779
                                var control = currentControl as InsideWhiteControl;
1780
                                if (control != null)
1781
                                {
1782
                                    //control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1783
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1784
                                    control.Paint = ViewerDataModel.Instance.paintSet;
1785
                                    control.Paint = PaintSet.Fill;
1786
                                }
1787
                            }
1788
                            break;
1789

    
1790
                        case ControlType.OverlapWhite:
1791
                            {
1792
                                var control = currentControl as OverlapWhiteControl;
1793
                                if (control != null)
1794
                                {
1795
                                    //control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1796
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1797
                                    control.Paint = ViewerDataModel.Instance.paintSet;
1798
                                    control.Paint = PaintSet.Fill;
1799
                                }
1800
                            }
1801
                            break;
1802

    
1803
                        case ControlType.ClipWhite:
1804
                            {
1805
                                var control = currentControl as ClipWhiteControl;
1806
                                if (control != null)
1807
                                {
1808
                                    //control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1809
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1810
                                    control.Paint = ViewerDataModel.Instance.paintSet;
1811
                                    control.Paint = PaintSet.Fill;
1812
                                }
1813
                            }
1814
                            break;
1815

    
1816
                        case ControlType.RectCloud:
1817
                            {
1818
                                var control = currentControl as RectCloudControl;
1819
                                if (control != null)
1820
                                {
1821
                                    //control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1822
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1823
                                    control.Paint = ViewerDataModel.Instance.paintSet;
1824
                                }
1825
                            }
1826
                            break;
1827

    
1828
                        case ControlType.SingleLine:
1829
                        case ControlType.CancelLine:
1830
                        case ControlType.ArrowLine:
1831
                        case ControlType.TwinLine:
1832
                        case ControlType.DimLine:
1833
                            {
1834
                                var control = currentControl as LineControl;
1835
                                if (control != null)
1836
                                {
1837
                                    //control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1838
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1839
                                }
1840
                            }
1841
                            break;
1842

    
1843
                        case ControlType.ArcLine:
1844
                            {
1845
                                var control = currentControl as ArcControl;
1846
                                if (control != null)
1847
                                {
1848
                                    //control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1849
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1850
                                }
1851
                            }
1852
                            break;
1853

    
1854
                        case ControlType.ArcArrow:
1855
                            {
1856
                                var control = currentControl as ArrowArcControl;
1857
                                if (control != null)
1858
                                {
1859
                                    //control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1860
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1861
                                }
1862
                            }
1863
                            break;
1864

    
1865
                        case ControlType.ArrowMultiLine:
1866
                            {
1867
                                var control = currentControl as ArrowControl_Multi;
1868
                                if (control != null)
1869
                                {
1870
                                    //control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1871
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1872
                                }
1873
                            }
1874
                            break;
1875

    
1876
                        case ControlType.Circle:
1877
                            {
1878
                                var control = currentControl as CircleControl;
1879

    
1880
                                if (control != null)
1881
                                {
1882
                                    //control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1883
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1884
                                    control.Paint = ViewerDataModel.Instance.paintSet;
1885
                                }
1886
                            }
1887
                            break;
1888

    
1889
                        case ControlType.PolygonCloud:
1890
                            {
1891
                                var control = currentControl as CloudControl;
1892
                                if (control != null)
1893
                                {
1894
                                    //control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1895
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1896
                                    control.Paint = ViewerDataModel.Instance.paintSet;
1897
                                }
1898
                            }
1899
                            break;
1900

    
1901
                        case ControlType.Triangle:
1902
                            {
1903
                                var control = currentControl as TriControl;
1904
                                if (control != null)
1905
                                {
1906
                                    //control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1907
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1908
                                    control.Paint = ViewerDataModel.Instance.paintSet;
1909
                                }
1910
                            }
1911
                            break;
1912

    
1913
                        case ControlType.ImgControl:
1914
                            {
1915
                                var control = currentControl as ImgControl;
1916
                                if (control != null)
1917
                                {
1918
                                    //control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1919
                                }
1920
                            }
1921
                            break;
1922

    
1923
                        case ControlType.Date:
1924
                            {
1925
                                var control = currentControl as DateControl;
1926
                                if (control != null)
1927
                                {
1928
                                    //control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1929
                                }
1930
                            }
1931
                            break;
1932

    
1933
                        case ControlType.ArrowTextControl:
1934
                        case ControlType.ArrowTransTextControl:
1935
                        case ControlType.ArrowTextBorderControl:
1936
                        case ControlType.ArrowTransTextBorderControl:
1937
                        case ControlType.ArrowTextCloudControl:
1938
                        case ControlType.ArrowTransTextCloudControl:
1939
                            {
1940
                                var control = currentControl as ArrowTextControl;
1941
                                if (control != null)
1942
                                {
1943
                                    //control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1944
                                }
1945
                            }
1946
                            break;
1947

    
1948
                        case ControlType.PolygonControl:
1949
                        case ControlType.ChainLine:
1950
                            {
1951
                                var control = currentControl as PolygonControl;
1952
                                if (control != null)
1953
                                {
1954
                                    //control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1955
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1956
                                    control.Paint = ViewerDataModel.Instance.paintSet;
1957
                                }
1958
                            }
1959
                            break;
1960

    
1961
                        case ControlType.Sign:
1962
                            {
1963
                                var control = currentControl as SignControl;
1964
                                if (control != null)
1965
                                {
1966
                                    //control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1967
                                }
1968
                            }
1969
                            break;
1970

    
1971
                        case ControlType.Symbol:
1972
                            {
1973
                                var control = currentControl as SymControl;
1974
                                if (control != null)
1975
                                {
1976
                                    //control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1977
                                }
1978
                            }
1979
                            break;
1980

    
1981
                        case ControlType.Stamp:
1982
                            {
1983
                                var control = currentControl as SymControlN;
1984
                                if (control != null)
1985
                                {
1986
                                    if (control.STAMP != null)
1987
                                    {
1988
                                        //control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1989
                                    }
1990
                                    else
1991
                                    {
1992
                                        currentControl = null;
1993
                                        this.cursor = new Cursor(App.DefaultArrowCursorStream);
1994
                                        DialogMessage_Alert("Approved Stamp 가 등록되어 있지 않습니다. \n관리자에게 문의하세요.", "안내");
1995
                                    }
1996
                                }
1997
                            }
1998
                            break;
1999

    
2000
                        case ControlType.Rectangle:
2001
                        case ControlType.Mark:
2002
                            {
2003
                                var control = currentControl as RectangleControl;
2004
                                if (control != null)
2005
                                {
2006
                                    //control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
2007
                                    if (control.ControlType == ControlType.Mark) control.Paint = PaintSet.Fill;
2008
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
2009
                                }
2010
                            }
2011
                            break;
2012

    
2013
                        case ControlType.PenControl:
2014
                            {
2015
                                stroke.StylusPoints.Add(new StylusPoint(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y));
2016
                                //inkBoard.Strokes.Add(stroke);
2017
                            }
2018
                            break;
2019

    
2020
                        default:
2021
                            break;
2022
                    }
2023

    
2024
                    #endregion // 각 컨트롤의 특별한 기능을 제어한다.
2025

    
2026
                    if (ViewerDataModel.Instance.MarkupAngleVisibility == Visibility.Visible)
2027
                    {
2028
                        ViewerDataModel.Instance.MarkupAngle = currentControl.CommentAngle;
2029
                    }
2030
                }
2031
            }
2032
            else if (mouseHandlingMode == MouseHandlingMode.Drawing && e.LeftButton == MouseButtonState.Pressed)
2033
            {
2034
                Point currentCanvasDrawingMouseMovePoint = e.GetPosition(drawingRotateCanvas);
2035
                Point currentCanvasZoomPanningMouseMovePoint = e.GetPosition(zoomAndPanCanvas);
2036
                SetCursor();
2037
                if (currentControl == null)
2038
                {
2039
                    switch (controlType)
2040
                    {
2041
                        case ControlType.PenControl:
2042
                            {
2043
                                if (inkBoard.Tag.ToString() == "Ink")
2044
                                {
2045
                                    stroke.StylusPoints.Add(new StylusPoint(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y));
2046
                                }
2047
                                else if (inkBoard.Tag.ToString() == "EraseByPoint")
2048
                                {
2049
                                    RemovePointStroke(currentCanvasDrawingMouseMovePoint);
2050
                                }
2051
                                else if (inkBoard.Tag.ToString() == "EraseByStroke")
2052
                                {
2053
                                    RemoveLineStroke(currentCanvasDrawingMouseMovePoint);
2054
                                }
2055

    
2056
                                //inkBoard.Strokes.Add(stroke);
2057
                            }
2058
                            break;
2059
                    }
2060
                    return;
2061
                }
2062
            }
2063
            else if (((e.LeftButton == MouseButtonState.Pressed) && mouseHandlingMode == MouseHandlingMode.Selecting) ||
2064
                ((e.LeftButton == MouseButtonState.Pressed) && mouseHandlingMode == MouseHandlingMode.Capture) ||
2065
                ((e.LeftButton == MouseButtonState.Pressed) && mouseHandlingMode == MouseHandlingMode.DragZoom))
2066
            {
2067
                Point curMouseDownPoint = e.GetPosition(drawingRotateCanvas);
2068

    
2069
                if (isDraggingSelectionRect)
2070
                {
2071
                    UpdateDragSelectionRect(CanvasDrawingMouseDownPoint, curMouseDownPoint);
2072
                    e.Handled = true;
2073
                }
2074
                else if (isLeftMouseButtonDownOnWindow)
2075
                {
2076
                    var dragDelta = curMouseDownPoint - CanvasDrawingMouseDownPoint;
2077
                    double dragDistance = Math.Abs(dragDelta.Length);
2078

    
2079
                    if (dragDistance > DragThreshold)
2080
                    {
2081
                        isDraggingSelectionRect = true;
2082
                        InitDragSelectionRect(CanvasDrawingMouseDownPoint, curMouseDownPoint);
2083
                    }
2084

    
2085
                    e.Handled = true;
2086
                }
2087

    
2088
                if (CanvasDrawingMouseDownPoint == curMouseDownPoint)
2089
                {
2090
                }
2091
                else
2092
                {
2093
                    e.Handled = true;
2094
                }
2095
            }
2096
            /*
2097
            else if ((e.LeftButton == MouseButtonState.Pressed) && mouseHandlingMode == MouseHandlingMode.DragSymbol)
2098
            { //symbol
2099
                if(_dragdropWindow != null)
2100
                {
2101
                    Win32Point w32Mouse = new Win32Point();
2102
                    GetCursorPos(ref w32Mouse);
2103

    
2104
                    this._dragdropWindow.Left = w32Mouse.X - (symbol_img.Width / 2);
2105
                    this._dragdropWindow.Top = w32Mouse.Y - (symbol_img.Height / 2);
2106
                }
2107
            }
2108
            */
2109
            else if ((e.LeftButton == MouseButtonState.Released) && (e.MiddleButton == MouseButtonState.Released) &&
2110
                (e.RightButton == MouseButtonState.Released) && ViewerDataModel.Instance.MarkupControls_USER.Count > 0)
2111
            {
2112
                var control = ViewerDataModel.Instance.MarkupControls_USER.Where(data => data.IsMouseEnter).FirstOrDefault();
2113
                if (control != null)
2114
                {
2115
                    this.cursor = Cursors.Hand;
2116
                    SetCursor();
2117
                }
2118
                else
2119
                {
2120
                    if (this.Cursor != Cursors.None)
2121
                    {
2122
                        this.cursor = new Cursor(App.DefaultArrowCursorStream);
2123
                        SetCursor();
2124
                    }
2125
                }
2126
            }
2127
            else
2128
            {
2129
            }
2130
        }
2131

    
2132
        private void zoomAndPanControl2_MouseMove(object sender, MouseEventArgs e)
2133
        {
2134
            if ((e.MiddleButton == MouseButtonState.Pressed) || (e.RightButton == MouseButtonState.Pressed))
2135
            {
2136
                SetCursor();
2137
                Point currentCanvasDrawingMouseMovePoint = e.GetPosition(drawingRotateCanvas2);
2138
                Point currentCanvasZoomPanningMouseMovePoint = e.GetPosition(zoomAndPanCanvas2);
2139

    
2140
                Vector dragOffset = currentCanvasZoomPanningMouseMovePoint - canvasZoommovingMouseDownPoint;
2141

    
2142
                ViewerDataModel.Instance.Sync_ContentOffsetX -= dragOffset.X;
2143
                ViewerDataModel.Instance.Sync_ContentOffsetY -= dragOffset.Y;
2144

    
2145
                if (Sync.IsChecked)
2146
                {
2147
                    zoomAndPanControl.ContentOffsetX = ViewerDataModel.Instance.Sync_ContentOffsetX;
2148
                    zoomAndPanControl.ContentOffsetY = ViewerDataModel.Instance.Sync_ContentOffsetY;
2149
                }
2150
            }
2151
        }
2152

    
2153
        private List<CommentUserInfo> hitList = new List<CommentUserInfo>();
2154

    
2155
        private EllipseGeometry hitArea = new EllipseGeometry();
2156

    
2157
        private void zoomAndPanControl_MouseUp(object sender, MouseButtonEventArgs e)
2158
        {
2159
            IsDrawing = false;
2160

    
2161
            if (mouseHandlingMode != MouseHandlingMode.None)
2162
            {
2163
                if (mouseHandlingMode == MouseHandlingMode.Drawing)
2164
                {
2165
                    this.cursor = new Cursor(App.DefaultArrowCursorStream);
2166

    
2167
                    SetCursor();
2168

    
2169
                    switch (controlType)
2170
                    {
2171
                        case ControlType.None:
2172
                            break;
2173

    
2174
                        case ControlType.Rectangle:
2175
                            {
2176
                            }
2177
                            break;
2178

    
2179
                        case ControlType.PenControl:
2180
                            {
2181
                            }
2182
                            break;
2183

    
2184
                        default:
2185
                            break;
2186
                    }
2187
                }
2188
                else if (mouseHandlingMode == MouseHandlingMode.Selecting && e.ChangedButton == MouseButton.Left || mouseHandlingMode == MouseHandlingMode.Capture && e.ChangedButton == MouseButton.Left || mouseHandlingMode == MouseHandlingMode.DragZoom && e.ChangedButton == MouseButton.Left)
2189
                {
2190
                    if (isLeftMouseButtonDownOnWindow)
2191
                    {
2192
                        bool wasDragSelectionApplied = false;
2193

    
2194
                        if (isDraggingSelectionRect)
2195
                        {
2196
                            if (mouseHandlingMode == MouseHandlingMode.Capture && controlType == ControlType.ImgControl)
2197
                            {
2198
                                dragCaptureBorder.Visibility = Visibility.Collapsed;
2199
                                mouseHandlingMode = MouseHandlingMode.None;
2200
                                Point endPoint = e.GetPosition(zoomAndPanCanvas);
2201
                                symbolselectindex = symbolPanel_Instance.RadTab.SelectedIndex;
2202
                                Set_Symbol_Capture(endPoint);
2203
                                ViewerDataModel.Instance.ViewVisible = Visibility.Collapsed;
2204
                                ViewerDataModel.Instance.ViewVisible = Visibility.Visible;
2205
                                ViewerDataModel.Instance.Capture_Opacity = 0;
2206
                            }
2207
                            else if (mouseHandlingMode == MouseHandlingMode.Capture)
2208
                            {
2209
                                dragCaptureBorder.Visibility = Visibility.Collapsed;
2210
                                mouseHandlingMode = MouseHandlingMode.None;
2211
                                Set_Capture();
2212

    
2213
                                ViewerDataModel.Instance.ViewVisible = Visibility.Collapsed;
2214
                                ViewerDataModel.Instance.ViewVisible = Visibility.Visible;
2215
                                ViewerDataModel.Instance.Capture_Opacity = 0;
2216
                            }
2217
                            else if (mouseHandlingMode == MouseHandlingMode.Selecting)
2218
                            {
2219
                                ApplyDragSelectionRect();
2220
                            }
2221
                            else
2222
                            {
2223
                                double x = Canvas.GetLeft(dragZoomBorder);
2224
                                double y = Canvas.GetTop(dragZoomBorder);
2225
                                double width = dragZoomBorder.Width;
2226
                                double height = dragZoomBorder.Height;
2227
                                Rect dragRect = new Rect(x, y, width, height);
2228

    
2229
                                ViewerDataModel.Instance.SystemMain.dzMainMenu.zoomAndPanControl.ZoomTo(dragRect);
2230

    
2231
                                dragZoomBorder.Visibility = Visibility.Collapsed;
2232
                            }
2233

    
2234
                            isDraggingSelectionRect = false;
2235
                            e.Handled = true;
2236
                            wasDragSelectionApplied = true;
2237
                        }
2238

    
2239
                        if (isLeftMouseButtonDownOnWindow)
2240
                        {
2241
                            isLeftMouseButtonDownOnWindow = false;
2242
                            this.ReleaseMouseCapture();
2243
                            e.Handled = true;
2244
                        }
2245

    
2246
                        if (!wasDragSelectionApplied)
2247
                        {
2248
                            init();
2249
                        }
2250
                    }
2251
                }
2252
                else if (e.RightButton == MouseButtonState.Pressed)
2253
                {
2254
                    this.cursor = new Cursor(App.DefaultArrowCursorStream);
2255
                    SetCursor();
2256
                }
2257

    
2258
                zoomAndPanControl.ReleaseMouseCapture();
2259

    
2260
                e.Handled = true;
2261
            }
2262
            else
2263
            {
2264
                this.cursor = new Cursor(App.DefaultArrowCursorStream);
2265
                SetCursor();
2266
            }
2267

    
2268
            ///mouseButtonDown = MouseButton.Left;
2269
            //controlType = ControlType.SingleLine;
2270
        }
2271

    
2272
        public void Set_Symbol_Capture(Point endPoint)
2273
        {
2274
            double x = CanvasDrawingMouseDownPoint.X;
2275
            double y = CanvasDrawingMouseDownPoint.Y;
2276
            if (x > endPoint.X)
2277
            {
2278
                x = endPoint.X;
2279
                y = endPoint.Y;
2280
            }
2281

    
2282
            double width = dragCaptureBorder.Width;
2283
            double height = dragCaptureBorder.Height;
2284

    
2285
            canvasImage = ConverterBitmapImage(zoomAndPanCanvas);
2286

    
2287
            if (x < 0)
2288
            {
2289
                width += x;
2290
                x = 0;
2291
            }
2292
            if (y < 0)
2293
            {
2294
                height += y;
2295
                y = 0;
2296

    
2297
                width = (int)canvasImage.PixelWidth - x;
2298
            }
2299
            if (x + width > canvasImage.PixelWidth)
2300
            {
2301
                width = (int)canvasImage.PixelWidth - x;
2302
            }
2303
            if (y + height > canvasImage.PixelHeight)
2304
            {
2305
                height = (int)canvasImage.PixelHeight - y;
2306
            }
2307
            var rect = new Int32Rect((int)x, (int)y, (int)width, (int)height);
2308

    
2309
            string uri = this.GetImageURL(_ViewInfo.DocumentItemID, Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber);
2310
            var defaultBitmapImage = new BitmapImage();
2311
            defaultBitmapImage.BeginInit();
2312
            defaultBitmapImage.CreateOptions = BitmapCreateOptions.IgnoreImageCache;
2313
            defaultBitmapImage.CacheOption = BitmapCacheOption.OnLoad;
2314
            defaultBitmapImage.UriSource = new Uri(uri);
2315
            defaultBitmapImage.EndInit();
2316

    
2317
            //GC.Collect();
2318

    
2319
            if (defaultBitmapImage.IsDownloading)
2320
            {
2321
                defaultBitmapImage.DownloadCompleted += (ex, arg) =>
2322
                {
2323
                    defaultBitmapImage.Freeze();
2324
                    //GC.Collect();
2325
                    BitmapSource bs = new CroppedBitmap(defaultBitmapImage, rect);
2326
                    Save_Symbol_Capture(bs, (int)x, (int)y, (int)width, (int)height);
2327
                };
2328
            }
2329
        }
2330

    
2331
        private void zoomAndPanControl2_MouseUp(object sender, MouseButtonEventArgs e)
2332
        {
2333
            ///mouseButtonDown = MouseButton.Left;
2334
        }
2335

    
2336
        private void zoomAndPanControl_MouseLeave(object sender, MouseEventArgs e)
2337
        {
2338
            ///mouseButtonDown = MouseButton.Left;
2339
            //this.cursor = new Cursor(App.DefaultArrowCursorStream);
2340
        }
2341

    
2342
        private void zoomAndPanControl_MouseDoubleClick(object sender, MouseButtonEventArgs e)
2343
        {
2344
        }
2345

    
2346
        /// <summary>
2347
        /// select items by dragging
2348
        /// </summary>
2349
        private void ApplyDragSelectionRect()
2350
        {
2351
            dragSelectionBorder.Visibility = Visibility.Collapsed;
2352

    
2353
            double x = Canvas.GetLeft(dragSelectionBorder);
2354
            double y = Canvas.GetTop(dragSelectionBorder);
2355
            double width = dragSelectionBorder.Width;
2356
            double height = dragSelectionBorder.Height;
2357
            Boolean Flag = false;
2358
            List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>();
2359
            var Items = ViewerDataModel.Instance.MarkupControls_USER.Where(d => d.Visibility != Visibility.Hidden).ToList();
2360

    
2361
            Rect dragRect = new Rect(x, y, width, height);
2362
            ///dragRect.Inflate(width / 10, height / 10);
2363

    
2364
            foreach (var item in Items)
2365
            {
2366
                Flag = SelectionSet.Instance.SelectControl(item, dragRect);
2367

    
2368
                if (Flag)
2369
                {
2370
                    adornerSet.Add(item);
2371
                    ViewerDataModel.Instance.MarkupControls_USER.Remove(item);
2372
                    Control_Style(item);
2373
                }
2374
            }
2375
            if (adornerSet.Count > 0)
2376
            {
2377
                Controls.AdornerFinal final = new Controls.AdornerFinal(adornerSet);
2378
                SelectLayer.Children.Add(final);
2379
            }
2380
        }
2381

    
2382
        private void InitDragSelectionRect(Point pt1, Point pt2)
2383
        {
2384
            //캡쳐 중
2385
            if (mouseHandlingMode == MouseHandlingMode.Capture)
2386
            {
2387
                dragCaptureBorder.Visibility = Visibility.Visible;
2388
            }
2389
            //선택 중
2390
            else if (mouseHandlingMode == MouseHandlingMode.Selecting)
2391
            {
2392
                dragSelectionBorder.Visibility = Visibility.Visible;
2393
            }
2394
            else
2395
            {
2396
                dragZoomBorder.Visibility = Visibility.Visible;
2397
            }
2398
            UpdateDragSelectionRect(pt1, pt2);
2399
        }
2400

    
2401
        /// <summary>
2402
        /// Update the position and size of the rectangle used for drag selection.
2403
        /// </summary>
2404
        private void UpdateDragSelectionRect(Point pt1, Point pt2)
2405
        {
2406
            double x, y, width, height;
2407

    
2408
            //
2409
            // Determine x,y,width and height of the rect inverting the points if necessary.
2410
            //
2411

    
2412
            if (pt2.X < pt1.X)
2413
            {
2414
                x = pt2.X;
2415
                width = pt1.X - pt2.X;
2416
            }
2417
            else
2418
            {
2419
                x = pt1.X;
2420
                width = pt2.X - pt1.X;
2421
            }
2422

    
2423
            if (pt2.Y < pt1.Y)
2424
            {
2425
                y = pt2.Y;
2426
                height = pt1.Y - pt2.Y;
2427
            }
2428
            else
2429
            {
2430
                y = pt1.Y;
2431
                height = pt2.Y - pt1.Y;
2432
            }
2433

    
2434
            //
2435
            // Update the coordinates of the rectangle used for drag selection.
2436
            //
2437
            //캡쳐 중
2438
            if (mouseHandlingMode == MouseHandlingMode.Capture)
2439
            {
2440
                Canvas.SetLeft(dragCaptureBorder, x);
2441
                Canvas.SetTop(dragCaptureBorder, y);
2442
                dragCaptureBorder.Width = width;
2443
                dragCaptureBorder.Height = height;
2444
            }
2445
            //선택 중
2446
            else if (mouseHandlingMode == MouseHandlingMode.Selecting)
2447
            {
2448
                Canvas.SetLeft(dragSelectionBorder, x);
2449
                Canvas.SetTop(dragSelectionBorder, y);
2450
                dragSelectionBorder.Width = width;
2451
                dragSelectionBorder.Height = height;
2452
            }
2453
            else
2454
            {
2455
                Canvas.SetLeft(dragZoomBorder, x);
2456
                Canvas.SetTop(dragZoomBorder, y);
2457
                dragZoomBorder.Width = width;
2458
                dragZoomBorder.Height = height;
2459
            }
2460
        }
2461

    
2462
        private void drawingPannelRotate(double angle)
2463
        {
2464
            Logger.sendCheckLog("pageNavigator_PageChanging_drawingPannelRotate Setting", 1);
2465
            rotate.Angle = angle;
2466
            var rotationNum = Math.Abs((rotate.Angle / 90));
2467

    
2468
            if (angle == 90 || angle == 270)
2469
            {
2470
                double emptySize = zoomAndPanCanvas.Width;
2471
                zoomAndPanCanvas.Width = zoomAndPanCanvas.Height;
2472
                zoomAndPanCanvas.Height = emptySize;
2473
            }
2474
            if (angle == 0)
2475
            {
2476
                translate.X = 0;
2477
                translate.Y = 0;
2478
            }
2479
            else if (angle == 90)
2480
            {
2481
                translate.X = zoomAndPanCanvas.Width;
2482
                translate.Y = 0;
2483
            }
2484
            else if (angle == 180)
2485
            {
2486
                translate.X = zoomAndPanCanvas.Width;
2487
                translate.Y = zoomAndPanCanvas.Height;
2488
            }
2489
            else
2490
            {
2491
                translate.X = 0;
2492
                translate.Y = zoomAndPanCanvas.Height;
2493
            }
2494

    
2495
            zoomAndPanControl.RotationAngle = rotate.Angle;
2496

    
2497
            if (!testPanel2.IsHidden)
2498
            {
2499
                zoomAndPanControl2.RotationAngle = rotate.Angle;
2500
                zoomAndPanCanvas2.Width = zoomAndPanCanvas.Width;
2501
                zoomAndPanCanvas2.Height = zoomAndPanCanvas.Height;
2502
            }
2503

    
2504
            ViewerDataModel.Instance.ContentWidth = zoomAndPanCanvas.Width;
2505
            ViewerDataModel.Instance.ContentHeight = zoomAndPanCanvas.Height;
2506
            ViewerDataModel.Instance.AngleOffsetX = translate.X;
2507
            ViewerDataModel.Instance.AngleOffsetY = translate.Y;
2508
            ViewerDataModel.Instance.MarkupAngle = rotate.Angle;
2509
        }
2510

    
2511
        private void syncPannelRotate(double angle)
2512
        {
2513
            //Logger.sendCheckLog("pageNavigator_PageChanging_drawingPannelRotate Setting", 1);
2514
            rotate.Angle = angle;
2515
            var rotationNum = Math.Abs((rotate.Angle / 90));
2516

    
2517
            if (angle == 90 || angle == 270)
2518
            {
2519
                double emptySize = zoomAndPanCanvas2.Width;
2520
                zoomAndPanCanvas2.Width = zoomAndPanCanvas2.Height;
2521
                zoomAndPanCanvas2.Height = emptySize;
2522
            }
2523
            if (angle == 0)
2524
            {
2525
                translate2.X = 0;
2526
                translate2.Y = 0;
2527
            }
2528
            else if (angle == 90)
2529
            {
2530
                translate2.X = zoomAndPanCanvas2.Width;
2531
                translate2.Y = 0;
2532
            }
2533
            else if (angle == 180)
2534
            {
2535
                translate2.X = zoomAndPanCanvas2.Width;
2536
                translate2.Y = zoomAndPanCanvas2.Height;
2537
            }
2538
            else
2539
            {
2540
                translate2.X = 0;
2541
                translate2.Y = zoomAndPanCanvas2.Height;
2542
            }
2543

    
2544
            zoomAndPanControl2.RotationAngle = rotate.Angle;
2545
        }
2546

    
2547
        public void PlaceImageSymbol(string id, long group_id, int SelectedIndex, Point canvasZoomPanningMouseDownPoint)
2548
        {
2549
            string Data_ = "";
2550

    
2551
            try
2552
            {
2553
                //Logger.sendReqLog("GetSymbolImageURL: ", id + "," + SelectedIndex, 1);
2554
                Data_ = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.GetSymbolImageURL(id, SelectedIndex);
2555
                if (Data_ != null || Data_ != "")
2556
                {
2557
                    //Logger.sendResLog("GetSymbolImageURL", "TRUE", 1);
2558
                }
2559
                else
2560
                {
2561
                    //Logger.sendResLog("GetSymbolImageURL", "FALSE", 1);
2562
                }
2563

    
2564
                //MARKUP_DATA_GROUP mARKUP_DATA_GROUP = new MARKUP_DATA_GROUP
2565
                //{
2566
                //    SYMBOL_ID = id,//InnerItem.Symbol_ID
2567
                //    STATE = 0,
2568
                //};
2569
                if (Data_ != null)
2570
                {
2571
                    Image img = new Image();
2572
                    //img.Source = new System.Windows.Media.Imaging.BitmapImage(new Uri(Data_));
2573
                    if (Data_.Contains(".svg"))
2574
                    {
2575
                        byte[] imageData = null;
2576
                        DrawingImage image = null;
2577
                        using (System.Net.WebClient web = new System.Net.WebClient())
2578
                        {
2579
                            imageData = web.DownloadData(new Uri(Data_));
2580
                            System.IO.Stream stream = new System.IO.MemoryStream(imageData);
2581
                            image = SvgReader.Load(stream);
2582
                        }
2583
                        img.Source = image;
2584
                    }
2585
                    else
2586
                    {
2587
                        img.Source = new BitmapImage(new Uri(Data_));
2588
                    }
2589

    
2590
                    var currentControl = new MarkupToPDF.Controls.Etc.ImgControl
2591
                    {
2592
                        PointSet = new List<Point>(),
2593
                        FilePath = Data_,
2594
                        ImageData = img.Source,
2595
                        StartPoint = canvasZoomPanningMouseDownPoint,
2596
                        EndPoint = new Point(canvasZoomPanningMouseDownPoint.X + img.Source.Width,
2597
                        canvasZoomPanningMouseDownPoint.Y + img.Source.Height),
2598
                        TopRightPoint = new Point(canvasZoomPanningMouseDownPoint.X + img.Source.Width,
2599
                        canvasZoomPanningMouseDownPoint.Y),
2600
                        LeftBottomPoint = new Point(canvasZoomPanningMouseDownPoint.X,
2601
                        canvasZoomPanningMouseDownPoint.Y + img.Source.Height)
2602
                    };
2603

    
2604
                    currentControl.PointSet = new List<Point>
2605
                                        {
2606
                                            currentControl.StartPoint,
2607
                                            currentControl.LeftBottomPoint,
2608
                                            currentControl.EndPoint,
2609
                                            currentControl.TopRightPoint,
2610
                                        };
2611
                    Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
2612
                    UndoData = new Undo_data()
2613
                    {
2614
                        IsUndo = false,
2615
                        Event = Event_Type.Create,
2616
                        EventTime = DateTime.Now,
2617
                        Markup_List = new List<Multi_Undo_data>()
2618
                    };
2619
                    ViewerDataModel.Instance.UndoDataList.Where(data1 => data1.IsUndo == true).ToList().ForEach(i =>
2620
                    {
2621
                        ViewerDataModel.Instance.UndoDataList.Remove(i);
2622
                    });
2623

    
2624
                    //multi_Undo_Data = dzMainMenu.Control_Style(currentControl as MarkupToPDF.Common.CommentUserInfo);
2625
                    multi_Undo_Data = Control_Style(currentControl as MarkupToPDF.Common.CommentUserInfo);
2626
                    UndoData.Markup_List.Add(multi_Undo_Data);
2627
                    ViewerDataModel.Instance.UndoDataList.Add(UndoData);
2628

    
2629
                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl as MarkupToPDF.Common.CommentUserInfo);
2630
                    currentControl.CommentID = Commons.shortGuid();
2631
                    currentControl.SymbolID = id;
2632
                    currentControl.GroupID = group_id;
2633
                    currentControl.ApplyTemplate();
2634
                    currentControl.SetImage();
2635

    
2636
                    ViewerDataModel.Instance.MarkupControls_USER.Remove(currentControl as MarkupToPDF.Common.CommentUserInfo);
2637
                    Controls.AdornerFinal final = new Controls.AdornerFinal(currentControl as MarkupToPDF.Common.CommentUserInfo);
2638
                    SelectLayer.Children.Add(final);
2639
                }
2640
            }
2641
            catch (Exception ex)
2642
            {
2643
                this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert(ex.Message, "Error");
2644
            }
2645
        }
2646

    
2647
        private async void zoomAndPanControl_MouseDown(object sender, MouseButtonEventArgs e)
2648
        {
2649
            var set_option = this.ParentOfType<MainWindow>().dzTopMenu.Parent.ChildrenOfType<RadNumericUpDown>().Where(item => item.IsKeyboardFocusWithin).FirstOrDefault();
2650
            if (set_option != null && !string.IsNullOrEmpty(set_option.ContentText))
2651
            {
2652
                set_option.Value = double.Parse(set_option.ContentText);
2653
                //set_option.Focusable = false;
2654
                zoomAndPanControl.Focus();
2655
            }
2656

    
2657
            ConvertInkControlToPolygon();
2658

    
2659
            // 텍스트가 없으면 삭제됨
2660
            var text_item = ViewerDataModel.Instance.MarkupControls_USER.Where(data =>
2661
            (data as TextControl) != null && (data as TextControl).Text == "" || (data as ArrowTextControl) != null && (data as ArrowTextControl).ArrowText == "").FirstOrDefault();
2662

    
2663
            if (text_item != null && (currentControl as ArrowTextControl) == null)
2664
            {
2665
                DeleteCommand.Instance.Execute(new[] { text_item });
2666
                //ViewerDataModel.Instance.MarkupControls_USER.Remove(text_item);
2667
            }
2668
            /// up to here
2669

    
2670
            foreach (var item in ViewerDataModel.Instance.MarkupControls_USER)
2671
            {
2672
                if (item as ArrowTextControl != null)
2673
                {
2674
                    (item as ArrowTextControl).Base_TextBox.IsHitTestVisible = false;
2675
                }
2676
                else if (item as TextControl != null)
2677
                {
2678
                    (item as TextControl).Base_TextBox.IsHitTestVisible = false;
2679
                }
2680
            }
2681

    
2682
            //if (currentControl != null)
2683
            {
2684
                var text_item_ = ViewerDataModel.Instance.MarkupControls_USER.Where(data => (data as TextControl) != null && (data as TextControl).IsEditingMode == true).FirstOrDefault();
2685
                if (text_item_ != null)
2686
                {
2687
                    (text_item_ as TextControl).Base_TextBlock.Visibility = Visibility.Visible;
2688
                    (text_item_ as TextControl).Base_TextBox.Visibility = Visibility.Collapsed;
2689
                    (text_item_ as TextControl).IsEditingMode = false;
2690
                    currentControl = null;
2691
                }
2692

    
2693
                var Arrowtext_item_ = ViewerDataModel.Instance.MarkupControls_USER.Where(data => (data as ArrowTextControl) != null && (data as ArrowTextControl).IsEditingMode == true).FirstOrDefault();
2694
                if (Arrowtext_item_ != null && ((Arrowtext_item_ as ArrowTextControl).IsNew == false))
2695
                {
2696
                    (Arrowtext_item_ as ArrowTextControl).IsEditingMode = false;
2697
                    (Arrowtext_item_ as ArrowTextControl).Base_TextBox.Focusable = false;
2698
                    currentControl = null;
2699
                }
2700
            }
2701

    
2702
            double Ang = 0;
2703
            if (rotate.Angle != 0)
2704
            {
2705
                Ang = 360 - rotate.Angle;
2706
            }
2707

    
2708
            if (e.OriginalSource is System.Windows.Controls.Image)
2709
            {
2710
                (e.OriginalSource as System.Windows.Controls.Image).Focus();
2711
            }
2712
            /*
2713
            if (mouseHandlingMode == MouseHandlingMode.DragSymbol && e.LeftButton == MouseButtonState.Pressed)
2714
            {
2715
                canvasZoomPanningMouseDownPoint = e.GetPosition(zoomAndPanCanvas);
2716
                if(symbol_id != null)
2717
                {
2718
                    PlaceImageSymbol(symbol_id, symbol_group_id, symbol_SelectedIndex, canvasZoomPanningMouseDownPoint);
2719
                }
2720
            }
2721

    
2722
            if (mouseHandlingMode == MouseHandlingMode.DragSymbol && e.RightButton == MouseButtonState.Pressed)
2723
            {
2724
                if (this._dragdropWindow != null)
2725
                {
2726
                    this._dragdropWindow.Close();
2727
                    this._dragdropWindow = null;
2728
                    symbol_id = null;
2729
                }
2730
            }
2731
            */
2732

    
2733
            if (e.LeftButton == MouseButtonState.Pressed)
2734
            {
2735
                CanvasDrawingMouseDownPoint = e.GetPosition(drawingRotateCanvas);
2736
                canvasZoomPanningMouseDownPoint = e.GetPosition(zoomAndPanCanvas);
2737

    
2738
                this.cursor = new Cursor(App.DefaultArrowCursorStream);
2739
                SetCursor();
2740

    
2741
                if (!ViewerDataModel.Instance.IsPressCtrl)
2742
                {
2743
                    SelectionSet.Instance.UnSelect(this);
2744
                }
2745
            }
2746

    
2747
            if (e.MiddleButton == MouseButtonState.Pressed)
2748
            {
2749
                canvasZoommovingMouseDownPoint = e.GetPosition(zoomAndPanCanvas);
2750
                cursor = Cursors.SizeAll;
2751
                SetCursor();
2752
            }
2753
            if (e.RightButton == MouseButtonState.Pressed)
2754
            {
2755
                canvasZoommovingMouseDownPoint = e.GetPosition(zoomAndPanCanvas);
2756
                cursor = Cursors.SizeAll;
2757
                SetCursor();
2758
            }
2759
            else if (e.XButton1 == MouseButtonState.Pressed)
2760
            {
2761
                if (this.pageNavigator.CurrentPage.PageNumber + 1 <= this.pageNavigator.PageCount)
2762
                {
2763
                    this.pageNavigator.GotoPage(this.pageNavigator.CurrentPage.PageNumber + 1);
2764
                }
2765

    
2766
                //this.pageNavigator.GotoPage(this.pageNavigator._NextPage.PageNumber);
2767
            }
2768
            else if (e.XButton2 == MouseButtonState.Pressed)
2769
            {
2770
                if (this.pageNavigator.CurrentPage.PageNumber > 1)
2771
                {
2772
                    this.pageNavigator.GotoPage(this.pageNavigator.CurrentPage.PageNumber - 1);
2773
                }
2774
            }
2775

    
2776
            if (e.LeftButton == MouseButtonState.Pressed && mouseHandlingMode != MouseHandlingMode.Drawing && currentControl == null)
2777
            {
2778
                if (mouseHandlingMode == MouseHandlingMode.Selecting)
2779
                {
2780
                    if (SelectLayer.Children.Count == 0)
2781
                    {
2782
                        isLeftMouseButtonDownOnWindow = true;
2783
                        mouseHandlingMode = MouseHandlingMode.Selecting;
2784
                    }
2785

    
2786
                    if (controlType == ControlType.None)
2787
                    {
2788
                        isLeftMouseButtonDownOnWindow = true;
2789
                    }
2790
                }
2791

    
2792
                /// 캡쳐 모드 설정
2793
                if (mouseHandlingMode == MouseHandlingMode.Capture)
2794
                {
2795
                    dragCaptureBorder.Visibility = Visibility.Visible;
2796
                    isLeftMouseButtonDownOnWindow = true;
2797
                }
2798

    
2799
                /// 줌 모드 설정
2800
                if (mouseHandlingMode == MouseHandlingMode.DragZoom)
2801
                {
2802
                    isLeftMouseButtonDownOnWindow = true;
2803
                }
2804

    
2805
                var control = ViewerDataModel.Instance.MarkupControls_USER.Where(data => data.IsMouseEnter).FirstOrDefault();
2806

    
2807
                if (control == null)
2808
                {
2809
                    ViewerDataModel.Instance.SetAngleVisible(Visibility.Collapsed);
2810
                }
2811
                else
2812
                {
2813
                    if (ControlTypeExtansions.LineTypes.Contains(control.ControlType))
2814
                    {
2815
                        ViewerDataModel.Instance.SetAngleVisible(Visibility.Visible);
2816
                    }
2817

    
2818
                    AdornerFinal final = null;
2819

    
2820
                    if (!ViewerDataModel.Instance.IsPressCtrl)
2821
                    {
2822
                        /// 기존 selection 해제
2823
                        SelectionSet.Instance.UnSelect(this);
2824

    
2825
                        final = new AdornerFinal(control);
2826

    
2827
                        this.Control_Style(control);
2828

    
2829
                        if ((control as IPath) != null)
2830
                        {
2831
                            if ((control as IPath).LineSize != 0)
2832
                            {
2833
                                ViewerDataModel.Instance.LineSize = (control as IPath).LineSize;
2834
                            }
2835
                        }
2836
                        if ((control as IShapeControl) != null)
2837
                        {
2838
                            if ((control as IShapeControl).Paint == PaintSet.Hatch)
2839
                            {
2840
                                ViewerDataModel.Instance.checkHatchShape = true;
2841
                            }
2842
                            else if ((control as IShapeControl).Paint == PaintSet.Fill)
2843
                            {
2844
                                ViewerDataModel.Instance.checkFillShape = true;
2845
                            }
2846
                            else
2847
                            {
2848
                                ViewerDataModel.Instance.checkHatchShape = false;
2849
                                ViewerDataModel.Instance.checkFillShape = false;
2850
                            }
2851
                            ViewerDataModel.Instance.paintSet = (control as IShapeControl).Paint;
2852
                        }
2853

    
2854
                        ViewerDataModel.Instance.ControlOpacity = control.Opacity;
2855

    
2856
                        if ((control as TextControl) != null)
2857
                        {
2858
                            ViewerDataModel.Instance.SystemMain.dzTopMenu.SetFont((control as TextControl).TextFamily);
2859

    
2860
                            if (!((control as TextControl).EnableEditing))
2861
                            {
2862
                                (control as TextControl).EnableEditing = true;
2863
                            }
2864
                            if ((control as TextControl).TextStyle == FontStyles.Italic)
2865
                            {
2866
                                ViewerDataModel.Instance.checkTextStyle = true;
2867
                            }
2868
                            else
2869
                            {
2870
                                ViewerDataModel.Instance.checkTextStyle = false;
2871
                            }
2872
                            if ((control as TextControl).TextWeight == FontWeights.Bold)
2873
                            {
2874
                                ViewerDataModel.Instance.checkTextWeight = true;
2875
                            }
2876
                            else
2877
                            {
2878
                                ViewerDataModel.Instance.checkTextWeight = false;
2879
                            }
2880
                            if ((control as TextControl).UnderLine == TextDecorations.Underline)
2881
                            {
2882
                                ViewerDataModel.Instance.checkUnderLine = true;
2883
                            }
2884
                            else
2885
                            {
2886
                                ViewerDataModel.Instance.checkUnderLine = false;
2887
                            }
2888
                            ViewerDataModel.Instance.TextSize = (control as TextControl).TextSize;
2889
                            ViewerDataModel.Instance.checkHighlight = (control as TextControl).IsHighLight;
2890
                        }
2891
                        else if ((control as ArrowTextControl) != null)
2892
                        {
2893
                            ViewerDataModel.Instance.SystemMain.dzTopMenu.SetFont((control as ArrowTextControl).TextFamily);
2894

    
2895
                            if (!((control as ArrowTextControl).EnableEditing))
2896
                            {
2897
                                (control as ArrowTextControl).EnableEditing = true;
2898
                            }
2899
                            if ((control as ArrowTextControl).TextStyle == FontStyles.Italic)
2900
                            {
2901
                                ViewerDataModel.Instance.checkTextStyle = true;
2902
                            }
2903
                            else
2904
                            {
2905
                                ViewerDataModel.Instance.checkTextStyle = false;
2906
                            }
2907
                            if ((control as ArrowTextControl).TextWeight == FontWeights.Bold)
2908
                            {
2909
                                ViewerDataModel.Instance.checkTextWeight = true;
2910
                            }
2911
                            else
2912
                            {
2913
                                ViewerDataModel.Instance.checkTextWeight = false;
2914
                            }
2915
                            if ((control as ArrowTextControl).UnderLine == TextDecorations.Underline)
2916
                            {
2917
                                ViewerDataModel.Instance.checkUnderLine = true;
2918
                            }
2919
                            else
2920
                            {
2921
                                ViewerDataModel.Instance.checkUnderLine = false;
2922
                            }
2923
                            ViewerDataModel.Instance.checkHighlight = (control as ArrowTextControl).isHighLight;
2924
                            ViewerDataModel.Instance.TextSize = (control as ArrowTextControl).TextSize;
2925
                        }
2926
                        else if ((control as RectCloudControl) != null)
2927
                        {
2928
                            ViewerDataModel.Instance.ArcLength = (control as RectCloudControl).ArcLength;
2929
                        }
2930
                        else if ((control as CloudControl) != null)
2931
                        {
2932
                            ViewerDataModel.Instance.ArcLength = (control as CloudControl).ArcLength;
2933
                        }
2934
                    }
2935
                    else
2936
                    {
2937
                        List<CommentUserInfo> comment = SelectionSet.Instance.SelectedItems;
2938
                        SelectionSet.Instance.UnSelect(this);
2939
                        comment.Add(control);
2940

    
2941
                        Control_Style(control);
2942

    
2943
                        final = new AdornerFinal(comment);
2944
                    }
2945

    
2946
                    if (final != null)
2947
                    {
2948
                        this.SelectLayer.Children.Add(final);
2949
                    }
2950
                }
2951
            }
2952
            else if (mouseHandlingMode == MouseHandlingMode.Drawing)
2953
            {
2954
                init();
2955
                //강인구 추가(우 클릭 일 경우 커서 변경 하지 않음)
2956
                if (cursor != Cursors.SizeAll)
2957
                {
2958
                    cursor = Cursors.Cross;
2959
                    SetCursor();
2960
                }
2961
                bool init_user = false;
2962
                foreach (var user in gridViewMarkup.Items)
2963
                {
2964
                    if ((user as MarkupInfoItem).UserID == App.ViewInfo.UserID)
2965
                    {
2966
                        init_user = true;
2967
                    }
2968
                }
2969
                if (init_user && gridViewMarkup.SelectedItems.Where(d => (d as MarkupInfoItem).UserID == App.ViewInfo.UserID).FirstOrDefault() == null && e.LeftButton == MouseButtonState.Pressed)
2970
                {
2971
                    // 기존의 코멘트가 존재합니다. 사용자 리스트에서 먼저 선택해주세요
2972
                    RadWindow.Alert(new DialogParameters
2973
                    {
2974
                        Owner = Application.Current.MainWindow,
2975
                        Theme = new VisualStudio2013Theme(),
2976
                        Header = "Info",
2977
                        Content = "Existing comments already existed. Select from the user list first",
2978
                    });
2979
                    return;
2980
                }
2981
                else
2982
                {
2983
                    var item = gridViewMarkup.SelectedItems.Where(d => (d as MarkupInfoItem).UserID == App.ViewInfo.UserID).FirstOrDefault() as MarkupInfoItem;
2984
                    if (item != null)
2985
                    {
2986
                        App.Custom_ViewInfoId = item.MarkupInfoID;
2987
                    }
2988
                }
2989

    
2990
                switch (controlType)
2991
                {
2992
                    case ControlType.Coordinate:
2993
                        {
2994
                            if (e.LeftButton == MouseButtonState.Pressed)
2995
                            {
2996
                                if (currentControl is CoordinateControl)
2997
                                {
2998
                                    if (IsGetoutpoint((currentControl as CoordinateControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
2999
                                    {
3000
                                        return;
3001
                                    }
3002

    
3003
                                    CreateCommand.Instance.Execute(currentControl);
3004

    
3005
                                    currentControl = null;
3006
                                    this.cursor = Cursors.Arrow;
3007
                                }
3008
                                else
3009
                                {
3010
                                    this.ParentOfType<MainWindow>().dzTopMenu._SaveEvent(null, null);
3011
                                    if (ViewerDataModel.Instance.MyMarkupList.Where(d => d.PageNumber == Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber
3012
                                     && d.Data_Type == Convert.ToInt32(MarkupToPDF.Controls.Common.ControlType.Coordinate)).Count() > 0)
3013
                                    {
3014
                                        currentControl = null;
3015
                                        this.cursor = Cursors.Arrow;
3016
                                        Common.ViewerDataModel.Instance.SystemMain.DialogMessage_Alert("이미 해당 페이지의 도면 영역을 설정하셨습니다.", "Notice");
3017
                                        return;
3018
                                    }
3019
                                    else
3020
                                    {
3021
                                        currentControl = new CoordinateControl
3022
                                        {
3023
                                            Background = new SolidColorBrush(Colors.Black),
3024
                                            StartPoint = this.CanvasDrawingMouseDownPoint,
3025
                                            ControlType = ControlType.Coordinate
3026
                                        };
3027

    
3028
                                        currentControl.CommentID = Commons.shortGuid();
3029
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3030
                                        currentControl.IsNew = true;
3031

    
3032
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3033

    
3034
                                        currentControl.SetValue(Canvas.ZIndexProperty, 3);
3035
                                    }
3036
                                }
3037
                            }
3038
                        }
3039
                        break;
3040

    
3041
                    case ControlType.InsideWhite:
3042
                        {
3043
                            if (e.LeftButton == MouseButtonState.Pressed)
3044
                            {
3045
                                if (currentControl is InsideWhiteControl)
3046
                                {
3047
                                    if (IsGetoutpoint((currentControl as InsideWhiteControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3048
                                    {
3049
                                        return;
3050
                                    }
3051

    
3052
                                    CreateCommand.Instance.Execute(currentControl);
3053

    
3054
                                    currentControl = null;
3055
                                    this.cursor = Cursors.Arrow;
3056
                                }
3057
                                else
3058
                                {
3059
                                    currentControl = new InsideWhiteControl
3060
                                    {
3061
                                        Background = new SolidColorBrush(Colors.Black),
3062
                                        StartPoint = this.CanvasDrawingMouseDownPoint,
3063
                                        ControlType = ControlType.InsideWhite
3064
                                    };
3065

    
3066
                                    currentControl.CommentID = Commons.shortGuid();
3067
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3068
                                    currentControl.IsNew = true;
3069
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3070

    
3071
                                    currentControl.SetValue(Canvas.ZIndexProperty, 3);
3072
                                }
3073
                            }
3074
                        }
3075
                        break;
3076

    
3077
                    case ControlType.OverlapWhite:
3078
                        {
3079
                            if (e.LeftButton == MouseButtonState.Pressed)
3080
                            {
3081
                                if (currentControl is OverlapWhiteControl)
3082
                                {
3083
                                    if (IsGetoutpoint((currentControl as OverlapWhiteControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3084
                                    {
3085
                                        return;
3086
                                    }
3087

    
3088
                                    CreateCommand.Instance.Execute(currentControl);
3089

    
3090
                                    currentControl = null;
3091
                                    this.cursor = Cursors.Arrow;
3092
                                }
3093
                                else
3094
                                {
3095
                                    currentControl = new OverlapWhiteControl
3096
                                    {
3097
                                        Background = new SolidColorBrush(Colors.Black),
3098
                                        StartPoint = this.CanvasDrawingMouseDownPoint,
3099
                                        ControlType = ControlType.OverlapWhite
3100
                                    };
3101

    
3102
                                    currentControl.CommentID = Commons.shortGuid();
3103
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3104
                                    currentControl.IsNew = true;
3105
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3106

    
3107
                                    currentControl.SetValue(Canvas.ZIndexProperty, 3);
3108
                                }
3109
                            }
3110
                        }
3111
                        break;
3112

    
3113
                    case ControlType.ClipWhite:
3114
                        {
3115
                            if (e.LeftButton == MouseButtonState.Pressed)
3116
                            {
3117
                                if (currentControl is ClipWhiteControl)
3118
                                {
3119
                                    if (IsGetoutpoint((currentControl as ClipWhiteControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3120
                                    {
3121
                                        return;
3122
                                    }
3123

    
3124
                                    CreateCommand.Instance.Execute(currentControl);
3125

    
3126
                                    currentControl = null;
3127
                                    this.cursor = Cursors.Arrow;
3128
                                }
3129
                                else
3130
                                {
3131
                                    currentControl = new ClipWhiteControl
3132
                                    {
3133
                                        Background = new SolidColorBrush(Colors.Black),
3134
                                        StartPoint = this.CanvasDrawingMouseDownPoint,
3135
                                        ControlType = ControlType.ClipWhite
3136
                                    };
3137

    
3138
                                    currentControl.CommentID = Commons.shortGuid();
3139
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3140
                                    currentControl.IsNew = true;
3141
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3142

    
3143
                                    currentControl.SetValue(Canvas.ZIndexProperty, 3);
3144
                                }
3145
                            }
3146
                        }
3147
                        break;
3148

    
3149
                    case ControlType.Rectangle:
3150
                        {
3151
                            if (e.LeftButton == MouseButtonState.Pressed)
3152
                            {
3153
                                if (currentControl is RectangleControl)
3154
                                {
3155
                                    //20180906 LJY TEST IsRotationDrawingEnable
3156
                                    if (IsGetoutpoint((currentControl as RectangleControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3157
                                    {
3158
                                        return;
3159
                                    }
3160

    
3161
                                    CreateCommand.Instance.Execute(currentControl);
3162
                                    currentControl = null;
3163
                                    this.cursor = new Cursor(App.DefaultArrowCursorStream);
3164
                                }
3165
                                else
3166
                                {
3167
                                    currentControl = new RectangleControl
3168
                                    {
3169
                                        Background = new SolidColorBrush(Colors.Black),
3170
                                        StartPoint = this.CanvasDrawingMouseDownPoint,
3171
                                        ControlType = ControlType.Rectangle
3172
                                    };
3173

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

    
3179
                                    currentControl.SetValue(Canvas.ZIndexProperty, 3);
3180
                                }
3181
                            }
3182
                        }
3183
                        break;
3184

    
3185
                    case ControlType.RectCloud:
3186
                        {
3187
                            if (e.LeftButton == MouseButtonState.Pressed)
3188
                            {
3189
                                if (currentControl is RectCloudControl)
3190
                                {
3191
                                    //20180906 LJY TEST IsRotationDrawingEnable
3192
                                    if (IsGetoutpoint((currentControl as RectCloudControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3193
                                    {
3194
                                        return;
3195
                                    }
3196

    
3197
                                    CreateCommand.Instance.Execute(currentControl);
3198

    
3199
                                    currentControl = null;
3200

    
3201
                                    this.cursor = new Cursor(App.DefaultArrowCursorStream);
3202
                                }
3203
                                else
3204
                                {
3205
                                    currentControl = new RectCloudControl
3206
                                    {
3207
                                        StartPoint = this.CanvasDrawingMouseDownPoint,
3208
                                        ControlType = ControlType.RectCloud,
3209
                                        Background = new SolidColorBrush(Colors.Black)
3210
                                    };
3211

    
3212
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3213
                                    currentControl.CommentID = Commons.shortGuid();
3214
                                    currentControl.IsNew = true;
3215
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3216
                                }
3217
                            }
3218
                        }
3219
                        break;
3220

    
3221
                    case ControlType.Circle:
3222
                        {
3223
                            if (e.LeftButton == MouseButtonState.Pressed)
3224
                            {
3225
                                if (currentControl is CircleControl)
3226
                                {
3227
                                    //20180906 LJY TEST IsRotationDrawingEnable
3228
                                    if (IsGetoutpoint((currentControl as CircleControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3229
                                    {
3230
                                        return;
3231
                                    }
3232

    
3233
                                    CreateCommand.Instance.Execute(currentControl);
3234

    
3235
                                    currentControl = null;
3236
                                }
3237
                                else
3238
                                {
3239
                                    currentControl = new CircleControl
3240
                                    {
3241
                                        StartPoint = this.CanvasDrawingMouseDownPoint,
3242
                                        LeftBottomPoint = this.CanvasDrawingMouseDownPoint,
3243
                                        Background = new SolidColorBrush(Colors.Black)
3244
                                    };
3245

    
3246
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3247
                                    currentControl.CommentID = Commons.shortGuid();
3248
                                    currentControl.IsNew = true;
3249
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3250
                                }
3251
                            }
3252
                        }
3253
                        break;
3254

    
3255
                    case ControlType.Triangle:
3256
                        {
3257
                            if (e.LeftButton == MouseButtonState.Pressed)
3258
                            {
3259
                                if (currentControl is TriControl)
3260
                                {
3261
                                    var content = currentControl as TriControl;
3262
                                    if (content.MidPoint == new Point(0, 0))
3263
                                    {
3264
                                        content.MidPoint = new Point(CanvasDrawingMouseDownPoint.X, CanvasDrawingMouseDownPoint.Y);
3265
                                    }
3266
                                    else
3267
                                    {
3268
                                        //20180906 LJY TEST IsRotationDrawingEnable
3269
                                        if (IsGetoutpoint((currentControl as TriControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3270
                                        {
3271
                                            return;
3272
                                        }
3273

    
3274
                                        CreateCommand.Instance.Execute(currentControl);
3275

    
3276
                                        currentControl = null;
3277
                                    }
3278
                                }
3279
                                else
3280
                                {
3281
                                    currentControl = new TriControl
3282
                                    {
3283
                                        StartPoint = new Point(CanvasDrawingMouseDownPoint.X, CanvasDrawingMouseDownPoint.Y),
3284
                                        Background = new SolidColorBrush(Colors.Black),
3285
                                    };
3286

    
3287
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3288
                                    currentControl.CommentID = Commons.shortGuid();
3289
                                    currentControl.IsNew = true;
3290
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3291
                                }
3292
                            }
3293
                        }
3294
                        break;
3295

    
3296
                    case ControlType.CancelLine:
3297
                    case ControlType.SingleLine:
3298
                    case ControlType.ArrowLine:
3299
                    case ControlType.TwinLine:
3300
                    case ControlType.DimLine:
3301
                        {
3302
                            if (e.LeftButton == MouseButtonState.Pressed)
3303
                            {
3304
                                if (currentControl is LineControl)
3305
                                {
3306
                                    //20180906 LJY TEST IsRotationDrawingEnable
3307
                                    if (IsGetoutpoint((currentControl as LineControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3308
                                    {
3309
                                        return;
3310
                                    }
3311

    
3312
                                    CreateCommand.Instance.Execute(currentControl);
3313
                                    currentControl = null;
3314
                                    ViewerDataModel.Instance.SetAngleVisible(Visibility.Collapsed);
3315
                                }
3316
                                else
3317
                                {
3318
                                    currentControl = new LineControl
3319
                                    {
3320
                                        ControlType = this.controlType,
3321
                                        StartPoint = new Point(CanvasDrawingMouseDownPoint.X, CanvasDrawingMouseDownPoint.Y),
3322
                                        Background = new SolidColorBrush(Colors.Black)
3323
                                    };
3324

    
3325
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3326
                                    currentControl.CommentID = Commons.shortGuid();
3327
                                    currentControl.IsNew = true;
3328
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3329
                                    ViewerDataModel.Instance.SetAngleVisible(Visibility.Visible);
3330
                                }
3331
                            }
3332
                        }
3333
                        break;
3334

    
3335
                    case ControlType.PolygonControl:
3336
                        {
3337
                            if (currentControl is PolygonControl)
3338
                            {
3339
                                var control = currentControl as PolygonControl;
3340

    
3341
                                if (e.RightButton == MouseButtonState.Pressed)
3342
                                {
3343
                                    control.IsCompleted = true;
3344
                                }
3345

    
3346
                                if (!control.IsCompleted)
3347
                                {
3348
                                    control.PointSet.Add(control.EndPoint);
3349
                                }
3350
                                else
3351
                                {
3352
                                    //20180906 LJY TEST IsRotationDrawingEnable
3353
                                    if (IsGetoutpoint((currentControl as PolygonControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3354
                                    {
3355
                                        return;
3356
                                    }
3357

    
3358
                                    var firstPoint = control.PointSet.First();
3359
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
3360
                                    control.LineSize = ViewerDataModel.Instance.LineSize;
3361
                                    control.PointSet.Add(firstPoint);
3362

    
3363
                                    control.ApplyOverViewData();
3364

    
3365
                                    CreateCommand.Instance.Execute(currentControl);
3366
                                    control.UpdateControl();
3367
                                    currentControl = null;
3368
                                }
3369
                            }
3370
                            else
3371
                            {
3372
                                if (e.LeftButton == MouseButtonState.Pressed)
3373
                                {
3374
                                    currentControl = new PolygonControl
3375
                                    {
3376
                                        PointSet = new List<Point>(),
3377
                                    };
3378

    
3379
                                    var polygonControl = (currentControl as PolygonControl);
3380
                                    currentControl.CommentID = Commons.shortGuid();
3381
                                    currentControl.IsNew = true;
3382
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3383
                                    polygonControl.StartPoint = CanvasDrawingMouseDownPoint;
3384
                                    polygonControl.EndPoint = CanvasDrawingMouseDownPoint;
3385
                                    polygonControl.PointSet.Add(CanvasDrawingMouseDownPoint);
3386
                                    polygonControl.PointSet.Add(CanvasDrawingMouseDownPoint);
3387
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3388
                                    polygonControl.ApplyTemplate();
3389
                                    polygonControl.Visibility = Visibility.Visible;
3390
                                }
3391
                            }
3392
                        }
3393
                        break;
3394

    
3395
                    case ControlType.ChainLine:
3396
                        {
3397
                            if (currentControl is PolygonControl)
3398
                            {
3399
                                var control = currentControl as PolygonControl;
3400

    
3401
                                if (e.RightButton == MouseButtonState.Pressed)
3402
                                {
3403
                                    //20180906 LJY TEST IsRotationDrawingEnable
3404
                                    if (IsGetoutpoint((currentControl as PolygonControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3405
                                    {
3406
                                        return;
3407
                                    }
3408

    
3409
                                    CreateCommand.Instance.Execute(currentControl);
3410

    
3411
                                    currentControl = null;
3412
                                    ViewerDataModel.Instance.SetAngleVisible(Visibility.Collapsed);
3413
                                    return;
3414
                                }
3415

    
3416
                                if (!control.IsCompleted)
3417
                                {
3418
                                    control.PointSet.Add(control.EndPoint);
3419
                                    ViewerDataModel.Instance.SetAngleVisible(Visibility.Visible);
3420
                                }
3421
                            }
3422
                            else
3423
                            {
3424
                                if (e.LeftButton == MouseButtonState.Pressed)
3425
                                {
3426
                                    MainAngle.Visibility = Visibility.Visible;
3427
                                    currentControl = new PolygonControl
3428
                                    {
3429
                                        PointSet = new List<Point>(),
3430
                                        //강인구 추가(ChainLine일때는 채우기 스타일을 주지 않기 위해 설정)
3431
                                        ControlType = ControlType.ChainLine,
3432
                                        DashSize = ViewerDataModel.Instance.DashSize,
3433
                                        LineSize = ViewerDataModel.Instance.LineSize,
3434
                                        //PointC = new StylusPointSet()
3435
                                    };
3436

    
3437
                                    //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3438
                                    //{
3439
                                    var polygonControl = (currentControl as PolygonControl);
3440
                                    currentControl.CommentID = Commons.shortGuid();
3441
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3442
                                    currentControl.IsNew = true;
3443
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3444
                                    //currentControl.OnApplyTemplate();
3445
                                    //polygonControl.PointC.pointSet.Add(canvasDrawingMouseDownPoint);
3446
                                    //polygonControl.PointC.pointSet.Add(canvasDrawingMouseDownPoint);
3447
                                    polygonControl.PointSet.Add(CanvasDrawingMouseDownPoint);
3448
                                    polygonControl.PointSet.Add(CanvasDrawingMouseDownPoint);
3449
                                    //}
3450
                                }
3451
                            }
3452
                        }
3453
                        break;
3454

    
3455
                    case ControlType.ArcLine:
3456
                        {
3457
                            if (e.LeftButton == MouseButtonState.Pressed)
3458
                            {
3459
                                if (currentControl is ArcControl)
3460
                                {
3461
                                    //20180906 LJY TEST IsRotationDrawingEnable
3462
                                    if (IsGetoutpoint((currentControl as ArcControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3463
                                    {
3464
                                        return;
3465
                                    }
3466

    
3467
                                    CreateCommand.Instance.Execute(currentControl);
3468

    
3469
                                    currentControl = null;
3470
                                    ViewerDataModel.Instance.SetAngleVisible(Visibility.Collapsed);
3471
                                }
3472
                                else
3473
                                {
3474
                                    currentControl = new ArcControl
3475
                                    {
3476
                                        StartPoint = new Point(CanvasDrawingMouseDownPoint.X, CanvasDrawingMouseDownPoint.Y),
3477
                                        Background = new SolidColorBrush(Colors.Black)
3478
                                    };
3479
                                    currentControl.CommentID = Commons.shortGuid();
3480
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3481
                                    currentControl.IsNew = true;
3482
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3483
                                    ViewerDataModel.Instance.SetAngleVisible(Visibility.Visible);
3484
                                }
3485
                            }
3486
                            else if (e.RightButton == MouseButtonState.Pressed)
3487
                            {
3488
                                if (currentControl != null)
3489
                                {
3490
                                    (currentControl as ArcControl).setClock();
3491
                                    (currentControl as ArcControl).MidPoint = new Point(0, 0);
3492
                                }
3493
                            }
3494
                        }
3495
                        break;
3496

    
3497
                    case ControlType.ArcArrow:
3498
                        {
3499
                            if (e.LeftButton == MouseButtonState.Pressed)
3500
                            {
3501
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3502
                                //{
3503
                                if (currentControl is ArrowArcControl)
3504
                                {
3505
                                    //20180906 LJY TEST IsRotationDrawingEnable
3506
                                    if (IsGetoutpoint((currentControl as ArrowArcControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3507
                                    {
3508
                                        return;
3509
                                    }
3510

    
3511
                                    CreateCommand.Instance.Execute(currentControl);
3512

    
3513
                                    currentControl = null;
3514
                                    ViewerDataModel.Instance.SetAngleVisible(Visibility.Collapsed);
3515
                                }
3516
                                else
3517
                                {
3518
                                    currentControl = new ArrowArcControl
3519
                                    {
3520
                                        StartPoint = new Point(CanvasDrawingMouseDownPoint.X, CanvasDrawingMouseDownPoint.Y),
3521
                                        Background = new SolidColorBrush(Colors.Black)
3522
                                    };
3523
                                    currentControl.CommentID = Commons.shortGuid();
3524
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3525
                                    currentControl.IsNew = true;
3526
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3527
                                    ViewerDataModel.Instance.SetAngleVisible(Visibility.Visible);
3528
                                }
3529
                                //}
3530
                            }
3531
                            else if (e.RightButton == MouseButtonState.Pressed)
3532
                            {
3533
                                if (currentControl != null)
3534
                                {
3535
                                    (currentControl as ArrowArcControl).setClock();
3536
                                    (currentControl as ArrowArcControl).MiddlePoint = new Point(0, 0);
3537
                                    //(currentControl as ArcControl).ApplyTemplate();
3538
                                }
3539
                            }
3540
                        }
3541
                        break;
3542

    
3543
                    case ControlType.ArrowMultiLine:
3544
                        {
3545
                            if (e.LeftButton == MouseButtonState.Pressed)
3546
                            {
3547
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3548
                                //{
3549
                                if (currentControl is ArrowControl_Multi)
3550
                                {
3551
                                    var content = currentControl as ArrowControl_Multi;
3552
                                    if (content.MiddlePoint == new Point(0, 0))
3553
                                    {
3554
                                        if (ViewerDataModel.Instance.IsAxisLock || ViewerDataModel.Instance.IsPressShift)
3555
                                        {
3556
                                            content.MiddlePoint = content.EndPoint;
3557
                                        }
3558
                                        else
3559
                                        {
3560
                                            content.MiddlePoint = new Point(CanvasDrawingMouseDownPoint.X, CanvasDrawingMouseDownPoint.Y);
3561
                                        }
3562
                                    }
3563
                                    else
3564
                                    {
3565
                                        //20180906 LJY TEST IsRotationDrawingEnable
3566
                                        if (IsGetoutpoint((currentControl as ArrowControl_Multi).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3567
                                        {
3568
                                            return;
3569
                                        }
3570

    
3571
                                        CreateCommand.Instance.Execute(currentControl);
3572

    
3573
                                        currentControl = null;
3574
                                        ViewerDataModel.Instance.SetAngleVisible(Visibility.Collapsed);
3575
                                    }
3576
                                }
3577
                                else
3578
                                {
3579
                                    currentControl = new ArrowControl_Multi
3580
                                    {
3581
                                        StartPoint = new Point(CanvasDrawingMouseDownPoint.X, CanvasDrawingMouseDownPoint.Y),
3582
                                        Background = new SolidColorBrush(Colors.Black)
3583
                                    };
3584
                                    currentControl.CommentID = Commons.shortGuid();
3585
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3586
                                    currentControl.IsNew = true;
3587
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3588
                                    ViewerDataModel.Instance.SetAngleVisible(Visibility.Visible);
3589
                                }
3590
                                //}
3591
                            }
3592
                        }
3593
                        break;
3594

    
3595
                    case ControlType.PolygonCloud:
3596
                        {
3597
                            if (currentControl is CloudControl)
3598
                            {
3599
                                var control = currentControl as CloudControl;
3600
                                if (e.RightButton == MouseButtonState.Pressed)
3601
                                {
3602
                                    control.IsCompleted = true;
3603
                                }
3604

    
3605
                                if (!control.IsCompleted)
3606
                                {
3607
                                    control.PointSet.Add(control.EndPoint);
3608
                                }
3609
                                else
3610
                                {
3611
                                    //20180906 LJY TEST IsRotationDrawingEnable
3612
                                    if (IsGetoutpoint((currentControl as CloudControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3613
                                    {
3614
                                        return;
3615
                                    }
3616

    
3617
                                    CreateCommand.Instance.Execute(currentControl);
3618

    
3619
                                    control.isTransOn = true;
3620
                                    var firstPoint = control.PointSet.First();
3621

    
3622
                                    control.PointSet.Add(firstPoint);
3623
                                    control.DrawingCloud();
3624
                                    control.ApplyOverViewData();
3625

    
3626
                                    currentControl = null;
3627
                                }
3628
                            }
3629
                            else
3630
                            {
3631
                                if (e.LeftButton == MouseButtonState.Pressed)
3632
                                {
3633
                                    currentControl = new CloudControl
3634
                                    {
3635
                                        PointSet = new List<Point>(),
3636
                                        PointC = new StylusPointSet()
3637
                                    };
3638

    
3639
                                    //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3640
                                    //{
3641
                                    var polygonControl = (currentControl as CloudControl);
3642
                                    currentControl.CommentID = Commons.shortGuid();
3643
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3644
                                    currentControl.IsNew = true;
3645
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3646

    
3647
                                    polygonControl.PointSet.Add(CanvasDrawingMouseDownPoint);
3648
                                    polygonControl.PointSet.Add(CanvasDrawingMouseDownPoint);
3649

    
3650
                                    //}
3651
                                }
3652
                            }
3653
                        }
3654
                        break;
3655

    
3656
                    case ControlType.ImgControl:
3657
                        {
3658
                            if (e.LeftButton == MouseButtonState.Pressed)
3659
                            {
3660
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3661
                                //{
3662
                                if (currentControl is ImgControl)
3663
                                {
3664
                                    //20180906 LJY TEST IsRotationDrawingEnable
3665
                                    if (IsGetoutpoint((currentControl as ImgControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3666
                                    {
3667
                                        return;
3668
                                    }
3669

    
3670
                                    CreateCommand.Instance.Execute(currentControl);
3671
                                    controlType = ControlType.ImgControl;
3672
                                    currentControl = null;
3673
                                }
3674
                                else
3675
                                {
3676
                                    string extension = System.IO.Path.GetExtension(filename).ToUpper();
3677
                                    if (extension == ".PNG" || extension == ".JPEG" || extension == ".GIF" || extension == ".BMP" || extension == ".JPG" || extension == ".SVG")
3678
                                    {
3679
                                        UriBuilder downloadUri = new UriBuilder(App.BaseAddress);
3680
                                        UriBuilder uri = new UriBuilder(filename);
3681
                                        uri.Host = downloadUri.Host;
3682
                                        uri.Port = downloadUri.Port;
3683

    
3684
                                        Image img = new Image();
3685
                                        if (filename.Contains(".svg"))
3686
                                        {
3687
                                            byte[] imageData = null;
3688
                                            DrawingImage image = null;
3689
                                            using (System.Net.WebClient web = new System.Net.WebClient())
3690
                                            {
3691
                                                imageData = web.DownloadData(uri.Uri);
3692
                                                System.IO.Stream stream = new System.IO.MemoryStream(imageData);
3693
                                                image = SvgReader.Load(stream);
3694
                                            }
3695
                                            img.Source = image;
3696
                                        }
3697
                                        else
3698
                                        {
3699
                                            img.Source = new BitmapImage(uri.Uri);
3700
                                        }
3701

    
3702
                                        currentControl = new ImgControl
3703
                                        {
3704
                                            Background = new SolidColorBrush(Colors.Black),
3705
                                            PointSet = new List<Point>(),
3706
                                            FilePath = uri.Uri.ToString(),
3707
                                            ImageData = img.Source,
3708
                                            StartPoint = CanvasDrawingMouseDownPoint,
3709
                                            EndPoint = new Point(CanvasDrawingMouseDownPoint.X + 100, CanvasDrawingMouseDownPoint.Y + 100),
3710
                                            TopRightPoint = new Point(CanvasDrawingMouseDownPoint.X, CanvasDrawingMouseDownPoint.Y + 100),
3711
                                            LeftBottomPoint = new Point(CanvasDrawingMouseDownPoint.X + 100, CanvasDrawingMouseDownPoint.Y),
3712
                                            ControlType = ControlType.ImgControl
3713
                                        };
3714

    
3715
                                        currentControl.CommentID = Commons.shortGuid();
3716
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3717
                                        currentControl.IsNew = true;
3718
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3719

    
3720
                                        //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정
3721
                                        (currentControl as ImgControl).CommentAngle -= rotate.Angle;
3722
                                    }
3723
                                }
3724
                                //}
3725
                            }
3726
                        }
3727
                        break;
3728

    
3729
                    case ControlType.Date:
3730
                        {
3731
                            if (e.LeftButton == MouseButtonState.Pressed)
3732
                            {
3733
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3734
                                //{
3735
                                if (currentControl is DateControl)
3736
                                {
3737
                                    //20180906 LJY TEST IsRotationDrawingEnable
3738
                                    if (IsGetoutpoint((currentControl as DateControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3739
                                    {
3740
                                        return;
3741
                                    }
3742

    
3743
                                    CreateCommand.Instance.Execute(currentControl);
3744
                                    currentControl = null;
3745

    
3746
                                    if (Common.ViewerDataModel.Instance.SelectedControl == "Batch")
3747
                                    { 
3748
                                        controlType = ControlType.None;
3749
                                        IsSwingMode = false;
3750
                                        Common.ViewerDataModel.Instance.SelectedControl = "";
3751
                                        Common.ViewerDataModel.Instance.ControlTag = null;
3752
                                        mouseHandlingMode = MouseHandlingMode.None;
3753
                                        this.ParentOfType<MainWindow>().dzTopMenu.btn_Batch.IsChecked = false;
3754
                                        txtBatch.Visibility = Visibility.Collapsed;
3755
                                    }
3756
                                }
3757
                                else
3758
                                {
3759
                                    currentControl = new DateControl
3760
                                    {
3761
                                        StartPoint = CanvasDrawingMouseDownPoint,
3762
                                        Background = new SolidColorBrush(Colors.Black)
3763
                                    };
3764
                                    currentControl.CommentID = Commons.shortGuid();
3765
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3766
                                    currentControl.IsNew = true;
3767
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3768

    
3769
                                    //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정
3770
                                    if (currentControl is ImgControl)
3771
                                    {
3772
                                        (currentControl as ImgControl).CommentAngle -= rotate.Angle;
3773
                                    }
3774
                                }
3775
                                //}
3776
                            }
3777
                        }
3778
                        break;
3779

    
3780
                    case ControlType.TextControl:
3781
                        {
3782
                            if (e.LeftButton == MouseButtonState.Pressed)
3783
                            {
3784
                                if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3785
                                {
3786
                                    currentControl = new TextControl
3787
                                    {
3788
                                        ControlType = controlType
3789
                                    };
3790
                                    (currentControl as TextControl).TextSize = ViewerDataModel.Instance.TextSize;
3791
                                    currentControl.CommentID = Commons.shortGuid();
3792
                                    currentControl.IsNew = true;
3793
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3794
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3795
                                    currentControl.SetValue(Canvas.ZIndexProperty, 3);
3796

    
3797
                                    currentControl.SetValue(TextControl.CanvasXProperty, CanvasDrawingMouseDownPoint.X);
3798
                                    currentControl.SetValue(TextControl.CanvasYProperty, CanvasDrawingMouseDownPoint.Y);
3799

    
3800
                                    (currentControl as TextControl).ControlType_No = 0;
3801
                                    (currentControl as TextControl).CommentAngle -= rotate.Angle;
3802
                                    (currentControl as TextControl).IsHighLight = ViewerDataModel.Instance.checkHighShape;
3803
                                    (currentControl as TextControl).ApplyTemplate();
3804
                                    (currentControl as TextControl).Base_TextBox.Focus();
3805
                                    (currentControl as TextControl).SetFontFamily(new FontFamily(this.ParentOfType<MainWindow>().dzTopMenu.comboFontFamily.Text));
3806
                                    CreateCommand.Instance.Execute(currentControl);
3807
                                }
3808
                            }
3809
                        }
3810
                        break;
3811

    
3812
                    case ControlType.TextBorder:
3813
                        {
3814
                            if (e.LeftButton == MouseButtonState.Pressed)
3815
                            {
3816
                                if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3817
                                {
3818
                                    currentControl = new TextControl
3819
                                    {
3820
                                        ControlType = controlType
3821
                                    };
3822

    
3823
                                    (currentControl as TextControl).TextSize = ViewerDataModel.Instance.TextSize;
3824
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3825
                                    currentControl.CommentID = Commons.shortGuid();
3826
                                    currentControl.IsNew = true;
3827
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3828
                                    currentControl.SetValue(Canvas.ZIndexProperty, 3);
3829
                                    currentControl.SetValue(TextControl.CanvasXProperty, CanvasDrawingMouseDownPoint.X);
3830
                                    currentControl.SetValue(TextControl.CanvasYProperty, CanvasDrawingMouseDownPoint.Y);
3831

    
3832
                                    (currentControl as TextControl).ControlType_No = 1;
3833
                                    (currentControl as TextControl).CommentAngle = Ang;
3834
                                    (currentControl as TextControl).IsHighLight = ViewerDataModel.Instance.checkHighShape;
3835
                                    (currentControl as TextControl).ApplyTemplate();
3836
                                    (currentControl as TextControl).Base_TextBox.Focus();
3837
                                    (currentControl as TextControl).SetFontFamily(new FontFamily(this.ParentOfType<MainWindow>().dzTopMenu.comboFontFamily.Text));
3838
                                    CreateCommand.Instance.Execute(currentControl);
3839
                                }
3840
                            }
3841
                        }
3842
                        break;
3843

    
3844
                    case ControlType.TextCloud:
3845
                        {
3846
                            if (e.LeftButton == MouseButtonState.Pressed)
3847
                            {
3848
                                if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3849
                                {
3850
                                    currentControl = new TextControl
3851
                                    {
3852
                                        ControlType = controlType
3853
                                    };
3854

    
3855
                                    (currentControl as TextControl).TextSize = ViewerDataModel.Instance.TextSize;
3856
                                    currentControl.CommentID = Commons.shortGuid();
3857
                                    currentControl.IsNew = true;
3858
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3859
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3860

    
3861
                                    currentControl.SetValue(Canvas.ZIndexProperty, 3);
3862
                                    currentControl.SetValue(TextControl.CanvasXProperty, CanvasDrawingMouseDownPoint.X);
3863
                                    currentControl.SetValue(TextControl.CanvasYProperty, CanvasDrawingMouseDownPoint.Y);
3864

    
3865
                                    (currentControl as TextControl).CommentAngle = Ang;
3866
                                    (currentControl as TextControl).ControlType_No = 2;
3867
                                    (currentControl as TextControl).IsHighLight = ViewerDataModel.Instance.checkHighShape;
3868
                                    (currentControl as TextControl).SetFontFamily(new FontFamily(this.ParentOfType<MainWindow>().dzTopMenu.comboFontFamily.Text));
3869

    
3870
                                    (currentControl as TextControl).ApplyTemplate();
3871
                                    (currentControl as TextControl).Base_TextBox.Focus();
3872
                                    CreateCommand.Instance.Execute(currentControl);
3873
                                    
3874
                                    //currentControl = null;
3875
                                }
3876
                            }
3877
                        }
3878
                        break;
3879

    
3880
                    case ControlType.ArrowTextControl:
3881
                        {
3882
                            if (e.LeftButton == MouseButtonState.Pressed)
3883
                            {
3884
                                if (currentControl is ArrowTextControl)
3885
                                {
3886
                                    //20180906 LJY TEST IsRotationDrawingEnable
3887
                                    if (IsGetoutpoint((currentControl as ArrowTextControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3888
                                    {
3889
                                        return;
3890
                                    }
3891

    
3892
                                    CreateCommand.Instance.Execute(currentControl);
3893
                                    try
3894
                                    {
3895
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3896
                                    }
3897
                                    catch (Exception ex)
3898
                                    {
3899
                                        System.Diagnostics.Debug.WriteLine(ex.ToString());
3900
                                    }
3901

    
3902
                                    (currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false;
3903
                                    (currentControl as ArrowTextControl).EnableEditing = false;
3904
                                    (currentControl as ArrowTextControl).IsNew = false;
3905
                                    currentControl = null;
3906
                                }
3907
                                else
3908
                                {
3909
                                    //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3910
                                    //{
3911
                                    currentControl = new ArrowTextControl()
3912
                                    {
3913
                                        PageAngle = ViewerDataModel.Instance.PageAngle
3914
                                    };
3915

    
3916
                                    currentControl.CommentID = Commons.shortGuid();
3917
                                    currentControl.IsNew = true;
3918
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3919
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3920

    
3921
                                    currentControl.SetValue(Canvas.ZIndexProperty, 3);
3922
                                    currentControl.SetValue(ArrowTextControl.StartPointProperty, CanvasDrawingMouseDownPoint);
3923
                                    currentControl.SetValue(ArrowTextControl.EndPointProperty, CanvasDrawingMouseDownPoint);
3924
                                    (currentControl as ArrowTextControl).TextSize = ViewerDataModel.Instance.TextSize;
3925
                                    (currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape;
3926

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

    
3930
                                    (currentControl as ArrowTextControl).ApplyTemplate();
3931
                                    (currentControl as ArrowTextControl).Base_TextBox.Focus();
3932
                                    (currentControl as ArrowTextControl).SetFontFamily(new FontFamily(this.ParentOfType<MainWindow>().dzTopMenu.comboFontFamily.Text));
3933
                                    ViewerDataModel.Instance.SetAngleVisible(Visibility.Visible);
3934

    
3935
                                    //}
3936
                                }
3937
                            }
3938
                        }
3939
                        break;
3940

    
3941
                    case ControlType.ArrowTransTextControl:
3942
                        {
3943
                            if (e.LeftButton == MouseButtonState.Pressed)
3944
                            {
3945
                                if (currentControl is ArrowTextControl)
3946
                                {
3947
                                    //20180906 LJY TEST IsRotationDrawingEnable
3948
                                    if (IsGetoutpoint((currentControl as ArrowTextControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3949
                                    {
3950
                                        return;
3951
                                    }
3952

    
3953
                                    CreateCommand.Instance.Execute(currentControl);
3954

    
3955
                                    (currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false;
3956

    
3957
                                    currentControl.IsNew = false;
3958
                                    currentControl = null;
3959
                                    ViewerDataModel.Instance.SetAngleVisible(Visibility.Collapsed);
3960
                                }
3961
                                else
3962
                                {
3963
                                    //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3964
                                    //{
3965
                                    currentControl = new ArrowTextControl()
3966
                                    {
3967
                                        ControlType = ControlType.ArrowTransTextControl,
3968
                                        PageAngle = ViewerDataModel.Instance.PageAngle
3969
                                    };
3970
                                    currentControl.CommentID = Commons.shortGuid();
3971
                                    currentControl.IsNew = true;
3972
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3973
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3974
                                    currentControl.SetValue(Canvas.ZIndexProperty, 3);
3975
                                    currentControl.SetValue(ArrowTextControl.StartPointProperty, CanvasDrawingMouseDownPoint);
3976
                                    currentControl.SetValue(ArrowTextControl.EndPointProperty, CanvasDrawingMouseDownPoint);
3977
                                    (currentControl as ArrowTextControl).TextSize = ViewerDataModel.Instance.TextSize;
3978
                                    (currentControl as ArrowTextControl).isFixed = true;
3979
                                    (currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape;
3980

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

    
3984
                                    (currentControl as ArrowTextControl).ApplyTemplate();
3985
                                    (currentControl as ArrowTextControl).Base_TextBox.Focus();
3986
                                    (currentControl as ArrowTextControl).isTrans = true;
3987
                                    (currentControl as ArrowTextControl).SetFontFamily(new FontFamily(this.ParentOfType<MainWindow>().dzTopMenu.comboFontFamily.Text));
3988
                                }
3989
                            }
3990
                        }
3991
                        break;
3992

    
3993
                    case ControlType.ArrowTextBorderControl:
3994
                        {
3995
                            if (e.LeftButton == MouseButtonState.Pressed)
3996
                            {
3997
                                if (currentControl is ArrowTextControl)
3998
                                {
3999
                                    //20180906 LJY TEST IsRotationDrawingEnable
4000
                                    if (IsGetoutpoint((currentControl as ArrowTextControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
4001
                                    {
4002
                                        return;
4003
                                    }
4004

    
4005
                                    CreateCommand.Instance.Execute(currentControl);
4006
                                    (currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false;
4007
                                    currentControl.IsNew = false;
4008
                                    currentControl = null;
4009
                                    ViewerDataModel.Instance.SetAngleVisible(Visibility.Collapsed);
4010
                                }
4011
                                else
4012
                                {
4013
                                    //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4014
                                    //{
4015
                                    currentControl = new ArrowTextControl()
4016
                                    {
4017
                                        ArrowTextStyle = MarkupToPDF.Controls.Text.ArrowTextControl.ArrowTextStyleSet.Rect,
4018
                                        PageAngle = ViewerDataModel.Instance.PageAngle
4019
                                    };
4020
                                    currentControl.CommentID = Commons.shortGuid();
4021
                                    currentControl.IsNew = true;
4022
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4023
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4024

    
4025
                                    currentControl.SetValue(Canvas.ZIndexProperty, 3);
4026

    
4027
                                    currentControl.SetValue(ArrowTextControl.StartPointProperty, CanvasDrawingMouseDownPoint);
4028

    
4029
                                    currentControl.SetValue(ArrowTextControl.EndPointProperty, CanvasDrawingMouseDownPoint);
4030
                                    (currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape;
4031
                                    (currentControl as ArrowTextControl).TextSize = ViewerDataModel.Instance.TextSize;
4032
                                    (currentControl as ArrowTextControl).SetFontFamily(new FontFamily(this.ParentOfType<MainWindow>().dzTopMenu.comboFontFamily.Text));
4033
                                    //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정
4034
                                    (currentControl as ArrowTextControl).CommentAngle -= rotate.Angle;
4035
                                    (currentControl as ArrowTextControl).ApplyTemplate();
4036
                                    (currentControl as ArrowTextControl).Base_TextBox.Focus();
4037
                                    ViewerDataModel.Instance.SetAngleVisible(Visibility.Visible);
4038
                                    //}
4039
                                }
4040
                            }
4041
                        }
4042
                        break;
4043

    
4044
                    case ControlType.ArrowTransTextBorderControl:
4045
                        {
4046
                            if (e.LeftButton == MouseButtonState.Pressed)
4047
                            {
4048
                                if (currentControl is ArrowTextControl)
4049
                                {
4050
                                    //20180906 LJY TEST IsRotationDrawingEnable
4051
                                    if (IsGetoutpoint((currentControl as ArrowTextControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
4052
                                    {
4053
                                        return;
4054
                                    }
4055
                                    CreateCommand.Instance.Execute(currentControl);
4056
                                    (currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false;
4057
                                    currentControl.IsNew = false;
4058
                                    currentControl = null;
4059

    
4060
                                    ViewerDataModel.Instance.SetAngleVisible(Visibility.Collapsed);
4061
                                }
4062
                                else
4063
                                {
4064
                                    //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4065
                                    //{
4066
                                    currentControl = new ArrowTextControl()
4067
                                    {
4068
                                        ArrowTextStyle = MarkupToPDF.Controls.Text.ArrowTextControl.ArrowTextStyleSet.Rect,
4069
                                        ControlType = ControlType.ArrowTransTextBorderControl,
4070
                                        PageAngle = ViewerDataModel.Instance.PageAngle
4071
                                    };
4072
                                    
4073
                                    currentControl.CommentID = Commons.shortGuid();
4074
                                    currentControl.IsNew = true;
4075
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4076
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4077

    
4078
                                    currentControl.SetValue(Canvas.ZIndexProperty, 3);
4079

    
4080
                                    currentControl.SetValue(ArrowTextControl.StartPointProperty, CanvasDrawingMouseDownPoint);
4081
                                    currentControl.SetValue(ArrowTextControl.EndPointProperty, CanvasDrawingMouseDownPoint);
4082
                                    (currentControl as ArrowTextControl).TextSize = ViewerDataModel.Instance.TextSize;
4083
                                    (currentControl as ArrowTextControl).isFixed = true;
4084
                                    (currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape;
4085

    
4086
                                    //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정
4087
                                    (currentControl as ArrowTextControl).CommentAngle -= rotate.Angle;
4088
                                    (currentControl as ArrowTextControl).ApplyTemplate();
4089
                                    (currentControl as ArrowTextControl).SetFontFamily(new FontFamily(this.ParentOfType<MainWindow>().dzTopMenu.comboFontFamily.Text));
4090
                                    (currentControl as ArrowTextControl).Base_TextBox.Focus();
4091
                                    ViewerDataModel.Instance.SetAngleVisible(Visibility.Visible);
4092

    
4093
                                    //20180911 LJY
4094
                                    (currentControl as ArrowTextControl).isTrans = true;
4095

    
4096
                                    //}
4097
                                }
4098
                            }
4099
                        }
4100
                        break;
4101

    
4102
                    case ControlType.ArrowTextCloudControl:
4103
                        {
4104
                            if (e.LeftButton == MouseButtonState.Pressed)
4105
                            {
4106
                                if (currentControl is ArrowTextControl)
4107
                                {
4108
                                    //20180906 LJY TEST IsRotationDrawingEnable
4109
                                    if (IsGetoutpoint((currentControl as ArrowTextControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
4110
                                    {
4111
                                        return;
4112
                                    }
4113
                                    CreateCommand.Instance.Execute(currentControl);
4114
                                    (currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false;
4115
                                    currentControl.IsNew = false;
4116
                                    currentControl = null;
4117
                                    ViewerDataModel.Instance.SetAngleVisible(Visibility.Collapsed);
4118
                                }
4119
                                else
4120
                                {
4121
                                    //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4122
                                    //{
4123
                                    currentControl = new ArrowTextControl()
4124
                                    {
4125
                                        ArrowTextStyle = MarkupToPDF.Controls.Text.ArrowTextControl.ArrowTextStyleSet.Cloud,
4126
                                        PageAngle = ViewerDataModel.Instance.PageAngle
4127
                                    };
4128
                                    currentControl.CommentID = Commons.shortGuid();
4129
                                    currentControl.IsNew = true;
4130
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4131
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4132

    
4133
                                    currentControl.SetValue(Canvas.ZIndexProperty, 3);
4134
                                    currentControl.SetValue(ArrowTextControl.StartPointProperty, CanvasDrawingMouseDownPoint);
4135
                                    currentControl.SetValue(ArrowTextControl.EndPointProperty, CanvasDrawingMouseDownPoint);
4136
                                    (currentControl as ArrowTextControl).TextSize = ViewerDataModel.Instance.TextSize;
4137
                                    (currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape;
4138
                                    (currentControl as ArrowTextControl).SetFontFamily(new FontFamily(this.ParentOfType<MainWindow>().dzTopMenu.comboFontFamily.Text));
4139
                                    //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정
4140
                                    (currentControl as ArrowTextControl).CommentAngle -= rotate.Angle;
4141

    
4142
                                    (currentControl as ArrowTextControl).ApplyTemplate();
4143
                                    (currentControl as ArrowTextControl).Base_TextBox.Focus();
4144
                                    ViewerDataModel.Instance.SetAngleVisible(Visibility.Visible);
4145
                                    //}
4146
                                }
4147
                            }
4148
                        }
4149
                        break;
4150

    
4151
                    case ControlType.ArrowTransTextCloudControl:
4152
                        {
4153
                            if (e.LeftButton == MouseButtonState.Pressed)
4154
                            {
4155
                                if (currentControl is ArrowTextControl)
4156
                                {
4157
                                    //20180906 LJY TEST IsRotationDrawingEnable
4158
                                    if (IsGetoutpoint((currentControl as ArrowTextControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
4159
                                    {
4160
                                        return;
4161
                                    }
4162
                                    CreateCommand.Instance.Execute(currentControl);
4163
                                    (currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false;
4164
                                    currentControl.IsNew = false;
4165
                                    currentControl = null;
4166
                                    ViewerDataModel.Instance.SetAngleVisible(Visibility.Collapsed);
4167
                                }
4168
                                else
4169
                                {
4170
                                    //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4171
                                    //{
4172
                                    currentControl = new ArrowTextControl()
4173
                                    {
4174
                                        ArrowTextStyle = MarkupToPDF.Controls.Text.ArrowTextControl.ArrowTextStyleSet.Cloud,
4175
                                        ControlType = ControlType.ArrowTransTextCloudControl,
4176
                                        PageAngle = ViewerDataModel.Instance.PageAngle
4177
                                    };
4178
                                    currentControl.CommentID = Commons.shortGuid();
4179
                                    currentControl.IsNew = true;
4180
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4181
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4182
                                    currentControl.SetValue(Canvas.ZIndexProperty, 3);
4183

    
4184
                                    currentControl.SetValue(ArrowTextControl.StartPointProperty, CanvasDrawingMouseDownPoint);
4185
                                    currentControl.SetValue(ArrowTextControl.EndPointProperty, CanvasDrawingMouseDownPoint);
4186
                                    (currentControl as ArrowTextControl).TextSize = ViewerDataModel.Instance.TextSize;
4187
                                    (currentControl as ArrowTextControl).isFixed = true;
4188
                                    (currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape;
4189

    
4190
                                    //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정
4191
                                    (currentControl as ArrowTextControl).CommentAngle -= rotate.Angle;
4192
                                    (currentControl as ArrowTextControl).SetFontFamily(new FontFamily(this.ParentOfType<MainWindow>().dzTopMenu.comboFontFamily.Text));
4193
                                    (currentControl as ArrowTextControl).ApplyTemplate();
4194
                                    (currentControl as ArrowTextControl).Base_TextBox.Focus();
4195
                                    ViewerDataModel.Instance.SetAngleVisible(Visibility.Visible);
4196

    
4197
                                    //20180911 LJY
4198
                                    (currentControl as ArrowTextControl).isTrans = true;
4199
                                    //}
4200
                                }
4201
                            }
4202
                        }
4203
                        break;
4204
                    //강인구 추가
4205
                    case ControlType.Sign:
4206
                        {
4207
                            if (e.LeftButton == MouseButtonState.Pressed)
4208
                            {
4209
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4210
                                //{
4211
                                var _sign = await BaseTaskClient.GetSignDataAsync(App.ViewInfo.ProjectNO, App.ViewInfo.UserID);
4212

    
4213
                                if (_sign == null)
4214
                                {
4215
                                    txtBatch.Visibility = Visibility.Collapsed;
4216
                                    mouseHandlingMode = IKCOM.MouseHandlingMode.None;
4217
                                    controlType = ControlType.None;
4218

    
4219
                                    this.ParentOfType<MainWindow>().DialogMessage_Alert("등록된 Sign이 없습니다.", "Alert");
4220
                                    this.ParentOfType<MainWindow>().ChildrenOfType<RadToggleButton>().Where(data => data.IsChecked == true).FirstOrDefault().IsChecked = false;
4221
                                    return;
4222
                                }
4223

    
4224
                                if (currentControl is SignControl)
4225
                                {
4226
                                    //20180906 LJY TEST IsRotationDrawingEnable
4227
                                    if (IsGetoutpoint((currentControl as SignControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
4228
                                    {
4229
                                        return;
4230
                                    }
4231

    
4232
                                    CreateCommand.Instance.Execute(currentControl);
4233
                                    currentControl = null;
4234
                                    if (Common.ViewerDataModel.Instance.SelectedControl == "Batch")
4235
                                    {
4236
                                        txtBatch.Text = "Place Date";
4237
                                        controlType = ControlType.Date;
4238
                                    }
4239
                                }
4240
                                else
4241
                                {
4242
                                    currentControl = new SignControl
4243
                                    {
4244
                                        Background = new SolidColorBrush(Colors.Black),
4245
                                        UserNumber = App.ViewInfo.UserID,
4246
                                        ProjectNO = App.ViewInfo.ProjectNO,
4247
                                        StartPoint = new Point(CanvasDrawingMouseDownPoint.X, CanvasDrawingMouseDownPoint.Y),
4248
                                        EndPoint = new Point(CanvasDrawingMouseDownPoint.X, CanvasDrawingMouseDownPoint.Y),
4249
                                        ControlType = ControlType.Sign
4250
                                    };
4251

    
4252
                                    currentControl.CommentID = Commons.shortGuid();
4253
                                    currentControl.IsNew = true;
4254
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4255
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4256

    
4257
                                    //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정
4258
                                    (currentControl as SignControl).CommentAngle -= rotate.Angle;
4259
                                }
4260
                                //}
4261
                            }
4262
                        }
4263
                        break;
4264

    
4265
                    case ControlType.Mark:
4266
                        {
4267
                            if (e.LeftButton == MouseButtonState.Pressed)
4268
                            {
4269
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4270
                                //{
4271
                                if (currentControl is RectangleControl)
4272
                                {
4273
                                    //20180906 LJY TEST IsRotationDrawingEnable
4274
                                    if (IsGetoutpoint((currentControl as RectangleControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
4275
                                    {
4276
                                        return;
4277
                                    }
4278

    
4279
                                    CreateCommand.Instance.Execute(currentControl);
4280
                                    (currentControl as RectangleControl).ApplyOverViewData();
4281
                                    currentControl = null;
4282

    
4283
                                    this.cursor = new Cursor(App.DefaultArrowCursorStream);
4284

    
4285
                                    if (Common.ViewerDataModel.Instance.SelectedControl == "Batch")
4286
                                    {
4287
                                        txtBatch.Text = "Place Signature";
4288
                                        controlType = ControlType.Sign;
4289
                                    }
4290
                                }
4291
                                else
4292
                                {
4293
                                    currentControl = new RectangleControl
4294
                                    {
4295
                                        StartPoint = new Point(CanvasDrawingMouseDownPoint.X, CanvasDrawingMouseDownPoint.Y),
4296
                                        Background = new SolidColorBrush(Colors.Black),
4297
                                        ControlType = ControlType.Mark,
4298
                                        Paint = PaintSet.Fill
4299
                                    };
4300

    
4301
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4302
                                    currentControl.CommentID = Commons.shortGuid();
4303
                                    currentControl.IsNew = true;
4304
                                    (currentControl as RectangleControl).DashSize = ViewerDataModel.Instance.DashSize;
4305
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4306
                                }
4307
                                //}
4308
                            }
4309
                        }
4310
                        break;
4311

    
4312
                    case ControlType.Symbol:
4313
                        {
4314
                            if (e.LeftButton == MouseButtonState.Pressed)
4315
                            {
4316
                                if (currentControl is SymControl)
4317
                                {
4318
                                    //20180906 LJY TEST IsRotationDrawingEnable
4319
                                    if (IsGetoutpoint((currentControl as SymControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
4320
                                    {
4321
                                        return;
4322
                                    }
4323
                                    CreateCommand.Instance.Execute(currentControl);
4324
                                    currentControl = null;
4325

    
4326
                                    this.cursor = new Cursor(App.DefaultArrowCursorStream);
4327
                                }
4328
                                else
4329
                                {
4330
                                    currentControl = new SymControl
4331
                                    {
4332
                                        StartPoint = new Point(CanvasDrawingMouseDownPoint.X, CanvasDrawingMouseDownPoint.Y),
4333
                                        Background = new SolidColorBrush(Colors.Black),
4334
                                        LineSize = ViewerDataModel.Instance.LineSize + 3,
4335
                                        ControlType = ControlType.Symbol
4336
                                    };
4337

    
4338
                                    currentControl.IsNew = true;
4339
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4340
                                    currentControl.CommentID = Commons.shortGuid();
4341
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4342

    
4343
                                    //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정
4344
                                    (currentControl as SymControl).CommentAngle -= rotate.Angle;
4345
                                }
4346
                                //}
4347
                            }
4348
                        }
4349
                        break;
4350

    
4351
                    case ControlType.Stamp:
4352
                        {
4353
                            if (e.LeftButton == MouseButtonState.Pressed)
4354
                            {
4355
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4356
                                //{
4357
                                if (currentControl is SymControlN)
4358
                                {
4359
                                    //20180906 LJY TEST IsRotationDrawingEnable
4360
                                    if (IsGetoutpoint((currentControl as SymControlN).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
4361
                                    {
4362
                                        return;
4363
                                    }
4364

    
4365
                                    CreateCommand.Instance.Execute(currentControl);
4366
                                    currentControl = null;
4367

    
4368
                                    this.cursor = new Cursor(App.DefaultArrowCursorStream);
4369
                                }
4370
                                else
4371
                                {
4372
                                    currentControl = new SymControlN
4373
                                    {
4374
                                        StartPoint = new Point(CanvasDrawingMouseDownPoint.X, CanvasDrawingMouseDownPoint.Y),
4375
                                        Background = new SolidColorBrush(Colors.Black),
4376
                                        STAMP = App.SystemInfo.STAMP,
4377
                                        ControlType = ControlType.Stamp
4378
                                    };
4379

    
4380
                                    currentControl.IsNew = true;
4381
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4382
                                    currentControl.CommentID = Commons.shortGuid();
4383
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4384
                                    //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정
4385
                                    (currentControl as SymControlN).CommentAngle -= rotate.Angle;
4386
                                }
4387
                                //}
4388
                            }
4389
                        }
4390
                        break;
4391

    
4392
                    case ControlType.PenControl:
4393
                        {
4394
                            if (inkBoard.Tag.ToString() == "Ink")
4395
                            {
4396
                                inkBoard.IsEnabled = true;
4397
                                StartNewStroke(CanvasDrawingMouseDownPoint);
4398
                            }
4399
                            else if (inkBoard.Tag.ToString() == "EraseByPoint")
4400
                            {
4401
                                RemovePointStroke(CanvasDrawingMouseDownPoint);
4402
                            }
4403
                            else if (inkBoard.Tag.ToString() == "EraseByStroke")
4404
                            {
4405
                                RemoveLineStroke(CanvasDrawingMouseDownPoint);
4406
                            }
4407
                            IsDrawing = true;
4408
                            return;
4409
                        }
4410
                    default:
4411
                        if (currentControl != null)
4412
                        {
4413
                            currentControl.CommentID = null;
4414
                            currentControl.IsNew = false;
4415
                        }
4416
                        break;
4417
                }
4418

    
4419
             
4420
                if (currentControl is ArrowTextControl)
4421
                {
4422
                    (currentControl as ArrowTextControl).EditEnded += (snd, evt) =>
4423
                    {
4424
                        var control = snd as ArrowTextControl;
4425

    
4426
                        if (string.IsNullOrEmpty(control.ArrowText))
4427
                        {
4428
                            DeleteCommand.Instance.Execute(new [] { control });
4429
                        }
4430
                    };
4431

    
4432
                }
4433

    
4434
                if (Common.ViewerDataModel.Instance.IsMacroCommand)
4435
                {
4436
                    if (currentControl == null && mouseHandlingMode == MouseHandlingMode.Drawing)
4437
                    {
4438
                        MacroHelper.MacroAction();
4439
                    }
4440
                    //if (currentControl.ControlType)
4441
                    //txtBatch.Text = "Draw a TextBox";
4442
                    //controlType = ControlType.ArrowTextBorderControl;
4443
                }
4444

    
4445
                //if (currentControl != null)
4446
                //{
4447
                //    currentControl.PageAngle = pageNavigator.CurrentPage.Angle;
4448
                //}
4449
            }
4450
            if (mouseHandlingMode != MouseHandlingMode.None && e.LeftButton == MouseButtonState.Pressed)
4451
            {
4452
                // MACRO 버튼클릭하여 CLOUD RECT 그린 후
4453
             
4454

    
4455
                if (mouseHandlingMode == MouseHandlingMode.Adorner && SelectLayer.Children.Count > 0)
4456
                {
4457
                    bool mouseOff = false;
4458
                    foreach (var item in SelectLayer.Children)
4459
                    {
4460
                        if (item is AdornerFinal)
4461
                        {
4462
                            var over = (item as AdornerFinal).Members.Where(data => data.DrawingData.IsMouseOver).FirstOrDefault();
4463
                            if (over != null)
4464
                            {
4465
                                mouseOff = true;
4466
                            }
4467
                        }
4468
                    }
4469

    
4470
                    if (!mouseOff)
4471
                    {
4472
                        SelectionSet.Instance.UnSelect(this);
4473
                    }
4474
                }
4475
                zoomAndPanControl.CaptureMouse();
4476
                e.Handled = true;
4477
            }
4478
        }
4479

    
4480
        private void zoomAndPanControl2_MouseDown(object sender, MouseButtonEventArgs e)
4481
        {
4482
            ///mouseButtonDown = e.ChangedButton;
4483
            canvasZoommovingMouseDownPoint = e.GetPosition(zoomAndPanCanvas2);
4484
        }
4485

    
4486
        private void RemoveLineStroke(Point P)
4487
        {
4488
            var control = ViewerDataModel.Instance.MarkupControls_USER.Where(data => data.IsMouseEnter).FirstOrDefault();
4489
            if (control != null)
4490
            {
4491
                DeleteCommand.Instance.Execute(new List<CommentUserInfo>() { control });
4492
            }
4493
        }
4494

    
4495
        private void RemovePointStroke(Point P)
4496
        {
4497
            foreach (Stroke hits in inkBoard.Strokes)
4498
            {
4499
                foreach (StylusPoint sty in hits.StylusPoints)
4500
                {
4501
                }
4502
                if (hits.HitTest(P))
4503
                {
4504
                    inkBoard.Strokes.Remove(hits);
4505
                    return;
4506
                }
4507
            }
4508
        }
4509

    
4510
        private void StartNewStroke(Point P)
4511
        {
4512
            strokePoints = new StylusPointCollection();
4513
            StylusPoint segment1Start = new StylusPoint(P.X, P.Y);
4514
            strokePoints.Add(segment1Start);
4515
            stroke = new Stroke(strokePoints);
4516

    
4517
            stroke.DrawingAttributes.Color = Colors.Red;
4518
            stroke.DrawingAttributes.Width = 4;
4519
            stroke.DrawingAttributes.Height = 4;
4520

    
4521
            inkBoard.Strokes.Add(stroke);
4522
        }
4523

    
4524
        private  void btnConsolidate_Click(object sender, RoutedEventArgs e)
4525
        {
4526
            //SelectionSet.Instance.UnSelect(this.ParentOfType<MainWindow>().dzMainMenu);
4527
            //// update mylist and gridview
4528
            //this.UpdateMyMarkupList();
4529

    
4530
            //bool result = await this.ParentOfType<MainWindow>().dzTopMenu.ExecuteSaveCommand(this);
4531

    
4532
            //if (result)
4533
            //{
4534
                ConsolidationMethod();
4535
            //}
4536
            //else
4537
            //{
4538
            //    MessageBox.Show("오류");
4539
            //}
4540
        }
4541

    
4542
        /// <summary>
4543
        /// execute TeamConsolidationCommand
4544
        /// </summary>
4545
        public void TeamConsolidationMethod()
4546
        {
4547
            this.UpdateMyMarkupList();
4548
            if (this.gridViewMarkup.SelectedItems.Count == 0)
4549
            {
4550
                this.ParentOfType<MainWindow>().DialogMessage_Alert("Please select at least one user", "Alert");
4551
            }
4552
            else
4553
            {
4554
                ViewerDataModel.Instance.IsConsolidate = true;
4555
                this.ParentOfType<MainWindow>().dzTopMenu._SaveEvent(null, null);
4556

    
4557
                foreach (MarkupInfoItem item in this.gridViewMarkup.SelectedItems)
4558
                {
4559
                    if (!this.userData.DEPARTMENT.Equals(item.Depatment))
4560
                    {
4561
                        this.ParentOfType<MainWindow>().DialogMessage_Alert("Please select at your department", "Alert");
4562
                        return;
4563
                    }
4564
                }
4565
                List<MarkupInfoItem> MarkupInfoList = new List<MarkupInfoItem>();
4566
                foreach (MarkupInfoItem item in this.gridViewMarkup.SelectedItems)
4567
                {
4568
                    MarkupInfoList.Add(item);
4569
                }
4570
                TeamConsolidateCommand.Instance.Execute(MarkupInfoList);
4571
            }
4572
        }
4573

    
4574
        public async Task<bool> ConsolidationMethod()
4575
        {
4576
            bool result = false;
4577

    
4578
            if (this.gridViewMarkup.SelectedItems.Count == 0)
4579
            {
4580
                this.ParentOfType<MainWindow>().DialogMessage_Alert("Please select at least one user", "Alert");
4581
            }
4582
            else
4583
            {
4584
                List<IKCOM.MarkupInfoItem> MySelectItem = new List<IKCOM.MarkupInfoItem>();
4585
                foreach (var item in this.gridViewMarkup.SelectedItems)
4586
                {
4587
                    MySelectItem.Add(item as IKCOM.MarkupInfoItem);
4588
                }
4589
                int iPageNo = Convert.ToInt32(this.ParentOfType<MainWindow>().dzTopMenu.tlcurrentPage.Text);
4590

    
4591
                result = await ConsolidateCommand.Instance.Execute(MySelectItem, iPageNo);
4592
            }
4593

    
4594
            return result;
4595
        }
4596

    
4597
        private void btnConsolidate_Loaded(object sender, RoutedEventArgs e)
4598
        {
4599
            if (App.ViewInfo != null)
4600
            {
4601
                btnConsolidate = (sender as RadRibbonButton);
4602
                if (!App.ViewInfo.NewCommentPermission)
4603
                {
4604
                    (sender as RadRibbonButton).Visibility = System.Windows.Visibility.Collapsed;
4605
                }
4606
            }
4607
        }
4608

    
4609
        private void btnTeamConsolidate_Click(object sender, RoutedEventArgs e)
4610
        {
4611
            TeamConsolidationMethod();
4612
        }
4613

    
4614
        private void btnTeamConsolidate_Loaded(object sender, RoutedEventArgs e)
4615
        {
4616
            btnTeamConsolidate = sender as RadRibbonButton;
4617
            if (App.ViewInfo != null)
4618
            {
4619
                if (!App.ViewInfo.CreateFinalPDFPermission) //파이널이 True가 아니면
4620
                {
4621
                    if (btnConsolidate != null)
4622
                    {
4623
                        btnConsolidate.Visibility = Visibility.Collapsed;
4624
                    }
4625

    
4626
                    if (!App.ViewInfo.NewCommentPermission)
4627
                    {
4628
                        btnTeamConsolidate.Visibility = Visibility.Collapsed;
4629
                    }
4630
                }
4631
                else
4632
                {
4633
                    btnTeamConsolidate.Visibility = Visibility.Collapsed;
4634
                }
4635
            }
4636
        }
4637

    
4638
        private async void FinalPDFEvent(object sender, RoutedEventArgs e)
4639
        {
4640
            SelectionSet.Instance.UnSelect(this.ParentOfType<MainWindow>().dzMainMenu);
4641
            // update mylist and gridview
4642
            this.UpdateMyMarkupList();
4643

    
4644
            var result = await this.ParentOfType<MainWindow>().dzTopMenu.ExecuteSaveCommand(this);
4645

    
4646
            if(!result)
4647
            {
4648

    
4649
            }
4650
            else
4651
            {
4652
                var item = gridViewMarkup.Items.Cast<MarkupInfoItem>().Where(d => d.Consolidate == 1 && d.AvoidConsolidate == 0).FirstOrDefault();
4653

    
4654
                if (item != null)
4655
                {
4656
                    if (BaseClient.FinalPDF_GetFinalPDFStatus(_DocInfo.ID, item.MarkupInfoID, _ViewInfo.UserID))
4657
                    {
4658
                        //Logger.sendReqLog("SetFinalPDFAsync", _ViewInfo.ProjectNO + "," + _DocInfo.ID + "," + item.MarkupInfoID + "," + _ViewInfo.UserID, 1);
4659

    
4660
                        BaseClient.SetFinalPDFAsync(_ViewInfo.ProjectNO, _DocInfo.ID, item.MarkupInfoID, _ViewInfo.UserID);
4661

    
4662
                        ViewerDataModel.Instance.FinalPDFTime = DateTime.Now;
4663
                    }
4664
                    else
4665
                    {
4666
                        DialogMessage_Alert("Merged PDF가 수행중입니다", "안내");
4667
                    }
4668
                }
4669
                else
4670
                {
4671
                    //Consolidate 가 없는 경우
4672
                    DialogMessage_Alert("Consolidation 된 코멘트가 존재하지 않습니다", "안내");
4673
                }
4674
            }
4675

    
4676
        }
4677

    
4678
        private void btnFinalPDF_Loaded(object sender, RoutedEventArgs e)
4679
        {
4680
            btnFinalPDF = sender as RadRibbonButton;
4681
            if (App.ViewInfo != null)
4682
            {
4683
                //btnFinalPDF.IsEnabled = false;
4684

    
4685
                if (!App.ViewInfo.CreateFinalPDFPermission) //파이널이 True가 아니면
4686
                {
4687
                    btnFinalPDF.Visibility = System.Windows.Visibility.Collapsed;
4688
                    if (btnConsolidate != null)
4689
                    {
4690
                        btnConsolidate.Visibility = Visibility.Collapsed;
4691
                    }
4692
                }
4693
            }
4694
        }
4695

    
4696
        private async void ConsolidateFinalPDFEvent(object sender, RoutedEventArgs e)
4697
        {
4698
            //UpdateMyMarkupList();
4699

    
4700
            if (this.gridViewMarkup.SelectedItems.Count == 0)
4701
            {
4702
                this.ParentOfType<MainWindow>().DialogMessage_Alert("Please select at least one user", "Alert");
4703
            }
4704
            else
4705
            {
4706
                //if ((App.ViewInfo.CreateFinalPDFPermission || App.ViewInfo.NewCommentPermission))
4707
                //{
4708
                //컨트롤을 그리는 도중일 경우 컨트롤 삭제
4709
                //ViewerDataModel.Instance.MarkupControls_USER.Remove(ViewerDataModel.Instance.SystemMain.dzMainMenu.currentControl);
4710
                //ViewerDataModel.Instance.SystemMain.dzMainMenu.currentControl = null;
4711

    
4712
                //SelectionSet.Instance.UnSelect(this.ParentOfType<MainWindow>().dzMainMenu);
4713
                //// update mylist and gridview
4714
                //this.UpdateMyMarkupList();
4715

    
4716
                //var result = await this.ParentOfType<MainWindow>().dzTopMenu.ExecuteSaveCommand(this);
4717

    
4718
                bool result = await ConsolidationMethod();
4719

    
4720
                var items = this.BaseClient.GetMarkupInfoItems(App.ViewInfo.ProjectNO, _DocInfo.ID);
4721

    
4722
                var item2 = items.Where(d => d.Consolidate == 1 && d.AvoidConsolidate == 0).FirstOrDefault();
4723
                if (item2 != null)
4724
                {
4725
                    if (BaseClient.FinalPDF_GetFinalPDFStatus(_DocInfo.ID, item2.MarkupInfoID, _ViewInfo.UserID))
4726
                    {
4727
                        //Logger.sendReqLog("SetFinalPDFAsync", _ViewInfo.ProjectNO + "," + _DocInfo.ID + "," + item2.MarkupInfoID + "," + _ViewInfo.UserID, 1);
4728

    
4729
                        BaseClient.SetFinalPDFAsync(_ViewInfo.ProjectNO, _DocInfo.ID, item2.MarkupInfoID, _ViewInfo.UserID);
4730
                        BaseClient.GetMarkupInfoItemsAsync(App.ViewInfo.ProjectNO, _DocInfo.ID);
4731

    
4732
                        ViewerDataModel.Instance.FinalPDFTime = DateTime.Now;
4733
                    }
4734
                    else
4735
                    {
4736
                        DialogMessage_Alert("Merged PDF가 수행중입니다. 잠시 후 수행가능합니다.", "안내");
4737
                    }
4738
                }
4739
                else
4740
                {
4741
                    DialogMessage_Alert("Consolidation 된 코멘트가 존재하지 않습니다", "안내");
4742
                }
4743
            }
4744
        }
4745

    
4746
        private void btnConsolidateFinalPDF_Loaded(object sender, RoutedEventArgs e)
4747
        {
4748
            btnConsolidateFinalPDF = (sender as RadRibbonButton);
4749
#if Hyosung
4750
            btnConsolidateFinalPDF.Visibility = System.Windows.Visibility.Collapsed;
4751
#else
4752

    
4753
            //btnConsolidateFinalPDF.IsEnabled = false;
4754

    
4755
            if (App.ViewInfo != null)
4756
            {
4757
                if (!App.ViewInfo.NewCommentPermission || !App.ViewInfo.CreateFinalPDFPermission)
4758
                {
4759
                    btnConsolidateFinalPDF.Visibility = System.Windows.Visibility.Collapsed;
4760
                }
4761
            }
4762
#endif
4763
        }
4764

    
4765
        private void SyncCompare_Click(object sender, RoutedEventArgs e)
4766
        {
4767
            SetCompareRect();
4768
        }
4769

    
4770
        private void Sync_Click(object sender, RoutedEventArgs e)
4771
        {
4772
            if (Sync.IsChecked)
4773
            {
4774
                ViewerDataModel.Instance.Sync_ContentOffsetX = zoomAndPanControl.ContentOffsetX;
4775
                ViewerDataModel.Instance.Sync_ContentOffsetY = zoomAndPanControl.ContentOffsetY;
4776
                ViewerDataModel.Instance.Sync_ContentScale = zoomAndPanControl.ContentScale;
4777
            }
4778
        }
4779

    
4780
        private void SyncUserListExpender_Click(object sender, RoutedEventArgs e)
4781
        {
4782
            if (UserList.IsChecked)
4783
            {
4784
                this.gridViewRevMarkup.Visibility = Visibility.Visible;
4785
            }
4786
            else
4787
            {
4788
                this.gridViewRevMarkup.Visibility = Visibility.Collapsed;
4789
            }
4790
        }
4791

    
4792
        private void SyncPageBalance_Click(object sender, RoutedEventArgs e)
4793
        {
4794
            if (BalanceMode.IsChecked)
4795
            {
4796
                ViewerDataModel.Instance.PageBalanceMode = true;
4797
            }
4798
            else
4799
            {
4800
                ViewerDataModel.Instance.PageBalanceMode = false;
4801
                ViewerDataModel.Instance.PageBalanceNumber = 0;
4802
            }
4803
        }
4804

    
4805
        private void SyncExit_Click(object sender, RoutedEventArgs e)
4806
        {
4807
            //초기화
4808
            testPanel2.IsHidden = true;
4809
            ViewerDataModel.Instance.PageBalanceMode = false;
4810
            ViewerDataModel.Instance.PageBalanceNumber = 0;
4811
            ViewerDataModel.Instance.SyncPageNumber = 0;
4812
            ViewerDataModel.Instance.MarkupControls_Sync.Clear();
4813
            this.gridViewRevMarkup.Visibility = Visibility.Collapsed;
4814
            UserList.IsChecked = false;
4815
            BalanceMode.IsChecked = false;
4816
        }
4817

    
4818
        private async void SyncPageChange_Click(object sender, RoutedEventArgs e)
4819
        {
4820
            if ((sender as System.Windows.Controls.Control).Tag != null)
4821
            {
4822
                //Compare 초기화
4823
                CompareMode.IsChecked = false;
4824
                var balancePoint = Convert.ToInt32((sender as System.Windows.Controls.Control).Tag);
4825
                
4826
                if (ViewerDataModel.Instance.SyncPageNumber == 0)
4827
                {
4828
                    ViewerDataModel.Instance.SyncPageNumber = 1;
4829
                }
4830

    
4831
                if (ViewerDataModel.Instance.PageBalanceNumber == pageNavigator.PageCount)
4832
                {
4833
                }
4834
                else
4835
                {
4836
                    ViewerDataModel.Instance.PageBalanceNumber += balancePoint;
4837
                }
4838

    
4839
                if (ViewerDataModel.Instance.SyncPageNumber == pageNavigator.PageCount && balancePoint > 0)
4840
                {
4841
                }
4842
                else if ((ViewerDataModel.Instance.SyncPageNumber + balancePoint) >= 1)
4843
                {
4844
                    ViewerDataModel.Instance.SyncPageNumber += balancePoint;
4845
                }
4846

    
4847
                //pageNavigator.GotoPage(ViewerDataModel.Instance.PageNumber);
4848

    
4849
                if (!testPanel2.IsHidden)
4850
                {
4851
                    if (IsSyncPDFMode)
4852
                    {
4853
                        Get_FinalImage.Get_PdfImage get_PdfImage = new Get_FinalImage.Get_PdfImage();
4854
                        var pdfpath = new BitmapImage(new Uri(get_PdfImage.Run(CurrentRev.TO_VENDOR, App.ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, ViewerDataModel.Instance.SyncPageNumber)));
4855

    
4856
                        if (pdfpath.IsDownloading)
4857
                        {
4858
                            pdfpath.DownloadCompleted += (ex, arg) =>
4859
                            {
4860
                                ViewerDataModel.Instance.ImageViewPath_C = pdfpath;
4861
                                ViewerDataModel.Instance.ImageViewWidth_C = pdfpath.PixelWidth;
4862
                                ViewerDataModel.Instance.ImageViewHeight_C = pdfpath.PixelHeight;
4863
                                zoomAndPanCanvas2.Width = pdfpath.PixelWidth;
4864
                                zoomAndPanCanvas2.Height = pdfpath.PixelHeight;
4865
                            };
4866
                        }
4867
                        else
4868
                        {
4869
                            ViewerDataModel.Instance.ImageViewPath_C = pdfpath;
4870
                            ViewerDataModel.Instance.ImageViewWidth_C = pdfpath.PixelWidth;
4871
                            ViewerDataModel.Instance.ImageViewHeight_C = pdfpath.PixelHeight;
4872

    
4873
                            zoomAndPanCanvas2.Width = pdfpath.PixelWidth;
4874
                            zoomAndPanCanvas2.Height = pdfpath.PixelHeight;
4875
                        }
4876
                    }
4877
                    else
4878
                    {
4879
                        string uri = this.GetImageURL(CurrentRev.DOCUMENT_ID, ViewerDataModel.Instance.SyncPageNumber);
4880

    
4881
                        var isOriginalSize = !(ViewerDataModel.Instance.SyncPageNumber == pageNavigator.CurrentPage.PageNumber);
4882
                        ComparePageLoad(uri, isOriginalSize);
4883
                    }
4884
                   
4885
                    //강인구 추가(페이지 이동시 코멘트 재 호출)
4886
                    ViewerDataModel.Instance.MarkupControls_Sync.Clear();
4887
                    List<MarkupInfoItem> gridSelectionRevItem = gridViewRevMarkup.SelectedItems.Cast<MarkupInfoItem>().ToList();
4888

    
4889
                    foreach (var item in gridSelectionRevItem)
4890
                    {
4891
                        var markupitems = item.MarkupList.Where(pageItem => pageItem.PageNumber == ViewerDataModel.Instance.SyncPageNumber).ToList();
4892
                        foreach (var markupitem in markupitems)
4893
                        {
4894
                            await MarkupParser.ParseExAsync(App.BaseAddress, ViewerDataModel.Instance.CancellationToken(), App.ViewInfo.ProjectNO, markupitem.Data, Common.ViewerDataModel.Instance.MarkupControls_Sync,0, item.DisplayColor, "", item.MarkupInfoID);
4895
                        }
4896
                    }
4897

    
4898
                    tlSyncPageNum.Text = String.Format("Current Page : {0}", ViewerDataModel.Instance.SyncPageNumber);
4899
                }
4900
            }
4901
        }
4902

    
4903
        private void SyncRotation_Click(object sender,RoutedEventArgs e)
4904
        {
4905
            var direction = int.Parse((sender as Telerik.Windows.Controls.RadPathButton).Tag.ToString());
4906

    
4907
            double translateX = 0;
4908
            double translateY = 0;
4909
            double angle = rotate2.Angle;
4910

    
4911
            if (direction == 1)
4912
            {
4913
                if (angle < 270)
4914
                {
4915
                    angle += 90;
4916
                }
4917
                else
4918
                {
4919
                    angle = 0;
4920
                }
4921
            }
4922
            else
4923
            {
4924
                if (angle > 0)
4925
                {
4926
                    angle -= 90;
4927
                }
4928
                else
4929
                {
4930
                    angle = 270;
4931
                }
4932
            }
4933
            zoomAndPanControl2.RotationAngle = angle;
4934
            zoomAndPanControl2.ScaleToFit();
4935

    
4936
            //if (angle == 90 || angle == 270)
4937
            //{
4938
                double emptySize = zoomAndPanCanvas2.Width;
4939
                zoomAndPanCanvas2.Width = zoomAndPanCanvas2.Height;
4940
                zoomAndPanCanvas2.Height = emptySize;
4941
            //}
4942

    
4943
            if (angle == 90)
4944
            {
4945
                translateX = zoomAndPanCanvas2.Width;
4946
                translateY = 0;
4947
            }
4948
            else if (angle == 180)
4949
            {
4950
                translateX = zoomAndPanCanvas2.Width;
4951
                translateY = zoomAndPanCanvas2.Height;
4952
            }
4953
            else if (angle == 270)
4954
            {
4955
                translateX = 0;
4956
                translateY = zoomAndPanCanvas2.Height;
4957
            }
4958
            zoomAndPanControl2.ContentViewportWidth = zoomAndPanCanvas2.Width;
4959
            zoomAndPanControl2.ContentViewportHeight = zoomAndPanCanvas2.Height;
4960
            translate2.X = translateX;
4961
            translate2.Y = translateY;
4962
            rotate2.Angle = angle;
4963
            //translate2CompareBorder.X = translateX;
4964
            //translate2CompareBorder.Y = translateY;
4965
            //rotate2CompareBorder.Angle = angle;
4966

    
4967
        }
4968

    
4969
        private void SyncChange_Click(object sender, RoutedEventArgs e)
4970
        {
4971
            if (MarkupMode.IsChecked)
4972
            {
4973
                IsSyncPDFMode = true;
4974

    
4975
                var uri = CurrentRev.TO_VENDOR;
4976

    
4977
                if (ViewerDataModel.Instance.SyncPageNumber == 0)
4978
                {
4979
                    ViewerDataModel.Instance.SyncPageNumber = 1;
4980
                }
4981

    
4982
                //PDF모드 잠시 대기(강인구)
4983
                Get_FinalImage.Get_PdfImage get_PdfImage = new Get_FinalImage.Get_PdfImage();
4984
                var pdfpath = new BitmapImage(new Uri(get_PdfImage.Run(CurrentRev.TO_VENDOR, App.ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, ViewerDataModel.Instance.SyncPageNumber)));
4985

    
4986
                if (pdfpath.IsDownloading)
4987
                {
4988
                    pdfpath.DownloadCompleted += (ex, arg) =>
4989
                    {
4990
                        ViewerDataModel.Instance.ImageViewPath_C = pdfpath;
4991
                        ViewerDataModel.Instance.ImageViewWidth_C = pdfpath.PixelWidth;
4992
                        ViewerDataModel.Instance.ImageViewHeight_C = pdfpath.PixelHeight;
4993
                        zoomAndPanCanvas2.Width = pdfpath.PixelWidth;
4994
                        zoomAndPanCanvas2.Height = pdfpath.PixelHeight;
4995
                    };
4996
                }
4997
                else
4998
                {
4999
                    ViewerDataModel.Instance.ImageViewPath_C = pdfpath;
5000
                    ViewerDataModel.Instance.ImageViewWidth_C = pdfpath.PixelWidth;
5001
                    ViewerDataModel.Instance.ImageViewHeight_C = pdfpath.PixelHeight;
5002

    
5003
                    zoomAndPanCanvas2.Width = pdfpath.PixelWidth;
5004
                    zoomAndPanCanvas2.Height = pdfpath.PixelHeight;
5005
                }
5006
            }
5007
            else
5008
            {
5009
                IsSyncPDFMode = false;
5010
                string uri = this.GetImageURL(CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber);
5011

    
5012
                ComparePageLoad(uri,false);
5013

    
5014
                zoomAndPanControl2.ApplyTemplate();
5015
                zoomAndPanControl2.UpdateLayout();
5016
                zoomAndPanCanvas2.Width = Convert.ToDouble(Common.ViewerDataModel.Instance.ContentWidth);
5017
                zoomAndPanCanvas2.Height = Convert.ToDouble(Common.ViewerDataModel.Instance.ContentHeight);
5018
            }
5019
        }
5020

    
5021
        /// <summary>
5022
        /// Compare된 영역을 초기화
5023
        /// </summary>
5024
        private void ClearCompareRect()
5025
        {
5026
            da.From = 1;
5027
            da.To = 1;
5028
            da.Duration = new Duration(TimeSpan.FromSeconds(9999));
5029
            da.AutoReverse = false;
5030
            canvas_compareBorder.Children.Clear();
5031
            canvas_compareBorder.BeginAnimation(OpacityProperty, da);
5032
        }
5033

    
5034
        /// <summary>
5035
        /// 문서 Comprare
5036
        /// </summary>
5037
        private void SetCompareRect()
5038
        {
5039
            canvas_compareBorder.Children.Clear();
5040

    
5041
            if (CompareMode.IsChecked)
5042
            {
5043
                if (ViewerDataModel.Instance.PageBalanceMode && ViewerDataModel.Instance.PageBalanceNumber == 0)
5044
                {
5045
                    ViewerDataModel.Instance.PageBalanceNumber = 1;
5046
                }
5047
                if (ViewerDataModel.Instance.SyncPageNumber == 0)
5048
                {
5049
                    ViewerDataModel.Instance.SyncPageNumber = 1;
5050
                }
5051

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

    
5054
                /// 비교대상원본, 비교할 대상
5055
                BaseClient.GetCompareRectAsync(_ViewInfo.ProjectNO, _ViewInfo.DocumentItemID,  CurrentRev.DOCUMENT_ID,  ViewerDataModel.Instance.SyncPageNumber.ToString(), pageNavigator.CurrentPage.PageNumber.ToString(), userData.COMPANY != "EXT" ? "true" : "false");
5056
            }
5057
            else
5058
            {
5059
                canvas_compareBorder.Visibility = Visibility.Hidden;
5060
                ClearCompareRect();
5061
            }
5062
        }
5063

    
5064
        private void btnSync_Click(object sender, RoutedEventArgs e)
5065
        {
5066
            gridViewHistory_Busy.IsBusy = true;
5067

    
5068
            RadButton instance = sender as RadButton;
5069
            if (instance.CommandParameter != null)
5070
            {
5071
                CurrentRev = instance.CommandParameter as VPRevision;
5072
                System.EventHandler<ServiceDeepView.GetSyncMarkupInfoItemsCompletedEventArgs> GetSyncMarkupInfoItemshandler = null;
5073

    
5074
                GetSyncMarkupInfoItemshandler = (sen, ea) =>
5075
                {
5076
                    if (ea.Error == null && ea.Result != null)
5077
                    {
5078
                        testPanel2.IsHidden = false;
5079

    
5080
                        ViewerDataModel.Instance._markupInfoRevList.Clear();
5081
                        foreach (var info in ea.Result)
5082
                        {
5083
                            if (info.UserID == App.ViewInfo.UserID)
5084
                            {
5085
                                info.userDelete = true;
5086
                                info.DisplayColor = "#FFFF0000";
5087
                            }
5088
                            else
5089
                            {
5090
                                info.userDelete = false;
5091
                            }
5092
                            ViewerDataModel.Instance._markupInfoRevList.Add(info);
5093
                        }
5094
                        gridViewRevMarkup.ItemsSource = ViewerDataModel.Instance._markupInfoRevList;
5095

    
5096
                        string uri = this.GetImageURL(CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber);
5097
                        ComparePageLoad(uri,false);
5098

    
5099
                        Sync_Offset_Point = new Point(zoomAndPanControl.ContentOffsetX, zoomAndPanControl.ContentOffsetY);
5100

    
5101
                        zoomAndPanControl2.ApplyTemplate();
5102
                        zoomAndPanControl2.UpdateLayout();
5103

    
5104
                        if (Sync_Offset_Point != new Point(zoomAndPanControl.ContentOffsetX, zoomAndPanControl.ContentOffsetY))
5105
                        {
5106
                            zoomAndPanControl.ContentOffsetX = Sync_Offset_Point.X;
5107
                            zoomAndPanControl.ContentOffsetY = Sync_Offset_Point.Y;
5108
                        }
5109

    
5110
                        ViewerDataModel.Instance.Sync_ContentOffsetX = Sync_Offset_Point.X;
5111
                        ViewerDataModel.Instance.Sync_ContentOffsetY = Sync_Offset_Point.Y;
5112
                        ViewerDataModel.Instance.Sync_ContentScale = zoomAndPanControl.ContentScale;
5113

    
5114
                        tlSyncRev.Text = String.Format("Rev. {0}", CurrentRev.RevNo);
5115
                        tlSyncPageNum.Text = String.Format("Current Page : {0}", pageNavigator.CurrentPage.PageNumber);
5116

    
5117
                        zoomAndPanControl.ScaleToFit();
5118
                        zoomAndPanControl2.ScaleToFit();
5119

    
5120
                        gridViewHistory_Busy.IsBusy = false;
5121
                    }
5122

    
5123
                    //Logger.sendResLog("GetSyncMarkupInfoItemsCompleted", "UserState : " + ea.UserState + "\r Result :" + ea.Result + "\r Cancelled :" + ea.Cancelled + "\r Error :" + ea.Error, 1);
5124

    
5125
                    if (GetSyncMarkupInfoItemshandler != null)
5126
                    {
5127
                        BaseClient.GetSyncMarkupInfoItemsCompleted -= GetSyncMarkupInfoItemshandler;
5128
                    }
5129

    
5130
                    //ClearCompareRect();
5131
                    SetCompareRect();
5132
                };
5133

    
5134
                /// 중복 실행이 발생하여 수정함.
5135
                BaseClient.GetSyncMarkupInfoItemsCompleted += GetSyncMarkupInfoItemshandler;
5136
                BaseClient.GetSyncMarkupInfoItemsAsync(_ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, _ViewInfo.UserID);
5137

    
5138
                //Logger.sendReqLog("GetSyncMarkupInfoItemsAsync", _ViewInfo.ProjectNO + "," + CurrentRev.DOCUMENT_ID + "," + _ViewInfo.UserID, 1);
5139
            }
5140
        }
5141

    
5142
        private void OriginalSizeMode_Click(object sender,RoutedEventArgs e)
5143
        {
5144
            string uri = this.GetImageURL(CurrentRev.DOCUMENT_ID, ViewerDataModel.Instance.SyncPageNumber);
5145
            var isOriginalSize = !(ViewerDataModel.Instance.SyncPageNumber == pageNavigator.CurrentPage.PageNumber);
5146

    
5147
            ComparePageLoad(uri, OriginalSizeMode.IsChecked);
5148
        }
5149

    
5150
        private void EnsembleLink_Button_Click(object sender, RoutedEventArgs e)
5151
        {
5152
            try
5153
            {
5154
                if (sender is RadButton)
5155
                {
5156
                    if ((sender as RadButton).Tag != null)
5157
                    {
5158
                        var url = (sender as RadButton).Tag.ToString();
5159
                        System.Diagnostics.Process.Start(url);
5160
                    }
5161
                    else
5162
                    {
5163
                        this.ParentOfType<MainWindow>().DialogMessage_Alert("Link 정보가 잘못 되었습니다", "안내");
5164
                    }
5165
                }
5166
            }
5167
            catch (Exception ex)
5168
            {
5169
                //Logger.sendResLog("EnsembleLink_Button_Click", ex.Message, 0);
5170
            }
5171
        }
5172

    
5173
        public void Sync_Event(VPRevision Currnet_Rev)
5174
        {
5175
            CurrentRev = Currnet_Rev;
5176

    
5177
            BaseClient.GetSyncMarkupInfoItemsCompleted += (sen, ea) =>
5178
            {
5179
                if (ea.Error == null && ea.Result != null)
5180
                {
5181
                    testPanel2.IsHidden = false;
5182

    
5183
                    ViewerDataModel.Instance._markupInfoRevList.Clear();
5184
                    foreach (var info in ea.Result)
5185
                    {
5186
                        if (info.UserID == App.ViewInfo.UserID)
5187
                        {
5188
                            info.userDelete = true;
5189
                            info.DisplayColor = "FFFF0000";
5190
                        }
5191
                        else
5192
                        {
5193
                            info.userDelete = false;
5194
                        }
5195
                        ViewerDataModel.Instance._markupInfoRevList.Add(info);
5196
                    }
5197
                    gridViewRevMarkup.ItemsSource = ViewerDataModel.Instance._markupInfoRevList;
5198

    
5199
                    string uri = this.GetImageURL(CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber);
5200

    
5201
                    Sync_Offset_Point = new Point(zoomAndPanControl.ContentOffsetX, zoomAndPanControl.ContentOffsetY);
5202

    
5203
                    ComparePageLoad(uri,false);
5204

    
5205
                    zoomAndPanCanvas2.Width = Convert.ToDouble(Common.ViewerDataModel.Instance.ContentWidth);
5206
                    zoomAndPanCanvas2.Height = Convert.ToDouble(Common.ViewerDataModel.Instance.ContentHeight);
5207
                    zoomAndPanControl2.ApplyTemplate();
5208
                    zoomAndPanControl2.UpdateLayout();
5209

    
5210
                    if (Sync_Offset_Point != new Point(zoomAndPanControl.ContentOffsetX, zoomAndPanControl.ContentOffsetY))
5211
                    {
5212
                        zoomAndPanControl.ContentOffsetX = Sync_Offset_Point.X;
5213
                        zoomAndPanControl.ContentOffsetY = Sync_Offset_Point.Y;
5214
                    }
5215
                    //}
5216
                    
5217
                    tlSyncRev.Text = String.Format("Rev. {0}", CurrentRev.RevNo);
5218
                    tlSyncPageNum.Text = String.Format("Current Page : {0}", pageNavigator.CurrentPage.PageNumber);
5219
                    gridViewHistory_Busy.IsBusy = false;
5220
                }
5221
                //Logger.sendResLog("GetSyncMarkupInfoItemsCompleted", "UserState : " + ea.UserState + "\r Result :" + ea.Result + "\r Cancelled :" + ea.Cancelled + "\r Error :" + ea.Error, 1);
5222
            };
5223
            //Logger.sendReqLog("GetSyncMarkupInfoItemsAsync", _ViewInfo.ProjectNO + "," + CurrentRev.DOCUMENT_ID + "," + _ViewInfo.UserID, 1);
5224
            BaseClient.GetSyncMarkupInfoItemsAsync(_ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, _ViewInfo.UserID);
5225
        }
5226

    
5227
        private void PdfLink_ButtonDown(object sender, MouseButtonEventArgs e)
5228
        {
5229
            if (sender is Image)
5230
            {
5231
                if ((sender as Image).Tag != null)
5232
                {
5233
                    var pdfUrl = (sender as Image).Tag.ToString();
5234
                    System.Diagnostics.Process.Start(pdfUrl);
5235
                }
5236
                else
5237
                {
5238
                    this.ParentOfType<MainWindow>().DialogMessage_Alert("문서 정보가 잘못 되었습니다", "안내");
5239
                }
5240
            }
5241
        }
5242

    
5243
        private void Create_Symbol(object sender, RoutedEventArgs e)
5244
        {
5245
            MarkupToPDF.Controls.Parsing.MarkupParser.MarkupReturn markupReturn = new MarkupToPDF.Controls.Parsing.MarkupParser.MarkupReturn();
5246

    
5247
            if (SelectLayer.Children.Count < 1) //선택된 것이 없으면
5248
            {
5249
                DialogMessage_Alert("Please Select Controls", "Alert");
5250
            }
5251
            else //선택된 것이 있으면
5252
            {
5253
                string MarkupData = "";
5254
                adorner_ = new AdornerFinal();
5255

    
5256
                foreach (var item in SelectLayer.Children)
5257
                {
5258
                    if (item.GetType().Name == "AdornerFinal")
5259
                    {
5260
                        adorner_ = (item as Controls.AdornerFinal);
5261
                        foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
5262
                        {
5263
                            if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
5264
                            {
5265
                                markupReturn = MarkupParser.MarkupToString(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo, App.ViewInfo.UserID);
5266
                                MarkupData += markupReturn.ConvertData;
5267
                            }
5268
                        }
5269
                    }
5270
                }
5271
                DialogParameters parameters = new DialogParameters()
5272
                {
5273
                    Owner = Application.Current.MainWindow,
5274
                    Closed = (obj, args) => this.MarkupNamePromptClose(MarkupData, args),
5275
                    DefaultPromptResultValue = "Custom State",
5276
                    Content = "Name :",
5277
                    Header = "Insert Custom Symbol Name",
5278
                    Theme = new VisualStudio2013Theme(),
5279
                    ModalBackground = new SolidColorBrush { Color = Colors.Black, Opacity = 0.6 },
5280
                };
5281
                RadWindow.Prompt(parameters);
5282
            }
5283
        }
5284

    
5285
        public int symbolselectindex = 0;
5286

    
5287
        private void SymbolMarkupNamePromptClose(byte[] Img_byte, string data, WindowClosedEventArgs args)
5288
        {
5289
            //Save save = new Save();
5290
            try
5291
            {
5292
                string svgfilename = null;
5293
                if (symbolname != null)
5294
                {
5295
                    if (symbolpng == true || symbolsvg == true)
5296
                    {
5297
                        kr.co.devdoftech.cloud.FileUpload fileUploader = App.FileUploader;
5298
                        string guid = Commons.shortGuid();
5299

    
5300
                        fileUploader.RunAsync(App.ViewInfo.ProjectNO, _DocItem.DOCUMENT_NO, App.ViewInfo.UserID, guid + ".png", Img_byte);
5301
                        //Check_Uri.UriCheck();
5302
                        fileUploader.RunCompleted += (ex, arg) =>
5303
                        {
5304
                            filename = arg.Result;
5305
                            if (symbolpng == true)
5306
                            {
5307
                                if (filename != null)
5308
                                {
5309
                                    if (symbolselectindex == 0)
5310
                                    {
5311
                                        SymbolSave(symbolname, filename, data);
5312
                                    }
5313
                                    else
5314
                                    {
5315
                                        SymbolSave_Public(symbolname, filename, data, ViewerDataModel.Instance.SystemMain.dzMainMenu.userData.DEPARTMENT);
5316
                                    }
5317
                                    DataBind();
5318
                                }
5319
                            }
5320

    
5321
                            if (symbolsvg == true)
5322
                            {
5323
                                try
5324
                                {
5325
                                    var defaultBitmapImage = new BitmapImage();
5326
                                    defaultBitmapImage.BeginInit();
5327
                                    defaultBitmapImage.CreateOptions = BitmapCreateOptions.IgnoreImageCache;
5328
                                    defaultBitmapImage.CacheOption = BitmapCacheOption.OnLoad;
5329
                                    Check_Uri.UriCheck(filename);
5330
                                    defaultBitmapImage.UriSource = new Uri(filename);
5331
                                    defaultBitmapImage.EndInit();
5332

    
5333
                                    System.Drawing.Bitmap image;
5334

    
5335
                                    if (defaultBitmapImage.IsDownloading)
5336
                                    {
5337
                                        defaultBitmapImage.DownloadCompleted += (ex2, arg2) =>
5338
                                        {
5339
                                            defaultBitmapImage.Freeze();
5340
                                            image = GetBitmap(defaultBitmapImage);
5341
                                            image.Save(@AppDomain.CurrentDomain.BaseDirectory + "potrace.bmp", System.Drawing.Imaging.ImageFormat.Bmp);
5342
                                            Process potrace = new Process
5343
                                            {
5344
                                                StartInfo = new ProcessStartInfo
5345
                                                {
5346
                                                    FileName = @AppDomain.CurrentDomain.BaseDirectory + "potrace.exe",
5347
                                                    Arguments = "-b svg " + @AppDomain.CurrentDomain.BaseDirectory + "potrace.bmp",
5348
                                                    RedirectStandardInput = true,
5349
                                                    RedirectStandardOutput = true,
5350
                                                    RedirectStandardError = true,
5351
                                                    UseShellExecute = false,
5352
                                                    CreateNoWindow = true,
5353
                                                    WindowStyle = ProcessWindowStyle.Hidden
5354
                                                },
5355
                                            };
5356

    
5357
                                            StringBuilder svgBuilder = new StringBuilder();
5358
                                            potrace.OutputDataReceived += (object sender2, DataReceivedEventArgs e2) =>
5359
                                            {
5360
                                                svgBuilder.AppendLine(e2.Data);
5361
                                            };
5362

    
5363
                                            potrace.EnableRaisingEvents = true;
5364
                                            potrace.Start();
5365
                                            potrace.Exited += (sender, e) =>
5366
                                            {
5367
                                                byte[] bytes = System.IO.File.ReadAllBytes(@AppDomain.CurrentDomain.BaseDirectory + "potrace.svg");
5368
                                                svgfilename = fileUploader.Run(App.ViewInfo.ProjectNO, _DocItem.DOCUMENT_NO, App.ViewInfo.UserID, guid + ".svg", bytes);
5369
                                                Check_Uri.UriCheck(svgfilename);
5370
                                                if (symbolselectindex == 0)
5371
                                                {
5372
                                                    SymbolSave(symbolname, svgfilename, data);
5373
                                                }
5374
                                                else
5375
                                                {
5376
                                                    SymbolSave_Public(symbolname, svgfilename, data, ViewerDataModel.Instance.SystemMain.dzMainMenu.userData.DEPARTMENT);
5377
                                                }
5378

    
5379
                                                DataBind();
5380
                                            };
5381
                                            potrace.WaitForExit();
5382
                                        };
5383
                                    }
5384
                                    else
5385
                                    {
5386
                                        //GC.Collect();
5387
                                    }
5388
                                }
5389
                                catch (Exception ee)
5390
                                {
5391
                                    DialogMessage_Alert("" + ee, "Alert");
5392
                                }
5393
                            }
5394
                        };
5395
                    }
5396
                }
5397
            }
5398
            catch (Exception e)
5399
            {
5400
                //DialogMessage_Alert(e + "", "Alert");
5401
            }
5402
        }
5403

    
5404
        public void SymbolSave(string Name, string Url, string Data)
5405
        {
5406
            try
5407
            {
5408
                SYMBOL_PRIVATE symbol_private = new SYMBOL_PRIVATE
5409
                {
5410
                    ID = Commons.shortGuid(),
5411
                    MEMBER_USER_ID = App.ViewInfo.UserID,
5412
                    NAME = Name,
5413
                    IMAGE_URL = Url,
5414
                    DATA = Data
5415
                };
5416

    
5417
                Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.SaveSymbolCompleted += BaseClient_SaveSymbolCompleted;
5418
                //Logger.sendReqLog("SaveSymbolAsync: ", symbol_private.ID + "," + symbol_private.MEMBER_USER_ID + "," + symbol_private.NAME + "," + symbol_private.IMAGE_URL + "," + symbol_private.DATA, 1);
5419
                Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.SaveSymbolAsync(symbol_private);
5420
            }
5421
            catch (Exception)
5422
            {
5423
                throw;
5424
            }
5425
        }
5426

    
5427
        public void SymbolSave_Public(string Name, string Url, string Data, string Department)
5428
        {
5429
            try
5430
            {
5431
                SYMBOL_PUBLIC symbol_public = new SYMBOL_PUBLIC
5432
                {
5433
                    ID = Commons.shortGuid(),
5434
                    DEPARTMENT = Department,
5435
                    NAME = Name,
5436
                    IMAGE_URL = Url,
5437
                    DATA = Data
5438
                };
5439
                Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.AddPublicSymbolCompleted += BaseClient_AddPublicSymbolCompleted;
5440
                //Logger.sendReqLog("AddPublicSymbol: ", symbol_public.ID + "," + symbol_public.DEPARTMENT + "," + symbol_public.NAME + "," + symbol_public.IMAGE_URL + "," + symbol_public.DATA, 1);
5441
                Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.AddPublicSymbol(symbol_public);
5442
            }
5443
            catch (Exception)
5444
            {
5445
                throw;
5446
            }
5447
        }
5448

    
5449
        private void BaseClient_AddPublicSymbolCompleted(object sender, ServiceDeepView.AddPublicSymbolCompletedEventArgs e)
5450
        {
5451
            //Logger.sendResLog("AddPublicSymbolCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1);
5452
            DataBind();
5453
        }
5454

    
5455
        private void BaseClient_SaveSymbolCompleted(object sender, ServiceDeepView.SaveSymbolCompletedEventArgs e)
5456
        {
5457
            //Logger.sendResLog("RenameSymbolCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1);
5458
            DataBind();
5459
        }
5460

    
5461
        private void DataBind()
5462
        {
5463
            try
5464
            {
5465
                Symbol_Custom Custom = new Symbol_Custom();
5466
                List<Symbol_Custom> Custom_List = new List<Symbol_Custom>();
5467

    
5468
                var symbol_Private = BaseClient.GetSymbolList(App.ViewInfo.UserID);
5469
                foreach (var item in symbol_Private)
5470
                {
5471
                    Custom.Name = item.NAME;
5472
                    Custom.ImageUri = item.IMAGE_URL;
5473
                    Custom.ID = item.ID;
5474
                    Custom_List.Add(Custom);
5475
                    Custom = new Symbol_Custom();
5476
                }
5477
                symbolPanel_Instance.lstSymbolPrivate.ItemsSource = Custom_List;
5478

    
5479
                Custom = new Symbol_Custom();
5480
                Custom_List = new List<Symbol_Custom>();
5481

    
5482
                symbolPanel_Instance.deptlist.ItemsSource = BaseClient.GetPublicSymbolDeptList();
5483

    
5484
                List<SYMBOL_PUBLIC> symbol_Public;
5485

    
5486
                if (symbolPanel_Instance.deptlist.SelectedValue != null)
5487
                {
5488
                    symbol_Public = BaseClient.GetPublicSymbolList(symbolPanel_Instance.deptlist.SelectedValue.ToString());
5489
                }
5490
                else
5491
                {
5492
                    symbol_Public = BaseClient.GetPublicSymbolList(null);
5493
                }
5494
                foreach (var item in symbol_Public)
5495
                {
5496
                    Custom.Name = item.NAME;
5497
                    Custom.ImageUri = item.IMAGE_URL;
5498
                    Custom.ID = item.ID;
5499
                    Custom_List.Add(Custom);
5500
                    Custom = new Symbol_Custom();
5501
                }
5502
                symbolPanel_Instance.lstSymbolPublic.ItemsSource = Custom_List;
5503
                BaseClient.Close();
5504
            }
5505
            catch (Exception e)
5506
            {
5507
                //DialogMessage_Alert("DataBind", "Alert");
5508
            }
5509
        }
5510

    
5511
        private async void MarkupNamePromptClose(string data, WindowClosedEventArgs args)
5512
        {
5513
            try
5514
            {
5515
                if (args.PromptResult != null)
5516
                {
5517
                    if (args.DialogResult.Value)
5518
                    {
5519
                        PngBitmapEncoder _Encoder = await symImageAsync(data);
5520

    
5521
                        System.IO.MemoryStream fs = new System.IO.MemoryStream();
5522
                        _Encoder.Save(fs);
5523
                        System.Drawing.Image ImgOut = System.Drawing.Image.FromStream(fs);
5524

    
5525
                        byte[] Img_byte = fs.ToArray();
5526

    
5527
                        kr.co.devdoftech.cloud.FileUpload fileUploader = App.FileUploader;
5528
                        filename = fileUploader.Run(App.ViewInfo.ProjectNO, _DocItem.DOCUMENT_NO, App.ViewInfo.UserID, Commons.shortGuid() + ".png", Img_byte);
5529
                        Check_Uri.UriCheck(filename);
5530
                        if (symbolPanel_Instance.RadTab.SelectedIndex == 0)
5531
                        {
5532
                            SaveCommand.Instance.SymbolSave(args.PromptResult, filename, data);
5533
                        }
5534
                        else
5535
                        {
5536
                            SaveCommand.Instance.SymbolSave_Public(args.PromptResult, filename, data, ViewerDataModel.Instance.SystemMain.dzMainMenu.userData.DEPARTMENT);
5537
                        }
5538
                        DataBind();
5539
                    }
5540
                }
5541
            }
5542
            catch (Exception ex)
5543
            {
5544
                DialogMessage_Alert("" + ex, "Alert");
5545
            }
5546
        }
5547

    
5548
        public async Task<PngBitmapEncoder> symImageAsync(string data)
5549
        {
5550
            Canvas _canvas = new Canvas();
5551
            _canvas.Background = Brushes.White;
5552
            _canvas.Width = adorner_.BorderSize.Width;
5553
            _canvas.Height = adorner_.BorderSize.Height;
5554
            await MarkupParser.ParseAsync(App.BaseAddress, App.ViewInfo.ProjectNO, data, _canvas,ViewerDataModel.Instance.PageAngle, "#FFFF0000", "", ViewerDataModel.Instance.CancellationToken());
5555

    
5556
            BitmapEncoder encoder = new PngBitmapEncoder();
5557

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

    
5560
            DrawingVisual dv = new DrawingVisual();
5561

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

    
5565
            using (DrawingContext ctx = dv.RenderOpen())
5566
            {
5567
                VisualBrush vb = new VisualBrush(_canvas);
5568
                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)));
5569
            }
5570

    
5571
            try
5572
            {
5573
                renderBitmap.Render(dv);
5574

    
5575
                GC.Collect(2);
5576
                GC.WaitForPendingFinalizers();
5577
                //GC.Collect();
5578
                // encode png data
5579
                PngBitmapEncoder pngEncoder = new PngBitmapEncoder();
5580
                // puch rendered bitmap into it
5581
                pngEncoder.Interlace = PngInterlaceOption.Off;
5582
                pngEncoder.Frames.Add(BitmapFrame.Create(renderBitmap));
5583
                return pngEncoder;
5584
            }
5585
            catch //(Exception ex)
5586
            {
5587
                return null;
5588
            }
5589
        }
5590

    
5591
        public void DialogMessage_Alert(string content, string header)
5592
        {
5593
            App.splashScreen.Close();
5594

    
5595
            DialogParameters parameters = new DialogParameters()
5596
            {
5597
                Owner = this.ParentOfType<MainWindow>(),
5598
                Content = new TextBlock()
5599
                {
5600
                    MinWidth = 400,
5601
                    FontSize = 11,
5602
                    Text = content,
5603
                    TextWrapping = System.Windows.TextWrapping.Wrap
5604
                },
5605
                DialogStartupLocation = WindowStartupLocation.CenterOwner,
5606
                Header = header,
5607
                Theme = new VisualStudio2013Theme(),
5608
                ModalBackground = new SolidColorBrush { Color = Colors.Black, Opacity = 0.6 },
5609
            };
5610
            RadWindow.Alert(parameters);
5611
        }
5612

    
5613
        #region 캡쳐 기능
5614

    
5615
        public BitmapSource CutAreaToImage(int x, int y, int width, int height)
5616
        {
5617
            if (x < 0)
5618
            {
5619
                width += x;
5620
                x = 0;
5621
            }
5622
            if (y < 0)
5623
            {
5624
                height += y;
5625
                y = 0;
5626

    
5627
                width = (int)zoomAndPanCanvas.ActualWidth - x;
5628
            }
5629
            if (x + width > zoomAndPanCanvas.ActualWidth)
5630
            {
5631
                width = (int)zoomAndPanCanvas.ActualWidth - x;
5632
            }
5633
            if (y + height > zoomAndPanCanvas.ActualHeight)
5634
            {
5635
                height = (int)zoomAndPanCanvas.ActualHeight - y;
5636
            }
5637

    
5638
            byte[] pixels = CopyPixels(x, y, width, height);
5639

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

    
5642
            return BitmapSource.Create(width, height, 96, 96, PixelFormats.Pbgra32, null, pixels, stride);
5643
        }
5644

    
5645
        public byte[] CopyPixels(int x, int y, int width, int height)
5646
        {
5647
            byte[] pixels = new byte[width * height * 4];
5648
            int stride = (width * canvasImage.Format.BitsPerPixel + 7) / 8;
5649

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

    
5653
            return pixels;
5654
        }
5655

    
5656
        public RenderTargetBitmap ConverterBitmapImage(FrameworkElement element)
5657
        {
5658
            DrawingVisual drawingVisual = new DrawingVisual();
5659
            DrawingContext drawingContext = drawingVisual.RenderOpen();
5660

    
5661
            // 해당 객체의 그래픽요소로 사각형의 그림을 그립니다.
5662
            drawingContext.DrawRectangle(new VisualBrush(element), null,
5663
                new Rect(new Point(0, 0), new Point(element.ActualWidth, element.ActualHeight)));
5664
            drawingContext.Close();
5665

    
5666
            // 비트맵으로 변환합니다.
5667
            RenderTargetBitmap target =
5668
                new RenderTargetBitmap((int)element.ActualWidth, (int)element.ActualHeight,
5669
                96, 96, System.Windows.Media.PixelFormats.Pbgra32);
5670

    
5671
            target.Render(drawingVisual);
5672
            return target;
5673
        }
5674

    
5675
        private System.Drawing.Bitmap GetBitmap(BitmapSource source)
5676
        {
5677
            System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(source.PixelWidth, source.PixelHeight, System.Drawing.Imaging.PixelFormat.Format32bppPArgb);
5678
            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);
5679
            source.CopyPixels(Int32Rect.Empty, data.Scan0, data.Height * data.Stride, data.Stride);
5680
            bmp.UnlockBits(data);
5681
            return bmp;
5682
        }
5683

    
5684
        public string symbolname = null;
5685
        public bool symbolsvg = true;
5686
        public bool symbolpng = true;
5687

    
5688
        public void Save_Symbol_Capture(BitmapSource source, int x, int y, int width, int height)
5689
        {
5690
            System.Drawing.Bitmap image = GetBitmap(source);
5691
            //흰색 제거
5692
            //image.MakeTransparent(System.Drawing.Color.White);
5693

    
5694
            var imageStream = new System.IO.MemoryStream();
5695
            byte[] imageBytes = null;
5696
            using (imageStream)
5697
            {
5698
                image.Save(imageStream, System.Drawing.Imaging.ImageFormat.Png);
5699
                // test.Save(@"E:\test.png", System.Drawing.Imaging.ImageFormat.Png);
5700
                imageStream.Position = 0;
5701
                imageBytes = imageStream.ToArray();
5702
            }
5703

    
5704
            SymbolPrompt symbolPrompt = new SymbolPrompt();
5705

    
5706
            RadWindow CheckPop = new RadWindow();
5707
            //Alert check = new Alert(Msg);
5708

    
5709
            CheckPop = new RadWindow
5710
            {
5711
                MinWidth = 400,
5712
                MinHeight = 100,
5713
                // Closed = (obj, args) => this.SymbolMarkupNamePromptClose(imageBytes, "", args),
5714
                Header = "Alert",
5715
                Content = symbolPrompt,
5716
                //DialogResult =
5717
                ResizeMode = System.Windows.ResizeMode.NoResize,
5718
                WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen,
5719
                IsTopmost = true,
5720
            };
5721
            CheckPop.Closed += (obj, args) => this.SymbolMarkupNamePromptClose(imageBytes, "", args);
5722
            StyleManager.SetTheme(CheckPop, new Office2013Theme());
5723
            CheckPop.ShowDialog();
5724

    
5725
            /*
5726
            DialogParameters parameters = new DialogParameters()
5727
            {
5728
                Owner = Application.Current.MainWindow,
5729
                Closed = (obj, args) => this.SymbolMarkupNamePromptClose(imageBytes, "", args),
5730
                DefaultPromptResultValue = "Custom State",
5731
                Content = "Name :",
5732
                Header = "Insert Custom Symbol Name",
5733
                Theme = new VisualStudio2013Theme(),
5734
                ModalBackground = new SolidColorBrush { Color = Colors.Black, Opacity = 0.6 },
5735
            };
5736
            RadWindow.Prompt(parameters);
5737
            */
5738
        }
5739

    
5740
        public void Save_Capture(BitmapSource source, int x, int y, int width, int height)
5741
        {
5742
            KCOM.Common.Converter.FileStreamToBase64 streamToBase64 = new Common.Converter.FileStreamToBase64();
5743
            KCOMDataModel.DataModel.CHECK_LIST check_;
5744
            string Result = streamToBase64.ImageToBase64(source);
5745
            KCOMDataModel.DataModel.CHECK_LIST Item = new KCOMDataModel.DataModel.CHECK_LIST();
5746
            string projectno = App.ViewInfo.ProjectNO;
5747
            string checklist_id = ViewerDataModel.Instance.CheckList_ID;
5748

    
5749
            //Logger.sendReqLog("GetCheckList", projectno + "," + checklist_id, 1);
5750
            Item = this.BaseClient.GetCheckList(projectno, checklist_id);
5751
            if (Item != null)
5752
            {
5753
                //Logger.sendResLog("GetCheckList", "TRUE", 1);
5754
            }
5755
            else
5756
            {
5757
                //Logger.sendResLog("GetCheckList", "FALSE", 1);
5758
            }
5759

    
5760
            if (Item == null)
5761
            {
5762
                check_ = new KCOMDataModel.DataModel.CHECK_LIST
5763
                {
5764
                    ID = Commons.shortGuid(),
5765
                    USER_ID = App.ViewInfo.UserID,
5766
                    IMAGE_URL = Result,
5767
                    IMAGE_ANCHOR = x + "," + y + "," + width + "," + height,
5768
                    PAGENUMBER = this.pageNavigator.CurrentPage.PageNumber,
5769
                    REVISION = ViewerDataModel.Instance.SystemMain.dzMainMenu.CurrentDoc.Revision,
5770
                    DOCUMENT_ID = App.ViewInfo.DocumentItemID,
5771
                    PROJECT_NO = App.ViewInfo.ProjectNO,
5772
                    STATUS = "False",
5773
                    CREATE_TIME = DateTime.Now,
5774
                    UPDATE_TIME = DateTime.Now,
5775
                    DOCUMENT_NO = _DocItem.DOCUMENT_NO,
5776
                    STATUS_DESC_OPEN = "Vendor 반영 필요",
5777
                };
5778
                Logger.sendReqLog("AddCheckList", projectno + "," + check_, 1);
5779
                //Logger.sendResLog("AddCheckList", this.BaseClient.AddCheckList(projectno, check_).ToString(), 1);
5780
                this.BaseClient.AddCheckList(projectno, check_);
5781
            }
5782
            else
5783
            {
5784
                Item.IMAGE_URL = Result;
5785
                Item.IMAGE_ANCHOR = x + "," + y + "," + width + "," + height;
5786
                Item.PAGENUMBER = this.pageNavigator.CurrentPage.PageNumber;
5787
                Logger.sendReqLog("SaveCheckList", projectno + "," + checklist_id + "," + Item, 1);
5788
                //Logger.sendResLog("SaveCheckList", this.BaseClient.SaveCheckList(projectno, checklist_id, Item).ToString(), 1);
5789
                this.BaseClient.SaveCheckList(projectno, checklist_id, Item);
5790
            }
5791
        }
5792

    
5793
        public void Set_Capture()
5794
        {
5795
            double x = CanvasDrawingMouseDownPoint.X;
5796
            double y = CanvasDrawingMouseDownPoint.Y;
5797
            double width = dragCaptureBorder.Width;
5798
            double height = dragCaptureBorder.Height;
5799

    
5800
            if (width > 5 || height > 5)
5801
            {
5802
                canvasImage = ConverterBitmapImage(zoomAndPanCanvas);
5803
                BitmapSource source = CutAreaToImage((int)x, (int)y, (int)width, (int)height);
5804
                Save_Capture(source, (int)x, (int)y, (int)width, (int)height);
5805
            }
5806
        }
5807

    
5808
        #endregion 캡쳐 기능
5809

    
5810
        public Multi_Undo_data Control_Style(CommentUserInfo control)
5811
        {
5812
            multi_Undo_Data = new Multi_Undo_data();
5813

    
5814
            multi_Undo_Data.Markup = control;
5815

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

    
5833
            return multi_Undo_Data;
5834
        }
5835

    
5836
        private async void Comment_Move(object sender, MouseButtonEventArgs e)
5837
        {
5838
            string Select_ID = (((e.Source as Telerik.Windows.Controls.RadButton).DataContext) as IKCOM.MarkupInfoItem).MarkupInfoID;
5839
            foreach (var items in ViewerDataModel.Instance._markupInfoRevList)
5840
            {
5841
                if (items.MarkupInfoID == Select_ID)
5842
                {
5843
                    foreach (var item in items.MarkupList)
5844
                    {
5845
                        if (item.PageNumber == pageNavigator.CurrentPage.PageNumber)
5846
                        {
5847
                            await MarkupParser.ParseExAsync(App.BaseAddress, ViewerDataModel.Instance.CancellationToken(), App.ViewInfo.ProjectNO, item.Data, Common.ViewerDataModel.Instance.MarkupControls_USER,ViewerDataModel.Instance.PageAngle, "#FFFF0000", "",
5848
                                 items.MarkupInfoID, Commons.shortGuid());
5849
                        }
5850
                    }
5851
                }
5852
            }
5853
        }
5854

    
5855
        /// <summary>
5856
        /// convert inkcontrol to polygoncontrol
5857
        /// </summary>
5858
        public void ConvertInkControlToPolygon()
5859
        {
5860
            if (inkBoard.Strokes.Count > 0)
5861
            {
5862
                inkBoard.Strokes.ToList().ForEach(stroke =>
5863
                {
5864
                    InkToPath ip = new InkToPath();
5865

    
5866
                    List<Point> inkPointSet = new List<Point>();
5867
                    inkPointSet.AddRange(ip.GetPointsFrom(stroke));
5868

    
5869
                    PolygonControl pc = new PolygonControl()
5870
                    {
5871
                        CommentAngle = 0,
5872
                        PointSet = inkPointSet,
5873
                        ControlType = ControlType.Ink
5874
                    };
5875
                    pc.StartPoint = inkPointSet[0];
5876
                    pc.EndPoint = inkPointSet[inkPointSet.Count - 1];
5877
                    pc.LineSize = 3;
5878
                    pc.CommentID = Commons.shortGuid();
5879
                    pc.StrokeColor = new SolidColorBrush(Colors.Red);
5880

    
5881
                    if (pc.PointSet.Count > 0)
5882
                    {
5883
                        CreateCommand.Instance.Execute(pc);
5884
                        ViewerDataModel.Instance.MarkupControls_USER.Add(pc);
5885
                    }
5886
                });
5887
                inkBoard.Strokes.Clear();
5888
            }
5889
        }
5890

    
5891
        /// <summary>
5892
        /// 캔버스에 그릴때 모든 포인트가 캔버스를 벗어 났는지 체크하여 넘겨줌
5893
        /// </summary>
5894
        /// <author>ingu</author>
5895
        /// <date>2018.06.05</date>
5896
        /// <param name="getPoint"></param>
5897
        /// <returns></returns>
5898
        private bool IsGetoutpoint(Point getPoint)
5899
        {
5900
            if (getPoint == new Point())
5901
            {
5902
                ViewerDataModel.Instance.MarkupControls_USER.Remove(currentControl);
5903
                currentControl = null;
5904
                return true;
5905
            }
5906

    
5907
            return false;
5908
        }
5909

    
5910
        private void zoomAndPanControl_DragOver(object sender, DragEventArgs e)
5911
        {
5912
            e.Effects = DragDropEffects.Copy;
5913
        }
5914

    
5915
        private void zoomAndPanControl_DragEnter(object sender, DragEventArgs e)
5916
        {
5917
            e.Effects = DragDropEffects.Copy;
5918
        }
5919

    
5920
        private void zoomAndPanControl_DragLeave(object sender, DragEventArgs e)
5921
        {
5922
            e.Effects = DragDropEffects.None;
5923
        }
5924

    
5925
        private void ZoomAndPanControl_ScaleChanged(object sender, RoutedEventArgs e)
5926
        {
5927
            var pageWidth = ViewerDataModel.Instance.ImageViewWidth;
5928
            var pageHeight = ViewerDataModel.Instance.ImageViewHeight;
5929

    
5930
            ScaleImage(pageWidth, pageHeight);
5931
        }
5932

    
5933
        /// <summary>
5934
        /// 페이지를 scale의 변화에 맞춰서 DecodePixel을 변경한다.
5935
        /// </summary>
5936
        /// <param name="pageWidth">원본 사이즈</param>
5937
        /// <param name="pageHeight">원본 사이즈</param>
5938
        /// <returns></returns>
5939
        private void ScaleImage(double pageWidth, double pageHeight)
5940
        {
5941
            //mainPanel.Scale = zoomAndPanControl.ContentScale;// (zoomAndPanControl.ContentScale >= 0.1) ? 1 : zoomAndPanControl.ContentScale;
5942
        }
5943

    
5944
        private void thumbnailPanel_SizeChanged(object sender, SizeChangedEventArgs e)
5945
        {
5946
            CommonLib.Common.WriteConfigString("SetThumbnail", "WIDTH", thumbnailPanel.Width.ToString());
5947
        }
5948

    
5949
        private void gridViewMarkupAllSelect_Click(object sender, RoutedEventArgs e)
5950
        {
5951
            var checkbox = (sender as CheckBox);
5952

    
5953
            if (checkbox != null)
5954
            {
5955
                if (checkbox.IsChecked.GetValueOrDefault())
5956
                {
5957
                    gridViewMarkup.SelectAll();
5958
                }
5959
                else
5960
                {
5961
                    gridViewMarkup.UnselectAll();
5962
                }
5963
            }
5964
        }
5965
        
5966
        /*
5967
        private void zoomAndPanControl_Drop(object sender, DragEventArgs e)
5968
        {
5969
            try
5970
            {
5971
                if (e.Data.GetDataPresent(typeof(string)))
5972
                {
5973
                    this.getCurrentPoint = e.GetPosition(drawingRotateCanvas);
5974
                    string dragData = e.Data.GetData(typeof(string)) as string;
5975
                    Move_Symbol(sender, dragData);
5976
                }
5977
            }
5978
            catch (Exception ex)
5979
            {
5980
                //Logger.sendResLog("zoomAndPanControl_Drop", ex.ToString(), 0);
5981
            }
5982
        }
5983
        */
5984
    }
5985

    
5986
    public class testItem
5987
    {
5988
        public string Title { get; set; }
5989
    }
5990
}
클립보드 이미지 추가 (최대 크기: 500 MB)