프로젝트

일반

사용자정보

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

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

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

1 787a4489 KangIngu

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 670a4be2 humkyung
using KCOMDataModel.DataModel;
31 d7548b21 ljiyeon
using System.Xml;
32 6707a5c7 ljiyeon
using static KCOM.TempFile;
33
using System.Windows.Threading;
34
using System.Diagnostics;
35
using System.Threading;
36 510cbd2a ljiyeon
using System.Windows.Resources;
37 53880c83 ljiyeon
using Svg2Xaml;
38
using System.Runtime.InteropServices;
39
using System.Windows.Media.Effects;
40 684ef11c ljiyeon
using MarkupToPDF.Controls.Cad;
41 036650a0 humkyung
using MarkupToPDF.Controls.Parsing;
42 fddb48f7 ljiyeon
using Telerik.Windows.Data;
43
using System.ComponentModel;
44 4eb052e4 ljiyeon
using static KCOM.Controls.Sample;
45 787a4489 KangIngu
46
namespace KCOM.Views
47
{
48
    public static class ControlExtensions
49
    {
50
        public static T Clone<T>(this T controlToClone)
51
            where T : System.Windows.Controls.Control
52
        {
53
            System.Reflection.PropertyInfo[] controlProperties = typeof(T).GetProperties(System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance);
54
55
            T instance = Activator.CreateInstance<T>();
56
57
            foreach (PropertyInfo propInfo in controlProperties)
58
            {
59
                if (propInfo.CanWrite)
60
                {
61
                    if (propInfo.Name != "WindowTarget")
62
                        propInfo.SetValue(instance, propInfo.GetValue(controlToClone, null), null);
63
                }
64
            }
65
            return instance;
66
        }
67
    }
68
69 a0bab669 KangIngu
    public class MyConsole
70
    {
71
        private readonly System.Threading.ManualResetEvent _readLineSignal;
72
        private string _lastLine;
73
        public MyConsole()
74
        {
75
            _readLineSignal = new System.Threading.ManualResetEvent(false);
76
            Gui = new TextBox();
77
            Gui.AcceptsReturn = true;
78
            Gui.KeyUp += OnKeyUp;
79
        }
80
81
        private void OnKeyUp(object sender, KeyEventArgs e)
82
        {
83
            // this is always fired on UI thread
84
            if (e.Key == Key.Enter)
85
            {
86
                // quick and dirty, but that is not relevant to your question
87
                _lastLine = Gui.Text.Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries).Last();
88
                // now, when you detected that user typed a line, set signal
89
                _readLineSignal.Set();
90
            }
91
        }
92
93
        public TextBox Gui { get; private set; }
94
95
        public string ReadLine()
96
        {
97
            // that should always be called from non-ui thread
98
            if (Gui.Dispatcher.CheckAccess())
99
                throw new Exception("Cannot be called on UI thread");
100
            // reset signal
101
            _readLineSignal.Reset();
102
            // wait until signal is set. This call is blocking, but since we are on non-ui thread - there is no problem with that
103
            _readLineSignal.WaitOne();
104
            // we got signalled - return line user typed.
105
            return _lastLine;
106
        }
107
108
        public void WriteLine(string line)
109
        {
110
            if (!Gui.Dispatcher.CheckAccess())
111
            {
112
                Gui.Dispatcher.Invoke(new Action(() => WriteLine(line)));
113
                return;
114
            }
115
116
            Gui.Text += line + Environment.NewLine;
117
        }
118
    }
119
120 787a4489 KangIngu
    /// <summary>
121
    /// MainMenu.xaml에 대한 상호 작용 논리
122
    /// </summary>
123
    public partial class MainMenu : UserControl
