프로젝트

일반

사용자정보

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

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

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