프로젝트

일반

사용자정보

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

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

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

1

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

    
48
namespace KCOM.Views
49
{
50
    public static class ControlExtensions
51
    {
52
        public static T Clone<T>(this T controlToClone)
53
            where T : System.Windows.Controls.Control
54
        {
55
            System.Reflection.PropertyInfo[] controlProperties = typeof(T).GetProperties(System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance);
56

    
57
            T instance = Activator.CreateInstance<T>();
58

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

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

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

    
95
        public TextBox Gui { get; private set; }
96

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

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

    
118
            Gui.Text += line + Environment.NewLine;
119
        }
120
    }
121

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

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

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

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

    
184
                }
185
            }
186
        }
187

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

    
212
        public bool IsSyncPDFMode { get; set; }
213

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

    
238
        #endregion
239

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

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

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

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

    
264
        /// <summary>
265
        /// get image url
266
        /// </summary>
267
        /// <author>humkyung</author>
268
        /// <param name="sDocumentID"></param>
269
        /// <returns></returns>
270
        public string GetImageURL(string sDocumentID, int iPageNo)
271
        {
272
            string uri = string.Empty;
273

    
274
            string sFolder = sDocumentID.All(char.IsDigit) ? (Convert.ToUInt32(sDocumentID) / 100).ToString() : (sDocumentID.Length >= 5 ? sDocumentID.Substring(0, 5) : sDocumentID);
275
            if (userData.COMPANY != "EXT")
276
            {
277
                uri = String.Format(CommonLib.Common.GetConfigString("mainServerImageWebPath", "URL", "", App.isExternal), _ViewInfo.ProjectNO, sFolder, sDocumentID, iPageNo);
278
            }
279
            else
280
            {
281
                uri = String.Format(CommonLib.Common.GetConfigString("subServerImageWebPath", "URL", "", App.isExternal), _ViewInfo.ProjectNO, sDocumentID, iPageNo);
282
            }
283

    
284
            return uri;
285
        }
286

    
287
        /// <summary>
288
        /// 외부망에서의 Original PDF Download 를 위한 리소스 web path 경로로 치환
289
        /// </summary>
290
        /// <returns></returns>
291
        public string GetOriginalPDFURL()
292
        {
293
            string uri = string.Empty;
294
            string sDocumentID = this._DocItem.DOCUMENT_ID;
295
            string filename = string.Empty;
296
            if (this._DocInfo.ORIGINAL_FILE.Contains("fileName"))
297
            {
298
                filename = HttpUtility.ParseQueryString(this._DocInfo.ORIGINAL_FILE).Get("fileName");
299
            }
300
            else
301
            {
302
                filename = System.IO.Path.GetFileName(this._DocInfo.ORIGINAL_FILE);
303
            }
304

    
305
            string sFolder = sDocumentID.All(char.IsDigit) ? (Convert.ToUInt32(sDocumentID) / 100).ToString() : (sDocumentID.Length >= 5 ? sDocumentID.Substring(0, 5) : sDocumentID);
306
            if (userData.COMPANY != "EXT")
307
            {
308
                uri = String.Format(CommonLib.Common.GetConfigString("mainServerImageWebPath", "URL", "", App.isExternal), _ViewInfo.ProjectNO, sFolder, sDocumentID, filename);
309
            }
310
            else
311
            {
312
                uri = String.Format(CommonLib.Common.GetConfigString("subServerImageWebPath", "URL", "", App.isExternal), _ViewInfo.ProjectNO, sDocumentID, filename);
313
            }
314
            uri = uri.Replace(".png", "");
315
            return uri;
316
        }
317

    
318
        private bool IsDrawingEnable(Point _canvasZoomPanningMouseDownPoint)
319
        {
320
            if ((_canvasZoomPanningMouseDownPoint.X > 0 &&
321
                zoomAndPanCanvas.ActualWidth > _canvasZoomPanningMouseDownPoint.X) &&
322
                (_canvasZoomPanningMouseDownPoint.Y > 0 &&
323
                zoomAndPanCanvas.ActualHeight > _canvasZoomPanningMouseDownPoint.Y))
324
            {
325
                return true;
326
            }
327

    
328
            return false;
329
        }
330

    
331
        private bool IsRotationDrawingEnable(Point _canvasZoomPanningMouseDownPoint)
332
        {
333
            if (rotate.Angle == 90 || rotate.Angle == 270)
334
            {
335
                if ((_canvasZoomPanningMouseDownPoint.X > 0 &&
336
                zoomAndPanCanvas.ActualHeight > _canvasZoomPanningMouseDownPoint.X) &&
337
                (_canvasZoomPanningMouseDownPoint.Y > 0 &&
338
                zoomAndPanCanvas.ActualWidth > _canvasZoomPanningMouseDownPoint.Y))
339
                {
340
                    return true;
341
                }
342
            }
343
            else
344
            {
345
                if ((_canvasZoomPanningMouseDownPoint.X > 0 &&
346
                zoomAndPanCanvas.ActualWidth > _canvasZoomPanningMouseDownPoint.X) &&
347
                (_canvasZoomPanningMouseDownPoint.Y > 0 &&
348
                zoomAndPanCanvas.ActualHeight > _canvasZoomPanningMouseDownPoint.Y))
349
                {
350
                    return true;
351
                }
352
            }
353

    
354
            return false;
355
        }
356

    
357
        public void DeleteItem(MarkupInfoItem item)
358
        {
359
            if (PreviewUserMarkupInfoItem != null && item.Consolidate == 1 && item.AvoidConsolidate == 0)
360
            {
361
                App.Custom_ViewInfoId = PreviewUserMarkupInfoItem.MarkupInfoID;           }
362

    
363
            
364
            ViewerDataModel.Instance._markupInfoList.Remove(item);
365

    
366
            ViewerDataModel.Instance.MarkupControls.Where(data => data.MarkupInfoID == item.MarkupInfoID).ToList().ForEach(a =>
367
            {
368
                ViewerDataModel.Instance.MarkupControls.Remove(a);
369
            });
370

    
371
            ViewerDataModel.Instance.MarkupControls_USER.Where(data => data.MarkupInfoID == item.MarkupInfoID).ToList().ForEach(a =>
372
            {
373
                ViewerDataModel.Instance.MarkupControls_USER.Remove(a);
374
                ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.MarkupListUpdate(
375
                null, Event_Type.Delete, a.CommentID, null);
376
            });
377

    
378
            ViewerDataModel.Instance.MyMarkupList.Where(data => data.MarkupInfoID == item.MarkupInfoID).ToList().ForEach(a =>
379
            {
380
                ViewerDataModel.Instance.MyMarkupList.Remove(a);
381
                //임시파일에서도 삭제
382
                TempFile.DelTemp(a.ID, this.ParentOfType<MainWindow>().dzMainMenu.pageNavigator.CurrentPage.PageNumber.ToString());                
383
            });
384

    
385
            gridViewMarkup.ItemsSource = ViewerDataModel.Instance._markupInfoList;
386

    
387
            if (PreviewUserMarkupInfoItem == null && gridViewMarkup.SelectedItems.Where(d => (d as MarkupInfoItem).UserID == App.ViewInfo.UserID).FirstOrDefault() == null)
388
            {
389
                if (gridViewMarkup.Items.Cast<MarkupInfoItem>().ToList().Where(d => d.UserID == App.ViewInfo.UserID).Count() == 0)
390
                {
391
                    var infoId = Commons.shortGuid();
392
                    PreviewUserMarkupInfoItem = new MarkupInfoItem
393
                    {
394
                        CreateTime = DateTime.Now,
395
                        Depatment = userData.DEPARTMENT,
396
                        UpdateTime = DateTime.Now,
397
                        DisplayColor = "#FFFF0000",
398
                        UserID = userData.ID,
399
                        UserName = userData.NAME,
400
                        PageCount = 1,
401
                        Description = "",
402
                        MarkupInfoID = infoId,
403
                        MarkupList = null,
404
                        MarkupVersionID = Commons.shortGuid(),
405
                        Consolidate = 0,
406
                        PartConsolidate = 0,
407
                        userDelete = true,
408
                        AvoidConsolidate = 0,
409
                        IsPreviewUser = true
410
                    };
411
                    App.Custom_ViewInfoId = infoId;
412
                }
413
            }
414
            Logger.sendReqLog("DeleteMarkupAsync", App.ViewInfo.ProjectNO + "," + item.MarkupInfoID, 1);
415
            BaseClient.DeleteMarkupAsync(App.ViewInfo.ProjectNO, item.MarkupInfoID);    
416
        }
417

    
418
        /// <summary>
419
        /// delete selected comments
420
        /// </summary>
421
        /// <param name="sender"></param>
422
        /// <param name="e"></param>
423
        public void DeleteCommentEvent(object sender, RoutedEventArgs e)
424
        {
425
            DialogParameters parameters = new DialogParameters()
426
            {
427
                Owner = Application.Current.MainWindow,
428
                Content = new TextBlock()
429
                { 
430
                    MinWidth = 400,
431
                    FontSize = 11,
432
                    Text = "정말 삭제 하시겠습니까?",
433
                    TextWrapping = System.Windows.TextWrapping.Wrap
434
                },
435
                Header = "Confirm",
436
                Theme = new VisualStudio2013Theme(),
437
                ModalBackground = new SolidColorBrush { Color = Colors.Black, Opacity = 0.6 },
438
                OkButtonContent = "Yes",
439
                CancelButtonContent = "No",
440
                Closed = delegate (object windowSender, WindowClosedEventArgs wc)
441
                {
442
                    if(wc.DialogResult == true)
443
                    {
444
                        //선택된 어도너가 있을시 삭제가 되지 않음
445
                        SelectionSet.Instance.UnSelect(this);
446

    
447
                        Button content = (sender as Button);
448
                        MarkupInfoItem item = content.CommandParameter as MarkupInfoItem;
449

    
450
                        DeleteItem(item);
451
                    }
452
                }
453
            };
454
            RadWindow.Confirm(parameters);
455
        }
456

    
457
        System.Windows.Media.Animation.DoubleAnimation da = new System.Windows.Media.Animation.DoubleAnimation();
458

    
459
        private static Timer timer;
460
        private int InitInterval = KCOM.Properties.Settings.Default.InitInterval;
461
        private void MainMenu_Loaded(object sender, RoutedEventArgs e)
462
        {
463
            InitializeComponent();            
464
            //System.Diagnostics.Debug.WriteLine("MainMenu() : " + sw.ElapsedMilliseconds.ToString() + "ms");
465

    
466
            if (App.ParameterMode)
467
            {
468
                App.splashString(ISplashMessage.MAINMENU_1);
469
                this.pageNavigator.PageChanging += pageNavigator_PageChanging;
470
                this.pageNavigator.PageChanged += PageNavigator_PageChanged;
471
                imageViewer_Compare = new Image();
472
                ViewerDataModel.Instance.Capture_Opacity = 0;
473
                da.From = 0.8;
474
                da.To = 0;
475
                da.Duration = new Duration(TimeSpan.FromSeconds(1));
476
                da.AutoReverse = true;
477
                da.RepeatBehavior = System.Windows.Media.Animation.RepeatBehavior.Forever;
478

    
479
                if (!App.ViewInfo.CreateFinalPDFPermission && !App.ViewInfo.NewCommentPermission)
480
                {
481
                    this.SymbolPane.Visibility = Visibility.Collapsed;
482
                    this.FavoritePane.Visibility = Visibility.Collapsed;
483
                    this.drawingRotateCanvas.IsHitTestVisible = false;
484
                }
485
                thumbnailPanel.Width = Convert.ToInt32(CommonLib.Common.GetConfigString("SetThumbnail", "WIDTH", "250"));
486
            }
487

    
488
            timer = new Timer(timercallback, null, 0, InitInterval * 60000);
489

    
490
        }
491

    
492
        private async Task DownloadOriginalFileAsync()
493
        {
494
            try
495
            {
496
                using (System.Net.WebClient client = new System.Net.WebClient())
497
                {
498
                    string instnaceFile = System.IO.Path.GetTempFileName().Replace(".pdf", ".tmp");
499
                    string downloadurl = GetOriginalPDFURL();
500
                    
501
                    // canceltoken을 위해서 상위에 선언
502
                    var task = client.DownloadFileTaskAsync(new Uri(downloadurl), instnaceFile);
503

    
504
                    client.DownloadProgressChanged += (snd, evt) =>
505
                    {
506
                        ViewerDataModel.Instance.DownloadFileProgress = evt.ProgressPercentage;
507

    
508
                        //System.Diagnostics.Debug.WriteLine($"Download Progress {evt.ProgressPercentage}% {evt.BytesReceived}/{evt.TotalBytesToReceive}(Byte)");
509
                    };
510

    
511
                    await task;
512

    
513
                    ViewerDataModel.Instance.SystemMain.dzMainMenu.searchPanel_Instance.SetSerachPDFFile(instnaceFile);
514
                    ViewerDataModel.Instance.IsDownloadOriginal = true;
515
                    ViewerDataModel.Instance.OriginalTempFile = instnaceFile;
516
                }
517
            }
518
            catch (Exception ex)
519
            {
520
                Logger.sendResLog("DownloadOriginalFileAsync", ex.Message, 0);
521
            }
522
        }
523

    
524
        private void timercallback(Object o)
525
        {
526
            Stopwatch sw = new Stopwatch();
527
            sw.Start();
528
            TempFile.TempFileAdd();
529
            sw.Stop();
530

    
531
            Dispatcher.InvokeAsync(new Action(delegate
532
            {
533
               if (this.ParentOfType<MainWindow>().dzTopMenu.cbAutoSave.IsChecked == true) //Auto Save Checked?
534
                {
535
                    timer.Change(((int)this.ParentOfType<MainWindow>().dzTopMenu.cbSaveInterval.Value * 60000) / 2, sw.ElapsedMilliseconds); //Timer Setting
536
                }
537
            }));
538

    
539
            ////GC.Collect();
540
        }
541
        
542
        /// <summary>
543
        /// update my markuplist
544
        ///  - update existing markup data if already exist
545
        ///  - add new markup data if control is new
546
        /// </summary>
547
        public void UpdateMyMarkupList()
548
        {
549
            Logger.sendCheckLog("pageNavigator_PageChanging_ChangeCommentReact", 1);
550

    
551
            /// add or update markup list
552
            foreach (var control in ViewerDataModel.Instance.MarkupControls_USER)
553
            {
554
                var root = MarkupParser.MarkupToString(control, App.ViewInfo.UserID);
555

    
556
                var exist = ViewerDataModel.Instance.MyMarkupList.Where(data => data.ID == root.CommentID).FirstOrDefault();
557
                if (exist != null) //신규 추가 된 코멘트
558
                {
559
                    if (exist.Data != root.ConvertData) //코멘트가 같은지
560
                    {
561
                        exist.Data = root.ConvertData;
562
                        exist.IsUpdate = true;
563
                    }
564
                }
565
                else if (root.CommentID != null)
566
                {
567
                    ViewerDataModel.Instance.MyMarkupList.Add(new MarkupItemEx
568
                    {
569
                        ID = control.CommentID,
570
                        Data = root.ConvertData,
571
                        Data_Type = root.DATA_TYPE,
572
                        MarkupInfoID = App.Custom_ViewInfoId,
573
                        PageNumber = this.pageNavigator.CurrentPage.PageNumber,
574
                        Symbol_ID = control.SymbolID,
575
                        //Group_ID = control.GroupID,
576
                    });
577
                }
578
            }
579

    
580
            /// delete markup list
581
            int iPageNo = this.pageNavigator.CurrentPage.PageNumber;
582
            var deleted = (from markup in ViewerDataModel.Instance.MyMarkupList
583
                          where (markup.PageNumber == iPageNo) && (null == ViewerDataModel.Instance.MarkupControls_USER.Where(control => control.CommentID == markup.ID).FirstOrDefault())
584
                          select markup).ToList();
585
            foreach(var markup in deleted) ViewerDataModel.Instance.MyMarkupList.Remove(markup);
586
            /// up to here
587

    
588
            //if (modified)
589
            //{
590
            //    if (ViewerDataModel.Instance._markupInfoList.Where(info => info.UserID == PreviewUserMarkupInfoItem.UserID).FirstOrDefault() == null)
591
            //    {
592
            //        ComingNewBieEnd = true;
593
            //        ViewerDataModel.Instance._markupInfoList.Insert(0, PreviewUserMarkupInfoItem);
594
            //        PreviewUserMarkupInfoItem.IsPreviewUser = false;
595
            //        gridViewMarkup.ItemsSource = null;
596
            //        gridViewMarkup.ItemsSource = ViewerDataModel.Instance._markupInfoList;
597
            //        gridViewMarkup.SelectedItem = PreviewUserMarkupInfoItem;
598

    
599
            //        GroupDescriptor descriptor = new GroupDescriptor();
600
            //        descriptor.Member = "Depatment";
601
            //        descriptor.DisplayContent = "DEPT";
602
            //        descriptor.SortDirection = ListSortDirection.Ascending;
603
            //        gridViewMarkup.GroupDescriptors.Add(descriptor);
604
            //    }
605
            //}
606
        }
607

    
608
        DispatcherTimer renderTesttimer;
609

    
610
        /// <summary>
611
        /// start page changing
612
        ///  - save controls if page is modified
613
        ///  - starting download page image
614
        /// </summary>
615
        /// <param name="sender"></param>
616
        /// <param name="e"></param>
617
        private async void pageNavigator_PageChanging(object sender, Controls.Sample.PageChangeEventArgs e)
618
        {
619
            CompareMode.IsChecked = false;
620
            var BalancePoint = ViewerDataModel.Instance.PageBalanceMode == true ? e.PageNumber + ViewerDataModel.Instance.PageBalanceNumber : e.PageNumber;
621
           
622
            #region 페이지가 벗어난 경우
623

    
624
            if (BalancePoint < 1)
625
            {
626
                BalancePoint = 1;
627
                ViewerDataModel.Instance.PageBalanceNumber = 0;
628
            }
629

    
630
            if (pageNavigator.PageCount < BalancePoint)
631
            {
632
                BalancePoint = pageNavigator.PageCount;
633
                ViewerDataModel.Instance.PageBalanceNumber = 0;
634
            }
635

    
636
            #endregion
637

    
638
            ViewerDataModel.Instance.PageNumber = BalancePoint;
639

    
640
            var pageWidth = Convert.ToDouble(e.CurrentPage.PAGE_WIDTH);
641
            var pageHeight = Convert.ToDouble(e.CurrentPage.PAGE_HEIGHT);
642
            var pageUri = pageNavigator.CurrentPage.PageUri;
643
            var contentScale = zoomAndPanControl.ContentScale;
644

    
645
            #region 페이지 이미지 로딩 수정
646

    
647
            // ViewerDataModel.Instance.ImageViewPath = await ImageSourceHelper.GetDownloadImageAsync(pageUri, pageWidth * contentScale, pageHeight * contentScale);
648
            try
649
            {
650
                ViewerDataModel.Instance.ImageViewPath = await ImageSourceHelper.GetDownloadImageAsync(pageUri, pageWidth, pageHeight);
651
                
652
            }
653
            catch (Exception ex)
654
            {
655
                ViewerDataModel.Instance.ImageViewPath = null;
656
                string imgfailedmsg = string.Format(CommonLib.Common.GetAlertMessageString("GetImageResourceFailed", "MSG", "해당 문서의 {0} Page Convert가 정상적이지 않습니다. 관리자에게 문의해 주세요."), pageNavigator.CurrentPage.PageNumber);                
657
                DialogMessage_Alert(imgfailedmsg, "Warning");
658
                App.FileLogger.Fatal(ex);
659
            }
660
            ScaleImage(pageWidth, pageHeight);
661

    
662
            ViewerDataModel.Instance.ImageViewWidth = pageWidth;
663
            ViewerDataModel.Instance.ImageViewHeight = pageHeight;
664

    
665
            zoomAndPanCanvas.Width = pageWidth;
666
            zoomAndPanCanvas.Height = pageHeight;
667

    
668
            Common.ViewerDataModel.Instance.ContentWidth = pageWidth;
669
            Common.ViewerDataModel.Instance.ContentHeight = pageHeight;
670

    
671
            inkBoard.Width = pageWidth;
672
            inkBoard.Height = pageHeight;
673

    
674
            #endregion
675

    
676
            if (!testPanel2.IsHidden)
677
            {
678
                Logger.sendCheckLog("pageNavigator_PageChanging_!testPanel2.IsHidden 일 때", 1);
679
                //PDF모드일때 잠시 대기(강인구)
680
                if (IsSyncPDFMode)
681
                {
682
                    Get_FinalImage.Get_PdfImage get_PdfImage = new Get_FinalImage.Get_PdfImage();
683
                    var pdfpath = new BitmapImage(new Uri(get_PdfImage.Run(CurrentRev.TO_VENDOR, App.ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, ViewerDataModel.Instance.PageNumber)));
684

    
685
                    Logger.sendCheckLog("pageNavigator_PageChanging_pdfpath Image Downloading", 1);
686
                    if (pdfpath.IsDownloading)
687
                    {
688
                        pdfpath.DownloadCompleted += (ex, arg) =>
689
                        {
690
                            Logger.sendCheckLog("pageNavigator_PageChanging_pdfpath Image DownloadCompleted", 1);
691
                            ViewerDataModel.Instance.ImageViewPath_C = pdfpath;
692
                            ViewerDataModel.Instance.ImageViewWidth_C = pdfpath.PixelWidth;
693
                            ViewerDataModel.Instance.ImageViewHeight_C = pdfpath.PixelHeight;
694
                            zoomAndPanCanvas2.Width = pdfpath.PixelWidth;
695
                            zoomAndPanCanvas2.Height = pdfpath.PixelHeight;
696
                        };
697
                    }
698
                    else
699
                    {
700
                        Logger.sendCheckLog("pageNavigator_PageChanging_pdfpath Image Page Setting", 1);
701
                        ViewerDataModel.Instance.ImageViewPath_C = pdfpath;
702
                        ViewerDataModel.Instance.ImageViewWidth_C = pdfpath.PixelWidth;
703
                        ViewerDataModel.Instance.ImageViewHeight_C = pdfpath.PixelHeight;
704

    
705
                        zoomAndPanCanvas2.Width = pdfpath.PixelWidth;
706
                        zoomAndPanCanvas2.Height = pdfpath.PixelHeight;
707
                    }
708
                }
709
                else
710
                {
711
                    Logger.sendCheckLog("pageNavigator_PageChanging_uri2 값 설정", 1);
712
                    string uri2 = this.GetImageURL(CurrentRev.DOCUMENT_ID, BalancePoint);
713

    
714
                    Logger.sendCheckLog("pageNavigator_PageChanging_defaultBitmapImage_Compare BitmapImage 설정", 1);
715
                    var defaultBitmapImage_Compare = new BitmapImage();
716
                    defaultBitmapImage_Compare.BeginInit();
717
                    defaultBitmapImage_Compare.CreateOptions = BitmapCreateOptions.IgnoreImageCache;
718
                    defaultBitmapImage_Compare.CacheOption = BitmapCacheOption.OnLoad;
719
                    defaultBitmapImage_Compare.UriSource = new Uri(uri2);
720
                    //defaultBitmapImage_Compare.DecodePixelWidth = Int32.Parse(e.CurrentPage.PAGE_WIDTH);
721
                    //defaultBitmapImage_Compare.DecodePixelHeight = Int32.Parse(e.CurrentPage.PAGE_HEIGHT);
722
                    defaultBitmapImage_Compare.EndInit();
723

    
724
                    ViewerDataModel.Instance.ImageViewPath_C = null;                    
725

    
726
                    Logger.sendCheckLog("pageNavigator_PageChanging_zoomAndPanControl ZoomTo 설정", 1);
727
                    zoomAndPanControl.ZoomTo(new Rect
728
                    {
729
                        X = 0,
730
                        Y = 0,
731
                        Width = Math.Max(zoomAndPanCanvas.Width, zoomAndPanCanvas2.Width),
732
                        Height = Math.Max(zoomAndPanCanvas.Height, zoomAndPanCanvas2.Height),
733
                    });
734

    
735
                    Logger.sendCheckLog("pageNavigator_PageChanging_defaultBitmapImage_Compare Downloading", 1);
736
                    if (defaultBitmapImage_Compare.IsDownloading)
737
                    {
738
                        defaultBitmapImage_Compare.DownloadCompleted += (ex, arg) =>
739
                        {
740
                            defaultBitmapImage_Compare.Freeze();
741
                            ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare;
742
                            ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth;
743
                            ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight;
744
                            ComparePanel.UpdateLayout();
745
                            zoomAndPanCanvas2.Width = defaultBitmapImage_Compare.PixelWidth;
746
                            zoomAndPanCanvas2.Height = defaultBitmapImage_Compare.PixelHeight;
747

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

    
756
                            //defaultBitmapImage_Compare dispose
757
                            defaultBitmapImage_Compare = null;
758
                            GC.Collect();
759
                        };
760
                    }
761
                }
762
                tlSyncPageNum.Text = String.Format("Current Page : {0}", BalancePoint);
763
            }
764

    
765
            SearchFocusBorder.Visibility = Visibility.Collapsed;
766

    
767
            this.pageNavigator.ChangePage(e.PageNumber);
768
        }
769

    
770
        /// <summary>
771
        /// called after page is changed
772
        /// </summary>
773
        /// <param name="sender"></param>
774
        /// <param name="e"></param>
775
        private void PageNavigator_PageChanged(object sender, Sample.PageChangeEventArgs e)