124
    {
125
        #region 프로퍼티
126
        public CommentUserInfo currentControl { get; set; }
127
        public ControlType controlType { get; set; }
128 e6a9ddaf humkyung
        private Move move = new Move();
129 787a4489 KangIngu
        private double[] rotateValue = { 0, 90, 180, 270 };
130
        public MouseHandlingMode mouseHandlingMode = MouseHandlingMode.None;
131
        private static readonly double DragThreshold = 5;
132 eb2b9248 KangIngu
        private System.Windows.Input.Cursor cursor { get; set; }
133 787a4489 KangIngu
        private Point canvasDrawingMouseDownPoint;
134
        public string filename { get; set; }
135
        private Point canvasZoomPanningMouseDownPoint;
136
        public Point getCurrentPoint;
137
        private Point canvasZoommovingMouseDownPoint;
138
        List<object> ControlList = new List<object>();
139
        private ListBox listBox = new ListBox();
140
        private Dictionary<Geometry, string> selected_item = new Dictionary<Geometry, string>();
141
        private bool isDraggingSelectionRect = false;
142
        DrawingAttributes inkDA = new DrawingAttributes();
143
        private VPRevision CurrentRev { get; set; }
144
        public RadRibbonButton btnConsolidate { get; set; }
145
        public RadRibbonButton btnFinalPDF { get; set; }
146
        public RadRibbonButton btnTeamConsolidate { get; set; }
147 80458c15 ljiyeon
        public RadRibbonButton btnConsolidateFinalPDF { get; set; }
148
149 787a4489 KangIngu
        public string Filename_ { get; set; }
150
        public double L_Size = 0;
151
        public AdornerFinal adorner_;
152
        public Multi_Undo_data multi_Undo_Data;
153 5ce56a3a KangIngu
        public string Symbol_ID = "";
154 787a4489 KangIngu
        /// <summary>
155
        /// Set to 'true' when the left mouse-button is down.
156
        /// </summary>
157 9f473fb7 KangIngu
        public bool isLeftMouseButtonDownOnWindow = false;
158 787a4489 KangIngu
159
        public InkPresenter _InkBoard = null;
160
        Stroke stroke;
161
        Boolean IsDrawing = false;
162
        StylusPointCollection strokePoints;
163 53880c83 ljiyeon
        //StylusPointCollection erasePoints;
164 787a4489 KangIngu
        RenderTargetBitmap canvasImage;
165
        Point Sync_Offset_Point;
166
167
        //강인구 테스트
168
        private Path _SelectionPath { get; set; }
169
        public Path SelectionPath
170
        {
171
            get
172
            {
173
                return _SelectionPath;
174
            }
175
            set
176
            {
177
                if (_SelectionPath != value)
178
                {
179
                    _SelectionPath = value;
180
                    RaisePropertyChanged("SelectionPath");
181
182
                }
183
            }
184
        }
185
186
        private System.Windows.Controls.Image _imageViewer { get; set; }
187
        public System.Windows.Controls.Image imageViewer
188
        {
189
            get
190
            {
191
                if (_imageViewer == null)
192
                {
193
                    _imageViewer = new System.Windows.Controls.Image();
194
                    return _imageViewer;
195
                }
196
                else
197
                {
198
                    return _imageViewer;
199
                }
200
            }
201
            set
202
            {
203
                if (_imageViewer != value)
204
                {
205
                    _imageViewer = value;
206
                }
207
            }
208
        }
209
210
        public bool IsSyncPDFMode { get; set; }
211
212
        private System.Windows.Controls.Image _imageViewer_Compare { get; set; }
213
        public System.Windows.Controls.Image imageViewer_Compare
214
        {
215
            get
216
            {
217
                if (_imageViewer_Compare == null)
218
                {
219
                    _imageViewer_Compare = new System.Windows.Controls.Image();
220
                    return _imageViewer_Compare;
221
                }
222
                else
223
                {
224
                    return _imageViewer_Compare;
225
                }
226
            }
227
            set
228
            {
229
                if (_imageViewer_Compare != value)
230
                {
231
                    _imageViewer_Compare = value;
232
                }
233
            }
234
        }
235
236
        #endregion
237 90e7968d ljiyeon
238 787a4489 KangIngu
        public MainMenu()
239
        {
240 29e5dc6a ljiyeon
            App.splashString(ISplashMessage.MAINMENU_0);            
241 e0204db0 djkim
            //InitializeComponent();    
242 90e7968d ljiyeon
            this.Loaded += MainMenu_Loaded;
243 787a4489 KangIngu
        }
244 6707a5c7 ljiyeon
245
        public class TempDt
246
        {
247
            public int PageNumber { get; set; }
248
            public string CommentID { get; set; }
249
            public string ConvertData { get; set; }
250
            public int DATA_TYPE { get; set; }
251
            public string MarkupInfoID { get; set; }
252
            public int IsUpdate { get; set; }
253
        }
254
255
        List<TempDt> tempDtList = new List<TempDt>();
256 90e7968d ljiyeon
257 787a4489 KangIngu
        private void SetCursor()
258
        {
259
            this.Cursor = cursor;
260
        }
261
262
        private bool IsDrawingEnable(Point _canvasZoomPanningMouseDownPoint)
263
        {
264
            if ((_canvasZoomPanningMouseDownPoint.X > 0 &&
265 ca40e004 ljiyeon
                zoomAndPanCanvas.ActualWidth > _canvasZoomPanningMouseDownPoint.X) &&
266
                (_canvasZoomPanningMouseDownPoint.Y > 0 &&
267
                zoomAndPanCanvas.ActualHeight > _canvasZoomPanningMouseDownPoint.Y))
268 787a4489 KangIngu
            {
269
                return true;
270
            }
271
272
            return false;
273
        }
274
275 ca40e004 ljiyeon
        private bool IsRotationDrawingEnable(Point _canvasZoomPanningMouseDownPoint)
276
        {
277
            if (rotate.Angle == 90 || rotate.Angle == 270)
278
            {
279
                if ((_canvasZoomPanningMouseDownPoint.X > 0 &&
280
                zoomAndPanCanvas.ActualHeight > _canvasZoomPanningMouseDownPoint.X) &&
281
                (_canvasZoomPanningMouseDownPoint.Y > 0 &&
282
                zoomAndPanCanvas.ActualWidth > _canvasZoomPanningMouseDownPoint.Y))
283
                {
284
                    return true;
285
                }
286
            }
287
            else
288
            {
289
                if ((_canvasZoomPanningMouseDownPoint.X > 0 &&
290
                zoomAndPanCanvas.ActualWidth > _canvasZoomPanningMouseDownPoint.X) &&
291
                (_canvasZoomPanningMouseDownPoint.Y > 0 &&
292
                zoomAndPanCanvas.ActualHeight > _canvasZoomPanningMouseDownPoint.Y))
293
                {
294
                    return true;
295
                }
296 90e7968d ljiyeon
            }
297 ca40e004 ljiyeon
298
            return false;
299
        }
300
301 787a4489 KangIngu
        public void DeleteItem(MarkupInfoItem item)
302
        {
303
            if (PreviewUserMarkupInfoItem != null && item.Consolidate == 1 && item.AvoidConsolidate == 0)
304
            {
305 4eb052e4 ljiyeon
                App.Custom_ViewInfoId = PreviewUserMarkupInfoItem.MarkupInfoID;           }
306 787a4489 KangIngu
307 4eb052e4 ljiyeon
            
308 787a4489 KangIngu
            ViewerDataModel.Instance._markupInfoList.Remove(item);
309
310
            ViewerDataModel.Instance.MarkupControls.Where(data => data.MarkupInfoID == item.MarkupInfoID).ToList().ForEach(a =>
311
            {
312
                ViewerDataModel.Instance.MarkupControls.Remove(a);
313
            });
314
315
            ViewerDataModel.Instance.MarkupControls_USER.Where(data => data.MarkupInfoID == item.MarkupInfoID).ToList().ForEach(a =>
316
            {
317
                ViewerDataModel.Instance.MarkupControls_USER.Remove(a);
318 39f0624f ljiyeon
                ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.MarkupListUpdate(
319 4eb052e4 ljiyeon
                null, Event_Type.Delete, a.CommentID, null);
320 787a4489 KangIngu
            });
321
322 d62c0439 humkyung
            ViewerDataModel.Instance.MyMarkupList.Where(data => data.MarkupInfoID == item.MarkupInfoID).ToList().ForEach(a =>
323 787a4489 KangIngu
            {
324 d62c0439 humkyung
                ViewerDataModel.Instance.MyMarkupList.Remove(a);
325 6707a5c7 ljiyeon
                //임시파일에서도 삭제
326 4eb052e4 ljiyeon
                TempFile.DelTemp(a.ID, this.ParentOfType<MainWindow>().dzMainMenu.pageNavigator.CurrentPage.PageNumber.ToString());                
327 787a4489 KangIngu
            });
328
329
            gridViewMarkup.ItemsSource = ViewerDataModel.Instance._markupInfoList;
330 bb3a236d ljiyeon
331 787a4489 KangIngu
            if (PreviewUserMarkupInfoItem == null && gridViewMarkup.SelectedItems.Where(d => (d as MarkupInfoItem).UserID == App.ViewInfo.UserID).FirstOrDefault() == null)
332
            {
333
                if (gridViewMarkup.Items.Cast<MarkupInfoItem>().ToList().Where(d => d.UserID == App.ViewInfo.UserID).Count() == 0)
334
                {
335 24678e06 humkyung
                    var infoId = Commons.shortGuid();
336 787a4489 KangIngu
                    PreviewUserMarkupInfoItem = new MarkupInfoItem
337
                    {
338
                        CreateTime = DateTime.Now,
339
                        Depatment = userData.DEPARTMENT,
340 992a98b4 KangIngu
                        UpdateTime = DateTime.Now,
341 787a4489 KangIngu
                        DisplayColor = "#FFFF0000",
342
                        UserID = userData.ID,
343
                        UserName = userData.NAME,
344
                        PageCount = 1,
345
                        Description = "",
346
                        MarkupInfoID = infoId,
347
                        MarkupList = null,
348 24678e06 humkyung
                        MarkupVersionID = Commons.shortGuid(),
349 787a4489 KangIngu
                        Consolidate = 0,
350
                        PartConsolidate = 0,
351
                        userDelete = true,
352
                        AvoidConsolidate = 0,
353
                        IsPreviewUser = true
354
                    };
355
                    App.Custom_ViewInfoId = infoId;
356
                }
357
            }
358 0f065e57 ljiyeon
            Logger.sendReqLog("DeleteMarkupAsync", App.ViewInfo.ProjectNO + "," + item.MarkupInfoID, 1);
359 4eb052e4 ljiyeon
            BaseClient.DeleteMarkupAsync(App.ViewInfo.ProjectNO, item.MarkupInfoID);    
360 787a4489 KangIngu
        }
361
362 959b3ef2 humkyung
        /// <summary>
363
        /// delete selected comments
364
        /// </summary>
365
        /// <param name="sender"></param>
366
        /// <param name="e"></param>
367 787a4489 KangIngu
        public void DeleteCommentEvent(object sender, RoutedEventArgs e)
368
        {
369 17202508 ljiyeon
            DialogParameters parameters = new DialogParameters()
370 c35e49f5 ljiyeon
            {
371 17202508 ljiyeon
                Owner = Application.Current.MainWindow,
372 3d4d6da9 ljiyeon
                Content = new TextBlock()
373
                { 
374
                    MinWidth = 400,
375
                    FontSize = 11,
376
                    Text = "정말 삭제 하시겠습니까?",
377
                    TextWrapping = System.Windows.TextWrapping.Wrap
378
                },
379 17202508 ljiyeon
                Header = "Confirm",
380
                Theme = new VisualStudio2013Theme(),
381
                ModalBackground = new SolidColorBrush { Color = Colors.Black, Opacity = 0.6 },
382
                OkButtonContent = "Yes",
383
                CancelButtonContent = "No",
384
                Closed = delegate (object windowSender, WindowClosedEventArgs wc)
385
                {
386
                    if(wc.DialogResult == true)
387
                    {
388
                        //선택된 어도너가 있을시 삭제가 되지 않음
389
                        SelectionSet.Instance.UnSelect(this);
390 787a4489 KangIngu
391 17202508 ljiyeon
                        Button content = (sender as Button);
392
                        MarkupInfoItem item = content.CommandParameter as MarkupInfoItem;
393 787a4489 KangIngu
394 17202508 ljiyeon
                        DeleteItem(item);
395
                    }
396
                }
397
            };
398
            RadWindow.Confirm(parameters);
399 787a4489 KangIngu
        }
400
401
        System.Windows.Media.Animation.DoubleAnimation da = new System.Windows.Media.Animation.DoubleAnimation();
402
403 6707a5c7 ljiyeon
        private static Timer timer;
404
        private int InitInterval = KCOM.Properties.Settings.Default.InitInterval;
405 787a4489 KangIngu
        private void MainMenu_Loaded(object sender, RoutedEventArgs e)
406 90e7968d ljiyeon
        {
407 29e5dc6a ljiyeon
            InitializeComponent();            
408 90e7968d ljiyeon
            //System.Diagnostics.Debug.WriteLine("MainMenu() : " + sw.ElapsedMilliseconds.ToString() + "ms");
409
410 787a4489 KangIngu
            if (App.ParameterMode)
411 6707a5c7 ljiyeon
            {
412 f7caaaaf ljiyeon
                App.splashString(ISplashMessage.MAINMENU_1);
413 6707a5c7 ljiyeon
                this.pageNavigator.PageChanging += pageNavigator_PageChanging;
414 afaa7c92 djkim
                this.pageNavigator.PageChanged += PageNavigator_PageChanged;
415 6707a5c7 ljiyeon
                imageViewer_Compare = new Image();
416
                ViewerDataModel.Instance.Capture_Opacity = 0;
417
                da.From = 0.8;
418
                da.To = 0;
419
                da.Duration = new Duration(TimeSpan.FromSeconds(1));
420
                da.AutoReverse = true;
421 e0204db0 djkim
                da.RepeatBehavior = System.Windows.Media.Animation.RepeatBehavior.Forever;
422
423
                if (!App.ViewInfo.CreateFinalPDFPermission && !App.ViewInfo.NewCommentPermission)
424 90e7968d ljiyeon
                {
425 e0204db0 djkim
                    this.SymbolPane.Visibility = Visibility.Collapsed;
426
                    this.FavoritePane.Visibility = Visibility.Collapsed;
427
                    this.drawingRotateCanvas.IsHitTestVisible = false;
428 90e7968d ljiyeon
                }
429 8411f02d ljiyeon
                thumbnailPanel.Width = Convert.ToInt32(CommonLib.Common.GetConfigString("SetThumbnail", "WIDTH", "250"));
430 6707a5c7 ljiyeon
            }
431 90e7968d ljiyeon
            timer = new Timer(timercallback, null, 0, InitInterval * 60000);
432 ccf944bb ljiyeon
        }
433
434 afaa7c92 djkim
        
435
436 6707a5c7 ljiyeon
        private void timercallback(Object o)
437 ccf944bb ljiyeon
        {
438 6707a5c7 ljiyeon
            Stopwatch sw = new Stopwatch();
439
            sw.Start();
440 3b484ebb ljiyeon
            TempFile.TempFileAdd();
441 6707a5c7 ljiyeon
            sw.Stop();
442 ccf944bb ljiyeon
443 90e7968d ljiyeon
            Dispatcher.InvokeAsync(new Action(delegate
444 ccf944bb ljiyeon
            {
445 6707a5c7 ljiyeon
               if (this.ParentOfType<MainWindow>().dzTopMenu.cbAutoSave.IsChecked == true) //Auto Save Checked?
446
                {
447
                    timer.Change(((int)this.ParentOfType<MainWindow>().dzTopMenu.cbSaveInterval.Value * 60000) / 2, sw.ElapsedMilliseconds); //Timer Setting
448
                }
449
            }));
450 ccf944bb ljiyeon
451 90e7968d ljiyeon
            ////GC.Collect();
452 6707a5c7 ljiyeon
        }
453 077896be humkyung
        
454 d62c0439 humkyung
        /// <summary>
455
        /// update my markuplist
456
        ///  - update existing markup data if already exist
457
        ///  - add new markup data if control is new
458
        /// </summary>
459
        public void UpdateMyMarkupList()
460 787a4489 KangIngu
        {
461 548c696e ljiyeon
            Logger.sendCheckLog("pageNavigator_PageChanging_ChangeCommentReact", 1);
462 787a4489 KangIngu
463 d62c0439 humkyung
            /// add or update markup list
464
            foreach (var control in ViewerDataModel.Instance.MarkupControls_USER)
465 787a4489 KangIngu
            {
466 d62c0439 humkyung
                var root = MarkupParser.MarkupToString(control, App.ViewInfo.UserID);
467 90e7968d ljiyeon
468 d62c0439 humkyung
                var exist = ViewerDataModel.Instance.MyMarkupList.Where(data => data.ID == root.CommentID).FirstOrDefault();
469
                if (exist != null) //신규 추가 된 코멘트
470
                {
471
                    if (exist.Data != root.ConvertData) //코멘트가 같은지
472 6707a5c7 ljiyeon
                    {
473 d62c0439 humkyung
                        exist.Data = root.ConvertData;
474
                        exist.IsUpdate = true;
475 6707a5c7 ljiyeon
                    }
476 d62c0439 humkyung
                }
477
                else if (root.CommentID != null)
478
                {
479
                    ViewerDataModel.Instance.MyMarkupList.Add(new MarkupItemEx
480 6707a5c7 ljiyeon
                    {
481 d62c0439 humkyung
                        ID = control.CommentID,
482
                        Data = root.ConvertData,
483
                        Data_Type = root.DATA_TYPE,
484
                        MarkupInfoID = App.Custom_ViewInfoId,
485
                        PageNumber = this.pageNavigator.CurrentPage.PageNumber,
486
                        Symbol_ID = control.SymbolID,
487 c0977e97 djkim
                        //Group_ID = control.GroupID,
488 d62c0439 humkyung
                    });
489 787a4489 KangIngu
                }
490
            }
491
492 d62c0439 humkyung
            /// delete markup list
493 129ca191 humkyung
            int iPageNo = this.pageNavigator.CurrentPage.PageNumber;
494 d62c0439 humkyung
            var deleted = (from markup in ViewerDataModel.Instance.MyMarkupList
495
                          where (markup.PageNumber == iPageNo) && (null == ViewerDataModel.Instance.MarkupControls_USER.Where(control => control.CommentID == markup.ID).FirstOrDefault())
496
                          select markup).ToList();
497
            foreach(var markup in deleted) ViewerDataModel.Instance.MyMarkupList.Remove(markup);
498
            /// up to here
499 6707a5c7 ljiyeon
500 129ca191 humkyung
            //if (modified)
501
            //{
502
            //    if (ViewerDataModel.Instance._markupInfoList.Where(info => info.UserID == PreviewUserMarkupInfoItem.UserID).FirstOrDefault() == null)
503
            //    {
504
            //        ComingNewBieEnd = true;
505
            //        ViewerDataModel.Instance._markupInfoList.Insert(0, PreviewUserMarkupInfoItem);
506
            //        PreviewUserMarkupInfoItem.IsPreviewUser = false;
507
            //        gridViewMarkup.ItemsSource = null;
508
            //        gridViewMarkup.ItemsSource = ViewerDataModel.Instance._markupInfoList;
509
            //        gridViewMarkup.SelectedItem = PreviewUserMarkupInfoItem;
510
511
            //        GroupDescriptor descriptor = new GroupDescriptor();
512
            //        descriptor.Member = "Depatment";
513
            //        descriptor.DisplayContent = "DEPT";
514
            //        descriptor.SortDirection = ListSortDirection.Ascending;
515
            //        gridViewMarkup.GroupDescriptors.Add(descriptor);
516
            //    }
517
            //}
518 787a4489 KangIngu
        }
519
520 cdfb57ff taeseongkim
        DispatcherTimer renderTesttimer;
521
522 cb5c7f06 humkyung
        /// <summary>
523
        /// start page changing
524
        ///  - save controls if page is modified
525
        ///  - starting download page image
526
        /// </summary>
527
        /// <param name="sender"></param>
528
        /// <param name="e"></param>
529 cdfb57ff taeseongkim
        private async void pageNavigator_PageChanging(object sender, Controls.Sample.PageChangeEventArgs e)
530 548c696e ljiyeon
        {
531 787a4489 KangIngu
            CompareMode.IsChecked = false;
532
            var BalancePoint = ViewerDataModel.Instance.PageBalanceMode == true ? e.PageNumber + ViewerDataModel.Instance.PageBalanceNumber : e.PageNumber;
533
534
            #region 페이지가 벗어난 경우
535
536
            if (BalancePoint < 1)
537
            {
538
                BalancePoint = 1;
539
                ViewerDataModel.Instance.PageBalanceNumber = 0;
540
            }
541
542
            if (pageNavigator.PageCount < BalancePoint)
543
            {
544
                BalancePoint = pageNavigator.PageCount;
545
                ViewerDataModel.Instance.PageBalanceNumber = 0;
546
            }
547
548
            #endregion
549
550
            ViewerDataModel.Instance.PageNumber = BalancePoint;
551
552 8614f701 taeseongkim
            var pageWidth = Convert.ToDouble(e.CurrentPage.PAGE_WIDTH);
553
            var pageHeight = Convert.ToDouble(e.CurrentPage.PAGE_HEIGHT);
554 cdfb57ff taeseongkim
            var pageUri = pageNavigator.CurrentPage.PageUri;
555
            var contentScale = zoomAndPanControl.ContentScale;
556 8614f701 taeseongkim
557 92442e4a taeseongkim
            #region 페이지 이미지 로딩 수정
558 8a9f6742 djkim
559 92442e4a taeseongkim
            // ViewerDataModel.Instance.ImageViewPath = await ImageSourceHelper.GetDownloadImageAsync(pageUri, pageWidth * contentScale, pageHeight * contentScale);
560 09b40aad taeseongkim
561
           ViewerDataModel.Instance.ImageViewPath = await ImageSourceHelper.GetDownloadImageAsync(pageUri, pageWidth, pageHeight);
562 92442e4a taeseongkim
            ScaleImage(pageWidth,pageHeight);
563 787a4489 KangIngu
564 cdfb57ff taeseongkim
            ViewerDataModel.Instance.ImageViewWidth = pageWidth;
565
            ViewerDataModel.Instance.ImageViewHeight = pageHeight;
566 787a4489 KangIngu
567 cdfb57ff taeseongkim
            zoomAndPanCanvas.Width = pageWidth;
568
            zoomAndPanCanvas.Height = pageHeight;
569 787a4489 KangIngu
570 cdfb57ff taeseongkim
            Common.ViewerDataModel.Instance.ContentWidth = pageWidth;
571
            Common.ViewerDataModel.Instance.ContentHeight = pageHeight;
572 787a4489 KangIngu
573 cdfb57ff taeseongkim
            inkBoard.Width = pageWidth;
574
            inkBoard.Height = pageHeight;
575
576
            #endregion
577 90e7968d ljiyeon
578 787a4489 KangIngu
            if (!testPanel2.IsHidden)
579
            {
580 548c696e ljiyeon
                Logger.sendCheckLog("pageNavigator_PageChanging_!testPanel2.IsHidden 일 때", 1);
581 787a4489 KangIngu
                //PDF모드일때 잠시 대기(강인구)
582
                if (IsSyncPDFMode)
583
                {
584
                    Get_FinalImage.Get_PdfImage get_PdfImage = new Get_FinalImage.Get_PdfImage();
585
                    var pdfpath = new BitmapImage(new Uri(get_PdfImage.Run(CurrentRev.TO_VENDOR, App.ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, ViewerDataModel.Instance.PageNumber)));
586
587 548c696e ljiyeon
                    Logger.sendCheckLog("pageNavigator_PageChanging_pdfpath Image Downloading", 1);
588 787a4489 KangIngu
                    if (pdfpath.IsDownloading)
589
                    {
590
                        pdfpath.DownloadCompleted += (ex, arg) =>
591
                        {
592 548c696e ljiyeon
                            Logger.sendCheckLog("pageNavigator_PageChanging_pdfpath Image DownloadCompleted", 1);
593 787a4489 KangIngu
                            ViewerDataModel.Instance.ImageViewPath_C = pdfpath;
594
                            ViewerDataModel.Instance.ImageViewWidth_C = pdfpath.PixelWidth;
595
                            ViewerDataModel.Instance.ImageViewHeight_C = pdfpath.PixelHeight;
596
                            zoomAndPanCanvas2.Width = pdfpath.PixelWidth;
597
                            zoomAndPanCanvas2.Height = pdfpath.PixelHeight;
598
                        };
599
                    }
600
                    else
601
                    {
602 548c696e ljiyeon
                        Logger.sendCheckLog("pageNavigator_PageChanging_pdfpath Image Page Setting", 1);
603 787a4489 KangIngu
                        ViewerDataModel.Instance.ImageViewPath_C = pdfpath;
604
                        ViewerDataModel.Instance.ImageViewWidth_C = pdfpath.PixelWidth;
605
                        ViewerDataModel.Instance.ImageViewHeight_C = pdfpath.PixelHeight;
606
607
                        zoomAndPanCanvas2.Width = pdfpath.PixelWidth;
608
                        zoomAndPanCanvas2.Height = pdfpath.PixelHeight;
609
                    }
610
                }
611
                else
612
                {
613 548c696e ljiyeon
                    Logger.sendCheckLog("pageNavigator_PageChanging_uri2 값 설정", 1);
614 a874198d humkyung
                    string uri2 = "";
615 a1716fa5 KangIngu
                    if (userData.COMPANY != "EXT")
616 a874198d humkyung
                    {
617 84c48033 djkim
                        uri2 = String.Format(CommonLib.Common.GetConfigString("mainServerImageWebPath", "URL", "", App.isExternal), _ViewInfo.ProjectNO, (Convert.ToUInt32(CurrentRev.DOCUMENT_ID) / 100).ToString(), CurrentRev.DOCUMENT_ID, BalancePoint);
618 a874198d humkyung
                    }
619
                    else
620
                    {
621 84c48033 djkim
                        uri2 = String.Format(CommonLib.Common.GetConfigString("subServerImageWebPath", "URL", "", App.isExternal), _ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, BalancePoint);
622 a874198d humkyung
                    }
623 a1716fa5 KangIngu
624 548c696e ljiyeon
                    Logger.sendCheckLog("pageNavigator_PageChanging_defaultBitmapImage_Compare BitmapImage 설정", 1);
625 16f1ded9 ljiyeon
                    var defaultBitmapImage_Compare = new BitmapImage();
626 bb4e3ec4 djkim
                    defaultBitmapImage_Compare.BeginInit();
627 94b7c12c djkim
                    defaultBitmapImage_Compare.CreateOptions = BitmapCreateOptions.IgnoreImageCache;
628 bb4e3ec4 djkim
                    defaultBitmapImage_Compare.CacheOption = BitmapCacheOption.OnLoad;
629
                    defaultBitmapImage_Compare.UriSource = new Uri(uri2);
630 94b7c12c djkim
                    //defaultBitmapImage_Compare.DecodePixelWidth = Int32.Parse(e.CurrentPage.PAGE_WIDTH);
631
                    //defaultBitmapImage_Compare.DecodePixelHeight = Int32.Parse(e.CurrentPage.PAGE_HEIGHT);
632 bb4e3ec4 djkim
                    defaultBitmapImage_Compare.EndInit();
633 787a4489 KangIngu
634 bb4e3ec4 djkim
                    ViewerDataModel.Instance.ImageViewPath_C = null;                    
635 787a4489 KangIngu
636 548c696e ljiyeon
                    Logger.sendCheckLog("pageNavigator_PageChanging_zoomAndPanControl ZoomTo 설정", 1);
637 787a4489 KangIngu
                    zoomAndPanControl.ZoomTo(new Rect
638
                    {
639
                        X = 0,
640
                        Y = 0,
641
                        Width = Math.Max(zoomAndPanCanvas.Width, zoomAndPanCanvas2.Width),
642
                        Height = Math.Max(zoomAndPanCanvas.Height, zoomAndPanCanvas2.Height),
643
                    });
644
645 548c696e ljiyeon
                    Logger.sendCheckLog("pageNavigator_PageChanging_defaultBitmapImage_Compare Downloading", 1);
646 787a4489 KangIngu
                    if (defaultBitmapImage_Compare.IsDownloading)
647
                    {
648
                        defaultBitmapImage_Compare.DownloadCompleted += (ex, arg) =>
649
                        {
650 bb4e3ec4 djkim
                            defaultBitmapImage_Compare.Freeze();
651 787a4489 KangIngu
                            ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare;
652
                            ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth;
653
                            ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight;
654 94b7c12c djkim
                            ComparePanel.UpdateLayout();
655 787a4489 KangIngu
                            zoomAndPanCanvas2.Width = defaultBitmapImage_Compare.PixelWidth;
656
                            zoomAndPanCanvas2.Height = defaultBitmapImage_Compare.PixelHeight;
657
658
                            zoomAndPanControl.ZoomTo(new Rect
659
                            {
660
                                X = 0,
661
                                Y = 0,
662
                                Width = Math.Max(zoomAndPanCanvas.Width, zoomAndPanCanvas2.Width),
663
                                Height = Math.Max(zoomAndPanCanvas.Height, zoomAndPanCanvas2.Height),
664
                            });
665 bb4e3ec4 djkim
666
                            //defaultBitmapImage_Compare dispose
667
                            defaultBitmapImage_Compare = null;
668
                            GC.Collect();
669 787a4489 KangIngu
                        };
670
                    }
671
                }
672
                tlSyncPageNum.Text = String.Format("Current Page : {0}", BalancePoint);
673
            }
674
675 cdfb57ff taeseongkim
            this.pageNavigator.ChangePage(e.PageNumber);
676
        }
677
678 3ffd4b2d humkyung
        /// <summary>
679
        /// called after page is changed
680
        /// </summary>
681
        /// <param name="sender"></param>
682
        /// <param name="e"></param>
683
        private void PageNavigator_PageChanged(object sender, Sample.PageChangeEventArgs e)
684
        {
685
            if (zoomAndPanCanvas2.Width.IsNaN())
686
            {
687
                zoomAndPanControl.ZoomTo(new Rect { X = 0, Y = 0, Width = zoomAndPanCanvas.Width, Height = zoomAndPanCanvas.Height });
688
            }
689
690
            /// 컨트롤을 새로 생성한다.
691
            Common.ViewerDataModel.Instance.MarkupControls_USER.Clear();    //전체 제거
692
            Common.ViewerDataModel.Instance.MarkupControls.Clear();         //전체 제거
693
            foreach (var markup in ViewerDataModel.Instance.MyMarkupList.Where(param => param.PageNumber == ViewerDataModel.Instance.PageNumber))
694
            { 
695
                var info = ViewerDataModel.Instance._markupInfoList.Where(param => param.MarkupInfoID == markup.MarkupInfoID).First();
696
                if (info != null)
697
                {
698
                    string sColor = (info.UserID == App.ViewInfo.UserID) ? "#FFFF0000" : info.DisplayColor;
699
                    if (info.UserID == App.ViewInfo.UserID)
700
                    {
701
                        var control = MarkupParser.ParseEx(App.ViewInfo.ProjectNO, markup.Data, Common.ViewerDataModel.Instance.MarkupControls_USER, sColor, "",
702
                                        markup.MarkupInfoID, markup.ID);
703
                        control.Visibility = Visibility.Hidden;
704
                    }
705
                    else
706
                    {
707
                        var control = MarkupParser.ParseEx(App.ViewInfo.ProjectNO, markup.Data, Common.ViewerDataModel.Instance.MarkupControls, sColor, "",
708
                                                                markup.MarkupInfoID, markup.ID);
709
                        control.Visibility = Visibility.Hidden;
710
                    }
711
                }
712
            };
713
            /// up to here
714
715
            /// fire selection event
716
            List<MarkupInfoItem> gridSelectionItem = gridViewMarkup.SelectedItems.Cast<MarkupInfoItem>().ToList(); //선택 된 마크업
717
            this.gridViewMarkup.UnselectAll();
718
            this.gridViewMarkup.Select(gridSelectionItem);
719
720
            if (!testPanel2.IsHidden)
721
            {
722
                ViewerDataModel.Instance.Sync_ContentOffsetX = zoomAndPanControl.ContentOffsetX;
723
                ViewerDataModel.Instance.Sync_ContentOffsetY = zoomAndPanControl.ContentOffsetY;
724
                ViewerDataModel.Instance.Sync_ContentScale = zoomAndPanControl.ContentScale;
725
726
                Common.ViewerDataModel.Instance.MarkupControls_Sync.Clear();
727
                List<MarkupInfoItem> gridSelectionRevItem = gridViewRevMarkup.SelectedItems.Cast<MarkupInfoItem>().ToList();
728
729
730
                foreach (var item in gridSelectionRevItem)
731
                {
732
                    item.MarkupList.Where(pageItem => pageItem.PageNumber == ViewerDataModel.Instance.PageNumber).ToList().ForEach(delegate (MarkupItem markupitem)
733
                    {
734
                        MarkupParser.ParseEx(App.ViewInfo.ProjectNO, markupitem.Data, Common.ViewerDataModel.Instance.MarkupControls_Sync, item.DisplayColor, "", item.MarkupInfoID);
735
                    });
736
                }
737
            }
738
739
            var instanceMain = this.ParentOfType<MainWindow>();
740
            instanceMain.dzTopMenu.tlcurrentPage.Text = e.CurrentPage.PAGE_NUMBER.ToString();
741
            instanceMain.dzTopMenu.tlcurrentPage_readonly.Text = e.CurrentPage.PAGE_NUMBER.ToString();
742
743
            instanceMain.dzTopMenu.rotateOffSet = 0;
744
            var pageinfo = this.CurrentDoc.docInfo.DOCPAGE.Where(p => p.PAGE_NUMBER == e.CurrentPage.PAGE_NUMBER).FirstOrDefault();
745
            drawingPannelRotate(pageinfo.PAGE_ANGLE);
746
747
            SetCommentPages(true);
748
        }
749
750 787a4489 KangIngu
        private void SetCommentPages(bool onlyMe = false)
751
        {
752 548c696e ljiyeon
            Logger.sendCheckLog("pageNavigator_PageChanging_SetCommentPages Setting", 1);
753 787a4489 KangIngu
            List<UsersCommentPagesMember> _pages = new List<UsersCommentPagesMember>();
754
            foreach (var item in ViewerDataModel.Instance._markupInfoList)
755
            {
756 62fa27ec djkim
                //Comment 가 존재할 경우에만 Thumbnail 에 추가
757
                if(item.MarkupList != null)
758 787a4489 KangIngu
                {
759 62fa27ec djkim
                    UsersCommentPagesMember instance = new UsersCommentPagesMember();
760
                    instance.UserName = item.UserName;
761
                    instance.Depart = item.Depatment;
762
                    instance.MarkupInfoID = item.MarkupInfoID;
763
                    instance.IsSelected = true;
764
                    instance.isConSolidation = item.Consolidate;
765
                    instance.SetColor = item.DisplayColor;
766
                    if (item.UserID == App.ViewInfo.UserID && item.MarkupInfoID == item.MarkupInfoID)
767
                    {
768
                        instance.PageNumber = ViewerDataModel.Instance.MyMarkupList.Select(d => d.PageNumber).ToList();
769
                    }
770
                    else
771
                    {
772
                        instance.PageNumber = ViewerDataModel.Instance.MarkupList_Pre.Where(data => data.MarkupInfoID == item.MarkupInfoID).Select(d => d.PageNumber).ToList();
773
                    }
774
                    _pages.Add(instance);
775
                }                
776 787a4489 KangIngu
            }
777
            this.pageNavigator.SetCommentList(_pages.ToList());
778
        }
779
780
        private void zoomAndPanControl_MouseWheel(object sender, MouseWheelEventArgs e)
781
        {
782
            if (e.MiddleButton == MouseButtonState.Pressed)
783
            {
784
785
            }
786
            e.Handled = true;
787
            if (e.Delta > 0)
788
            {
789
                Point currentContentMousePoint = e.GetPosition(zoomAndPanCanvas);
790
                ZoomIn(currentContentMousePoint);
791
            }
792
            else
793
            {
794
                Point currentContentMousePoint = e.GetPosition(zoomAndPanCanvas);
795
                ZoomOut(currentContentMousePoint);
796
            }
797
        }
798
799 a1716fa5 KangIngu
        private void zoomAndPanControl2_MouseWheel(object sender, MouseWheelEventArgs e)
800
        {
801
            e.Handled = true;
802
            if (e.Delta > 0)
803
            {
804
                Point currentContentMousePoint = e.GetPosition(zoomAndPanCanvas2);
805
                ZoomIn_Sync(currentContentMousePoint);
806
            }
807
            else
808
            {
809
                Point currentContentMousePoint = e.GetPosition(zoomAndPanCanvas2);
810
                ZoomOut_Sync(currentContentMousePoint);
811
            }
812
        }
813
814 787a4489 KangIngu
        #region ZoomIn & ZoomOut
815
816
        private void ZoomOut_Executed(object sender, ExecutedRoutedEventArgs e)
817
        {
818
            ZoomOut(new Point(zoomAndPanControl.ContentZoomFocusX,
819
                zoomAndPanControl.ContentZoomFocusY));
820
        }
821
822
        private void ZoomIn_Executed(object sender, ExecutedRoutedEventArgs e)
823
        {
824
            ZoomIn(new Point(zoomAndPanControl.ContentZoomFocusX,
825
                zoomAndPanControl.ContentZoomFocusY));
826
        }
827
828
829
        //강인구 추가 (줌 인아웃 수치 변경)
830
        //큰해상도의 문서일 경우 줌 인 아웃시 사이즈 변동이 큼
831
        private void ZoomOut(Point contentZoomCenter)
832
        {
833
            if (zoomAndPanControl.ContentScale > 0.39)
834
            {
835
                zoomAndPanControl.ZoomAboutPoint(zoomAndPanControl.ContentScale - 0.2, contentZoomCenter);
836
            }
837
            else
838
            {
839
                zoomAndPanControl.ZoomAboutPoint(zoomAndPanControl.ContentScale / 2, contentZoomCenter);
840
            }
841
842 9cd2865b KangIngu
            if (zoomAndPanControl2 != null && Sync.IsChecked)
843 787a4489 KangIngu
            {
844 9cd2865b KangIngu
                zoomAndPanControl2.ZoomAboutPoint(zoomAndPanControl.ContentScale, contentZoomCenter);
845 787a4489 KangIngu
            }
846
        }
847
848
        private void ZoomIn(Point contentZoomCenter)
849
        {
850
            if (zoomAndPanControl.ContentScale > 0.19)
851
            {
852
                zoomAndPanControl.ZoomAboutPoint(zoomAndPanControl.ContentScale + 0.2, contentZoomCenter);
853
            }
854
            else
855
            {
856
                zoomAndPanControl.ZoomAboutPoint(zoomAndPanControl.ContentScale * 2, contentZoomCenter);
857
            }
858
859 9cd2865b KangIngu
            if (zoomAndPanControl2 != null && Sync.IsChecked)
860 787a4489 KangIngu
            {
861 9cd2865b KangIngu
                zoomAndPanControl2.ZoomAboutPoint(zoomAndPanControl.ContentScale, contentZoomCenter);
862 787a4489 KangIngu
            }
863 a1716fa5 KangIngu
864
        }
865
866
        private void ZoomOut_Sync(Point contentZoomCenter)
867
        {
868
            if (zoomAndPanControl2.ContentScale > 0.39)
869
            {
870
                zoomAndPanControl2.ZoomAboutPoint(zoomAndPanControl2.ContentScale - 0.2, contentZoomCenter);
871
            }
872
            else
873
            {
874
                zoomAndPanControl2.ZoomAboutPoint(zoomAndPanControl2.ContentScale / 2, contentZoomCenter);
875
            }
876
877
            if (Sync.IsChecked)
878
            {
879
                zoomAndPanControl.ZoomAboutPoint(zoomAndPanControl2.ContentScale, contentZoomCenter);
880
            }
881
        }
882
883
        private void ZoomIn_Sync(Point contentZoomCenter)
884
        {
885
            if (zoomAndPanControl2.ContentScale > 0.19)
886
            {
887
                zoomAndPanControl2.ZoomAboutPoint(zoomAndPanControl2.ContentScale + 0.2, contentZoomCenter);
888
            }
889
            else
890
            {
891
                zoomAndPanControl2.ZoomAboutPoint(zoomAndPanControl2.ContentScale * 2, contentZoomCenter);
892
            }
893
894
            if (Sync.IsChecked)
895
            {
896
                zoomAndPanControl.ZoomAboutPoint(zoomAndPanControl2.ContentScale, contentZoomCenter);
897
            }
898 787a4489 KangIngu
        }
899
900
        private void ZoomOut()
901
        {
902
            zoomAndPanControl.ContentScale -= 0.1;
903
            //if (zoomAndPanControl2 != null)
904
            //{
905
            //    zoomAndPanControl2.ContentScale -= 0.1;
906
            //}
907
        }
908
909
        private void ZoomIn()
910
        {
911
            zoomAndPanControl.ContentScale += 0.1;
912
            //if (zoomAndPanControl2 != null)
913
            //{
914
            //    zoomAndPanControl2.ContentScale += 0.1;
915
            //}
916
        }
917
918
        #endregion
919
920
        private void init()
921
        {
922
            foreach (var item in ViewerDataModel.Instance.MarkupControls)
923
            {
924
925
                ControlList.Clear();
926
                listBox.Items.Clear();
927
                selected_item.Clear();
928
929
                (item as IMarkupCommonData).IsSelected = false;
930
            }
931
932
        }
933
934
        private HitTestResultBehavior MyCallback(HitTestResult result)
935
        {
936
            //this.cursor = Cursors.UpArrow;
937
            var element = result.VisualHit;
938
            while (element != null && !(element is CommentUserInfo))
939
                element = VisualTreeHelper.GetParent(element);
940
941
            if (element == null)
942
            {
943
                return HitTestResultBehavior.Stop;
944
            }
945
            else
946
            {
947
                if (element is CommentUserInfo)
948
                {
949
                    if (!hitList.Contains(element))
950
                    {
951
                        hitList.Add((CommentUserInfo)element);
952
                    }
953
                    else
954
                    {
955
                        return HitTestResultBehavior.Stop;
956
                    }
957
                }
958
            }
959
            return HitTestResultBehavior.Continue;
960
        }
961
962
        public void ReleaseSelectPath()
963
        {
964
            if (SelectionPath == null)
965
            {
966
                SelectionPath = new Path();
967
                SelectionPath.Name = "";
968
            }
969
            if (SelectionPath.Name != "")
970
            {
971
                SelectionPath.Name = "None";
972
            }
973
            SelectionPath.Opacity = 0.01;
974
            SelectionPath.RenderTransform = null;
975
            SelectionPath.RenderTransformOrigin = new Point(0, 0);
976
        }
977
978
        #region 컨트롤 초기화 
979
        public void Control_Init(object control)
980
        {
981
            if (L_Size != 0 && (control as IPath) != null)
982
            {
983
                (control as IPath).LineSize = L_Size;
984
                L_Size = 0;
985
            }
986
987
            switch (control.GetType().Name)
988
            {
989
                case "RectangleControl":
990
                    {
991
                        (control as RectangleControl).StrokeColor = Brushes.Red;
992
                    }
993
                    break;
994
                case "CircleControl":
995
                    {
996
                        (control as CircleControl).StrokeColor = Brushes.Red;
997
                    }
998
                    break;
999
                case "TriControl":
1000
                    {
1001
                        (control as TriControl).StrokeColor = Brushes.Red;
1002
                    }
1003
                    break;
1004
                case "RectCloudControl":
1005
                    {
1006
                        (control as RectCloudControl).StrokeColor = Brushes.Red;
1007
                    }
1008
                    break;
1009
                case "CloudControl":
1010
                    {
1011
                        (control as CloudControl).StrokeColor = Brushes.Red;
1012
                    }
1013
                    break;
1014
                case "PolygonControl":
1015
                    {
1016
                        (control as PolygonControl).StrokeColor = Brushes.Red;
1017
                    }
1018
                    break;
1019
                case "ArcControl":
1020
                    {
1021
                        (control as ArcControl).StrokeColor = Brushes.Red;
1022
                    }
1023
                    break;
1024 40b3ce25 ljiyeon
                case "ArrowArcControl":
1025
                    {
1026
                        (control as ArrowArcControl).StrokeColor = Brushes.Red;
1027
                    }
1028
                    break;
1029 787a4489 KangIngu
                case "LineControl":
1030
                    {
1031
                        (control as LineControl).StrokeColor = Brushes.Red;
1032
                    }
1033
                    break;
1034
                case "ArrowControl_Multi":
1035
                    {
1036
                        (control as ArrowControl_Multi).StrokeColor = Brushes.Red;
1037
                    }
1038
                    break;
1039
                case "TextControl":
1040
                    {
1041
                        (control as TextControl).BackInnerColor = new SolidColorBrush(Color.FromArgb(Convert.ToByte(255 * 0.6), Colors.White.R, Colors.White.G, Colors.White.B));
1042
                    }
1043
                    break;
1044
                case "ArrowTextControl":
1045
                    {
1046
                        (control as ArrowTextControl).BackInnerColor = new SolidColorBrush(Color.FromArgb(Convert.ToByte(255 * 0.6), Colors.White.R, Colors.White.G, Colors.White.B));
1047
                    }
1048
                    break;
1049 684ef11c ljiyeon
                case "InsideWhiteControl":
1050
                    {
1051
                        (control as InsideWhiteControl).StrokeColor = Brushes.White;
1052
                    }
1053
                    break;
1054
                case "OverlapWhiteControl":
1055
                    {
1056
                        (control as OverlapWhiteControl).StrokeColor = Brushes.White;
1057
                    }
1058
                    break;
1059
                case "ClipWhiteControl":
1060
                    {
1061
                        (control as ClipWhiteControl).StrokeColor = Brushes.White;
1062
                    }
1063
                    break;
1064
                case "CoordinateControl":
1065
                    {
1066
                        (control as CoordinateControl).StrokeColor = Brushes.Black;
1067
                    }
1068
                    break;
1069 787a4489 KangIngu
            }
1070
        }
1071
        #endregion
1072
1073
        public void firstCondition_MouseLeave(object sender, MouseEventArgs e)
1074
        {
1075
            //Control_Init(e.Source);
1076
        }
1077 7211e0c2 ljiyeon
        //private Window _dragdropWindow = null;
1078 53880c83 ljiyeon
1079
        [DllImport("user32.dll")]
1080
        [return: MarshalAs(UnmanagedType.Bool)]
1081
        internal static extern bool GetCursorPos(ref Win32Point pt);
1082
1083
        [StructLayout(LayoutKind.Sequential)]
1084
        internal struct Win32Point
1085
        {
1086
            public Int32 X;
1087
            public Int32 Y;
1088
        };
1089 7211e0c2 ljiyeon
        /*
1090
       public string symbol_id = null;
1091
       public long symbol_group_id;
1092
       public int symbol_SelectedIndex;
1093
       public ImageSource symbol_img;
1094
       public string symbol_Data = null;
1095
       public void symboldata(string id, long group_id, int SelectedIndex, string Data_, ImageSource img)
1096
       {
1097
           PlaceImageSymbol(symbol_id, symbol_group_id, symbol_SelectedIndex, new Point(zoomAndPanCanvas.ActualWidth / 2,
1098
               zoomAndPanCanvas.ActualHeight / 2));
1099
1100
1101
               if (this._dragdropWindow != null)
1102
               {
1103
                   this._dragdropWindow.Close();
1104
                   this._dragdropWindow = null;
1105
               }
1106
1107
               symbol_id = id;
1108
               symbol_group_id = group_id;
1109
               symbol_SelectedIndex = SelectedIndex;
1110
               symbol_Data = Data_;
1111
               symbol_img = img;
1112
1113
1114
               CreateDragDropWindow2(img);
1115
              
1116
    }
1117 53880c83 ljiyeon
1118 7211e0c2 ljiyeon
    private void CreateDragDropWindow2(ImageSource image)
1119 53880c83 ljiyeon
        {
1120
            this._dragdropWindow = new Window();
1121
            _dragdropWindow.Cursor = new Cursor(MainWindow.CursorChange().StreamSource);
1122
            _dragdropWindow.WindowStyle = WindowStyle.None;
1123
            _dragdropWindow.AllowsTransparency = true;           
1124
            _dragdropWindow.AllowDrop = false;
1125
            _dragdropWindow.Background = null;
1126
            _dragdropWindow.IsHitTestVisible = false;
1127
            _dragdropWindow.SizeToContent = SizeToContent.WidthAndHeight;
1128
            _dragdropWindow.Topmost = true;
1129
            _dragdropWindow.ShowInTaskbar = false;
1130
            
1131
            Rectangle r = new Rectangle();
1132
            r.Width = image.Width;
1133
            r.Height = image.Height;
1134
            r.Opacity = 0.5;            
1135
            r.Fill = new ImageBrush(image);
1136
            this._dragdropWindow.Content = r;
1137
1138
            Win32Point w32Mouse = new Win32Point();
1139
            GetCursorPos(ref w32Mouse);
1140
1141
            //w32Mouse.X = getCurrentPoint.X;
1142
            this._dragdropWindow.Left = w32Mouse.X - (image.Width / 2);
1143
            this._dragdropWindow.Top = w32Mouse.Y - (image.Height / 2); 
1144
            this._dragdropWindow.Show();
1145
        }
1146 7211e0c2 ljiyeon
         */
1147 787a4489 KangIngu
        private void zoomAndPanControl_MouseMove(object sender, MouseEventArgs e)
1148
        {
1149
            if (Common.ViewerDataModel.Instance.SelectedControl == "Batch")
1150
            {
1151
                if (!floatingTip.IsOpen) { floatingTip.IsOpen = true; }
1152
1153
                Point currentPos = e.GetPosition(rect);
1154 d71ee575 djkim
1155 787a4489 KangIngu
                floatingTip.HorizontalOffset = currentPos.X + 20;
1156
                floatingTip.VerticalOffset = currentPos.Y;
1157
            }
1158
1159
            getCurrentPoint = e.GetPosition(drawingRotateCanvas);
1160 a36a37c3 humkyung
            
1161 e6a9ddaf humkyung
            if ((e.MiddleButton == MouseButtonState.Pressed) || (e.RightButton == MouseButtonState.Pressed))
1162 787a4489 KangIngu
            {
1163 e54660e8 KangIngu
                SetCursor();
1164 787a4489 KangIngu
                Point currentCanvasDrawingMouseMovePoint = e.GetPosition(drawingRotateCanvas);
1165
                Point currentCanvasZoomPanningMouseMovePoint = e.GetPosition(zoomAndPanCanvas);
1166
1167
                Vector dragOffset = currentCanvasZoomPanningMouseMovePoint - canvasZoommovingMouseDownPoint;
1168
                zoomAndPanControl.ContentOffsetX -= dragOffset.X;
1169
                zoomAndPanControl.ContentOffsetY -= dragOffset.Y;
1170 9cd2865b KangIngu
1171 a1716fa5 KangIngu
                if (Sync.IsChecked)
1172 9cd2865b KangIngu
                {
1173
                    ViewerDataModel.Instance.Sync_ContentOffsetX = zoomAndPanControl.ContentOffsetX;
1174
                    ViewerDataModel.Instance.Sync_ContentOffsetY = zoomAndPanControl.ContentOffsetY;
1175
                }
1176 787a4489 KangIngu
            }
1177 992a98b4 KangIngu
1178 e6a9ddaf humkyung
            if (mouseHandlingMode == MouseHandlingMode.Drawing && currentControl != null)
1179 787a4489 KangIngu
            {
1180
                Point currentCanvasDrawingMouseMovePoint = e.GetPosition(drawingRotateCanvas);
1181
                Point currentCanvasZoomPanningMouseMovePoint = e.GetPosition(zoomAndPanCanvas);
1182
                SetCursor();
1183
1184
                if (currentControl != null)
1185
                {
1186
                    double moveX = currentCanvasDrawingMouseMovePoint.X - canvasDrawingMouseDownPoint.X;
1187
                    double moveY = currentCanvasDrawingMouseMovePoint.Y - canvasDrawingMouseDownPoint.Y;
1188
                    //강인구 추가
1189
                    currentControl.Opacity = ViewerDataModel.Instance.ControlOpacity;
1190
1191
                    if ((currentControl as IPath) != null)
1192
                    {
1193
                        (currentControl as IPath).LineSize = ViewerDataModel.Instance.LineSize;
1194
                    }
1195 5ce56a3a KangIngu
                    if ((currentControl as LineControl) != null)
1196
                    {
1197
                        (currentControl as LineControl).Interval = ViewerDataModel.Instance.Interval;
1198
                    }
1199
1200 787a4489 KangIngu
                    if ((currentControl as IShapeControl) != null)
1201
                    {
1202
                        (currentControl as IShapeControl).Paint = ViewerDataModel.Instance.paintSet;
1203
                    }
1204
                    if ((currentControl as TextControl) != null)
1205
                    {
1206
                        if (this.ParentOfType<MainWindow>().dzTopMenu.btnItalic.IsChecked == true)
1207
                        {
1208
                            (currentControl as TextControl).TextStyle = FontStyles.Italic;
1209
                        }
1210
                        if (this.ParentOfType<MainWindow>().dzTopMenu.btnBold.IsChecked == true)
1211
                        {
1212 d4b0c723 KangIngu
                            (currentControl as TextControl).TextWeight = FontWeights.Bold;
1213 787a4489 KangIngu
                        }
1214
                        if (this.ParentOfType<MainWindow>().dzTopMenu.btnUnderLine.IsChecked == true)
1215
                        {
1216
                            (currentControl as TextControl).UnderLine = TextDecorations.Underline;
1217
                        }
1218
                    }
1219
                    else if ((currentControl as ArrowTextControl) != null)
1220
                    {
1221
                        if (this.ParentOfType<MainWindow>().dzTopMenu.btnItalic.IsChecked == true)
1222
                        {
1223
                            (currentControl as ArrowTextControl).TextStyle = FontStyles.Italic;
1224
                        }
1225
                        if (this.ParentOfType<MainWindow>().dzTopMenu.btnBold.IsChecked == true)
1226
                        {
1227 d4b0c723 KangIngu
                            (currentControl as ArrowTextControl).TextWeight = FontWeights.Bold;
1228 787a4489 KangIngu
                        }
1229
                        if (this.ParentOfType<MainWindow>().dzTopMenu.btnUnderLine.IsChecked == true)
1230
                        {
1231
                            (currentControl as ArrowTextControl).UnderLine = TextDecorations.Underline;
1232
                        }
1233
                    }
1234 9f473fb7 KangIngu
                    else if ((currentControl as RectCloudControl) != null)
1235
                    {
1236
                        (currentControl as RectCloudControl).ArcLength = ViewerDataModel.Instance.ArcLength;
1237
                    }
1238
                    else if ((currentControl as CloudControl) != null)
1239
                    {
1240
                        (currentControl as CloudControl).ArcLength = ViewerDataModel.Instance.ArcLength;
1241
                    }
1242 787a4489 KangIngu
1243
                    switch (controlType)
1244
                    {
1245 684ef11c ljiyeon
                        case (ControlType.Coordinate):
1246
                            {
1247
                                var control = currentControl as CoordinateControl;
1248
                                if (control != null)
1249
                                {
1250 a6272c57 humkyung
                                    control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1251 684ef11c ljiyeon
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1252
                                    control.Paint = ViewerDataModel.Instance.paintSet;
1253
                                }
1254
                            }
1255
                            break;
1256
                        case (ControlType.InsideWhite):
1257
                            {
1258
                                var control = currentControl as InsideWhiteControl;
1259
                                if (control != null)
1260
                                {
1261 a6272c57 humkyung
                                    control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1262 684ef11c ljiyeon
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1263
                                    control.Paint = ViewerDataModel.Instance.paintSet;
1264
                                    control.Paint = PaintSet.Fill;
1265
                                }
1266
                            }
1267
                            break;
1268 a6272c57 humkyung
                        case ControlType.OverlapWhite:
1269 684ef11c ljiyeon
                            {
1270
                                var control = currentControl as OverlapWhiteControl;
1271
                                if (control != null)
1272
                                {
1273 a6272c57 humkyung
                                    control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1274 684ef11c ljiyeon
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1275
                                    control.Paint = ViewerDataModel.Instance.paintSet;
1276
                                    control.Paint = PaintSet.Fill;
1277
                                }
1278
                            }
1279
                            break;
1280 a6272c57 humkyung
                        case ControlType.ClipWhite:
1281 684ef11c ljiyeon
                            {
1282
                                var control = currentControl as ClipWhiteControl;
1283
                                if (control != null)
1284
                                {
1285 a6272c57 humkyung
                                    control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1286 684ef11c ljiyeon
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1287
                                    control.Paint = ViewerDataModel.Instance.paintSet;
1288
                                    control.Paint = PaintSet.Fill;
1289
                                }
1290
                            }
1291
                            break;
1292 787a4489 KangIngu
                        case ControlType.RectCloud:
1293
                            {
1294
                                var control = currentControl as RectCloudControl;
1295
                                if (control != null)
1296
                                {
1297 a6272c57 humkyung
                                    control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1298 787a4489 KangIngu
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1299
                                    control.Paint = ViewerDataModel.Instance.paintSet;
1300
                                }
1301
                            }
1302
                            break;
1303
                        case ControlType.SingleLine:
1304
                        case ControlType.CancelLine:
1305
                        case ControlType.ArrowLine:
1306
                        case ControlType.TwinLine:
1307
                        case ControlType.DimLine:
1308
                            {
1309 d71ee575 djkim
                                var control = currentControl as LineControl;
1310
                                if (control != null)
1311 787a4489 KangIngu
                                {
1312 a6272c57 humkyung
                                    control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1313 787a4489 KangIngu
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1314
                                }
1315
                            }
1316
                            break;
1317
1318
                        case ControlType.ArcLine:
1319
                            {
1320 d71ee575 djkim
                                var control = currentControl as ArcControl;
1321
                                if (control != null)
1322 787a4489 KangIngu
                                {
1323 a6272c57 humkyung
                                    control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1324 787a4489 KangIngu
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1325
                                }
1326
                            }
1327
                            break;
1328
1329
                        case ControlType.ArcArrow:
1330
                            {
1331 40b3ce25 ljiyeon
                                var control = currentControl as ArrowArcControl;
1332 d71ee575 djkim
                                if (control != null)
1333 787a4489 KangIngu
                                {
1334 a6272c57 humkyung
                                    control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1335 787a4489 KangIngu
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1336
                                }
1337
                            }
1338
                            break;
1339
1340
                        case ControlType.ArrowMultiLine:
1341
                            {
1342 d71ee575 djkim
                                var control = currentControl as ArrowControl_Multi;
1343
                                if (control != null)
1344 787a4489 KangIngu
                                {
1345 a6272c57 humkyung
                                    control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1346 787a4489 KangIngu
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1347
                                }
1348
                            }
1349
                            break;
1350
1351
                        case ControlType.Circle:
1352
                            {
1353 a6272c57 humkyung
                                if (currentControl != null)
1354 787a4489 KangIngu
                                {
1355 a6272c57 humkyung
                                    currentControl.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1356
                                    (currentControl as CircleControl).DashSize = ViewerDataModel.Instance.DashSize;
1357
                                    (currentControl as CircleControl).Paint = ViewerDataModel.Instance.paintSet;
1358 787a4489 KangIngu
                                }
1359
                            }
1360
                            break;
1361
1362
                        case ControlType.PolygonCloud:
1363
                            {
1364
                                var control = currentControl as CloudControl;
1365
                                if (control != null)
1366
                                {
1367 a6272c57 humkyung
                                    control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1368 787a4489 KangIngu
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1369
                                    control.Paint = ViewerDataModel.Instance.paintSet;
1370
                                }
1371
                            }
1372
                            break;
1373
1374
                        case ControlType.Triangle:
1375
                            {
1376
                                var control = currentControl as TriControl;
1377
                                if (control != null)
1378
                                {
1379 a6272c57 humkyung
                                    control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1380 787a4489 KangIngu
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1381
                                    control.Paint = ViewerDataModel.Instance.paintSet;
1382
                                }
1383
                            }
1384
                            break;
1385
1386
                        case ControlType.ImgControl:
1387
                            {
1388
                                var control = currentControl as ImgControl;
1389
                                if (control != null)
1390
                                {
1391 a6272c57 humkyung
                                    control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1392 787a4489 KangIngu
                                }
1393
                            }
1394
                            break;
1395
1396
                        case ControlType.Date:
1397
                            {
1398
                                var control = currentControl as DateControl;
1399
                                if (control != null)
1400
                                {
1401 a6272c57 humkyung
                                    control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1402 787a4489 KangIngu
                                }
1403
                            }
1404
                            break;
1405
1406
                        case ControlType.ArrowTextControl:
1407
                        case ControlType.ArrowTransTextControl:
1408
                        case ControlType.ArrowTextBorderControl:
1409
                        case ControlType.ArrowTransTextBorderControl:
1410
                        case ControlType.ArrowTextCloudControl:
1411
                        case ControlType.ArrowTransTextCloudControl:
1412
                            {
1413
                                var control = currentControl as ArrowTextControl;
1414
                                if (control != null)
1415
                                {
1416 a6272c57 humkyung
                                    control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1417 787a4489 KangIngu
                                }
1418
                            }
1419
                            break;
1420
                        case ControlType.PolygonControl:
1421 e6a9ddaf humkyung
                        case ControlType.ChainLine:
1422 787a4489 KangIngu
                            {
1423
                                var control = currentControl as PolygonControl;
1424
                                if (control != null)
1425
                                {
1426 a6272c57 humkyung
                                    control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1427 787a4489 KangIngu
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1428
                                    control.Paint = ViewerDataModel.Instance.paintSet;
1429
                                }
1430
                            }
1431
                            break;
1432
                        case ControlType.Sign:
1433
                            {
1434
                                var control = currentControl as SignControl;
1435
                                if (control != null)
1436
                                {
1437 a6272c57 humkyung
                                    control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1438 787a4489 KangIngu
                                }
1439
                            }
1440
                            break;
1441
                        case ControlType.Symbol:
1442
                            {
1443
                                var control = currentControl as SymControl;
1444
                                if (control != null)
1445
                                {
1446 a6272c57 humkyung
                                    control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1447 787a4489 KangIngu
                                }
1448
                            }
1449
                            break;
1450
                        case ControlType.Stamp:
1451
                            {
1452 cd988cd8 djkim
                                var control = currentControl as SymControlN;
1453
                                if (control != null)
1454 787a4489 KangIngu
                                {
1455 cd988cd8 djkim
                                    if (control.STAMP != null)
1456 cbaa3c91 ljiyeon
                                    {
1457
                                        control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1458
                                    }
1459 cd988cd8 djkim
                                    else
1460
                                    {
1461
                                        currentControl = null;
1462
                                        this.cursor = new Cursor(MainWindow.CursorChange().StreamSource);
1463
                                        DialogMessage_Alert("Approved Stamp 가 등록되어 있지 않습니다. \n관리자에게 문의하세요.", "안내");
1464
                                    }
1465
                                }                                    
1466 787a4489 KangIngu
                            }
1467
                            break;
1468 a6272c57 humkyung
                        case ControlType.Rectangle:
1469 787a4489 KangIngu
                        case ControlType.Mark:
1470
                            {
1471
                                var control = currentControl as RectangleControl;
1472
                                if (control != null)
1473
                                {
1474 a6272c57 humkyung
                                    control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1475
                                    if(control.ControlType == ControlType.Mark) control.Paint = PaintSet.Fill;
1476 7a5210f1 humkyung
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1477 787a4489 KangIngu
                                }
1478
                            }
1479
                            break;
1480
                        case ControlType.PenControl:
1481
                            {
1482
                                stroke.StylusPoints.Add(new StylusPoint(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y));
1483
                                //inkBoard.Strokes.Add(stroke);
1484
                            }
1485
                            break;
1486
                        default:
1487
                            break;
1488
                    }
1489
                }
1490
            }
1491 29cf2c0c humkyung
            else if(mouseHandlingMode == MouseHandlingMode.Drawing && e.LeftButton == MouseButtonState.Pressed)
1492
            {
1493
                Point currentCanvasDrawingMouseMovePoint = e.GetPosition(drawingRotateCanvas);
1494
                Point currentCanvasZoomPanningMouseMovePoint = e.GetPosition(zoomAndPanCanvas);
1495
                SetCursor();
1496
                if (currentControl == null)
1497
                {
1498
                    switch (controlType)
1499
                    {
1500
                        case ControlType.PenControl:
1501
                            {
1502
                                if (inkBoard.Tag.ToString() == "Ink")
1503
                                {
1504
                                    stroke.StylusPoints.Add(new StylusPoint(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y));
1505
                                }
1506
                                else if (inkBoard.Tag.ToString() == "EraseByPoint")
1507
                                {
1508
                                    RemovePointStroke(currentCanvasDrawingMouseMovePoint);
1509
                                }
1510
                                else if (inkBoard.Tag.ToString() == "EraseByStroke")
1511
                                {
1512
                                    RemoveLineStroke(currentCanvasDrawingMouseMovePoint);
1513
                                }
1514
1515
                                //inkBoard.Strokes.Add(stroke);
1516
                            }
1517
                            break;
1518
                    }
1519
                    return;
1520
                }
1521
            }
1522 e6a9ddaf humkyung
            else if (((e.LeftButton == MouseButtonState.Pressed) && mouseHandlingMode == MouseHandlingMode.Selecting) || 
1523
                ((e.LeftButton == MouseButtonState.Pressed) && mouseHandlingMode == MouseHandlingMode.Capture) || 
1524
                ((e.LeftButton == MouseButtonState.Pressed) && mouseHandlingMode == MouseHandlingMode.DragZoom))
1525 787a4489 KangIngu
            {
1526
                Point curMouseDownPoint = e.GetPosition(drawingRotateCanvas);
1527
1528
                if (isDraggingSelectionRect)
1529
                {
1530
                    UpdateDragSelectionRect(canvasDrawingMouseDownPoint, curMouseDownPoint);
1531
                    e.Handled = true;
1532
                }
1533
                else if (isLeftMouseButtonDownOnWindow)
1534
                {
1535
                    var dragDelta = curMouseDownPoint - canvasDrawingMouseDownPoint;
1536
                    double dragDistance = Math.Abs(dragDelta.Length);
1537
1538
                    if (dragDistance > DragThreshold)
1539
                    {
1540
                        isDraggingSelectionRect = true;
1541
                        InitDragSelectionRect(canvasDrawingMouseDownPoint, curMouseDownPoint);
1542
                    }
1543
1544
                    e.Handled = true;
1545
                }
1546
1547
                if (canvasDrawingMouseDownPoint == curMouseDownPoint)
1548
                {
1549
                }
1550
                else
1551
                {
1552
                    e.Handled = true;
1553
                }
1554
            }
1555 7211e0c2 ljiyeon
            /*
1556 e6a9ddaf humkyung
            else if ((e.LeftButton == MouseButtonState.Pressed) && mouseHandlingMode == MouseHandlingMode.DragSymbol)
1557 53880c83 ljiyeon
            { //symbol      
1558
                if(_dragdropWindow != null)
1559
                {
1560
                    Win32Point w32Mouse = new Win32Point();
1561
                    GetCursorPos(ref w32Mouse);
1562
1563
                    this._dragdropWindow.Left = w32Mouse.X - (symbol_img.Width / 2);
1564
                    this._dragdropWindow.Top = w32Mouse.Y - (symbol_img.Height / 2);
1565
                }                
1566
            }
1567 7211e0c2 ljiyeon
            */
1568 e6a9ddaf humkyung
            else if ((e.LeftButton == MouseButtonState.Released) && (e.MiddleButton == MouseButtonState.Released) && 
1569
                (e.RightButton == MouseButtonState.Released) && ViewerDataModel.Instance.MarkupControls_USER.Count > 0)
1570 787a4489 KangIngu
            {
1571 05009a0e ljiyeon
                var control = ViewerDataModel.Instance.MarkupControls_USER.Where(data => data.IsMouseOver).FirstOrDefault();
1572 e6a9ddaf humkyung
                if(control != null)
1573 787a4489 KangIngu
                {
1574
                    this.cursor = Cursors.Hand;
1575
                    SetCursor();
1576
                }
1577
                else
1578
                {
1579 510cbd2a ljiyeon
                    this.cursor = new Cursor(MainWindow.CursorChange().StreamSource);
1580 787a4489 KangIngu
                    SetCursor();
1581
                }
1582
            }
1583
            else
1584
            {
1585
            }
1586
        }
1587
1588 a1716fa5 KangIngu
        private void zoomAndPanControl2_MouseMove(object sender, MouseEventArgs e)
1589
        {
1590 e6a9ddaf humkyung
            if ((e.MiddleButton == MouseButtonState.Pressed) || (e.RightButton == MouseButtonState.Pressed))
1591 a1716fa5 KangIngu
            {
1592
                SetCursor();
1593
                Point currentCanvasDrawingMouseMovePoint = e.GetPosition(drawingRotateCanvas2);
1594
                Point currentCanvasZoomPanningMouseMovePoint = e.GetPosition(zoomAndPanCanvas2);
1595
1596
                Vector dragOffset = currentCanvasZoomPanningMouseMovePoint - canvasZoommovingMouseDownPoint;
1597
1598
                ViewerDataModel.Instance.Sync_ContentOffsetX -= dragOffset.X;
1599
                ViewerDataModel.Instance.Sync_ContentOffsetY -= dragOffset.Y;
1600
1601
                if (Sync.IsChecked)
1602
                {
1603
                    zoomAndPanControl.ContentOffsetX = ViewerDataModel.Instance.Sync_ContentOffsetX;
1604
                    zoomAndPanControl.ContentOffsetY = ViewerDataModel.Instance.Sync_ContentOffsetY;
1605
                }
1606
            }
1607
        }
1608
1609 787a4489 KangIngu
        private List<CommentUserInfo> hitList = new List<CommentUserInfo>();
1610
1611
        private EllipseGeometry hitArea = new EllipseGeometry();
1612
1613
        private void zoomAndPanControl_MouseUp(object sender, MouseButtonEventArgs e)
1614
        {
1615
            IsDrawing = false;
1616
1617
            if (mouseHandlingMode != MouseHandlingMode.None)
1618
            {
1619
                if (mouseHandlingMode == MouseHandlingMode.Drawing)
1620
                {
1621 510cbd2a ljiyeon
                    this.cursor = new Cursor(MainWindow.CursorChange().StreamSource);
1622 787a4489 KangIngu
1623
                    SetCursor();
1624
1625
                    switch (controlType)
1626
                    {
1627
                        case ControlType.None:
1628
                            break;
1629
                        case ControlType.Rectangle:
1630
                            {
1631
1632
                            }
1633
                            break;
1634
                        case ControlType.PenControl:
1635
                            {
1636
1637
                            }
1638
                            break;
1639
                        default:
1640
                            break;
1641 4eb052e4 ljiyeon
                    }                    
1642 787a4489 KangIngu
                }
1643 9f473fb7 KangIngu
                else if (mouseHandlingMode == MouseHandlingMode.Selecting && e.ChangedButton == MouseButton.Left || mouseHandlingMode == MouseHandlingMode.Capture && e.ChangedButton == MouseButton.Left || mouseHandlingMode == MouseHandlingMode.DragZoom && e.ChangedButton == MouseButton.Left)
1644 787a4489 KangIngu
                {
1645
                    if (isLeftMouseButtonDownOnWindow)
1646
                    {
1647
                        bool wasDragSelectionApplied = false;
1648
1649
                        if (isDraggingSelectionRect)
1650
                        {
1651 53880c83 ljiyeon
                            if (mouseHandlingMode == MouseHandlingMode.Capture && controlType == ControlType.ImgControl)
1652
                            {
1653
                                dragCaptureBorder.Visibility = Visibility.Collapsed;
1654
                                mouseHandlingMode = MouseHandlingMode.None;
1655
                                Point endPoint = e.GetPosition(zoomAndPanCanvas);
1656
                                symbolselectindex = symbolPanel_Instance.RadTab.SelectedIndex;
1657
                                Set_Symbol_Capture(endPoint);
1658
                                ViewerDataModel.Instance.ViewVisible = Visibility.Collapsed;
1659
                                ViewerDataModel.Instance.ViewVisible = Visibility.Visible;                                
1660
                                ViewerDataModel.Instance.Capture_Opacity = 0;
1661
                            }
1662
                            else if (mouseHandlingMode == MouseHandlingMode.Capture)
1663 787a4489 KangIngu
                            {
1664
                                dragCaptureBorder.Visibility = Visibility.Collapsed;
1665
                                mouseHandlingMode = MouseHandlingMode.None;
1666
                                Set_Capture();
1667
1668
                                ViewerDataModel.Instance.ViewVisible = Visibility.Collapsed;
1669
                                ViewerDataModel.Instance.ViewVisible = Visibility.Visible;
1670
                                ViewerDataModel.Instance.Capture_Opacity = 0;
1671
                            }
1672 9f473fb7 KangIngu
                            else if (mouseHandlingMode == MouseHandlingMode.Selecting)
1673 787a4489 KangIngu
                            {
1674
                                ApplyDragSelectionRect();
1675
                            }
1676 9f473fb7 KangIngu
                            else
1677
                            {
1678
                                double x = Canvas.GetLeft(dragZoomBorder);
1679
                                double y = Canvas.GetTop(dragZoomBorder);
1680
                                double width = dragZoomBorder.Width;
1681
                                double height = dragZoomBorder.Height;
1682
                                Rect dragRect = new Rect(x, y, width, height);
1683
1684
                                ViewerDataModel.Instance.SystemMain.dzMainMenu.zoomAndPanControl.ZoomTo(dragRect);
1685
1686
                                dragZoomBorder.Visibility = Visibility.Collapsed;
1687
                            }
1688 787a4489 KangIngu
1689 9f473fb7 KangIngu
                            isDraggingSelectionRect = false;
1690 787a4489 KangIngu
                            e.Handled = true;
1691
                            wasDragSelectionApplied = true;
1692
                        }
1693
1694
                        if (isLeftMouseButtonDownOnWindow)
1695
                        {
1696
                            isLeftMouseButtonDownOnWindow = false;
1697
                            this.ReleaseMouseCapture();
1698
                            e.Handled = true;
1699
                        }
1700
1701
                        if (!wasDragSelectionApplied)
1702
                        {
1703
                            init();
1704
                        }
1705
                    }
1706
                }
1707 e6a9ddaf humkyung
                else if (e.RightButton == MouseButtonState.Pressed)
1708 787a4489 KangIngu
                {
1709 510cbd2a ljiyeon
                    this.cursor = new Cursor(MainWindow.CursorChange().StreamSource);
1710 787a4489 KangIngu
                    SetCursor();
1711
                }
1712
1713
                zoomAndPanControl.ReleaseMouseCapture();
1714
1715
1716
                e.Handled = true;
1717
            }
1718
            else
1719
            {
1720 510cbd2a ljiyeon
                this.cursor = new Cursor(MainWindow.CursorChange().StreamSource);
1721 787a4489 KangIngu
                SetCursor();
1722
            }
1723
1724 e6a9ddaf humkyung
            ///mouseButtonDown = MouseButton.Left;
1725 787a4489 KangIngu
            //controlType = ControlType.SingleLine;
1726
        }
1727
1728 53880c83 ljiyeon
        public void Set_Symbol_Capture(Point endPoint)
1729
        {       
1730
            double x = canvasDrawingMouseDownPoint.X;
1731
            double y = canvasDrawingMouseDownPoint.Y;
1732
            if(x > endPoint.X)
1733
            {
1734
                x = endPoint.X;
1735
                y = endPoint.Y;
1736
            }
1737
1738
            double width = dragCaptureBorder.Width;
1739
            double height = dragCaptureBorder.Height;
1740
1741
            canvasImage = ConverterBitmapImage(zoomAndPanCanvas);
1742
1743
            if (x < 0)
1744
            {
1745
                width += x;
1746
                x = 0;
1747
            }
1748
            if (y < 0)
1749
            {
1750
                height += y;
1751
                y = 0;
1752
1753
                width = (int)canvasImage.PixelWidth - x;
1754
            }
1755
            if (x + width > canvasImage.PixelWidth)
1756
            {
1757
                width = (int)canvasImage.PixelWidth - x;
1758
            }
1759
            if (y + height > canvasImage.PixelHeight)
1760
            {
1761
                height = (int)canvasImage.PixelHeight - y;
1762
            }
1763
            var rect = new Int32Rect((int)x, (int)y, (int)width, (int)height);
1764
1765
            string uri = "";
1766
            if (userData.COMPANY != "EXT")
1767
            {
1768 84c48033 djkim
                uri = String.Format(CommonLib.Common.GetConfigString("mainServerImageWebPath", "URL", "", App.isExternal), _ViewInfo.ProjectNO,
1769 53880c83 ljiyeon
                    (Convert.ToInt32(_ViewInfo.DocumentItemID) / 100).ToString(), _ViewInfo.DocumentItemID, Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber);
1770
            }
1771
            else
1772
            {
1773 84c48033 djkim
                uri = String.Format(CommonLib.Common.GetConfigString("subServerImageWebPath", "URL", "", App.isExternal), _ViewInfo.ProjectNO, _ViewInfo.DocumentItemID,
1774 53880c83 ljiyeon
                    Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber);
1775
            }
1776
1777
            var defaultBitmapImage = new BitmapImage();
1778
            defaultBitmapImage.BeginInit();
1779
            defaultBitmapImage.CreateOptions = BitmapCreateOptions.IgnoreImageCache;
1780
            defaultBitmapImage.CacheOption = BitmapCacheOption.OnLoad;
1781
            defaultBitmapImage.UriSource = new Uri(uri);
1782
            defaultBitmapImage.EndInit();
1783
1784 90e7968d ljiyeon
            //GC.Collect();
1785 53880c83 ljiyeon
1786
            if (defaultBitmapImage.IsDownloading)
1787
            {
1788
                defaultBitmapImage.DownloadCompleted += (ex, arg) =>
1789
                {
1790
                    defaultBitmapImage.Freeze();
1791 90e7968d ljiyeon
                    //GC.Collect();
1792 53880c83 ljiyeon
                    BitmapSource bs = new CroppedBitmap(defaultBitmapImage, rect);
1793
                    Save_Symbol_Capture(bs, (int)x, (int)y, (int)width, (int)height);
1794
                };
1795
            }
1796
        }
1797
1798 a1716fa5 KangIngu
        private void zoomAndPanControl2_MouseUp(object sender, MouseButtonEventArgs e)
1799
        {
1800 e6a9ddaf humkyung
            ///mouseButtonDown = MouseButton.Left;
1801 a1716fa5 KangIngu
        }
1802
1803 787a4489 KangIngu
        private void zoomAndPanControl_MouseLeave(object sender, MouseEventArgs e)
1804
        {
1805 e6a9ddaf humkyung
            ///mouseButtonDown = MouseButton.Left;
1806 53880c83 ljiyeon
            //this.cursor = new Cursor(MainWindow.CursorChange().StreamSource);
1807 787a4489 KangIngu
        }
1808
1809
        private void zoomAndPanControl_MouseDoubleClick(object sender, MouseButtonEventArgs e)
1810
        {
1811
1812
        }
1813
1814 4804a4fb humkyung
        /// <summary>
1815
        /// select items by dragging
1816
        /// </summary>
1817 787a4489 KangIngu
        private void ApplyDragSelectionRect()
1818
        {
1819
            dragSelectionBorder.Visibility = Visibility.Collapsed;
1820
1821
            double x = Canvas.GetLeft(dragSelectionBorder);
1822
            double y = Canvas.GetTop(dragSelectionBorder);
1823
            double width = dragSelectionBorder.Width;
1824
            double height = dragSelectionBorder.Height;
1825
            Boolean Flag = false;
1826
            List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>();
1827 f87a00b1 ljiyeon
            var Items = ViewerDataModel.Instance.MarkupControls_USER.Where(d => d.Visibility != Visibility.Hidden).ToList();
1828 787a4489 KangIngu
1829 e6a9ddaf humkyung
            Rect dragRect = new Rect(x, y, width, height);
1830
            ///dragRect.Inflate(width / 10, height / 10);
1831 787a4489 KangIngu
1832
            foreach (var item in Items)
1833
            {
1834 91efe37a humkyung
                Flag = SelectionSet.Instance.SelectControl(item, dragRect);
1835 787a4489 KangIngu
1836
                if (Flag)
1837
                {
1838
                    adornerSet.Add(item);
1839 05009a0e ljiyeon
                    ViewerDataModel.Instance.MarkupControls_USER.Remove(item);
1840 787a4489 KangIngu
                    Control_Style(item);
1841
                }
1842
            }
1843
            if (adornerSet.Count > 0)
1844
            {
1845
                Controls.AdornerFinal final = new Controls.AdornerFinal(adornerSet);
1846
                SelectLayer.Children.Add(final);
1847
            }
1848
        }
1849
1850
        private void InitDragSelectionRect(Point pt1, Point pt2)
1851
        {
1852 9f473fb7 KangIngu
            //캡쳐 중
1853
            if (mouseHandlingMode == MouseHandlingMode.Capture)
1854
            {
1855
                dragCaptureBorder.Visibility = Visibility.Visible;
1856
            }
1857 787a4489 KangIngu
            //선택 중
1858 9f473fb7 KangIngu
            else if (mouseHandlingMode == MouseHandlingMode.Selecting)
1859 787a4489 KangIngu
            {
1860 e54660e8 KangIngu
1861 787a4489 KangIngu
                dragSelectionBorder.Visibility = Visibility.Visible;
1862
            }
1863
            else
1864
            {
1865 9f473fb7 KangIngu
                dragZoomBorder.Visibility = Visibility.Visible;
1866 787a4489 KangIngu
            }
1867
            UpdateDragSelectionRect(pt1, pt2);
1868
        }
1869
1870
        /// <summary>
1871
        /// Update the position and size of the rectangle used for drag selection.
1872
        /// </summary>
1873
        private void UpdateDragSelectionRect(Point pt1, Point pt2)
1874
        {
1875
            double x, y, width, height;
1876
1877
            //
1878
            // Determine x,y,width and height of the rect inverting the points if necessary.
1879
            // 
1880
1881
            if (pt2.X < pt1.X)
1882
            {
1883
                x = pt2.X;
1884
                width = pt1.X - pt2.X;
1885
            }
1886
            else
1887
            {
1888
                x = pt1.X;
1889
                width = pt2.X - pt1.X;
1890
            }
1891
1892
            if (pt2.Y < pt1.Y)
1893
            {
1894
                y = pt2.Y;
1895
                height = pt1.Y - pt2.Y;
1896
            }
1897
            else
1898
            {
1899
                y = pt1.Y;
1900
                height = pt2.Y - pt1.Y;
1901
            }
1902
1903
            //
1904
            // Update the coordinates of the rectangle used for drag selection.
1905
            //
1906 9f473fb7 KangIngu
            //캡쳐 중
1907
            if (mouseHandlingMode == MouseHandlingMode.Capture)
1908
            {
1909
                Canvas.SetLeft(dragCaptureBorder, x);
1910
                Canvas.SetTop(dragCaptureBorder, y);
1911
                dragCaptureBorder.Width = width;
1912
                dragCaptureBorder.Height = height;
1913
            }
1914 787a4489 KangIngu
            //선택 중
1915 a1716fa5 KangIngu
            else if (mouseHandlingMode == MouseHandlingMode.Selecting)
1916 787a4489 KangIngu
            {
1917
                Canvas.SetLeft(dragSelectionBorder, x);
1918
                Canvas.SetTop(dragSelectionBorder, y);
1919
                dragSelectionBorder.Width = width;
1920
                dragSelectionBorder.Height = height;
1921
            }
1922
            else
1923
            {
1924 9f473fb7 KangIngu
                Canvas.SetLeft(dragZoomBorder, x);
1925
                Canvas.SetTop(dragZoomBorder, y);
1926
                dragZoomBorder.Width = width;
1927
                dragZoomBorder.Height = height;
1928 787a4489 KangIngu
            }
1929
        }
1930
1931
        private void drawingPannelRotate(double angle)
1932
        {
1933 548c696e ljiyeon
            Logger.sendCheckLog("pageNavigator_PageChanging_drawingPannelRotate Setting", 1);
1934 787a4489 KangIngu
            rotate.Angle = angle;
1935
            var rotationNum = Math.Abs((rotate.Angle / 90));
1936
1937
            if (angle == 90 || angle == 270)
1938
            {
1939
                double emptySize = zoomAndPanCanvas.Width;
1940
                zoomAndPanCanvas.Width = zoomAndPanCanvas.Height;
1941
                zoomAndPanCanvas.Height = emptySize;
1942
            }
1943
            if (angle == 0)
1944
            {
1945
                translate.X = 0;
1946
                translate.Y = 0;
1947
            }
1948
            else if (angle == 90)
1949
            {
1950
                translate.X = zoomAndPanCanvas.Width;
1951
                translate.Y = 0;
1952
            }
1953
            else if (angle == 180)
1954
            {
1955
                translate.X = zoomAndPanCanvas.Width;
1956
                translate.Y = zoomAndPanCanvas.Height;
1957
            }
1958
            else
1959
            {
1960
                translate.X = 0;
1961
                translate.Y = zoomAndPanCanvas.Height;
1962
            }
1963
1964
            zoomAndPanControl.RotationAngle = rotate.Angle;
1965
1966
1967
            if (!testPanel2.IsHidden)
1968
            {
1969
                zoomAndPanControl2.RotationAngle = rotate.Angle;
1970
                zoomAndPanCanvas2.Width = zoomAndPanCanvas.Width;
1971
                zoomAndPanCanvas2.Height = zoomAndPanCanvas.Height;
1972
            }
1973
1974
            ViewerDataModel.Instance.ContentWidth = zoomAndPanCanvas.Width;
1975
            ViewerDataModel.Instance.ContentHeight = zoomAndPanCanvas.Height;
1976
            ViewerDataModel.Instance.AngleOffsetX = translate.X;
1977
            ViewerDataModel.Instance.AngleOffsetY = translate.Y;
1978
            ViewerDataModel.Instance.Angle = rotate.Angle;
1979
        }
1980
1981 497bbe52 ljiyeon
        private void syncPannelRotate(double angle)
1982
        {
1983
            //Logger.sendCheckLog("pageNavigator_PageChanging_drawingPannelRotate Setting", 1);
1984
            rotate.Angle = angle;
1985
            var rotationNum = Math.Abs((rotate.Angle / 90));
1986
1987
            if (angle == 90 || angle == 270)
1988
            {
1989
                double emptySize = zoomAndPanCanvas2.Width;
1990
                zoomAndPanCanvas2.Width = zoomAndPanCanvas2.Height;
1991
                zoomAndPanCanvas2.Height = emptySize;
1992
            }
1993
            if (angle == 0)
1994
            {
1995
                translate2.X = 0;
1996
                translate2.Y = 0;
1997
            }
1998
            else if (angle == 90)
1999
            {
2000
                translate2.X = zoomAndPanCanvas2.Width;
2001
                translate2.Y = 0;
2002
            }
2003
            else if (angle == 180)
2004
            {
2005
                translate2.X = zoomAndPanCanvas2.Width;
2006
                translate2.Y = zoomAndPanCanvas2.Height;
2007
            }
2008
            else
2009
            {
2010
                translate2.X = 0;
2011
                translate2.Y = zoomAndPanCanvas2.Height;
2012
            }
2013
2014
            zoomAndPanControl2.RotationAngle = rotate.Angle;
2015
        }
2016
2017 53880c83 ljiyeon
        public void PlaceImageSymbol(string id, long group_id, int SelectedIndex, Point canvasZoomPanningMouseDownPoint)
2018 787a4489 KangIngu
        {
2019 53880c83 ljiyeon
            string Data_ = "";
2020
2021
            try
2022
            {
2023
                Logger.sendReqLog("GetSymbolImageURL: ", id + "," + SelectedIndex, 1);
2024
                Data_ = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.GetSymbolImageURL(id, SelectedIndex);
2025
                if (Data_ != null || Data_ != "")
2026
                {
2027
                    Logger.sendResLog("GetSymbolImageURL", "TRUE", 1);
2028
                }
2029
                else
2030
                {
2031
                    Logger.sendResLog("GetSymbolImageURL", "FALSE", 1);
2032
                }
2033
2034 c0977e97 djkim
                //MARKUP_DATA_GROUP mARKUP_DATA_GROUP = new MARKUP_DATA_GROUP
2035
                //{
2036
                //    SYMBOL_ID = id,//InnerItem.Symbol_ID
2037
                //    STATE = 0,
2038
                //};
2039 53880c83 ljiyeon
                if (Data_ != null)
2040
                {
2041
                    Image img = new Image();
2042
                    //img.Source = new System.Windows.Media.Imaging.BitmapImage(new Uri(Data_));
2043
                    if (Data_.Contains(".svg"))
2044
                    {
2045
                        byte[] imageData = null;
2046
                        DrawingImage image = null;
2047
                        using (System.Net.WebClient web = new System.Net.WebClient())
2048
                        {
2049
                            imageData = web.DownloadData(new Uri(Data_));
2050
                            System.IO.Stream stream = new System.IO.MemoryStream(imageData);
2051
                            image = SvgReader.Load(stream);
2052
                        }
2053
                        img.Source = image;
2054
                    }
2055
                    else
2056
                    {
2057
                        img.Source = new BitmapImage(new Uri(Data_));
2058
                    }
2059
2060
                    var currentControl = new MarkupToPDF.Controls.Etc.ImgControl
2061
                    {
2062
                        PointSet = new List<Point>(),
2063
                        FilePath = Data_,
2064
                        ImageData = img.Source,
2065
                        StartPoint = canvasZoomPanningMouseDownPoint,
2066
                        EndPoint = new Point(canvasZoomPanningMouseDownPoint.X + img.Source.Width, 
2067
                        canvasZoomPanningMouseDownPoint.Y + img.Source.Height),
2068
                        TopRightPoint = new Point(canvasZoomPanningMouseDownPoint.X+img.Source.Width,
2069
                        canvasZoomPanningMouseDownPoint.Y),
2070
                        LeftBottomPoint = new Point(canvasZoomPanningMouseDownPoint.X,
2071
                        canvasZoomPanningMouseDownPoint.Y + img.Source.Height)
2072
                    };
2073
2074
                    currentControl.PointSet = new List<Point>
2075
                                        {
2076
                                            currentControl.StartPoint,
2077
                                            currentControl.LeftBottomPoint,
2078
                                            currentControl.EndPoint,
2079
                                            currentControl.TopRightPoint,
2080
                                        };
2081
                    Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
2082
                    UndoData = new Undo_data()
2083
                    {
2084
                        IsUndo = false,
2085
                        Event = Event_Type.Create,
2086
                        EventTime = DateTime.Now,
2087
                        Markup_List = new List<Multi_Undo_data>()
2088
                    };
2089
                    ViewerDataModel.Instance.UndoDataList.Where(data1 => data1.IsUndo == true).ToList().ForEach(i =>
2090
                    {
2091
                        ViewerDataModel.Instance.UndoDataList.Remove(i);
2092
                    });
2093
2094
                    //multi_Undo_Data = dzMainMenu.Control_Style(currentControl as MarkupToPDF.Common.CommentUserInfo);
2095
                    multi_Undo_Data = Control_Style(currentControl as MarkupToPDF.Common.CommentUserInfo);
2096
                    UndoData.Markup_List.Add(multi_Undo_Data);
2097
                    ViewerDataModel.Instance.UndoDataList.Add(UndoData);
2098
2099
                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl as MarkupToPDF.Common.CommentUserInfo);
2100 24678e06 humkyung
                    currentControl.CommentID = Commons.shortGuid();
2101 53880c83 ljiyeon
                    currentControl.SymbolID = id;
2102
                    currentControl.GroupID = group_id;
2103
                    currentControl.ApplyTemplate();
2104
                    currentControl.SetImage();
2105
2106
                    ViewerDataModel.Instance.MarkupControls_USER.Remove(currentControl as MarkupToPDF.Common.CommentUserInfo);
2107
                    Controls.AdornerFinal final = new Controls.AdornerFinal(currentControl as MarkupToPDF.Common.CommentUserInfo);
2108
                    SelectLayer.Children.Add(final);
2109
                }
2110
            }
2111
            catch (Exception ex)
2112
            {
2113
                this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert(ex.Message, "Error");
2114
            }
2115
        }
