프로젝트

일반

사용자정보

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

markus / KCOM / Views / MainMenu.xaml.cs @ 105359ce

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