776
        {
777
            if (zoomAndPanCanvas2.Width.IsNaN())
778
            {
779
                zoomAndPanControl.ZoomTo(new Rect { X = 0, Y = 0, Width = zoomAndPanCanvas.Width, Height = zoomAndPanCanvas.Height });
780
            }
781

    
782
            /// 컨트롤을 새로 생성한다.
783
            Common.ViewerDataModel.Instance.MarkupControls_USER.Clear();    //전체 제거
784
            Common.ViewerDataModel.Instance.MarkupControls.Clear();         //전체 제거
785
            foreach (var markup in ViewerDataModel.Instance.MyMarkupList.Where(param => param.PageNumber == ViewerDataModel.Instance.PageNumber))
786
            { 
787
                var info = ViewerDataModel.Instance._markupInfoList.Where(param => param.MarkupInfoID == markup.MarkupInfoID).FirstOrDefault();
788
                if (info != null)
789
                {
790
                    string sColor = (info.UserID == App.ViewInfo.UserID) ? "#FFFF0000" : info.DisplayColor;
791
                    if (info.UserID == App.ViewInfo.UserID)
792
                    {
793
                        var control = MarkupParser.ParseEx(App.ViewInfo.ProjectNO, markup.Data, Common.ViewerDataModel.Instance.MarkupControls_USER, sColor, "",
794
                                        markup.MarkupInfoID, markup.ID);
795
                        control.Visibility = Visibility.Hidden;
796
                    }
797
                    else
798
                    {
799
                        var control = MarkupParser.ParseEx(App.ViewInfo.ProjectNO, markup.Data, Common.ViewerDataModel.Instance.MarkupControls, sColor, "",
800
                                                                markup.MarkupInfoID, markup.ID);
801
                        control.Visibility = Visibility.Hidden;
802
                    }
803
                }
804
            };
805
            /// up to here
806

    
807
            /// fire selection event
808
            List<MarkupInfoItem> gridSelectionItem = gridViewMarkup.SelectedItems.Cast<MarkupInfoItem>().ToList(); //선택 된 마크업
809
            this.gridViewMarkup.UnselectAll();
810
            this.gridViewMarkup.Select(gridSelectionItem);
811

    
812
            if (!testPanel2.IsHidden)
813
            {
814
                ViewerDataModel.Instance.Sync_ContentOffsetX = zoomAndPanControl.ContentOffsetX;
815
                ViewerDataModel.Instance.Sync_ContentOffsetY = zoomAndPanControl.ContentOffsetY;
816
                ViewerDataModel.Instance.Sync_ContentScale = zoomAndPanControl.ContentScale;
817

    
818
                Common.ViewerDataModel.Instance.MarkupControls_Sync.Clear();
819
                List<MarkupInfoItem> gridSelectionRevItem = gridViewRevMarkup.SelectedItems.Cast<MarkupInfoItem>().ToList();
820

    
821

    
822
                foreach (var item in gridSelectionRevItem)
823
                {
824
                    item.MarkupList.Where(pageItem => pageItem.PageNumber == ViewerDataModel.Instance.PageNumber).ToList().ForEach(delegate (MarkupItem markupitem)
825
                    {
826
                        MarkupParser.ParseEx(App.ViewInfo.ProjectNO, markupitem.Data, Common.ViewerDataModel.Instance.MarkupControls_Sync, item.DisplayColor, "", item.MarkupInfoID);
827
                    });
828
                }
829
            }
830

    
831
            var instanceMain = this.ParentOfType<MainWindow>();
832
            instanceMain.dzTopMenu.tlcurrentPage.Text = e.CurrentPage.PAGE_NUMBER.ToString();
833
            instanceMain.dzTopMenu.tlcurrentPage_readonly.Text = e.CurrentPage.PAGE_NUMBER.ToString();
834

    
835
            instanceMain.dzTopMenu.rotateOffSet = 0;
836
            var pageinfo = this.CurrentDoc.docInfo.DOCPAGE.Where(p => p.PAGE_NUMBER == e.CurrentPage.PAGE_NUMBER).FirstOrDefault();
837
            drawingPannelRotate(pageinfo.PAGE_ANGLE);
838
            
839
            SetCommentPages(true);
840
        }
841

    
842
        public void SetCommentPages(bool onlyMe = false)
843
        {
844
            Logger.sendCheckLog("pageNavigator_PageChanging_SetCommentPages Setting", 1);
845
            List<UsersCommentPagesMember> _pages = new List<UsersCommentPagesMember>();
846
            foreach (var item in ViewerDataModel.Instance._markupInfoList)
847
            {
848
                //Comment 가 존재할 경우에만 Thumbnail 에 추가
849
                if(item.MarkupList != null)
850
                {
851
                    UsersCommentPagesMember instance = new UsersCommentPagesMember();
852
                    instance.UserName = item.UserName;
853
                    instance.Depart = item.Depatment;
854
                    instance.MarkupInfoID = item.MarkupInfoID;
855
                    instance.IsSelected = true;
856
                    instance.isConSolidation = item.Consolidate;
857
                    instance.SetColor = item.DisplayColor;
858
                    if (item.UserID == App.ViewInfo.UserID && item.MarkupInfoID == item.MarkupInfoID)
859
                    {
860
                        instance.PageNumber = ViewerDataModel.Instance.MyMarkupList.Select(d => d.PageNumber).ToList();
861
                    }
862
                    else
863
                    {
864
                        instance.PageNumber = ViewerDataModel.Instance.MarkupList_Pre.Where(data => data.MarkupInfoID == item.MarkupInfoID).Select(d => d.PageNumber).ToList();
865
                    }
866
                    _pages.Add(instance);
867
                }                   
868
            }
869
            
870
            this.pageNavigator.SetCommentList(_pages.ToList());
871
        }
872

    
873
        public void MarkupitemViewUpdate(string markupinfo_id)
874
        {
875
            //db에 업데이트 한 list 를 view 에 업데이트
876
            string sDocID = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu._DocInfo.ID;
877
            List<MarkupInfoItem> results = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.GetMarkupInfoItems(App.ViewInfo.ProjectNO, sDocID);
878
            MarkupInfoItem dbinfo = results.Where(x => x.MarkupInfoID == markupinfo_id).FirstOrDefault();
879
            MarkupInfoItem viewinfo = Common.ViewerDataModel.Instance._markupInfoList.Where(x => x.MarkupInfoID == markupinfo_id).FirstOrDefault();
880
            if (dbinfo.MarkupList.Count > 0)
881
            {
882
                if (viewinfo.MarkupList != null)
883
                {
884
                    viewinfo.MarkupList.Clear();
885
                    viewinfo.MarkupList = null;
886
                }
887
                viewinfo.MarkupList = new List<MarkupItem>();
888
                foreach (var item in dbinfo.MarkupList)
889
                {
890
                    viewinfo.MarkupList.Add(item);
891
                }
892
            }
893
        }
894

    
895
        private void zoomAndPanControl_MouseWheel(object sender, MouseWheelEventArgs e)
896
        {
897
            if (e.MiddleButton == MouseButtonState.Pressed)
898
            {
899

    
900
            }
901
            e.Handled = true;
902
            if (e.Delta > 0)
903
            {
904
                Point currentContentMousePoint = e.GetPosition(zoomAndPanCanvas);
905
                ZoomIn(currentContentMousePoint);
906
            }
907
            else
908
            {
909
                Point currentContentMousePoint = e.GetPosition(zoomAndPanCanvas);
910
                ZoomOut(currentContentMousePoint);
911
            }
912
        }
913

    
914
        private void zoomAndPanControl2_MouseWheel(object sender, MouseWheelEventArgs e)
915
        {
916
            e.Handled = true;
917
            if (e.Delta > 0)
918
            {
919
                Point currentContentMousePoint = e.GetPosition(zoomAndPanCanvas2);
920
                ZoomIn_Sync(currentContentMousePoint);
921
            }
922
            else
923
            {
924
                Point currentContentMousePoint = e.GetPosition(zoomAndPanCanvas2);
925
                ZoomOut_Sync(currentContentMousePoint);
926
            }
927
        }
928

    
929
        #region ZoomIn & ZoomOut
930

    
931
        private void ZoomOut_Executed(object sender, ExecutedRoutedEventArgs e)
932
        {
933
            ZoomOut(new Point(zoomAndPanControl.ContentZoomFocusX,
934
                zoomAndPanControl.ContentZoomFocusY));
935
        }
936

    
937
        private void ZoomIn_Executed(object sender, ExecutedRoutedEventArgs e)
938
        {
939
            ZoomIn(new Point(zoomAndPanControl.ContentZoomFocusX,
940
                zoomAndPanControl.ContentZoomFocusY));
941
        }
942

    
943

    
944
        //강인구 추가 (줌 인아웃 수치 변경)
945
        //큰해상도의 문서일 경우 줌 인 아웃시 사이즈 변동이 큼
946
        private void ZoomOut(Point contentZoomCenter)
947
        {
948
            if (zoomAndPanControl.ContentScale > 0.39)
949
            {
950
                zoomAndPanControl.ZoomAboutPoint(zoomAndPanControl.ContentScale - 0.2, contentZoomCenter);
951
            }
952
            else
953
            {
954
                zoomAndPanControl.ZoomAboutPoint(zoomAndPanControl.ContentScale / 2, contentZoomCenter);
955
            }
956

    
957
            if (zoomAndPanControl2 != null && Sync.IsChecked)
958
            {
959
                zoomAndPanControl2.ZoomAboutPoint(zoomAndPanControl.ContentScale, contentZoomCenter);
960
            }
961
        }
962

    
963
        private void ZoomIn(Point contentZoomCenter)
964
        {
965
            if (zoomAndPanControl.ContentScale > 0.19)
966
            {
967
                zoomAndPanControl.ZoomAboutPoint(zoomAndPanControl.ContentScale + 0.2, contentZoomCenter);
968
            }
969
            else
970
            {
971
                zoomAndPanControl.ZoomAboutPoint(zoomAndPanControl.ContentScale * 2, contentZoomCenter);
972
            }
973

    
974
            if (zoomAndPanControl2 != null && Sync.IsChecked)
975
            {
976
                zoomAndPanControl2.ZoomAboutPoint(zoomAndPanControl.ContentScale, contentZoomCenter);
977
            }
978

    
979
        }
980

    
981
        private void ZoomOut_Sync(Point contentZoomCenter)
982
        {
983
            if (zoomAndPanControl2.ContentScale > 0.39)
984
            {
985
                zoomAndPanControl2.ZoomAboutPoint(zoomAndPanControl2.ContentScale - 0.2, contentZoomCenter);
986
            }
987
            else
988
            {
989
                zoomAndPanControl2.ZoomAboutPoint(zoomAndPanControl2.ContentScale / 2, contentZoomCenter);
990
            }
991

    
992
            if (Sync.IsChecked)
993
            {
994
                zoomAndPanControl.ZoomAboutPoint(zoomAndPanControl2.ContentScale, contentZoomCenter);
995
            }
996
        }
997

    
998
        private void ZoomIn_Sync(Point contentZoomCenter)
999
        {
1000
            if (zoomAndPanControl2.ContentScale > 0.19)
1001
            {
1002
                zoomAndPanControl2.ZoomAboutPoint(zoomAndPanControl2.ContentScale + 0.2, contentZoomCenter);
1003
            }
1004
            else
1005
            {
1006
                zoomAndPanControl2.ZoomAboutPoint(zoomAndPanControl2.ContentScale * 2, contentZoomCenter);
1007
            }
1008

    
1009
            if (Sync.IsChecked)
1010
            {
1011
                zoomAndPanControl.ZoomAboutPoint(zoomAndPanControl2.ContentScale, contentZoomCenter);
1012
            }
1013
        }
1014

    
1015
        private void ZoomOut()
1016
        {
1017
            zoomAndPanControl.ContentScale -= 0.1;
1018
            //if (zoomAndPanControl2 != null)
1019
            //{
1020
            //    zoomAndPanControl2.ContentScale -= 0.1;
1021
            //}
1022
        }
1023

    
1024
        private void ZoomIn()
1025
        {
1026
            zoomAndPanControl.ContentScale += 0.1;
1027
            //if (zoomAndPanControl2 != null)
1028
            //{
1029
            //    zoomAndPanControl2.ContentScale += 0.1;
1030
            //}
1031
        }
1032

    
1033
        #endregion
1034

    
1035
        private void init()
1036
        {
1037
            foreach (var item in ViewerDataModel.Instance.MarkupControls)
1038
            {
1039

    
1040
                ControlList.Clear();
1041
                listBox.Items.Clear();
1042
                selected_item.Clear();
1043

    
1044
                (item as IMarkupCommonData).IsSelected = false;
1045
            }
1046

    
1047
        }
1048

    
1049
        private HitTestResultBehavior MyCallback(HitTestResult result)
1050
        {
1051
            //this.cursor = Cursors.UpArrow;
1052
            var element = result.VisualHit;
1053
            while (element != null && !(element is CommentUserInfo))
1054
                element = VisualTreeHelper.GetParent(element);
1055

    
1056
            if (element == null)
1057
            {
1058
                return HitTestResultBehavior.Stop;
1059
            }
1060
            else
1061
            {
1062
                if (element is CommentUserInfo)
1063
                {
1064
                    if (!hitList.Contains(element))
1065
                    {
1066
                        hitList.Add((CommentUserInfo)element);
1067
                    }
1068
                    else
1069
                    {
1070
                        return HitTestResultBehavior.Stop;
1071
                    }
1072
                }
1073
            }
1074
            return HitTestResultBehavior.Continue;
1075
        }
1076

    
1077
        public void ReleaseSelectPath()
1078
        {
1079
            if (SelectionPath == null)
1080
            {
1081
                SelectionPath = new Path();
1082
                SelectionPath.Name = "";
1083
            }
1084
            if (SelectionPath.Name != "")
1085
            {
1086
                SelectionPath.Name = "None";
1087
            }
1088
            SelectionPath.Opacity = 0.01;
1089
            SelectionPath.RenderTransform = null;
1090
            SelectionPath.RenderTransformOrigin = new Point(0, 0);
1091
        }
1092

    
1093
        #region 컨트롤 초기화 
1094
        public void Control_Init(object control)
1095
        {
1096
            if (L_Size != 0 && (control as IPath) != null)
1097
            {
1098
                (control as IPath).LineSize = L_Size;
1099
                L_Size = 0;
1100
            }
1101

    
1102
            switch (control.GetType().Name)
1103
            {
1104
                case "RectangleControl":
1105
                    {
1106
                        (control as RectangleControl).StrokeColor = Brushes.Red;
1107
                    }
1108
                    break;
1109
                case "CircleControl":
1110
                    {
1111
                        (control as CircleControl).StrokeColor = Brushes.Red;
1112
                    }
1113
                    break;
1114
                case "TriControl":
1115
                    {
1116
                        (control as TriControl).StrokeColor = Brushes.Red;
1117
                    }
1118
                    break;
1119
                case "RectCloudControl":
1120
                    {
1121
                        (control as RectCloudControl).StrokeColor = Brushes.Red;
1122
                    }
1123
                    break;
1124
                case "CloudControl":
1125
                    {
1126
                        (control as CloudControl).StrokeColor = Brushes.Red;
1127
                    }
1128
                    break;
1129
                case "PolygonControl":
1130
                    {
1131
                        (control as PolygonControl).StrokeColor = Brushes.Red;
1132
                    }
1133
                    break;
1134
                case "ArcControl":
1135
                    {
1136
                        (control as ArcControl).StrokeColor = Brushes.Red;
1137
                    }
1138
                    break;
1139
                case "ArrowArcControl":
1140
                    {
1141
                        (control as ArrowArcControl).StrokeColor = Brushes.Red;
1142
                    }
1143
                    break;
1144
                case "LineControl":
1145
                    {
1146
                        (control as LineControl).StrokeColor = Brushes.Red;
1147
                    }
1148
                    break;
1149
                case "ArrowControl_Multi":
1150
                    {
1151
                        (control as ArrowControl_Multi).StrokeColor = Brushes.Red;
1152
                    }
1153
                    break;
1154
                case "TextControl":
1155
                    {
1156
                        (control as TextControl).BackInnerColor = new SolidColorBrush(Color.FromArgb(Convert.ToByte(255 * 0.6), Colors.White.R, Colors.White.G, Colors.White.B));
1157
                    }
1158
                    break;
1159
                case "ArrowTextControl":
1160
                    {
1161
                        (control as ArrowTextControl).BackInnerColor = new SolidColorBrush(Color.FromArgb(Convert.ToByte(255 * 0.6), Colors.White.R, Colors.White.G, Colors.White.B));
1162
                    }
1163
                    break;
1164
                case "InsideWhiteControl":
1165
                    {
1166
                        (control as InsideWhiteControl).StrokeColor = Brushes.White;
1167
                    }
1168
                    break;
1169
                case "OverlapWhiteControl":
1170
                    {
1171
                        (control as OverlapWhiteControl).StrokeColor = Brushes.White;
1172
                    }
1173
                    break;
1174
                case "ClipWhiteControl":
1175
                    {
1176
                        (control as ClipWhiteControl).StrokeColor = Brushes.White;
1177
                    }
1178
                    break;
1179
                case "CoordinateControl":
1180
                    {
1181
                        (control as CoordinateControl).StrokeColor = Brushes.Black;
1182
                    }
1183
                    break;
1184
            }
1185
        }
1186
        #endregion
1187

    
1188
        public void firstCondition_MouseLeave(object sender, MouseEventArgs e)
1189
        {
1190
            //Control_Init(e.Source);
1191
        }
1192
        //private Window _dragdropWindow = null;
1193

    
1194
        [DllImport("user32.dll")]
1195
        [return: MarshalAs(UnmanagedType.Bool)]
1196
        internal static extern bool GetCursorPos(ref Win32Point pt);
1197

    
1198
        [StructLayout(LayoutKind.Sequential)]
1199
        internal struct Win32Point
1200
        {
1201
            public Int32 X;
1202
            public Int32 Y;
1203
        };
1204
        /*
1205
       public string symbol_id = null;
1206
       public long symbol_group_id;
1207
       public int symbol_SelectedIndex;
1208
       public ImageSource symbol_img;
1209
       public string symbol_Data = null;
1210
       public void symboldata(string id, long group_id, int SelectedIndex, string Data_, ImageSource img)
1211
       {
1212
           PlaceImageSymbol(symbol_id, symbol_group_id, symbol_SelectedIndex, new Point(zoomAndPanCanvas.ActualWidth / 2,
1213
               zoomAndPanCanvas.ActualHeight / 2));
1214

    
1215

    
1216
               if (this._dragdropWindow != null)
1217
               {
1218
                   this._dragdropWindow.Close();
1219
                   this._dragdropWindow = null;
1220
               }
1221

    
1222
               symbol_id = id;
1223
               symbol_group_id = group_id;
1224
               symbol_SelectedIndex = SelectedIndex;
1225
               symbol_Data = Data_;
1226
               symbol_img = img;
1227

    
1228

    
1229
               CreateDragDropWindow2(img);
1230
              
1231
    }
1232

    
1233
    private void CreateDragDropWindow2(ImageSource image)
1234
        {
1235
            this._dragdropWindow = new Window();
1236
            _dragdropWindow.Cursor = new Cursor(MainWindow.CursorChange().StreamSource);
1237
            _dragdropWindow.WindowStyle = WindowStyle.None;
1238
            _dragdropWindow.AllowsTransparency = true;           
1239
            _dragdropWindow.AllowDrop = false;
1240
            _dragdropWindow.Background = null;
1241
            _dragdropWindow.IsHitTestVisible = false;
1242
            _dragdropWindow.SizeToContent = SizeToContent.WidthAndHeight;
1243
            _dragdropWindow.Topmost = true;
1244
            _dragdropWindow.ShowInTaskbar = false;
1245
            
1246
            Rectangle r = new Rectangle();
1247
            r.Width = image.Width;
1248
            r.Height = image.Height;
1249
            r.Opacity = 0.5;            
1250
            r.Fill = new ImageBrush(image);
1251
            this._dragdropWindow.Content = r;
1252

    
1253
            Win32Point w32Mouse = new Win32Point();
1254
            GetCursorPos(ref w32Mouse);
1255

    
1256
            //w32Mouse.X = getCurrentPoint.X;
1257
            this._dragdropWindow.Left = w32Mouse.X - (image.Width / 2);
1258
            this._dragdropWindow.Top = w32Mouse.Y - (image.Height / 2); 
1259
            this._dragdropWindow.Show();
1260
        }
1261
         */
1262
        private void zoomAndPanControl_MouseMove(object sender, MouseEventArgs e)
