프로젝트

일반

사용자정보

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

markus / KCOM / Views / MainMenu.xaml.cs @ 92442e4a

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