2116
2117
        private void zoomAndPanControl_MouseDown(object sender, MouseButtonEventArgs e)
2118 3c71b3a5 taeseongkim
        {            
2119 992a98b4 KangIngu
            var set_option = this.ParentOfType<MainWindow>().dzTopMenu.Parent.ChildrenOfType<RadNumericUpDown>().Where(item => item.IsKeyboardFocusWithin).FirstOrDefault();
2120 be04d12c djkim
            if (set_option != null && !string.IsNullOrEmpty(set_option.ContentText))
2121 992a98b4 KangIngu
            {
2122
                set_option.Value = double.Parse(set_option.ContentText);
2123 5d55f6fb ljiyeon
                //set_option.Focusable = false;
2124 3c71b3a5 taeseongkim
                zoomAndPanControl.Focus();
2125 992a98b4 KangIngu
            }
2126
2127 f959ea6f humkyung
            ConvertInkControlToPolygon();
2128 787a4489 KangIngu
2129 d62c0439 humkyung
            ///TODO:
2130 787a4489 KangIngu
            var text_item = ViewerDataModel.Instance.MarkupControls_USER.Where(data =>
2131
            (data as TextControl) != null && (data as TextControl).Text == "" || (data as ArrowTextControl) != null && (data as ArrowTextControl).ArrowText == "").FirstOrDefault();
2132
2133 a1716fa5 KangIngu
            if (text_item != null && (currentControl as ArrowTextControl) == null)
2134 787a4489 KangIngu
            {
2135
                ViewerDataModel.Instance.MarkupControls_USER.Remove(text_item);
2136
            }
2137 d62c0439 humkyung
            /// up to here
2138 787a4489 KangIngu
2139 b7813553 djkim
            foreach (var item in ViewerDataModel.Instance.MarkupControls_USER)
2140 787a4489 KangIngu
            {
2141 b7813553 djkim
                if (item as ArrowTextControl != null)
2142 787a4489 KangIngu
                {
2143 b7813553 djkim
                    (item as ArrowTextControl).Base_TextBox.IsHitTestVisible = false;
2144 787a4489 KangIngu
                }
2145
            }
2146
2147 49b217ad humkyung
            //if (currentControl != null)
2148 787a4489 KangIngu
            {
2149
                var text_item_ = ViewerDataModel.Instance.MarkupControls_USER.Where(data => (data as TextControl) != null && (data as TextControl).Base_TextBox.Visibility == Visibility.Visible).FirstOrDefault();
2150
                if (text_item_ != null)
2151
                {
2152
                    (text_item_ as TextControl).Base_TextBlock.Visibility = Visibility.Visible;
2153
                    (text_item_ as TextControl).Base_TextBox.Visibility = Visibility.Collapsed;
2154 b7813553 djkim
                    (text_item_ as TextControl).IsEditingMode = false;
2155
                    (text_item_ as TextControl).Base_TextBox.Focusable = false;
2156 49b217ad humkyung
                    currentControl = null;
2157 787a4489 KangIngu
                }
2158
2159
                var Arrowtext_item_ = ViewerDataModel.Instance.MarkupControls_USER.Where(data => (data as ArrowTextControl) != null && (data as ArrowTextControl).IsEditingMode == true).FirstOrDefault();
2160 49b217ad humkyung
                if (Arrowtext_item_ != null && ((Arrowtext_item_ as ArrowTextControl).IsNew == false))
2161 787a4489 KangIngu
                {
2162
                    (Arrowtext_item_ as ArrowTextControl).IsEditingMode = false;
2163
                    (Arrowtext_item_ as ArrowTextControl).Base_TextBox.Focusable = false;
2164 49b217ad humkyung
                    currentControl = null;
2165 787a4489 KangIngu
                }
2166
            }
2167
2168 ca40e004 ljiyeon
            double Ang = 0;                                          
2169 787a4489 KangIngu
            if (rotate.Angle != 0)
2170
            {
2171
                Ang = 360 - rotate.Angle;
2172
            }
2173
2174
            if (e.OriginalSource is System.Windows.Controls.Image)
2175
            {
2176
                (e.OriginalSource as System.Windows.Controls.Image).Focus();
2177
            }
2178 7211e0c2 ljiyeon
            /*
2179 e6a9ddaf humkyung
            if (mouseHandlingMode == MouseHandlingMode.DragSymbol && e.LeftButton == MouseButtonState.Pressed)
2180 53880c83 ljiyeon
            {                
2181
                canvasZoomPanningMouseDownPoint = e.GetPosition(zoomAndPanCanvas);
2182
                if(symbol_id != null)
2183
                {
2184
                    PlaceImageSymbol(symbol_id, symbol_group_id, symbol_SelectedIndex, canvasZoomPanningMouseDownPoint);
2185
                }                
2186
            }
2187
2188 e6a9ddaf humkyung
            if (mouseHandlingMode == MouseHandlingMode.DragSymbol && e.RightButton == MouseButtonState.Pressed)
2189 53880c83 ljiyeon
            {
2190
                if (this._dragdropWindow != null)
2191
                {
2192
                    this._dragdropWindow.Close();
2193
                    this._dragdropWindow = null;
2194
                    symbol_id = null;
2195
                }
2196
            }
2197 7211e0c2 ljiyeon
            */
2198 53880c83 ljiyeon
2199 e6a9ddaf humkyung
            if (e.LeftButton == MouseButtonState.Pressed)
2200 787a4489 KangIngu
            {
2201
                canvasDrawingMouseDownPoint = e.GetPosition(drawingRotateCanvas);
2202
                canvasZoomPanningMouseDownPoint = e.GetPosition(zoomAndPanCanvas);
2203
2204 510cbd2a ljiyeon
                this.cursor = new Cursor(MainWindow.CursorChange().StreamSource);
2205 787a4489 KangIngu
                SetCursor();
2206
2207 f513c215 humkyung
                if (!ViewerDataModel.Instance.IsPressCtrl) SelectionSet.Instance.UnSelect(this);
2208 787a4489 KangIngu
            }
2209 f513c215 humkyung
2210 e6a9ddaf humkyung
            if (e.MiddleButton == MouseButtonState.Pressed)
2211 787a4489 KangIngu
            {
2212
                canvasZoommovingMouseDownPoint = e.GetPosition(zoomAndPanCanvas);
2213
                cursor = Cursors.SizeAll;
2214
                SetCursor();
2215
            }
2216 e6a9ddaf humkyung
            if (e.RightButton == MouseButtonState.Pressed)
2217 787a4489 KangIngu
            {
2218
                canvasZoommovingMouseDownPoint = e.GetPosition(zoomAndPanCanvas);
2219
                cursor = Cursors.SizeAll;
2220
                SetCursor();
2221
            }
2222 e6a9ddaf humkyung
            else if (e.XButton1 == MouseButtonState.Pressed)
2223 787a4489 KangIngu
            {
2224
                if (this.pageNavigator.CurrentPage.PageNumber + 1 <= this.pageNavigator.PageCount)
2225
                {
2226 3908a575 humkyung
                    this.pageNavigator.GotoPage(this.pageNavigator.CurrentPage.PageNumber + 1);
2227 787a4489 KangIngu
                }
2228
2229 3908a575 humkyung
                //this.pageNavigator.GotoPage(this.pageNavigator._NextPage.PageNumber);
2230 787a4489 KangIngu
2231
            }
2232 e6a9ddaf humkyung
            else if (e.XButton2 == MouseButtonState.Pressed)
2233 787a4489 KangIngu
            {
2234
                if (this.pageNavigator.CurrentPage.PageNumber > 1)
2235
                {
2236
                    this.pageNavigator.GotoPage(this.pageNavigator.CurrentPage.PageNumber - 1);
2237
                }
2238
            }
2239
2240 e6a9ddaf humkyung
            if (e.LeftButton == MouseButtonState.Pressed && mouseHandlingMode != MouseHandlingMode.Drawing && currentControl == null)
2241 787a4489 KangIngu
            {
2242
                if (mouseHandlingMode == MouseHandlingMode.Selecting)
2243
                {
2244
                    if (SelectLayer.Children.Count == 0)
2245
                    {
2246
                        isLeftMouseButtonDownOnWindow = true;
2247
                        mouseHandlingMode = MouseHandlingMode.Selecting;
2248
                    }
2249
2250
                    if (controlType == ControlType.None)
2251
                    {
2252
                        isLeftMouseButtonDownOnWindow = true;
2253
                    }
2254
                }
2255
2256 f513c215 humkyung
                /// 캡쳐 모드 설정
2257 9f473fb7 KangIngu
                if (mouseHandlingMode == MouseHandlingMode.Capture)
2258
                {
2259
                    dragCaptureBorder.Visibility = Visibility.Visible;
2260
                    isLeftMouseButtonDownOnWindow = true;
2261
                }
2262
2263 f513c215 humkyung
                /// 줌 모드 설정
2264 9f473fb7 KangIngu
                if (mouseHandlingMode == MouseHandlingMode.DragZoom)
2265
                {
2266
                    isLeftMouseButtonDownOnWindow = true;
2267 1066bae3 ljiyeon
                }
2268 787a4489 KangIngu
2269 05009a0e ljiyeon
                var control = ViewerDataModel.Instance.MarkupControls_USER.Where(data => data.IsMouseOver).FirstOrDefault();
2270 787a4489 KangIngu
                if (control != null)
2271
                {
2272 d62c0439 humkyung
                    AdornerFinal final = null;
2273 787a4489 KangIngu
2274
                    if (!ViewerDataModel.Instance.IsPressCtrl)
2275
                    {
2276 d62c0439 humkyung
                        /// 기존 selection 해제
2277 077896be humkyung
                        SelectionSet.Instance.UnSelect(this);
2278 d62c0439 humkyung
2279 787a4489 KangIngu
                        final = new AdornerFinal(control);
2280
2281 f513c215 humkyung
                        this.Control_Style(control);
2282 787a4489 KangIngu
2283
                        if ((control as IPath) != null)
2284
                        {
2285
                            if ((control as IPath).LineSize != 0)
2286
                            {
2287
                                ViewerDataModel.Instance.LineSize = (control as IPath).LineSize;
2288
                            }
2289
                        }
2290
                        if ((control as IShapeControl) != null)
2291
                        {
2292
                            if ((control as IShapeControl).Paint == PaintSet.Hatch)
2293
                            {
2294
                                ViewerDataModel.Instance.checkHatchShape = true;
2295
                            }
2296
                            else if ((control as IShapeControl).Paint == PaintSet.Fill)
2297
                            {
2298
                                ViewerDataModel.Instance.checkFillShape = true;
2299
                            }
2300
                            else
2301
                            {
2302
                                ViewerDataModel.Instance.checkHatchShape = false;
2303
                                ViewerDataModel.Instance.checkFillShape = false;
2304
                            }
2305
                            ViewerDataModel.Instance.paintSet = (control as IShapeControl).Paint;
2306
                        }
2307 9f473fb7 KangIngu
2308 787a4489 KangIngu
                        ViewerDataModel.Instance.ControlOpacity = control.Opacity;
2309 d4b0c723 KangIngu
2310
                        if ((control as TextControl) != null)
2311
                        {
2312 71d7e0bf 송근호
                            if(!((control as TextControl).EnableEditing)) {
2313
                                (control as TextControl).EnableEditing = true;
2314
                            }
2315
2316 d4b0c723 KangIngu
                            if ((control as TextControl).TextStyle == FontStyles.Italic)
2317
                            {
2318
                                ViewerDataModel.Instance.checkTextStyle = true;
2319
                            }
2320
                            else
2321
                            {
2322
                                ViewerDataModel.Instance.checkTextStyle = false;
2323
                            }
2324
2325
                            if ((control as TextControl).TextStyle == FontStyles.Italic)
2326
                            {
2327
                                ViewerDataModel.Instance.checkTextStyle = true;
2328
                            }
2329
                            else
2330
                            {
2331
                                ViewerDataModel.Instance.checkTextStyle = false;
2332
                            }
2333
                            if ((control as TextControl).TextWeight == FontWeights.Bold)
2334
                            {
2335
                                ViewerDataModel.Instance.checkTextWeight = true;
2336
                            }
2337
                            else
2338
                            {
2339
                                ViewerDataModel.Instance.checkTextWeight = false;
2340
                            }
2341
                            if ((control as TextControl).UnderLine == TextDecorations.Underline)
2342
                            {
2343
                                ViewerDataModel.Instance.checkUnderLine = true;
2344
                            }
2345
                            else
2346
                            {
2347
                                ViewerDataModel.Instance.checkUnderLine = false;
2348
                            }
2349
                            ViewerDataModel.Instance.TextSize = (control as TextControl).TextSize;
2350
                            ViewerDataModel.Instance.checkHighlight = (control as TextControl).IsHighLight;
2351 e54660e8 KangIngu
2352 d4b0c723 KangIngu
                        }
2353
                        else if ((control as ArrowTextControl) != null)
2354
                        {
2355 120b8b00 송근호
                            if (!((control as ArrowTextControl).EnableEditing))
2356
                            {
2357 71d7e0bf 송근호
                                (control as ArrowTextControl).EnableEditing = true;
2358
                            }
2359 e17af42b KangIngu
                            if ((control as ArrowTextControl).TextStyle == FontStyles.Italic)
2360 d4b0c723 KangIngu
                            {
2361 e17af42b KangIngu
                                ViewerDataModel.Instance.checkTextStyle = true;
2362
                            }
2363
                            else
2364
                            {
2365
                                ViewerDataModel.Instance.checkTextStyle = false;
2366
                            }
2367
2368
                            if ((control as ArrowTextControl).TextStyle == FontStyles.Italic)
2369
                            {
2370
                                ViewerDataModel.Instance.checkTextStyle = true;
2371 d4b0c723 KangIngu
                            }
2372 e17af42b KangIngu
                            else
2373 d4b0c723 KangIngu
                            {
2374 e17af42b KangIngu
                                ViewerDataModel.Instance.checkTextStyle = false;
2375 d4b0c723 KangIngu
                            }
2376 e17af42b KangIngu
                            if ((control as ArrowTextControl).TextWeight == FontWeights.Bold)
2377 d4b0c723 KangIngu
                            {
2378 e17af42b KangIngu
                                ViewerDataModel.Instance.checkTextWeight = true;
2379
                            }
2380
                            else
2381
                            {
2382
                                ViewerDataModel.Instance.checkTextWeight = false;
2383
                            }
2384
                            if ((control as ArrowTextControl).UnderLine == TextDecorations.Underline)
2385
                            {
2386
                                ViewerDataModel.Instance.checkUnderLine = true;
2387
                            }
2388
                            else
2389
                            {
2390
                                ViewerDataModel.Instance.checkUnderLine = false;
2391 d4b0c723 KangIngu
                            }
2392
                            ViewerDataModel.Instance.checkHighlight = (control as ArrowTextControl).isHighLight;
2393
                            ViewerDataModel.Instance.TextSize = (control as ArrowTextControl).TextSize;
2394
                        }
2395 9f473fb7 KangIngu
                        else if ((control as RectCloudControl) != null)
2396
                        {
2397
                            ViewerDataModel.Instance.ArcLength = (control as RectCloudControl).ArcLength;
2398
                        }
2399
                        else if ((control as CloudControl) != null)
2400
                        {
2401
                            ViewerDataModel.Instance.ArcLength = (control as CloudControl).ArcLength;
2402
                        }
2403 787a4489 KangIngu
                    }
2404
                    else
2405
                    {
2406 d62c0439 humkyung
                        List<CommentUserInfo> comment = SelectionSet.Instance.SelectedItems;
2407
                        SelectionSet.Instance.UnSelect(this);
2408 787a4489 KangIngu
                        comment.Add(control);
2409
2410
                        Control_Style(control);
2411
2412
                        final = new AdornerFinal(comment);
2413
                    }
2414
2415 f513c215 humkyung
                    if (final != null)
2416
                    {
2417
                        this.SelectLayer.Children.Add(final);
2418
                    }
2419 6707a5c7 ljiyeon
                }              
2420 787a4489 KangIngu
            }
2421
            else if (mouseHandlingMode == MouseHandlingMode.Drawing)
2422 6707a5c7 ljiyeon
            {               
2423 787a4489 KangIngu
                init();
2424
                //강인구 추가(우 클릭 일 경우 커서 변경 하지 않음)
2425
                if (cursor != Cursors.SizeAll)
2426
                {
2427
                    cursor = Cursors.Cross;
2428
                    SetCursor();
2429
                }
2430
                bool init_user = false;
2431
                foreach (var user in gridViewMarkup.Items)
2432
                {
2433
                    if ((user as MarkupInfoItem).UserID == App.ViewInfo.UserID)
2434
                    {
2435
                        init_user = true;
2436
                    }
2437
                }
2438
                if (init_user && gridViewMarkup.SelectedItems.Where(d => (d as MarkupInfoItem).UserID == App.ViewInfo.UserID).FirstOrDefault() == null && e.LeftButton == MouseButtonState.Pressed)
2439
                {
2440
                    RadWindow.Alert(new DialogParameters
2441
                    {
2442 b9b01f8e ljiyeon
                        Owner = Application.Current.MainWindow,
2443 787a4489 KangIngu
                        Theme = new VisualStudio2013Theme(),
2444
                        Header = "안내",
2445
                        Content = "기존의 코멘트가 존재합니다. 사용자 리스트에서 먼저 선택해주세요",
2446
                    });
2447
                    return;
2448
                }
2449
                else
2450
                {
2451
                    var item = gridViewMarkup.SelectedItems.Where(d => (d as MarkupInfoItem).UserID == App.ViewInfo.UserID).FirstOrDefault() as MarkupInfoItem;
2452
                    if (item != null)
2453
                    {
2454
                        App.Custom_ViewInfoId = item.MarkupInfoID;
2455
                    }
2456
                }
2457
2458 75448f5e ljiyeon
                switch (controlType)
2459 787a4489 KangIngu
                {
2460 684ef11c ljiyeon
                    case ControlType.Coordinate:
2461
                        {
2462 e6a9ddaf humkyung
                            if (e.LeftButton == MouseButtonState.Pressed)
2463 684ef11c ljiyeon
                            {
2464
                                if (currentControl is CoordinateControl)
2465
                                {
2466
                                    if (IsGetoutpoint((currentControl as CoordinateControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
2467
                                    {
2468
                                        return;
2469
                                    }
2470
2471 f513c215 humkyung
                                    CreateCommand.Instance.Execute(currentControl);
2472 684ef11c ljiyeon
2473
                                    currentControl = null;
2474
                                    this.cursor = Cursors.Arrow;
2475
                                }
2476
                                else
2477
                                {
2478
                                    this.ParentOfType<MainWindow>().dzTopMenu._SaveEvent(null, null);
2479 d62c0439 humkyung
                                    if (ViewerDataModel.Instance.MyMarkupList.Where(d => d.PageNumber == Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber
2480 684ef11c ljiyeon
                                     && d.Data_Type == Convert.ToInt32(MarkupToPDF.Controls.Common.ControlType.Coordinate)).Count() > 0)
2481
                                    {
2482
                                        currentControl = null;
2483
                                        this.cursor = Cursors.Arrow;
2484
                                        Common.ViewerDataModel.Instance.SystemMain.DialogMessage_Alert("이미 해당 페이지의 도면 영역을 설정하셨습니다.", "Notice");
2485
                                        return;
2486
                                    }
2487
                                    else
2488
                                    {
2489
                                        currentControl = new CoordinateControl
2490
                                        {
2491
                                            Background = new SolidColorBrush(Colors.Black),
2492 f67f164e humkyung
                                            StartPoint = this.canvasDrawingMouseDownPoint,
2493 684ef11c ljiyeon
                                            ControlType = ControlType.Coordinate
2494
                                        };
2495
2496 24678e06 humkyung
                                        currentControl.CommentID = Commons.shortGuid();
2497 684ef11c ljiyeon
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
2498
                                        currentControl.IsNew = true;
2499
2500
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
2501
2502
                                        currentControl.SetValue(Canvas.ZIndexProperty, 3);
2503
                                    }
2504
                                }
2505
                            }
2506
                        }
2507
                        break;
2508
                    case ControlType.InsideWhite:
2509
                        {
2510 e6a9ddaf humkyung
                            if (e.LeftButton == MouseButtonState.Pressed)
2511 684ef11c ljiyeon
                            {
2512
                                if (currentControl is InsideWhiteControl)
2513
                                {
2514
                                    if (IsGetoutpoint((currentControl as InsideWhiteControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
2515
                                    {
2516
                                        return;
2517
                                    }
2518
2519 f513c215 humkyung
                                    CreateCommand.Instance.Execute(currentControl);
2520 684ef11c ljiyeon
2521
                                    currentControl = null;
2522
                                    this.cursor = Cursors.Arrow;
2523
                                }
2524
                                else
2525
                                {
2526
                                    currentControl = new InsideWhiteControl
2527
                                    {
2528
                                        Background = new SolidColorBrush(Colors.Black),
2529 f67f164e humkyung
                                        StartPoint = this.canvasDrawingMouseDownPoint,
2530 684ef11c ljiyeon
                                        ControlType = ControlType.InsideWhite
2531
                                    };
2532
2533 24678e06 humkyung
                                    currentControl.CommentID = Commons.shortGuid();
2534 684ef11c ljiyeon
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
2535
                                    currentControl.IsNew = true;
2536
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
2537
2538
                                    currentControl.SetValue(Canvas.ZIndexProperty, 3);
2539
                                }
2540
                            }
2541
                        }
2542
                        break;
2543
                    case ControlType.OverlapWhite:
2544
                        {
2545 e6a9ddaf humkyung
                            if (e.LeftButton == MouseButtonState.Pressed)
2546 684ef11c ljiyeon
                            {
2547
                                if (currentControl is OverlapWhiteControl)
2548
                                {
2549
                                    if (IsGetoutpoint((currentControl as OverlapWhiteControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
2550
                                    {
2551
                                        return;
2552
                                    }
2553
2554 f513c215 humkyung
                                    CreateCommand.Instance.Execute(currentControl);
2555 684ef11c ljiyeon
2556
                                    currentControl = null;
2557
                                    this.cursor = Cursors.Arrow;
2558
                                }
2559
                                else
2560
                                {
2561
                                    currentControl = new OverlapWhiteControl
2562
                                    {
2563
                                        Background = new SolidColorBrush(Colors.Black),
2564 f67f164e humkyung
                                        StartPoint = this.canvasDrawingMouseDownPoint,
2565 684ef11c ljiyeon
                                        ControlType = ControlType.OverlapWhite
2566
                                    };
2567
2568 24678e06 humkyung
                                    currentControl.CommentID = Commons.shortGuid();
2569 684ef11c ljiyeon
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
2570
                                    currentControl.IsNew = true;
2571
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
2572
2573
                                    currentControl.SetValue(Canvas.ZIndexProperty, 3);
2574
                                }
2575
                            }
2576
                        }
2577
                        break;
2578
                    case ControlType.ClipWhite:
2579
                        {
2580 e6a9ddaf humkyung
                            if (e.LeftButton == MouseButtonState.Pressed)
2581 684ef11c ljiyeon
                            {
2582
                                if (currentControl is ClipWhiteControl)
2583
                                {
2584
                                    if (IsGetoutpoint((currentControl as ClipWhiteControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
2585
                                    {
2586
                                        return;
2587
                                    }
2588
2589 f513c215 humkyung
                                    CreateCommand.Instance.Execute(currentControl);
2590 684ef11c ljiyeon
2591
                                    currentControl = null;
2592
                                    this.cursor = Cursors.Arrow;
2593
                                }
2594
                                else
2595
                                {
2596
                                    currentControl = new ClipWhiteControl
2597
                                    {
2598
                                        Background = new SolidColorBrush(Colors.Black),
2599 a6272c57 humkyung
                                        StartPoint = this.canvasDrawingMouseDownPoint,
2600 684ef11c ljiyeon
                                        ControlType = ControlType.ClipWhite
2601
                                    };
2602
2603 24678e06 humkyung
                                    currentControl.CommentID = Commons.shortGuid();
2604 684ef11c ljiyeon
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
2605
                                    currentControl.IsNew = true;
2606
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
2607
2608
                                    currentControl.SetValue(Canvas.ZIndexProperty, 3);
2609
                                }
2610
                            }
2611
                        }
2612
                        break;
2613 787a4489 KangIngu
                    case ControlType.Rectangle:
2614
                        {
2615 e6a9ddaf humkyung
                            if (e.LeftButton == MouseButtonState.Pressed)
2616 787a4489 KangIngu
                            {
2617 f67f164e humkyung
                                if (currentControl is RectangleControl)
2618
                                {
2619
                                    //20180906 LJY TEST IsRotationDrawingEnable
2620
                                    if (IsGetoutpoint((currentControl as RectangleControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
2621 787a4489 KangIngu
                                    {
2622 f67f164e humkyung
                                        return;
2623
                                    }
2624 787a4489 KangIngu
2625 f67f164e humkyung
                                    CreateCommand.Instance.Execute(currentControl);
2626
                                    currentControl = null;
2627 510cbd2a ljiyeon
                                    this.cursor = new Cursor(MainWindow.CursorChange().StreamSource);
2628 f67f164e humkyung
                                }
2629
                                else
2630
                                {
2631
                                    currentControl = new RectangleControl
2632 787a4489 KangIngu
                                    {
2633 f67f164e humkyung
                                        Background = new SolidColorBrush(Colors.Black),
2634
                                        StartPoint = this.canvasDrawingMouseDownPoint,
2635
                                        ControlType = ControlType.Rectangle
2636
                                    };
2637 787a4489 KangIngu
2638 f67f164e humkyung
                                    currentControl.CommentID = Commons.shortGuid();
2639
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
2640
                                    currentControl.IsNew = true;
2641
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
2642 787a4489 KangIngu
2643 f67f164e humkyung
                                    currentControl.SetValue(Canvas.ZIndexProperty, 3);
2644
                                }
2645 787a4489 KangIngu
                            }
2646
                        }
2647
                        break;
2648
                    case ControlType.RectCloud:
2649
                        {
2650 e6a9ddaf humkyung
                            if (e.LeftButton == MouseButtonState.Pressed)
2651 787a4489 KangIngu
                            {
2652 f67f164e humkyung
                                if (currentControl is RectCloudControl)
2653
                                {
2654
                                    //20180906 LJY TEST IsRotationDrawingEnable
2655
                                    if (IsGetoutpoint((currentControl as RectCloudControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
2656 787a4489 KangIngu
                                    {
2657 f67f164e humkyung
                                        return;
2658
                                    }
2659 e66f22eb KangIngu
2660 f67f164e humkyung
                                    CreateCommand.Instance.Execute(currentControl);
2661 787a4489 KangIngu
2662 f67f164e humkyung
                                    currentControl = null;
2663
                                
2664
                                    this.cursor = new Cursor(MainWindow.CursorChange().StreamSource);
2665
                                }
2666
                                else
2667
                                {
2668
                                    currentControl = new RectCloudControl
2669 787a4489 KangIngu
                                    {
2670 f67f164e humkyung
                                        StartPoint = this.canvasDrawingMouseDownPoint,
2671
                                        ControlType = ControlType.RectCloud,
2672
                                        Background = new SolidColorBrush(Colors.Black)
2673
                                    };
2674 787a4489 KangIngu
2675 f67f164e humkyung
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
2676
                                    currentControl.CommentID = Commons.shortGuid();
2677
                                    currentControl.IsNew = true;
2678
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
2679
                                }
2680 787a4489 KangIngu
                            }
2681
                        }
2682
                        break;
2683
                    case ControlType.Circle:
2684
                        {
2685 e6a9ddaf humkyung
                            if (e.LeftButton == MouseButtonState.Pressed)
2686 787a4489 KangIngu
                            {
2687 f67f164e humkyung
                                if (currentControl is CircleControl)
2688
                                {
2689
                                    //20180906 LJY TEST IsRotationDrawingEnable
2690
                                    if (IsGetoutpoint((currentControl as CircleControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
2691 787a4489 KangIngu
                                    {
2692 f67f164e humkyung
                                        return;
2693
                                    }
2694 e66f22eb KangIngu
2695 f67f164e humkyung
                                    CreateCommand.Instance.Execute(currentControl);
2696 787a4489 KangIngu
2697 f67f164e humkyung
                                    currentControl = null;
2698
                                }
2699
                                else
2700
                                {
2701
                                    currentControl = new CircleControl
2702 787a4489 KangIngu
                                    {
2703 f67f164e humkyung
                                        StartPoint = this.canvasDrawingMouseDownPoint,
2704
                                        LeftBottomPoint = this.canvasDrawingMouseDownPoint,
2705
                                        Background = new SolidColorBrush(Colors.Black)
2706
                                    };
2707 787a4489 KangIngu
2708 f67f164e humkyung
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
2709
                                    currentControl.CommentID = Commons.shortGuid();
2710
                                    currentControl.IsNew = true;
2711
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
2712
                                }
2713 787a4489 KangIngu
                            }
2714
                        }
2715
                        break;
2716
                    case ControlType.Triangle:
2717
                        {
2718 e6a9ddaf humkyung
                            if (e.LeftButton == MouseButtonState.Pressed)
2719 787a4489 KangIngu
                            {
2720 f67f164e humkyung
                                if (currentControl is TriControl)
2721
                                {
2722
                                    var content = currentControl as TriControl;
2723
                                    if (content.MidPoint == new Point(0, 0))
2724 787a4489 KangIngu
                                    {
2725 f67f164e humkyung
                                        content.MidPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
2726 787a4489 KangIngu
                                    }
2727
                                    else
2728
                                    {
2729 ca40e004 ljiyeon
                                        //20180906 LJY TEST IsRotationDrawingEnable
2730 f67f164e humkyung
                                        if (IsGetoutpoint((currentControl as TriControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
2731 e66f22eb KangIngu
                                        {
2732
                                            return;
2733
                                        }
2734
2735 f513c215 humkyung
                                        CreateCommand.Instance.Execute(currentControl);
2736 787a4489 KangIngu
2737
                                        currentControl = null;
2738
                                    }
2739 f67f164e humkyung
                                }
2740
                                else
2741
                                {
2742
                                    currentControl = new TriControl
2743 787a4489 KangIngu
                                    {
2744 f67f164e humkyung
                                        StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y),
2745
                                        Background = new SolidColorBrush(Colors.Black),
2746
                                    };
2747 787a4489 KangIngu
2748 f67f164e humkyung
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
2749
                                    currentControl.CommentID = Commons.shortGuid();
2750
                                    currentControl.IsNew = true;
2751
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
2752
                                }
2753 787a4489 KangIngu
                            }
2754
                        }
2755
                        break;
2756
                    case ControlType.CancelLine:
2757 f67f164e humkyung
                    case ControlType.SingleLine:
2758
                    case ControlType.ArrowLine:
2759
                    case ControlType.TwinLine:
2760
                    case ControlType.DimLine:
2761 787a4489 KangIngu
                        {
2762 e6a9ddaf humkyung
                            if (e.LeftButton == MouseButtonState.Pressed)
2763 787a4489 KangIngu
                            {
2764 f67f164e humkyung
                                if (currentControl is LineControl)
2765
                                {
2766
                                    //20180906 LJY TEST IsRotationDrawingEnable
2767
                                    if (IsGetoutpoint((currentControl as LineControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
2768 787a4489 KangIngu
                                    {
2769 f67f164e humkyung
                                        return;
2770 787a4489 KangIngu
                                    }
2771 f67f164e humkyung
2772
                                    CreateCommand.Instance.Execute(currentControl);
2773
                                    currentControl = null;
2774
                                    this.MainAngle.Visibility = Visibility.Collapsed;
2775
                                }
2776
                                else
2777
                                {
2778
                                    currentControl = new LineControl
2779 787a4489 KangIngu
                                    {
2780 f67f164e humkyung
                                        ControlType = this.controlType,
2781
                                        StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y),
2782
                                        Background = new SolidColorBrush(Colors.Black)
2783
                                    };
2784 787a4489 KangIngu
2785 f67f164e humkyung
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
2786
                                    currentControl.CommentID = Commons.shortGuid();
2787
                                    currentControl.IsNew = true;
2788
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
2789
                                    this.MainAngle.Visibility = Visibility.Visible;
2790
                                }
2791 787a4489 KangIngu
                            }
2792
                        }
2793
                        break;
2794 f67f164e humkyung
                    case ControlType.PolygonControl:
2795 787a4489 KangIngu
                        {
2796 f67f164e humkyung
                            if (currentControl is PolygonControl)
2797 787a4489 KangIngu
                            {
2798 f67f164e humkyung
                                var control = currentControl as PolygonControl;
2799 e66f22eb KangIngu
2800 f67f164e humkyung
                                if (e.RightButton == MouseButtonState.Pressed)
2801
                                {
2802
                                    control.IsCompleted = true;
2803
                                }
2804 787a4489 KangIngu
2805 f67f164e humkyung
                                if (!control.IsCompleted)
2806
                                {
2807
                                    control.PointSet.Add(control.EndPoint);
2808
                                }
2809
                                else
2810
                                {
2811
                                    //20180906 LJY TEST IsRotationDrawingEnable
2812
                                    if (IsGetoutpoint((currentControl as PolygonControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
2813 787a4489 KangIngu
                                    {
2814 f67f164e humkyung
                                        return;
2815 787a4489 KangIngu
                                    }
2816 e66f22eb KangIngu
2817 f67f164e humkyung
                                    var firstPoint = control.PointSet.First();
2818
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
2819
                                    control.LineSize = ViewerDataModel.Instance.LineSize;
2820
                                    control.PointSet.Add(firstPoint);
2821 787a4489 KangIngu
2822 f67f164e humkyung
                                    control.ApplyOverViewData();
2823
2824
                                    CreateCommand.Instance.Execute(currentControl);
2825 0d00f9c8 humkyung
                                    control.UpdateControl();
2826 f67f164e humkyung
                                    currentControl = null;
2827
                                }
2828 787a4489 KangIngu
                            }
2829 f67f164e humkyung
                            else
2830 787a4489 KangIngu
                            {
2831 f67f164e humkyung
                                if (e.LeftButton == MouseButtonState.Pressed)
2832
                                {
2833
                                    currentControl = new PolygonControl
2834 787a4489 KangIngu
                                    {
2835 f67f164e humkyung
                                        PointSet = new List<Point>(),
2836
                                    };
2837 787a4489 KangIngu
2838 f67f164e humkyung
                                    var polygonControl = (currentControl as PolygonControl);
2839
                                    currentControl.CommentID = Commons.shortGuid();
2840
                                    currentControl.IsNew = true;
2841
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
2842
                                    polygonControl.StartPoint = canvasDrawingMouseDownPoint;
2843
                                    polygonControl.EndPoint = canvasDrawingMouseDownPoint;
2844
                                    polygonControl.PointSet.Add(canvasDrawingMouseDownPoint);
2845
                                    polygonControl.PointSet.Add(canvasDrawingMouseDownPoint);
2846
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
2847
                                    polygonControl.ApplyTemplate();
2848
                                    polygonControl.Visibility = Visibility.Visible;
2849
                                }
2850 787a4489 KangIngu
                            }
2851
                        }
2852
                        break;
2853
                    case ControlType.ChainLine:
2854
                        {
2855
                            if (currentControl is PolygonControl)
2856
                            {
2857
                                var control = currentControl as PolygonControl;
2858
2859 e6a9ddaf humkyung
                                if (e.RightButton == MouseButtonState.Pressed)
2860 787a4489 KangIngu
                                {
2861 ca40e004 ljiyeon
                                    //20180906 LJY TEST IsRotationDrawingEnable
2862
                                    if (IsGetoutpoint((currentControl as PolygonControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
2863 e66f22eb KangIngu
                                    {
2864
                                        return;
2865
                                    }
2866
2867 f513c215 humkyung
                                    CreateCommand.Instance.Execute(currentControl);
2868 787a4489 KangIngu
2869
                                    currentControl = null;
2870 2eac4f76 KangIngu
                                    this.MainAngle.Visibility = Visibility.Collapsed;
2871 787a4489 KangIngu
                                    return;
2872
                                }
2873
2874
                                if (!control.IsCompleted)
2875
                                {
2876
                                    control.PointSet.Add(control.EndPoint);
2877 2eac4f76 KangIngu
                                    this.MainAngle.Visibility = Visibility.Visible;
2878 787a4489 KangIngu
                                }
2879
                            }
2880
                            else
2881
                            {
2882 e6a9ddaf humkyung
                                if (e.LeftButton == MouseButtonState.Pressed)
2883 787a4489 KangIngu
                                {
2884 2eac4f76 KangIngu
                                    MainAngle.Visibility = Visibility.Visible;
2885 787a4489 KangIngu
                                    currentControl = new PolygonControl
2886
                                    {
2887
                                        PointSet = new List<Point>(),
2888
                                        //강인구 추가(ChainLine일때는 채우기 스타일을 주지 않기 위해 설정)
2889
                                        ControlType = ControlType.ChainLine,
2890
                                        DashSize = ViewerDataModel.Instance.DashSize,
2891
                                        LineSize = ViewerDataModel.Instance.LineSize,
2892
                                        //PointC = new StylusPointSet()
2893
                                    };
2894
2895 e66f22eb KangIngu
                                    //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
2896
                                    //{
2897 787a4489 KangIngu
                                        var polygonControl = (currentControl as PolygonControl);
2898 24678e06 humkyung
                                        currentControl.CommentID = Commons.shortGuid();
2899 787a4489 KangIngu
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
2900
                                        currentControl.IsNew = true;
2901
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
2902
                                        //currentControl.OnApplyTemplate();
2903
                                        //polygonControl.PointC.pointSet.Add(canvasDrawingMouseDownPoint);
2904
                                        //polygonControl.PointC.pointSet.Add(canvasDrawingMouseDownPoint);
2905
                                        polygonControl.PointSet.Add(canvasDrawingMouseDownPoint);
2906
                                        polygonControl.PointSet.Add(canvasDrawingMouseDownPoint);
2907 e66f22eb KangIngu
                                    //}
2908 787a4489 KangIngu
                                }
2909
                            }
2910
                        }
2911
                        break;
2912
                    case ControlType.ArcLine:
2913
                        {
2914 e6a9ddaf humkyung
                            if (e.LeftButton == MouseButtonState.Pressed)
2915 787a4489 KangIngu
                            {
2916 f67f164e humkyung
                                if (currentControl is ArcControl)
2917
                                {
2918
                                    //20180906 LJY TEST IsRotationDrawingEnable
2919
                                    if (IsGetoutpoint((currentControl as ArcControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
2920 787a4489 KangIngu
                                    {
2921 f67f164e humkyung
                                        return;
2922
                                    }
2923 e66f22eb KangIngu
2924 f67f164e humkyung
                                    CreateCommand.Instance.Execute(currentControl);
2925 787a4489 KangIngu
2926 f67f164e humkyung
                                    currentControl = null;
2927
                                    this.MainAngle.Visibility = Visibility.Collapsed;
2928
                                }
2929
                                else
2930
                                {
2931
                                    currentControl = new ArcControl
2932 787a4489 KangIngu
                                    {
2933 f67f164e humkyung
                                        StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y),
2934
                                        Background = new SolidColorBrush(Colors.Black)
2935
                                    };
2936
                                    currentControl.CommentID = Commons.shortGuid();
2937
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
2938
                                    currentControl.IsNew = true;
2939
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
2940
                                    this.MainAngle.Visibility = Visibility.Visible;
2941
                                }
2942 787a4489 KangIngu
                            }
2943 e6a9ddaf humkyung
                            else if (e.RightButton == MouseButtonState.Pressed)
2944 787a4489 KangIngu
                            {
2945
                                if (currentControl != null)
2946
                                {
2947
                                    (currentControl as ArcControl).setClock();
2948 05f4d127 KangIngu
                                    (currentControl as ArcControl).MidPoint = new Point(0, 0);
2949 787a4489 KangIngu
                                }
2950
                            }
2951
                        }
2952
                        break;
2953
                    case ControlType.ArcArrow:
2954
                        {
2955 e6a9ddaf humkyung
                            if (e.LeftButton == MouseButtonState.Pressed)
2956 787a4489 KangIngu
                            {
2957 e66f22eb KangIngu
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
2958
                                //{
2959 40b3ce25 ljiyeon
                                if (currentControl is ArrowArcControl)
2960
                                {
2961
                                    //20180906 LJY TEST IsRotationDrawingEnable
2962
                                    if (IsGetoutpoint((currentControl as ArrowArcControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
2963 787a4489 KangIngu
                                    {
2964 40b3ce25 ljiyeon
                                        return;
2965
                                    }
2966 e66f22eb KangIngu
2967 f513c215 humkyung
                                    CreateCommand.Instance.Execute(currentControl);
2968 787a4489 KangIngu
2969 40b3ce25 ljiyeon
                                    currentControl = null;
2970
                                    this.MainAngle.Visibility = Visibility.Collapsed;
2971
                                }
2972
                                else
2973
                                {
2974
                                    currentControl = new ArrowArcControl
2975 787a4489 KangIngu
                                    {
2976 a6272c57 humkyung
                                        StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y),
2977 40b3ce25 ljiyeon
                                        Background = new SolidColorBrush(Colors.Black)
2978
                                    };
2979 24678e06 humkyung
                                    currentControl.CommentID = Commons.shortGuid();
2980 40b3ce25 ljiyeon
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
2981
                                    currentControl.IsNew = true;
2982
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
2983
                                    this.MainAngle.Visibility = Visibility.Visible;
2984
                                }
2985 e66f22eb KangIngu
                                //}
2986 787a4489 KangIngu
                            }
2987 e6a9ddaf humkyung
                            else if (e.RightButton == MouseButtonState.Pressed)
2988 787a4489 KangIngu
                            {
2989 40b3ce25 ljiyeon
                                if (currentControl != null)
2990
                                {
2991
                                    (currentControl as ArrowArcControl).setClock();
2992
                                    (currentControl as ArrowArcControl).MidPoint = new Point(0, 0);
2993
                                    //(currentControl as ArcControl).ApplyTemplate();
2994
                                }
2995 787a4489 KangIngu
                            }
2996
                        }
2997
                        break;
2998
                    case ControlType.ArrowMultiLine:
2999
                        {
3000 e6a9ddaf humkyung
                            if (e.LeftButton == MouseButtonState.Pressed)
3001 787a4489 KangIngu
                            {
3002 e66f22eb KangIngu
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3003
                                //{
3004 787a4489 KangIngu
3005
                                    if (currentControl is ArrowControl_Multi)
3006
                                    {
3007
                                        var content = currentControl as ArrowControl_Multi;
3008
                                        if (content.MiddlePoint == new Point(0, 0))
3009
                                        {
3010 2eac4f76 KangIngu
                                            if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift)
3011
                                            {
3012
                                                content.MiddlePoint = content.EndPoint;
3013
                                            }
3014
                                            else
3015
                                            {
3016
                                                content.MiddlePoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
3017
                                            }
3018 787a4489 KangIngu
                                        }
3019
                                        else
3020
                                        {
3021 ca40e004 ljiyeon
                                            //20180906 LJY TEST IsRotationDrawingEnable
3022
                                            if (IsGetoutpoint((currentControl as ArrowControl_Multi).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3023 e66f22eb KangIngu
                                            {
3024
                                                return;
3025
                                            }
3026
3027 f513c215 humkyung
                                            CreateCommand.Instance.Execute(currentControl);
3028 787a4489 KangIngu
3029
                                            currentControl = null;
3030 5ce56a3a KangIngu
                                            this.MainAngle.Visibility = Visibility.Collapsed;
3031 787a4489 KangIngu
                                        }
3032
                                    }
3033
                                    else
3034
                                    {
3035
                                        currentControl = new ArrowControl_Multi
3036
                                        {
3037
                                            StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y),
3038
                                            Background = new SolidColorBrush(Colors.Black)
3039
                                        };
3040 24678e06 humkyung
                                        currentControl.CommentID = Commons.shortGuid();
3041 787a4489 KangIngu
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3042
                                        currentControl.IsNew = true;
3043
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3044 5ce56a3a KangIngu
                                        this.MainAngle.Visibility = Visibility.Visible;
3045 787a4489 KangIngu
                                    }
3046 e66f22eb KangIngu
                                //}
3047 787a4489 KangIngu
                            }
3048
                        }
3049
                        break;
3050
                    case ControlType.PolygonCloud:
3051
                        {
3052
                            if (currentControl is CloudControl)
3053
                            {
3054
                                var control = currentControl as CloudControl;
3055 e6a9ddaf humkyung
                                if (e.RightButton == MouseButtonState.Pressed)
3056 787a4489 KangIngu
                                {
3057
                                    control.IsCompleted = true;
3058
                                }
3059
3060
                                if (!control.IsCompleted)
3061
                                {
3062
                                    control.PointSet.Add(control.EndPoint);
3063
                                }
3064
                                else
3065
                                {
3066 ca40e004 ljiyeon
                                    //20180906 LJY TEST IsRotationDrawingEnable
3067
                                    if (IsGetoutpoint((currentControl as CloudControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3068 e66f22eb KangIngu
                                    {
3069
                                        return;
3070
                                    }
3071
3072 f513c215 humkyung
                                    CreateCommand.Instance.Execute(currentControl);
3073 787a4489 KangIngu
3074
                                    control.isTransOn = true;
3075
                                    var firstPoint = control.PointSet.First();
3076
3077
                                    control.PointSet.Add(firstPoint);
3078
                                    control.DrawingCloud();
3079
                                    control.ApplyOverViewData();
3080
3081
                                    currentControl = null;
3082
                                }
3083
                            }
3084
                            else
3085
                            {
3086 e6a9ddaf humkyung
                                if (e.LeftButton == MouseButtonState.Pressed)
3087 787a4489 KangIngu
                                {
3088
                                    currentControl = new CloudControl
3089
                                    {
3090
                                        PointSet = new List<Point>(),
3091
                                        PointC = new StylusPointSet()
3092
                                    };
3093
3094 e66f22eb KangIngu
                                    //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3095
                                    //{
3096 787a4489 KangIngu
                                        var polygonControl = (currentControl as CloudControl);
3097 24678e06 humkyung
                                        currentControl.CommentID = Commons.shortGuid();
3098 787a4489 KangIngu
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3099
                                        currentControl.IsNew = true;
3100
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3101
3102
                                        polygonControl.PointSet.Add(canvasDrawingMouseDownPoint);
3103
                                        polygonControl.PointSet.Add(canvasDrawingMouseDownPoint);
3104 b9ce7aee ljiyeon
                                    
3105 e66f22eb KangIngu
                                    //}
3106 787a4489 KangIngu
                                }
3107
                            }
3108
                        }
3109
                        break;
3110
                    case ControlType.ImgControl:
3111
                        {
3112 e6a9ddaf humkyung
                            if (e.LeftButton == MouseButtonState.Pressed)
3113 787a4489 KangIngu
                            {
3114 e66f22eb KangIngu
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3115
                                //{
3116 787a4489 KangIngu
                                    if (currentControl is ImgControl)
3117
                                    {
3118 ca40e004 ljiyeon
                                        //20180906 LJY TEST IsRotationDrawingEnable
3119
                                        if (IsGetoutpoint((currentControl as ImgControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3120 e66f22eb KangIngu
                                        {
3121
                                            return;
3122
                                        }
3123
3124 f513c215 humkyung
                                        CreateCommand.Instance.Execute(currentControl);
3125 53880c83 ljiyeon
                                        controlType = ControlType.ImgControl;
3126 787a4489 KangIngu
                                        currentControl = null;
3127
                                    }
3128
                                    else
3129
                                    {
3130 c73426a9 ljiyeon
                                        
3131 787a4489 KangIngu
                                        string extension = System.IO.Path.GetExtension(filename).ToUpper();
3132 53880c83 ljiyeon
                                        if (extension == ".PNG" || extension == ".JPEG" || extension == ".GIF" || extension == ".BMP" || extension == ".JPG" || extension == ".SVG")
3133 787a4489 KangIngu
                                        {
3134
                                            Image img = new Image();
3135 53880c83 ljiyeon
                                            if (filename.Contains(".svg"))
3136
                                            {
3137
                                                byte[] imageData = null;
3138
                                                DrawingImage image = null;
3139
                                                using (System.Net.WebClient web = new System.Net.WebClient())
3140
                                                {
3141
                                                    imageData = web.DownloadData(new Uri(filename));
3142
                                                    System.IO.Stream stream = new System.IO.MemoryStream(imageData);
3143
                                                    image = SvgReader.Load(stream);
3144
                                                }
3145
                                                img.Source = image;
3146
                                            }
3147
                                            else
3148
                                            {
3149
                                                img.Source = new BitmapImage(new Uri(filename));
3150
                                            }
3151 787a4489 KangIngu
3152
                                            currentControl = new ImgControl
3153
                                            {
3154 53880c83 ljiyeon
                                                    Background = new SolidColorBrush(Colors.Black),
3155
                                                    PointSet = new List<Point>(),
3156
                                                    FilePath = filename,
3157
                                                    ImageData = img.Source,
3158
                                                    StartPoint = canvasDrawingMouseDownPoint,
3159
                                                    EndPoint = new Point(canvasDrawingMouseDownPoint.X + 100, canvasDrawingMouseDownPoint.Y + 100),
3160
                                                    TopRightPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y + 100),
3161
                                                    LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X + 100, canvasDrawingMouseDownPoint.Y),
3162
                                                    ControlType = ControlType.ImgControl
3163
                                                };
3164
3165
                                        
3166 24678e06 humkyung
                                                currentControl.CommentID = Commons.shortGuid();                                            
3167 53880c83 ljiyeon
                                                currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3168
                                                currentControl.IsNew = true;
3169
                                                ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3170
3171
                                                //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정  
3172
                                                (currentControl as ImgControl).Angle -= rotate.Angle;
3173
                                        }
3174 787a4489 KangIngu
                                    }
3175 e66f22eb KangIngu
                                //}
3176 787a4489 KangIngu
                            }
3177
                        }
3178
                        break;
3179
                    case ControlType.Date:
3180
                        {
3181 e6a9ddaf humkyung
                            if (e.LeftButton == MouseButtonState.Pressed)
3182 787a4489 KangIngu
                            {
3183 e66f22eb KangIngu
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3184
                                //{
3185 787a4489 KangIngu
                                    if (currentControl is DateControl)
3186
                                    {
3187 ca40e004 ljiyeon
                                        //20180906 LJY TEST IsRotationDrawingEnable
3188
                                        if (IsGetoutpoint((currentControl as DateControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3189 e66f22eb KangIngu
                                        {
3190
                                            return;
3191
                                        }
3192
3193 f513c215 humkyung
                                        CreateCommand.Instance.Execute(currentControl);
3194 787a4489 KangIngu
                                        currentControl = null;
3195
3196
                                        if (Common.ViewerDataModel.Instance.SelectedControl == "Batch")
3197
                                        {
3198
                                            controlType = ControlType.None;
3199
                                            IsSwingMode = false;
3200
                                            Common.ViewerDataModel.Instance.SelectedControl = "";
3201
                                            Common.ViewerDataModel.Instance.ControlTag = null;
3202
                                            mouseHandlingMode = MouseHandlingMode.None;
3203
                                            this.ParentOfType<MainWindow>().dzTopMenu.btn_Batch.IsChecked = false;
3204
                                            txtBatch.Visibility = Visibility.Collapsed;
3205
3206
                                        }
3207
                                    }
3208
                                    else
3209
                                    {
3210
                                        currentControl = new DateControl
3211
                                        {
3212 a6272c57 humkyung
                                            StartPoint = canvasDrawingMouseDownPoint,
3213 787a4489 KangIngu
                                            Background = new SolidColorBrush(Colors.Black)
3214
                                        };
3215 24678e06 humkyung
                                        currentControl.CommentID = Commons.shortGuid();
3216 787a4489 KangIngu
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3217
                                        currentControl.IsNew = true;
3218
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3219 ca40e004 ljiyeon
3220
                                        //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 
3221
                                        (currentControl as DateControl).Angle -= rotate.Angle;
3222
                                }
3223 e66f22eb KangIngu
                                //}
3224 787a4489 KangIngu
                            }
3225
                        }
3226
                        break;
3227
                    case ControlType.TextControl:
3228
                        {
3229 e6a9ddaf humkyung
                            if (e.LeftButton == MouseButtonState.Pressed)
3230 787a4489 KangIngu
                            {
3231
                                if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3232
                                {
3233
                                    currentControl = new TextControl
3234
                                    {
3235
                                        ControlType = controlType
3236
                                    };
3237 610a4b86 KangIngu
                                    (currentControl as TextControl).TextSize = ViewerDataModel.Instance.TextSize;
3238 24678e06 humkyung
                                    currentControl.CommentID = Commons.shortGuid();
3239 8742caa5 humkyung
                                    currentControl.IsNew = true;
3240
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3241
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3242 1066bae3 ljiyeon
                                    currentControl.SetValue(Canvas.ZIndexProperty, 3);
3243
3244 8742caa5 humkyung
                                    currentControl.SetValue(TextControl.CanvasXProperty, canvasDrawingMouseDownPoint.X);
3245
                                    currentControl.SetValue(TextControl.CanvasYProperty, canvasDrawingMouseDownPoint.Y);
3246 6b5d33c6 djkim
                                    
3247 8742caa5 humkyung
                                    (currentControl as TextControl).ControlType_No = 0;
3248
                                    (currentControl as TextControl).Angle -= rotate.Angle;
3249
                                    (currentControl as TextControl).IsHighLight = ViewerDataModel.Instance.checkHighShape;
3250 6b5d33c6 djkim
                                    (currentControl as TextControl).ApplyTemplate();
3251
                                    (currentControl as TextControl).Base_TextBox.Focus();
3252 787a4489 KangIngu
3253 f513c215 humkyung
                                    CreateCommand.Instance.Execute(currentControl);
3254 787a4489 KangIngu
                                }
3255
                            }
3256
                        }
3257
                        break;
3258
                    case ControlType.TextBorder:
3259
                        {
3260 e6a9ddaf humkyung
                            if (e.LeftButton == MouseButtonState.Pressed)
3261 787a4489 KangIngu
                            {
3262
                                if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3263
                                {
3264
                                    currentControl = new TextControl
3265
                                    {
3266
                                        ControlType = controlType
3267
                                    };
3268
3269 610a4b86 KangIngu
                                    (currentControl as TextControl).TextSize = ViewerDataModel.Instance.TextSize;
3270 787a4489 KangIngu
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3271 24678e06 humkyung
                                    currentControl.CommentID = Commons.shortGuid();
3272 787a4489 KangIngu
                                    currentControl.IsNew = true;
3273
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3274
                                    currentControl.SetValue(Canvas.ZIndexProperty, 3);
3275
                                    currentControl.SetValue(TextControl.CanvasXProperty, canvasDrawingMouseDownPoint.X);
3276
                                    currentControl.SetValue(TextControl.CanvasYProperty, canvasDrawingMouseDownPoint.Y);
3277 6b5d33c6 djkim
                                    
3278 787a4489 KangIngu
                                    (currentControl as TextControl).ControlType_No = 1;
3279
                                    (currentControl as TextControl).Angle = Ang;
3280
                                    (currentControl as TextControl).IsHighLight = ViewerDataModel.Instance.checkHighShape;
3281 6b5d33c6 djkim
                                    (currentControl as TextControl).ApplyTemplate();
3282
                                    (currentControl as TextControl).Base_TextBox.Focus();
3283 f513c215 humkyung
                                    CreateCommand.Instance.Execute(currentControl);
3284 787a4489 KangIngu
                                }
3285
                            }
3286
                        }
3287
                        break;
3288
                    case ControlType.TextCloud:
3289
                        {
3290 e6a9ddaf humkyung
                            if (e.LeftButton == MouseButtonState.Pressed)
3291 787a4489 KangIngu
                            {
3292
                                if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3293
                                {
3294
                                    currentControl = new TextControl
3295
                                    {
3296
                                        ControlType = controlType
3297
                                    };
3298 610a4b86 KangIngu
3299
                                    (currentControl as TextControl).TextSize = ViewerDataModel.Instance.TextSize;
3300 24678e06 humkyung
                                    currentControl.CommentID = Commons.shortGuid();
3301 787a4489 KangIngu
                                    currentControl.IsNew = true;
3302
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3303
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3304
3305
                                    currentControl.SetValue(Canvas.ZIndexProperty, 3);
3306
                                    currentControl.SetValue(TextControl.CanvasXProperty, canvasDrawingMouseDownPoint.X);
3307 6b5d33c6 djkim
                                    currentControl.SetValue(TextControl.CanvasYProperty, canvasDrawingMouseDownPoint.Y);                                    
3308 787a4489 KangIngu
3309
                                    (currentControl as TextControl).Angle = Ang;
3310
                                    (currentControl as TextControl).ControlType_No = 2;
3311
                                    (currentControl as TextControl).IsHighLight = ViewerDataModel.Instance.checkHighShape;
3312 6b5d33c6 djkim
                                    (currentControl as TextControl).ApplyTemplate();
3313
                                    (currentControl as TextControl).Base_TextBox.Focus();
3314 f513c215 humkyung
                                    CreateCommand.Instance.Execute(currentControl);
3315 49b217ad humkyung
                                    //currentControl = null;
3316 787a4489 KangIngu
                                }
3317
                            }
3318
                        }
3319
                        break;
3320
                    case ControlType.ArrowTextControl:
3321 ca40e004 ljiyeon
                         {
3322 e6a9ddaf humkyung
                            if (e.LeftButton == MouseButtonState.Pressed)
3323 787a4489 KangIngu
                            {
3324
                                if (currentControl is ArrowTextControl)
3325
                                {
3326 ca40e004 ljiyeon
                                    //20180906 LJY TEST IsRotationDrawingEnable
3327
                                    if (IsGetoutpoint((currentControl as ArrowTextControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3328 e66f22eb KangIngu
                                    {
3329
                                        return;
3330 f513c215 humkyung
                                    }
3331 e66f22eb KangIngu
3332 f513c215 humkyung
                                    CreateCommand.Instance.Execute(currentControl);
3333 787a4489 KangIngu
3334
                                    (currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false;
3335
                                    (currentControl as ArrowTextControl).EnableEditing = false;
3336 49b217ad humkyung
                                    (currentControl as ArrowTextControl).IsNew = false;
3337 787a4489 KangIngu
                                    currentControl = null;
3338
                                }
3339
                                else
3340
                                {
3341 e66f22eb KangIngu
                                    //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3342
                                    //{
3343 787a4489 KangIngu
                                        currentControl = new ArrowTextControl();
3344 24678e06 humkyung
                                        currentControl.CommentID = Commons.shortGuid();
3345 787a4489 KangIngu
                                        currentControl.IsNew = true;
3346
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3347
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3348
3349
                                        currentControl.SetValue(Canvas.ZIndexProperty, 3);
3350
                                        currentControl.SetValue(ArrowTextControl.StartPointProperty, canvasDrawingMouseDownPoint);
3351
                                        currentControl.SetValue(ArrowTextControl.EndPointProperty, canvasDrawingMouseDownPoint);
3352 610a4b86 KangIngu
                                        (currentControl as ArrowTextControl).TextSize = ViewerDataModel.Instance.TextSize;
3353 787a4489 KangIngu
                                        (currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape;
3354
3355 ca40e004 ljiyeon
                                        //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 
3356
                                        (currentControl as ArrowTextControl).Angle -= rotate.Angle;
3357 787a4489 KangIngu
3358 ca40e004 ljiyeon
                                        (currentControl as ArrowTextControl).ApplyTemplate();
3359 787a4489 KangIngu
                                        (currentControl as ArrowTextControl).Base_TextBox.Focus();
3360 5ce56a3a KangIngu
                                        this.MainAngle.Visibility = Visibility.Visible;
3361 ca40e004 ljiyeon
3362
                                    
3363 e66f22eb KangIngu
                                    //}
3364 787a4489 KangIngu
                                }
3365
                            }
3366
                        }
3367
                        break;
3368
                    case ControlType.ArrowTransTextControl:
3369
                        {
3370 e6a9ddaf humkyung
                            if (e.LeftButton == MouseButtonState.Pressed)
3371 787a4489 KangIngu
                            {
3372
                                if (currentControl is ArrowTextControl)
3373
                                {
3374 ca40e004 ljiyeon
                                    //20180906 LJY TEST IsRotationDrawingEnable
3375
                                    if (IsGetoutpoint((currentControl as ArrowTextControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3376 e66f22eb KangIngu
                                    {
3377
                                        return;
3378 f513c215 humkyung
                                    }
3379 e66f22eb KangIngu
3380 f513c215 humkyung
                                    CreateCommand.Instance.Execute(currentControl);
3381 787a4489 KangIngu
                                    (currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false;
3382 49b217ad humkyung
                                    currentControl.IsNew = false;
3383 787a4489 KangIngu
                                    currentControl = null;
3384 5ce56a3a KangIngu
                                    this.MainAngle.Visibility = Visibility.Collapsed;
3385 787a4489 KangIngu
                                }
3386
                                else
3387
                                {
3388 e66f22eb KangIngu
                                    //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3389
                                    //{
3390 120b8b00 송근호
                                    currentControl = new ArrowTextControl()
3391
                                    {
3392
                                        ControlType = ControlType.ArrowTransTextControl
3393
                                    };
3394
                                    currentControl.CommentID = Commons.shortGuid();
3395
                                    currentControl.IsNew = true;
3396
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3397
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3398
                                    currentControl.SetValue(Canvas.ZIndexProperty, 3);
3399
                                    currentControl.SetValue(ArrowTextControl.StartPointProperty, canvasDrawingMouseDownPoint);
3400
                                    currentControl.SetValue(ArrowTextControl.EndPointProperty, canvasDrawingMouseDownPoint);                  
3401
                                    (currentControl as ArrowTextControl).TextSize = ViewerDataModel.Instance.TextSize;
3402
                                    (currentControl as ArrowTextControl).isFixed = true;
3403
                                    (currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape;
3404 787a4489 KangIngu
3405 120b8b00 송근호
                                    //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 
3406
                                    (currentControl as ArrowTextControl).Angle -= rotate.Angle;
3407 ca40e004 ljiyeon
3408 120b8b00 송근호
                                    (currentControl as ArrowTextControl).ApplyTemplate();
3409
                                    (currentControl as ArrowTextControl).Base_TextBox.Focus();
3410
                                    (currentControl as ArrowTextControl).isTrans = true;
3411 787a4489 KangIngu
                                }
3412
                            }
3413
                        }
3414
                        break;
3415
                    case ControlType.ArrowTextBorderControl:
3416 ca40e004 ljiyeon
                         {
3417 e6a9ddaf humkyung
                            if (e.LeftButton == MouseButtonState.Pressed)
3418 787a4489 KangIngu
                            {
3419
                                if (currentControl is ArrowTextControl)
3420
                                {
3421 ca40e004 ljiyeon
                                    //20180906 LJY TEST IsRotationDrawingEnable
3422
                                    if (IsGetoutpoint((currentControl as ArrowTextControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3423 e66f22eb KangIngu
                                    {
3424
                                        return;
3425
                                    }
3426
3427 f513c215 humkyung
                                    CreateCommand.Instance.Execute(currentControl);
3428 787a4489 KangIngu
                                    (currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false;
3429 49b217ad humkyung
                                    currentControl.IsNew = false;
3430 787a4489 KangIngu
                                    currentControl = null;
3431 5ce56a3a KangIngu
                                    this.MainAngle.Visibility = Visibility.Collapsed;
3432 787a4489 KangIngu
                                }
3433
                                else
3434
                                {
3435 e66f22eb KangIngu
                                    //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3436
                                    //{
3437 787a4489 KangIngu
                                        currentControl = new ArrowTextControl()
3438
                                        {
3439
                                            ArrowTextStyle = MarkupToPDF.Controls.Text.ArrowTextControl.ArrowTextStyleSet.Rect
3440
                                        };
3441 24678e06 humkyung
                                        currentControl.CommentID = Commons.shortGuid();
3442 787a4489 KangIngu
                                        currentControl.IsNew = true;
3443
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3444
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3445
3446
                                        currentControl.SetValue(Canvas.ZIndexProperty, 3);
3447
3448
                                        currentControl.SetValue(ArrowTextControl.StartPointProperty, canvasDrawingMouseDownPoint);
3449
3450
                                        currentControl.SetValue(ArrowTextControl.EndPointProperty, canvasDrawingMouseDownPoint);
3451
                                        (currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape;
3452 610a4b86 KangIngu
                                        (currentControl as ArrowTextControl).TextSize = ViewerDataModel.Instance.TextSize;
3453 787a4489 KangIngu
3454 ca40e004 ljiyeon
                                        //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 
3455
                                        (currentControl as ArrowTextControl).Angle -= rotate.Angle;
3456
                                        (currentControl as ArrowTextControl).ApplyTemplate();
3457 787a4489 KangIngu
                                        (currentControl as ArrowTextControl).Base_TextBox.Focus();
3458 ca40e004 ljiyeon
                                        this.MainAngle.Visibility = Visibility.Visible;                                    
3459 e66f22eb KangIngu
                                    //}
3460 787a4489 KangIngu
                                }
3461
                            }
3462
                        }
3463
                        break;
3464
                    case ControlType.ArrowTransTextBorderControl:
3465
                        {
3466 e6a9ddaf humkyung
                            if (e.LeftButton == MouseButtonState.Pressed)
3467 787a4489 KangIngu
                            {
3468
                                if (currentControl is ArrowTextControl)
3469
                                {
3470 ca40e004 ljiyeon
                                    //20180906 LJY TEST IsRotationDrawingEnable
3471
                                    if (IsGetoutpoint((currentControl as ArrowTextControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3472 e66f22eb KangIngu
                                    {
3473
                                        return;
3474
                                    }
3475 f513c215 humkyung
                                    CreateCommand.Instance.Execute(currentControl);
3476 787a4489 KangIngu
                                    (currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false;
3477 49b217ad humkyung
                                    currentControl.IsNew = false;
3478 787a4489 KangIngu
                                    currentControl = null;
3479 5ce56a3a KangIngu
                                    this.MainAngle.Visibility = Visibility.Collapsed;
3480 787a4489 KangIngu
                                }
3481
                                else
3482
                                {
3483 e66f22eb KangIngu
                                    //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3484
                                    //{
3485 ca40e004 ljiyeon
                                    
3486
3487
                                    currentControl = new ArrowTextControl()
3488 120b8b00 송근호
                                    {
3489
                                        ArrowTextStyle = MarkupToPDF.Controls.Text.ArrowTextControl.ArrowTextStyleSet.Rect,
3490
                                        ControlType = ControlType.ArrowTransTextBorderControl
3491
3492
                                    };
3493 24678e06 humkyung
                                        currentControl.CommentID = Commons.shortGuid();
3494 787a4489 KangIngu
                                        currentControl.IsNew = true;
3495
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3496
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3497
3498
                                        currentControl.SetValue(Canvas.ZIndexProperty, 3);
3499
3500
                                        currentControl.SetValue(ArrowTextControl.StartPointProperty, canvasDrawingMouseDownPoint);
3501 ca40e004 ljiyeon
                                        currentControl.SetValue(ArrowTextControl.EndPointProperty, canvasDrawingMouseDownPoint);                                    
3502 610a4b86 KangIngu
                                        (currentControl as ArrowTextControl).TextSize = ViewerDataModel.Instance.TextSize;
3503 787a4489 KangIngu
                                        (currentControl as ArrowTextControl).isFixed = true;
3504
                                        (currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape;
3505 ca40e004 ljiyeon
                                     
3506
                                        //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정  
3507
                                        (currentControl as ArrowTextControl).Angle -= rotate.Angle;
3508 787a4489 KangIngu
                                        (currentControl as ArrowTextControl).ApplyTemplate();
3509
3510 ca40e004 ljiyeon
                                        (currentControl as ArrowTextControl).Base_TextBox.Focus();                                 
3511 5ce56a3a KangIngu
                                        this.MainAngle.Visibility = Visibility.Visible;
3512 ca40e004 ljiyeon
                                    
3513
                                    //20180911 LJY
3514
                                        (currentControl as ArrowTextControl).isTrans = true;
3515
                                    
3516
3517 e66f22eb KangIngu
                                    //}
3518 787a4489 KangIngu
                                }
3519
                            }
3520
                        }
3521
                        break;
3522
                    case ControlType.ArrowTextCloudControl:
3523
                        {
3524 e6a9ddaf humkyung
                            if (e.LeftButton == MouseButtonState.Pressed)
3525 787a4489 KangIngu
                            {
3526
                                if (currentControl is ArrowTextControl)
3527
                                {
3528 ca40e004 ljiyeon
                                    //20180906 LJY TEST IsRotationDrawingEnable
3529
                                    if (IsGetoutpoint((currentControl as ArrowTextControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3530 e66f22eb KangIngu
                                    {
3531
                                        return;
3532
                                    }
3533 f513c215 humkyung
                                    CreateCommand.Instance.Execute(currentControl);
3534 787a4489 KangIngu
                                    (currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false;
3535 49b217ad humkyung
                                    currentControl.IsNew = false;
3536 787a4489 KangIngu
                                    currentControl = null;
3537 5ce56a3a KangIngu
                                    this.MainAngle.Visibility = Visibility.Collapsed;
3538 787a4489 KangIngu
                                }
3539
                                else
3540
                                {
3541 e66f22eb KangIngu
                                    //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3542
                                    //{
3543 787a4489 KangIngu
                                        currentControl = new ArrowTextControl()
3544
                                        {
3545
                                            ArrowTextStyle = MarkupToPDF.Controls.Text.ArrowTextControl.ArrowTextStyleSet.Cloud
3546
                                        };
3547 24678e06 humkyung
                                        currentControl.CommentID = Commons.shortGuid();
3548 787a4489 KangIngu
                                        currentControl.IsNew = true;
3549
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3550
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3551
3552
                                        currentControl.SetValue(Canvas.ZIndexProperty, 3);
3553
                                        currentControl.SetValue(ArrowTextControl.StartPointProperty, canvasDrawingMouseDownPoint);
3554 ca40e004 ljiyeon
                                        currentControl.SetValue(ArrowTextControl.EndPointProperty, canvasDrawingMouseDownPoint);                                 
3555 610a4b86 KangIngu
                                        (currentControl as ArrowTextControl).TextSize = ViewerDataModel.Instance.TextSize;
3556 787a4489 KangIngu
                                        (currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape;
3557
3558 ca40e004 ljiyeon
                                        //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정  
3559
                                        (currentControl as ArrowTextControl).Angle -= rotate.Angle;
3560
                                    
3561
                                        (currentControl as ArrowTextControl).ApplyTemplate();
3562 787a4489 KangIngu
                                        (currentControl as ArrowTextControl).Base_TextBox.Focus();
3563 ca40e004 ljiyeon
                                        this.MainAngle.Visibility = Visibility.Visible;                                        
3564 e66f22eb KangIngu
                                    //}
3565 787a4489 KangIngu
                                }
3566
                            }
3567
                        }
3568
                        break;
3569
                    case ControlType.ArrowTransTextCloudControl:
3570
                        {
3571 e6a9ddaf humkyung
                            if (e.LeftButton == MouseButtonState.Pressed)
3572 787a4489 KangIngu
                            {
3573
                                if (currentControl is ArrowTextControl)
3574
                                {
3575 ca40e004 ljiyeon
                                    //20180906 LJY TEST IsRotationDrawingEnable
3576
                                    if (IsGetoutpoint((currentControl as ArrowTextControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3577 e66f22eb KangIngu
                                    {
3578
                                        return;
3579
                                    }
3580 f513c215 humkyung
                                    CreateCommand.Instance.Execute(currentControl);
3581 787a4489 KangIngu
                                    (currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false;
3582 49b217ad humkyung
                                    currentControl.IsNew = false;
3583 787a4489 KangIngu
                                    currentControl = null;
3584 5ce56a3a KangIngu
                                    this.MainAngle.Visibility = Visibility.Collapsed;
3585 787a4489 KangIngu
                                }
3586
                                else
3587
                                {
3588 e66f22eb KangIngu
                                    //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3589
                                    //{
3590 787a4489 KangIngu
                                        currentControl = new ArrowTextControl()
3591
                                        {
3592 120b8b00 송근호
                                            ArrowTextStyle = MarkupToPDF.Controls.Text.ArrowTextControl.ArrowTextStyleSet.Cloud,
3593
                                            ControlType = ControlType.ArrowTransTextCloudControl
3594
3595 787a4489 KangIngu
                                        };
3596 24678e06 humkyung
                                        currentControl.CommentID = Commons.shortGuid();
3597 ca40e004 ljiyeon
                                        currentControl.IsNew = true; 
3598 787a4489 KangIngu
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3599
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3600
                                        currentControl.SetValue(Canvas.ZIndexProperty, 3);
3601
3602
                                        currentControl.SetValue(ArrowTextControl.StartPointProperty, canvasDrawingMouseDownPoint);
3603 ca40e004 ljiyeon
                                        currentControl.SetValue(ArrowTextControl.EndPointProperty, canvasDrawingMouseDownPoint);                                        
3604 610a4b86 KangIngu
                                        (currentControl as ArrowTextControl).TextSize = ViewerDataModel.Instance.TextSize;
3605 787a4489 KangIngu
                                        (currentControl as ArrowTextControl).isFixed = true;
3606
                                        (currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape;
3607
3608 ca40e004 ljiyeon
                                        //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 
3609
                                        (currentControl as ArrowTextControl).Angle -= rotate.Angle;
3610 787a4489 KangIngu
3611 ca40e004 ljiyeon
                                        (currentControl as ArrowTextControl).ApplyTemplate();
3612 787a4489 KangIngu
                                        (currentControl as ArrowTextControl).Base_TextBox.Focus();
3613 ca40e004 ljiyeon
                                        this.MainAngle.Visibility = Visibility.Visible;  
3614
                                    
3615
                                    //20180911 LJY
3616
                                        (currentControl as ArrowTextControl).isTrans = true;
3617 e66f22eb KangIngu
                                    //}
3618 787a4489 KangIngu
                                }
3619
                            }
3620
                        }
3621
                        break;
3622
                    //강인구 추가
3623
                    case ControlType.Sign:
3624
                        {
3625 e6a9ddaf humkyung
                            if (e.LeftButton == MouseButtonState.Pressed)
3626 787a4489 KangIngu
                            {
3627 e66f22eb KangIngu
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3628
                                //{
3629 cdfb57ff taeseongkim
                                    var _sign = GetUserSign.GetSign(App.ViewInfo.UserID, App.ViewInfo.ProjectNO,App.isExternal);
3630 992a98b4 KangIngu
3631
                                    if (_sign == null)
3632
                                    {
3633
                                        txtBatch.Visibility = Visibility.Collapsed;
3634
                                        mouseHandlingMode = IKCOM.MouseHandlingMode.None;
3635
                                        controlType = ControlType.None;
3636
3637
                                        this.ParentOfType<MainWindow>().DialogMessage_Alert("등록된 Sign이 없습니다.", "Alert");
3638
                                        this.ParentOfType<MainWindow>().ChildrenOfType<RadToggleButton>().Where(data => data.IsChecked == true).FirstOrDefault().IsChecked = false;
3639
                                        return;
3640
                                    }
3641
3642 787a4489 KangIngu
                                    if (currentControl is SignControl)
3643
                                    {
3644 ca40e004 ljiyeon
                                        //20180906 LJY TEST IsRotationDrawingEnable
3645
                                        if (IsGetoutpoint((currentControl as SignControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3646 e66f22eb KangIngu
                                        {
3647
                                            return;
3648
                                        }
3649
3650 f513c215 humkyung
                                        CreateCommand.Instance.Execute(currentControl);
3651 787a4489 KangIngu
                                        currentControl = null;
3652
                                        if (Common.ViewerDataModel.Instance.SelectedControl == "Batch")
3653
                                        {
3654 999c9e40 humkyung
                                            txtBatch.Text = "Place Date";
3655 787a4489 KangIngu
                                            controlType = ControlType.Date;
3656
                                        }
3657
                                    }
3658
                                    else
3659
                                    {
3660
                                        currentControl = new SignControl
3661
                                        {
3662
                                            Background = new SolidColorBrush(Colors.Black),
3663
                                            UserNumber = App.ViewInfo.UserID,
3664 a6272c57 humkyung
                                            ProjectNO = App.ViewInfo.ProjectNO,
3665 787a4489 KangIngu
                                            StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y),
3666
                                            EndPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y),
3667
                                            ControlType = ControlType.Sign
3668
                                        };
3669
3670 24678e06 humkyung
                                        currentControl.CommentID = Commons.shortGuid();
3671 787a4489 KangIngu
                                        currentControl.IsNew = true;
3672
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3673
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3674 ca40e004 ljiyeon
3675
                                        //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 
3676
                                        (currentControl as SignControl).Angle -= rotate.Angle;                                    
3677
                                }
3678 e66f22eb KangIngu
                                //}
3679 787a4489 KangIngu
                            }
3680
                        }
3681
                        break;
3682
                    case ControlType.Mark:
3683
                        {
3684 e6a9ddaf humkyung
                            if (e.LeftButton == MouseButtonState.Pressed)
3685 787a4489 KangIngu
                            {
3686 e66f22eb KangIngu
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3687
                                //{
3688 787a4489 KangIngu
                                    if (currentControl is RectangleControl)
3689
                                    {
3690 ca40e004 ljiyeon
                                        //20180906 LJY TEST IsRotationDrawingEnable
3691
                                        if (IsGetoutpoint((currentControl as RectangleControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3692 e66f22eb KangIngu
                                        {
3693
                                            return;
3694
                                        }
3695
3696 f513c215 humkyung
                                        CreateCommand.Instance.Execute(currentControl);
3697 787a4489 KangIngu
                                        (currentControl as RectangleControl).ApplyOverViewData();
3698
                                        currentControl = null;
3699 510cbd2a ljiyeon
                                    
3700
                                        this.cursor = new Cursor(MainWindow.CursorChange().StreamSource);
3701 787a4489 KangIngu
3702
                                        if (Common.ViewerDataModel.Instance.SelectedControl == "Batch")
3703
                                        {
3704 999c9e40 humkyung
                                            txtBatch.Text = "Place Signature";
3705 787a4489 KangIngu
                                            controlType = ControlType.Sign;
3706
                                        }
3707
                                    }
3708
                                    else
3709
                                    {
3710
                                        currentControl = new RectangleControl
3711
                                        {
3712 a6272c57 humkyung
                                            StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y),
3713 787a4489 KangIngu
                                            Background = new SolidColorBrush(Colors.Black),
3714 a6272c57 humkyung
                                            ControlType = ControlType.Mark ,
3715 787a4489 KangIngu
                                            Paint = PaintSet.Fill
3716
                                        };
3717
3718
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3719 24678e06 humkyung
                                        currentControl.CommentID = Commons.shortGuid();
3720 787a4489 KangIngu
                                        currentControl.IsNew = true;
3721
                                        (currentControl as RectangleControl).DashSize = ViewerDataModel.Instance.DashSize;
3722
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3723
                                    }
3724 e66f22eb KangIngu
                                //}
3725 787a4489 KangIngu
                            }
3726
                        }
3727
                        break;
3728
                    case ControlType.Symbol:
3729
                        {
3730 e6a9ddaf humkyung
                            if (e.LeftButton == MouseButtonState.Pressed)
3731 787a4489 KangIngu
                            {
3732 a6272c57 humkyung
                                if (currentControl is SymControl)
3733
                                {
3734
                                    //20180906 LJY TEST IsRotationDrawingEnable
3735
                                    if (IsGetoutpoint((currentControl as SymControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3736 787a4489 KangIngu
                                    {
3737 a6272c57 humkyung
                                        return;
3738 787a4489 KangIngu
                                    }
3739 a6272c57 humkyung
                                    CreateCommand.Instance.Execute(currentControl);
3740
                                    currentControl = null;
3741
                                
3742
                                    this.cursor = new Cursor(MainWindow.CursorChange().StreamSource);
3743
                                }
3744
                                else
3745
                                {
3746
                                    currentControl = new SymControl
3747 787a4489 KangIngu
                                    {
3748 a6272c57 humkyung
                                        StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y),
3749
                                        Background = new SolidColorBrush(Colors.Black),
3750
                                        LineSize = ViewerDataModel.Instance.LineSize + 3,
3751
                                        ControlType = ControlType.Symbol
3752
                                    };
3753 787a4489 KangIngu
3754 a6272c57 humkyung
                                    currentControl.IsNew = true;
3755
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3756
                                    currentControl.CommentID = Commons.shortGuid();
3757
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3758 ca40e004 ljiyeon
3759 a6272c57 humkyung
                                    //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정  
3760
                                    (currentControl as SymControl).Angle -= rotate.Angle;
3761 ca40e004 ljiyeon
                                }
3762 e66f22eb KangIngu
                                //}
3763 787a4489 KangIngu
                            }
3764
                        }
3765
                        break;
3766
                    case ControlType.Stamp:
3767
                        {
3768 e6a9ddaf humkyung
                            if (e.LeftButton == MouseButtonState.Pressed)
3769 787a4489 KangIngu
                            {
3770 e66f22eb KangIngu
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3771
                                //{
3772 787a4489 KangIngu
                                    if (currentControl is SymControlN)
3773
                                    {
3774 ca40e004 ljiyeon
                                        //20180906 LJY TEST IsRotationDrawingEnable
3775
                                        if (IsGetoutpoint((currentControl as SymControlN).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3776 e66f22eb KangIngu
                                        {
3777
                                            return;
3778
                                        }
3779
3780 f513c215 humkyung
                                        CreateCommand.Instance.Execute(currentControl);
3781 787a4489 KangIngu
                                        currentControl = null;
3782 510cbd2a ljiyeon
                                   
3783
3784
                                    this.cursor = new Cursor(MainWindow.CursorChange().StreamSource);
3785 787a4489 KangIngu
                                    }
3786
                                    else
3787
                                    {
3788
                                        currentControl = new SymControlN
3789
                                        {
3790
                                            StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y),
3791
                                            Background = new SolidColorBrush(Colors.Black),
3792 cd988cd8 djkim
                                            STAMP = App.SystemInfo.STAMP,                                            
3793 787a4489 KangIngu
                                            ControlType = ControlType.Stamp
3794
                                        };
3795
3796
                                        currentControl.IsNew = true;
3797
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3798 24678e06 humkyung
                                        currentControl.CommentID = Commons.shortGuid();
3799 787a4489 KangIngu
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3800 ca40e004 ljiyeon
                                        //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정  
3801
                                        (currentControl as SymControlN).Angle -= rotate.Angle;
3802
                                }                                    
3803 e66f22eb KangIngu
                                //}
3804 787a4489 KangIngu
                            }
3805
                        }
3806
                        break;
3807
                    case ControlType.PenControl:
3808
                        {
3809
                            if (inkBoard.Tag.ToString() == "Ink")
3810
                            {
3811
                                inkBoard.IsEnabled = true;
3812
                                StartNewStroke(canvasDrawingMouseDownPoint);
3813
                            }
3814
                            else if (inkBoard.Tag.ToString() == "EraseByPoint")
3815
                            {
3816
                                RemovePointStroke(canvasDrawingMouseDownPoint);
3817
                            }
3818
                            else if (inkBoard.Tag.ToString() == "EraseByStroke")
3819
                            {
3820
                                RemoveLineStroke(canvasDrawingMouseDownPoint);
3821
                            }
3822
                            IsDrawing = true;
3823
                            return;
3824
                        }
3825
                    default:
3826
                        if (currentControl != null)
3827
                        {
3828
                            currentControl.CommentID = null;
3829
                            currentControl.IsNew = false;
3830
                        }
3831
                        break;
3832
                }
3833
            }
3834 e6a9ddaf humkyung
            if (mouseHandlingMode != MouseHandlingMode.None && e.LeftButton == MouseButtonState.Pressed)
3835 787a4489 KangIngu
            {
3836
                if (mouseHandlingMode == MouseHandlingMode.Adorner && SelectLayer.Children.Count > 0)
3837
                {
3838
                    bool mouseOff = false;
3839
                    foreach (var item in SelectLayer.Children)
3840
                    {
3841
                        if (item is AdornerFinal)
3842
                        {
3843
3844 4913851c humkyung
                            var over = (item as AdornerFinal).Members.Where(data => data.DrawingData.IsMouseOver).FirstOrDefault();
3845 787a4489 KangIngu
                            if (over != null)
3846
                            {
3847
                                mouseOff = true;
3848
                            }
3849
                        }
3850
                    }
3851
3852
                    if (!mouseOff)
3853
                    {
3854 077896be humkyung
                        SelectionSet.Instance.UnSelect(this);
3855 787a4489 KangIngu
                    }
3856
                }
3857
                zoomAndPanControl.CaptureMouse();
3858
                e.Handled = true;
3859
            }
3860 5d55f6fb ljiyeon
          
3861 787a4489 KangIngu
        }
3862 e54660e8 KangIngu
3863 a1716fa5 KangIngu
        private void zoomAndPanControl2_MouseDown(object sender, MouseButtonEventArgs e)
3864
        {
3865 e6a9ddaf humkyung
            ///mouseButtonDown = e.ChangedButton;
3866 a1716fa5 KangIngu
            canvasZoommovingMouseDownPoint = e.GetPosition(zoomAndPanCanvas2);
3867
        }
3868
3869 787a4489 KangIngu
        private void RemoveLineStroke(Point P)
3870
        {
3871 05009a0e ljiyeon
            var control = ViewerDataModel.Instance.MarkupControls_USER.Where(data => data.IsMouseOver).FirstOrDefault();
3872 787a4489 KangIngu
            if (control != null)
3873
            {
3874 f729ef4e humkyung
                DeleteCommand.Instance.Execute(new List<CommentUserInfo>() { control });
3875 787a4489 KangIngu
            }
3876
        }
3877
3878
        private void RemovePointStroke(Point P)
3879
        {
3880
            foreach (Stroke hits in inkBoard.Strokes)
3881
            {
3882
                foreach (StylusPoint sty in hits.StylusPoints)
3883
                {
3884
3885
                }
3886
                if (hits.HitTest(P))
3887
                {
3888
                    inkBoard.Strokes.Remove(hits);
3889
                    return;
3890
                }
3891
            }
3892
        }
3893
3894
        private void StartNewStroke(Point P)
3895
        {
3896
            strokePoints = new StylusPointCollection();
3897
            StylusPoint segment1Start = new StylusPoint(P.X, P.Y);
3898
            strokePoints.Add(segment1Start);
3899
            stroke = new Stroke(strokePoints);
3900
3901
            stroke.DrawingAttributes.Color = Colors.Red;
3902
            stroke.DrawingAttributes.Width = 4;
3903
            stroke.DrawingAttributes.Height = 4;
3904
3905
            inkBoard.Strokes.Add(stroke);
3906
        }
3907
3908
        private void btnConsolidate_Click(object sender, RoutedEventArgs e)
3909
        {
3910
            ConsolidationMethod();
3911
        }
3912
3913 102476f6 humkyung
        /// <summary>
3914
        /// execute TeamConsolidationCommand
3915
        /// </summary>
3916 04a7385a djkim
        public void TeamConsolidationMethod()
3917
        {
3918 102476f6 humkyung
            this.UpdateMyMarkupList();
3919 04a7385a djkim
            if (this.gridViewMarkup.SelectedItems.Count == 0)
3920
            {
3921
                this.ParentOfType<MainWindow>().DialogMessage_Alert("Please select at least one user", "Alert");
3922
            }
3923
            else
3924
            {
3925 8129f2a5 ljiyeon
3926
                ViewerDataModel.Instance.IsConsolidate = true;
3927
                this.ParentOfType<MainWindow>().dzTopMenu._SaveEvent(null, null);
3928
3929 04a7385a djkim
                foreach (MarkupInfoItem item in this.gridViewMarkup.SelectedItems)
3930
                {
3931
                    if (!this.userData.DEPARTMENT.Equals(item.Depatment))
3932
                    {
3933
                        this.ParentOfType<MainWindow>().DialogMessage_Alert("Please select at your department", "Alert");
3934
                        return;
3935
                    }                    
3936
                }
3937 102476f6 humkyung
                List<MarkupInfoItem> MarkupInfoList = new List<MarkupInfoItem>();
3938 04a7385a djkim
                foreach (MarkupInfoItem item in this.gridViewMarkup.SelectedItems)
3939 90e7968d ljiyeon
                {
3940 102476f6 humkyung
                    MarkupInfoList.Add(item);
3941 04a7385a djkim
                }
3942 102476f6 humkyung
                TeamConsolidateCommand.Instance.Execute(MarkupInfoList);
3943 04a7385a djkim
            }
3944
        }
3945 102476f6 humkyung
3946 787a4489 KangIngu
        public void ConsolidationMethod()
3947
        {
3948
            if (this.gridViewMarkup.SelectedItems.Count == 0)
3949
            {
3950
                this.ParentOfType<MainWindow>().DialogMessage_Alert("Please select at least one user", "Alert");
3951
            }
3952
            else
3953 90e7968d ljiyeon
            {
3954 35a96e24 humkyung
                List<IKCOM.MarkupInfoItem> MySelectItem = new List<IKCOM.MarkupInfoItem>();
3955
                foreach (var item in this.gridViewMarkup.SelectedItems)
3956
                {
3957
                    MySelectItem.Add(item as IKCOM.MarkupInfoItem);
3958
                }
3959
                int iPageNo = Convert.ToInt32(this.ParentOfType<MainWindow>().dzTopMenu.tlcurrentPage.Text);
3960 8129f2a5 ljiyeon
                
3961 35a96e24 humkyung
                ConsolidateCommand.Instance.Execute(MySelectItem, iPageNo);
3962 787a4489 KangIngu
            }
3963
        }
3964
3965
        private void btnConsolidate_Loaded(object sender, RoutedEventArgs e)
3966
        {
3967
            if (App.ViewInfo != null)
3968
            {
3969
                btnConsolidate = (sender as RadRibbonButton);
3970
                if (!App.ViewInfo.NewCommentPermission)
3971
                {
3972
                    (sender as RadRibbonButton).Visibility = System.Windows.Visibility.Collapsed;
3973
                }
3974
            }
3975
        }
3976
3977
        private void btnTeamConsolidate_Click(object sender, RoutedEventArgs e)
3978
        {
3979 04a7385a djkim
            TeamConsolidationMethod();
3980 787a4489 KangIngu
        }
3981
3982
        private void btnTeamConsolidate_Loaded(object sender, RoutedEventArgs e)
3983
        {
3984
            btnTeamConsolidate = sender as RadRibbonButton;
3985
            if (App.ViewInfo != null)
3986
            {
3987
                if (!App.ViewInfo.CreateFinalPDFPermission) //파이널이 True가 아니면
3988
                {
3989
                    if (btnConsolidate != null)
3990
                    {
3991
                        btnConsolidate.Visibility = Visibility.Collapsed;
3992
                    }
3993
3994
                    if (!App.ViewInfo.NewCommentPermission)
3995
                    {
3996
                        btnTeamConsolidate.Visibility = Visibility.Collapsed;
3997
                    }
3998
                }
3999
                else
4000
                {
4001
                    btnTeamConsolidate.Visibility = Visibility.Collapsed;
4002
                }
4003
            }
4004
        }
4005
4006
        private void FinalPDFEvent(object sender, RoutedEventArgs e)
4007
        {
4008 3b62305d ljiyeon
            var item = gridViewMarkup.Items.Cast<MarkupInfoItem>().Where(d => d.Consolidate == 1 && d.AvoidConsolidate == 0).FirstOrDefault();
4009
            if (BaseClient.FinalPDF_GetFinalPDFStatus(_DocInfo.ID, item.MarkupInfoID, _ViewInfo.UserID))
4010 787a4489 KangIngu
            {
4011 81e3c9f6 ljiyeon
                if (item != null)
4012
                {
4013
                    Logger.sendReqLog("SetFinalPDFAsync", _ViewInfo.ProjectNO + "," + _DocInfo.ID + "," + item.MarkupInfoID + "," + _ViewInfo.UserID, 1);
4014
                    BaseClient.SetFinalPDFAsync(_ViewInfo.ProjectNO, _DocInfo.ID, item.MarkupInfoID, _ViewInfo.UserID);
4015
                }
4016
                else
4017
                {
4018
                    DialogMessage_Alert("Consolidation 된 코멘트가 존재하지 않습니다", "안내");
4019
                }
4020 787a4489 KangIngu
            }
4021
            else
4022
            {
4023 81e3c9f6 ljiyeon
                DialogMessage_Alert("Merged PDF가 수행중입니다", "안내");
4024 787a4489 KangIngu
            }
4025
        }
4026
4027
        private void btnFinalPDF_Loaded(object sender, RoutedEventArgs e)
4028
        {
4029
            btnFinalPDF = sender as RadRibbonButton;
4030
            if (App.ViewInfo != null)
4031
            {
4032
                if (!App.ViewInfo.CreateFinalPDFPermission) //파이널이 True가 아니면
4033
                {
4034
                    btnFinalPDF.Visibility = System.Windows.Visibility.Collapsed;
4035
                    if (btnConsolidate != null)
4036
                    {
4037
                        btnConsolidate.Visibility = Visibility.Collapsed;
4038
                    }
4039
                }
4040
            }
4041
        }
4042
4043 80458c15 ljiyeon
        private void ConsolidateFinalPDFEvent(object sender, RoutedEventArgs e)
4044
        {
4045 d62c0439 humkyung
            UpdateMyMarkupList();
4046 80458c15 ljiyeon
4047
            if (this.gridViewMarkup.SelectedItems.Count == 0)
4048
            {
4049
                this.ParentOfType<MainWindow>().DialogMessage_Alert("Please select at least one user", "Alert");
4050
            }
4051
            else
4052
            {
4053
                ViewerDataModel.Instance.IsConsolidate = true;
4054
                this.ParentOfType<MainWindow>().dzTopMenu._SaveEvent(null, null);
4055
                List<KCOMDataModel.DataModel.MARKUP_DATA> instanceDataSet = new List<KCOMDataModel.DataModel.MARKUP_DATA>();
4056
4057
                string project_no = App.ViewInfo.ProjectNO;
4058
                string doc_id = _DocInfo.ID;
4059
                string user_id = App.ViewInfo.UserID;
4060
                List<MarkupInfoItem> markupInfoItems = new List<MarkupInfoItem>();
4061
                foreach (MarkupInfoItem item in this.gridViewMarkup.SelectedItems)
4062
                {
4063
                    markupInfoItems.Add(item);
4064
                }
4065
                Logger.sendReqLog("Consolidate", project_no + "," + user_id + "," + doc_id + "," + markupInfoItems, 1);
4066
                Logger.sendResLog("Consolidate", this.BaseClient.Consolidate(project_no, user_id, doc_id, markupInfoItems).ToString(), 1);
4067
                Logger.sendReqLog("GetMarkupInfoItemsAsync", App.ViewInfo.ProjectNO + "," + _DocInfo.ID, 1);
4068 1126281e djkim
                var items = this.BaseClient.GetMarkupInfoItems(App.ViewInfo.ProjectNO, _DocInfo.ID);
4069 80458c15 ljiyeon
4070 1126281e djkim
                var item2 = items.Where(d => d.Consolidate == 1 && d.AvoidConsolidate == 0).FirstOrDefault();
4071 80458c15 ljiyeon
                if (item2 != null)
4072
                {
4073
                    Logger.sendReqLog("SetFinalPDFAsync", _ViewInfo.ProjectNO + "," + _DocInfo.ID + "," + item2.MarkupInfoID + "," + _ViewInfo.UserID, 1);
4074
4075
                    BaseClient.SetFinalPDFAsync(_ViewInfo.ProjectNO, _DocInfo.ID, item2.MarkupInfoID, _ViewInfo.UserID);
4076 1126281e djkim
                    BaseClient.GetMarkupInfoItemsAsync(App.ViewInfo.ProjectNO, _DocInfo.ID);
4077 80458c15 ljiyeon
                }
4078
                else
4079
                {
4080
                    DialogMessage_Alert("Consolidation 된 코멘트가 존재하지 않습니다", "안내");
4081
                }
4082 90e7968d ljiyeon
            }
4083 80458c15 ljiyeon
        }
4084
4085
        private void btnConsolidateFinalPDF_Loaded(object sender, RoutedEventArgs e)
4086 90e7968d ljiyeon
        {
4087 80458c15 ljiyeon
            btnConsolidateFinalPDF = (sender as RadRibbonButton);
4088
4089
            if (App.ViewInfo != null)
4090
            {
4091
                if (!App.ViewInfo.NewCommentPermission || !App.ViewInfo.CreateFinalPDFPermission)
4092
                {
4093 90e7968d ljiyeon
                    btnConsolidateFinalPDF.Visibility = System.Windows.Visibility.Collapsed;
4094 80458c15 ljiyeon
                }
4095 90e7968d ljiyeon
            }
4096 80458c15 ljiyeon
        }
4097
4098 787a4489 KangIngu
        private void SyncCompare_Click(object sender, RoutedEventArgs e)
4099
        {
4100
            if (CompareMode.IsChecked)
4101
            {
4102
                if (ViewerDataModel.Instance.PageBalanceMode && ViewerDataModel.Instance.PageBalanceNumber == 0)
4103
                {
4104
                    ViewerDataModel.Instance.PageBalanceNumber = 1;
4105
                }
4106
                if (ViewerDataModel.Instance.PageNumber == 0)
4107
                {
4108
                    ViewerDataModel.Instance.PageNumber = 1;
4109
                }
4110
4111 90e7968d ljiyeon
                Logger.sendReqLog("GetCompareRectAsync", _ViewInfo.ProjectNO + "," + _ViewInfo.DocumentItemID + "," + CurrentRev.DOCUMENT_ID +
4112 0f065e57 ljiyeon
                    "," + pageNavigator.CurrentPage.PageNumber.ToString() + "," + ViewerDataModel.Instance.PageNumber.ToString() + "," +
4113 90e7968d ljiyeon
                    userData.COMPANY != "EXT" ? "true" : "false", 1);
4114 0f065e57 ljiyeon
4115 d9cf7d6e djkim
                BaseClient.GetCompareRectAsync(_ViewInfo.ProjectNO, _ViewInfo.DocumentItemID, CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber.ToString(), ViewerDataModel.Instance.PageNumber.ToString(), userData.COMPANY != "EXT" ? "true" : "false");
4116 787a4489 KangIngu
            }
4117
            else
4118
            {
4119
                da.From = 1;
4120
                da.To = 1;
4121
                da.Duration = new Duration(TimeSpan.FromSeconds(9999));
4122
                da.AutoReverse = false;
4123
                canvas_compareBorder.Children.Clear();
4124
                canvas_compareBorder.BeginAnimation(OpacityProperty, da);
4125
            }
4126
        }
4127
4128 9cd2865b KangIngu
        private void Sync_Click(object sender, RoutedEventArgs e)
4129
        {
4130 a1716fa5 KangIngu
            if (Sync.IsChecked)
4131 9cd2865b KangIngu
            {
4132
                ViewerDataModel.Instance.Sync_ContentOffsetX = zoomAndPanControl.ContentOffsetX;
4133
                ViewerDataModel.Instance.Sync_ContentOffsetY = zoomAndPanControl.ContentOffsetY;
4134
                ViewerDataModel.Instance.Sync_ContentScale = zoomAndPanControl.ContentScale;
4135
            }
4136
        }
4137
4138 787a4489 KangIngu
        private void SyncUserListExpender_Click(object sender, RoutedEventArgs e)
4139
        {
4140
            if (UserList.IsChecked)
4141
            {
4142
                this.gridViewRevMarkup.Visibility = Visibility.Visible;
4143
            }
4144
            else
4145
            {
4146
                this.gridViewRevMarkup.Visibility = Visibility.Collapsed;
4147
            }
4148
        }
4149
4150
        private void SyncPageBalance_Click(object sender, RoutedEventArgs e)
4151
        {
4152
4153
            if (BalanceMode.IsChecked)
4154
            {
4155
                ViewerDataModel.Instance.PageBalanceMode = true;
4156
            }
4157
            else
4158
            {
4159
                ViewerDataModel.Instance.PageBalanceMode = false;
4160
                ViewerDataModel.Instance.PageBalanceNumber = 0;
4161
            }
4162
        }
4163
4164
        private void SyncExit_Click(object sender, RoutedEventArgs e)
4165
        {
4166
            //초기화
4167
            testPanel2.IsHidden = true;
4168
            ViewerDataModel.Instance.PageBalanceMode = false;
4169
            ViewerDataModel.Instance.PageBalanceNumber = 0;
4170
            ViewerDataModel.Instance.PageNumber = 0;
4171
            ViewerDataModel.Instance.MarkupControls_Sync.Clear();
4172
            this.gridViewRevMarkup.Visibility = Visibility.Collapsed;
4173
            UserList.IsChecked = false;
4174
            BalanceMode.IsChecked = false;
4175
        }
4176
4177
        private void SyncPageChange_Click(object sender, RoutedEventArgs e)
4178
        {
4179
            if ((sender as System.Windows.Controls.Control).Tag != null)
4180
            {
4181
                //Compare 초기화
4182
                CompareMode.IsChecked = false;
4183
                var balancePoint = Convert.ToInt32((sender as System.Windows.Controls.Control).Tag);
4184
4185
                if (ViewerDataModel.Instance.PageNumber == 0)
4186
                {
4187
                    ViewerDataModel.Instance.PageNumber = 1;
4188
                }
4189
4190
                if (ViewerDataModel.Instance.PageBalanceNumber == pageNavigator.PageCount)
4191
                {
4192
                }
4193
                else
4194
                {
4195
                    ViewerDataModel.Instance.PageBalanceNumber += balancePoint;
4196
                }
4197
4198
                if (ViewerDataModel.Instance.PageNumber == pageNavigator.PageCount && balancePoint > 0)
4199
                {
4200
4201
                }
4202
                else if ((ViewerDataModel.Instance.PageNumber + balancePoint) >= 1)
4203
                {
4204
                    ViewerDataModel.Instance.PageNumber += balancePoint;
4205
                }
4206
4207
                if (!testPanel2.IsHidden)
4208
                {
4209
                    if (IsSyncPDFMode)
4210
                    {
4211
                        Get_FinalImage.Get_PdfImage get_PdfImage = new Get_FinalImage.Get_PdfImage();
4212
                        var pdfpath = new BitmapImage(new Uri(get_PdfImage.Run(CurrentRev.TO_VENDOR, App.ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, ViewerDataModel.Instance.PageNumber)));
4213
4214
                        if (pdfpath.IsDownloading)
4215
                        {
4216
                            pdfpath.DownloadCompleted += (ex, arg) =>
4217
                            {
4218
                                ViewerDataModel.Instance.ImageViewPath_C = pdfpath;
4219
                                ViewerDataModel.Instance.ImageViewWidth_C = pdfpath.PixelWidth;
4220
                                ViewerDataModel.Instance.ImageViewHeight_C = pdfpath.PixelHeight;
4221
                                zoomAndPanCanvas2.Width = pdfpath.PixelWidth;
4222
                                zoomAndPanCanvas2.Height = pdfpath.PixelHeight;
4223
                            };
4224
                        }
4225
                        else
4226
                        {
4227
                            ViewerDataModel.Instance.ImageViewPath_C = pdfpath;
4228
                            ViewerDataModel.Instance.ImageViewWidth_C = pdfpath.PixelWidth;
4229
                            ViewerDataModel.Instance.ImageViewHeight_C = pdfpath.PixelHeight;
4230
4231
                            zoomAndPanCanvas2.Width = pdfpath.PixelWidth;
4232
                            zoomAndPanCanvas2.Height = pdfpath.PixelHeight;
4233
                        }
4234
4235
                    }
4236
                    else
4237
                    {
4238 a874198d humkyung
                        string uri = "";
4239
4240
                        if (userData.COMPANY != "EXT")
4241
                        {
4242 84c48033 djkim
                            uri = String.Format(CommonLib.Common.GetConfigString("mainServerImageWebPath", "URL", "", App.isExternal), _ViewInfo.ProjectNO, (Convert.ToUInt32(CurrentRev.DOCUMENT_ID) / 100).ToString(), CurrentRev.DOCUMENT_ID, ViewerDataModel.Instance.PageNumber);
4243 a874198d humkyung
                        }
4244
                        else
4245
                        {
4246 84c48033 djkim
                            uri = String.Format(CommonLib.Common.GetConfigString("subServerImageWebPath", "URL", "", App.isExternal), _ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, ViewerDataModel.Instance.PageNumber);
4247 a874198d humkyung
                        }
4248 787a4489 KangIngu
4249
                        var defaultBitmapImage_Compare = new BitmapImage(new Uri(uri));
4250
4251
                        ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare;
4252
                        ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth;
4253
                        ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight;
4254
4255
                        zoomAndPanCanvas2.Width = defaultBitmapImage_Compare.PixelWidth;
4256
                        zoomAndPanCanvas2.Height = defaultBitmapImage_Compare.PixelHeight;
4257
4258
                        if (defaultBitmapImage_Compare.IsDownloading)
4259
                        {
4260
                            defaultBitmapImage_Compare.DownloadCompleted += (ex, arg) =>
4261
                            {
4262
                                ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare;
4263
                                ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth;
4264
                                ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight;
4265
4266
                                zoomAndPanCanvas2.Width = defaultBitmapImage_Compare.PixelWidth;
4267
                                zoomAndPanCanvas2.Height = defaultBitmapImage_Compare.PixelHeight;
4268
                            };
4269
                        }
4270
                    }
4271
4272
                    //강인구 추가(페이지 이동시 코멘트 재 호출)
4273
                    ViewerDataModel.Instance.MarkupControls_Sync.Clear();
4274
                    List<MarkupInfoItem> gridSelectionRevItem = gridViewRevMarkup.SelectedItems.Cast<MarkupInfoItem>().ToList();
4275
4276
                    foreach (var item in gridSelectionRevItem)
4277
                    {
4278
                        item.MarkupList.Where(pageItem => pageItem.PageNumber == ViewerDataModel.Instance.PageNumber).ToList().ForEach(delegate (MarkupItem markupitem)
4279
                        {
4280 661b7416 humkyung
                            MarkupParser.ParseEx(App.ViewInfo.ProjectNO, markupitem.Data, Common.ViewerDataModel.Instance.MarkupControls_Sync, item.DisplayColor, "", item.MarkupInfoID);
4281 787a4489 KangIngu
                        });
4282
                    }
4283 e54660e8 KangIngu
4284 787a4489 KangIngu
                    //강인구 추가
4285
                    zoomAndPanControl2.ZoomTo(new Rect
4286
                    {
4287
                        X = 0,
4288
                        Y = 0,
4289
                        Width = Math.Max(zoomAndPanCanvas.Width, zoomAndPanCanvas2.Width),
4290
                        Height = Math.Max(zoomAndPanCanvas.Height, zoomAndPanCanvas2.Height),
4291
                    });
4292 ae56d52d KangIngu
4293 787a4489 KangIngu
                    tlSyncPageNum.Text = String.Format("Current Page : {0}", ViewerDataModel.Instance.PageNumber);
4294
4295
                }
4296
            }
4297
        }
4298
4299
        private void SyncChange_Click(object sender, RoutedEventArgs e)
4300
        {
4301
            if (MarkupMode.IsChecked)
4302
            {
4303
                IsSyncPDFMode = true;
4304
4305
                var uri = CurrentRev.TO_VENDOR;
4306 ae56d52d KangIngu
4307 787a4489 KangIngu
                if (ViewerDataModel.Instance.PageNumber == 0)
4308
                {
4309
                    ViewerDataModel.Instance.PageNumber = 1;
4310
                }
4311
4312
                //PDF모드 잠시 대기(강인구)
4313
                Get_FinalImage.Get_PdfImage get_PdfImage = new Get_FinalImage.Get_PdfImage();
4314
                var pdfpath = new BitmapImage(new Uri(get_PdfImage.Run(CurrentRev.TO_VENDOR, App.ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, ViewerDataModel.Instance.PageNumber)));
4315
4316
                if (pdfpath.IsDownloading)
4317
                {
4318
                    pdfpath.DownloadCompleted += (ex, arg) =>
4319
                    {
4320
                        ViewerDataModel.Instance.ImageViewPath_C = pdfpath;
4321
                        ViewerDataModel.Instance.ImageViewWidth_C = pdfpath.PixelWidth;
4322
                        ViewerDataModel.Instance.ImageViewHeight_C = pdfpath.PixelHeight;
4323
                        zoomAndPanCanvas2.Width = pdfpath.PixelWidth;
4324
                        zoomAndPanCanvas2.Height = pdfpath.PixelHeight;
4325
                    };
4326
                }
4327
                else
4328
                {
4329
                    ViewerDataModel.Instance.ImageViewPath_C = pdfpath;
4330
                    ViewerDataModel.Instance.ImageViewWidth_C = pdfpath.PixelWidth;
4331
                    ViewerDataModel.Instance.ImageViewHeight_C = pdfpath.PixelHeight;
4332
4333
                    zoomAndPanCanvas2.Width = pdfpath.PixelWidth;
4334
                    zoomAndPanCanvas2.Height = pdfpath.PixelHeight;
4335
                }
4336
            }
4337
            else
4338
            {
4339
                IsSyncPDFMode = false;
4340 a874198d humkyung
                string uri = "";
4341
                if (userData.COMPANY != "EXT")
4342
                {
4343 84c48033 djkim
                    uri = String.Format(CommonLib.Common.GetConfigString("mainServerImageWebPath", "URL", "", App.isExternal), _ViewInfo.ProjectNO, (Convert.ToUInt32(CurrentRev.DOCUMENT_ID) / 100).ToString(), CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber);
4344 a874198d humkyung
                }
4345
                else
4346
                {
4347 84c48033 djkim
                    uri = String.Format(CommonLib.Common.GetConfigString("subServerImageWebPath", "URL", "", App.isExternal), _ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber);
4348 a874198d humkyung
                }
4349 787a4489 KangIngu
4350
                var defaultBitmapImage_Compare = new BitmapImage(new Uri(uri));
4351
4352
                ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare;
4353
                ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth;
4354
                ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight;
4355
4356
                if (defaultBitmapImage_Compare.IsDownloading)
4357
                {
4358
                    defaultBitmapImage_Compare.DownloadCompleted += (ex, arg) =>
4359
                    {
4360
                        ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare;
4361
                        ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth;
4362
                        ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight;
4363
                    };
4364
                }
4365
                zoomAndPanControl2.ApplyTemplate();
4366
                zoomAndPanControl2.UpdateLayout();
4367
                zoomAndPanCanvas2.Width = Convert.ToDouble(Common.ViewerDataModel.Instance.ContentWidth);
4368
                zoomAndPanCanvas2.Height = Convert.ToDouble(Common.ViewerDataModel.Instance.ContentHeight);
4369
            }
4370
        }
4371
4372
        private void RadButton_Click(object sender, RoutedEventArgs e)
4373
        {
4374
            gridViewHistory_Busy.IsBusy = true;
4375
4376
            RadButton instance = sender as RadButton;
4377
            if (instance.CommandParameter != null)
4378
            {
4379
                CurrentRev = instance.CommandParameter as VPRevision;
4380
                BaseClient.GetSyncMarkupInfoItemsCompleted += (sen, ea) =>
4381
                {
4382
                    if (ea.Error == null && ea.Result != null)
4383
                    {
4384
                        testPanel2.IsHidden = false;
4385
4386 d128ceb2 humkyung
                        ViewerDataModel.Instance._markupInfoRevList.Clear();
4387
                        foreach(var info in ea.Result)
4388
                        {
4389
                            if(info.UserID == App.ViewInfo.UserID)
4390
                            {
4391
                                info.userDelete = true;
4392
                                info.DisplayColor = "FFFF0000";
4393
                            }
4394
                            else
4395
                            {
4396
                                info.userDelete = false;
4397
                            }
4398
                            ViewerDataModel.Instance._markupInfoRevList.Add(info);
4399
                        }
4400 787a4489 KangIngu
                        gridViewRevMarkup.ItemsSource = ViewerDataModel.Instance._markupInfoRevList;
4401
4402 a874198d humkyung
                        string uri = "";
4403
                        if (userData.COMPANY != "EXT")
4404
                        {
4405 84c48033 djkim
                            uri = String.Format(CommonLib.Common.GetConfigString("mainServerImageWebPath", "URL", "", App.isExternal), _ViewInfo.ProjectNO, (Convert.ToUInt32(CurrentRev.DOCUMENT_ID) / 100).ToString(), CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber);
4406 a874198d humkyung
                        }
4407
                        else
4408
                        {
4409 84c48033 djkim
                            uri = String.Format(CommonLib.Common.GetConfigString("subServerImageWebPath", "URL", "", App.isExternal), _ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber);
4410 a874198d humkyung
                        }
4411 787a4489 KangIngu
4412
                        Sync_Offset_Point = new Point(zoomAndPanControl.ContentOffsetX, zoomAndPanControl.ContentOffsetY);
4413
4414 497bbe52 ljiyeon
                        var defaultBitmapImage_Compare = new BitmapImage();
4415
                        defaultBitmapImage_Compare.BeginInit();
4416
                        defaultBitmapImage_Compare.CacheOption = BitmapCacheOption.OnLoad;
4417
                        defaultBitmapImage_Compare.UriSource = new Uri(uri);
4418
                        defaultBitmapImage_Compare.EndInit();
4419 787a4489 KangIngu
4420
                        if (defaultBitmapImage_Compare.IsDownloading)
4421
                        {
4422
                            defaultBitmapImage_Compare.DownloadCompleted += (ex, arg) =>
4423
                            {
4424 497bbe52 ljiyeon
                                defaultBitmapImage_Compare.Freeze();
4425 787a4489 KangIngu
                                ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare;
4426
                                ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth;
4427
                                ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight;
4428 497bbe52 ljiyeon
                                zoomAndPanCanvas2.Width = defaultBitmapImage_Compare.PixelWidth;
4429
                                zoomAndPanCanvas2.Height = defaultBitmapImage_Compare.PixelHeight;
4430 787a4489 KangIngu
                            };
4431 497bbe52 ljiyeon
                        }                        
4432 787a4489 KangIngu
                        zoomAndPanControl2.ApplyTemplate();
4433
                        zoomAndPanControl2.UpdateLayout();
4434 497bbe52 ljiyeon
                        //syncPannelRotate(zoomAndPanControl.RotationAngle);
4435 787a4489 KangIngu
                        if (Sync_Offset_Point != new Point(zoomAndPanControl.ContentOffsetX, zoomAndPanControl.ContentOffsetY))
4436
                        {
4437
                            zoomAndPanControl.ContentOffsetX = Sync_Offset_Point.X;
4438
                            zoomAndPanControl.ContentOffsetY = Sync_Offset_Point.Y;
4439
                        }
4440
4441 9cd2865b KangIngu
                        ViewerDataModel.Instance.Sync_ContentOffsetX = Sync_Offset_Point.X;
4442
                        ViewerDataModel.Instance.Sync_ContentOffsetY = Sync_Offset_Point.Y;
4443
                        ViewerDataModel.Instance.Sync_ContentScale = zoomAndPanControl.ContentScale;
4444
4445 787a4489 KangIngu
                        tlSyncRev.Text = String.Format("Rev. {0}", CurrentRev.RevNo);
4446
                        tlSyncPageNum.Text = String.Format("Current Page : {0}", pageNavigator.CurrentPage.PageNumber);
4447
                        gridViewHistory_Busy.IsBusy = false;
4448
                    }
4449 0f065e57 ljiyeon
4450
                    Logger.sendResLog("GetSyncMarkupInfoItemsCompleted", "UserState : " + ea.UserState + "\r Result :" + ea.Result + "\r Cancelled :" + ea.Cancelled + "\r Error :" + ea.Error, 1);
4451 90e7968d ljiyeon
                };
4452 787a4489 KangIngu
                BaseClient.GetSyncMarkupInfoItemsAsync(_ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, _ViewInfo.UserID);
4453 0f065e57 ljiyeon
                Logger.sendReqLog("GetSyncMarkupInfoItemsAsync", _ViewInfo.ProjectNO + "," + CurrentRev.DOCUMENT_ID + "," + _ViewInfo.UserID, 1);
4454 787a4489 KangIngu
            }
4455
        }
4456 4eb052e4 ljiyeon
4457 94b7c12c djkim
        private void EnsembleLink_Button_Click(object sender, RoutedEventArgs e)
4458
        {
4459
            try
4460
            {
4461
                if (sender is RadButton)
4462
                {
4463
                    if ((sender as RadButton).Tag != null)
4464
                    {
4465
                        var url = (sender as RadButton).Tag.ToString();
4466
                        System.Diagnostics.Process.Start(url);
4467
                    }
4468
                    else
4469
                    {
4470
                        this.ParentOfType<MainWindow>().DialogMessage_Alert("Link 정보가 잘못 되었습니다", "안내");
4471
                    }
4472
                }
4473
            }
4474
            catch (Exception ex)
4475
            {
4476
                Logger.sendResLog("EnsembleLink_Button_Click", ex.Message, 0);
4477
            }
4478
        }
4479 787a4489 KangIngu
4480
        public void Sync_Event(VPRevision Currnet_Rev)
4481
        {
4482
            CurrentRev = Currnet_Rev;
4483
4484
            BaseClient.GetSyncMarkupInfoItemsCompleted += (sen, ea) =>
4485
            {
4486
                if (ea.Error == null && ea.Result != null)
4487
                {
4488
                    testPanel2.IsHidden = false;
4489
4490 d128ceb2 humkyung
                    ViewerDataModel.Instance._markupInfoRevList.Clear();
4491
                    foreach(var info in ea.Result)
4492
                    {
4493
                        if(info.UserID == App.ViewInfo.UserID)
4494
                        {
4495
                            info.userDelete = true;
4496
                            info.DisplayColor = "FFFF0000";
4497
                        }
4498
                        else
4499
                        {
4500
                            info.userDelete = false;
4501
                        }
4502
                        ViewerDataModel.Instance._markupInfoRevList.Add(info);
4503
                    }
4504 787a4489 KangIngu
                    gridViewRevMarkup.ItemsSource = ViewerDataModel.Instance._markupInfoRevList;
4505
4506 a874198d humkyung
                    string uri = "";
4507 a1716fa5 KangIngu
                    if (userData.COMPANY != "EXT")
4508 a874198d humkyung
                    {
4509 84c48033 djkim
                        uri = String.Format(CommonLib.Common.GetConfigString("mainServerImageWebPath", "URL", "", App.isExternal), _ViewInfo.ProjectNO, (Convert.ToUInt32(CurrentRev.DOCUMENT_ID) / 100).ToString(), CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber);
4510 a874198d humkyung
                    }
4511
                    else
4512
                    {
4513 84c48033 djkim
                        uri = String.Format(CommonLib.Common.GetConfigString("subServerImageWebPath", "URL", "", App.isExternal), _ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber);
4514 a874198d humkyung
                    }
4515 787a4489 KangIngu
4516
                    Sync_Offset_Point = new Point(zoomAndPanControl.ContentOffsetX, zoomAndPanControl.ContentOffsetY);
4517
4518
                    var defaultBitmapImage_Compare = new BitmapImage(new Uri(uri));
4519
4520
                    ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare;
4521
                    ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth;
4522
                    ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight;
4523
4524
                    if (defaultBitmapImage_Compare.IsDownloading)
4525
                    {
4526
                        defaultBitmapImage_Compare.DownloadCompleted += (ex, arg) =>
4527
                        {
4528
                            ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare;
4529
                            ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth;
4530
                            ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight;
4531
                        };
4532
                    }
4533 90e7968d ljiyeon
4534
4535 787a4489 KangIngu
                    zoomAndPanCanvas2.Width = Convert.ToDouble(Common.ViewerDataModel.Instance.ContentWidth);
4536
                    zoomAndPanCanvas2.Height = Convert.ToDouble(Common.ViewerDataModel.Instance.ContentHeight);
4537
                    zoomAndPanControl2.ApplyTemplate();
4538
                    zoomAndPanControl2.UpdateLayout();
4539
4540
                    if (Sync_Offset_Point != new Point(zoomAndPanControl.ContentOffsetX, zoomAndPanControl.ContentOffsetY))
4541
                    {
4542
                        zoomAndPanControl.ContentOffsetX = Sync_Offset_Point.X;
4543
                        zoomAndPanControl.ContentOffsetY = Sync_Offset_Point.Y;
4544
                    }
4545
                    //}
4546
4547
                    tlSyncRev.Text = String.Format("Rev. {0}", CurrentRev.RevNo);
4548
                    tlSyncPageNum.Text = String.Format("Current Page : {0}", pageNavigator.CurrentPage.PageNumber);
4549 90e7968d ljiyeon
                    gridViewHistory_Busy.IsBusy = false;
4550 787a4489 KangIngu
                }
4551 0f065e57 ljiyeon
                Logger.sendResLog("GetSyncMarkupInfoItemsCompleted", "UserState : " + ea.UserState + "\r Result :" + ea.Result + "\r Cancelled :" + ea.Cancelled + "\r Error :" + ea.Error, 1);
4552 90e7968d ljiyeon
4553 787a4489 KangIngu
            };
4554 0f065e57 ljiyeon
            Logger.sendReqLog("GetSyncMarkupInfoItemsAsync", _ViewInfo.ProjectNO + "," + CurrentRev.DOCUMENT_ID + "," + _ViewInfo.UserID, 1);
4555 90e7968d ljiyeon
            BaseClient.GetSyncMarkupInfoItemsAsync(_ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, _ViewInfo.UserID);
4556 787a4489 KangIngu
        }
4557
4558
        private void PdfLink_ButtonDown(object sender, MouseButtonEventArgs e)
4559
        {
4560
            if (sender is Image)
4561
            {
4562
                if ((sender as Image).Tag != null)
4563
                {
4564
                    var pdfUrl = (sender as Image).Tag.ToString();
4565
                    System.Diagnostics.Process.Start(pdfUrl);
4566
                }
4567
                else
4568
                {
4569
                    this.ParentOfType<MainWindow>().DialogMessage_Alert("문서 정보가 잘못 되었습니다", "안내");
4570
                }
4571
            }
4572
        }
4573
4574
        private void Create_Symbol(object sender, RoutedEventArgs e)
4575
        {
4576 5529d2a2 humkyung
            MarkupToPDF.Controls.Parsing.MarkupParser.MarkupReturn markupReturn = new MarkupToPDF.Controls.Parsing.MarkupParser.MarkupReturn();
4577 787a4489 KangIngu
4578
            if (SelectLayer.Children.Count < 1) //선택된 것이 없으면
4579
            {
4580
                DialogMessage_Alert("Please Select Controls", "Alert");
4581
            }
4582
            else //선택된 것이 있으면
4583
            {
4584
                string MarkupData = "";
4585
                adorner_ = new AdornerFinal();
4586
4587
                foreach (var item in SelectLayer.Children)
4588
                {
4589
                    if (item.GetType().Name == "AdornerFinal")
4590
                    {
4591
                        adorner_ = (item as Controls.AdornerFinal);
4592 4913851c humkyung
                        foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
4593 787a4489 KangIngu
                        {
4594
                            if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
4595
                            {
4596 5529d2a2 humkyung
                                markupReturn = MarkupParser.MarkupToString(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo, App.ViewInfo.UserID);
4597 787a4489 KangIngu
                                MarkupData += markupReturn.ConvertData;
4598
                            }
4599
                        }
4600
                    }
4601
                }
4602
                DialogParameters parameters = new DialogParameters()
4603
                {
4604 b9b01f8e ljiyeon
                    Owner = Application.Current.MainWindow,
4605 787a4489 KangIngu
                    Closed = (obj, args) => this.MarkupNamePromptClose(MarkupData, args),
4606
                    DefaultPromptResultValue = "Custom State",
4607
                    Content = "Name :",
4608
                    Header = "Insert Custom Symbol Name",
4609
                    Theme = new VisualStudio2013Theme(),
4610
                    ModalBackground = new SolidColorBrush { Color = Colors.Black, Opacity = 0.6 },
4611
                };
4612
                RadWindow.Prompt(parameters);
4613
            }
4614
4615
        }
4616 53880c83 ljiyeon
        public int symbolselectindex = 0;
4617
        private void SymbolMarkupNamePromptClose(byte[] Img_byte, string data, WindowClosedEventArgs args)
4618
        {
4619
            //Save save = new Save();
4620
            try
4621
            {
4622
                string svgfilename = null;
4623
                if (symbolname != null)
4624
                {
4625
                    if (symbolpng == true || symbolsvg == true)
4626
                    {
4627
                        kr.co.devdoftech.cloud.FileUpload fileUploader = new kr.co.devdoftech.cloud.FileUpload();
4628 24678e06 humkyung
                        string guid = Commons.shortGuid();
4629 53880c83 ljiyeon
4630
                        fileUploader.RunAsync(App.ViewInfo.ProjectNO, _DocItem.DOCUMENT_NO, App.ViewInfo.UserID, guid + ".png", Img_byte);
4631 c73426a9 ljiyeon
                        //Check_Uri.UriCheck();
4632 53880c83 ljiyeon
                        fileUploader.RunCompleted += (ex, arg) =>
4633
                        {
4634
                            filename = arg.Result;
4635
                            if (symbolpng == true)
4636
                            {
4637
                                if (filename != null)
4638
                                { 
4639
                                    if (symbolselectindex == 0)
4640
                                    {
4641
                                        SymbolSave(symbolname, filename, data);
4642
                                    }
4643
                                    else
4644
                                    {
4645
                                        SymbolSave_Public(symbolname, filename, data, ViewerDataModel.Instance.SystemMain.dzMainMenu.userData.DEPARTMENT);
4646
                                    }
4647
                                    DataBind();
4648
                                }                                
4649
                            }
4650
4651
                            if (symbolsvg == true)
4652
                            {
4653 c73426a9 ljiyeon
                                try
4654 53880c83 ljiyeon
                                {
4655 c73426a9 ljiyeon
                                    var defaultBitmapImage = new BitmapImage();
4656
                                    defaultBitmapImage.BeginInit();
4657
                                    defaultBitmapImage.CreateOptions = BitmapCreateOptions.IgnoreImageCache;
4658
                                    defaultBitmapImage.CacheOption = BitmapCacheOption.OnLoad;
4659
                                    Check_Uri.UriCheck(filename);
4660
                                    defaultBitmapImage.UriSource = new Uri(filename);
4661
                                    defaultBitmapImage.EndInit();
4662 53880c83 ljiyeon
4663 c73426a9 ljiyeon
                                    System.Drawing.Bitmap image;
4664 53880c83 ljiyeon
4665 c73426a9 ljiyeon
                                    if (defaultBitmapImage.IsDownloading)
4666
                                    {
4667
                                        defaultBitmapImage.DownloadCompleted += (ex2, arg2) =>
4668 53880c83 ljiyeon
                                        {
4669 c73426a9 ljiyeon
                                            defaultBitmapImage.Freeze();
4670
                                            image = GetBitmap(defaultBitmapImage);
4671
                                            image.Save(@AppDomain.CurrentDomain.BaseDirectory + "potrace.bmp", System.Drawing.Imaging.ImageFormat.Bmp);
4672
                                            Process potrace = new Process
4673 53880c83 ljiyeon
                                            {
4674 c73426a9 ljiyeon
                                                StartInfo = new ProcessStartInfo
4675
                                                {
4676
                                                    FileName = @AppDomain.CurrentDomain.BaseDirectory + "potrace.exe",
4677
                                                    Arguments = "-b svg " + @AppDomain.CurrentDomain.BaseDirectory + "potrace.bmp",
4678
                                                    RedirectStandardInput = true,
4679
                                                    RedirectStandardOutput = true,
4680
                                                    RedirectStandardError = true,
4681
                                                    UseShellExecute = false,
4682
                                                    CreateNoWindow = true,
4683
                                                    WindowStyle = ProcessWindowStyle.Hidden
4684
                                                },
4685
                                            };
4686 53880c83 ljiyeon
4687 c73426a9 ljiyeon
                                            StringBuilder svgBuilder = new StringBuilder();
4688
                                            potrace.OutputDataReceived += (object sender2, DataReceivedEventArgs e2) =>
4689 53880c83 ljiyeon
                                            {
4690 c73426a9 ljiyeon
                                                svgBuilder.AppendLine(e2.Data);
4691
                                            };
4692
4693
                                            potrace.EnableRaisingEvents = true;
4694
                                            potrace.Start();
4695
                                            potrace.Exited += (sender, e) =>
4696 53880c83 ljiyeon
                                            {
4697 c73426a9 ljiyeon
                                                byte[] bytes = System.IO.File.ReadAllBytes(@AppDomain.CurrentDomain.BaseDirectory + "potrace.svg");
4698
                                                svgfilename = fileUploader.Run(App.ViewInfo.ProjectNO, _DocItem.DOCUMENT_NO, App.ViewInfo.UserID, guid + ".svg", bytes);
4699
                                                Check_Uri.UriCheck(svgfilename);
4700
                                                if (symbolselectindex == 0)
4701
                                                {
4702
                                                    SymbolSave(symbolname, svgfilename, data);
4703
                                                }
4704
                                                else
4705
                                                {
4706
                                                    SymbolSave_Public(symbolname, svgfilename, data, ViewerDataModel.Instance.SystemMain.dzMainMenu.userData.DEPARTMENT);
4707
                                                }
4708 53880c83 ljiyeon
4709 c73426a9 ljiyeon
                                                DataBind();
4710
                                            };
4711
                                            potrace.WaitForExit();
4712 53880c83 ljiyeon
                                        };
4713 c73426a9 ljiyeon
                                    }
4714
                                    else
4715
                                    {
4716
                                        //GC.Collect();
4717
                                    }
4718 53880c83 ljiyeon
                                }
4719 c73426a9 ljiyeon
                                catch(Exception ee)
4720 90e7968d ljiyeon
                                {
4721 c73426a9 ljiyeon
                                    DialogMessage_Alert("" + ee, "Alert");
4722 90e7968d ljiyeon
                                }
4723 53880c83 ljiyeon
                            }
4724
                        };                                             
4725
                    }
4726
                }
4727
            }
4728
            catch (Exception e)
4729
            {
4730
                //DialogMessage_Alert(e + "", "Alert");
4731
            }            
4732
        }
4733
4734
        public void SymbolSave(string Name, string Url, string Data)
4735
        {
4736
            try
4737
            {
4738
                SYMBOL_PRIVATE symbol_private = new SYMBOL_PRIVATE
4739
                {
4740 24678e06 humkyung
                    ID = Commons.shortGuid(),
4741 53880c83 ljiyeon
                    MEMBER_USER_ID = App.ViewInfo.UserID,
4742
                    NAME = Name,
4743
                    IMAGE_URL = Url,
4744
                    DATA = Data
4745
                };
4746
4747
                Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.SaveSymbolCompleted += BaseClient_SaveSymbolCompleted;
4748
                Logger.sendReqLog("SaveSymbolAsync: ", symbol_private.ID + "," + symbol_private.MEMBER_USER_ID + "," + symbol_private.NAME + "," + symbol_private.IMAGE_URL + "," + symbol_private.DATA, 1);
4749
                Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.SaveSymbolAsync(symbol_private);
4750
            }
4751
            catch (Exception)
4752
            {
4753
                throw;
4754
            }
4755
        }
4756
4757
        public void SymbolSave_Public(string Name, string Url, string Data, string Department)
4758
        {
4759
            try
4760
            {
4761
                SYMBOL_PUBLIC symbol_public = new SYMBOL_PUBLIC
4762
                {
4763 24678e06 humkyung
                    ID = Commons.shortGuid(),
4764 53880c83 ljiyeon
                    DEPARTMENT = Department,
4765
                    NAME = Name,
4766
                    IMAGE_URL = Url,
4767
                    DATA = Data
4768
                };
4769
                Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.AddPublicSymbolCompleted += BaseClient_AddPublicSymbolCompleted;
4770
                Logger.sendReqLog("AddPublicSymbol: ", symbol_public.ID + "," + symbol_public.DEPARTMENT + "," + symbol_public.NAME + "," + symbol_public.IMAGE_URL + "," + symbol_public.DATA, 1);
4771
                Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.AddPublicSymbol(symbol_public);
4772
            }
4773
            catch (Exception)
4774
            {
4775
                throw;
4776
            }
4777
        }
4778
4779
        private void BaseClient_AddPublicSymbolCompleted(object sender, ServiceDeepView.AddPublicSymbolCompletedEventArgs e)
4780
        {           
4781
            Logger.sendResLog("AddPublicSymbolCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1);
4782
            DataBind();
4783
        }
4784
4785
        private void BaseClient_SaveSymbolCompleted(object sender, ServiceDeepView.SaveSymbolCompletedEventArgs e)
4786
        {
4787
            Logger.sendResLog("RenameSymbolCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1);
4788
            DataBind();
4789
        }
4790
        private void DataBind()
4791
        {
4792
            try
4793
            {
4794
                Symbol_Custom Custom = new Symbol_Custom();
4795
                List<Symbol_Custom> Custom_List = new List<Symbol_Custom>();
4796 5928384e djkim
                
4797 bb3a236d ljiyeon
                var symbol_Private = BaseClient.GetSymbolList(App.ViewInfo.UserID);
4798 53880c83 ljiyeon
                foreach (var item in symbol_Private)
4799
                {
4800
                    Custom.Name = item.NAME;
4801
                    Custom.ImageUri = item.IMAGE_URL;
4802
                    Custom.ID = item.ID;
4803
                    Custom_List.Add(Custom);
4804
                    Custom = new Symbol_Custom();
4805
                }
4806
                symbolPanel_Instance.lstSymbolPrivate.ItemsSource = Custom_List;
4807
                
4808
                Custom = new Symbol_Custom();
4809
                Custom_List = new List<Symbol_Custom>();
4810
4811 bb3a236d ljiyeon
                symbolPanel_Instance.deptlist.ItemsSource = BaseClient.GetPublicSymbolDeptList();
4812 53880c83 ljiyeon
4813
                List<SYMBOL_PUBLIC> symbol_Public;
4814 787a4489 KangIngu
4815 53880c83 ljiyeon
                if (symbolPanel_Instance.deptlist.SelectedValue != null)
4816
                {
4817 bb3a236d ljiyeon
                    symbol_Public = BaseClient.GetPublicSymbolList(symbolPanel_Instance.deptlist.SelectedValue.ToString());
4818 53880c83 ljiyeon
                }
4819
                else
4820
                {
4821 bb3a236d ljiyeon
                    symbol_Public = BaseClient.GetPublicSymbolList(null);
4822 53880c83 ljiyeon
                }
4823
                foreach (var item in symbol_Public)
4824
                {
4825
                    Custom.Name = item.NAME;
4826
                    Custom.ImageUri = item.IMAGE_URL;
4827
                    Custom.ID = item.ID;
4828
                    Custom_List.Add(Custom);
4829
                    Custom = new Symbol_Custom();
4830
                }
4831
                symbolPanel_Instance.lstSymbolPublic.ItemsSource = Custom_List;
4832 bb3a236d ljiyeon
                BaseClient.Close();                
4833 53880c83 ljiyeon
            }
4834
            catch(Exception e)
4835
            {
4836
                //DialogMessage_Alert("DataBind", "Alert");
4837
            }
4838
            
4839
        }
4840 787a4489 KangIngu
        private void MarkupNamePromptClose(string data, WindowClosedEventArgs args)
4841
        {
4842 c73426a9 ljiyeon
            try
4843 787a4489 KangIngu
            {
4844 c73426a9 ljiyeon
                if (args.PromptResult != null)
4845 53880c83 ljiyeon
                {
4846 c73426a9 ljiyeon
                    if (args.DialogResult.Value)
4847
                    {
4848
                        PngBitmapEncoder _Encoder = symImage(data);
4849 787a4489 KangIngu
4850 c73426a9 ljiyeon
                        System.IO.MemoryStream fs = new System.IO.MemoryStream();
4851
                        _Encoder.Save(fs);
4852
                        System.Drawing.Image ImgOut = System.Drawing.Image.FromStream(fs);
4853 787a4489 KangIngu
4854 c73426a9 ljiyeon
                        byte[] Img_byte = fs.ToArray();
4855 787a4489 KangIngu
4856 c73426a9 ljiyeon
                        kr.co.devdoftech.cloud.FileUpload fileUploader = new kr.co.devdoftech.cloud.FileUpload();
4857 24678e06 humkyung
                        filename = fileUploader.Run(App.ViewInfo.ProjectNO, _DocItem.DOCUMENT_NO, App.ViewInfo.UserID, Commons.shortGuid() + ".png", Img_byte);
4858 c73426a9 ljiyeon
                        Check_Uri.UriCheck(filename);
4859
                        if (symbolPanel_Instance.RadTab.SelectedIndex == 0)
4860
                        {
4861 de6499db humkyung
                            SaveCommand.Instance.SymbolSave(args.PromptResult, filename, data);
4862 c73426a9 ljiyeon
                        }
4863
                        else
4864
                        {
4865 de6499db humkyung
                            SaveCommand.Instance.SymbolSave_Public(args.PromptResult, filename, data, ViewerDataModel.Instance.SystemMain.dzMainMenu.userData.DEPARTMENT);
4866 c73426a9 ljiyeon
                        }
4867
                        DataBind();
4868 53880c83 ljiyeon
                    }
4869
                }
4870 787a4489 KangIngu
            }
4871 c73426a9 ljiyeon
            catch(Exception ex)
4872
            {
4873
                DialogMessage_Alert("" + ex, "Alert");
4874
            }
4875 787a4489 KangIngu
        }
4876
4877
        public PngBitmapEncoder symImage(string data)
4878
        {
4879
4880
            Canvas _canvas = new Canvas();
4881
            _canvas.Background = Brushes.White;
4882
            _canvas.Width = adorner_.BorderSize.Width;
4883
            _canvas.Height = adorner_.BorderSize.Height;
4884 5529d2a2 humkyung
            MarkupParser.Parse(App.ViewInfo.ProjectNO, data, _canvas, "#FFFF0000", "");
4885 787a4489 KangIngu
4886
            BitmapEncoder encoder = new PngBitmapEncoder();
4887
4888
4889
            RenderTargetBitmap renderBitmap = new RenderTargetBitmap((int)_canvas.Width + 50, (int)_canvas.Height + 50, 96d, 96d, PixelFormats.Pbgra32);
4890
4891
            DrawingVisual dv = new DrawingVisual();
4892
4893
            _canvas.Measure(new System.Windows.Size(adorner_.BorderSize.Width + 50, adorner_.BorderSize.Height + 50));
4894
            _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)));
4895
4896
            using (DrawingContext ctx = dv.RenderOpen())
4897
            {
4898
                VisualBrush vb = new VisualBrush(_canvas);
4899
                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)));
4900
            }
4901
4902
            try
4903
            {
4904
                renderBitmap.Render(dv);
4905
4906 90e7968d ljiyeon
                //GC.Collect();
4907 787a4489 KangIngu
                GC.WaitForPendingFinalizers();
4908 90e7968d ljiyeon
                //GC.Collect();
4909 787a4489 KangIngu
                // encode png data
4910
                PngBitmapEncoder pngEncoder = new PngBitmapEncoder();
4911
                // puch rendered bitmap into it
4912
                pngEncoder.Interlace = PngInterlaceOption.Off;
4913
                pngEncoder.Frames.Add(BitmapFrame.Create(renderBitmap));
4914
                return pngEncoder;
4915
4916
            }
4917 53880c83 ljiyeon
            catch //(Exception ex)
4918 787a4489 KangIngu
            {
4919
                return null;
4920
            }
4921
4922
        }
4923
4924
        public void DialogMessage_Alert(string content, string header)
4925
        {
4926
            DialogParameters parameters = new DialogParameters()
4927
            {
4928 b9b01f8e ljiyeon
                Owner = Application.Current.MainWindow,
4929 0d32593b ljiyeon
                Content = new TextBlock()
4930
                { 
4931
                    MinWidth = 400,
4932
                    FontSize = 11,
4933
                    Text = content,
4934
                    TextWrapping = System.Windows.TextWrapping.Wrap
4935
                },
4936 787a4489 KangIngu
                Header = header,
4937
                Theme = new VisualStudio2013Theme(),
4938
                ModalBackground = new SolidColorBrush { Color = Colors.Black, Opacity = 0.6 },
4939 90e7968d ljiyeon
            };            
4940 787a4489 KangIngu
            RadWindow.Alert(parameters);
4941
        }
4942
4943
        #region 캡쳐 기능
4944
4945
        public BitmapSource CutAreaToImage(int x, int y, int width, int height)
4946
        {
4947
            if (x < 0)
4948
            {
4949
                width += x;
4950
                x = 0;
4951
            }
4952
            if (y < 0)
4953
            {
4954
                height += y;
4955
                y = 0;
4956
4957
                width = (int)zoomAndPanCanvas.ActualWidth - x;
4958
            }
4959
            if (x + width > zoomAndPanCanvas.ActualWidth)
4960
            {
4961
                width = (int)zoomAndPanCanvas.ActualWidth - x;
4962
            }
4963
            if (y + height > zoomAndPanCanvas.ActualHeight)
4964
            {
4965
                height = (int)zoomAndPanCanvas.ActualHeight - y;
4966
            }
4967
4968
            byte[] pixels = CopyPixels(x, y, width, height);
4969
4970
            int stride = (width * canvasImage.Format.BitsPerPixel + 7) / 8;
4971
4972
            return BitmapSource.Create(width, height, 96, 96, PixelFormats.Pbgra32, null, pixels, stride);
4973
        }
4974
4975
        public byte[] CopyPixels(int x, int y, int width, int height)
4976
        {
4977
            byte[] pixels = new byte[width * height * 4];
4978
            int stride = (width * canvasImage.Format.BitsPerPixel + 7) / 8;
4979
4980
            // Canvas 이미지에서 객체 역역만큼 픽셀로 복사
4981
            canvasImage.CopyPixels(new Int32Rect(x, y, width, height), pixels, stride, 0);
4982
4983
            return pixels;
4984
        }
4985
4986
        public RenderTargetBitmap ConverterBitmapImage(FrameworkElement element)
4987
        {
4988
            DrawingVisual drawingVisual = new DrawingVisual();
4989
            DrawingContext drawingContext = drawingVisual.RenderOpen();
4990
4991
            // 해당 객체의 그래픽요소로 사각형의 그림을 그립니다.
4992
            drawingContext.DrawRectangle(new VisualBrush(element), null,
4993
                new Rect(new Point(0, 0), new Point(element.ActualWidth, element.ActualHeight)));
4994
            drawingContext.Close();
4995
4996
            // 비트맵으로 변환합니다.
4997
            RenderTargetBitmap target =
4998
                new RenderTargetBitmap((int)element.ActualWidth, (int)element.ActualHeight,
4999
                96, 96, System.Windows.Media.PixelFormats.Pbgra32);
5000
5001
            target.Render(drawingVisual);
5002
            return target;
5003
        }
5004
5005 53880c83 ljiyeon
        System.Drawing.Bitmap GetBitmap(BitmapSource source)
5006
        {
5007
            System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(source.PixelWidth, source.PixelHeight, System.Drawing.Imaging.PixelFormat.Format32bppPArgb);
5008
            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);
5009
            source.CopyPixels(Int32Rect.Empty, data.Scan0, data.Height * data.Stride, data.Stride);
5010
            bmp.UnlockBits(data);
5011
            return bmp;
5012
        }
5013
        public string symbolname = null;
5014
        public bool symbolsvg = true;
5015
        public bool symbolpng = true;
5016
5017
        public void Save_Symbol_Capture(BitmapSource source, int x, int y, int width, int height)
5018
        {
5019
            System.Drawing.Bitmap image = GetBitmap(source);
5020
            //흰색 제거
5021
            //image.MakeTransparent(System.Drawing.Color.White);
5022
5023
            var imageStream = new System.IO.MemoryStream();
5024
            byte[] imageBytes = null;
5025
            using (imageStream)
5026
            {
5027
                image.Save(imageStream, System.Drawing.Imaging.ImageFormat.Png);
5028
                // test.Save(@"E:\test.png", System.Drawing.Imaging.ImageFormat.Png);
5029
                imageStream.Position = 0;
5030
                imageBytes = imageStream.ToArray();
5031
            }
5032
5033
            SymbolPrompt symbolPrompt = new SymbolPrompt();
5034
5035
            RadWindow CheckPop = new RadWindow();
5036
            //Alert check = new Alert(Msg);
5037
5038
            CheckPop = new RadWindow
5039
            {
5040
                MinWidth = 400,
5041
                MinHeight = 100,
5042
               // Closed = (obj, args) => this.SymbolMarkupNamePromptClose(imageBytes, "", args),
5043
                Header = "Alert",
5044
                Content = symbolPrompt,
5045
                //DialogResult = 
5046
                ResizeMode = System.Windows.ResizeMode.NoResize,
5047
                WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen,
5048
                IsTopmost = true,
5049
            };
5050
            CheckPop.Closed += (obj, args) => this.SymbolMarkupNamePromptClose(imageBytes, "", args);
5051
            StyleManager.SetTheme(CheckPop, new Office2013Theme());
5052
            CheckPop.ShowDialog();
5053
5054
            /*
5055
            DialogParameters parameters = new DialogParameters()
5056
            {
5057
                Owner = Application.Current.MainWindow,
5058
                Closed = (obj, args) => this.SymbolMarkupNamePromptClose(imageBytes, "", args),
5059
                DefaultPromptResultValue = "Custom State",
5060
                Content = "Name :",
5061
                Header = "Insert Custom Symbol Name",
5062
                Theme = new VisualStudio2013Theme(),
5063
                ModalBackground = new SolidColorBrush { Color = Colors.Black, Opacity = 0.6 },
5064
            };            
5065
            RadWindow.Prompt(parameters);
5066
            */
5067
        }
5068
5069 787a4489 KangIngu
        public void Save_Capture(BitmapSource source, int x, int y, int width, int height)
5070
        {
5071
            KCOM.Common.Converter.FileStreamToBase64 streamToBase64 = new Common.Converter.FileStreamToBase64();
5072
            KCOMDataModel.DataModel.CHECK_LIST check_;
5073
            string Result = streamToBase64.ImageToBase64(source);
5074
            KCOMDataModel.DataModel.CHECK_LIST Item = new KCOMDataModel.DataModel.CHECK_LIST();
5075 6c781c0c djkim
            string projectno = App.ViewInfo.ProjectNO;
5076
            string checklist_id = ViewerDataModel.Instance.CheckList_ID;
5077 0f065e57 ljiyeon
5078
            Logger.sendReqLog("GetCheckList", projectno + "," + checklist_id, 1);
5079 6c781c0c djkim
            Item = this.BaseClient.GetCheckList(projectno, checklist_id);
5080 90e7968d ljiyeon
            if (Item != null)
5081 0f065e57 ljiyeon
            {
5082
                Logger.sendResLog("GetCheckList", "TRUE", 1);
5083
            }
5084
            else
5085
            {
5086
                Logger.sendResLog("GetCheckList", "FALSE", 1);
5087
            }
5088 90e7968d ljiyeon
5089 6c781c0c djkim
            if (Item == null)
5090 787a4489 KangIngu
            {
5091 6c781c0c djkim
                check_ = new KCOMDataModel.DataModel.CHECK_LIST
5092 787a4489 KangIngu
                {
5093 24678e06 humkyung
                    ID = Commons.shortGuid(),
5094 6c781c0c djkim
                    USER_ID = App.ViewInfo.UserID,
5095
                    IMAGE_URL = Result,
5096
                    IMAGE_ANCHOR = x + "," + y + "," + width + "," + height,
5097
                    PAGENUMBER = this.pageNavigator.CurrentPage.PageNumber,
5098
                    REVISION = ViewerDataModel.Instance.SystemMain.dzMainMenu.CurrentDoc.Revision,
5099
                    DOCUMENT_ID = App.ViewInfo.DocumentItemID,
5100
                    PROJECT_NO = App.ViewInfo.ProjectNO,
5101
                    STATUS = "False",
5102
                    CREATE_TIME = DateTime.Now,
5103
                    UPDATE_TIME = DateTime.Now,
5104
                    DOCUMENT_NO = _DocItem.DOCUMENT_NO,
5105
                    STATUS_DESC_OPEN = "Vendor 반영 필요",
5106
                };
5107 0f065e57 ljiyeon
                Logger.sendReqLog("AddCheckList", projectno + "," + check_, 1);
5108
                Logger.sendResLog("AddCheckList", this.BaseClient.AddCheckList(projectno, check_).ToString(), 1);
5109
                //this.BaseClient.AddCheckList(projectno, check_);
5110 787a4489 KangIngu
            }
5111 6c781c0c djkim
            else
5112
            {
5113
                Item.IMAGE_URL = Result;
5114
                Item.IMAGE_ANCHOR = x + "," + y + "," + width + "," + height;
5115 90e7968d ljiyeon
                Item.PAGENUMBER = this.pageNavigator.CurrentPage.PageNumber;
5116 0f065e57 ljiyeon
                Logger.sendReqLog("SaveCheckList", projectno + "," + checklist_id + "," + Item, 1);
5117
                Logger.sendResLog("SaveCheckList", this.BaseClient.SaveCheckList(projectno, checklist_id, Item).ToString(), 1);
5118
                //this.BaseClient.SaveCheckList(projectno, checklist_id, Item);
5119 6c781c0c djkim
            }
5120 90e7968d ljiyeon
5121 787a4489 KangIngu
        }
5122
5123
        public void Set_Capture()
5124 90e7968d ljiyeon
        {
5125 787a4489 KangIngu
            double x = canvasDrawingMouseDownPoint.X;
5126
            double y = canvasDrawingMouseDownPoint.Y;
5127
            double width = dragCaptureBorder.Width;
5128
            double height = dragCaptureBorder.Height;
5129
5130
            if (width > 5 || height > 5)
5131
            {
5132
                canvasImage = ConverterBitmapImage(zoomAndPanCanvas);
5133
                BitmapSource source = CutAreaToImage((int)x, (int)y, (int)width, (int)height);
5134
                Save_Capture(source, (int)x, (int)y, (int)width, (int)height);
5135
            }
5136
        }
5137
        #endregion
5138
5139
        public Multi_Undo_data Control_Style(CommentUserInfo control)
5140
        {
5141
            multi_Undo_Data = new Multi_Undo_data();
5142
5143
            multi_Undo_Data.Markup = control;
5144
5145
            if ((control as IShapeControl) != null)
5146
            {
5147
                multi_Undo_Data.paint = (control as IShapeControl).Paint;
5148
            }
5149
            if ((control as IDashControl) != null)
5150
            {
5151
                multi_Undo_Data.DashSize = (control as IDashControl).DashSize;
5152
            }
5153
            if ((control as IPath) != null)
5154
            {
5155
                multi_Undo_Data.LineSize = (control as IPath).LineSize;
5156
            }
5157
            if ((control as UIElement) != null)
5158
            {
5159
                multi_Undo_Data.Opacity = (control as UIElement).Opacity;
5160
            }
5161
5162
            return multi_Undo_Data;
5163
        }
5164
5165
        private void Comment_Move(object sender, MouseButtonEventArgs e)
5166
        {
5167
            string Select_ID = (((e.Source as Telerik.Windows.Controls.RadButton).DataContext) as IKCOM.MarkupInfoItem).UserID;
5168
            foreach (var items in ViewerDataModel.Instance._markupInfoRevList)
5169
            {
5170
                if (items.UserID == Select_ID)
5171
                {
5172
                    foreach (var item in items.MarkupList)
5173
                    {
5174
                        if (item.PageNumber == pageNavigator.CurrentPage.PageNumber)
5175
                        {
5176 661b7416 humkyung
                            MarkupParser.ParseEx(App.ViewInfo.ProjectNO, item.Data, Common.ViewerDataModel.Instance.MarkupControls_USER, "#FFFF0000", "", 
5177 24678e06 humkyung
                                items.MarkupInfoID, Commons.shortGuid());
5178 787a4489 KangIngu
                        }
5179
                    }
5180
                }
5181
            }
5182
        }
5183 d62c0439 humkyung
5184 f959ea6f humkyung
        /// <summary>
5185
        /// convert inkcontrol to polygoncontrol
5186
        /// </summary>
5187
        public void ConvertInkControlToPolygon()
5188 787a4489 KangIngu
        {
5189
            if (inkBoard.Strokes.Count > 0)
5190
            {
5191
                inkBoard.Strokes.ToList().ForEach(stroke =>
5192
                {
5193
                    InkToPath ip = new InkToPath();
5194 f959ea6f humkyung
5195 787a4489 KangIngu
                    List<Point> inkPointSet = new List<Point>();
5196 f959ea6f humkyung
                    inkPointSet.AddRange(ip.GetPointsFrom(stroke));
5197
5198
                    PolygonControl pc = new PolygonControl()
5199 787a4489 KangIngu
                    {
5200
                        Angle = 0,
5201 f959ea6f humkyung
                        PointSet = inkPointSet,
5202 787a4489 KangIngu
                        ControlType = ControlType.Ink
5203
                    };
5204 f959ea6f humkyung
                    pc.StartPoint = inkPointSet[0];
5205
                    pc.EndPoint = inkPointSet[inkPointSet.Count - 1];
5206
                    pc.LineSize = 3;
5207
                    pc.CommentID = Commons.shortGuid();
5208
                    pc.StrokeColor = new SolidColorBrush(Colors.Red);
5209 787a4489 KangIngu
5210 f959ea6f humkyung
                    if (pc.PointSet.Count > 0)
5211
                    {
5212
                        CreateCommand.Instance.Execute(pc);
5213 787a4489 KangIngu
                        ViewerDataModel.Instance.MarkupControls_USER.Add(pc);
5214
                    }
5215
                });
5216 f959ea6f humkyung
                inkBoard.Strokes.Clear();
5217 787a4489 KangIngu
            }
5218
        }
5219 17a22987 KangIngu
5220 4318fdeb KangIngu
        /// <summary>
5221 e66f22eb KangIngu
        /// 캔버스에 그릴때 모든 포인트가 캔버스를 벗어 났는지 체크하여 넘겨줌
5222
        /// </summary>
5223
        /// <author>ingu</author>
5224
        /// <date>2018.06.05</date>
5225
        /// <param name="getPoint"></param>
5226
        /// <returns></returns>
5227
        private bool IsGetoutpoint(Point getPoint)
5228 670a4be2 humkyung
        {
5229 e66f22eb KangIngu
            if (getPoint == new Point())
5230 670a4be2 humkyung
            {
5231 e66f22eb KangIngu
                ViewerDataModel.Instance.MarkupControls_USER.Remove(currentControl);
5232
                currentControl = null;
5233
                return true;
5234 670a4be2 humkyung
            }
5235
5236 e66f22eb KangIngu
            return false;
5237 670a4be2 humkyung
        }
5238 e66f22eb KangIngu
5239 5b46312f djkim
        private void zoomAndPanControl_DragOver(object sender, DragEventArgs e)
5240
        {
5241
            e.Effects = DragDropEffects.Copy;
5242
        }
5243
5244
        private void zoomAndPanControl_DragEnter(object sender, DragEventArgs e)
5245
        {
5246
            e.Effects = DragDropEffects.Copy;
5247
        }
5248
5249
        private void zoomAndPanControl_DragLeave(object sender, DragEventArgs e)
5250
        {
5251
            e.Effects = DragDropEffects.None;
5252
        }
5253
5254 92442e4a taeseongkim
        private void ZoomAndPanControl_ScaleChanged(object sender, RoutedEventArgs e)
5255 cdfb57ff taeseongkim
        {
5256
            var pageWidth = ViewerDataModel.Instance.ImageViewWidth;
5257
            var pageHeight = ViewerDataModel.Instance.ImageViewHeight;
5258
5259 92442e4a taeseongkim
            ScaleImage(pageWidth, pageHeight);
5260
        }
5261
5262
        /// <summary>
5263
        /// 페이지를 scale의 변화에 맞춰서 DecodePixel을 변경한다.
5264
        /// </summary>
5265
        /// <param name="pageWidth">원본 사이즈</param>
5266
        /// <param name="pageHeight">원본 사이즈</param>
5267
        /// <returns></returns>
5268
        private void ScaleImage(double pageWidth,double pageHeight)
5269
        {
5270 eb9a8cb6 taeseongkim
            mainPanel.Scale = zoomAndPanControl.ContentScale;// (zoomAndPanControl.ContentScale >= 0.1) ? 1 : zoomAndPanControl.ContentScale;
5271 cdfb57ff taeseongkim
        }
5272
5273 d0eda156 ljiyeon
        private void thumbnailPanel_SizeChanged(object sender, SizeChangedEventArgs e)
5274
        {
5275
            CommonLib.Common.WriteConfigString("SetThumbnail", "WIDTH", thumbnailPanel.Width.ToString());
5276
        }
5277
5278 cdfb57ff taeseongkim
5279 e6a9ddaf humkyung
        /*
5280 5b46312f djkim
        private void zoomAndPanControl_Drop(object sender, DragEventArgs e)
5281
        {
5282 90e7968d ljiyeon
            try
5283 5b46312f djkim
            {
5284 90e7968d ljiyeon
                if (e.Data.GetDataPresent(typeof(string)))
5285
                {
5286
                    this.getCurrentPoint = e.GetPosition(drawingRotateCanvas);
5287
                    string dragData = e.Data.GetData(typeof(string)) as string;
5288
                    Move_Symbol(sender, dragData);
5289
                }
5290 5b46312f djkim
            }
5291 90e7968d ljiyeon
            catch (Exception ex)
5292
            {
5293
                Logger.sendResLog("zoomAndPanControl_Drop", ex.ToString(), 0);
5294
            }            
5295 5b46312f djkim
        }
5296 e6a9ddaf humkyung
        */
5297 787a4489 KangIngu
    }
5298 5a6a5dd1 humkyung
}
클립보드 이미지 추가 (최대 크기: 500 MB)