1263
        {
1264
            if (Common.ViewerDataModel.Instance.SelectedControl == "Batch")
1265
            {
1266
                if (!floatingTip.IsOpen) { floatingTip.IsOpen = true; }
1267

    
1268
                Point currentPos = e.GetPosition(rect);
1269

    
1270
                floatingTip.HorizontalOffset = currentPos.X + 20;
1271
                floatingTip.VerticalOffset = currentPos.Y;
1272
            }
1273

    
1274
            getCurrentPoint = e.GetPosition(drawingRotateCanvas);
1275
            
1276
            if ((e.MiddleButton == MouseButtonState.Pressed) || (e.RightButton == MouseButtonState.Pressed))
1277
            {
1278
                SetCursor();
1279
                Point currentCanvasDrawingMouseMovePoint = e.GetPosition(drawingRotateCanvas);
1280
                Point currentCanvasZoomPanningMouseMovePoint = e.GetPosition(zoomAndPanCanvas);
1281

    
1282
                Vector dragOffset = currentCanvasZoomPanningMouseMovePoint - canvasZoommovingMouseDownPoint;
1283
                zoomAndPanControl.ContentOffsetX -= dragOffset.X;
1284
                zoomAndPanControl.ContentOffsetY -= dragOffset.Y;
1285

    
1286
                if (Sync.IsChecked)
1287
                {
1288
                    ViewerDataModel.Instance.Sync_ContentOffsetX = zoomAndPanControl.ContentOffsetX;
1289
                    ViewerDataModel.Instance.Sync_ContentOffsetY = zoomAndPanControl.ContentOffsetY;
1290
                }
1291
            }
1292

    
1293
            if (mouseHandlingMode == MouseHandlingMode.Drawing && currentControl != null)
1294
            {
1295
                Point currentCanvasDrawingMouseMovePoint = e.GetPosition(drawingRotateCanvas);
1296
                Point currentCanvasZoomPanningMouseMovePoint = e.GetPosition(zoomAndPanCanvas);
1297
                SetCursor();
1298

    
1299
                if (currentControl != null)
1300
                {
1301
                    double moveX = currentCanvasDrawingMouseMovePoint.X - canvasDrawingMouseDownPoint.X;
1302
                    double moveY = currentCanvasDrawingMouseMovePoint.Y - canvasDrawingMouseDownPoint.Y;
1303
                    //강인구 추가
1304
                    currentControl.Opacity = ViewerDataModel.Instance.ControlOpacity;
1305

    
1306
                    if ((currentControl as IPath) != null)
1307
                    {
1308
                        (currentControl as IPath).LineSize = ViewerDataModel.Instance.LineSize;
1309
                    }
1310
                    if ((currentControl as LineControl) != null)
1311
                    {
1312
                        (currentControl as LineControl).Interval = ViewerDataModel.Instance.Interval;
1313
                    }
1314

    
1315
                    if ((currentControl as IShapeControl) != null)
1316
                    {
1317
                        (currentControl as IShapeControl).Paint = ViewerDataModel.Instance.paintSet;
1318
                    }
1319
                    if ((currentControl as TextControl) != null)
1320
                    {
1321
                        if (this.ParentOfType<MainWindow>().dzTopMenu.btnItalic.IsChecked == true)
1322
                        {
1323
                            (currentControl as TextControl).TextStyle = FontStyles.Italic;
1324
                        }
1325
                        if (this.ParentOfType<MainWindow>().dzTopMenu.btnBold.IsChecked == true)
1326
                        {
1327
                            (currentControl as TextControl).TextWeight = FontWeights.Bold;
1328
                        }
1329
                        if (this.ParentOfType<MainWindow>().dzTopMenu.btnUnderLine.IsChecked == true)
1330
                        {
1331
                            (currentControl as TextControl).UnderLine = TextDecorations.Underline;
1332
                        }
1333
                    }
1334
                    else if ((currentControl as ArrowTextControl) != null)
1335
                    {
1336
                        if (this.ParentOfType<MainWindow>().dzTopMenu.btnItalic.IsChecked == true)
1337
                        {
1338
                            (currentControl as ArrowTextControl).TextStyle = FontStyles.Italic;
1339
                        }
1340
                        if (this.ParentOfType<MainWindow>().dzTopMenu.btnBold.IsChecked == true)
1341
                        {
1342
                            (currentControl as ArrowTextControl).TextWeight = FontWeights.Bold;
1343
                        }
1344
                        if (this.ParentOfType<MainWindow>().dzTopMenu.btnUnderLine.IsChecked == true)
1345
                        {
1346
                            (currentControl as ArrowTextControl).UnderLine = TextDecorations.Underline;
1347
                        }
1348
                    }
1349
                    else if ((currentControl as RectCloudControl) != null)
1350
                    {
1351
                        (currentControl as RectCloudControl).ArcLength = ViewerDataModel.Instance.ArcLength;
1352
                    }
1353
                    else if ((currentControl as CloudControl) != null)
1354
                    {
1355
                        (currentControl as CloudControl).ArcLength = ViewerDataModel.Instance.ArcLength;
1356
                    }
1357

    
1358

    
1359
                    #region // 모든 컨트롤의 공통기능 제어
1360
                    if (controlType != ControlType.PenControl)
1361
                    {
1362
                        currentControl.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1363
                    }
1364

    
1365

    
1366
                    #endregion
1367

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

    
1370
                    switch (controlType)
1371
                    {
1372
                        case (ControlType.Coordinate):
1373
                            {
1374
                                var control = currentControl as CoordinateControl;
1375
                                if (control != null)
1376
                                {
1377
                                    //control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1378
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1379
                                    control.Paint = ViewerDataModel.Instance.paintSet;
1380
                                }
1381
                            }
1382
                            break;
1383
                        case (ControlType.InsideWhite):
1384
                            {
1385
                                var control = currentControl as InsideWhiteControl;
1386
                                if (control != null)
1387
                                {
1388
                                    //control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1389
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1390
                                    control.Paint = ViewerDataModel.Instance.paintSet;
1391
                                    control.Paint = PaintSet.Fill;
1392
                                }
1393
                            }
1394
                            break;
1395
                        case ControlType.OverlapWhite:
1396
                            {
1397
                                var control = currentControl as OverlapWhiteControl;
1398
                                if (control != null)
1399
                                {
1400
                                    //control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1401
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1402
                                    control.Paint = ViewerDataModel.Instance.paintSet;
1403
                                    control.Paint = PaintSet.Fill;
1404
                                }
1405
                            }
1406
                            break;
1407
                        case ControlType.ClipWhite:
1408
                            {
1409
                                var control = currentControl as ClipWhiteControl;
1410
                                if (control != null)
1411
                                {
1412
                                    //control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1413
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1414
                                    control.Paint = ViewerDataModel.Instance.paintSet;
1415
                                    control.Paint = PaintSet.Fill;
1416
                                }
1417
                            }
1418
                            break;
1419
                        case ControlType.RectCloud:
1420
                            {
1421
                                var control = currentControl as RectCloudControl;
1422
                                if (control != null)
1423
                                {
1424
                                    //control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1425
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1426
                                    control.Paint = ViewerDataModel.Instance.paintSet;
1427
                                }
1428
                            }
1429
                            break;
1430
                        case ControlType.SingleLine:
1431
                        case ControlType.CancelLine:
1432
                        case ControlType.ArrowLine:
1433
                        case ControlType.TwinLine:
1434
                        case ControlType.DimLine:
1435
                            {
1436
                                var control = currentControl as LineControl;
1437
                                if (control != null)
1438
                                {
1439
                                    //control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1440
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1441
                                }
1442

    
1443
                            }
1444
                            break;
1445

    
1446
                        case ControlType.ArcLine:
1447
                            {
1448
                                var control = currentControl as ArcControl;
1449
                                if (control != null)
1450
                                {
1451
                                    //control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1452
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1453
                                }
1454
                            }
1455
                            break;
1456

    
1457
                        case ControlType.ArcArrow:
1458
                            {
1459
                                var control = currentControl as ArrowArcControl;
1460
                                if (control != null)
1461
                                {
1462
                                    //control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1463
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1464
                                }
1465
                            }
1466
                            break;
1467

    
1468
                        case ControlType.ArrowMultiLine:
1469
                            {
1470
                                var control = currentControl as ArrowControl_Multi;
1471
                                if (control != null)
1472
                                {
1473
                                    //control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1474
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1475
                                }
1476
                            }
1477
                            break;
1478

    
1479
                        case ControlType.Circle:
1480
                            {
1481
                                var control = currentControl as CircleControl;
1482

    
1483
                                if (control != null)
1484
                                {
1485
                                    //control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1486
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1487
                                    control.Paint = ViewerDataModel.Instance.paintSet;
1488
                                }
1489
                            }
1490
                            break;
1491

    
1492
                        case ControlType.PolygonCloud:
1493
                            {
1494
                                var control = currentControl as CloudControl;
1495
                                if (control != null)
1496
                                {
1497
                                    //control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1498
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1499
                                    control.Paint = ViewerDataModel.Instance.paintSet;
1500
                                }
1501
                            }
1502
                            break;
1503

    
1504
                        case ControlType.Triangle:
1505
                            {
1506
                                var control = currentControl as TriControl;
1507
                                if (control != null)
1508
                                {
1509
                                    //control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1510
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1511
                                    control.Paint = ViewerDataModel.Instance.paintSet;
1512
                                }
1513
                            }
1514
                            break;
1515

    
1516
                        case ControlType.ImgControl:
1517
                            {
1518
                                var control = currentControl as ImgControl;
1519
                                if (control != null)
1520
                                {
1521
                                    //control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1522
                                }
1523
                            }
1524
                            break;
1525

    
1526
                        case ControlType.Date:
1527
                            {
1528
                                var control = currentControl as DateControl;
1529
                                if (control != null)
1530
                                {
1531
                                    //control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1532
                                }
1533
                            }
1534
                            break;
1535

    
1536
                        case ControlType.ArrowTextControl:
1537
                        case ControlType.ArrowTransTextControl:
1538
                        case ControlType.ArrowTextBorderControl:
1539
                        case ControlType.ArrowTransTextBorderControl:
1540
                        case ControlType.ArrowTextCloudControl:
1541
                        case ControlType.ArrowTransTextCloudControl:
1542
                            {
1543
                                var control = currentControl as ArrowTextControl;
1544
                                if (control != null)
1545
                                {
1546
                                    //control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1547
                                }
1548
                            }
1549
                            break;
1550
                        case ControlType.PolygonControl:
1551
                        case ControlType.ChainLine:
1552
                            {
1553
                                var control = currentControl as PolygonControl;
1554
                                if (control != null)
1555
                                {
1556
                                    //control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1557
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1558
                                    control.Paint = ViewerDataModel.Instance.paintSet;
1559
                                }
1560
                            }
1561
                            break;
1562
                        case ControlType.Sign:
1563
                            {
1564
                                var control = currentControl as SignControl;
1565
                                if (control != null)
1566
                                {
1567
                                    //control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1568
                                }
1569
                            }
1570
                            break;
1571
                        case ControlType.Symbol:
1572
                            {
1573
                                var control = currentControl as SymControl;
1574
                                if (control != null)
1575
                                {
1576
                                    //control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1577
                                }
1578
                            }
1579
                            break;
1580
                        case ControlType.Stamp:
1581
                            {
1582
                                var control = currentControl as SymControlN;
1583
                                if (control != null)
1584
                                {
1585
                                    if (control.STAMP != null)
1586
                                    {
1587
                                        //control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1588
                                    }
1589
                                    else
1590
                                    {
1591
                                        currentControl = null;
1592
                                        this.cursor = new Cursor(MainWindow.CursorChange().StreamSource);
1593
                                        DialogMessage_Alert("Approved Stamp 가 등록되어 있지 않습니다. \n관리자에게 문의하세요.", "안내");
1594
                                    }
1595
                                }
1596
                            }
1597
                            break;
1598
                        case ControlType.Rectangle:
1599
                        case ControlType.Mark:
1600
                            {
1601
                                var control = currentControl as RectangleControl;
1602
                                if (control != null)
1603
                                {
1604
                                    //control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1605
                                    if (control.ControlType == ControlType.Mark) control.Paint = PaintSet.Fill;
1606
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1607
                                }
1608
                            }
1609
                            break;
1610
                        case ControlType.PenControl:
1611
                            {
1612
                                stroke.StylusPoints.Add(new StylusPoint(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y));
1613
                                //inkBoard.Strokes.Add(stroke);
1614
                            }
1615
                            break;
1616
                        default:
1617
                            break;
1618
                    }
1619

    
1620
                    #endregion
1621
                    if (ViewerDataModel.Instance.AngleVisibility == Visibility.Visible)
1622
                    {
1623
                        ViewerDataModel.Instance.Angle = currentControl.CommentAngle;
1624
                    }
1625
                }
1626
            }
1627
            else if(mouseHandlingMode == MouseHandlingMode.Drawing && e.LeftButton == MouseButtonState.Pressed)
1628
            {
1629
                Point currentCanvasDrawingMouseMovePoint = e.GetPosition(drawingRotateCanvas);
1630
                Point currentCanvasZoomPanningMouseMovePoint = e.GetPosition(zoomAndPanCanvas);
1631
                SetCursor();
1632
                if (currentControl == null)
1633
                {
1634
                    switch (controlType)
1635
                    {
1636
                        case ControlType.PenControl:
1637
                            {
1638
                                if (inkBoard.Tag.ToString() == "Ink")
1639
                                {
1640
                                    stroke.StylusPoints.Add(new StylusPoint(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y));
1641
                                }
1642
                                else if (inkBoard.Tag.ToString() == "EraseByPoint")
1643
                                {
1644
                                    RemovePointStroke(currentCanvasDrawingMouseMovePoint);
1645
                                }
1646
                                else if (inkBoard.Tag.ToString() == "EraseByStroke")
1647
                                {
1648
                                    RemoveLineStroke(currentCanvasDrawingMouseMovePoint);
1649
                                }
1650

    
1651
                                //inkBoard.Strokes.Add(stroke);
1652
                            }
1653
                            break;
1654
                    }
1655
                    return;
1656
                }
1657
            }
1658
            else if (((e.LeftButton == MouseButtonState.Pressed) && mouseHandlingMode == MouseHandlingMode.Selecting) || 
1659
                ((e.LeftButton == MouseButtonState.Pressed) && mouseHandlingMode == MouseHandlingMode.Capture) || 
1660
                ((e.LeftButton == MouseButtonState.Pressed) && mouseHandlingMode == MouseHandlingMode.DragZoom))
1661
            {
1662
                Point curMouseDownPoint = e.GetPosition(drawingRotateCanvas);
1663

    
1664
                if (isDraggingSelectionRect)
1665
                {
1666
                    UpdateDragSelectionRect(canvasDrawingMouseDownPoint, curMouseDownPoint);
1667
                    e.Handled = true;
1668
                }
1669
                else if (isLeftMouseButtonDownOnWindow)
1670
                {
1671
                    var dragDelta = curMouseDownPoint - canvasDrawingMouseDownPoint;
1672
                    double dragDistance = Math.Abs(dragDelta.Length);
1673

    
1674
                    if (dragDistance > DragThreshold)
1675
                    {
1676
                        isDraggingSelectionRect = true;
1677
                        InitDragSelectionRect(canvasDrawingMouseDownPoint, curMouseDownPoint);
1678
                    }
1679

    
1680
                    e.Handled = true;
1681
                }
1682

    
1683
                if (canvasDrawingMouseDownPoint == curMouseDownPoint)
1684
                {
1685
                }
1686
                else
1687
                {
1688
                    e.Handled = true;
1689
                }
1690
            }
1691
            /*
1692
            else if ((e.LeftButton == MouseButtonState.Pressed) && mouseHandlingMode == MouseHandlingMode.DragSymbol)
1693
            { //symbol      
1694
                if(_dragdropWindow != null)
1695
                {
1696
                    Win32Point w32Mouse = new Win32Point();
1697
                    GetCursorPos(ref w32Mouse);
1698

    
1699
                    this._dragdropWindow.Left = w32Mouse.X - (symbol_img.Width / 2);
1700
                    this._dragdropWindow.Top = w32Mouse.Y - (symbol_img.Height / 2);
1701
                }                
1702
            }
1703
            */
1704
            else if ((e.LeftButton == MouseButtonState.Released) && (e.MiddleButton == MouseButtonState.Released) && 
1705
                (e.RightButton == MouseButtonState.Released) && ViewerDataModel.Instance.MarkupControls_USER.Count > 0)
1706
            {
1707
                var control = ViewerDataModel.Instance.MarkupControls_USER.Where(data => data.IsMouseOver).FirstOrDefault();
1708
                if(control != null)
1709
                {
1710
                    this.cursor = Cursors.Hand;
1711
                    SetCursor();
1712
                }
1713
                else
1714
                {
1715
                    this.cursor = new Cursor(MainWindow.CursorChange().StreamSource);
1716
                    SetCursor();
1717
                }
1718
            }
1719
            else
1720
            {
1721
            }
1722
        }
1723

    
1724
        private void zoomAndPanControl2_MouseMove(object sender, MouseEventArgs e)
1725
        {
1726
            if ((e.MiddleButton == MouseButtonState.Pressed) || (e.RightButton == MouseButtonState.Pressed))
1727
            {
1728
                SetCursor();
1729
                Point currentCanvasDrawingMouseMovePoint = e.GetPosition(drawingRotateCanvas2);
1730
                Point currentCanvasZoomPanningMouseMovePoint = e.GetPosition(zoomAndPanCanvas2);
1731

    
1732
                Vector dragOffset = currentCanvasZoomPanningMouseMovePoint - canvasZoommovingMouseDownPoint;
1733

    
1734
                ViewerDataModel.Instance.Sync_ContentOffsetX -= dragOffset.X;
1735
                ViewerDataModel.Instance.Sync_ContentOffsetY -= dragOffset.Y;
1736

    
1737
                if (Sync.IsChecked)
1738
                {
1739
                    zoomAndPanControl.ContentOffsetX = ViewerDataModel.Instance.Sync_ContentOffsetX;
1740
                    zoomAndPanControl.ContentOffsetY = ViewerDataModel.Instance.Sync_ContentOffsetY;
1741
                }
1742
            }
1743
        }
1744

    
1745
        private List<CommentUserInfo> hitList = new List<CommentUserInfo>();
1746

    
1747
        private EllipseGeometry hitArea = new EllipseGeometry();
1748

    
1749
        private void zoomAndPanControl_MouseUp(object sender, MouseButtonEventArgs e)
1750
        {
1751
            IsDrawing = false;
1752
    
1753
            if (mouseHandlingMode != MouseHandlingMode.None)
1754
            {
1755
                if (mouseHandlingMode == MouseHandlingMode.Drawing)
1756
                {
1757
                    this.cursor = new Cursor(MainWindow.CursorChange().StreamSource);
1758

    
1759
                    SetCursor();
1760

    
1761
                    switch (controlType)
1762
                    {
1763
                        case ControlType.None:
1764
                            break;
1765
                        case ControlType.Rectangle:
1766
                            {
1767

    
1768
                            }
1769
                            break;
1770
                        case ControlType.PenControl:
1771
                            {
1772

    
1773
                            }
1774
                            break;
1775
                        default:
1776
                            break;
1777
                    }                    
1778
                }
1779
                else if (mouseHandlingMode == MouseHandlingMode.Selecting && e.ChangedButton == MouseButton.Left || mouseHandlingMode == MouseHandlingMode.Capture && e.ChangedButton == MouseButton.Left || mouseHandlingMode == MouseHandlingMode.DragZoom && e.ChangedButton == MouseButton.Left)
1780
                {
1781
                    ViewerDataModel.Instance.AngleVisibility = Visibility.Collapsed;
1782

    
1783
                    if (isLeftMouseButtonDownOnWindow)
1784
                    {
1785
                        bool wasDragSelectionApplied = false;
1786

    
1787
                        if (isDraggingSelectionRect)
1788
                        {
1789
                            if (mouseHandlingMode == MouseHandlingMode.Capture && controlType == ControlType.ImgControl)
1790
                            {
1791
                                dragCaptureBorder.Visibility = Visibility.Collapsed;
1792
                                mouseHandlingMode = MouseHandlingMode.None;
1793
                                Point endPoint = e.GetPosition(zoomAndPanCanvas);
1794
                                symbolselectindex = symbolPanel_Instance.RadTab.SelectedIndex;
1795
                                Set_Symbol_Capture(endPoint);
1796
                                ViewerDataModel.Instance.ViewVisible = Visibility.Collapsed;
1797
                                ViewerDataModel.Instance.ViewVisible = Visibility.Visible;                                
1798
                                ViewerDataModel.Instance.Capture_Opacity = 0;
1799
                            }
1800
                            else if (mouseHandlingMode == MouseHandlingMode.Capture)
1801
                            {
1802
                                dragCaptureBorder.Visibility = Visibility.Collapsed;
1803
                                mouseHandlingMode = MouseHandlingMode.None;
1804
                                Set_Capture();
1805

    
1806
                                ViewerDataModel.Instance.ViewVisible = Visibility.Collapsed;
1807
                                ViewerDataModel.Instance.ViewVisible = Visibility.Visible;
1808
                                ViewerDataModel.Instance.Capture_Opacity = 0;
1809
                            }
1810
                            else if (mouseHandlingMode == MouseHandlingMode.Selecting)
1811
                            {
1812
                                ApplyDragSelectionRect();
1813
                            }
1814
                            else
1815
                            {
1816
                                double x = Canvas.GetLeft(dragZoomBorder);
1817
                                double y = Canvas.GetTop(dragZoomBorder);
1818
                                double width = dragZoomBorder.Width;
1819
                                double height = dragZoomBorder.Height;
1820
                                Rect dragRect = new Rect(x, y, width, height);
1821

    
1822
                                ViewerDataModel.Instance.SystemMain.dzMainMenu.zoomAndPanControl.ZoomTo(dragRect);
1823

    
1824
                                dragZoomBorder.Visibility = Visibility.Collapsed;
1825
                            }
1826

    
1827
                            isDraggingSelectionRect = false;
1828
                            e.Handled = true;
1829
                            wasDragSelectionApplied = true;
1830
                        }
1831

    
1832
                        if (isLeftMouseButtonDownOnWindow)
1833
                        {
1834
                            isLeftMouseButtonDownOnWindow = false;
1835
                            this.ReleaseMouseCapture();
1836
                            e.Handled = true;
1837
                        }
1838

    
1839
                        if (!wasDragSelectionApplied)
1840
                        {
1841
                            init();
1842
                        }
1843
                    }
1844
                }
1845
                else if (e.RightButton == MouseButtonState.Pressed)
1846
                {
1847
                    this.cursor = new Cursor(MainWindow.CursorChange().StreamSource);
1848
                    SetCursor();
1849
                }
1850

    
1851
                zoomAndPanControl.ReleaseMouseCapture();
1852

    
1853

    
1854
                e.Handled = true;
1855
            }
1856
            else
1857
            {
1858
                this.cursor = new Cursor(MainWindow.CursorChange().StreamSource);
1859
                SetCursor();
1860
            }
1861

    
1862
            ///mouseButtonDown = MouseButton.Left;
1863
            //controlType = ControlType.SingleLine;
1864
        }
1865

    
1866
        public void Set_Symbol_Capture(Point endPoint)
1867
        {       
1868
            double x = canvasDrawingMouseDownPoint.X;
1869
            double y = canvasDrawingMouseDownPoint.Y;
1870
            if(x > endPoint.X)
1871
            {
1872
                x = endPoint.X;
1873
                y = endPoint.Y;
1874
            }
1875

    
1876
            double width = dragCaptureBorder.Width;
1877
            double height = dragCaptureBorder.Height;
1878

    
1879
            canvasImage = ConverterBitmapImage(zoomAndPanCanvas);
1880

    
1881
            if (x < 0)
1882
            {
1883
                width += x;
1884
                x = 0;
1885
            }
1886
            if (y < 0)
1887
            {
1888
                height += y;
1889
                y = 0;
1890

    
1891
                width = (int)canvasImage.PixelWidth - x;
1892
            }
1893
            if (x + width > canvasImage.PixelWidth)
1894
            {
1895
                width = (int)canvasImage.PixelWidth - x;
1896
            }
1897
            if (y + height > canvasImage.PixelHeight)
1898
            {
1899
                height = (int)canvasImage.PixelHeight - y;
1900
            }
1901
            var rect = new Int32Rect((int)x, (int)y, (int)width, (int)height);
1902

    
1903
            string uri = this.GetImageURL(_ViewInfo.DocumentItemID, Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber);
1904
            var defaultBitmapImage = new BitmapImage();
1905
            defaultBitmapImage.BeginInit();
1906
            defaultBitmapImage.CreateOptions = BitmapCreateOptions.IgnoreImageCache;
1907
            defaultBitmapImage.CacheOption = BitmapCacheOption.OnLoad;
1908
            defaultBitmapImage.UriSource = new Uri(uri);
1909
            defaultBitmapImage.EndInit();
1910

    
1911
            //GC.Collect();
1912

    
1913
            if (defaultBitmapImage.IsDownloading)
1914
            {
1915
                defaultBitmapImage.DownloadCompleted += (ex, arg) =>
1916
                {
1917
                    defaultBitmapImage.Freeze();
1918
                    //GC.Collect();
1919
                    BitmapSource bs = new CroppedBitmap(defaultBitmapImage, rect);
1920
                    Save_Symbol_Capture(bs, (int)x, (int)y, (int)width, (int)height);
1921
                };
1922
            }
1923
        }
1924

    
1925
        private void zoomAndPanControl2_MouseUp(object sender, MouseButtonEventArgs e)
1926
        {
1927
            ///mouseButtonDown = MouseButton.Left;
1928
        }
1929

    
1930
        private void zoomAndPanControl_MouseLeave(object sender, MouseEventArgs e)
1931
        {
1932
            ///mouseButtonDown = MouseButton.Left;
1933
            //this.cursor = new Cursor(MainWindow.CursorChange().StreamSource);
1934
        }
1935

    
1936
        private void zoomAndPanControl_MouseDoubleClick(object sender, MouseButtonEventArgs e)
1937
        {
1938

    
1939
        }
1940

    
1941
        /// <summary>
1942
        /// select items by dragging
1943
        /// </summary>
1944
        private void ApplyDragSelectionRect()
1945
        {
1946
            dragSelectionBorder.Visibility = Visibility.Collapsed;
1947

    
1948
            double x = Canvas.GetLeft(dragSelectionBorder);
1949
            double y = Canvas.GetTop(dragSelectionBorder);
1950
            double width = dragSelectionBorder.Width;
1951
            double height = dragSelectionBorder.Height;
1952
            Boolean Flag = false;
1953
            List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>();
1954
            var Items = ViewerDataModel.Instance.MarkupControls_USER.Where(d => d.Visibility != Visibility.Hidden).ToList();
1955

    
1956
            Rect dragRect = new Rect(x, y, width, height);
1957
            ///dragRect.Inflate(width / 10, height / 10);
1958

    
1959
            foreach (var item in Items)
1960
            {
1961
                Flag = SelectionSet.Instance.SelectControl(item, dragRect);
1962

    
1963
                if (Flag)
1964
                {
1965
                    adornerSet.Add(item);
1966
                    ViewerDataModel.Instance.MarkupControls_USER.Remove(item);
1967
                    Control_Style(item);
1968
                }
1969
            }
1970
            if (adornerSet.Count > 0)
1971
            {
1972
                Controls.AdornerFinal final = new Controls.AdornerFinal(adornerSet);
1973
                SelectLayer.Children.Add(final);
1974
            }
1975
        }
1976

    
1977
        private void InitDragSelectionRect(Point pt1, Point pt2)
1978
        {
1979
            //캡쳐 중
1980
            if (mouseHandlingMode == MouseHandlingMode.Capture)
1981
            {
1982
                dragCaptureBorder.Visibility = Visibility.Visible;
1983
            }
1984
            //선택 중
1985
            else if (mouseHandlingMode == MouseHandlingMode.Selecting)
1986
            {
1987

    
1988
                dragSelectionBorder.Visibility = Visibility.Visible;
1989
            }
1990
            else
1991
            {
1992
                dragZoomBorder.Visibility = Visibility.Visible;
1993
            }
1994
            UpdateDragSelectionRect(pt1, pt2);
1995
        }
1996

    
1997
        /// <summary>
1998
        /// Update the position and size of the rectangle used for drag selection.
1999
        /// </summary>
2000
        private void UpdateDragSelectionRect(Point pt1, Point pt2)
2001
        {
2002
            double x, y, width, height;
2003

    
2004
            //
2005
            // Determine x,y,width and height of the rect inverting the points if necessary.
2006
            // 
2007

    
2008
            if (pt2.X < pt1.X)
2009
            {
2010
                x = pt2.X;
2011
                width = pt1.X - pt2.X;
2012
            }
2013
            else
2014
            {
2015
                x = pt1.X;
2016
                width = pt2.X - pt1.X;
2017
            }
2018

    
2019
            if (pt2.Y < pt1.Y)
2020
            {
2021
                y = pt2.Y;
2022
                height = pt1.Y - pt2.Y;
2023
            }
2024
            else
2025
            {
2026
                y = pt1.Y;
2027
                height = pt2.Y - pt1.Y;
2028
            }
2029

    
2030
            //
2031
            // Update the coordinates of the rectangle used for drag selection.
2032
            //
2033
            //캡쳐 중
2034
            if (mouseHandlingMode == MouseHandlingMode.Capture)
2035
            {
2036
                Canvas.SetLeft(dragCaptureBorder, x);
2037
                Canvas.SetTop(dragCaptureBorder, y);
2038
                dragCaptureBorder.Width = width;
2039
                dragCaptureBorder.Height = height;
2040
            }
2041
            //선택 중
2042
            else if (mouseHandlingMode == MouseHandlingMode.Selecting)
2043
            {
2044
                Canvas.SetLeft(dragSelectionBorder, x);
2045
                Canvas.SetTop(dragSelectionBorder, y);
2046
                dragSelectionBorder.Width = width;
2047
                dragSelectionBorder.Height = height;
2048
            }
2049
            else
2050
            {
2051
                Canvas.SetLeft(dragZoomBorder, x);
2052
                Canvas.SetTop(dragZoomBorder, y);
2053
                dragZoomBorder.Width = width;
2054
                dragZoomBorder.Height = height;
2055
            }
2056
        }
2057

    
2058
        private void drawingPannelRotate(double angle)
2059
        {
2060
            Logger.sendCheckLog("pageNavigator_PageChanging_drawingPannelRotate Setting", 1);
2061
            rotate.Angle = angle;
2062
            var rotationNum = Math.Abs((rotate.Angle / 90));
2063

    
2064
            if (angle == 90 || angle == 270)
2065
            {
2066
                double emptySize = zoomAndPanCanvas.Width;
2067
                zoomAndPanCanvas.Width = zoomAndPanCanvas.Height;
2068
                zoomAndPanCanvas.Height = emptySize;
2069
            }
2070
            if (angle == 0)
2071
            {
2072
                translate.X = 0;
2073
                translate.Y = 0;
2074
            }
2075
            else if (angle == 90)
2076
            {
2077
                translate.X = zoomAndPanCanvas.Width;
2078
                translate.Y = 0;
2079
            }
2080
            else if (angle == 180)
2081
            {
2082
                translate.X = zoomAndPanCanvas.Width;
2083
                translate.Y = zoomAndPanCanvas.Height;
2084
            }
2085
            else
2086
            {
2087
                translate.X = 0;
2088
                translate.Y = zoomAndPanCanvas.Height;
2089
            }
2090

    
2091
            zoomAndPanControl.RotationAngle = rotate.Angle;
2092

    
2093

    
2094
            if (!testPanel2.IsHidden)
2095
            {
2096
                zoomAndPanControl2.RotationAngle = rotate.Angle;
2097
                zoomAndPanCanvas2.Width = zoomAndPanCanvas.Width;
2098
                zoomAndPanCanvas2.Height = zoomAndPanCanvas.Height;
2099
            }
2100

    
2101
            ViewerDataModel.Instance.ContentWidth = zoomAndPanCanvas.Width;
2102
            ViewerDataModel.Instance.ContentHeight = zoomAndPanCanvas.Height;
2103
            ViewerDataModel.Instance.AngleOffsetX = translate.X;
2104
            ViewerDataModel.Instance.AngleOffsetY = translate.Y;
2105
            ViewerDataModel.Instance.Angle = rotate.Angle;
2106
        }
2107

    
2108
        private void syncPannelRotate(double angle)
2109
        {
2110
            //Logger.sendCheckLog("pageNavigator_PageChanging_drawingPannelRotate Setting", 1);
2111
            rotate.Angle = angle;
2112
            var rotationNum = Math.Abs((rotate.Angle / 90));
2113

    
2114
            if (angle == 90 || angle == 270)
2115
            {
2116
                double emptySize = zoomAndPanCanvas2.Width;
2117
                zoomAndPanCanvas2.Width = zoomAndPanCanvas2.Height;
2118
                zoomAndPanCanvas2.Height = emptySize;
2119
            }
2120
            if (angle == 0)
2121
            {
2122
                translate2.X = 0;
2123
                translate2.Y = 0;
2124
            }
2125
            else if (angle == 90)
2126
            {
2127
                translate2.X = zoomAndPanCanvas2.Width;
2128
                translate2.Y = 0;
2129
            }
2130
            else if (angle == 180)
2131
            {
2132
                translate2.X = zoomAndPanCanvas2.Width;
2133
                translate2.Y = zoomAndPanCanvas2.Height;
2134
            }
2135
            else
2136
            {
2137
                translate2.X = 0;
2138
                translate2.Y = zoomAndPanCanvas2.Height;
2139
            }
2140

    
2141
            zoomAndPanControl2.RotationAngle = rotate.Angle;
2142
        }
2143

    
2144
        public void PlaceImageSymbol(string id, long group_id, int SelectedIndex, Point canvasZoomPanningMouseDownPoint)
