프로젝트

일반

사용자정보

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

markus / KCOM / Views / MainMenu.xaml.cs @ 55d4f382

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