프로젝트

일반

사용자정보

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

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

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