2145
        {
2146
            string Data_ = "";
2147

    
2148
            try
2149
            {
2150
                Logger.sendReqLog("GetSymbolImageURL: ", id + "," + SelectedIndex, 1);
2151
                Data_ = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.GetSymbolImageURL(id, SelectedIndex);
2152
                if (Data_ != null || Data_ != "")
2153
                {
2154
                    Logger.sendResLog("GetSymbolImageURL", "TRUE", 1);
2155
                }
2156
                else
2157
                {
2158
                    Logger.sendResLog("GetSymbolImageURL", "FALSE", 1);
2159
                }
2160

    
2161
                //MARKUP_DATA_GROUP mARKUP_DATA_GROUP = new MARKUP_DATA_GROUP
2162
                //{
2163
                //    SYMBOL_ID = id,//InnerItem.Symbol_ID
2164
                //    STATE = 0,
2165
                //};
2166
                if (Data_ != null)
2167
                {
2168
                    Image img = new Image();
2169
                    //img.Source = new System.Windows.Media.Imaging.BitmapImage(new Uri(Data_));
2170
                    if (Data_.Contains(".svg"))
2171
                    {
2172
                        byte[] imageData = null;
2173
                        DrawingImage image = null;
2174
                        using (System.Net.WebClient web = new System.Net.WebClient())
2175
                        {
2176
                            imageData = web.DownloadData(new Uri(Data_));
2177
                            System.IO.Stream stream = new System.IO.MemoryStream(imageData);
2178
                            image = SvgReader.Load(stream);
2179
                        }
2180
                        img.Source = image;
2181
                    }
2182
                    else
2183
                    {
2184
                        img.Source = new BitmapImage(new Uri(Data_));
2185
                    }
2186

    
2187
                    var currentControl = new MarkupToPDF.Controls.Etc.ImgControl
2188
                    {
2189
                        PointSet = new List<Point>(),
2190
                        FilePath = Data_,
2191
                        ImageData = img.Source,
2192
                        StartPoint = canvasZoomPanningMouseDownPoint,
2193
                        EndPoint = new Point(canvasZoomPanningMouseDownPoint.X + img.Source.Width, 
2194
                        canvasZoomPanningMouseDownPoint.Y + img.Source.Height),
2195
                        TopRightPoint = new Point(canvasZoomPanningMouseDownPoint.X+img.Source.Width,
2196
                        canvasZoomPanningMouseDownPoint.Y),
2197
                        LeftBottomPoint = new Point(canvasZoomPanningMouseDownPoint.X,
2198
                        canvasZoomPanningMouseDownPoint.Y + img.Source.Height)
2199
                    };
2200

    
2201
                    currentControl.PointSet = new List<Point>
2202
                                        {
2203
                                            currentControl.StartPoint,
2204
                                            currentControl.LeftBottomPoint,
2205
                                            currentControl.EndPoint,
2206
                                            currentControl.TopRightPoint,
2207
                                        };
2208
                    Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
2209
                    UndoData = new Undo_data()
2210
                    {
2211
                        IsUndo = false,
2212
                        Event = Event_Type.Create,
2213
                        EventTime = DateTime.Now,
2214
                        Markup_List = new List<Multi_Undo_data>()
2215
                    };
2216
                    ViewerDataModel.Instance.UndoDataList.Where(data1 => data1.IsUndo == true).ToList().ForEach(i =>
2217
                    {
2218
                        ViewerDataModel.Instance.UndoDataList.Remove(i);
2219
                    });
2220

    
2221
                    //multi_Undo_Data = dzMainMenu.Control_Style(currentControl as MarkupToPDF.Common.CommentUserInfo);
2222
                    multi_Undo_Data = Control_Style(currentControl as MarkupToPDF.Common.CommentUserInfo);
2223
                    UndoData.Markup_List.Add(multi_Undo_Data);
2224
                    ViewerDataModel.Instance.UndoDataList.Add(UndoData);
2225

    
2226
                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl as MarkupToPDF.Common.CommentUserInfo);
2227
                    currentControl.CommentID = Commons.shortGuid();
2228
                    currentControl.SymbolID = id;
2229
                    currentControl.GroupID = group_id;
2230
                    currentControl.ApplyTemplate();
2231
                    currentControl.SetImage();
2232

    
2233
                    ViewerDataModel.Instance.MarkupControls_USER.Remove(currentControl as MarkupToPDF.Common.CommentUserInfo);
2234
                    Controls.AdornerFinal final = new Controls.AdornerFinal(currentControl as MarkupToPDF.Common.CommentUserInfo);
2235
                    SelectLayer.Children.Add(final);
2236
                }
2237
            }
2238
            catch (Exception ex)
2239
            {
2240
                this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert(ex.Message, "Error");
2241
            }
2242
        }
2243

    
2244
        private void zoomAndPanControl_MouseDown(object sender, MouseButtonEventArgs e)
