프로젝트

일반

사용자정보

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

markus / KCOM / Views / MainMenu.xaml.cs @ 62fa27ec

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

1 787a4489 KangIngu

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