2245
        {            
2246
            var set_option = this.ParentOfType<MainWindow>().dzTopMenu.Parent.ChildrenOfType<RadNumericUpDown>().Where(item => item.IsKeyboardFocusWithin).FirstOrDefault();
2247
            if (set_option != null && !string.IsNullOrEmpty(set_option.ContentText))
2248
            {
2249
                set_option.Value = double.Parse(set_option.ContentText);
2250
                //set_option.Focusable = false;
2251
                zoomAndPanControl.Focus();
2252
            }
2253

    
2254
            ConvertInkControlToPolygon();
2255

    
2256
            ///TODO:
2257
            var text_item = ViewerDataModel.Instance.MarkupControls_USER.Where(data =>
2258
            (data as TextControl) != null && (data as TextControl).Text == "" || (data as ArrowTextControl) != null && (data as ArrowTextControl).ArrowText == "").FirstOrDefault();
2259

    
2260
            if (text_item != null && (currentControl as ArrowTextControl) == null)
2261
            {
2262
                ViewerDataModel.Instance.MarkupControls_USER.Remove(text_item);
2263
            }
2264
            /// up to here
2265

    
2266
            foreach (var item in ViewerDataModel.Instance.MarkupControls_USER)
2267
            {
2268
                if (item as ArrowTextControl != null)
2269
                {
2270
                    (item as ArrowTextControl).Base_TextBox.IsHitTestVisible = false;
2271
                }
2272
                else if (item as TextControl != null)
2273
                {
2274
                    (item as TextControl).Base_TextBox.IsHitTestVisible = false;
2275
                }
2276
            }
2277

    
2278
            //if (currentControl != null)
2279
            {
2280
                var text_item_ = ViewerDataModel.Instance.MarkupControls_USER.Where(data => (data as TextControl) != null && (data as TextControl).IsEditingMode == true).FirstOrDefault();
2281
                if (text_item_ != null)
2282
                {
2283
                    (text_item_ as TextControl).Base_TextBlock.Visibility = Visibility.Visible;
2284
                    (text_item_ as TextControl).Base_TextBox.Visibility = Visibility.Collapsed;
2285
                    (text_item_ as TextControl).IsEditingMode = false;                    
2286
                    currentControl = null;
2287
                }
2288

    
2289
                var Arrowtext_item_ = ViewerDataModel.Instance.MarkupControls_USER.Where(data => (data as ArrowTextControl) != null && (data as ArrowTextControl).IsEditingMode == true).FirstOrDefault();
2290
                if (Arrowtext_item_ != null && ((Arrowtext_item_ as ArrowTextControl).IsNew == false))
2291
                {
2292
                    (Arrowtext_item_ as ArrowTextControl).IsEditingMode = false;
2293
                    (Arrowtext_item_ as ArrowTextControl).Base_TextBox.Focusable = false;
2294
                    currentControl = null;
2295
                }
2296
            }
2297

    
2298
            double Ang = 0;                                          
2299
            if (rotate.Angle != 0)
2300
            {
2301
                Ang = 360 - rotate.Angle;
2302
            }
2303

    
2304
            if (e.OriginalSource is System.Windows.Controls.Image)
2305
            {
2306
                (e.OriginalSource as System.Windows.Controls.Image).Focus();
2307
            }
2308
            /*
2309
            if (mouseHandlingMode == MouseHandlingMode.DragSymbol && e.LeftButton == MouseButtonState.Pressed)
2310
            {                
2311
                canvasZoomPanningMouseDownPoint = e.GetPosition(zoomAndPanCanvas);
2312
                if(symbol_id != null)
2313
                {
2314
                    PlaceImageSymbol(symbol_id, symbol_group_id, symbol_SelectedIndex, canvasZoomPanningMouseDownPoint);
2315
                }                
2316
            }
2317

    
2318
            if (mouseHandlingMode == MouseHandlingMode.DragSymbol && e.RightButton == MouseButtonState.Pressed)
2319
            {
2320
                if (this._dragdropWindow != null)
2321
                {
2322
                    this._dragdropWindow.Close();
2323
                    this._dragdropWindow = null;
2324
                    symbol_id = null;
2325
                }
2326
            }
2327
            */
2328

    
2329
            if (e.LeftButton == MouseButtonState.Pressed)
2330
            {
2331
                canvasDrawingMouseDownPoint = e.GetPosition(drawingRotateCanvas);
2332
                canvasZoomPanningMouseDownPoint = e.GetPosition(zoomAndPanCanvas);
2333

    
2334
                this.cursor = new Cursor(MainWindow.CursorChange().StreamSource);
2335
                SetCursor();
2336

    
2337
                if (!ViewerDataModel.Instance.IsPressCtrl) SelectionSet.Instance.UnSelect(this);
2338
            }
2339

    
2340
            if (e.MiddleButton == MouseButtonState.Pressed)
2341
            {
2342
                canvasZoommovingMouseDownPoint = e.GetPosition(zoomAndPanCanvas);
2343
                cursor = Cursors.SizeAll;
2344
                SetCursor();
2345
            }
2346
            if (e.RightButton == MouseButtonState.Pressed)
2347
            {
2348
                canvasZoommovingMouseDownPoint = e.GetPosition(zoomAndPanCanvas);
2349
                cursor = Cursors.SizeAll;
2350
                SetCursor();
2351
            }
2352
            else if (e.XButton1 == MouseButtonState.Pressed)
2353
            {
2354
                if (this.pageNavigator.CurrentPage.PageNumber + 1 <= this.pageNavigator.PageCount)
2355
                {
2356
                    this.pageNavigator.GotoPage(this.pageNavigator.CurrentPage.PageNumber + 1);
2357
                }
2358

    
2359
                //this.pageNavigator.GotoPage(this.pageNavigator._NextPage.PageNumber);
2360

    
2361
            }
2362
            else if (e.XButton2 == MouseButtonState.Pressed)
2363
            {
2364
                if (this.pageNavigator.CurrentPage.PageNumber > 1)
2365
                {
2366
                    this.pageNavigator.GotoPage(this.pageNavigator.CurrentPage.PageNumber - 1);
2367
                }
2368
            }
2369

    
2370
            if (e.LeftButton == MouseButtonState.Pressed && mouseHandlingMode != MouseHandlingMode.Drawing && currentControl == null)
2371
            {
2372
                if (mouseHandlingMode == MouseHandlingMode.Selecting)
2373
                {
2374
                    if (SelectLayer.Children.Count == 0)
2375
                    {
2376
                        isLeftMouseButtonDownOnWindow = true;
2377
                        mouseHandlingMode = MouseHandlingMode.Selecting;
2378
                    }
2379

    
2380
                    if (controlType == ControlType.None)
2381
                    {
2382
                        isLeftMouseButtonDownOnWindow = true;
2383
                    }
2384
                }
2385

    
2386
                /// 캡쳐 모드 설정
2387
                if (mouseHandlingMode == MouseHandlingMode.Capture)
2388
                {
2389
                    dragCaptureBorder.Visibility = Visibility.Visible;
2390
                    isLeftMouseButtonDownOnWindow = true;
2391
                }
2392

    
2393
                /// 줌 모드 설정
2394
                if (mouseHandlingMode == MouseHandlingMode.DragZoom)
2395
                {
2396
                    isLeftMouseButtonDownOnWindow = true;
2397
                }
2398

    
2399
                var control = ViewerDataModel.Instance.MarkupControls_USER.Where(data => data.IsMouseOver).FirstOrDefault();
2400
                if (control != null)
2401
                {
2402
                    AdornerFinal final = null;
2403

    
2404
                    if (!ViewerDataModel.Instance.IsPressCtrl)
2405
                    {
2406
                        /// 기존 selection 해제
2407
                        SelectionSet.Instance.UnSelect(this);
2408

    
2409
                        final = new AdornerFinal(control);
2410

    
2411
                        this.Control_Style(control);
2412

    
2413
                        if ((control as IPath) != null)
2414
                        {
2415
                            if ((control as IPath).LineSize != 0)
2416
                            {
2417
                                ViewerDataModel.Instance.LineSize = (control as IPath).LineSize;
2418
                            }
2419
                        }
2420
                        if ((control as IShapeControl) != null)
2421
                        {
2422
                            if ((control as IShapeControl).Paint == PaintSet.Hatch)
2423
                            {
2424
                                ViewerDataModel.Instance.checkHatchShape = true;
2425
                            }
2426
                            else if ((control as IShapeControl).Paint == PaintSet.Fill)
2427
                            {
2428
                                ViewerDataModel.Instance.checkFillShape = true;
2429
                            }
2430
                            else
2431
                            {
2432
                                ViewerDataModel.Instance.checkHatchShape = false;
2433
                                ViewerDataModel.Instance.checkFillShape = false;
2434
                            }
2435
                            ViewerDataModel.Instance.paintSet = (control as IShapeControl).Paint;
2436
                        }
2437

    
2438
                        ViewerDataModel.Instance.ControlOpacity = control.Opacity;
2439

    
2440
                        if ((control as TextControl) != null)
2441
                        {
2442
                            if(!((control as TextControl).EnableEditing)) {
2443
                                (control as TextControl).EnableEditing = true;
2444
                            }
2445
                            if ((control as TextControl).TextStyle == FontStyles.Italic)
2446
                            {
2447
                                ViewerDataModel.Instance.checkTextStyle = true;
2448
                            }
2449
                            else
2450
                            {
2451
                                ViewerDataModel.Instance.checkTextStyle = false;
2452
                            }
2453
                            if ((control as TextControl).TextWeight == FontWeights.Bold)
2454
                            {
2455
                                ViewerDataModel.Instance.checkTextWeight = true;
2456
                            }
2457
                            else
2458
                            {
2459
                                ViewerDataModel.Instance.checkTextWeight = false;
2460
                            }
2461
                            if ((control as TextControl).UnderLine == TextDecorations.Underline)
2462
                            {
2463
                                ViewerDataModel.Instance.checkUnderLine = true;
2464
                            }
2465
                            else
2466
                            {
2467
                                ViewerDataModel.Instance.checkUnderLine = false;
2468
                            }
2469
                            ViewerDataModel.Instance.TextSize = (control as TextControl).TextSize;
2470
                            ViewerDataModel.Instance.checkHighlight = (control as TextControl).IsHighLight;
2471

    
2472
                        }
2473
                        else if ((control as ArrowTextControl) != null)
2474
                        {
2475
                            if (!((control as ArrowTextControl).EnableEditing))
2476
                            {
2477
                                (control as ArrowTextControl).EnableEditing = true;
2478
                            }
2479
                            if ((control as ArrowTextControl).TextStyle == FontStyles.Italic)
2480
                            {
2481
                                ViewerDataModel.Instance.checkTextStyle = true;
2482
                            }
2483
                            else
2484
                            {
2485
                                ViewerDataModel.Instance.checkTextStyle = false;
2486
                            }
2487
                            if ((control as ArrowTextControl).TextWeight == FontWeights.Bold)
2488
                            {
2489
                                ViewerDataModel.Instance.checkTextWeight = true;
2490
                            }
2491
                            else
2492
                            {
2493
                                ViewerDataModel.Instance.checkTextWeight = false;
2494
                            }
2495
                            if ((control as ArrowTextControl).UnderLine == TextDecorations.Underline)
2496
                            {
2497
                                ViewerDataModel.Instance.checkUnderLine = true;
2498
                            }
2499
                            else
2500
                            {
2501
                                ViewerDataModel.Instance.checkUnderLine = false;
2502
                            }
2503
                            ViewerDataModel.Instance.checkHighlight = (control as ArrowTextControl).isHighLight;
2504
                            ViewerDataModel.Instance.TextSize = (control as ArrowTextControl).TextSize;
2505
                        }
2506
                        else if ((control as RectCloudControl) != null)
2507
                        {
2508
                            ViewerDataModel.Instance.ArcLength = (control as RectCloudControl).ArcLength;
2509
                        }
2510
                        else if ((control as CloudControl) != null)
2511
                        {
2512
                            ViewerDataModel.Instance.ArcLength = (control as CloudControl).ArcLength;
2513
                        }
2514
                    }
2515
                    else
2516
                    {
2517
                        List<CommentUserInfo> comment = SelectionSet.Instance.SelectedItems;
2518
                        SelectionSet.Instance.UnSelect(this);
2519
                        comment.Add(control);
2520

    
2521
                        Control_Style(control);
2522

    
2523
                        final = new AdornerFinal(comment);
2524
                    }
2525

    
2526
                    if (final != null)
2527
                    {
2528
                        this.SelectLayer.Children.Add(final);
2529
                    }
2530
                }              
2531
            }
2532
            else if (mouseHandlingMode == MouseHandlingMode.Drawing)
2533
            {               
2534
                init();
2535
                //강인구 추가(우 클릭 일 경우 커서 변경 하지 않음)
2536
                if (cursor != Cursors.SizeAll)
2537
                {
2538
                    cursor = Cursors.Cross;
2539
                    SetCursor();
2540
                }
2541
                bool init_user = false;
2542
                foreach (var user in gridViewMarkup.Items)
2543
                {
2544
                    if ((user as MarkupInfoItem).UserID == App.ViewInfo.UserID)
2545
                    {
2546
                        init_user = true;
2547
                    }
2548
                }
2549
                if (init_user && gridViewMarkup.SelectedItems.Where(d => (d as MarkupInfoItem).UserID == App.ViewInfo.UserID).FirstOrDefault() == null && e.LeftButton == MouseButtonState.Pressed)
2550
                {
2551
                    RadWindow.Alert(new DialogParameters
2552
                    {
2553
                        Owner = Application.Current.MainWindow,
2554
                        Theme = new VisualStudio2013Theme(),
2555
                        Header = "안내",
2556
                        Content = "기존의 코멘트가 존재합니다. 사용자 리스트에서 먼저 선택해주세요",
2557
                    });
2558
                    return;
2559
                }
2560
                else
2561
                {
2562
                    var item = gridViewMarkup.SelectedItems.Where(d => (d as MarkupInfoItem).UserID == App.ViewInfo.UserID).FirstOrDefault() as MarkupInfoItem;
2563
                    if (item != null)
2564
                    {
2565
                        App.Custom_ViewInfoId = item.MarkupInfoID;
2566
                    }
2567
                }
2568

    
2569
                switch (controlType)
2570
                {
2571
                    case ControlType.Coordinate:
2572
                        {
2573
                            if (e.LeftButton == MouseButtonState.Pressed)
2574
                            {
2575
                                if (currentControl is CoordinateControl)
2576
                                {
2577
                                    if (IsGetoutpoint((currentControl as CoordinateControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
2578
                                    {
2579
                                        return;
2580
                                    }
2581

    
2582
                                    CreateCommand.Instance.Execute(currentControl);
2583

    
2584
                                    currentControl = null;
2585
                                    this.cursor = Cursors.Arrow;
2586
                                }
2587
                                else
2588
                                {
2589
                                    this.ParentOfType<MainWindow>().dzTopMenu._SaveEvent(null, null);
2590
                                    if (ViewerDataModel.Instance.MyMarkupList.Where(d => d.PageNumber == Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber
2591
                                     && d.Data_Type == Convert.ToInt32(MarkupToPDF.Controls.Common.ControlType.Coordinate)).Count() > 0)
2592
                                    {
2593
                                        currentControl = null;
2594
                                        this.cursor = Cursors.Arrow;
2595
                                        Common.ViewerDataModel.Instance.SystemMain.DialogMessage_Alert("이미 해당 페이지의 도면 영역을 설정하셨습니다.", "Notice");
2596
                                        return;
2597
                                    }
2598
                                    else
2599
                                    {
2600
                                        currentControl = new CoordinateControl
2601
                                        {
2602
                                            Background = new SolidColorBrush(Colors.Black),
2603
                                            StartPoint = this.canvasDrawingMouseDownPoint,
2604
                                            ControlType = ControlType.Coordinate
2605
                                        };
2606

    
2607
                                        currentControl.CommentID = Commons.shortGuid();
2608
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
2609
                                        currentControl.IsNew = true;
2610

    
2611
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
2612

    
2613
                                        currentControl.SetValue(Canvas.ZIndexProperty, 3);
2614
                                    }
2615
                                }
2616
                            }
2617
                        }
2618
                        break;
2619
                    case ControlType.InsideWhite:
2620
                        {
2621
                            if (e.LeftButton == MouseButtonState.Pressed)
2622
                            {
2623
                                if (currentControl is InsideWhiteControl)
2624
                                {
2625
                                    if (IsGetoutpoint((currentControl as InsideWhiteControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
2626
                                    {
2627
                                        return;
2628
                                    }
2629

    
2630
                                    CreateCommand.Instance.Execute(currentControl);
2631

    
2632
                                    currentControl = null;
2633
                                    this.cursor = Cursors.Arrow;
2634
                                }
2635
                                else
2636
                                {
2637
                                    currentControl = new InsideWhiteControl
2638
                                    {
2639
                                        Background = new SolidColorBrush(Colors.Black),
2640
                                        StartPoint = this.canvasDrawingMouseDownPoint,
2641
                                        ControlType = ControlType.InsideWhite
2642
                                    };
2643

    
2644
                                    currentControl.CommentID = Commons.shortGuid();
2645
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
2646
                                    currentControl.IsNew = true;
2647
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
2648

    
2649
                                    currentControl.SetValue(Canvas.ZIndexProperty, 3);
2650
                                }
2651
                            }
2652
                        }
2653
                        break;
2654
                    case ControlType.OverlapWhite:
2655
                        {
2656
                            if (e.LeftButton == MouseButtonState.Pressed)
2657
                            {
2658
                                if (currentControl is OverlapWhiteControl)
2659
                                {
2660
                                    if (IsGetoutpoint((currentControl as OverlapWhiteControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
2661
                                    {
2662
                                        return;
2663
                                    }
2664

    
2665
                                    CreateCommand.Instance.Execute(currentControl);
2666

    
2667
                                    currentControl = null;
2668
                                    this.cursor = Cursors.Arrow;
2669
                                }
2670
                                else
2671
                                {
2672
                                    currentControl = new OverlapWhiteControl
2673
                                    {
2674
                                        Background = new SolidColorBrush(Colors.Black),
2675
                                        StartPoint = this.canvasDrawingMouseDownPoint,
2676
                                        ControlType = ControlType.OverlapWhite
2677
                                    };
2678

    
2679
                                    currentControl.CommentID = Commons.shortGuid();
2680
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
2681
                                    currentControl.IsNew = true;
2682
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
2683

    
2684
                                    currentControl.SetValue(Canvas.ZIndexProperty, 3);
2685
                                }
2686
                            }
2687
                        }
2688
                        break;
2689
                    case ControlType.ClipWhite:
2690
                        {
2691
                            if (e.LeftButton == MouseButtonState.Pressed)
2692
                            {
2693
                                if (currentControl is ClipWhiteControl)
2694
                                {
2695
                                    if (IsGetoutpoint((currentControl as ClipWhiteControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
2696
                                    {
2697
                                        return;
2698
                                    }
2699

    
2700
                                    CreateCommand.Instance.Execute(currentControl);
2701

    
2702
                                    currentControl = null;
2703
                                    this.cursor = Cursors.Arrow;
2704
                                }
2705
                                else
2706
                                {
2707
                                    currentControl = new ClipWhiteControl
2708
                                    {
2709
                                        Background = new SolidColorBrush(Colors.Black),
2710
                                        StartPoint = this.canvasDrawingMouseDownPoint,
2711
                                        ControlType = ControlType.ClipWhite
2712
                                    };
2713

    
2714
                                    currentControl.CommentID = Commons.shortGuid();
2715
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
2716
                                    currentControl.IsNew = true;
2717
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
2718

    
2719
                                    currentControl.SetValue(Canvas.ZIndexProperty, 3);
2720
                                }
2721
                            }
2722
                        }
2723
                        break;
2724
                    case ControlType.Rectangle:
2725
                        {
2726
                            if (e.LeftButton == MouseButtonState.Pressed)
2727
                            {
2728
                                if (currentControl is RectangleControl)
2729
                                {
2730
                                    //20180906 LJY TEST IsRotationDrawingEnable
2731
                                    if (IsGetoutpoint((currentControl as RectangleControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
2732
                                    {
2733
                                        return;
2734
                                    }
2735

    
2736
                                    CreateCommand.Instance.Execute(currentControl);
2737
                                    currentControl = null;
2738
                                    this.cursor = new Cursor(MainWindow.CursorChange().StreamSource);
2739
                                }
2740
                                else
2741
                                {
2742
                                    currentControl = new RectangleControl
2743
                                    {
2744
                                        Background = new SolidColorBrush(Colors.Black),
2745
                                        StartPoint = this.canvasDrawingMouseDownPoint,
2746
                                        ControlType = ControlType.Rectangle
2747
                                    };
2748

    
2749
                                    currentControl.CommentID = Commons.shortGuid();
2750
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
2751
                                    currentControl.IsNew = true;
2752
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
2753

    
2754
                                    currentControl.SetValue(Canvas.ZIndexProperty, 3);
2755
                                }
2756
                            }
2757
                        }
2758
                        break;
2759
                    case ControlType.RectCloud:
2760
                        {
2761
                            if (e.LeftButton == MouseButtonState.Pressed)
2762
                            {
2763
                                if (currentControl is RectCloudControl)
2764
                                {
2765
                                    //20180906 LJY TEST IsRotationDrawingEnable
2766
                                    if (IsGetoutpoint((currentControl as RectCloudControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
2767
                                    {
2768
                                        return;
2769
                                    }
2770

    
2771
                                    CreateCommand.Instance.Execute(currentControl);
2772

    
2773
                                    currentControl = null;
2774
                                
2775
                                    this.cursor = new Cursor(MainWindow.CursorChange().StreamSource);
2776
                                }
2777
                                else
2778
                                {
2779
                                    currentControl = new RectCloudControl
2780
                                    {
2781
                                        StartPoint = this.canvasDrawingMouseDownPoint,
2782
                                        ControlType = ControlType.RectCloud,
2783
                                        Background = new SolidColorBrush(Colors.Black)
2784
                                    };
2785

    
2786
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
2787
                                    currentControl.CommentID = Commons.shortGuid();
2788
                                    currentControl.IsNew = true;
2789
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
2790
                                }
2791
                            }
2792
                        }
2793
                        break;
2794
                    case ControlType.Circle:
2795
                        {
2796
                            if (e.LeftButton == MouseButtonState.Pressed)
2797
                            {
2798
                                if (currentControl is CircleControl)
2799
                                {
2800
                                    //20180906 LJY TEST IsRotationDrawingEnable
2801
                                    if (IsGetoutpoint((currentControl as CircleControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
2802
                                    {
2803
                                        return;
2804
                                    }
2805

    
2806
                                    CreateCommand.Instance.Execute(currentControl);
2807

    
2808
                                    currentControl = null;
2809
                                }
2810
                                else
2811
                                {
2812
                                    currentControl = new CircleControl
2813
                                    {
2814
                                        StartPoint = this.canvasDrawingMouseDownPoint,
2815
                                        LeftBottomPoint = this.canvasDrawingMouseDownPoint,
2816
                                        Background = new SolidColorBrush(Colors.Black)
2817
                                    };
2818

    
2819
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
2820
                                    currentControl.CommentID = Commons.shortGuid();
2821
                                    currentControl.IsNew = true;
2822
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
2823
                                }
2824
                            }
2825
                        }
2826
                        break;
2827
                    case ControlType.Triangle:
2828
                        {
2829
                            if (e.LeftButton == MouseButtonState.Pressed)
2830
                            {
2831
                                if (currentControl is TriControl)
2832
                                {
2833
                                    var content = currentControl as TriControl;
2834
                                    if (content.MidPoint == new Point(0, 0))
2835
                                    {
2836
                                        content.MidPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
2837
                                    }
2838
                                    else
2839
                                    {
2840
                                        //20180906 LJY TEST IsRotationDrawingEnable
2841
                                        if (IsGetoutpoint((currentControl as TriControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
2842
                                        {
2843
                                            return;
2844
                                        }
2845

    
2846
                                        CreateCommand.Instance.Execute(currentControl);
2847

    
2848
                                        currentControl = null;
2849
                                    }
2850
                                }
2851
                                else
2852
                                {
2853
                                    currentControl = new TriControl
2854
                                    {
2855
                                        StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y),
2856
                                        Background = new SolidColorBrush(Colors.Black),
2857
                                    };
2858

    
2859
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
2860
                                    currentControl.CommentID = Commons.shortGuid();
2861
                                    currentControl.IsNew = true;
2862
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
2863
                                }
2864
                            }
2865
                        }
2866
                        break;
2867
                    case ControlType.CancelLine:
2868
                    case ControlType.SingleLine:
2869
                    case ControlType.ArrowLine:
2870
                    case ControlType.TwinLine:
2871
                    case ControlType.DimLine:
2872
                        {
2873
                            if (e.LeftButton == MouseButtonState.Pressed)
2874
                            {
2875
                                if (currentControl is LineControl)
2876
                                {
2877
                                    //20180906 LJY TEST IsRotationDrawingEnable
2878
                                    if (IsGetoutpoint((currentControl as LineControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
2879
                                    {
2880
                                        return;
2881
                                    }
2882

    
2883
                                    CreateCommand.Instance.Execute(currentControl);
2884
                                    currentControl = null;
2885
                                    ViewerDataModel.Instance.AngleVisibility = Visibility.Collapsed;
2886
                                }
2887
                                else
2888
                                {
2889
                                    currentControl = new LineControl
2890
                                    {
2891
                                        ControlType = this.controlType,
2892
                                        StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y),
2893
                                        Background = new SolidColorBrush(Colors.Black)
2894
                                    };
2895

    
2896
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
2897
                                    currentControl.CommentID = Commons.shortGuid();
2898
                                    currentControl.IsNew = true;
2899
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
2900
                                    ViewerDataModel.Instance.AngleVisibility = Visibility.Visible;
2901
                                }
2902
                            }
2903
                        }
2904
                        break;
2905
                    case ControlType.PolygonControl:
2906
                        {
2907
                            if (currentControl is PolygonControl)
2908
                            {
2909
                                var control = currentControl as PolygonControl;
2910

    
2911
                                if (e.RightButton == MouseButtonState.Pressed)
2912
                                {
2913
                                    control.IsCompleted = true;
2914
                                }
2915

    
2916
                                if (!control.IsCompleted)
2917
                                {
2918
                                    control.PointSet.Add(control.EndPoint);
2919
                                }
2920
                                else
2921
                                {
2922
                                    //20180906 LJY TEST IsRotationDrawingEnable
2923
                                    if (IsGetoutpoint((currentControl as PolygonControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
2924
                                    {
2925
                                        return;
2926
                                    }
2927

    
2928
                                    var firstPoint = control.PointSet.First();
2929
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
2930
                                    control.LineSize = ViewerDataModel.Instance.LineSize;
2931
                                    control.PointSet.Add(firstPoint);
2932

    
2933
                                    control.ApplyOverViewData();
2934

    
2935
                                    CreateCommand.Instance.Execute(currentControl);
2936
                                    control.UpdateControl();
2937
                                    currentControl = null;
2938
                                }
2939
                            }
2940
                            else
2941
                            {
2942
                                if (e.LeftButton == MouseButtonState.Pressed)
2943
                                {
2944
                                    currentControl = new PolygonControl
2945
                                    {
2946
                                        PointSet = new List<Point>(),
2947
                                    };
2948

    
2949
                                    var polygonControl = (currentControl as PolygonControl);
2950
                                    currentControl.CommentID = Commons.shortGuid();
2951
                                    currentControl.IsNew = true;
2952
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
2953
                                    polygonControl.StartPoint = canvasDrawingMouseDownPoint;
2954
                                    polygonControl.EndPoint = canvasDrawingMouseDownPoint;
2955
                                    polygonControl.PointSet.Add(canvasDrawingMouseDownPoint);
2956
                                    polygonControl.PointSet.Add(canvasDrawingMouseDownPoint);
2957
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
2958
                                    polygonControl.ApplyTemplate();
2959
                                    polygonControl.Visibility = Visibility.Visible;
2960
                                }
2961
                            }
2962
                        }
2963
                        break;
2964
                    case ControlType.ChainLine:
2965
                        {
2966
                            if (currentControl is PolygonControl)
2967
                            {
2968
                                var control = currentControl as PolygonControl;
2969

    
2970
                                if (e.RightButton == MouseButtonState.Pressed)
2971
                                {
2972
                                    //20180906 LJY TEST IsRotationDrawingEnable
2973
                                    if (IsGetoutpoint((currentControl as PolygonControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
2974
                                    {
2975
                                        return;
2976
                                    }
2977

    
2978
                                    CreateCommand.Instance.Execute(currentControl);
2979

    
2980
                                    currentControl = null;
2981
                                    ViewerDataModel.Instance.AngleVisibility = Visibility.Collapsed;
2982
                                    return;
2983
                                }
2984

    
2985
                                if (!control.IsCompleted)
2986
                                {
2987
                                    control.PointSet.Add(control.EndPoint);
2988
                                    ViewerDataModel.Instance.AngleVisibility = Visibility.Visible;
2989
                                }
2990
                            }
2991
                            else
2992
                            {
2993
                                if (e.LeftButton == MouseButtonState.Pressed)
2994
                                {
2995
                                    MainAngle.Visibility = Visibility.Visible;
2996
                                    currentControl = new PolygonControl
2997
                                    {
2998
                                        PointSet = new List<Point>(),
2999
                                        //강인구 추가(ChainLine일때는 채우기 스타일을 주지 않기 위해 설정)
3000
                                        ControlType = ControlType.ChainLine,
3001
                                        DashSize = ViewerDataModel.Instance.DashSize,
3002
                                        LineSize = ViewerDataModel.Instance.LineSize,
3003
                                        //PointC = new StylusPointSet()
3004
                                    };
3005

    
3006
                                    //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3007
                                    //{
3008
                                        var polygonControl = (currentControl as PolygonControl);
3009
                                        currentControl.CommentID = Commons.shortGuid();
3010
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3011
                                        currentControl.IsNew = true;
3012
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3013
                                        //currentControl.OnApplyTemplate();
3014
                                        //polygonControl.PointC.pointSet.Add(canvasDrawingMouseDownPoint);
3015
                                        //polygonControl.PointC.pointSet.Add(canvasDrawingMouseDownPoint);
3016
                                        polygonControl.PointSet.Add(canvasDrawingMouseDownPoint);
3017
                                        polygonControl.PointSet.Add(canvasDrawingMouseDownPoint);
3018
                                    //}
3019
                                }
3020
                            }
3021
                        }
3022
                        break;
3023
                    case ControlType.ArcLine:
3024
                        {
3025
                            if (e.LeftButton == MouseButtonState.Pressed)
3026
                            {
3027
                                if (currentControl is ArcControl)
3028
                                {
3029
                                    //20180906 LJY TEST IsRotationDrawingEnable
3030
                                    if (IsGetoutpoint((currentControl as ArcControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3031
                                    {
3032
                                        return;
3033
                                    }
3034

    
3035
                                    CreateCommand.Instance.Execute(currentControl);
3036

    
3037
                                    currentControl = null;
3038
                                    ViewerDataModel.Instance.AngleVisibility = Visibility.Collapsed;
3039
                                }
3040
                                else
3041
                                {
3042
                                    currentControl = new ArcControl
3043
                                    {
3044
                                        StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y),
3045
                                        Background = new SolidColorBrush(Colors.Black)
3046
                                    };
3047
                                    currentControl.CommentID = Commons.shortGuid();
3048
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3049
                                    currentControl.IsNew = true;
3050
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3051
                                    ViewerDataModel.Instance.AngleVisibility = Visibility.Visible;
3052
                                }
3053
                            }
3054
                            else if (e.RightButton == MouseButtonState.Pressed)
3055
                            {
3056
                                if (currentControl != null)
3057
                                {
3058
                                    (currentControl as ArcControl).setClock();
3059
                                    (currentControl as ArcControl).MidPoint = new Point(0, 0);
3060
                                }
3061
                            }
3062
                        }
3063
                        break;
3064
                    case ControlType.ArcArrow:
3065
                        {
3066
                            if (e.LeftButton == MouseButtonState.Pressed)
3067
                            {
3068
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3069
                                //{
3070
                                if (currentControl is ArrowArcControl)
3071
                                {
3072
                                    //20180906 LJY TEST IsRotationDrawingEnable
3073
                                    if (IsGetoutpoint((currentControl as ArrowArcControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3074
                                    {
3075
                                        return;
3076
                                    }
3077

    
3078
                                    CreateCommand.Instance.Execute(currentControl);
3079

    
3080
                                    currentControl = null;
3081
                                    ViewerDataModel.Instance.AngleVisibility = Visibility.Collapsed;
3082
                                }
3083
                                else
3084
                                {
3085
                                    currentControl = new ArrowArcControl
3086
                                    {
3087
                                        StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y),
3088
                                        Background = new SolidColorBrush(Colors.Black)
3089
                                    };
3090
                                    currentControl.CommentID = Commons.shortGuid();
3091
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3092
                                    currentControl.IsNew = true;
3093
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3094
                                    ViewerDataModel.Instance.AngleVisibility = Visibility.Visible;
3095
                                }
3096
                                //}
3097
                            }
3098
                            else if (e.RightButton == MouseButtonState.Pressed)
3099
                            {
3100
                                if (currentControl != null)
3101
                                {
3102
                                    (currentControl as ArrowArcControl).setClock();
3103
                                    (currentControl as ArrowArcControl).MidPoint = new Point(0, 0);
3104
                                    //(currentControl as ArcControl).ApplyTemplate();
3105
                                }
3106
                            }
3107
                        }
3108
                        break;
3109
                    case ControlType.ArrowMultiLine:
3110
                        {
3111
                            if (e.LeftButton == MouseButtonState.Pressed)
3112
                            {
3113
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3114
                                //{
3115

    
3116
                                    if (currentControl is ArrowControl_Multi)
3117
                                    {
3118
                                        var content = currentControl as ArrowControl_Multi;
3119
                                        if (content.MiddlePoint == new Point(0, 0))
3120
                                        {
3121
                                            if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift)
3122
                                            {
3123
                                                content.MiddlePoint = content.EndPoint;
3124
                                            }
3125
                                            else
3126
                                            {
3127
                                                content.MiddlePoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
3128
                                            }
3129
                                        }
3130
                                        else
3131
                                        {
3132
                                            //20180906 LJY TEST IsRotationDrawingEnable
3133
                                            if (IsGetoutpoint((currentControl as ArrowControl_Multi).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3134
                                            {
3135
                                                return;
3136
                                            }
3137

    
3138
                                            CreateCommand.Instance.Execute(currentControl);
3139

    
3140
                                            currentControl = null;
3141
                                            ViewerDataModel.Instance.AngleVisibility = Visibility.Collapsed;
3142
                                        }
3143
                                    }
3144
                                    else
3145
                                    {
3146
                                        currentControl = new ArrowControl_Multi
3147
                                        {
3148
                                            StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y),
3149
                                            Background = new SolidColorBrush(Colors.Black)
3150
                                        };
3151
                                        currentControl.CommentID = Commons.shortGuid();
3152
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3153
                                        currentControl.IsNew = true;
3154
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3155
                                        ViewerDataModel.Instance.AngleVisibility = Visibility.Visible;
3156
                                    }
3157
                                //}
3158
                            }
3159
                        }
3160
                        break;
3161
                    case ControlType.PolygonCloud:
3162
                        {
3163
                            if (currentControl is CloudControl)
3164
                            {
3165
                                var control = currentControl as CloudControl;
3166
                                if (e.RightButton == MouseButtonState.Pressed)
3167
                                {
3168
                                    control.IsCompleted = true;
3169
                                }
3170

    
3171
                                if (!control.IsCompleted)
3172
                                {
3173
                                    control.PointSet.Add(control.EndPoint);
3174
                                }
3175
                                else
3176
                                {
3177
                                    //20180906 LJY TEST IsRotationDrawingEnable
3178
                                    if (IsGetoutpoint((currentControl as CloudControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3179
                                    {
3180
                                        return;
3181
                                    }
3182

    
3183
                                    CreateCommand.Instance.Execute(currentControl);
3184

    
3185
                                    control.isTransOn = true;
3186
                                    var firstPoint = control.PointSet.First();
3187

    
3188
                                    control.PointSet.Add(firstPoint);
3189
                                    control.DrawingCloud();
3190
                                    control.ApplyOverViewData();
3191

    
3192
                                    currentControl = null;
3193
                                }
3194
                            }
3195
                            else
3196
                            {
3197
                                if (e.LeftButton == MouseButtonState.Pressed)
3198
                                {
3199
                                    currentControl = new CloudControl
3200
                                    {
3201
                                        PointSet = new List<Point>(),
3202
                                        PointC = new StylusPointSet()
3203
                                    };
3204

    
3205
                                    //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3206
                                    //{
3207
                                        var polygonControl = (currentControl as CloudControl);
3208
                                        currentControl.CommentID = Commons.shortGuid();
3209
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3210
                                        currentControl.IsNew = true;
3211
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3212

    
3213
                                        polygonControl.PointSet.Add(canvasDrawingMouseDownPoint);
3214
                                        polygonControl.PointSet.Add(canvasDrawingMouseDownPoint);
3215
                                    
3216
                                    //}
3217
                                }
3218
                            }
3219
                        }
3220
                        break;
3221
                    case ControlType.ImgControl:
3222
                        {
3223
                            if (e.LeftButton == MouseButtonState.Pressed)
3224
                            {
3225
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3226
                                //{
3227
                                    if (currentControl is ImgControl)
3228
                                    {
3229
                                        //20180906 LJY TEST IsRotationDrawingEnable
3230
                                        if (IsGetoutpoint((currentControl as ImgControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3231
                                        {
3232
                                            return;
3233
                                        }
3234

    
3235
                                        CreateCommand.Instance.Execute(currentControl);
3236
                                        controlType = ControlType.ImgControl;
3237
                                        currentControl = null;
3238
                                    }
3239
                                    else
3240
                                    {
3241
                                        
3242
                                        string extension = System.IO.Path.GetExtension(filename).ToUpper();
3243
                                        if (extension == ".PNG" || extension == ".JPEG" || extension == ".GIF" || extension == ".BMP" || extension == ".JPG" || extension == ".SVG")
3244
                                        {
3245
                                            Image img = new Image();
3246
                                            if (filename.Contains(".svg"))
3247
                                            {
3248
                                                byte[] imageData = null;
3249
                                                DrawingImage image = null;
3250
                                                using (System.Net.WebClient web = new System.Net.WebClient())
3251
                                                {
3252
                                                    imageData = web.DownloadData(new Uri(filename));
3253
                                                    System.IO.Stream stream = new System.IO.MemoryStream(imageData);
3254
                                                    image = SvgReader.Load(stream);
3255
                                                }
3256
                                                img.Source = image;
3257
                                            }
3258
                                            else
3259
                                            {
3260
                                                img.Source = new BitmapImage(new Uri(filename));
3261
                                            }
3262

    
3263
                                            currentControl = new ImgControl
3264
                                            {
3265
                                                    Background = new SolidColorBrush(Colors.Black),
3266
                                                    PointSet = new List<Point>(),
3267
                                                    FilePath = filename,
3268
                                                    ImageData = img.Source,
3269
                                                    StartPoint = canvasDrawingMouseDownPoint,
3270
                                                    EndPoint = new Point(canvasDrawingMouseDownPoint.X + 100, canvasDrawingMouseDownPoint.Y + 100),
3271
                                                    TopRightPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y + 100),
3272
                                                    LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X + 100, canvasDrawingMouseDownPoint.Y),
3273
                                                    ControlType = ControlType.ImgControl
3274
                                                };
3275

    
3276
                                        
3277
                                                currentControl.CommentID = Commons.shortGuid();                                            
3278
                                                currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3279
                                                currentControl.IsNew = true;
3280
                                                ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3281

    
3282
                                        //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정  
3283
                                        (currentControl as ImgControl).CommentAngle -= rotate.Angle;
3284
                                    }
3285
                                    }
3286
                                //}
3287
                            }
3288
                        }
3289
                        break;
3290
                    case ControlType.Date:
3291
                        {
3292
                            if (e.LeftButton == MouseButtonState.Pressed)
3293
                            {
3294
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3295
                                //{
3296
                                    if (currentControl is DateControl)
3297
                                    {
3298
                                        //20180906 LJY TEST IsRotationDrawingEnable
3299
                                        if (IsGetoutpoint((currentControl as DateControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3300
                                        {
3301
                                            return;
3302
                                        }
3303

    
3304
                                        CreateCommand.Instance.Execute(currentControl);
3305
                                        currentControl = null;
3306

    
3307
                                        if (Common.ViewerDataModel.Instance.SelectedControl == "Batch")
3308
                                        {
3309
                                            controlType = ControlType.None;
3310
                                            IsSwingMode = false;
3311
                                            Common.ViewerDataModel.Instance.SelectedControl = "";
3312
                                            Common.ViewerDataModel.Instance.ControlTag = null;
3313
                                            mouseHandlingMode = MouseHandlingMode.None;
3314
                                            this.ParentOfType<MainWindow>().dzTopMenu.btn_Batch.IsChecked = false;
3315
                                            txtBatch.Visibility = Visibility.Collapsed;
3316

    
3317
                                        }
3318
                                    }
3319
                                    else
3320
                                    {
3321
                                        currentControl = new DateControl
3322
                                        {
3323
                                            StartPoint = canvasDrawingMouseDownPoint,
3324
                                            Background = new SolidColorBrush(Colors.Black)
3325
                                        };
3326
                                        currentControl.CommentID = Commons.shortGuid();
3327
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3328
                                        currentControl.IsNew = true;
3329
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3330

    
3331
                                        //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 
3332
                                        (currentControl as ImgControl).CommentAngle -= rotate.Angle;
3333
                                }
3334
                                //}
3335
                            }
3336
                        }
3337
                        break;
3338
                    case ControlType.TextControl:
3339
                        {
3340
                            if (e.LeftButton == MouseButtonState.Pressed)
3341
                            {
3342
                                if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3343
                                {
3344
                                    currentControl = new TextControl
3345
                                    {
3346
                                        ControlType = controlType
3347
                                    };
3348
                                    (currentControl as TextControl).TextSize = ViewerDataModel.Instance.TextSize;
3349
                                    currentControl.CommentID = Commons.shortGuid();
3350
                                    currentControl.IsNew = true;
3351
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3352
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3353
                                    currentControl.SetValue(Canvas.ZIndexProperty, 3);
3354

    
3355
                                    currentControl.SetValue(TextControl.CanvasXProperty, canvasDrawingMouseDownPoint.X);
3356
                                    currentControl.SetValue(TextControl.CanvasYProperty, canvasDrawingMouseDownPoint.Y);
3357
                                    
3358
                                    (currentControl as TextControl).ControlType_No = 0;
3359
                                    (currentControl as TextControl).CommentAngle -= rotate.Angle;
3360
                                    (currentControl as TextControl).IsHighLight = ViewerDataModel.Instance.checkHighShape;
3361
                                    (currentControl as TextControl).ApplyTemplate();
3362
                                    (currentControl as TextControl).Base_TextBox.Focus();
3363
                                    (currentControl as TextControl).SetFontFamily(new FontFamily(this.ParentOfType<MainWindow>().dzTopMenu.comboFontFamily.Text));
3364
                                    CreateCommand.Instance.Execute(currentControl);
3365
                                }
3366
                            }
3367
                        }
3368
                        break;
3369
                    case ControlType.TextBorder:
3370
                        {
3371
                            if (e.LeftButton == MouseButtonState.Pressed)
3372
                            {
3373
                                if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3374
                                {
3375
                                    currentControl = new TextControl
3376
                                    {
3377
                                        ControlType = controlType
3378
                                    };
3379

    
3380
                                    (currentControl as TextControl).TextSize = ViewerDataModel.Instance.TextSize;
3381
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3382
                                    currentControl.CommentID = Commons.shortGuid();
3383
                                    currentControl.IsNew = true;
3384
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3385
                                    currentControl.SetValue(Canvas.ZIndexProperty, 3);
3386
                                    currentControl.SetValue(TextControl.CanvasXProperty, canvasDrawingMouseDownPoint.X);
3387
                                    currentControl.SetValue(TextControl.CanvasYProperty, canvasDrawingMouseDownPoint.Y);
3388
                                    
3389
                                    (currentControl as TextControl).ControlType_No = 1;
3390
                                    (currentControl as TextControl).CommentAngle = Ang;
3391
                                    (currentControl as TextControl).IsHighLight = ViewerDataModel.Instance.checkHighShape;
3392
                                    (currentControl as TextControl).ApplyTemplate();
3393
                                    (currentControl as TextControl).Base_TextBox.Focus();
3394
                                    (currentControl as TextControl).SetFontFamily(new FontFamily(this.ParentOfType<MainWindow>().dzTopMenu.comboFontFamily.Text));
3395
                                    CreateCommand.Instance.Execute(currentControl);
3396
                                }
3397
                            }
3398
                        }
3399
                        break;
3400
                    case ControlType.TextCloud:
3401
                        {
3402
                            if (e.LeftButton == MouseButtonState.Pressed)
3403
                            {
3404
                                if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3405
                                {
3406
                                    currentControl = new TextControl
3407
                                    {
3408
                                        ControlType = controlType
3409
                                    };
3410

    
3411
                                    (currentControl as TextControl).TextSize = ViewerDataModel.Instance.TextSize;
3412
                                    currentControl.CommentID = Commons.shortGuid();
3413
                                    currentControl.IsNew = true;
3414
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3415
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3416

    
3417
                                    currentControl.SetValue(Canvas.ZIndexProperty, 3);
3418
                                    currentControl.SetValue(TextControl.CanvasXProperty, canvasDrawingMouseDownPoint.X);
3419
                                    currentControl.SetValue(TextControl.CanvasYProperty, canvasDrawingMouseDownPoint.Y);
3420

    
3421
                                    (currentControl as TextControl).CommentAngle = Ang;
3422
                                    (currentControl as TextControl).ControlType_No = 2;
3423
                                    (currentControl as TextControl).IsHighLight = ViewerDataModel.Instance.checkHighShape;
3424
                                    (currentControl as TextControl).ApplyTemplate();
3425
                                    (currentControl as TextControl).Base_TextBox.Focus();
3426
                                    CreateCommand.Instance.Execute(currentControl);
3427
                                    (currentControl as TextControl).SetFontFamily(new FontFamily(this.ParentOfType<MainWindow>().dzTopMenu.comboFontFamily.Text));
3428
                                    //currentControl = null;
3429
                                }
3430
                            }
3431
                        }
3432
                        break;
3433
                    case ControlType.ArrowTextControl:
3434
                         {
3435
                            if (e.LeftButton == MouseButtonState.Pressed)
3436
                            {
3437
                                if (currentControl is ArrowTextControl)
3438
                                {
3439
                                    //20180906 LJY TEST IsRotationDrawingEnable
3440
                                    if (IsGetoutpoint((currentControl as ArrowTextControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3441
                                    {
3442
                                        return;
3443
                                    }
3444

    
3445
                                    CreateCommand.Instance.Execute(currentControl);
3446

    
3447
                                    (currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false;
3448
                                    (currentControl as ArrowTextControl).EnableEditing = false;
3449
                                    (currentControl as ArrowTextControl).IsNew = false;
3450
                                    currentControl = null;
3451
                                }
3452
                                else
3453
                                {
3454
                                    //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3455
                                    //{
3456
                                        currentControl = new ArrowTextControl();
3457
                                        currentControl.CommentID = Commons.shortGuid();
3458
                                        currentControl.IsNew = true;
3459
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3460
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3461

    
3462
                                        currentControl.SetValue(Canvas.ZIndexProperty, 3);
3463
                                        currentControl.SetValue(ArrowTextControl.StartPointProperty, canvasDrawingMouseDownPoint);
3464
                                        currentControl.SetValue(ArrowTextControl.EndPointProperty, canvasDrawingMouseDownPoint);
3465
                                        (currentControl as ArrowTextControl).TextSize = ViewerDataModel.Instance.TextSize;
3466
                                        (currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape;
3467

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

    
3471
                                    (currentControl as ArrowTextControl).ApplyTemplate();
3472
                                        (currentControl as ArrowTextControl).Base_TextBox.Focus();
3473
                                        (currentControl as ArrowTextControl).SetFontFamily(new FontFamily(this.ParentOfType<MainWindow>().dzTopMenu.comboFontFamily.Text));
3474
                                        ViewerDataModel.Instance.AngleVisibility = Visibility.Visible;
3475

    
3476
                                    
3477
                                    //}
3478
                                }
3479
                            }
3480
                        }
3481
                        break;
3482
                    case ControlType.ArrowTransTextControl:
3483
                        {
3484
                            if (e.LeftButton == MouseButtonState.Pressed)
3485
                            {
3486
                                if (currentControl is ArrowTextControl)
3487
                                {
3488
                                    //20180906 LJY TEST IsRotationDrawingEnable
3489
                                    if (IsGetoutpoint((currentControl as ArrowTextControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3490
                                    {
3491
                                        return;
3492
                                    }
3493

    
3494
                                    CreateCommand.Instance.Execute(currentControl);
3495

    
3496
                                    (currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false;
3497
                                    
3498
                                    currentControl.IsNew = false;
3499
                                    currentControl = null;
3500
                                    ViewerDataModel.Instance.AngleVisibility = Visibility.Collapsed;
3501
                                }
3502
                                else
3503
                                {
3504
                                    //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3505
                                    //{
3506
                                    currentControl = new ArrowTextControl()
3507
                                    {
3508
                                        ControlType = ControlType.ArrowTransTextControl
3509
                                    };
3510
                                    currentControl.CommentID = Commons.shortGuid();
3511
                                    currentControl.IsNew = true;
3512
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3513
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3514
                                    currentControl.SetValue(Canvas.ZIndexProperty, 3);
3515
                                    currentControl.SetValue(ArrowTextControl.StartPointProperty, canvasDrawingMouseDownPoint);
3516
                                    currentControl.SetValue(ArrowTextControl.EndPointProperty, canvasDrawingMouseDownPoint);                  
3517
                                    (currentControl as ArrowTextControl).TextSize = ViewerDataModel.Instance.TextSize;
3518
                                    (currentControl as ArrowTextControl).isFixed = true;
3519
                                    (currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape;
3520

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

    
3524
                                    (currentControl as ArrowTextControl).ApplyTemplate();
3525
                                    (currentControl as ArrowTextControl).Base_TextBox.Focus();
3526
                                    (currentControl as ArrowTextControl).isTrans = true;
3527
                                    (currentControl as ArrowTextControl).SetFontFamily(new FontFamily(this.ParentOfType<MainWindow>().dzTopMenu.comboFontFamily.Text));
3528
                                }
3529
                            }
3530
                        }
3531
                        break;
3532
                    case ControlType.ArrowTextBorderControl:
3533
                         {
3534
                            if (e.LeftButton == MouseButtonState.Pressed)
3535
                            {
3536
                                if (currentControl is ArrowTextControl)
3537
                                {
3538
                                    //20180906 LJY TEST IsRotationDrawingEnable
3539
                                    if (IsGetoutpoint((currentControl as ArrowTextControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3540
                                    {
3541
                                        return;
3542
                                    }
3543

    
3544
                                    CreateCommand.Instance.Execute(currentControl);
3545
                                    (currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false;
3546
                                    currentControl.IsNew = false;
3547
                                    currentControl = null;
3548
                                    ViewerDataModel.Instance.AngleVisibility = Visibility.Collapsed;
3549
                                }
3550
                                else
3551
                                {
3552
                                    //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3553
                                    //{
3554
                                        currentControl = new ArrowTextControl()
3555
                                        {
3556
                                            ArrowTextStyle = MarkupToPDF.Controls.Text.ArrowTextControl.ArrowTextStyleSet.Rect
3557
                                        };
3558
                                        currentControl.CommentID = Commons.shortGuid();
3559
                                        currentControl.IsNew = true;
3560
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3561
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3562

    
3563
                                        currentControl.SetValue(Canvas.ZIndexProperty, 3);
3564

    
3565
                                        currentControl.SetValue(ArrowTextControl.StartPointProperty, canvasDrawingMouseDownPoint);
3566

    
3567
                                        currentControl.SetValue(ArrowTextControl.EndPointProperty, canvasDrawingMouseDownPoint);
3568
                                        (currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape;
3569
                                        (currentControl as ArrowTextControl).TextSize = ViewerDataModel.Instance.TextSize;
3570
                                        (currentControl as ArrowTextControl).SetFontFamily(new FontFamily(this.ParentOfType<MainWindow>().dzTopMenu.comboFontFamily.Text));
3571
                                        //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 
3572
                                        (currentControl as ArrowTextControl).CommentAngle -= rotate.Angle;
3573
                                        (currentControl as ArrowTextControl).ApplyTemplate();
3574
                                        (currentControl as ArrowTextControl).Base_TextBox.Focus();
3575
                                        ViewerDataModel.Instance.AngleVisibility = Visibility.Visible;                                    
3576
                                    //}
3577
                                }
3578
                            }
3579
                        }
3580
                        break;
3581
                    case ControlType.ArrowTransTextBorderControl:
3582
                        {
3583
                            if (e.LeftButton == MouseButtonState.Pressed)
3584
                            {
3585
                                if (currentControl is ArrowTextControl)
3586
                                {
3587
                                    //20180906 LJY TEST IsRotationDrawingEnable
3588
                                    if (IsGetoutpoint((currentControl as ArrowTextControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3589
                                    {
3590
                                        return;
3591
                                    }
3592
                                    CreateCommand.Instance.Execute(currentControl);
3593
                                    (currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false;
3594
                                    currentControl.IsNew = false;
3595
                                    currentControl = null;
3596

    
3597
                                    ViewerDataModel.Instance.AngleVisibility = Visibility.Collapsed;
3598
                                }
3599
                                else
3600
                                {
3601
                                    //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3602
                                    //{
3603
                                    
3604

    
3605
                                    currentControl = new ArrowTextControl()
3606
                                    {
3607
                                        ArrowTextStyle = MarkupToPDF.Controls.Text.ArrowTextControl.ArrowTextStyleSet.Rect,
3608
                                        ControlType = ControlType.ArrowTransTextBorderControl
3609

    
3610
                                    };
3611
                                        currentControl.CommentID = Commons.shortGuid();
3612
                                        currentControl.IsNew = true;
3613
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3614
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3615

    
3616
                                        currentControl.SetValue(Canvas.ZIndexProperty, 3);
3617

    
3618
                                        currentControl.SetValue(ArrowTextControl.StartPointProperty, canvasDrawingMouseDownPoint);
3619
                                        currentControl.SetValue(ArrowTextControl.EndPointProperty, canvasDrawingMouseDownPoint);                                    
3620
                                        (currentControl as ArrowTextControl).TextSize = ViewerDataModel.Instance.TextSize;
3621
                                        (currentControl as ArrowTextControl).isFixed = true;
3622
                                        (currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape;
3623
                                     
3624
                                        //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정  
3625
                                        (currentControl as ArrowTextControl).CommentAngle -= rotate.Angle;
3626
                                        (currentControl as ArrowTextControl).ApplyTemplate();
3627
                                        (currentControl as ArrowTextControl).SetFontFamily(new FontFamily(this.ParentOfType<MainWindow>().dzTopMenu.comboFontFamily.Text));
3628
                                        (currentControl as ArrowTextControl).Base_TextBox.Focus();                                 
3629
                                        ViewerDataModel.Instance.AngleVisibility = Visibility.Visible;
3630
                                    
3631
                                    //20180911 LJY
3632
                                        (currentControl as ArrowTextControl).isTrans = true;
3633
                                    
3634

    
3635
                                    //}
3636
                                }
3637
                            }
3638
                        }
3639
                        break;
3640
                    case ControlType.ArrowTextCloudControl:
3641
                        {
3642
                            if (e.LeftButton == MouseButtonState.Pressed)
3643
                            {
3644
                                if (currentControl is ArrowTextControl)
3645
                                {
3646
                                    //20180906 LJY TEST IsRotationDrawingEnable
3647
                                    if (IsGetoutpoint((currentControl as ArrowTextControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3648
                                    {
3649
                                        return;
3650
                                    }
3651
                                    CreateCommand.Instance.Execute(currentControl);
3652
                                    (currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false;
3653
                                    currentControl.IsNew = false;
3654
                                    currentControl = null;
3655
                                    ViewerDataModel.Instance.AngleVisibility = Visibility.Collapsed;
3656
                                }
3657
                                else
3658
                                {
3659
                                    //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3660
                                    //{
3661
                                        currentControl = new ArrowTextControl()
3662
                                        {
3663
                                            ArrowTextStyle = MarkupToPDF.Controls.Text.ArrowTextControl.ArrowTextStyleSet.Cloud
3664
                                        };
3665
                                        currentControl.CommentID = Commons.shortGuid();
3666
                                        currentControl.IsNew = true;
3667
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3668
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3669

    
3670
                                        currentControl.SetValue(Canvas.ZIndexProperty, 3);
3671
                                        currentControl.SetValue(ArrowTextControl.StartPointProperty, canvasDrawingMouseDownPoint);
3672
                                        currentControl.SetValue(ArrowTextControl.EndPointProperty, canvasDrawingMouseDownPoint);                                 
3673
                                        (currentControl as ArrowTextControl).TextSize = ViewerDataModel.Instance.TextSize;
3674
                                        (currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape;
3675
                                        (currentControl as ArrowTextControl).SetFontFamily(new FontFamily(this.ParentOfType<MainWindow>().dzTopMenu.comboFontFamily.Text));
3676
                                        //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정  
3677
                                        (currentControl as ArrowTextControl).CommentAngle -= rotate.Angle;
3678
                                    
3679
                                        (currentControl as ArrowTextControl).ApplyTemplate();
3680
                                        (currentControl as ArrowTextControl).Base_TextBox.Focus();
3681
                                        ViewerDataModel.Instance.AngleVisibility = Visibility.Visible;                                        
3682
                                    //}
3683
                                }
3684
                            }
3685
                        }
3686
                        break;
3687
                    case ControlType.ArrowTransTextCloudControl:
3688
                        {
3689
                            if (e.LeftButton == MouseButtonState.Pressed)
3690
                            {
3691
                                if (currentControl is ArrowTextControl)
3692
                                {
3693
                                    //20180906 LJY TEST IsRotationDrawingEnable
3694
                                    if (IsGetoutpoint((currentControl as ArrowTextControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3695
                                    {
3696
                                        return;
3697
                                    }
3698
                                    CreateCommand.Instance.Execute(currentControl);
3699
                                    (currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false;
3700
                                    currentControl.IsNew = false;
3701
                                    currentControl = null;
3702
                                    ViewerDataModel.Instance.AngleVisibility = Visibility.Collapsed;
3703
                                }
3704
                                else
3705
                                {
3706
                                    //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3707
                                    //{
3708
                                        currentControl = new ArrowTextControl()
3709
                                        {
3710
                                            ArrowTextStyle = MarkupToPDF.Controls.Text.ArrowTextControl.ArrowTextStyleSet.Cloud,
3711
                                            ControlType = ControlType.ArrowTransTextCloudControl
3712

    
3713
                                        };
3714
                                        currentControl.CommentID = Commons.shortGuid();
3715
                                        currentControl.IsNew = true; 
3716
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3717
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3718
                                        currentControl.SetValue(Canvas.ZIndexProperty, 3);
3719

    
3720
                                        currentControl.SetValue(ArrowTextControl.StartPointProperty, canvasDrawingMouseDownPoint);
3721
                                        currentControl.SetValue(ArrowTextControl.EndPointProperty, canvasDrawingMouseDownPoint);                                        
3722
                                        (currentControl as ArrowTextControl).TextSize = ViewerDataModel.Instance.TextSize;
3723
                                        (currentControl as ArrowTextControl).isFixed = true;
3724
                                        (currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape;
3725

    
3726
                                        //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 
3727
                                        (currentControl as ArrowTextControl).CommentAngle -= rotate.Angle;
3728
                                        (currentControl as ArrowTextControl).SetFontFamily(new FontFamily(this.ParentOfType<MainWindow>().dzTopMenu.comboFontFamily.Text));
3729
                                        (currentControl as ArrowTextControl).ApplyTemplate();
3730
                                        (currentControl as ArrowTextControl).Base_TextBox.Focus();
3731
                                        ViewerDataModel.Instance.AngleVisibility = Visibility.Visible;  
3732
                                    
3733
                                    //20180911 LJY
3734
                                        (currentControl as ArrowTextControl).isTrans = true;
3735
                                    //}
3736
                                }
3737
                            }
3738
                        }
3739
                        break;
3740
                    //강인구 추가
3741
                    case ControlType.Sign:
3742
                        {
3743
                            if (e.LeftButton == MouseButtonState.Pressed)
3744
                            {
3745
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3746
                                //{
3747
                                    var _sign = GetUserSign.GetSign(App.ViewInfo.UserID, App.ViewInfo.ProjectNO,App.isExternal);
3748

    
3749
                                    if (_sign == null)
3750
                                    {
3751
                                        txtBatch.Visibility = Visibility.Collapsed;
3752
                                        mouseHandlingMode = IKCOM.MouseHandlingMode.None;
3753
                                        controlType = ControlType.None;
3754

    
3755
                                        this.ParentOfType<MainWindow>().DialogMessage_Alert("등록된 Sign이 없습니다.", "Alert");
3756
                                        this.ParentOfType<MainWindow>().ChildrenOfType<RadToggleButton>().Where(data => data.IsChecked == true).FirstOrDefault().IsChecked = false;
3757
                                        return;
3758
                                    }
3759

    
3760
                                    if (currentControl is SignControl)
3761
                                    {
3762
                                        //20180906 LJY TEST IsRotationDrawingEnable
3763
                                        if (IsGetoutpoint((currentControl as SignControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3764
                                        {
3765
                                            return;
3766
                                        }
3767

    
3768
                                        CreateCommand.Instance.Execute(currentControl);
3769
                                        currentControl = null;
3770
                                        if (Common.ViewerDataModel.Instance.SelectedControl == "Batch")
3771
                                        {
3772
                                            txtBatch.Text = "Place Date";
3773
                                            controlType = ControlType.Date;
3774
                                        }
3775
                                    }
3776
                                    else
3777
                                    {
3778
                                        currentControl = new SignControl
3779
                                        {
3780
                                            Background = new SolidColorBrush(Colors.Black),
3781
                                            UserNumber = App.ViewInfo.UserID,
3782
                                            ProjectNO = App.ViewInfo.ProjectNO,
3783
                                            StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y),
3784
                                            EndPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y),
3785
                                            ControlType = ControlType.Sign
3786
                                        };
3787

    
3788
                                        currentControl.CommentID = Commons.shortGuid();
3789
                                        currentControl.IsNew = true;
3790
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3791
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3792

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

    
3814
                                        CreateCommand.Instance.Execute(currentControl);
3815
                                        (currentControl as RectangleControl).ApplyOverViewData();
3816
                                        currentControl = null;
3817
                                    
3818
                                        this.cursor = new Cursor(MainWindow.CursorChange().StreamSource);
3819

    
3820
                                        if (Common.ViewerDataModel.Instance.SelectedControl == "Batch")
3821
                                        {
3822
                                            txtBatch.Text = "Place Signature";
3823
                                            controlType = ControlType.Sign;
3824
                                        }
3825
                                    }
3826
                                    else
3827
                                    {
3828
                                        currentControl = new RectangleControl
3829
                                        {
3830
                                            StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y),
3831
                                            Background = new SolidColorBrush(Colors.Black),
3832
                                            ControlType = ControlType.Mark ,
3833
                                            Paint = PaintSet.Fill
3834
                                        };
3835

    
3836
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3837
                                        currentControl.CommentID = Commons.shortGuid();
3838
                                        currentControl.IsNew = true;
3839
                                        (currentControl as RectangleControl).DashSize = ViewerDataModel.Instance.DashSize;
3840
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3841
                                    }
3842
                                //}
3843
                            }
3844
                        }
3845
                        break;
3846
                    case ControlType.Symbol:
3847
                        {
3848
                            if (e.LeftButton == MouseButtonState.Pressed)
3849
                            {
3850
                                if (currentControl is SymControl)
3851
                                {
3852
                                    //20180906 LJY TEST IsRotationDrawingEnable
3853
                                    if (IsGetoutpoint((currentControl as SymControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3854
                                    {
3855
                                        return;
3856
                                    }
3857
                                    CreateCommand.Instance.Execute(currentControl);
3858
                                    currentControl = null;
3859
                                
3860
                                    this.cursor = new Cursor(MainWindow.CursorChange().StreamSource);
3861
                                }
3862
                                else
3863
                                {
3864
                                    currentControl = new SymControl
3865
                                    {
3866
                                        StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y),
3867
                                        Background = new SolidColorBrush(Colors.Black),
3868
                                        LineSize = ViewerDataModel.Instance.LineSize + 3,
3869
                                        ControlType = ControlType.Symbol
3870
                                    };
3871

    
3872
                                    currentControl.IsNew = true;
3873
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3874
                                    currentControl.CommentID = Commons.shortGuid();
3875
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3876

    
3877
                                    //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정  
3878
                                    (currentControl as SymControl).CommentAngle -= rotate.Angle;
3879
                                }
3880
                                //}
3881
                            }
3882
                        }
3883
                        break;
3884
                    case ControlType.Stamp:
3885
                        {
3886
                            if (e.LeftButton == MouseButtonState.Pressed)
3887
                            {
3888
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3889
                                //{
3890
                                    if (currentControl is SymControlN)
3891
                                    {
3892
                                        //20180906 LJY TEST IsRotationDrawingEnable
3893
                                        if (IsGetoutpoint((currentControl as SymControlN).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3894
                                        {
3895
                                            return;
3896
                                        }
3897

    
3898
                                        CreateCommand.Instance.Execute(currentControl);
3899
                                        currentControl = null;
3900
                                   
3901

    
3902
                                    this.cursor = new Cursor(MainWindow.CursorChange().StreamSource);
3903
                                    }
3904
                                    else
3905
                                    {
3906
                                        currentControl = new SymControlN
3907
                                        {
3908
                                            StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y),
3909
                                            Background = new SolidColorBrush(Colors.Black),
3910
                                            STAMP = App.SystemInfo.STAMP,                                            
3911
                                            ControlType = ControlType.Stamp
3912
                                        };
3913

    
3914
                                        currentControl.IsNew = true;
3915
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3916
                                        currentControl.CommentID = Commons.shortGuid();
3917
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3918
                                        //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정  
3919
                                        (currentControl as SymControlN).CommentAngle -= rotate.Angle;
3920
                                }                                    
3921
                                //}
3922
                            }
3923
                        }
3924
                        break;
3925
                    case ControlType.PenControl:
3926
                        {
3927
                            if (inkBoard.Tag.ToString() == "Ink")
3928
                            {
3929
                                inkBoard.IsEnabled = true;
3930
                                StartNewStroke(canvasDrawingMouseDownPoint);
3931
                            }
3932
                            else if (inkBoard.Tag.ToString() == "EraseByPoint")
3933
                            {
3934
                                RemovePointStroke(canvasDrawingMouseDownPoint);
3935
                            }
3936
                            else if (inkBoard.Tag.ToString() == "EraseByStroke")
3937
                            {
3938
                                RemoveLineStroke(canvasDrawingMouseDownPoint);
3939
                            }
3940
                            IsDrawing = true;
3941
                            return;
3942
                        }
3943
                    default:
3944
                        if (currentControl != null)
3945
                        {
3946
                            currentControl.CommentID = null;
3947
                            currentControl.IsNew = false;
3948
                        }
3949
                        break;
3950
                }
3951

    
3952
                if (currentControl != null)
3953
                {
3954
                    currentControl.PageAngle = pageNavigator.CurrentPage.Angle;
3955
                }
3956
            }
3957
            if (mouseHandlingMode != MouseHandlingMode.None && e.LeftButton == MouseButtonState.Pressed)
3958
            {
3959
                if (mouseHandlingMode == MouseHandlingMode.Adorner && SelectLayer.Children.Count > 0)
3960
                {
3961
                    bool mouseOff = false;
3962
                    foreach (var item in SelectLayer.Children)
3963
                    {
3964
                        if (item is AdornerFinal)
3965
                        {
3966

    
3967
                            var over = (item as AdornerFinal).Members.Where(data => data.DrawingData.IsMouseOver).FirstOrDefault();
3968
                            if (over != null)
3969
                            {
3970
                                mouseOff = true;
3971
                            }
3972
                        }
3973
                    }
3974

    
3975
                    if (!mouseOff)
3976
                    {
3977
                        SelectionSet.Instance.UnSelect(this);
3978
                    }
3979
                }
3980
                zoomAndPanControl.CaptureMouse();
3981
                e.Handled = true;
3982
            }
3983
          
3984
        }
3985

    
3986
        private void zoomAndPanControl2_MouseDown(object sender, MouseButtonEventArgs e)
3987
        {
3988
            ///mouseButtonDown = e.ChangedButton;
3989
            canvasZoommovingMouseDownPoint = e.GetPosition(zoomAndPanCanvas2);
3990
        }
3991

    
3992
        private void RemoveLineStroke(Point P)
3993
        {
3994
            var control = ViewerDataModel.Instance.MarkupControls_USER.Where(data => data.IsMouseOver).FirstOrDefault();
3995
            if (control != null)
3996
            {
3997
                DeleteCommand.Instance.Execute(new List<CommentUserInfo>() { control });
3998
            }
3999
        }
4000

    
4001
        private void RemovePointStroke(Point P)
4002
        {
4003
            foreach (Stroke hits in inkBoard.Strokes)
4004
            {
4005
                foreach (StylusPoint sty in hits.StylusPoints)
4006
                {
4007

    
4008
                }
4009
                if (hits.HitTest(P))
4010
                {
4011
                    inkBoard.Strokes.Remove(hits);
4012
                    return;
4013
                }
4014
            }
4015
        }
4016

    
4017
        private void StartNewStroke(Point P)
4018
        {
4019
            strokePoints = new StylusPointCollection();
4020
            StylusPoint segment1Start = new StylusPoint(P.X, P.Y);
4021
            strokePoints.Add(segment1Start);
4022
            stroke = new Stroke(strokePoints);
4023

    
4024
            stroke.DrawingAttributes.Color = Colors.Red;
4025
            stroke.DrawingAttributes.Width = 4;
4026
            stroke.DrawingAttributes.Height = 4;
4027

    
4028
            inkBoard.Strokes.Add(stroke);
4029
        }
4030

    
4031
        private void btnConsolidate_Click(object sender, RoutedEventArgs e)
4032
        {
4033
            ConsolidationMethod();
4034
        }
4035

    
4036
        /// <summary>
4037
        /// execute TeamConsolidationCommand
4038
        /// </summary>
4039
        public void TeamConsolidationMethod()
4040
        {
4041
            this.UpdateMyMarkupList();
4042
            if (this.gridViewMarkup.SelectedItems.Count == 0)
4043
            {
4044
                this.ParentOfType<MainWindow>().DialogMessage_Alert("Please select at least one user", "Alert");
4045
            }
4046
            else
4047
            {
4048

    
4049
                ViewerDataModel.Instance.IsConsolidate = true;
4050
                this.ParentOfType<MainWindow>().dzTopMenu._SaveEvent(null, null);
4051

    
4052
                foreach (MarkupInfoItem item in this.gridViewMarkup.SelectedItems)
4053
                {
4054
                    if (!this.userData.DEPARTMENT.Equals(item.Depatment))
4055
                    {
4056
                        this.ParentOfType<MainWindow>().DialogMessage_Alert("Please select at your department", "Alert");
4057
                        return;
4058
                    }                    
4059
                }
4060
                List<MarkupInfoItem> MarkupInfoList = new List<MarkupInfoItem>();
4061
                foreach (MarkupInfoItem item in this.gridViewMarkup.SelectedItems)
4062
                {
4063
                    MarkupInfoList.Add(item);
4064
                }
4065
                TeamConsolidateCommand.Instance.Execute(MarkupInfoList);
4066
            }
4067
        }
4068

    
4069
        public void ConsolidationMethod()
4070
        {
4071
            if (this.gridViewMarkup.SelectedItems.Count == 0)
4072
            {
4073
                this.ParentOfType<MainWindow>().DialogMessage_Alert("Please select at least one user", "Alert");
4074
            }
4075
            else
4076
            {
4077
                List<IKCOM.MarkupInfoItem> MySelectItem = new List<IKCOM.MarkupInfoItem>();
4078
                foreach (var item in this.gridViewMarkup.SelectedItems)
4079
                {
4080
                    MySelectItem.Add(item as IKCOM.MarkupInfoItem);
4081
                }
4082
                int iPageNo = Convert.ToInt32(this.ParentOfType<MainWindow>().dzTopMenu.tlcurrentPage.Text);
4083
                
4084
                ConsolidateCommand.Instance.Execute(MySelectItem, iPageNo);
4085
            }
4086
        }
4087

    
4088
        private void btnConsolidate_Loaded(object sender, RoutedEventArgs e)
4089
        {
4090
            if (App.ViewInfo != null)
4091
            {
4092
                btnConsolidate = (sender as RadRibbonButton);
4093
                if (!App.ViewInfo.NewCommentPermission)
4094
                {
4095
                    (sender as RadRibbonButton).Visibility = System.Windows.Visibility.Collapsed;
4096
                }
4097
            }
4098
        }
4099

    
4100
        private void btnTeamConsolidate_Click(object sender, RoutedEventArgs e)
4101
        {
4102
            TeamConsolidationMethod();
4103
        }
4104

    
4105
        private void btnTeamConsolidate_Loaded(object sender, RoutedEventArgs e)
4106
        {
4107
            btnTeamConsolidate = sender as RadRibbonButton;
4108
            if (App.ViewInfo != null)
4109
            {
4110
                if (!App.ViewInfo.CreateFinalPDFPermission) //파이널이 True가 아니면
4111
                {
4112
                    if (btnConsolidate != null)
4113
                    {
4114
                        btnConsolidate.Visibility = Visibility.Collapsed;
4115
                    }
4116

    
4117
                    if (!App.ViewInfo.NewCommentPermission)
4118
                    {
4119
                        btnTeamConsolidate.Visibility = Visibility.Collapsed;
4120
                    }
4121
                }
4122
                else
4123
                {
4124
                    btnTeamConsolidate.Visibility = Visibility.Collapsed;
4125
                }
4126
            }
4127
        }
4128

    
4129
        private void FinalPDFEvent(object sender, RoutedEventArgs e)
4130
        {
4131
            var item = gridViewMarkup.Items.Cast<MarkupInfoItem>().Where(d => d.Consolidate == 1 && d.AvoidConsolidate == 0).FirstOrDefault();
4132
            if(item != null)
4133
            {
4134
                if (BaseClient.FinalPDF_GetFinalPDFStatus(_DocInfo.ID, item.MarkupInfoID, _ViewInfo.UserID))
4135
                {
4136
                    Logger.sendReqLog("SetFinalPDFAsync", _ViewInfo.ProjectNO + "," + _DocInfo.ID + "," + item.MarkupInfoID + "," + _ViewInfo.UserID, 1);
4137
                    BaseClient.SetFinalPDFAsync(_ViewInfo.ProjectNO, _DocInfo.ID, item.MarkupInfoID, _ViewInfo.UserID);
4138
                }
4139
                else
4140
                {
4141
                    DialogMessage_Alert("Merged PDF가 수행중입니다", "안내");
4142
                }
4143
            }else{
4144
                //Consolidate 가 없는 경우
4145
                DialogMessage_Alert("Consolidation 된 코멘트가 존재하지 않습니다", "안내");
4146
            }
4147
            
4148
        }
4149

    
4150
        private void btnFinalPDF_Loaded(object sender, RoutedEventArgs e)
4151
        {
4152
            btnFinalPDF = sender as RadRibbonButton;
4153
            if (App.ViewInfo != null)
4154
            {
4155
                if (!App.ViewInfo.CreateFinalPDFPermission) //파이널이 True가 아니면
4156
                {
4157
                    btnFinalPDF.Visibility = System.Windows.Visibility.Collapsed;
4158
                    if (btnConsolidate != null)
4159
                    {
4160
                        btnConsolidate.Visibility = Visibility.Collapsed;
4161
                    }
4162
                }
4163
            }
4164
        }
4165

    
4166
        private void ConsolidateFinalPDFEvent(object sender, RoutedEventArgs e)
4167
        {
4168
            UpdateMyMarkupList();
4169

    
4170
            if (this.gridViewMarkup.SelectedItems.Count == 0)
4171
            {
4172
                this.ParentOfType<MainWindow>().DialogMessage_Alert("Please select at least one user", "Alert");
4173
            }
4174
            else
4175
            {
4176
                ViewerDataModel.Instance.IsConsolidate = true;
4177
                this.ParentOfType<MainWindow>().dzTopMenu._SaveEvent(null, null);
4178
                List<KCOMDataModel.DataModel.MARKUP_DATA> instanceDataSet = new List<KCOMDataModel.DataModel.MARKUP_DATA>();
4179

    
4180
                string project_no = App.ViewInfo.ProjectNO;
4181
                string doc_id = _DocInfo.ID;
4182
                string user_id = App.ViewInfo.UserID;
4183
                List<MarkupInfoItem> markupInfoItems = new List<MarkupInfoItem>();
4184
                foreach (MarkupInfoItem item in this.gridViewMarkup.SelectedItems)
4185
                {
4186
                    markupInfoItems.Add(item);
4187
                }
4188
                Logger.sendReqLog("Consolidate", project_no + "," + user_id + "," + doc_id + "," + markupInfoItems, 1);
4189
                Logger.sendResLog("Consolidate", this.BaseClient.Consolidate(project_no, user_id, doc_id, markupInfoItems).ToString(), 1);
4190
                Logger.sendReqLog("GetMarkupInfoItemsAsync", App.ViewInfo.ProjectNO + "," + _DocInfo.ID, 1);
4191
                var items = this.BaseClient.GetMarkupInfoItems(App.ViewInfo.ProjectNO, _DocInfo.ID);
4192

    
4193
                var item2 = items.Where(d => d.Consolidate == 1 && d.AvoidConsolidate == 0).FirstOrDefault();
4194
                if (item2 != null)
4195
                {
4196
                    Logger.sendReqLog("SetFinalPDFAsync", _ViewInfo.ProjectNO + "," + _DocInfo.ID + "," + item2.MarkupInfoID + "," + _ViewInfo.UserID, 1);
4197

    
4198
                    BaseClient.SetFinalPDFAsync(_ViewInfo.ProjectNO, _DocInfo.ID, item2.MarkupInfoID, _ViewInfo.UserID);
4199
                    BaseClient.GetMarkupInfoItemsAsync(App.ViewInfo.ProjectNO, _DocInfo.ID);
4200
                }
4201
                else
4202
                {
4203
                    DialogMessage_Alert("Consolidation 된 코멘트가 존재하지 않습니다", "안내");
4204
                }
4205
            }
4206
        }
4207

    
4208
        private void btnConsolidateFinalPDF_Loaded(object sender, RoutedEventArgs e)
4209
        {
4210
            btnConsolidateFinalPDF = (sender as RadRibbonButton);
4211

    
4212
            if (App.ViewInfo != null)
4213
            {
4214
                if (!App.ViewInfo.NewCommentPermission || !App.ViewInfo.CreateFinalPDFPermission)
4215
                {
4216
                    btnConsolidateFinalPDF.Visibility = System.Windows.Visibility.Collapsed;
4217
                }
4218
            }
4219
        }
4220

    
4221
        private void SyncCompare_Click(object sender, RoutedEventArgs e)
4222
        {
4223
            SetCompareRect();
4224
        }
4225

    
4226
        private void Sync_Click(object sender, RoutedEventArgs e)
4227
        {
4228
            if (Sync.IsChecked)
4229
            {
4230
                ViewerDataModel.Instance.Sync_ContentOffsetX = zoomAndPanControl.ContentOffsetX;
4231
                ViewerDataModel.Instance.Sync_ContentOffsetY = zoomAndPanControl.ContentOffsetY;
4232
                ViewerDataModel.Instance.Sync_ContentScale = zoomAndPanControl.ContentScale;
4233
            }
4234
        }
4235

    
4236
        private void SyncUserListExpender_Click(object sender, RoutedEventArgs e)
4237
        {
4238
            if (UserList.IsChecked)
4239
            {
4240
                this.gridViewRevMarkup.Visibility = Visibility.Visible;
4241
            }
4242
            else
4243
            {
4244
                this.gridViewRevMarkup.Visibility = Visibility.Collapsed;
4245
            }
4246
        }
4247

    
4248
        private void SyncPageBalance_Click(object sender, RoutedEventArgs e)
4249
        {
4250

    
4251
            if (BalanceMode.IsChecked)
4252
            {
4253
                ViewerDataModel.Instance.PageBalanceMode = true;
4254
            }
4255
            else
4256
            {
4257
                ViewerDataModel.Instance.PageBalanceMode = false;
4258
                ViewerDataModel.Instance.PageBalanceNumber = 0;
4259
            }
4260
        }
4261

    
4262
        private void SyncExit_Click(object sender, RoutedEventArgs e)
4263
        {
4264
            //초기화
4265
            testPanel2.IsHidden = true;
4266
            ViewerDataModel.Instance.PageBalanceMode = false;
4267
            ViewerDataModel.Instance.PageBalanceNumber = 0;
4268
            ViewerDataModel.Instance.PageNumber = 0;
4269
            ViewerDataModel.Instance.MarkupControls_Sync.Clear();
4270
            this.gridViewRevMarkup.Visibility = Visibility.Collapsed;
4271
            UserList.IsChecked = false;
4272
            BalanceMode.IsChecked = false;
4273
        }
4274

    
4275
        private void SyncPageChange_Click(object sender, RoutedEventArgs e)
4276
        {
4277
            if ((sender as System.Windows.Controls.Control).Tag != null)
4278
            {
4279
                //Compare 초기화
4280
                CompareMode.IsChecked = false;
4281
                var balancePoint = Convert.ToInt32((sender as System.Windows.Controls.Control).Tag);
4282

    
4283
                if (ViewerDataModel.Instance.PageNumber == 0)
4284
                {
4285
                    ViewerDataModel.Instance.PageNumber = 1;
4286
                }
4287

    
4288
                if (ViewerDataModel.Instance.PageBalanceNumber == pageNavigator.PageCount)
4289
                {
4290
                }
4291
                else
4292
                {
4293
                    ViewerDataModel.Instance.PageBalanceNumber += balancePoint;
4294
                }
4295

    
4296
                if (ViewerDataModel.Instance.PageNumber == pageNavigator.PageCount && balancePoint > 0)
4297
                {
4298

    
4299
                }
4300
                else if ((ViewerDataModel.Instance.PageNumber + balancePoint) >= 1)
4301
                {
4302
                    ViewerDataModel.Instance.PageNumber += balancePoint;
4303
                }
4304

    
4305
                if (!testPanel2.IsHidden)
4306
                {
4307
                    if (IsSyncPDFMode)
4308
                    {
4309
                        Get_FinalImage.Get_PdfImage get_PdfImage = new Get_FinalImage.Get_PdfImage();
4310
                        var pdfpath = new BitmapImage(new Uri(get_PdfImage.Run(CurrentRev.TO_VENDOR, App.ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, ViewerDataModel.Instance.PageNumber)));
4311

    
4312
                        if (pdfpath.IsDownloading)
4313
                        {
4314
                            pdfpath.DownloadCompleted += (ex, arg) =>
4315
                            {
4316
                                ViewerDataModel.Instance.ImageViewPath_C = pdfpath;
4317
                                ViewerDataModel.Instance.ImageViewWidth_C = pdfpath.PixelWidth;
4318
                                ViewerDataModel.Instance.ImageViewHeight_C = pdfpath.PixelHeight;
4319
                                zoomAndPanCanvas2.Width = pdfpath.PixelWidth;
4320
                                zoomAndPanCanvas2.Height = pdfpath.PixelHeight;
4321
                            };
4322
                        }
4323
                        else
4324
                        {
4325
                            ViewerDataModel.Instance.ImageViewPath_C = pdfpath;
4326
                            ViewerDataModel.Instance.ImageViewWidth_C = pdfpath.PixelWidth;
4327
                            ViewerDataModel.Instance.ImageViewHeight_C = pdfpath.PixelHeight;
4328

    
4329
                            zoomAndPanCanvas2.Width = pdfpath.PixelWidth;
4330
                            zoomAndPanCanvas2.Height = pdfpath.PixelHeight;
4331
                        }
4332

    
4333
                    }
4334
                    else
4335
                    {
4336
                        string uri = this.GetImageURL(_ViewInfo.ProjectNO, ViewerDataModel.Instance.PageNumber);
4337

    
4338
                        var defaultBitmapImage_Compare = new BitmapImage(new Uri(uri));
4339

    
4340
                        ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare;
4341
                        ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth;
4342
                        ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight;
4343

    
4344
                        zoomAndPanCanvas2.Width = defaultBitmapImage_Compare.PixelWidth;
4345
                        zoomAndPanCanvas2.Height = defaultBitmapImage_Compare.PixelHeight;
4346

    
4347
                        if (defaultBitmapImage_Compare.IsDownloading)
4348
                        {
4349
                            defaultBitmapImage_Compare.DownloadCompleted += (ex, arg) =>
4350
                            {
4351
                                ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare;
4352
                                ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth;
4353
                                ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight;
4354

    
4355
                                zoomAndPanCanvas2.Width = defaultBitmapImage_Compare.PixelWidth;
4356
                                zoomAndPanCanvas2.Height = defaultBitmapImage_Compare.PixelHeight;
4357
                            };
4358
                        }
4359
                    }
4360

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

    
4365
                    foreach (var item in gridSelectionRevItem)
4366
                    {
4367
                        item.MarkupList.Where(pageItem => pageItem.PageNumber == ViewerDataModel.Instance.PageNumber).ToList().ForEach(delegate (MarkupItem markupitem)
4368
                        {
4369
                            MarkupParser.ParseEx(App.ViewInfo.ProjectNO, markupitem.Data, Common.ViewerDataModel.Instance.MarkupControls_Sync, item.DisplayColor, "", item.MarkupInfoID);
4370
                        });
4371
                    }
4372

    
4373
                    //강인구 추가
4374
                    zoomAndPanControl2.ZoomTo(new Rect
4375
                    {
4376
                        X = 0,
4377
                        Y = 0,
4378
                        Width = Math.Max(zoomAndPanCanvas.Width, zoomAndPanCanvas2.Width),
4379
                        Height = Math.Max(zoomAndPanCanvas.Height, zoomAndPanCanvas2.Height),
4380
                    });
4381

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

    
4384
                }
4385
            }
4386
        }
4387

    
4388
        private void SyncChange_Click(object sender, RoutedEventArgs e)
4389
        {
4390
            if (MarkupMode.IsChecked)
4391
            {
4392
                IsSyncPDFMode = true;
4393

    
4394
                var uri = CurrentRev.TO_VENDOR;
4395

    
4396
                if (ViewerDataModel.Instance.PageNumber == 0)
4397
                {
4398
                    ViewerDataModel.Instance.PageNumber = 1;
4399
                }
4400

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

    
4405
                if (pdfpath.IsDownloading)
4406
                {
4407
                    pdfpath.DownloadCompleted += (ex, arg) =>
4408
                    {
4409
                        ViewerDataModel.Instance.ImageViewPath_C = pdfpath;
4410
                        ViewerDataModel.Instance.ImageViewWidth_C = pdfpath.PixelWidth;
4411
                        ViewerDataModel.Instance.ImageViewHeight_C = pdfpath.PixelHeight;
4412
                        zoomAndPanCanvas2.Width = pdfpath.PixelWidth;
4413
                        zoomAndPanCanvas2.Height = pdfpath.PixelHeight;
4414
                    };
4415
                }
4416
                else
4417
                {
4418
                    ViewerDataModel.Instance.ImageViewPath_C = pdfpath;
4419
                    ViewerDataModel.Instance.ImageViewWidth_C = pdfpath.PixelWidth;
4420
                    ViewerDataModel.Instance.ImageViewHeight_C = pdfpath.PixelHeight;
4421

    
4422
                    zoomAndPanCanvas2.Width = pdfpath.PixelWidth;
4423
                    zoomAndPanCanvas2.Height = pdfpath.PixelHeight;
4424
                }
4425
            }
4426
            else
4427
            {
4428
                IsSyncPDFMode = false;
4429
                string uri = this.GetImageURL(CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber);
4430

    
4431
                var defaultBitmapImage_Compare = new BitmapImage(new Uri(uri));
4432

    
4433
                ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare;
4434
                ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth;
4435
                ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight;
4436

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

    
4453
        /// <summary>
4454
        /// Compare된 영역을 초기화
4455
        /// </summary>
4456
        private void ClearCompareRect()
4457
        {
4458
            da.From = 1;
4459
            da.To = 1;
4460
            da.Duration = new Duration(TimeSpan.FromSeconds(9999));
4461
            da.AutoReverse = false;
4462
            canvas_compareBorder.Children.Clear();
4463
            canvas_compareBorder.BeginAnimation(OpacityProperty, da);
4464
        }
4465

    
4466
        /// <summary>
4467
        /// 문서 Comprare 
4468
        /// </summary>
4469
        private void SetCompareRect()
4470
        {
4471
            if (CompareMode.IsChecked)
4472
            {
4473
                if (ViewerDataModel.Instance.PageBalanceMode && ViewerDataModel.Instance.PageBalanceNumber == 0)
4474
                {
4475
                    ViewerDataModel.Instance.PageBalanceNumber = 1;
4476
                }
4477
                if (ViewerDataModel.Instance.PageNumber == 0)
4478
                {
4479
                    ViewerDataModel.Instance.PageNumber = 1;
4480
                }
4481

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

    
4486
                BaseClient.GetCompareRectAsync(_ViewInfo.ProjectNO, _ViewInfo.DocumentItemID, CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber.ToString(), ViewerDataModel.Instance.PageNumber.ToString(), userData.COMPANY != "EXT" ? "true" : "false");
4487
            }
4488
            else
4489
            {
4490
                ClearCompareRect();
4491
            }
4492
        }
4493

    
4494
        private void RadButton_Click(object sender, RoutedEventArgs e)
4495
        {
4496
            gridViewHistory_Busy.IsBusy = true;
4497

    
4498
            RadButton instance = sender as RadButton;
4499
            if (instance.CommandParameter != null)
4500
            {
4501
                CurrentRev = instance.CommandParameter as VPRevision;
4502
                System.EventHandler<ServiceDeepView.GetSyncMarkupInfoItemsCompletedEventArgs> GetSyncMarkupInfoItemshandler = null;
4503

    
4504
                GetSyncMarkupInfoItemshandler = (sen, ea) =>
4505
                {
4506
                    if (ea.Error == null && ea.Result != null)
4507
                    {
4508
                        testPanel2.IsHidden = false;
4509

    
4510
                        ViewerDataModel.Instance._markupInfoRevList.Clear();
4511
                        foreach(var info in ea.Result)
4512
                        {
4513
                            if(info.UserID == App.ViewInfo.UserID)
4514
                            {
4515
                                info.userDelete = true;
4516
                                info.DisplayColor = "FFFF0000";
4517
                            }
4518
                            else
4519
                            {
4520
                                info.userDelete = false;
4521
                            }
4522
                            ViewerDataModel.Instance._markupInfoRevList.Add(info);
4523
                        }
4524
                        gridViewRevMarkup.ItemsSource = ViewerDataModel.Instance._markupInfoRevList;
4525

    
4526
                        string uri = this.GetImageURL(CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber);
4527

    
4528
                        Sync_Offset_Point = new Point(zoomAndPanControl.ContentOffsetX, zoomAndPanControl.ContentOffsetY);
4529

    
4530
                        var defaultBitmapImage_Compare = ImageSourceHelper.GetDownloadImage(uri);
4531
                        ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare;
4532
                        ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth;
4533
                        ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight;
4534
                        zoomAndPanCanvas2.Width = defaultBitmapImage_Compare.PixelWidth;
4535
                        zoomAndPanCanvas2.Height = defaultBitmapImage_Compare.PixelHeight;
4536

    
4537
                        zoomAndPanControl2.ApplyTemplate();
4538
                        zoomAndPanControl2.UpdateLayout();
4539
                        if (Sync_Offset_Point != new Point(zoomAndPanControl.ContentOffsetX, zoomAndPanControl.ContentOffsetY))
4540
                        {
4541
                            zoomAndPanControl.ContentOffsetX = Sync_Offset_Point.X;
4542
                            zoomAndPanControl.ContentOffsetY = Sync_Offset_Point.Y;
4543
                        }
4544

    
4545
                        ViewerDataModel.Instance.Sync_ContentOffsetX = Sync_Offset_Point.X;
4546
                        ViewerDataModel.Instance.Sync_ContentOffsetY = Sync_Offset_Point.Y;
4547
                        ViewerDataModel.Instance.Sync_ContentScale = zoomAndPanControl.ContentScale;
4548

    
4549
                        tlSyncRev.Text = String.Format("Rev. {0}", CurrentRev.RevNo);
4550
                        tlSyncPageNum.Text = String.Format("Current Page : {0}", pageNavigator.CurrentPage.PageNumber);
4551
                        gridViewHistory_Busy.IsBusy = false;
4552
                    }
4553

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

    
4556
                    if (GetSyncMarkupInfoItemshandler != null)
4557
                    {
4558
                        BaseClient.GetSyncMarkupInfoItemsCompleted -= GetSyncMarkupInfoItemshandler;
4559
                    }
4560

    
4561
                    ClearCompareRect();
4562
                    SetCompareRect();
4563
                };
4564

    
4565
                /// 중복 실행이 발생하여 수정함.
4566
                BaseClient.GetSyncMarkupInfoItemsCompleted += GetSyncMarkupInfoItemshandler;
4567
                BaseClient.GetSyncMarkupInfoItemsAsync(_ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, _ViewInfo.UserID);
4568

    
4569
                Logger.sendReqLog("GetSyncMarkupInfoItemsAsync", _ViewInfo.ProjectNO + "," + CurrentRev.DOCUMENT_ID + "," + _ViewInfo.UserID, 1);
4570
            }
4571
        }
4572

    
4573
        private void EnsembleLink_Button_Click(object sender, RoutedEventArgs e)
4574
        {
4575
            try
4576
            {
4577
                if (sender is RadButton)
4578
                {
4579
                    if ((sender as RadButton).Tag != null)
4580
                    {
4581
                        var url = (sender as RadButton).Tag.ToString();
4582
                        System.Diagnostics.Process.Start(url);
4583
                    }
4584
                    else
4585
                    {
4586
                        this.ParentOfType<MainWindow>().DialogMessage_Alert("Link 정보가 잘못 되었습니다", "안내");
4587
                    }
4588
                }
4589
            }
4590
            catch (Exception ex)
4591
            {
4592
                Logger.sendResLog("EnsembleLink_Button_Click", ex.Message, 0);
4593
            }
4594
        }
4595

    
4596
        public void Sync_Event(VPRevision Currnet_Rev)
4597
        {
4598
            CurrentRev = Currnet_Rev;
4599

    
4600
            BaseClient.GetSyncMarkupInfoItemsCompleted += (sen, ea) =>
4601
            {
4602
                if (ea.Error == null && ea.Result != null)
4603
                {
4604
                    testPanel2.IsHidden = false;
4605

    
4606
                    ViewerDataModel.Instance._markupInfoRevList.Clear();
4607
                    foreach(var info in ea.Result)
4608
                    {
4609
                        if(info.UserID == App.ViewInfo.UserID)
4610
                        {
4611
                            info.userDelete = true;
4612
                            info.DisplayColor = "FFFF0000";
4613
                        }
4614
                        else
4615
                        {
4616
                            info.userDelete = false;
4617
                        }
4618
                        ViewerDataModel.Instance._markupInfoRevList.Add(info);
4619
                    }
4620
                    gridViewRevMarkup.ItemsSource = ViewerDataModel.Instance._markupInfoRevList;
4621

    
4622
                    string uri = this.GetImageURL(CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber);
4623

    
4624
                    Sync_Offset_Point = new Point(zoomAndPanControl.ContentOffsetX, zoomAndPanControl.ContentOffsetY);
4625

    
4626
                    var defaultBitmapImage_Compare = new BitmapImage(new Uri(uri));
4627

    
4628
                    ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare;
4629
                    ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth;
4630
                    ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight;
4631

    
4632
                    if (defaultBitmapImage_Compare.IsDownloading)
4633
                    {
4634
                        defaultBitmapImage_Compare.DownloadCompleted += (ex, arg) =>
4635
                        {
4636
                            ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare;
4637
                            ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth;
4638
                            ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight;
4639
                        };
4640
                    }
4641

    
4642

    
4643
                    zoomAndPanCanvas2.Width = Convert.ToDouble(Common.ViewerDataModel.Instance.ContentWidth);
4644
                    zoomAndPanCanvas2.Height = Convert.ToDouble(Common.ViewerDataModel.Instance.ContentHeight);
4645
                    zoomAndPanControl2.ApplyTemplate();
4646
                    zoomAndPanControl2.UpdateLayout();
4647

    
4648
                    if (Sync_Offset_Point != new Point(zoomAndPanControl.ContentOffsetX, zoomAndPanControl.ContentOffsetY))
4649
                    {
4650
                        zoomAndPanControl.ContentOffsetX = Sync_Offset_Point.X;
4651
                        zoomAndPanControl.ContentOffsetY = Sync_Offset_Point.Y;
4652
                    }
4653
                    //}
4654

    
4655
                    tlSyncRev.Text = String.Format("Rev. {0}", CurrentRev.RevNo);
4656
                    tlSyncPageNum.Text = String.Format("Current Page : {0}", pageNavigator.CurrentPage.PageNumber);
4657
                    gridViewHistory_Busy.IsBusy = false;
4658
                }
4659
                Logger.sendResLog("GetSyncMarkupInfoItemsCompleted", "UserState : " + ea.UserState + "\r Result :" + ea.Result + "\r Cancelled :" + ea.Cancelled + "\r Error :" + ea.Error, 1);
4660

    
4661
            };
4662
            Logger.sendReqLog("GetSyncMarkupInfoItemsAsync", _ViewInfo.ProjectNO + "," + CurrentRev.DOCUMENT_ID + "," + _ViewInfo.UserID, 1);
4663
            BaseClient.GetSyncMarkupInfoItemsAsync(_ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, _ViewInfo.UserID);
4664
        }
4665

    
4666
        private void PdfLink_ButtonDown(object sender, MouseButtonEventArgs e)
4667
        {
4668
            if (sender is Image)
4669
            {
4670
                if ((sender as Image).Tag != null)
4671
                {
4672
                    var pdfUrl = (sender as Image).Tag.ToString();
4673
                    System.Diagnostics.Process.Start(pdfUrl);
4674
                }
4675
                else
4676
                {
4677
                    this.ParentOfType<MainWindow>().DialogMessage_Alert("문서 정보가 잘못 되었습니다", "안내");
4678
                }
4679
            }
4680
        }
4681

    
4682
        private void Create_Symbol(object sender, RoutedEventArgs e)
4683
        {
4684
            MarkupToPDF.Controls.Parsing.MarkupParser.MarkupReturn markupReturn = new MarkupToPDF.Controls.Parsing.MarkupParser.MarkupReturn();
4685

    
4686
            if (SelectLayer.Children.Count < 1) //선택된 것이 없으면
4687
            {
4688
                DialogMessage_Alert("Please Select Controls", "Alert");
4689
            }
4690
            else //선택된 것이 있으면
4691
            {
4692
                string MarkupData = "";
4693
                adorner_ = new AdornerFinal();
4694

    
4695
                foreach (var item in SelectLayer.Children)
4696
                {
4697
                    if (item.GetType().Name == "AdornerFinal")
4698
                    {
4699
                        adorner_ = (item as Controls.AdornerFinal);
4700
                        foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
4701
                        {
4702
                            if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
4703
                            {
4704
                                markupReturn = MarkupParser.MarkupToString(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo, App.ViewInfo.UserID);
4705
                                MarkupData += markupReturn.ConvertData;
4706
                            }
4707
                        }
4708
                    }
4709
                }
4710
                DialogParameters parameters = new DialogParameters()
4711
                {
4712
                    Owner = Application.Current.MainWindow,
4713
                    Closed = (obj, args) => this.MarkupNamePromptClose(MarkupData, args),
4714
                    DefaultPromptResultValue = "Custom State",
4715
                    Content = "Name :",
4716
                    Header = "Insert Custom Symbol Name",
4717
                    Theme = new VisualStudio2013Theme(),
4718
                    ModalBackground = new SolidColorBrush { Color = Colors.Black, Opacity = 0.6 },
4719
                };
4720
                RadWindow.Prompt(parameters);
4721
            }
4722

    
4723
        }
4724
        public int symbolselectindex = 0;
4725
        private void SymbolMarkupNamePromptClose(byte[] Img_byte, string data, WindowClosedEventArgs args)
4726
        {
4727
            //Save save = new Save();
4728
            try
4729
            {
4730
                string svgfilename = null;
4731
                if (symbolname != null)
4732
                {
4733
                    if (symbolpng == true || symbolsvg == true)
4734
                    {
4735
                        kr.co.devdoftech.cloud.FileUpload fileUploader = new kr.co.devdoftech.cloud.FileUpload();
4736
                        string guid = Commons.shortGuid();
4737

    
4738
                        fileUploader.RunAsync(App.ViewInfo.ProjectNO, _DocItem.DOCUMENT_NO, App.ViewInfo.UserID, guid + ".png", Img_byte);
4739
                        //Check_Uri.UriCheck();
4740
                        fileUploader.RunCompleted += (ex, arg) =>
4741
                        {
4742
                            filename = arg.Result;
4743
                            if (symbolpng == true)
4744
                            {
4745
                                if (filename != null)
4746
                                { 
4747
                                    if (symbolselectindex == 0)
4748
                                    {
4749
                                        SymbolSave(symbolname, filename, data);
4750
                                    }
4751
                                    else
4752
                                    {
4753
                                        SymbolSave_Public(symbolname, filename, data, ViewerDataModel.Instance.SystemMain.dzMainMenu.userData.DEPARTMENT);
4754
                                    }
4755
                                    DataBind();
4756
                                }                                
4757
                            }
4758

    
4759
                            if (symbolsvg == true)
4760
                            {
4761
                                try
4762
                                {
4763
                                    var defaultBitmapImage = new BitmapImage();
4764
                                    defaultBitmapImage.BeginInit();
4765
                                    defaultBitmapImage.CreateOptions = BitmapCreateOptions.IgnoreImageCache;
4766
                                    defaultBitmapImage.CacheOption = BitmapCacheOption.OnLoad;
4767
                                    Check_Uri.UriCheck(filename);
4768
                                    defaultBitmapImage.UriSource = new Uri(filename);
4769
                                    defaultBitmapImage.EndInit();
4770

    
4771
                                    System.Drawing.Bitmap image;
4772

    
4773
                                    if (defaultBitmapImage.IsDownloading)
4774
                                    {
4775
                                        defaultBitmapImage.DownloadCompleted += (ex2, arg2) =>
4776
                                        {
4777
                                            defaultBitmapImage.Freeze();
4778
                                            image = GetBitmap(defaultBitmapImage);
4779
                                            image.Save(@AppDomain.CurrentDomain.BaseDirectory + "potrace.bmp", System.Drawing.Imaging.ImageFormat.Bmp);
4780
                                            Process potrace = new Process
4781
                                            {
4782
                                                StartInfo = new ProcessStartInfo
4783
                                                {
4784
                                                    FileName = @AppDomain.CurrentDomain.BaseDirectory + "potrace.exe",
4785
                                                    Arguments = "-b svg " + @AppDomain.CurrentDomain.BaseDirectory + "potrace.bmp",
4786
                                                    RedirectStandardInput = true,
4787
                                                    RedirectStandardOutput = true,
4788
                                                    RedirectStandardError = true,
4789
                                                    UseShellExecute = false,
4790
                                                    CreateNoWindow = true,
4791
                                                    WindowStyle = ProcessWindowStyle.Hidden
4792
                                                },
4793
                                            };
4794

    
4795
                                            StringBuilder svgBuilder = new StringBuilder();
4796
                                            potrace.OutputDataReceived += (object sender2, DataReceivedEventArgs e2) =>
4797
                                            {
4798
                                                svgBuilder.AppendLine(e2.Data);
4799
                                            };
4800

    
4801
                                            potrace.EnableRaisingEvents = true;
4802
                                            potrace.Start();
4803
                                            potrace.Exited += (sender, e) =>
4804
                                            {
4805
                                                byte[] bytes = System.IO.File.ReadAllBytes(@AppDomain.CurrentDomain.BaseDirectory + "potrace.svg");
4806
                                                svgfilename = fileUploader.Run(App.ViewInfo.ProjectNO, _DocItem.DOCUMENT_NO, App.ViewInfo.UserID, guid + ".svg", bytes);
4807
                                                Check_Uri.UriCheck(svgfilename);
4808
                                                if (symbolselectindex == 0)
4809
                                                {
4810
                                                    SymbolSave(symbolname, svgfilename, data);
4811
                                                }
4812
                                                else
4813
                                                {
4814
                                                    SymbolSave_Public(symbolname, svgfilename, data, ViewerDataModel.Instance.SystemMain.dzMainMenu.userData.DEPARTMENT);
4815
                                                }
4816

    
4817
                                                DataBind();
4818
                                            };
4819
                                            potrace.WaitForExit();
4820
                                        };
4821
                                    }
4822
                                    else
4823
                                    {
4824
                                        //GC.Collect();
4825
                                    }
4826
                                }
4827
                                catch(Exception ee)
4828
                                {
4829
                                    DialogMessage_Alert("" + ee, "Alert");
4830
                                }
4831
                            }
4832
                        };                                             
4833
                    }
4834
                }
4835
            }
4836
            catch (Exception e)
4837
            {
4838
                //DialogMessage_Alert(e + "", "Alert");
4839
            }            
4840
        }
4841

    
4842
        public void SymbolSave(string Name, string Url, string Data)
4843
        {
4844
            try
4845
            {
4846
                SYMBOL_PRIVATE symbol_private = new SYMBOL_PRIVATE
4847
                {
4848
                    ID = Commons.shortGuid(),
4849
                    MEMBER_USER_ID = App.ViewInfo.UserID,
4850
                    NAME = Name,
4851
                    IMAGE_URL = Url,
4852
                    DATA = Data
4853
                };
4854

    
4855
                Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.SaveSymbolCompleted += BaseClient_SaveSymbolCompleted;
4856
                Logger.sendReqLog("SaveSymbolAsync: ", symbol_private.ID + "," + symbol_private.MEMBER_USER_ID + "," + symbol_private.NAME + "," + symbol_private.IMAGE_URL + "," + symbol_private.DATA, 1);
4857
                Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.SaveSymbolAsync(symbol_private);
4858
            }
4859
            catch (Exception)
4860
            {
4861
                throw;
4862
            }
4863
        }
4864

    
4865
        public void SymbolSave_Public(string Name, string Url, string Data, string Department)
4866
        {
4867
            try
4868
            {
4869
                SYMBOL_PUBLIC symbol_public = new SYMBOL_PUBLIC
4870
                {
4871
                    ID = Commons.shortGuid(),
4872
                    DEPARTMENT = Department,
4873
                    NAME = Name,
4874
                    IMAGE_URL = Url,
4875
                    DATA = Data
4876
                };
4877
                Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.AddPublicSymbolCompleted += BaseClient_AddPublicSymbolCompleted;
4878
                Logger.sendReqLog("AddPublicSymbol: ", symbol_public.ID + "," + symbol_public.DEPARTMENT + "," + symbol_public.NAME + "," + symbol_public.IMAGE_URL + "," + symbol_public.DATA, 1);
4879
                Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.AddPublicSymbol(symbol_public);
4880
            }
4881
            catch (Exception)
4882
            {
4883
                throw;
4884
            }
4885
        }
4886

    
4887
        private void BaseClient_AddPublicSymbolCompleted(object sender, ServiceDeepView.AddPublicSymbolCompletedEventArgs e)
4888
        {           
4889
            Logger.sendResLog("AddPublicSymbolCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1);
4890
            DataBind();
4891
        }
4892

    
4893
        private void BaseClient_SaveSymbolCompleted(object sender, ServiceDeepView.SaveSymbolCompletedEventArgs e)
4894
        {
4895
            Logger.sendResLog("RenameSymbolCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1);
4896
            DataBind();
4897
        }
4898
        private void DataBind()
4899
        {
4900
            try
4901
            {
4902
                Symbol_Custom Custom = new Symbol_Custom();
4903
                List<Symbol_Custom> Custom_List = new List<Symbol_Custom>();
4904
                
4905
                var symbol_Private = BaseClient.GetSymbolList(App.ViewInfo.UserID);
4906
                foreach (var item in symbol_Private)
4907
                {
4908
                    Custom.Name = item.NAME;
4909
                    Custom.ImageUri = item.IMAGE_URL;
4910
                    Custom.ID = item.ID;
4911
                    Custom_List.Add(Custom);
4912
                    Custom = new Symbol_Custom();
4913
                }
4914
                symbolPanel_Instance.lstSymbolPrivate.ItemsSource = Custom_List;
4915
                
4916
                Custom = new Symbol_Custom();
4917
                Custom_List = new List<Symbol_Custom>();
4918

    
4919
                symbolPanel_Instance.deptlist.ItemsSource = BaseClient.GetPublicSymbolDeptList();
4920

    
4921
                List<SYMBOL_PUBLIC> symbol_Public;
4922

    
4923
                if (symbolPanel_Instance.deptlist.SelectedValue != null)
4924
                {
4925
                    symbol_Public = BaseClient.GetPublicSymbolList(symbolPanel_Instance.deptlist.SelectedValue.ToString());
4926
                }
4927
                else
4928
                {
4929
                    symbol_Public = BaseClient.GetPublicSymbolList(null);
4930
                }
4931
                foreach (var item in symbol_Public)
4932
                {
4933
                    Custom.Name = item.NAME;
4934
                    Custom.ImageUri = item.IMAGE_URL;
4935
                    Custom.ID = item.ID;
4936
                    Custom_List.Add(Custom);
4937
                    Custom = new Symbol_Custom();
4938
                }
4939
                symbolPanel_Instance.lstSymbolPublic.ItemsSource = Custom_List;
4940
                BaseClient.Close();                
4941
            }
4942
            catch(Exception e)
4943
            {
4944
                //DialogMessage_Alert("DataBind", "Alert");
4945
            }
4946
            
4947
        }
4948
        private void MarkupNamePromptClose(string data, WindowClosedEventArgs args)
4949
        {
4950
            try
4951
            {
4952
                if (args.PromptResult != null)
4953
                {
4954
                    if (args.DialogResult.Value)
4955
                    {
4956
                        PngBitmapEncoder _Encoder = symImage(data);
4957

    
4958
                        System.IO.MemoryStream fs = new System.IO.MemoryStream();
4959
                        _Encoder.Save(fs);
4960
                        System.Drawing.Image ImgOut = System.Drawing.Image.FromStream(fs);
4961

    
4962
                        byte[] Img_byte = fs.ToArray();
4963

    
4964
                        kr.co.devdoftech.cloud.FileUpload fileUploader = new kr.co.devdoftech.cloud.FileUpload();
4965
                        filename = fileUploader.Run(App.ViewInfo.ProjectNO, _DocItem.DOCUMENT_NO, App.ViewInfo.UserID, Commons.shortGuid() + ".png", Img_byte);
4966
                        Check_Uri.UriCheck(filename);
4967
                        if (symbolPanel_Instance.RadTab.SelectedIndex == 0)
4968
                        {
4969
                            SaveCommand.Instance.SymbolSave(args.PromptResult, filename, data);
4970
                        }
4971
                        else
4972
                        {
4973
                            SaveCommand.Instance.SymbolSave_Public(args.PromptResult, filename, data, ViewerDataModel.Instance.SystemMain.dzMainMenu.userData.DEPARTMENT);
4974
                        }
4975
                        DataBind();
4976
                    }
4977
                }
4978
            }
4979
            catch(Exception ex)
4980
            {
4981
                DialogMessage_Alert("" + ex, "Alert");
4982
            }
4983
        }
4984

    
4985
        public PngBitmapEncoder symImage(string data)
4986
        {
4987

    
4988
            Canvas _canvas = new Canvas();
4989
            _canvas.Background = Brushes.White;
4990
            _canvas.Width = adorner_.BorderSize.Width;
4991
            _canvas.Height = adorner_.BorderSize.Height;
4992
            MarkupParser.Parse(App.ViewInfo.ProjectNO, data, _canvas, "#FFFF0000", "");
4993

    
4994
            BitmapEncoder encoder = new PngBitmapEncoder();
4995

    
4996

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

    
4999
            DrawingVisual dv = new DrawingVisual();
5000

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

    
5004
            using (DrawingContext ctx = dv.RenderOpen())
5005
            {
5006
                VisualBrush vb = new VisualBrush(_canvas);
5007
                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)));
5008
            }
5009

    
5010
            try
5011
            {
5012
                renderBitmap.Render(dv);
5013

    
5014
                //GC.Collect();
5015
                GC.WaitForPendingFinalizers();
5016
                //GC.Collect();
5017
                // encode png data
5018
                PngBitmapEncoder pngEncoder = new PngBitmapEncoder();
5019
                // puch rendered bitmap into it
5020
                pngEncoder.Interlace = PngInterlaceOption.Off;
5021
                pngEncoder.Frames.Add(BitmapFrame.Create(renderBitmap));
5022
                return pngEncoder;
5023

    
5024
            }
5025
            catch //(Exception ex)
5026
            {
5027
                return null;
5028
            }
5029

    
5030
        }
5031

    
5032
        public void DialogMessage_Alert(string content, string header)
5033
        {
5034
            DialogParameters parameters = new DialogParameters()
5035
            {
5036
                Owner = this.ParentOfType<MainWindow>(),
5037
                Content = new TextBlock()
5038
                { 
5039
                    MinWidth = 400,
5040
                    FontSize = 11,
5041
                    Text = content,
5042
                    TextWrapping = System.Windows.TextWrapping.Wrap
5043
                },
5044
                DialogStartupLocation = WindowStartupLocation.CenterOwner,
5045
                Header = header,
5046
                Theme = new VisualStudio2013Theme(),
5047
                ModalBackground = new SolidColorBrush { Color = Colors.Black, Opacity = 0.6 },
5048
            };            
5049
            RadWindow.Alert(parameters);
5050
        }
5051

    
5052
        #region 캡쳐 기능
5053

    
5054
        public BitmapSource CutAreaToImage(int x, int y, int width, int height)
5055
        {
5056
            if (x < 0)
5057
            {
5058
                width += x;
5059
                x = 0;
5060
            }
5061
            if (y < 0)
5062
            {
5063
                height += y;
5064
                y = 0;
5065

    
5066
                width = (int)zoomAndPanCanvas.ActualWidth - x;
5067
            }
5068
            if (x + width > zoomAndPanCanvas.ActualWidth)
5069
            {
5070
                width = (int)zoomAndPanCanvas.ActualWidth - x;
5071
            }
5072
            if (y + height > zoomAndPanCanvas.ActualHeight)
5073
            {
5074
                height = (int)zoomAndPanCanvas.ActualHeight - y;
5075
            }
5076

    
5077
            byte[] pixels = CopyPixels(x, y, width, height);
5078

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

    
5081
            return BitmapSource.Create(width, height, 96, 96, PixelFormats.Pbgra32, null, pixels, stride);
5082
        }
5083

    
5084
        public byte[] CopyPixels(int x, int y, int width, int height)
5085
        {
5086
            byte[] pixels = new byte[width * height * 4];
5087
            int stride = (width * canvasImage.Format.BitsPerPixel + 7) / 8;
5088

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

    
5092
            return pixels;
5093
        }
5094

    
5095
        public RenderTargetBitmap ConverterBitmapImage(FrameworkElement element)
5096
        {
5097
            DrawingVisual drawingVisual = new DrawingVisual();
5098
            DrawingContext drawingContext = drawingVisual.RenderOpen();
5099

    
5100
            // 해당 객체의 그래픽요소로 사각형의 그림을 그립니다.
5101
            drawingContext.DrawRectangle(new VisualBrush(element), null,
5102
                new Rect(new Point(0, 0), new Point(element.ActualWidth, element.ActualHeight)));
5103
            drawingContext.Close();
5104

    
5105
            // 비트맵으로 변환합니다.
5106
            RenderTargetBitmap target =
5107
                new RenderTargetBitmap((int)element.ActualWidth, (int)element.ActualHeight,
5108
                96, 96, System.Windows.Media.PixelFormats.Pbgra32);
5109

    
5110
            target.Render(drawingVisual);
5111
            return target;
5112
        }
5113

    
5114
        System.Drawing.Bitmap GetBitmap(BitmapSource source)
5115
        {
5116
            System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(source.PixelWidth, source.PixelHeight, System.Drawing.Imaging.PixelFormat.Format32bppPArgb);
5117
            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);
5118
            source.CopyPixels(Int32Rect.Empty, data.Scan0, data.Height * data.Stride, data.Stride);
5119
            bmp.UnlockBits(data);
5120
            return bmp;
5121
        }
5122
        public string symbolname = null;
5123
        public bool symbolsvg = true;
5124
        public bool symbolpng = true;
5125

    
5126
        public void Save_Symbol_Capture(BitmapSource source, int x, int y, int width, int height)
5127
        {
5128
            System.Drawing.Bitmap image = GetBitmap(source);
5129
            //흰색 제거
5130
            //image.MakeTransparent(System.Drawing.Color.White);
5131

    
5132
            var imageStream = new System.IO.MemoryStream();
5133
            byte[] imageBytes = null;
5134
            using (imageStream)
5135
            {
5136
                image.Save(imageStream, System.Drawing.Imaging.ImageFormat.Png);
5137
                // test.Save(@"E:\test.png", System.Drawing.Imaging.ImageFormat.Png);
5138
                imageStream.Position = 0;
5139
                imageBytes = imageStream.ToArray();
5140
            }
5141

    
5142
            SymbolPrompt symbolPrompt = new SymbolPrompt();
5143

    
5144
            RadWindow CheckPop = new RadWindow();
5145
            //Alert check = new Alert(Msg);
5146

    
5147
            CheckPop = new RadWindow
5148
            {
5149
                MinWidth = 400,
5150
                MinHeight = 100,
5151
               // Closed = (obj, args) => this.SymbolMarkupNamePromptClose(imageBytes, "", args),
5152
                Header = "Alert",
5153
                Content = symbolPrompt,
5154
                //DialogResult = 
5155
                ResizeMode = System.Windows.ResizeMode.NoResize,
5156
                WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen,
5157
                IsTopmost = true,
5158
            };
5159
            CheckPop.Closed += (obj, args) => this.SymbolMarkupNamePromptClose(imageBytes, "", args);
5160
            StyleManager.SetTheme(CheckPop, new Office2013Theme());
5161
            CheckPop.ShowDialog();
5162

    
5163
            /*
5164
            DialogParameters parameters = new DialogParameters()
5165
            {
5166
                Owner = Application.Current.MainWindow,
5167
                Closed = (obj, args) => this.SymbolMarkupNamePromptClose(imageBytes, "", args),
5168
                DefaultPromptResultValue = "Custom State",
5169
                Content = "Name :",
5170
                Header = "Insert Custom Symbol Name",
5171
                Theme = new VisualStudio2013Theme(),
5172
                ModalBackground = new SolidColorBrush { Color = Colors.Black, Opacity = 0.6 },
5173
            };            
5174
            RadWindow.Prompt(parameters);
5175
            */
5176
        }
5177

    
5178
        public void Save_Capture(BitmapSource source, int x, int y, int width, int height)
5179
        {
5180
            KCOM.Common.Converter.FileStreamToBase64 streamToBase64 = new Common.Converter.FileStreamToBase64();
5181
            KCOMDataModel.DataModel.CHECK_LIST check_;
5182
            string Result = streamToBase64.ImageToBase64(source);
5183
            KCOMDataModel.DataModel.CHECK_LIST Item = new KCOMDataModel.DataModel.CHECK_LIST();
5184
            string projectno = App.ViewInfo.ProjectNO;
5185
            string checklist_id = ViewerDataModel.Instance.CheckList_ID;
5186

    
5187
            Logger.sendReqLog("GetCheckList", projectno + "," + checklist_id, 1);
5188
            Item = this.BaseClient.GetCheckList(projectno, checklist_id);
5189
            if (Item != null)
5190
            {
5191
                Logger.sendResLog("GetCheckList", "TRUE", 1);
5192
            }
5193
            else
5194
            {
5195
                Logger.sendResLog("GetCheckList", "FALSE", 1);
5196
            }
5197

    
5198
            if (Item == null)
5199
            {
5200
                check_ = new KCOMDataModel.DataModel.CHECK_LIST
5201
                {
5202
                    ID = Commons.shortGuid(),
5203
                    USER_ID = App.ViewInfo.UserID,
5204
                    IMAGE_URL = Result,
5205
                    IMAGE_ANCHOR = x + "," + y + "," + width + "," + height,
5206
                    PAGENUMBER = this.pageNavigator.CurrentPage.PageNumber,
5207
                    REVISION = ViewerDataModel.Instance.SystemMain.dzMainMenu.CurrentDoc.Revision,
5208
                    DOCUMENT_ID = App.ViewInfo.DocumentItemID,
5209
                    PROJECT_NO = App.ViewInfo.ProjectNO,
5210
                    STATUS = "False",
5211
                    CREATE_TIME = DateTime.Now,
5212
                    UPDATE_TIME = DateTime.Now,
5213
                    DOCUMENT_NO = _DocItem.DOCUMENT_NO,
5214
                    STATUS_DESC_OPEN = "Vendor 반영 필요",
5215
                };
5216
                Logger.sendReqLog("AddCheckList", projectno + "," + check_, 1);
5217
                Logger.sendResLog("AddCheckList", this.BaseClient.AddCheckList(projectno, check_).ToString(), 1);
5218
                //this.BaseClient.AddCheckList(projectno, check_);
5219
            }
5220
            else
5221
            {
5222
                Item.IMAGE_URL = Result;
5223
                Item.IMAGE_ANCHOR = x + "," + y + "," + width + "," + height;
5224
                Item.PAGENUMBER = this.pageNavigator.CurrentPage.PageNumber;
5225
                Logger.sendReqLog("SaveCheckList", projectno + "," + checklist_id + "," + Item, 1);
5226
                Logger.sendResLog("SaveCheckList", this.BaseClient.SaveCheckList(projectno, checklist_id, Item).ToString(), 1);
5227
                //this.BaseClient.SaveCheckList(projectno, checklist_id, Item);
5228
            }
5229

    
5230
        }
5231

    
5232
        public void Set_Capture()
5233
        {
5234
            double x = canvasDrawingMouseDownPoint.X;
5235
            double y = canvasDrawingMouseDownPoint.Y;
5236
            double width = dragCaptureBorder.Width;
5237
            double height = dragCaptureBorder.Height;
5238

    
5239
            if (width > 5 || height > 5)
5240
            {
5241
                canvasImage = ConverterBitmapImage(zoomAndPanCanvas);
5242
                BitmapSource source = CutAreaToImage((int)x, (int)y, (int)width, (int)height);
5243
                Save_Capture(source, (int)x, (int)y, (int)width, (int)height);
5244
            }
5245
        }
5246
        #endregion
5247

    
5248
        public Multi_Undo_data Control_Style(CommentUserInfo control)
5249
        {
5250
            multi_Undo_Data = new Multi_Undo_data();
5251

    
5252
            multi_Undo_Data.Markup = control;
5253

    
5254
            if ((control as IShapeControl) != null)
5255
            {
5256
                multi_Undo_Data.paint = (control as IShapeControl).Paint;
5257
            }
5258
            if ((control as IDashControl) != null)
5259
            {
5260
                multi_Undo_Data.DashSize = (control as IDashControl).DashSize;
5261
            }
5262
            if ((control as IPath) != null)
5263
            {
5264
                multi_Undo_Data.LineSize = (control as IPath).LineSize;
5265
            }
5266
            if ((control as UIElement) != null)
5267
            {
5268
                multi_Undo_Data.Opacity = (control as UIElement).Opacity;
5269
            }
5270

    
5271
            return multi_Undo_Data;
5272
        }
5273

    
5274
        private void Comment_Move(object sender, MouseButtonEventArgs e)
5275
        {
5276
            string Select_ID = (((e.Source as Telerik.Windows.Controls.RadButton).DataContext) as IKCOM.MarkupInfoItem).UserID;
5277
            foreach (var items in ViewerDataModel.Instance._markupInfoRevList)
5278
            {
5279
                if (items.UserID == Select_ID)
5280
                {
5281
                    foreach (var item in items.MarkupList)
5282
                    {
5283
                        if (item.PageNumber == pageNavigator.CurrentPage.PageNumber)
5284
                        {
5285
                            MarkupParser.ParseEx(App.ViewInfo.ProjectNO, item.Data, Common.ViewerDataModel.Instance.MarkupControls_USER, "#FFFF0000", "", 
5286
                                items.MarkupInfoID, Commons.shortGuid());
5287
                        }
5288
                    }
5289
                }
5290
            }
5291
        }
5292

    
5293
        /// <summary>
5294
        /// convert inkcontrol to polygoncontrol
5295
        /// </summary>
5296
        public void ConvertInkControlToPolygon()
5297
        {
5298
            if (inkBoard.Strokes.Count > 0)
5299
            {
5300
                inkBoard.Strokes.ToList().ForEach(stroke =>
5301
                {
5302
                    InkToPath ip = new InkToPath();
5303

    
5304
                    List<Point> inkPointSet = new List<Point>();
5305
                    inkPointSet.AddRange(ip.GetPointsFrom(stroke));
5306

    
5307
                    PolygonControl pc = new PolygonControl()
5308
                    {
5309
                        CommentAngle = 0,
5310
                        PointSet = inkPointSet,
5311
                        ControlType = ControlType.Ink
5312
                    };
5313
                    pc.StartPoint = inkPointSet[0];
5314
                    pc.EndPoint = inkPointSet[inkPointSet.Count - 1];
5315
                    pc.LineSize = 3;
5316
                    pc.CommentID = Commons.shortGuid();
5317
                    pc.StrokeColor = new SolidColorBrush(Colors.Red);
5318

    
5319
                    if (pc.PointSet.Count > 0)
5320
                    {
5321
                        CreateCommand.Instance.Execute(pc);
5322
                        ViewerDataModel.Instance.MarkupControls_USER.Add(pc);
5323
                    }
5324
                });
5325
                inkBoard.Strokes.Clear();
5326
            }
5327
        }
5328

    
5329
        /// <summary>
5330
        /// 캔버스에 그릴때 모든 포인트가 캔버스를 벗어 났는지 체크하여 넘겨줌
5331
        /// </summary>
5332
        /// <author>ingu</author>
5333
        /// <date>2018.06.05</date>
5334
        /// <param name="getPoint"></param>
5335
        /// <returns></returns>
5336
        private bool IsGetoutpoint(Point getPoint)
5337
        {
5338
            if (getPoint == new Point())
5339
            {
5340
                ViewerDataModel.Instance.MarkupControls_USER.Remove(currentControl);
5341
                currentControl = null;
5342
                return true;
5343
            }
5344

    
5345
            return false;
5346
        }
5347

    
5348
        private void zoomAndPanControl_DragOver(object sender, DragEventArgs e)
5349
        {
5350
            e.Effects = DragDropEffects.Copy;
5351
        }
5352

    
5353
        private void zoomAndPanControl_DragEnter(object sender, DragEventArgs e)
5354
        {
5355
            e.Effects = DragDropEffects.Copy;
5356
        }
5357

    
5358
        private void zoomAndPanControl_DragLeave(object sender, DragEventArgs e)
5359
        {
5360
            e.Effects = DragDropEffects.None;
5361
        }
5362

    
5363
        private void ZoomAndPanControl_ScaleChanged(object sender, RoutedEventArgs e)
5364
        {
5365
            var pageWidth = ViewerDataModel.Instance.ImageViewWidth;
5366
            var pageHeight = ViewerDataModel.Instance.ImageViewHeight;
5367

    
5368
            ScaleImage(pageWidth, pageHeight);
5369
        }
5370

    
5371
        /// <summary>
5372
        /// 페이지를 scale의 변화에 맞춰서 DecodePixel을 변경한다.
5373
        /// </summary>
5374
        /// <param name="pageWidth">원본 사이즈</param>
5375
        /// <param name="pageHeight">원본 사이즈</param>
5376
        /// <returns></returns>
5377
        private void ScaleImage(double pageWidth,double pageHeight)
5378
        {
5379
            //mainPanel.Scale = zoomAndPanControl.ContentScale;// (zoomAndPanControl.ContentScale >= 0.1) ? 1 : zoomAndPanControl.ContentScale;
5380
        }
5381

    
5382
        private void thumbnailPanel_SizeChanged(object sender, SizeChangedEventArgs e)
5383
        {
5384
            CommonLib.Common.WriteConfigString("SetThumbnail", "WIDTH", thumbnailPanel.Width.ToString());
5385
        }
5386

    
5387

    
5388
        /*
5389
        private void zoomAndPanControl_Drop(object sender, DragEventArgs e)
5390
        {
5391
            try
5392
            {
5393
                if (e.Data.GetDataPresent(typeof(string)))
5394
                {
5395
                    this.getCurrentPoint = e.GetPosition(drawingRotateCanvas);
5396
                    string dragData = e.Data.GetData(typeof(string)) as string;
5397
                    Move_Symbol(sender, dragData);
5398
                }
5399
            }
5400
            catch (Exception ex)
5401
            {
5402
                Logger.sendResLog("zoomAndPanControl_Drop", ex.ToString(), 0);
5403
            }            
5404
        }
5405
        */
5406
    }
5407
}
클립보드 이미지 추가 (최대 크기: 500 MB)