프로젝트

일반

사용자정보

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

markus / KCOM / Views / MainMenu.xaml.cs @ 34ac8db7

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

1 233ef333 taeseongkim
using IKCOM;
2 2b9b3656 taeseongkim
using KCOM.Common;
3
using KCOM.Controls;
4
using KCOM.Events;
5
using KCOMDataModel.DataModel;
6
using MarkupToPDF.Common;
7
using MarkupToPDF.Controls.Cad;
8 787a4489 KangIngu
using MarkupToPDF.Controls.Common;
9 2b9b3656 taeseongkim
using MarkupToPDF.Controls.Etc;
10 787a4489 KangIngu
using MarkupToPDF.Controls.Line;
11 2b9b3656 taeseongkim
using MarkupToPDF.Controls.Parsing;
12 787a4489 KangIngu
using MarkupToPDF.Controls.Polygon;
13
using MarkupToPDF.Controls.Shape;
14
using MarkupToPDF.Controls.Text;
15
using System;
16
using System.Collections.Generic;
17 2b9b3656 taeseongkim
using System.Diagnostics;
18 787a4489 KangIngu
using System.Linq;
19 2b9b3656 taeseongkim
using System.Reflection;
20
using System.Runtime.InteropServices;
21 787a4489 KangIngu
using System.Text;
22 2b9b3656 taeseongkim
using System.Threading;
23
using System.Threading.Tasks;
24
using System.Web;
25 787a4489 KangIngu
using System.Windows;
26
using System.Windows.Controls;
27 2b9b3656 taeseongkim
using System.Windows.Ink;
28 787a4489 KangIngu
using System.Windows.Input;
29
using System.Windows.Media;
30
using System.Windows.Media.Imaging;
31
using System.Windows.Shapes;
32 6707a5c7 ljiyeon
using System.Windows.Threading;
33 2b9b3656 taeseongkim
using Telerik.Windows.Controls;
34 552af7c7 swate0609
using Telerik.Windows.Controls.GridView;
35 fddb48f7 ljiyeon
using Telerik.Windows.Data;
36 2b1f30fe taeseongkim
//using static KCOM.TempFile;
37 787a4489 KangIngu
38
namespace KCOM.Views
39
{
40
    public static class ControlExtensions
41
    {
42
        public static T Clone<T>(this T controlToClone)
43
            where T : System.Windows.Controls.Control
44
        {
45
            System.Reflection.PropertyInfo[] controlProperties = typeof(T).GetProperties(System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance);
46
47
            T instance = Activator.CreateInstance<T>();
48
49
            foreach (PropertyInfo propInfo in controlProperties)
50
            {
51
                if (propInfo.CanWrite)
52
                {
53
                    if (propInfo.Name != "WindowTarget")
54
                        propInfo.SetValue(instance, propInfo.GetValue(controlToClone, null), null);
55
                }
56
            }
57
            return instance;
58
        }
59
    }
60
61 a0bab669 KangIngu
    public class MyConsole
62
    {
63
        private readonly System.Threading.ManualResetEvent _readLineSignal;
64
        private string _lastLine;
65 233ef333 taeseongkim
66 a0bab669 KangIngu
        public MyConsole()
67
        {
68
            _readLineSignal = new System.Threading.ManualResetEvent(false);
69
            Gui = new TextBox();
70
            Gui.AcceptsReturn = true;
71
            Gui.KeyUp += OnKeyUp;
72
        }
73
74
        private void OnKeyUp(object sender, KeyEventArgs e)
75
        {
76
            // this is always fired on UI thread
77
            if (e.Key == Key.Enter)
78
            {
79
                // quick and dirty, but that is not relevant to your question
80
                _lastLine = Gui.Text.Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries).Last();
81
                // now, when you detected that user typed a line, set signal
82
                _readLineSignal.Set();
83
            }
84
        }
85
86
        public TextBox Gui { get; private set; }
87
88
        public string ReadLine()
89
        {
90
            // that should always be called from non-ui thread
91
            if (Gui.Dispatcher.CheckAccess())
92
                throw new Exception("Cannot be called on UI thread");
93
            // reset signal
94
            _readLineSignal.Reset();
95
            // wait until signal is set. This call is blocking, but since we are on non-ui thread - there is no problem with that
96
            _readLineSignal.WaitOne();
97
            // we got signalled - return line user typed.
98
            return _lastLine;
99
        }
100
101
        public void WriteLine(string line)
102
        {
103
            if (!Gui.Dispatcher.CheckAccess())
104
            {
105
                Gui.Dispatcher.Invoke(new Action(() => WriteLine(line)));
106
                return;
107
            }
108
109
            Gui.Text += line + Environment.NewLine;
110
        }
111
    }
112
113 787a4489 KangIngu
    /// <summary>
114
    /// MainMenu.xaml에 대한 상호 작용 논리
115
    /// </summary>
116
    public partial class MainMenu : UserControl
117
    {
118
        #region 프로퍼티
119 233ef333 taeseongkim
120 2b1f30fe taeseongkim
        private BitmapFrame tempPageImage =null;
121 f5f788c2 taeseongkim
122 873011c4 humkyung
        public UndoDataGroup UndoDataGroup { get; set; }
123 9380813b swate0609
        public CommentUserInfo previousControl { get; set; }
124 787a4489 KangIngu
        public CommentUserInfo currentControl { get; set; }
125
        public ControlType controlType { get; set; }
126 e6a9ddaf humkyung
        private Move move = new Move();
127 787a4489 KangIngu
        private double[] rotateValue = { 0, 90, 180, 270 };
128
        public MouseHandlingMode mouseHandlingMode = MouseHandlingMode.None;
129
        private static readonly double DragThreshold = 5;
130 eb2b9248 KangIngu
        private System.Windows.Input.Cursor cursor { get; set; }
131 c7fde400 taeseongkim
132
        /// <summary>
133
        ///  문서의 마우스 위치
134
        /// </summary>
135
        public Point CanvasDrawingMouseDownPoint;
136
137 787a4489 KangIngu
        public string filename { get; set; }
138
        private Point canvasZoomPanningMouseDownPoint;
139
        public Point getCurrentPoint;
140
        private Point canvasZoommovingMouseDownPoint;
141 233ef333 taeseongkim
        private List<object> ControlList = new List<object>();
142 787a4489 KangIngu
        private ListBox listBox = new ListBox();
143
        private Dictionary<Geometry, string> selected_item = new Dictionary<Geometry, string>();
144
        private bool isDraggingSelectionRect = false;
145 233ef333 taeseongkim
        private DrawingAttributes inkDA = new DrawingAttributes();
146 787a4489 KangIngu
        private VPRevision CurrentRev { get; set; }
147
        public RadRibbonButton btnConsolidate { get; set; }
148
        public RadRibbonButton btnFinalPDF { get; set; }
149
        public RadRibbonButton btnTeamConsolidate { get; set; }
150 80458c15 ljiyeon
        public RadRibbonButton btnConsolidateFinalPDF { get; set; }
151
152 787a4489 KangIngu
        public string Filename_ { get; set; }
153
        public double L_Size = 0;
154
        public AdornerFinal adorner_;
155 b79d6e7f humkyung
        public UndoData multi_UndoData;
156 5ce56a3a KangIngu
        public string Symbol_ID = "";
157 233ef333 taeseongkim
158 787a4489 KangIngu
        /// <summary>
159
        /// Set to 'true' when the left mouse-button is down.
160
        /// </summary>
161 9f473fb7 KangIngu
        public bool isLeftMouseButtonDownOnWindow = false;
162 787a4489 KangIngu
163
        public InkPresenter _InkBoard = null;
164 233ef333 taeseongkim
        private Stroke stroke;
165
        private Boolean IsDrawing = false;
166
        private StylusPointCollection strokePoints;
167
168 53880c83 ljiyeon
        //StylusPointCollection erasePoints;
169 233ef333 taeseongkim
        private RenderTargetBitmap canvasImage;
170
171
        private Point Sync_Offset_Point;
172 787a4489 KangIngu
173
        //강인구 테스트
174
        private Path _SelectionPath { get; set; }
175 233ef333 taeseongkim
176 787a4489 KangIngu
        public Path SelectionPath
177
        {
178
            get
179
            {
180
                return _SelectionPath;
181
            }
182
            set
183
            {
184
                if (_SelectionPath != value)
185
                {
186
                    _SelectionPath = value;
187
                    RaisePropertyChanged("SelectionPath");
188
                }
189
            }
190
        }
191
192
        private System.Windows.Controls.Image _imageViewer { get; set; }
193 233ef333 taeseongkim
194 787a4489 KangIngu
        public System.Windows.Controls.Image imageViewer
195
        {
196
            get
197
            {
198
                if (_imageViewer == null)
199
                {
200
                    _imageViewer = new System.Windows.Controls.Image();
201
                    return _imageViewer;
202
                }
203
                else
204
                {
205
                    return _imageViewer;
206
                }
207
            }
208
            set
209
            {
210
                if (_imageViewer != value)
211
                {
212
                    _imageViewer = value;
213
                }
214
            }
215
        }
216
217
        public bool IsSyncPDFMode { get; set; }
218
219
        private System.Windows.Controls.Image _imageViewer_Compare { get; set; }
220 233ef333 taeseongkim
221 787a4489 KangIngu
        public System.Windows.Controls.Image imageViewer_Compare
222
        {
223
            get
224
            {
225
                if (_imageViewer_Compare == null)
226
                {
227
                    _imageViewer_Compare = new System.Windows.Controls.Image();
228
                    return _imageViewer_Compare;
229
                }
230
                else
231
                {
232
                    return _imageViewer_Compare;
233
                }
234
            }
235
            set
236
            {
237
                if (_imageViewer_Compare != value)
238
                {
239
                    _imageViewer_Compare = value;
240
                }
241
            }
242
        }
243
244 233ef333 taeseongkim
        #endregion 프로퍼티
245 90e7968d ljiyeon
246 787a4489 KangIngu
        public MainMenu()
247
        {
248 233ef333 taeseongkim
            //App.splashString(ISplashMessage.MAINMENU_0);
249
            InitializeComponent();
250 f65e6c02 taeseongkim
251 f5f788c2 taeseongkim
            tempPageImage = BitmapFrame.Create(new Uri(@"pack://application:,,,/KCOM;component/Resources/Images/ExtImage/blank.png"), BitmapCreateOptions.None, BitmapCacheOption.OnLoad);
252 dea506e2 taeseongkim
            //List<testItem> testItems = new List<testItem>
253
            //{
254
            //    new testItem{Title = "test1"},
255
            //    new testItem{Title = "test2"},
256
            //    new testItem{Title = "test3"},
257
            //    new testItem{Title = "test4"},
258
            //};
259 f65e6c02 taeseongkim
260 dea506e2 taeseongkim
            //lstSymbolPrivate.ItemsSource = testItems;
261 f65e6c02 taeseongkim
262 90e7968d ljiyeon
            this.Loaded += MainMenu_Loaded;
263 787a4489 KangIngu
        }
264 6707a5c7 ljiyeon
265
        public class TempDt
266
        {
267
            public int PageNumber { get; set; }
268
            public string CommentID { get; set; }
269
            public string ConvertData { get; set; }
270
            public int DATA_TYPE { get; set; }
271
            public string MarkupInfoID { get; set; }
272
            public int IsUpdate { get; set; }
273
        }
274
275 233ef333 taeseongkim
        private List<TempDt> tempDtList = new List<TempDt>();
276 90e7968d ljiyeon
277 38d69491 taeseongkim
        public void SetCursor()
278 787a4489 KangIngu
        {
279
            this.Cursor = cursor;
280
        }
281
282 69f41aab humkyung
        /// <summary>
283
        /// get image url
284
        /// </summary>
285
        /// <author>humkyung</author>
286
        /// <param name="sDocumentID"></param>
287
        /// <returns></returns>
288 6dcbe4a7 humkyung
        public string GetImageURL(string sDocumentID, int iPageNo)
289 69f41aab humkyung
        {
290
            string uri = string.Empty;
291
292 fdfa126d taeseongkim
            string sFolder = sDocumentID.All(char.IsDigit) ? (Convert.ToUInt64(sDocumentID) / 100).ToString() : (sDocumentID.Length >= 5 ? sDocumentID.Substring(0, 5) : sDocumentID);
293 69f41aab humkyung
            if (userData.COMPANY != "EXT")
294
            {
295
                uri = String.Format(CommonLib.Common.GetConfigString("mainServerImageWebPath", "URL", "", App.isExternal), _ViewInfo.ProjectNO, sFolder, sDocumentID, iPageNo);
296
            }
297
            else
298
            {
299
                uri = String.Format(CommonLib.Common.GetConfigString("subServerImageWebPath", "URL", "", App.isExternal), _ViewInfo.ProjectNO, sDocumentID, iPageNo);
300
            }
301
302
            return uri;
303
        }
304
305 52827a4c djkim
        /// <summary>
306
        /// 외부망에서의 Original PDF Download 를 위한 리소스 web path 경로로 치환
307
        /// </summary>
308
        /// <returns></returns>
309
        public string GetOriginalPDFURL()
310
        {
311
            string uri = string.Empty;
312
            string sDocumentID = this._DocItem.DOCUMENT_ID;
313
            string filename = string.Empty;
314
            if (this._DocInfo.ORIGINAL_FILE.Contains("fileName"))
315
            {
316
                filename = HttpUtility.ParseQueryString(this._DocInfo.ORIGINAL_FILE).Get("fileName");
317
            }
318
            else
319
            {
320
                filename = System.IO.Path.GetFileName(this._DocInfo.ORIGINAL_FILE);
321
            }
322 0f26a9aa taeseongkim
323 77cdac33 taeseongkim
            var directUri = CommonLib.Common.GetConfigString("DocumentDownloadPath", "url", "");
324
325
            if (!string.IsNullOrWhiteSpace(directUri))
326 52827a4c djkim
            {
327 77cdac33 taeseongkim
                uri = string.Format(directUri, filename);
328 52827a4c djkim
            }
329
            else
330
            {
331 fdfa126d taeseongkim
                string sFolder = sDocumentID.All(char.IsDigit) ? (Convert.ToUInt64(sDocumentID) / 100).ToString() : (sDocumentID.Length >= 5 ? sDocumentID.Substring(0, 5) : sDocumentID);
332 77cdac33 taeseongkim
                if (userData.COMPANY != "EXT")
333
                {
334
                    uri = String.Format(CommonLib.Common.GetConfigString("mainServerImageWebPath", "URL", "", App.isExternal), _ViewInfo.ProjectNO, sFolder, sDocumentID, filename);
335
                }
336
                else
337
                {
338
                    uri = String.Format(CommonLib.Common.GetConfigString("subServerImageWebPath", "URL", "", App.isExternal), _ViewInfo.ProjectNO, sDocumentID, filename);
339
                }
340
                uri = uri.Replace(".png", "");
341 52827a4c djkim
            }
342 77cdac33 taeseongkim
343 52827a4c djkim
            return uri;
344
        }
345 0f26a9aa taeseongkim
346 787a4489 KangIngu
        private bool IsDrawingEnable(Point _canvasZoomPanningMouseDownPoint)
347
        {
348
            if ((_canvasZoomPanningMouseDownPoint.X > 0 &&
349 ca40e004 ljiyeon
                zoomAndPanCanvas.ActualWidth > _canvasZoomPanningMouseDownPoint.X) &&
350
                (_canvasZoomPanningMouseDownPoint.Y > 0 &&
351
                zoomAndPanCanvas.ActualHeight > _canvasZoomPanningMouseDownPoint.Y))
352 787a4489 KangIngu
            {
353
                return true;
354
            }
355
356
            return false;
357
        }
358
359 ca40e004 ljiyeon
        private bool IsRotationDrawingEnable(Point _canvasZoomPanningMouseDownPoint)
360
        {
361
            if (rotate.Angle == 90 || rotate.Angle == 270)
362
            {
363
                if ((_canvasZoomPanningMouseDownPoint.X > 0 &&
364
                zoomAndPanCanvas.ActualHeight > _canvasZoomPanningMouseDownPoint.X) &&
365
                (_canvasZoomPanningMouseDownPoint.Y > 0 &&
366
                zoomAndPanCanvas.ActualWidth > _canvasZoomPanningMouseDownPoint.Y))
367
                {
368
                    return true;
369
                }
370
            }
371
            else
372
            {
373
                if ((_canvasZoomPanningMouseDownPoint.X > 0 &&
374
                zoomAndPanCanvas.ActualWidth > _canvasZoomPanningMouseDownPoint.X) &&
375
                (_canvasZoomPanningMouseDownPoint.Y > 0 &&
376
                zoomAndPanCanvas.ActualHeight > _canvasZoomPanningMouseDownPoint.Y))
377
                {
378
                    return true;
379
                }
380 90e7968d ljiyeon
            }
381 ca40e004 ljiyeon
382
            return false;
383
        }
384
385 f258d884 humkyung
        /// <summary>
386
        /// 주어진 레이어를 삭제한다.
387
        /// </summary>
388
        /// <param name="item"></param>
389 787a4489 KangIngu
        public void DeleteItem(MarkupInfoItem item)
390
        {
391
            if (PreviewUserMarkupInfoItem != null && item.Consolidate == 1 && item.AvoidConsolidate == 0)
392
            {
393 233ef333 taeseongkim
                App.Custom_ViewInfoId = PreviewUserMarkupInfoItem.MarkupInfoID;
394
            }
395 787a4489 KangIngu
396 f258d884 humkyung
            #region Consolidate 또는 AvoidConsolidate한 레이어만 삭제한다.
397 55b32920 humkyung
            if (item.Consolidate == 1 || item.AvoidConsolidate == 1)
398
            {
399
                ViewerDataModel.Instance._markupInfoList.Remove(item);
400
                gridViewMarkup.ItemsSource = ViewerDataModel.Instance._markupInfoList;
401
            }
402 f258d884 humkyung
            #endregion
403 787a4489 KangIngu
404 f258d884 humkyung
            #region item에 속한 컨트롤들을 삭제한다.
405 787a4489 KangIngu
            ViewerDataModel.Instance.MarkupControls.Where(data => data.MarkupInfoID == item.MarkupInfoID).ToList().ForEach(a =>
406
            {
407
                ViewerDataModel.Instance.MarkupControls.Remove(a);
408
            });
409
410
            ViewerDataModel.Instance.MarkupControls_USER.Where(data => data.MarkupInfoID == item.MarkupInfoID).ToList().ForEach(a =>
411
            {
412
                ViewerDataModel.Instance.MarkupControls_USER.Remove(a);
413 39f0624f ljiyeon
                ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.MarkupListUpdate(
414 873011c4 humkyung
                null, EventType.Delete, a.CommentID, null);
415 787a4489 KangIngu
            });
416 f258d884 humkyung
            #endregion
417 787a4489 KangIngu
418 d62c0439 humkyung
            ViewerDataModel.Instance.MyMarkupList.Where(data => data.MarkupInfoID == item.MarkupInfoID).ToList().ForEach(a =>
419 787a4489 KangIngu
            {
420 d62c0439 humkyung
                ViewerDataModel.Instance.MyMarkupList.Remove(a);
421 6707a5c7 ljiyeon
                //임시파일에서도 삭제
422 2b1f30fe taeseongkim
                //TempFile.DelTemp(a.ID, this.ParentOfType<MainWindow>().dzMainMenu.pageNavigator.CurrentPage.PageNumber.ToString());
423 787a4489 KangIngu
            });
424
425 f258d884 humkyung
            if (PreviewUserMarkupInfoItem == null && gridViewMarkup.SelectedItems.FirstOrDefault(d => (d as MarkupInfoItem).UserID == App.ViewInfo.UserID) == null)
426 787a4489 KangIngu
            {
427 f258d884 humkyung
                if (!gridViewMarkup.Items.Cast<MarkupInfoItem>().Any(d => d.UserID == App.ViewInfo.UserID))
428 787a4489 KangIngu
                {
429 24678e06 humkyung
                    var infoId = Commons.shortGuid();
430 787a4489 KangIngu
                    PreviewUserMarkupInfoItem = new MarkupInfoItem
431
                    {
432
                        CreateTime = DateTime.Now,
433
                        Depatment = userData.DEPARTMENT,
434 992a98b4 KangIngu
                        UpdateTime = DateTime.Now,
435 787a4489 KangIngu
                        DisplayColor = "#FFFF0000",
436
                        UserID = userData.ID,
437
                        UserName = userData.NAME,
438
                        PageCount = 1,
439
                        Description = "",
440
                        MarkupInfoID = infoId,
441
                        MarkupList = null,
442 24678e06 humkyung
                        MarkupVersionID = Commons.shortGuid(),
443 787a4489 KangIngu
                        Consolidate = 0,
444
                        PartConsolidate = 0,
445
                        userDelete = true,
446
                        AvoidConsolidate = 0,
447
                        IsPreviewUser = true
448
                    };
449
                    App.Custom_ViewInfoId = infoId;
450
                }
451
            }
452 f258d884 humkyung
453 233ef333 taeseongkim
            BaseClient.DeleteMarkupAsync(App.ViewInfo.ProjectNO, item.MarkupInfoID);
454 787a4489 KangIngu
        }
455
456 959b3ef2 humkyung
        /// <summary>
457
        /// delete selected comments
458
        /// </summary>
459
        /// <param name="sender"></param>
460
        /// <param name="e"></param>
461 787a4489 KangIngu
        public void DeleteCommentEvent(object sender, RoutedEventArgs e)
462
        {
463 552af7c7 swate0609
            //ReadOnly 권한이 어떻게 들어오는지 모르겠음.
464
            //NewCommentPermission으로 일단 처리 함. (2024-06-05 IRON)
465
            if (App.ViewInfo.NewCommentPermission)
466 c35e49f5 ljiyeon
            {
467 552af7c7 swate0609
                //정말 삭제 하시겠습니까?
468
                DialogParameters parameters = new DialogParameters()
469 17202508 ljiyeon
                {
470 552af7c7 swate0609
                    Owner = Application.Current.MainWindow,
471
                    Content = new TextBlock()
472 17202508 ljiyeon
                    {
473 552af7c7 swate0609
                        MinWidth = 400,
474
                        FontSize = 11,
475
                        Text = "Are you sure you want to delete?",
476
                        TextWrapping = System.Windows.TextWrapping.Wrap
477
                    },
478
                    Header = "Confirm",
479
                    Theme = new VisualStudio2013Theme(),
480
                    ModalBackground = new SolidColorBrush { Color = Colors.Black, Opacity = 0.6 },
481
                    OkButtonContent = "Yes",
482
                    CancelButtonContent = "No",
483
                    Closed = delegate (object windowSender, WindowClosedEventArgs wc)
484
                    {
485
                        if (wc.DialogResult == true)
486
                        {
487
                            //선택된 어도너가 있을시 삭제가 되지 않음
488
                            SelectionSet.Instance.UnSelect(this);
489 787a4489 KangIngu
490 552af7c7 swate0609
                            Button content = (sender as Button);
491
                            MarkupInfoItem item = content.CommandParameter as MarkupInfoItem;
492 787a4489 KangIngu
493 552af7c7 swate0609
                            DeleteItem(item);
494
                        }
495 17202508 ljiyeon
                    }
496 552af7c7 swate0609
                };
497
                RadWindow.Confirm(parameters);
498
            }
499 787a4489 KangIngu
        }
500
501 233ef333 taeseongkim
        private System.Windows.Media.Animation.DoubleAnimation da = new System.Windows.Media.Animation.DoubleAnimation();
502 787a4489 KangIngu
503 6707a5c7 ljiyeon
        private static Timer timer;
504
        private int InitInterval = KCOM.Properties.Settings.Default.InitInterval;
505 233ef333 taeseongkim
506 787a4489 KangIngu
        private void MainMenu_Loaded(object sender, RoutedEventArgs e)
507 90e7968d ljiyeon
        {
508 233ef333 taeseongkim
            //InitializeComponent();
509 90e7968d ljiyeon
            //System.Diagnostics.Debug.WriteLine("MainMenu() : " + sw.ElapsedMilliseconds.ToString() + "ms");
510
511 787a4489 KangIngu
            if (App.ParameterMode)
512 6707a5c7 ljiyeon
            {
513 e59e6c8e 이지연
                
514 f7caaaaf ljiyeon
                App.splashString(ISplashMessage.MAINMENU_1);
515 54a28343 taeseongkim
                this.pageNavigator.ThumbInitialized += pageNavigator_ThumbInitialized;
516 6707a5c7 ljiyeon
                this.pageNavigator.PageChanging += pageNavigator_PageChanging;
517 afaa7c92 djkim
                this.pageNavigator.PageChanged += PageNavigator_PageChanged;
518 2007ecaa taeseongkim
519 6707a5c7 ljiyeon
                imageViewer_Compare = new Image();
520
                ViewerDataModel.Instance.Capture_Opacity = 0;
521
                da.From = 0.8;
522
                da.To = 0;
523
                da.Duration = new Duration(TimeSpan.FromSeconds(1));
524
                da.AutoReverse = true;
525 e0204db0 djkim
                da.RepeatBehavior = System.Windows.Media.Animation.RepeatBehavior.Forever;
526 e59e6c8e 이지연
               
527 e0204db0 djkim
                if (!App.ViewInfo.CreateFinalPDFPermission && !App.ViewInfo.NewCommentPermission)
528 90e7968d ljiyeon
                {
529 e0204db0 djkim
                    this.SymbolPane.Visibility = Visibility.Collapsed;
530
                    this.FavoritePane.Visibility = Visibility.Collapsed;
531
                    this.drawingRotateCanvas.IsHitTestVisible = false;
532 90e7968d ljiyeon
                }
533 8411f02d ljiyeon
                thumbnailPanel.Width = Convert.ToInt32(CommonLib.Common.GetConfigString("SetThumbnail", "WIDTH", "250"));
534 6707a5c7 ljiyeon
            }
535 6af42ff0 taeseongkim
536 2007ecaa taeseongkim
            //timer = new Timer(timercallback, null, 0, InitInterval * 60000);
537 ccf944bb ljiyeon
        }
538
539 f258d884 humkyung
        /// <summary>
540
        /// 검색을 위해 원본 PDF 파일을 다운로드한다.
541
        /// </summary>
542 2007ecaa taeseongkim
        private void DownloadOriginalFile()
543 6af42ff0 taeseongkim
        {
544 2007ecaa taeseongkim
            #region 임시파일 다운로드
545 9d5b4bc2 taeseongkim
            instnaceFile = System.IO.Path.Combine(System.IO.Path.GetTempPath(), "MARKUS", System.IO.Path.GetRandomFileName().Split('.')[0] + ".pdf");
546 77cdac33 taeseongkim
       
547
            var directUri = CommonLib.Common.GetConfigString("DocumentDownloadPath", "url", "");
548 058a4c0d taeseongkim
549
            bool isRestDownload = Convert.ToBoolean(CommonLib.Common.GetConfigString("DocumentDownloadPath", "IsRest", "False"));
550
551 77cdac33 taeseongkim
552
            if (!string.IsNullOrWhiteSpace(directUri))
553
            {
554 058a4c0d taeseongkim
                if (directUri.ToLower() == "full")
555 92c9cab8 taeseongkim
                {
556
                    downloadurl = this._DocInfo.ORIGINAL_FILE;
557
                }
558
                else
559
                {
560
                    isRestDownload = true;
561
                    filename = System.IO.Path.GetFileName(this._DocInfo.ORIGINAL_FILE);
562 77cdac33 taeseongkim
563 92c9cab8 taeseongkim
                    downloadurl = string.Format(directUri, filename);
564
                }
565 77cdac33 taeseongkim
             }
566
            else
567
            {
568
                downloadurl = GetOriginalPDFURL();
569
            }
570 9d5b4bc2 taeseongkim
571
            ViewerDataModel.Instance.OriginalTempFile = instnaceFile;
572
            
573
            string endpoint = Common.Commons.shortGuid() + "file";
574 2007ecaa taeseongkim
            IIpc.WcfServer wcfServer = new IIpc.WcfServer(endpoint);
575
            wcfServer.IpcFileDownloadReceived += WcfServer_IpcFileDownloadReceived;
576
            wcfServer.Start();
577 9d5b4bc2 taeseongkim
            
578 77cdac33 taeseongkim
            DownloadProcess.FileDownloader(endpoint, ViewerDataModel.Instance.IsAdmin, downloadurl, instnaceFile, isRestDownload);
579 2007ecaa taeseongkim
            #endregion
580
        }
581 6af42ff0 taeseongkim
582 2007ecaa taeseongkim
        string instnaceFile;
583
        string downloadurl;
584 6af42ff0 taeseongkim
585 2007ecaa taeseongkim
        private void WcfServer_IpcFileDownloadReceived(object sender, IIpc.IpcDownloadStatusArgs e)
586
        {
587 6a19b48d taeseongkim
            try
588
            {
589 26ec6226 taeseongkim
                Dispatcher.BeginInvoke((Action)delegate ()
590
                {
591
                    if ((sender as IIpc.WcfServer).IsOpen)
592
                    {
593
                        ViewerDataModel.Instance.DownloadFileProgress = (int)e.Progress;
594
                    }
595
596
                });
597 6af42ff0 taeseongkim
598 26ec6226 taeseongkim
                if ((sender as IIpc.WcfServer).IsOpen)
599 6a19b48d taeseongkim
                {
600 26ec6226 taeseongkim
                    if (e.IsFinish)
601
                    {
602
                        ViewerDataModel.Instance.SystemMain.dzMainMenu.searchPanel_Instance.SetSerachPDFFile(instnaceFile);
603
                        ViewerDataModel.Instance.IsDownloadOriginal = true;
604
                        (sender as IIpc.WcfServer).Stop();
605
                        (sender as IIpc.WcfServer).IpcFileDownloadReceived -= WcfServer_IpcFileDownloadReceived;
606
                    }
607 6a19b48d taeseongkim
                }
608
            }
609
            catch (Exception ex)
610 6af42ff0 taeseongkim
            {
611 6a19b48d taeseongkim
                throw;
612 6af42ff0 taeseongkim
            }
613
        }
614 afaa7c92 djkim
615 d62c0439 humkyung
        /// <summary>
616
        /// update my markuplist
617
        ///  - update existing markup data if already exist
618
        ///  - add new markup data if control is new
619
        /// </summary>
620
        public void UpdateMyMarkupList()
621 787a4489 KangIngu
        {
622 548c696e ljiyeon
            Logger.sendCheckLog("pageNavigator_PageChanging_ChangeCommentReact", 1);
623 787a4489 KangIngu
624 d62c0439 humkyung
            /// add or update markup list
625
            foreach (var control in ViewerDataModel.Instance.MarkupControls_USER)
626 787a4489 KangIngu
            {
627 d62c0439 humkyung
                var root = MarkupParser.MarkupToString(control, App.ViewInfo.UserID);
628 90e7968d ljiyeon
629 d62c0439 humkyung
                var exist = ViewerDataModel.Instance.MyMarkupList.Where(data => data.ID == root.CommentID).FirstOrDefault();
630
                if (exist != null) //신규 추가 된 코멘트
631
                {
632
                    if (exist.Data != root.ConvertData) //코멘트가 같은지
633 6707a5c7 ljiyeon
                    {
634 d62c0439 humkyung
                        exist.Data = root.ConvertData;
635
                        exist.IsUpdate = true;
636 6707a5c7 ljiyeon
                    }
637 d62c0439 humkyung
                }
638
                else if (root.CommentID != null)
639
                {
640
                    ViewerDataModel.Instance.MyMarkupList.Add(new MarkupItemEx
641 6707a5c7 ljiyeon
                    {
642 d62c0439 humkyung
                        ID = control.CommentID,
643
                        Data = root.ConvertData,
644
                        Data_Type = root.DATA_TYPE,
645
                        MarkupInfoID = App.Custom_ViewInfoId,
646
                        PageNumber = this.pageNavigator.CurrentPage.PageNumber,
647
                        Symbol_ID = control.SymbolID,
648 c0977e97 djkim
                        //Group_ID = control.GroupID,
649 d62c0439 humkyung
                    });
650 787a4489 KangIngu
                }
651
            }
652
653 24c5e56c taeseongkim
            //if (this.pageNavigator.CurrentPage != null)
654
            //{
655
            //    /// delete markup list
656
            //    int iPageNo = this.pageNavigator.CurrentPage.PageNumber;
657 6b6e937c taeseongkim
658 24c5e56c taeseongkim
            //    var deleted = (from markup in ViewerDataModel.Instance.MyMarkupList
659
            //                   where (markup.PageNumber == iPageNo)
660
            //                   && (null == ViewerDataModel.Instance.MarkupControls_USER.Where(control => control.CommentID == markup.ID).FirstOrDefault())
661
            //                   select markup).ToList();
662 6b6e937c taeseongkim
663 24c5e56c taeseongkim
            //    foreach (var markup in deleted)
664
            //    {
665
            //        ViewerDataModel.Instance.MyMarkupList.Remove(markup);
666
            //    }
667
            //}
668
            //else
669
            //{
670
            //    System.Diagnostics.Debug.WriteLine("UpdateMyMarkupList : this.pageNavigator.CurrentPage null ");
671
            //}
672 0585d5cc taeseongkim
673 d62c0439 humkyung
            /// up to here
674 6707a5c7 ljiyeon
675 129ca191 humkyung
            //if (modified)
676
            //{
677
            //    if (ViewerDataModel.Instance._markupInfoList.Where(info => info.UserID == PreviewUserMarkupInfoItem.UserID).FirstOrDefault() == null)
678
            //    {
679
            //        ComingNewBieEnd = true;
680
            //        ViewerDataModel.Instance._markupInfoList.Insert(0, PreviewUserMarkupInfoItem);
681
            //        PreviewUserMarkupInfoItem.IsPreviewUser = false;
682
            //        gridViewMarkup.ItemsSource = null;
683
            //        gridViewMarkup.ItemsSource = ViewerDataModel.Instance._markupInfoList;
684
            //        gridViewMarkup.SelectedItem = PreviewUserMarkupInfoItem;
685
686
            //        GroupDescriptor descriptor = new GroupDescriptor();
687
            //        descriptor.Member = "Depatment";
688
            //        descriptor.DisplayContent = "DEPT";
689
            //        descriptor.SortDirection = ListSortDirection.Ascending;
690
            //        gridViewMarkup.GroupDescriptors.Add(descriptor);
691
            //    }
692
            //}
693 787a4489 KangIngu
        }
694
695 cb5c7f06 humkyung
        /// <summary>
696
        /// start page changing
697
        ///  - save controls if page is modified
698
        ///  - starting download page image
699
        /// </summary>
700
        /// <param name="sender"></param>
701
        /// <param name="e"></param>
702 cdfb57ff taeseongkim
        private async void pageNavigator_PageChanging(object sender, Controls.Sample.PageChangeEventArgs e)
703 548c696e ljiyeon
        {
704 5c64268e taeseongkim
            System.Diagnostics.Debug.WriteLine("pageNavigator PageChanging");
705 f5f788c2 taeseongkim
            //    await PageLoadAsync(e.CurrentPage,e.PageNumber);
706
            //}
707
            //private async Task PageLoadAsync(DOCPAGE page, int PageNo)
708
            //{
709
            DOCPAGE page = e.CurrentPage;
710
            int PageNo = e.PageNumber;
711 24c5e56c taeseongkim
712 f5f788c2 taeseongkim
            ViewerDataModel.Instance.PageAngle = page.PAGE_ANGLE;
713 e8557bd7 taeseongkim
714 dea506e2 taeseongkim
            // 페이지 이미지 변경
715 f5f788c2 taeseongkim
716
            /// 컨트롤을 새로 생성한다.
717
            ViewerDataModel.Instance.ImageViewPath = tempPageImage;
718
            ViewerDataModel.Instance.ImageViewWidth = 1;
719
            ViewerDataModel.Instance.ImageViewHeight = 1;
720
721 5c64268e taeseongkim
            ViewerDataModel.Instance.SystemMain.dzMainMenu.SelectLayer.Children.Clear();
722
            Common.ViewerDataModel.Instance.MarkupControls_USER.Clear();    //전체 제거
723
            Common.ViewerDataModel.Instance.MarkupControls.Clear();         //전체 제거
724
725 45ac2822 taeseongkim
            await PageChangingAsync(page, PageNo, ViewerDataModel.Instance.NewPagImageCancelToken());
726
            
727 f5f788c2 taeseongkim
            await MarkupLoadAsync(PageNo, ViewerDataModel.Instance.PageAngle, ViewerDataModel.Instance.NewMarkupCancelToken());
728
729
            //var pagechangeTask = PageChangingAsync(page, page.PAGE_NUMBER, ViewerDataModel.Instance.NewPagImageCancelToken());
730
731
            //var markupLoadTask = MarkupLoadAsync(page.PAGE_NUMBER, ViewerDataModel.Instance.PageAngle, ViewerDataModel.Instance.NewMarkupCancelToken());
732
733
            //await Task.WhenAll(pagechangeTask, markupLoadTask);
734 d7e20d2d taeseongkim
        }
735
736 24c5e56c taeseongkim
        private async Task PageChangingAsync(DOCPAGE currentPage, int changePageNumber,CancellationToken token)
737 233ef333 taeseongkim
        {
738 d7e20d2d taeseongkim
            var BalancePoint = ViewerDataModel.Instance.PageBalanceMode == true ? changePageNumber + ViewerDataModel.Instance.PageBalanceNumber : changePageNumber;
739 233ef333 taeseongkim
740 787a4489 KangIngu
            #region 페이지가 벗어난 경우
741
742
            if (BalancePoint < 1)
743
            {
744
                BalancePoint = 1;
745
                ViewerDataModel.Instance.PageBalanceNumber = 0;
746
            }
747
748
            if (pageNavigator.PageCount < BalancePoint)
749
            {
750
                BalancePoint = pageNavigator.PageCount;
751
                ViewerDataModel.Instance.PageBalanceNumber = 0;
752
            }
753
754 233ef333 taeseongkim
            #endregion 페이지가 벗어난 경우
755 787a4489 KangIngu
756 752b18ef taeseongkim
            ViewerDataModel.Instance.SyncPageNumber = BalancePoint;
757 787a4489 KangIngu
758 d7e20d2d taeseongkim
            var pageWidth = Convert.ToDouble(currentPage.PAGE_WIDTH);
759
            var pageHeight = Convert.ToDouble(currentPage.PAGE_HEIGHT);
760 cdfb57ff taeseongkim
            var contentScale = zoomAndPanControl.ContentScale;
761 8614f701 taeseongkim
762 92442e4a taeseongkim
            #region 페이지 이미지 로딩 수정
763 f5f788c2 taeseongkim
            
764 8a9f6742 djkim
765 24c5e56c taeseongkim
            ViewerDataModel.Instance.ImageViewPath = await App.PageStorage.GetPageImageAsync(token,changePageNumber);
766 233ef333 taeseongkim
767 f5f788c2 taeseongkim
            if(token.IsCancellationRequested)
768
            {
769
                return;
770
            }
771
772 d48260a2 djkim
            ScaleImage(pageWidth, pageHeight);
773
774
            ViewerDataModel.Instance.ImageViewWidth = pageWidth;
775
            ViewerDataModel.Instance.ImageViewHeight = pageHeight;
776
777
            zoomAndPanCanvas.Width = pageWidth;
778
            zoomAndPanCanvas.Height = pageHeight;
779
780
            Common.ViewerDataModel.Instance.ContentWidth = pageWidth;
781
            Common.ViewerDataModel.Instance.ContentHeight = pageHeight;
782
783
            inkBoard.Width = pageWidth;
784
            inkBoard.Height = pageHeight;
785 cdfb57ff taeseongkim
786 233ef333 taeseongkim
            #endregion 페이지 이미지 로딩 수정
787 90e7968d ljiyeon
788 787a4489 KangIngu
            if (!testPanel2.IsHidden)
789
            {
790 548c696e ljiyeon
                Logger.sendCheckLog("pageNavigator_PageChanging_!testPanel2.IsHidden 일 때", 1);
791 787a4489 KangIngu
                //PDF모드일때 잠시 대기(강인구)
792
                if (IsSyncPDFMode)
793
                {
794
                    Get_FinalImage.Get_PdfImage get_PdfImage = new Get_FinalImage.Get_PdfImage();
795 752b18ef taeseongkim
                    var pdfpath = new BitmapImage(new Uri(get_PdfImage.Run(CurrentRev.TO_VENDOR, App.ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, ViewerDataModel.Instance.SyncPageNumber)));
796 787a4489 KangIngu
797 548c696e ljiyeon
                    Logger.sendCheckLog("pageNavigator_PageChanging_pdfpath Image Downloading", 1);
798 787a4489 KangIngu
                    if (pdfpath.IsDownloading)
799
                    {
800
                        pdfpath.DownloadCompleted += (ex, arg) =>
801
                        {
802 548c696e ljiyeon
                            Logger.sendCheckLog("pageNavigator_PageChanging_pdfpath Image DownloadCompleted", 1);
803 787a4489 KangIngu
                            ViewerDataModel.Instance.ImageViewPath_C = pdfpath;
804
                            ViewerDataModel.Instance.ImageViewWidth_C = pdfpath.PixelWidth;
805
                            ViewerDataModel.Instance.ImageViewHeight_C = pdfpath.PixelHeight;
806
                            zoomAndPanCanvas2.Width = pdfpath.PixelWidth;
807
                            zoomAndPanCanvas2.Height = pdfpath.PixelHeight;
808
                        };
809
                    }
810
                    else
811
                    {
812 548c696e ljiyeon
                        Logger.sendCheckLog("pageNavigator_PageChanging_pdfpath Image Page Setting", 1);
813 787a4489 KangIngu
                        ViewerDataModel.Instance.ImageViewPath_C = pdfpath;
814
                        ViewerDataModel.Instance.ImageViewWidth_C = pdfpath.PixelWidth;
815
                        ViewerDataModel.Instance.ImageViewHeight_C = pdfpath.PixelHeight;
816
817
                        zoomAndPanCanvas2.Width = pdfpath.PixelWidth;
818
                        zoomAndPanCanvas2.Height = pdfpath.PixelHeight;
819
                    }
820
                }
821
                else
822
                {
823 752b18ef taeseongkim
                    Logger.sendCheckLog("Compare Image Download", 1);
824
                    string compareImageUri = this.GetImageURL(CurrentRev.DOCUMENT_ID, BalancePoint);
825
                    ComparePageLoad(compareImageUri,false);
826 787a4489 KangIngu
                }
827 752b18ef taeseongkim
828 787a4489 KangIngu
                tlSyncPageNum.Text = String.Format("Current Page : {0}", BalancePoint);
829
            }
830
831 f4ec4218 taeseongkim
            SearchFocusBorder.Visibility = Visibility.Collapsed;
832
833 d7e20d2d taeseongkim
            this.pageNavigator.ChangePage(changePageNumber);
834 cdfb57ff taeseongkim
        }
835
836 752b18ef taeseongkim
        private void ComparePageLoad(string pageUri, bool IsOriginalSize)
837
        {
838
            /// 현재 보고 있는 VP와 같은 크기로 로딩
839
            ViewerDataModel.Instance.ImageViewPath_C = null;
840
841
            if (IsOriginalSize && OriginalSizeMode.IsChecked)
842
            {
843
                ViewerDataModel.Instance.ImageViewPath_C = ImageSourceHelper.GetDownloadImage(pageUri);
844
            }
845
            else
846
            {
847
                var imageSize = new Size(ViewerDataModel.Instance.ImageViewWidth, ViewerDataModel.Instance.ImageViewHeight);
848
                ViewerDataModel.Instance.ImageViewPath_C = ImageSourceHelper.GetDownloadImage(pageUri, imageSize);
849
            }
850
851
            if (ViewerDataModel.Instance.ImageViewPath_C != null)
852
            {
853
                ViewerDataModel.Instance.ImageViewWidth_C = ViewerDataModel.Instance.ImageViewPath_C.PixelWidth;
854
                ViewerDataModel.Instance.ImageViewHeight_C = ViewerDataModel.Instance.ImageViewPath_C.PixelHeight;
855
                zoomAndPanCanvas2.Width = ViewerDataModel.Instance.ImageViewPath_C.PixelWidth;
856
                zoomAndPanCanvas2.Height = ViewerDataModel.Instance.ImageViewPath_C.PixelHeight;
857
858
                zoomAndPanControl.ZoomTo(new Rect
859
                {
860
                    X = 0,
861
                    Y = 0,
862
                    Width = Math.Max(zoomAndPanCanvas.Width, zoomAndPanCanvas2.Width),
863
                    Height = Math.Max(zoomAndPanCanvas.Height, zoomAndPanCanvas2.Height),
864
                });
865
866
                if (Sync.IsChecked)
867
                {
868
                    Sync_Click(null, new RoutedEventArgs());
869
                }
870
871
                if (CompareMode.IsChecked)
872
                {
873
                    SyncCompare_Click(null, new RoutedEventArgs());
874
                }
875
            }
876
        }
877
878 3ffd4b2d humkyung
        /// <summary>
879
        /// called after page is changed
880
        /// </summary>
881
        /// <param name="sender"></param>
882
        /// <param name="e"></param>
883 a1142a6b taeseongkim
        private async void PageNavigator_PageChanged(object sender, Sample.PageChangeEventArgs e)
884 3ffd4b2d humkyung
        {
885 a1142a6b taeseongkim
            //if (zoomAndPanCanvas.Width.IsNaN())
886
            //{
887 d5096d58 taeseongkim
            //await zoomAndPanControl.Dispatcher.InvokeAsync(() =>
888
            //    zoomAndPanControl.ZoomTo(new Rect { X = 0, Y = 0, Width = zoomAndPanCanvas.Width, Height = zoomAndPanCanvas.Height })
889
            //    );
890 a1142a6b taeseongkim
            //}
891 233ef333 taeseongkim
892 d7e20d2d taeseongkim
            var instanceMain = ViewerDataModel.Instance.SystemMain;
893
894 315ae55e taeseongkim
            instanceMain.dzMainMenu.CanvasDrawingMouseDownPoint = new Point(ViewerDataModel.Instance.ImageViewWidth / 2, ViewerDataModel.Instance.ImageViewHeight / 2);
895
896 d7e20d2d taeseongkim
            instanceMain.dzTopMenu.tlcurrentPage.Text = e.CurrentPage.PAGE_NUMBER.ToString();
897
            instanceMain.dzTopMenu.tlcurrentPage_readonly.Text = e.CurrentPage.PAGE_NUMBER.ToString();
898
899
            instanceMain.dzTopMenu.rotateOffSet = 0;
900
            var pageinfo = this.CurrentDoc.docInfo.DOCPAGE.Where(p => p.PAGE_NUMBER == e.CurrentPage.PAGE_NUMBER).FirstOrDefault();
901
            drawingPannelRotate(pageinfo.PAGE_ANGLE);
902
903
            /// 페이지의 모든 마크업을 로드한 후 호출
904
            /// 좌측 마크업 list의 아이템을 클릭하는 경우 MarkupControls_USER가 0으로 나와서 추가함.
905 d5096d58 taeseongkim
            ViewerDataModel.Instance.LoadPageMarkupFinish(new Rect { X = 0, Y = 0, Width = zoomAndPanCanvas.Width, Height = zoomAndPanCanvas.Height });
906 e1c892f7 taeseongkim
907
            //Point startPoint = new Point(15, 15);
908
909
            //var markupinfo = ViewerDataModel.Instance._markupInfoList.Where(x => x.UserID == App.ViewInfo.UserID).First();
910
911
            ////var rect = GetRectControl(Convert.ToDouble(pageinfo.PAGE_WIDTH), Convert.ToDouble(pageinfo.PAGE_HEIGHT), markupinfo.UserID, markupinfo.MarkupInfoID, startPoint);
912
913
            ////var txtApproved = GetTextControl(Convert.ToDouble(pageinfo.PAGE_WIDTH), Convert.ToDouble(pageinfo.PAGE_HEIGHT), markupinfo.UserID, markupinfo.MarkupInfoID,
914
            ////                             "APPROVED",30, FontWeights.Bold, TextAlignment.Center, rect.ItemRect, 15);
915
916
            ////var txtCreator = GetTextControl(Convert.ToDouble(pageinfo.PAGE_WIDTH), Convert.ToDouble(pageinfo.PAGE_HEIGHT), markupinfo.UserID, markupinfo.MarkupInfoID
917
            ////                , "By HYOSUNG", 18, FontWeights.Bold, TextAlignment.Center, rect.ItemRect, txtApproved.StartPoint.Y + txtApproved.BoxHeight + 3);
918
919
            //var symCtrl = GetSymNControl(Convert.ToDouble(pageinfo.PAGE_WIDTH), Convert.ToDouble(pageinfo.PAGE_HEIGHT), markupinfo.UserID, markupinfo.MarkupInfoID, startPoint);
920
921
            //var bottom = Rect.Offset(symCtrl.ItemRect, new Vector(0, symCtrl.ItemRect.Height));
922
923
            //var txtOriginator = GetTextControl(Convert.ToDouble(pageinfo.PAGE_WIDTH), Convert.ToDouble(pageinfo.PAGE_HEIGHT), markupinfo.UserID, markupinfo.MarkupInfoID
924
            //               , App.ViewInfo.UserID, 18, FontWeights.Bold, TextAlignment.Left, bottom, bottom.Top + 3);
925
926
            //var dtfi = new System.Globalization.DateTimeFormatInfo { DateSeparator = "-", ShortDatePattern = @"yyyy/MM/dd" };
927
928
            //var txtDate = GetTextControl(Convert.ToDouble(pageinfo.PAGE_WIDTH), Convert.ToDouble(pageinfo.PAGE_HEIGHT), markupinfo.UserID, markupinfo.MarkupInfoID
929
            //               , DateTime.Now.ToString("d", dtfi), 18, FontWeights.Bold, TextAlignment.Left, bottom, txtOriginator.StartPoint.Y + txtOriginator.BoxHeight + 2);
930
931
            //ViewerDataModel.Instance.MarkupControls_USER.Add(symCtrl);
932
            ////ViewerDataModel.Instance.MarkupControls_USER.Add(txtApproved);
933
            ////ViewerDataModel.Instance.MarkupControls_USER.Add(txtCreator);
934
            //ViewerDataModel.Instance.MarkupControls_USER.Add(txtOriginator);
935
            //ViewerDataModel.Instance.MarkupControls_USER.Add(txtDate);
936
937
            //symCtrl.ApplyTemplate();
938
            ////txtApproved.ApplyTemplate();
939
            ////txtCreator.ApplyTemplate();
940
            //txtOriginator.ApplyTemplate();
941
            //txtDate.ApplyTemplate();
942
943
            ////SetTextControl(txtApproved);
944
            ////SetTextControl(txtCreator);
945
            //SetTextControl(txtOriginator);
946
            //SetTextControl(txtDate);
947
948 873011c4 humkyung
            //multi_UndoData = new Multi_UndoData();
949 e1c892f7 taeseongkim
950 873011c4 humkyung
            //MarkupToPDF.Common.UndoData UndoData = new UndoData()
951 e1c892f7 taeseongkim
            //{
952
            //    IsUndo = false,
953 873011c4 humkyung
            //    Event = EventType.Create,
954 e1c892f7 taeseongkim
            //    EventTime = DateTime.Now,
955 873011c4 humkyung
            //    MarkupDataColl = new List<Multi_UndoData>()
956 e1c892f7 taeseongkim
            //};
957
958 873011c4 humkyung
            //multi_UndoData = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.Control_Style(symCtrl as MarkupToPDF.Common.CommentUserInfo);
959
            //UndoData.MarkupDataColl.Add(multi_UndoData);
960 e1c892f7 taeseongkim
961 873011c4 humkyung
            ////multi_UndoData = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.Control_Style(txtApproved as MarkupToPDF.Common.CommentUserInfo);
962
            ////UndoData.MarkupDataColl.Add(multi_UndoData);
963 e1c892f7 taeseongkim
964 873011c4 humkyung
            ////multi_UndoData = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.Control_Style(txtCreator as MarkupToPDF.Common.CommentUserInfo);
965
            ////UndoData.MarkupDataColl.Add(multi_UndoData);
966 e1c892f7 taeseongkim
967 873011c4 humkyung
            //multi_UndoData = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.Control_Style(txtOriginator as MarkupToPDF.Common.CommentUserInfo);
968
            //UndoData.MarkupDataColl.Add(multi_UndoData);
969 e1c892f7 taeseongkim
970 873011c4 humkyung
            //multi_UndoData = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.Control_Style(txtDate as MarkupToPDF.Common.CommentUserInfo);
971
            //UndoData.MarkupDataColl.Add(multi_UndoData);
972 e1c892f7 taeseongkim
973
            //ViewerDataModel.Instance.UndoDataList.Add(UndoData);
974
975
            //System.Diagnostics.Debug.WriteLine(symCtrl.GetMarkupData(App.ViewInfo.UserID, 1, markupinfo.MarkupVersionID).DATA);
976
            ////System.Diagnostics.Debug.WriteLine(txtApproved.GetMarkupData(App.ViewInfo.UserID, 1, markupinfo.MarkupVersionID).DATA);
977
            ////System.Diagnostics.Debug.WriteLine(txtCreator.GetMarkupData(App.ViewInfo.UserID, 1, markupinfo.MarkupVersionID).DATA);
978
            //System.Diagnostics.Debug.WriteLine(txtOriginator.GetMarkupData(App.ViewInfo.UserID, 1, markupinfo.MarkupVersionID).DATA);
979
            //System.Diagnostics.Debug.WriteLine(txtDate.GetMarkupData(App.ViewInfo.UserID, 1, markupinfo.MarkupVersionID).DATA);
980
        }
981
982
        private void SetTextControl(TextControl textControl)
983
        {
984
            textControl.Base_TextBlock.Margin = new Thickness(0, 0, 10, 0);
985
            textControl.Base_TextBox.Visibility = Visibility.Collapsed;
986
            textControl.Base_TextBlock.Visibility = Visibility.Visible;
987
        }
988
989
        private SymControlN GetSymNControl(double PageWidth, double PageHeight, string userId, string markupInfoId, Point startPosition)
990
        {
991
            SymControlN result = null;
992
993
            try
994
            {
995
                double height = 80;
996
                double itemWidth = 180;
997
998
                System.Windows.Point startPoint = new System.Windows.Point(startPosition.X, startPosition.Y);
999
                System.Windows.Point endPoint = new System.Windows.Point(startPosition.X + itemWidth, startPosition.Y + height);
1000
                System.Windows.Point leftBottomPoint = new System.Windows.Point(startPosition.X, startPosition.Y + height);
1001
                System.Windows.Point topRightPoint = new System.Windows.Point(startPosition.X + itemWidth, startPosition.Y);
1002
1003
                result = new SymControlN
1004
                {
1005
                    CommentID = Commons.shortGuid(),
1006
                    MarkupInfoID = markupInfoId,
1007
                    UserID = userId,
1008
                    PointSet = new List<Point> { startPoint, leftBottomPoint, endPoint, topRightPoint },
1009
                    StartPoint = startPoint,
1010
                    EndPoint = endPoint,
1011
                    CommentAngle = 0,
1012
                    LeftBottomPoint = leftBottomPoint,
1013
                    TopRightPoint = topRightPoint,
1014
                    Opacity = 1,
1015
                    PathXathData = "eJy1Ul1PwjAU/SvN9c3EdY5g1FAShyIxRgygxsemu7AbupZ0Vae/3g42/Azxxfuw9Z7Tnpx72t6lo4zdyAIFyHUBqwptSgG596tTzkuVYyHLqCDlbGnnPlK24C9k5hVP4viIV7LQfOWwROOlJ2ug36tVo1Sq5cLZJ5P1e1OrKRtYbV3qnsqcrZcC9oZNARuvpCL/KiCODoHxfo//EJmg8tIsNLKpd+hVLmBIWkPd2iU2cnGoFprlpJYGyzBOt8WuyeCVJSNgUstCM/1WHNgDZT5oJ3E4M0Ja5F7A8QmwgTTPIYlrnAfgIIm6W2hmVy3CN9M3GUzsyznOyVAdTBlG+NxvxffXx37nOlF3Fx3vppNd5P6nnL8bnWHlU23VktUrAWe3t5Px/cU5sKE1/qFRuKi8k6nV2Qae0ltIshPXncPNtX25lZF19BY2Sn2maWGK8GQEDMIXHbB7dJ7Ur1RrUcDmbXx3l76y0eN4endz+Qd/yX/663xk2v7eAQ==",
1016
                    Memo = null
1017
                };
1018
            }
1019
            catch (Exception ex)
1020
            {
1021
                System.Diagnostics.Debug.WriteLine(ex.ToString());
1022
            }
1023
1024
            return result;
1025
        }
1026
1027 233ef333 taeseongkim
        private RectangleControl GetRectControl(double PageWidth, double PageHeight, string userId, string markupInfoId, Point startPosition)
1028 e1c892f7 taeseongkim
        {
1029
            RectangleControl result = null;
1030
1031
            try
1032
            {
1033
                double height = 80;
1034
                double itemWidth = 180;
1035
1036
                System.Windows.Point startPoint = new System.Windows.Point(startPosition.X, startPosition.Y);
1037
                System.Windows.Point endPoint = new System.Windows.Point(startPosition.X + itemWidth, startPosition.Y + height);
1038
                System.Windows.Point leftBottomPoint = new System.Windows.Point(startPosition.X, startPosition.Y + height);
1039
                System.Windows.Point topRightPoint = new System.Windows.Point(startPosition.X + itemWidth, startPosition.Y);
1040
1041
                result = new RectangleControl
1042
                {
1043
                    CommentID = Commons.shortGuid(),
1044
                    MarkupInfoID = markupInfoId,
1045
                    LineSize = 5,
1046
                    Paint = MarkupToPDF.Controls.Common.PaintSet.None,
1047
                    StartPoint = startPoint,
1048
                    EndPoint = endPoint,
1049
                    CommentAngle = 0,
1050
                    StrokeColor = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromArgb(255, 255, 0x0, 0x0)),
1051
                    //StrokeColor = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromArgb(255, 64, 224, 208)),
1052
                    FillColor = null,
1053
                    DashSize = new System.Windows.Media.DoubleCollection(new[] { 999999.0 }),
1054
                    Opacity = 1,
1055
                    LeftBottomPoint = leftBottomPoint,
1056
                    TopRightPoint = topRightPoint,
1057 233ef333 taeseongkim
                    PointSet = new List<Point> { startPoint, leftBottomPoint, endPoint, topRightPoint },
1058 e1c892f7 taeseongkim
                    UserID = userId,
1059
                    Memo = null
1060
                };
1061
            }
1062
            catch (Exception ex)
1063
            {
1064
                System.Diagnostics.Debug.WriteLine(ex.ToString());
1065
            }
1066
1067
            return result;
1068
        }
1069
1070 233ef333 taeseongkim
        private TextControl GetTextControl(double PageWidth, double PageHeight, string userId, string markupInfoId, string Text, double fontSize, FontWeight fontWeight, TextAlignment textAlignment, Rect parentRect, double positionY)
1071 e1c892f7 taeseongkim
        {
1072
            TextControl result = null;
1073
1074
            try
1075
            {
1076 233ef333 taeseongkim
                var txtSize = ShapeMeasure(new TextBlock { Text = Text, FontSize = fontSize, FontWeight = fontWeight, FontFamily = new FontFamily("Tahoma") });
1077 e1c892f7 taeseongkim
1078
                double startPositionX = parentRect.X;
1079
1080
                switch (textAlignment)
1081
                {
1082
                    case TextAlignment.Right:
1083
                        startPositionX = parentRect.X + parentRect.Width - txtSize.Width;
1084
                        break;
1085 233ef333 taeseongkim
1086 e1c892f7 taeseongkim
                    case TextAlignment.Center:
1087
                        startPositionX = parentRect.X + parentRect.Width / 2 - txtSize.Width / 2 - 3;
1088
                        break;
1089
                }
1090
1091
                Point startPosition = new Point
1092
                {
1093
                    X = startPositionX,
1094
                    Y = positionY
1095
                };
1096 233ef333 taeseongkim
1097 e1c892f7 taeseongkim
                System.Windows.Point startPoint = new System.Windows.Point(startPosition.X, startPosition.Y);
1098
                System.Windows.Point endPoint = new System.Windows.Point(startPosition.X + txtSize.Width, startPosition.Y + txtSize.Height);
1099
                System.Windows.Point leftBottomPoint = new System.Windows.Point(startPosition.X, startPosition.Y + txtSize.Height);
1100
                System.Windows.Point topRightPoint = new System.Windows.Point(startPosition.X + txtSize.Width, startPosition.Y);
1101
1102
                result = new TextControl
1103
                {
1104
                    CommentID = Commons.shortGuid(),
1105
                    MarkupInfoID = markupInfoId,
1106
                    Text = Text,
1107
                    StartPoint = startPoint,
1108
                    EndPoint = endPoint,
1109
                    CanvasX = startPosition.X,
1110
                    CanvasY = startPosition.Y,
1111
                    BoxWidth = txtSize.Width,
1112
                    BoxHeight = txtSize.Height,
1113
                    ControlType_No = 0,
1114
                    LineSize = new Thickness(5),
1115
                    TextSize = fontSize,
1116
                    Foreground = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromArgb(255, 255, 0, 0)),
1117
                    FontSize = 10,
1118
                    UserID = userId,
1119
                    IsHighLight = false,
1120
                    CommentAngle = 0,
1121
                    PointSet = new List<Point>(),
1122
                    Opacity = 1,
1123
                    IsSelected = false,
1124
                    TextFamily = new FontFamily("Tahoma"),
1125
                    TextStyle = FontStyles.Normal,
1126
                    TextWeight = FontWeights.Bold
1127
                };
1128
            }
1129
            catch (Exception ex)
1130
            {
1131
            }
1132
1133
            return result;
1134
        }
1135 233ef333 taeseongkim
1136 e1c892f7 taeseongkim
        public static Size ShapeMeasure(UIElement e)
1137
        {
1138
            // Measured Size is bounded to be less than maxSize
1139
            Size maxSize = new Size(
1140
                 double.PositiveInfinity,
1141
                 double.PositiveInfinity);
1142
            e.Measure(maxSize);
1143
            return e.DesiredSize;
1144 d7e20d2d taeseongkim
        }
1145
1146 4f017ed3 taeseongkim
        private async Task MarkupLoadAsync(int pageNumber,Double PageAngle, CancellationToken cts)
1147 ac4f1e13 taeseongkim
        {
1148
            System.Diagnostics.Stopwatch stopwatch = new Stopwatch();
1149
            stopwatch.Start();
1150
1151 3ffd4b2d humkyung
            /// 컨트롤을 새로 생성한다.
1152
            Common.ViewerDataModel.Instance.MarkupControls_USER.Clear();    //전체 제거
1153
            Common.ViewerDataModel.Instance.MarkupControls.Clear();         //전체 제거
1154 e8557bd7 taeseongkim
1155 ac4f1e13 taeseongkim
            System.Diagnostics.Debug.WriteLine("MarkupLoad - Clear " + new TimeSpan(stopwatch.ElapsedTicks).ToString());
1156
1157 d7e20d2d taeseongkim
            foreach (var markup in ViewerDataModel.Instance.MyMarkupList.Where(param => param.PageNumber == pageNumber))
1158 233ef333 taeseongkim
            {
1159 24c5e56c taeseongkim
                if (cts.IsCancellationRequested)
1160
                {
1161
                    return;
1162
                }
1163
1164 5ee1c547 송근호
                var info = ViewerDataModel.Instance._markupInfoList.Where(param => param.MarkupInfoID == markup.MarkupInfoID).FirstOrDefault();
1165 3ffd4b2d humkyung
                if (info != null)
1166
                {
1167
                    string sColor = (info.UserID == App.ViewInfo.UserID) ? "#FFFF0000" : info.DisplayColor;
1168
                    if (info.UserID == App.ViewInfo.UserID)
1169
                    {
1170 a1e2ba68 taeseongkim
                        var control = await MarkupParser.ParseExAsync(App.BaseAddress, cts, App.ViewInfo.ProjectNO, markup.Data, Common.ViewerDataModel.Instance.MarkupControls_USER, PageAngle, sColor, "",
1171 3ffd4b2d humkyung
                                        markup.MarkupInfoID, markup.ID);
1172
                        control.Visibility = Visibility.Hidden;
1173
                    }
1174
                    else
1175
                    {
1176 a1e2ba68 taeseongkim
                        var control = await MarkupParser.ParseExAsync(App.BaseAddress, cts, App.ViewInfo.ProjectNO, markup.Data, Common.ViewerDataModel.Instance.MarkupControls, PageAngle, sColor, "",
1177 3ffd4b2d humkyung
                                                                markup.MarkupInfoID, markup.ID);
1178
                        control.Visibility = Visibility.Hidden;
1179
                    }
1180
                }
1181
            };
1182
            /// up to here
1183
1184 ac4f1e13 taeseongkim
            System.Diagnostics.Debug.WriteLine("MarkupLoad - MarkupParser " + new TimeSpan(stopwatch.ElapsedTicks).ToString());
1185
1186 3ffd4b2d humkyung
            /// fire selection event
1187 552af7c7 swate0609
            // DIG 요청으로 첫 로드시 전체 선택 되도록 수정 2024-06-04 IRON
1188
            // 다른 페이지 넘어갈 시 메시지 박스가 여러개 떠서 추가기능 주석 처리 2024-06-05 IRON
1189
            //gridViewMarkup.SelectAll(); 
1190 3ffd4b2d humkyung
            List<MarkupInfoItem> gridSelectionItem = gridViewMarkup.SelectedItems.Cast<MarkupInfoItem>().ToList(); //선택 된 마크업
1191
            this.gridViewMarkup.UnselectAll();
1192
            this.gridViewMarkup.Select(gridSelectionItem);
1193
1194
            if (!testPanel2.IsHidden)
1195
            {
1196
                ViewerDataModel.Instance.Sync_ContentOffsetX = zoomAndPanControl.ContentOffsetX;
1197
                ViewerDataModel.Instance.Sync_ContentOffsetY = zoomAndPanControl.ContentOffsetY;
1198
                ViewerDataModel.Instance.Sync_ContentScale = zoomAndPanControl.ContentScale;
1199
1200
                Common.ViewerDataModel.Instance.MarkupControls_Sync.Clear();
1201
                List<MarkupInfoItem> gridSelectionRevItem = gridViewRevMarkup.SelectedItems.Cast<MarkupInfoItem>().ToList();
1202
1203
                foreach (var item in gridSelectionRevItem)
1204
                {
1205 ac4f1e13 taeseongkim
                    var markupitems = item.MarkupList.Where(pageItem => pageItem.PageNumber == pageNumber).ToList();
1206
1207
                    foreach (var markupitem in markupitems)
1208 3ffd4b2d humkyung
                    {
1209 f5f788c2 taeseongkim
                        await MarkupParser.ParseExAsync(App.BaseAddress, ViewerDataModel.Instance.NewMarkupCancelToken(), App.ViewInfo.ProjectNO, markupitem.Data, Common.ViewerDataModel.Instance.MarkupControls_Sync,PageAngle, item.DisplayColor, "", item.MarkupInfoID);
1210 24c5e56c taeseongkim
1211 5639752b taeseongkim
                        //if (cts.IsCancellationRequested)
1212
                        //{
1213
                        //    return;
1214
                        //}
1215 ac4f1e13 taeseongkim
                    }
1216 3ffd4b2d humkyung
                }
1217
            }
1218 ac4f1e13 taeseongkim
1219 24c5e56c taeseongkim
            SetCommentPages(cts);
1220 3ffd4b2d humkyung
        }
1221
1222 24c5e56c taeseongkim
        public void SetCommentPages(CancellationToken? cts)
1223 787a4489 KangIngu
        {
1224 548c696e ljiyeon
            Logger.sendCheckLog("pageNavigator_PageChanging_SetCommentPages Setting", 1);
1225 787a4489 KangIngu
            List<UsersCommentPagesMember> _pages = new List<UsersCommentPagesMember>();
1226
            foreach (var item in ViewerDataModel.Instance._markupInfoList)
1227 ed3740c4 djkim
            {
1228
                //Comment 가 존재할 경우에만 Thumbnail 에 추가
1229 233ef333 taeseongkim
                if (item.MarkupList != null)
1230 787a4489 KangIngu
                {
1231 ed3740c4 djkim
                    UsersCommentPagesMember instance = new UsersCommentPagesMember();
1232
                    instance.UserName = item.UserName;
1233
                    instance.Depart = item.Depatment;
1234
                    instance.MarkupInfoID = item.MarkupInfoID;
1235
                    instance.IsSelected = true;
1236
                    instance.isConSolidation = item.Consolidate;
1237
                    instance.SetColor = item.DisplayColor;
1238
                    if (item.UserID == App.ViewInfo.UserID && item.MarkupInfoID == item.MarkupInfoID)
1239
                    {
1240
                        instance.PageNumber = ViewerDataModel.Instance.MyMarkupList.Select(d => d.PageNumber).ToList();
1241
                    }
1242
                    else
1243
                    {
1244
                        instance.PageNumber = ViewerDataModel.Instance.MarkupList_Pre.Where(data => data.MarkupInfoID == item.MarkupInfoID).Select(d => d.PageNumber).ToList();
1245
                    }
1246
                    _pages.Add(instance);
1247 233ef333 taeseongkim
                }
1248 24c5e56c taeseongkim
1249
                if (cts != null)
1250
                {
1251
                    if (cts.Value.IsCancellationRequested)
1252
                        return;
1253
                }
1254 ed3740c4 djkim
            }
1255 233ef333 taeseongkim
1256 24c5e56c taeseongkim
            this.pageNavigator.SetCommentList(_pages.ToList(),cts);
1257 ed3740c4 djkim
        }
1258
1259
        public void MarkupitemViewUpdate(string markupinfo_id)
1260
        {
1261
            //db에 업데이트 한 list 를 view 에 업데이트
1262
            string sDocID = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu._DocInfo.ID;
1263
            List<MarkupInfoItem> results = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.GetMarkupInfoItems(App.ViewInfo.ProjectNO, sDocID);
1264
            MarkupInfoItem dbinfo = results.Where(x => x.MarkupInfoID == markupinfo_id).FirstOrDefault();
1265
            MarkupInfoItem viewinfo = Common.ViewerDataModel.Instance._markupInfoList.Where(x => x.MarkupInfoID == markupinfo_id).FirstOrDefault();
1266
            if (dbinfo.MarkupList.Count > 0)
1267
            {
1268
                if (viewinfo.MarkupList != null)
1269
                {
1270
                    viewinfo.MarkupList.Clear();
1271
                    viewinfo.MarkupList = null;
1272 e05fe8ab djkim
                }
1273 6a19b48d taeseongkim
1274 ed3740c4 djkim
                viewinfo.MarkupList = new List<MarkupItem>();
1275
                foreach (var item in dbinfo.MarkupList)
1276 e05fe8ab djkim
                {
1277 6a19b48d taeseongkim
                    System.Diagnostics.Debug.WriteLine(item.ID);
1278 ed3740c4 djkim
                    viewinfo.MarkupList.Add(item);
1279 e05fe8ab djkim
                }
1280 787a4489 KangIngu
            }
1281
        }
1282
1283 a1142a6b taeseongkim
        private async void zoomAndPanControl_MouseWheel(object sender, MouseWheelEventArgs e)
1284 787a4489 KangIngu
        {
1285 f06cce07 taeseongkim
            var instance = ViewerDataModel.Instance;
1286
1287 233ef333 taeseongkim
            if (instance.IsWheelPageChanage)
1288 787a4489 KangIngu
            {
1289 a1142a6b taeseongkim
                return;
1290
            }
1291
1292
            if (instance.IsPressCtrl) // && !instance.IsWheelPageChanage)
1293
            {
1294
                int changePage = 0;
1295 233ef333 taeseongkim
1296 f87dfb18 taeseongkim
                if (e.Delta > 0)
1297
                {
1298 a1142a6b taeseongkim
                    if (0 < instance.ContentOffsetY)
1299 f06cce07 taeseongkim
                    {
1300
                        Vector dragOffset = new Vector(0, e.Delta);
1301
                        MoveZoomAndPanControl(dragOffset);
1302
                    }
1303
                    //else
1304
                    //{
1305 a1142a6b taeseongkim
                    //    if (instance.SystemMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber > 1)
1306
                    //    {
1307
                    //        instance.IsWheelPageChanage = true;
1308
                    //        changePage -= 1;
1309
                    //    }
1310 f06cce07 taeseongkim
                    //}
1311 f87dfb18 taeseongkim
                }
1312 233ef333 taeseongkim
                else if (e.Delta < 0)
1313 f87dfb18 taeseongkim
                {
1314 f06cce07 taeseongkim
                    if (instance.ContentHeight > instance.ContentOffsetY + instance.ContentViewportHeight)
1315
                    {
1316 233ef333 taeseongkim
                        Vector dragOffset = new Vector(0, e.Delta);
1317 f06cce07 taeseongkim
                        MoveZoomAndPanControl(dragOffset);
1318
                    }
1319
                    //else
1320
                    //{
1321 a1142a6b taeseongkim
                    //    if (instance.SystemMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber < instance.SystemMain.dzMainMenu.pageNavigator.PageCount)
1322
                    //    {
1323
                    //        instance.IsWheelPageChanage = true;
1324
                    //        changePage += 1;
1325
                    //    }
1326 f06cce07 taeseongkim
                    //}
1327 f87dfb18 taeseongkim
                }
1328 a1142a6b taeseongkim
1329
                //if (changePage != 0)
1330
                //{
1331
                //    await Task.Factory.StartNew(() =>
1332
                //    {
1333
                //        double beforeScale = instance.ContentScale;
1334
1335
                //        EventHandler<Sample.PageChangeEventArgs> handler = null;
1336
1337
                //        handler = (snd, evt) =>
1338
                //        {
1339
                //            /// 최상단으로 이전 zoomScale로 위치한다
1340
                //            //Point currentContentMousePoint = e.GetPosition(zoomAndPanCanvas);
1341
                //            //zoomAndPanControl.ZoomAboutPoint(beforeScale, new Point(currentContentMousePoint.X, 0));
1342
                //            instance.IsWheelPageChanage = false;
1343
                //            pageNavigator.PageChanged -= handler;
1344
                //        };
1345
1346
                //        pageNavigator.PageChanged += handler;
1347
1348
                //        pageNavigator.GotoPage(Convert.ToInt32(instance.SystemMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber) + changePage);
1349
                //    });
1350
1351
                //}
1352 787a4489 KangIngu
            }
1353
            else
1354
            {
1355 f87dfb18 taeseongkim
                e.Handled = true;
1356
                if (e.Delta > 0)
1357
                {
1358
                    Point currentContentMousePoint = e.GetPosition(zoomAndPanCanvas);
1359
                    ZoomIn(currentContentMousePoint);
1360
                }
1361
                else
1362
                {
1363
                    Point currentContentMousePoint = e.GetPosition(zoomAndPanCanvas);
1364
                    ZoomOut(currentContentMousePoint);
1365
                }
1366 787a4489 KangIngu
            }
1367
        }
1368
1369 a1716fa5 KangIngu
        private void zoomAndPanControl2_MouseWheel(object sender, MouseWheelEventArgs e)
1370
        {
1371
            e.Handled = true;
1372
            if (e.Delta > 0)
1373
            {
1374
                Point currentContentMousePoint = e.GetPosition(zoomAndPanCanvas2);
1375
                ZoomIn_Sync(currentContentMousePoint);
1376
            }
1377
            else
1378
            {
1379
                Point currentContentMousePoint = e.GetPosition(zoomAndPanCanvas2);
1380
                ZoomOut_Sync(currentContentMousePoint);
1381
            }
1382
        }
1383
1384 787a4489 KangIngu
        #region ZoomIn & ZoomOut
1385
1386
        private void ZoomOut_Executed(object sender, ExecutedRoutedEventArgs e)
1387
        {
1388
            ZoomOut(new Point(zoomAndPanControl.ContentZoomFocusX,
1389
                zoomAndPanControl.ContentZoomFocusY));
1390
        }
1391
1392
        private void ZoomIn_Executed(object sender, ExecutedRoutedEventArgs e)
1393
        {
1394
            ZoomIn(new Point(zoomAndPanControl.ContentZoomFocusX,
1395
                zoomAndPanControl.ContentZoomFocusY));
1396
        }
1397
1398
        //강인구 추가 (줌 인아웃 수치 변경)
1399
        //큰해상도의 문서일 경우 줌 인 아웃시 사이즈 변동이 큼
1400
        private void ZoomOut(Point contentZoomCenter)
1401
        {
1402
            if (zoomAndPanControl.ContentScale > 0.39)
1403
            {
1404
                zoomAndPanControl.ZoomAboutPoint(zoomAndPanControl.ContentScale - 0.2, contentZoomCenter);
1405
            }
1406
            else
1407
            {
1408
                zoomAndPanControl.ZoomAboutPoint(zoomAndPanControl.ContentScale / 2, contentZoomCenter);
1409
            }
1410
1411 9cd2865b KangIngu
            if (zoomAndPanControl2 != null && Sync.IsChecked)
1412 787a4489 KangIngu
            {
1413 9cd2865b KangIngu
                zoomAndPanControl2.ZoomAboutPoint(zoomAndPanControl.ContentScale, contentZoomCenter);
1414 787a4489 KangIngu
            }
1415
        }
1416
1417
        private void ZoomIn(Point contentZoomCenter)
1418
        {
1419
            if (zoomAndPanControl.ContentScale > 0.19)
1420
            {
1421
                zoomAndPanControl.ZoomAboutPoint(zoomAndPanControl.ContentScale + 0.2, contentZoomCenter);
1422
            }
1423
            else
1424
            {
1425
                zoomAndPanControl.ZoomAboutPoint(zoomAndPanControl.ContentScale * 2, contentZoomCenter);
1426
            }
1427
1428 9cd2865b KangIngu
            if (zoomAndPanControl2 != null && Sync.IsChecked)
1429 787a4489 KangIngu
            {
1430 9cd2865b KangIngu
                zoomAndPanControl2.ZoomAboutPoint(zoomAndPanControl.ContentScale, contentZoomCenter);
1431 787a4489 KangIngu
            }
1432 a1716fa5 KangIngu
        }
1433
1434
        private void ZoomOut_Sync(Point contentZoomCenter)
1435
        {
1436
            if (zoomAndPanControl2.ContentScale > 0.39)
1437
            {
1438
                zoomAndPanControl2.ZoomAboutPoint(zoomAndPanControl2.ContentScale - 0.2, contentZoomCenter);
1439
            }
1440
            else
1441
            {
1442
                zoomAndPanControl2.ZoomAboutPoint(zoomAndPanControl2.ContentScale / 2, contentZoomCenter);
1443
            }
1444
1445
            if (Sync.IsChecked)
1446
            {
1447
                zoomAndPanControl.ZoomAboutPoint(zoomAndPanControl2.ContentScale, contentZoomCenter);
1448
            }
1449
        }
1450
1451
        private void ZoomIn_Sync(Point contentZoomCenter)
1452
        {
1453
            if (zoomAndPanControl2.ContentScale > 0.19)
1454
            {
1455
                zoomAndPanControl2.ZoomAboutPoint(zoomAndPanControl2.ContentScale + 0.2, contentZoomCenter);
1456
            }
1457
            else
1458
            {
1459
                zoomAndPanControl2.ZoomAboutPoint(zoomAndPanControl2.ContentScale * 2, contentZoomCenter);
1460
            }
1461
1462
            if (Sync.IsChecked)
1463
            {
1464
                zoomAndPanControl.ZoomAboutPoint(zoomAndPanControl2.ContentScale, contentZoomCenter);
1465
            }
1466 787a4489 KangIngu
        }
1467
1468
        private void ZoomOut()
1469
        {
1470
            zoomAndPanControl.ContentScale -= 0.1;
1471
            //if (zoomAndPanControl2 != null)
1472
            //{
1473
            //    zoomAndPanControl2.ContentScale -= 0.1;
1474
            //}
1475
        }
1476
1477
        private void ZoomIn()
1478
        {
1479
            zoomAndPanControl.ContentScale += 0.1;
1480
            //if (zoomAndPanControl2 != null)
1481
            //{
1482
            //    zoomAndPanControl2.ContentScale += 0.1;
1483
            //}
1484
        }
1485
1486 233ef333 taeseongkim
        #endregion ZoomIn & ZoomOut
1487 787a4489 KangIngu
1488 38d69491 taeseongkim
        public void init()
1489 787a4489 KangIngu
        {
1490
            foreach (var item in ViewerDataModel.Instance.MarkupControls)
1491
            {
1492
                ControlList.Clear();
1493
                listBox.Items.Clear();
1494
                selected_item.Clear();
1495
1496
                (item as IMarkupCommonData).IsSelected = false;
1497
            }
1498
        }
1499
1500
        private HitTestResultBehavior MyCallback(HitTestResult result)
1501
        {
1502
            //this.cursor = Cursors.UpArrow;
1503
            var element = result.VisualHit;
1504
            while (element != null && !(element is CommentUserInfo))
1505
                element = VisualTreeHelper.GetParent(element);
1506
1507
            if (element == null)
1508
            {
1509
                return HitTestResultBehavior.Stop;
1510
            }
1511
            else
1512
            {
1513
                if (element is CommentUserInfo)
1514
                {
1515
                    if (!hitList.Contains(element))
1516
                    {
1517
                        hitList.Add((CommentUserInfo)element);
1518
                    }
1519
                    else
1520
                    {
1521
                        return HitTestResultBehavior.Stop;
1522
                    }
1523
                }
1524
            }
1525
            return HitTestResultBehavior.Continue;
1526
        }
1527
1528
        public void ReleaseSelectPath()
1529
        {
1530
            if (SelectionPath == null)
1531
            {
1532
                SelectionPath = new Path();
1533
                SelectionPath.Name = "";
1534
            }
1535
            if (SelectionPath.Name != "")
1536
            {
1537
                SelectionPath.Name = "None";
1538
            }
1539
            SelectionPath.Opacity = 0.01;
1540
            SelectionPath.RenderTransform = null;
1541
            SelectionPath.RenderTransformOrigin = new Point(0, 0);
1542
        }
1543
1544 233ef333 taeseongkim
        #region 컨트롤 초기화
1545
1546 787a4489 KangIngu
        public void Control_Init(object control)
1547
        {
1548
            if (L_Size != 0 && (control as IPath) != null)
1549
            {
1550
                (control as IPath).LineSize = L_Size;
1551
                L_Size = 0;
1552
            }
1553
1554
            switch (control.GetType().Name)
1555
            {
1556
                case "RectangleControl":
1557
                    {
1558
                        (control as RectangleControl).StrokeColor = Brushes.Red;
1559
                    }
1560
                    break;
1561 233ef333 taeseongkim
1562 787a4489 KangIngu
                case "CircleControl":
1563
                    {
1564
                        (control as CircleControl).StrokeColor = Brushes.Red;
1565
                    }
1566
                    break;
1567 233ef333 taeseongkim
1568 787a4489 KangIngu
                case "TriControl":
1569
                    {
1570
                        (control as TriControl).StrokeColor = Brushes.Red;
1571
                    }
1572
                    break;
1573 233ef333 taeseongkim
1574 787a4489 KangIngu
                case "RectCloudControl":
1575
                    {
1576
                        (control as RectCloudControl).StrokeColor = Brushes.Red;
1577
                    }
1578
                    break;
1579 233ef333 taeseongkim
1580 787a4489 KangIngu
                case "CloudControl":
1581
                    {
1582
                        (control as CloudControl).StrokeColor = Brushes.Red;
1583
                    }
1584
                    break;
1585 233ef333 taeseongkim
1586 787a4489 KangIngu
                case "PolygonControl":
1587
                    {
1588
                        (control as PolygonControl).StrokeColor = Brushes.Red;
1589
                    }
1590
                    break;
1591 233ef333 taeseongkim
1592 787a4489 KangIngu
                case "ArcControl":
1593
                    {
1594
                        (control as ArcControl).StrokeColor = Brushes.Red;
1595
                    }
1596
                    break;
1597 233ef333 taeseongkim
1598 40b3ce25 ljiyeon
                case "ArrowArcControl":
1599
                    {
1600
                        (control as ArrowArcControl).StrokeColor = Brushes.Red;
1601
                    }
1602
                    break;
1603 233ef333 taeseongkim
1604 787a4489 KangIngu
                case "LineControl":
1605
                    {
1606
                        (control as LineControl).StrokeColor = Brushes.Red;
1607
                    }
1608
                    break;
1609 233ef333 taeseongkim
1610 787a4489 KangIngu
                case "ArrowControl_Multi":
1611
                    {
1612
                        (control as ArrowControl_Multi).StrokeColor = Brushes.Red;
1613
                    }
1614
                    break;
1615 233ef333 taeseongkim
1616 787a4489 KangIngu
                case "TextControl":
1617
                    {
1618
                        (control as TextControl).BackInnerColor = new SolidColorBrush(Color.FromArgb(Convert.ToByte(255 * 0.6), Colors.White.R, Colors.White.G, Colors.White.B));
1619
                    }
1620
                    break;
1621 233ef333 taeseongkim
1622 787a4489 KangIngu
                case "ArrowTextControl":
1623
                    {
1624
                        (control as ArrowTextControl).BackInnerColor = new SolidColorBrush(Color.FromArgb(Convert.ToByte(255 * 0.6), Colors.White.R, Colors.White.G, Colors.White.B));
1625
                    }
1626
                    break;
1627 233ef333 taeseongkim
1628 684ef11c ljiyeon
                case "InsideWhiteControl":
1629
                    {
1630
                        (control as InsideWhiteControl).StrokeColor = Brushes.White;
1631
                    }
1632
                    break;
1633 233ef333 taeseongkim
1634 684ef11c ljiyeon
                case "OverlapWhiteControl":
1635
                    {
1636
                        (control as OverlapWhiteControl).StrokeColor = Brushes.White;
1637
                    }
1638
                    break;
1639 233ef333 taeseongkim
1640 684ef11c ljiyeon
                case "ClipWhiteControl":
1641
                    {
1642
                        (control as ClipWhiteControl).StrokeColor = Brushes.White;
1643
                    }
1644
                    break;
1645 233ef333 taeseongkim
1646 684ef11c ljiyeon
                case "CoordinateControl":
1647
                    {
1648
                        (control as CoordinateControl).StrokeColor = Brushes.Black;
1649
                    }
1650
                    break;
1651 787a4489 KangIngu
            }
1652
        }
1653 233ef333 taeseongkim
1654
        #endregion 컨트롤 초기화
1655 787a4489 KangIngu
1656
        public void firstCondition_MouseLeave(object sender, MouseEventArgs e)
1657
        {
1658
            //Control_Init(e.Source);
1659
        }
1660 233ef333 taeseongkim
1661 7211e0c2 ljiyeon
        //private Window _dragdropWindow = null;
1662 53880c83 ljiyeon
1663
        [DllImport("user32.dll")]
1664
        [return: MarshalAs(UnmanagedType.Bool)]
1665
        internal static extern bool GetCursorPos(ref Win32Point pt);
1666
1667
        [StructLayout(LayoutKind.Sequential)]
1668
        internal struct Win32Point
1669
        {
1670
            public Int32 X;
1671
            public Int32 Y;
1672
        };
1673 233ef333 taeseongkim
1674 7211e0c2 ljiyeon
        /*
1675
       public string symbol_id = null;
1676
       public long symbol_group_id;
1677
       public int symbol_SelectedIndex;
1678
       public ImageSource symbol_img;
1679
       public string symbol_Data = null;
1680
       public void symboldata(string id, long group_id, int SelectedIndex, string Data_, ImageSource img)
1681
       {
1682
           PlaceImageSymbol(symbol_id, symbol_group_id, symbol_SelectedIndex, new Point(zoomAndPanCanvas.ActualWidth / 2,
1683
               zoomAndPanCanvas.ActualHeight / 2));
1684
1685
               if (this._dragdropWindow != null)
1686
               {
1687
                   this._dragdropWindow.Close();
1688
                   this._dragdropWindow = null;
1689
               }
1690
1691
               symbol_id = id;
1692
               symbol_group_id = group_id;
1693
               symbol_SelectedIndex = SelectedIndex;
1694
               symbol_Data = Data_;
1695
               symbol_img = img;
1696
1697
               CreateDragDropWindow2(img);
1698
    }
1699 53880c83 ljiyeon
1700 7211e0c2 ljiyeon
    private void CreateDragDropWindow2(ImageSource image)
1701 53880c83 ljiyeon
        {
1702
            this._dragdropWindow = new Window();
1703 902faaea taeseongkim
            _dragdropWindow.Cursor = new Cursor(App.DefaultArrowCursorStream);
1704 53880c83 ljiyeon
            _dragdropWindow.WindowStyle = WindowStyle.None;
1705 233ef333 taeseongkim
            _dragdropWindow.AllowsTransparency = true;
1706 53880c83 ljiyeon
            _dragdropWindow.AllowDrop = false;
1707
            _dragdropWindow.Background = null;
1708
            _dragdropWindow.IsHitTestVisible = false;
1709
            _dragdropWindow.SizeToContent = SizeToContent.WidthAndHeight;
1710
            _dragdropWindow.Topmost = true;
1711
            _dragdropWindow.ShowInTaskbar = false;
1712 233ef333 taeseongkim
1713 53880c83 ljiyeon
            Rectangle r = new Rectangle();
1714
            r.Width = image.Width;
1715
            r.Height = image.Height;
1716 233ef333 taeseongkim
            r.Opacity = 0.5;
1717 53880c83 ljiyeon
            r.Fill = new ImageBrush(image);
1718
            this._dragdropWindow.Content = r;
1719
1720
            Win32Point w32Mouse = new Win32Point();
1721
            GetCursorPos(ref w32Mouse);
1722
1723
            //w32Mouse.X = getCurrentPoint.X;
1724
            this._dragdropWindow.Left = w32Mouse.X - (image.Width / 2);
1725 233ef333 taeseongkim
            this._dragdropWindow.Top = w32Mouse.Y - (image.Height / 2);
1726 53880c83 ljiyeon
            this._dragdropWindow.Show();
1727
        }
1728 f87dfb18 taeseongkim
1729 7211e0c2 ljiyeon
         */
1730 f87dfb18 taeseongkim
1731
        public void MoveZoomAndPanControl(Vector dragOffset)
1732
        {
1733
            zoomAndPanControl.ContentOffsetX -= dragOffset.X;
1734
            zoomAndPanControl.ContentOffsetY -= dragOffset.Y;
1735
1736
            if (Sync.IsChecked)
1737
            {
1738
                ViewerDataModel.Instance.Sync_ContentOffsetX = zoomAndPanControl.ContentOffsetX;
1739
                ViewerDataModel.Instance.Sync_ContentOffsetY = zoomAndPanControl.ContentOffsetY;
1740
            }
1741
        }
1742
1743 787a4489 KangIngu
        private void zoomAndPanControl_MouseMove(object sender, MouseEventArgs e)
1744
        {
1745 b74a9c91 taeseongkim
            if (Common.ViewerDataModel.Instance.SelectedControl == "Batch"
1746
                || Common.ViewerDataModel.Instance.SelectedControl == "MACRO")
1747
            //if(this.txtBatch.Visibility == Visibility.Visible)
1748 787a4489 KangIngu
            {
1749
                if (!floatingTip.IsOpen) { floatingTip.IsOpen = true; }
1750
1751
                Point currentPos = e.GetPosition(rect);
1752 d71ee575 djkim
1753 787a4489 KangIngu
                floatingTip.HorizontalOffset = currentPos.X + 20;
1754
                floatingTip.VerticalOffset = currentPos.Y;
1755
            }
1756
1757
            getCurrentPoint = e.GetPosition(drawingRotateCanvas);
1758 233ef333 taeseongkim
1759 e6a9ddaf humkyung
            if ((e.MiddleButton == MouseButtonState.Pressed) || (e.RightButton == MouseButtonState.Pressed))
1760 787a4489 KangIngu
            {
1761 e54660e8 KangIngu
                SetCursor();
1762 787a4489 KangIngu
                Point currentCanvasDrawingMouseMovePoint = e.GetPosition(drawingRotateCanvas);
1763
                Point currentCanvasZoomPanningMouseMovePoint = e.GetPosition(zoomAndPanCanvas);
1764
1765
                Vector dragOffset = currentCanvasZoomPanningMouseMovePoint - canvasZoommovingMouseDownPoint;
1766 9cd2865b KangIngu
1767 f87dfb18 taeseongkim
                MoveZoomAndPanControl(dragOffset);
1768 787a4489 KangIngu
            }
1769 992a98b4 KangIngu
1770 e6a9ddaf humkyung
            if (mouseHandlingMode == MouseHandlingMode.Drawing && currentControl != null)
1771 787a4489 KangIngu
            {
1772
                Point currentCanvasDrawingMouseMovePoint = e.GetPosition(drawingRotateCanvas);
1773
                Point currentCanvasZoomPanningMouseMovePoint = e.GetPosition(zoomAndPanCanvas);
1774
                SetCursor();
1775
1776
                if (currentControl != null)
1777
                {
1778 c7fde400 taeseongkim
                    double moveX = currentCanvasDrawingMouseMovePoint.X - CanvasDrawingMouseDownPoint.X;
1779
                    double moveY = currentCanvasDrawingMouseMovePoint.Y - CanvasDrawingMouseDownPoint.Y;
1780 787a4489 KangIngu
                    //강인구 추가
1781
                    currentControl.Opacity = ViewerDataModel.Instance.ControlOpacity;
1782
1783
                    if ((currentControl as IPath) != null)
1784
                    {
1785
                        (currentControl as IPath).LineSize = ViewerDataModel.Instance.LineSize;
1786
                    }
1787 5ce56a3a KangIngu
                    if ((currentControl as LineControl) != null)
1788
                    {
1789
                        (currentControl as LineControl).Interval = ViewerDataModel.Instance.Interval;
1790
                    }
1791
1792 787a4489 KangIngu
                    if ((currentControl as IShapeControl) != null)
1793
                    {
1794
                        (currentControl as IShapeControl).Paint = ViewerDataModel.Instance.paintSet;
1795
                    }
1796 f7ca524b humkyung
                    if (currentControl is TextControl TextCtrl)
1797 787a4489 KangIngu
                    {
1798
                        if (this.ParentOfType<MainWindow>().dzTopMenu.btnItalic.IsChecked == true)
1799
                        {
1800 f7ca524b humkyung
                            TextCtrl.TextStyle = FontStyles.Italic;
1801 787a4489 KangIngu
                        }
1802
                        if (this.ParentOfType<MainWindow>().dzTopMenu.btnBold.IsChecked == true)
1803
                        {
1804 f7ca524b humkyung
                            TextCtrl.TextWeight = FontWeights.Bold;
1805 787a4489 KangIngu
                        }
1806
                        if (this.ParentOfType<MainWindow>().dzTopMenu.btnUnderLine.IsChecked == true)
1807
                        {
1808 f7ca524b humkyung
                            TextCtrl.UnderLine = TextDecorations.Underline;
1809 787a4489 KangIngu
                        }
1810 f7ca524b humkyung
1811
                        TextCtrl.ArcLength = ViewerDataModel.Instance.ArcLength;
1812 787a4489 KangIngu
                    }
1813
                    else if ((currentControl as ArrowTextControl) != null)
1814
                    {
1815
                        if (this.ParentOfType<MainWindow>().dzTopMenu.btnItalic.IsChecked == true)
1816
                        {
1817
                            (currentControl as ArrowTextControl).TextStyle = FontStyles.Italic;
1818
                        }
1819
                        if (this.ParentOfType<MainWindow>().dzTopMenu.btnBold.IsChecked == true)
1820
                        {
1821 d4b0c723 KangIngu
                            (currentControl as ArrowTextControl).TextWeight = FontWeights.Bold;
1822 787a4489 KangIngu
                        }
1823
                        if (this.ParentOfType<MainWindow>().dzTopMenu.btnUnderLine.IsChecked == true)
1824
                        {
1825
                            (currentControl as ArrowTextControl).UnderLine = TextDecorations.Underline;
1826
                        }
1827
                    }
1828 f7ca524b humkyung
                    else if (currentControl is RectCloudControl RectCloudCtrl)
1829 9f473fb7 KangIngu
                    {
1830 f7ca524b humkyung
                        RectCloudCtrl.ArcLength = ViewerDataModel.Instance.ArcLength;
1831 9f473fb7 KangIngu
                    }
1832 f7ca524b humkyung
                    else if (currentControl is CloudControl CloudCtrl)
1833 9f473fb7 KangIngu
                    {
1834 f7ca524b humkyung
                        CloudCtrl.ArcLength = ViewerDataModel.Instance.ArcLength;
1835 9f473fb7 KangIngu
                    }
1836 787a4489 KangIngu
1837 168f8027 taeseongkim
                    #region // 모든 컨트롤의 공통기능 제어
1838 233ef333 taeseongkim
1839 168f8027 taeseongkim
                    if (controlType != ControlType.PenControl)
1840
                    {
1841 233ef333 taeseongkim
                        currentControl.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.IsAxisLock || ViewerDataModel.Instance.IsPressShift);
1842 7a3b7ef3 swate0609
                        
1843
1844
                        if(currentControl is MarkupToPDF.Controls.Polygon.PolygonControl && ((MarkupToPDF.Controls.Polygon.PolygonControl)currentControl).IsCompleted)
1845
                        {
1846
                            var vControl = currentControl as MarkupToPDF.Controls.Polygon.PolygonControl;
1847
                            var firstPoint = vControl.PointSet.First();
1848
                            vControl.DashSize = ViewerDataModel.Instance.DashSize;
1849
                            vControl.LineSize = ViewerDataModel.Instance.LineSize;
1850
                            vControl.PointSet.Add(firstPoint);
1851
1852
                            vControl.ApplyOverViewData();
1853
1854
                            CreateCommand.Instance.Execute(currentControl);
1855
                            vControl.UpdateControl();
1856
                            currentControl = null;
1857
                        }
1858
                        else if(currentControl is MarkupToPDF.Controls.Polygon.CloudControl && ((MarkupToPDF.Controls.Polygon.CloudControl)currentControl).IsCompleted)
1859
                        {
1860
                            var vControl = currentControl as MarkupToPDF.Controls.Polygon.CloudControl;
1861
1862
                            CreateCommand.Instance.Execute(currentControl);
1863
1864
                            vControl.isTransOn = true;
1865
                            var firstPoint = vControl.PointSet.First();
1866
1867
                            vControl.PointSet.Add(firstPoint);
1868
                            vControl.DrawingCloud();
1869
                            vControl.ApplyOverViewData();
1870
1871
                            currentControl = null;
1872
                        }
1873
1874 43e1d368 taeseongkim
                        ViewerDataModel.Instance.IsMarkupUpdate = true;
1875 168f8027 taeseongkim
                    }
1876
1877 233ef333 taeseongkim
                    #endregion // 모든 컨트롤의 공통기능 제어
1878 168f8027 taeseongkim
1879
                    #region // 각 컨트롤의 특별한 기능을 제어한다.
1880
1881 787a4489 KangIngu
                    switch (controlType)
1882
                    {
1883 684ef11c ljiyeon
                        case (ControlType.Coordinate):
1884
                            {
1885
                                var control = currentControl as CoordinateControl;
1886
                                if (control != null)
1887
                                {
1888 168f8027 taeseongkim
                                    //control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1889 684ef11c ljiyeon
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1890
                                    control.Paint = ViewerDataModel.Instance.paintSet;
1891
                                }
1892
                            }
1893
                            break;
1894 233ef333 taeseongkim
1895 684ef11c ljiyeon
                        case (ControlType.InsideWhite):
1896
                            {
1897
                                var control = currentControl as InsideWhiteControl;
1898
                                if (control != null)
1899
                                {
1900 168f8027 taeseongkim
                                    //control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1901 684ef11c ljiyeon
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1902
                                    control.Paint = ViewerDataModel.Instance.paintSet;
1903
                                    control.Paint = PaintSet.Fill;
1904
                                }
1905
                            }
1906
                            break;
1907 233ef333 taeseongkim
1908 a6272c57 humkyung
                        case ControlType.OverlapWhite:
1909 684ef11c ljiyeon
                            {
1910
                                var control = currentControl as OverlapWhiteControl;
1911
                                if (control != null)
1912
                                {
1913 168f8027 taeseongkim
                                    //control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1914 684ef11c ljiyeon
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1915
                                    control.Paint = ViewerDataModel.Instance.paintSet;
1916
                                    control.Paint = PaintSet.Fill;
1917
                                }
1918
                            }
1919
                            break;
1920 233ef333 taeseongkim
1921 a6272c57 humkyung
                        case ControlType.ClipWhite:
1922 684ef11c ljiyeon
                            {
1923
                                var control = currentControl as ClipWhiteControl;
1924
                                if (control != null)
1925
                                {
1926 168f8027 taeseongkim
                                    //control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1927 684ef11c ljiyeon
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1928
                                    control.Paint = ViewerDataModel.Instance.paintSet;
1929
                                    control.Paint = PaintSet.Fill;
1930
                                }
1931
                            }
1932
                            break;
1933 233ef333 taeseongkim
1934 787a4489 KangIngu
                        case ControlType.RectCloud:
1935
                            {
1936
                                var control = currentControl as RectCloudControl;
1937
                                if (control != null)
1938
                                {
1939 168f8027 taeseongkim
                                    //control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1940 787a4489 KangIngu
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1941
                                    control.Paint = ViewerDataModel.Instance.paintSet;
1942
                                }
1943
                            }
1944
                            break;
1945 233ef333 taeseongkim
1946 787a4489 KangIngu
                        case ControlType.SingleLine:
1947
                        case ControlType.CancelLine:
1948
                        case ControlType.ArrowLine:
1949
                        case ControlType.TwinLine:
1950
                        case ControlType.DimLine:
1951
                            {
1952 d71ee575 djkim
                                var control = currentControl as LineControl;
1953
                                if (control != null)
1954 787a4489 KangIngu
                                {
1955 168f8027 taeseongkim
                                    //control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1956 787a4489 KangIngu
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1957
                                }
1958
                            }
1959
                            break;
1960
1961
                        case ControlType.ArcLine:
1962
                            {
1963 d71ee575 djkim
                                var control = currentControl as ArcControl;
1964
                                if (control != null)
1965 787a4489 KangIngu
                                {
1966 168f8027 taeseongkim
                                    //control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1967 787a4489 KangIngu
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1968
                                }
1969
                            }
1970
                            break;
1971
1972
                        case ControlType.ArcArrow:
1973
                            {
1974 40b3ce25 ljiyeon
                                var control = currentControl as ArrowArcControl;
1975 d71ee575 djkim
                                if (control != null)
1976 787a4489 KangIngu
                                {
1977 168f8027 taeseongkim
                                    //control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1978 787a4489 KangIngu
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1979
                                }
1980
                            }
1981
                            break;
1982
1983
                        case ControlType.ArrowMultiLine:
1984
                            {
1985 d71ee575 djkim
                                var control = currentControl as ArrowControl_Multi;
1986
                                if (control != null)
1987 787a4489 KangIngu
                                {
1988 168f8027 taeseongkim
                                    //control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1989 787a4489 KangIngu
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1990
                                }
1991
                            }
1992
                            break;
1993
1994
                        case ControlType.Circle:
1995
                            {
1996 168f8027 taeseongkim
                                var control = currentControl as CircleControl;
1997
1998
                                if (control != null)
1999 787a4489 KangIngu
                                {
2000 168f8027 taeseongkim
                                    //control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
2001
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
2002
                                    control.Paint = ViewerDataModel.Instance.paintSet;
2003 787a4489 KangIngu
                                }
2004
                            }
2005
                            break;
2006
2007
                        case ControlType.PolygonCloud:
2008
                            {
2009
                                var control = currentControl as CloudControl;
2010
                                if (control != null)
2011
                                {
2012 168f8027 taeseongkim
                                    //control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
2013 787a4489 KangIngu
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
2014
                                    control.Paint = ViewerDataModel.Instance.paintSet;
2015
                                }
2016
                            }
2017
                            break;
2018
2019
                        case ControlType.Triangle:
2020
                            {
2021
                                var control = currentControl as TriControl;
2022
                                if (control != null)
2023
                                {
2024 168f8027 taeseongkim
                                    //control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
2025 787a4489 KangIngu
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
2026
                                    control.Paint = ViewerDataModel.Instance.paintSet;
2027
                                }
2028
                            }
2029
                            break;
2030
2031
                        case ControlType.ImgControl:
2032
                            {
2033
                                var control = currentControl as ImgControl;
2034
                                if (control != null)
2035
                                {
2036 168f8027 taeseongkim
                                    //control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
2037 787a4489 KangIngu
                                }
2038
                            }
2039
                            break;
2040
2041
                        case ControlType.Date:
2042
                            {
2043
                                var control = currentControl as DateControl;
2044
                                if (control != null)
2045
                                {
2046 168f8027 taeseongkim
                                    //control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
2047 787a4489 KangIngu
                                }
2048
                            }
2049
                            break;
2050
2051
                        case ControlType.ArrowTextControl:
2052
                        case ControlType.ArrowTransTextControl:
2053
                        case ControlType.ArrowTextBorderControl:
2054
                        case ControlType.ArrowTransTextBorderControl:
2055
                        case ControlType.ArrowTextCloudControl:
2056
                        case ControlType.ArrowTransTextCloudControl:
2057
                            {
2058
                                var control = currentControl as ArrowTextControl;
2059
                                if (control != null)
2060
                                {
2061 168f8027 taeseongkim
                                    //control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
2062 787a4489 KangIngu
                                }
2063
                            }
2064
                            break;
2065 233ef333 taeseongkim
2066 787a4489 KangIngu
                        case ControlType.PolygonControl:
2067 e6a9ddaf humkyung
                        case ControlType.ChainLine:
2068 787a4489 KangIngu
                            {
2069
                                var control = currentControl as PolygonControl;
2070
                                if (control != null)
2071
                                {
2072 168f8027 taeseongkim
                                    //control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
2073 787a4489 KangIngu
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
2074
                                    control.Paint = ViewerDataModel.Instance.paintSet;
2075
                                }
2076
                            }
2077
                            break;
2078 233ef333 taeseongkim
2079 787a4489 KangIngu
                        case ControlType.Sign:
2080
                            {
2081
                                var control = currentControl as SignControl;
2082
                                if (control != null)
2083
                                {
2084 168f8027 taeseongkim
                                    //control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
2085 787a4489 KangIngu
                                }
2086
                            }
2087
                            break;
2088 233ef333 taeseongkim
2089 787a4489 KangIngu
                        case ControlType.Symbol:
2090
                            {
2091
                                var control = currentControl as SymControl;
2092
                                if (control != null)
2093
                                {
2094 168f8027 taeseongkim
                                    //control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
2095 787a4489 KangIngu
                                }
2096
                            }
2097
                            break;
2098 233ef333 taeseongkim
2099 787a4489 KangIngu
                        case ControlType.Stamp:
2100
                            {
2101 cd988cd8 djkim
                                var control = currentControl as SymControlN;
2102
                                if (control != null)
2103 787a4489 KangIngu
                                {
2104 cd988cd8 djkim
                                    if (control.STAMP != null)
2105 cbaa3c91 ljiyeon
                                    {
2106 168f8027 taeseongkim
                                        //control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
2107 cbaa3c91 ljiyeon
                                    }
2108 cd988cd8 djkim
                                    else
2109
                                    {
2110
                                        currentControl = null;
2111 902faaea taeseongkim
                                        this.cursor = new Cursor(App.DefaultArrowCursorStream);
2112 cd988cd8 djkim
                                        DialogMessage_Alert("Approved Stamp 가 등록되어 있지 않습니다. \n관리자에게 문의하세요.", "안내");
2113
                                    }
2114 168f8027 taeseongkim
                                }
2115 787a4489 KangIngu
                            }
2116
                            break;
2117 233ef333 taeseongkim
2118 a6272c57 humkyung
                        case ControlType.Rectangle:
2119 787a4489 KangIngu
                        case ControlType.Mark:
2120
                            {
2121
                                var control = currentControl as RectangleControl;
2122
                                if (control != null)
2123
                                {
2124 168f8027 taeseongkim
                                    //control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
2125
                                    if (control.ControlType == ControlType.Mark) control.Paint = PaintSet.Fill;
2126 7a5210f1 humkyung
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
2127 787a4489 KangIngu
                                }
2128
                            }
2129
                            break;
2130 233ef333 taeseongkim
2131 787a4489 KangIngu
                        case ControlType.PenControl:
2132
                            {
2133
                                stroke.StylusPoints.Add(new StylusPoint(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y));
2134
                                //inkBoard.Strokes.Add(stroke);
2135
                            }
2136
                            break;
2137 233ef333 taeseongkim
2138 787a4489 KangIngu
                        default:
2139
                            break;
2140
                    }
2141 168f8027 taeseongkim
2142 233ef333 taeseongkim
                    #endregion // 각 컨트롤의 특별한 기능을 제어한다.
2143
2144 4f017ed3 taeseongkim
                    if (ViewerDataModel.Instance.MarkupAngleVisibility == Visibility.Visible)
2145 168f8027 taeseongkim
                    {
2146 4f017ed3 taeseongkim
                        ViewerDataModel.Instance.MarkupAngle = currentControl.CommentAngle;
2147 168f8027 taeseongkim
                    }
2148 787a4489 KangIngu
                }
2149
            }
2150 233ef333 taeseongkim
            else if (mouseHandlingMode == MouseHandlingMode.Drawing && e.LeftButton == MouseButtonState.Pressed)
2151 29cf2c0c humkyung
            {
2152
                Point currentCanvasDrawingMouseMovePoint = e.GetPosition(drawingRotateCanvas);
2153
                Point currentCanvasZoomPanningMouseMovePoint = e.GetPosition(zoomAndPanCanvas);
2154
                SetCursor();
2155
                if (currentControl == null)
2156
                {
2157
                    switch (controlType)
2158
                    {
2159
                        case ControlType.PenControl:
2160
                            {
2161
                                if (inkBoard.Tag.ToString() == "Ink")
2162
                                {
2163
                                    stroke.StylusPoints.Add(new StylusPoint(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y));
2164
                                }
2165
                                else if (inkBoard.Tag.ToString() == "EraseByPoint")
2166
                                {
2167
                                    RemovePointStroke(currentCanvasDrawingMouseMovePoint);
2168
                                }
2169
                                else if (inkBoard.Tag.ToString() == "EraseByStroke")
2170
                                {
2171
                                    RemoveLineStroke(currentCanvasDrawingMouseMovePoint);
2172
                                }
2173
2174
                                //inkBoard.Strokes.Add(stroke);
2175
                            }
2176
                            break;
2177
                    }
2178
                    return;
2179
                }
2180
            }
2181 233ef333 taeseongkim
            else if (((e.LeftButton == MouseButtonState.Pressed) && mouseHandlingMode == MouseHandlingMode.Selecting) ||
2182
                ((e.LeftButton == MouseButtonState.Pressed) && mouseHandlingMode == MouseHandlingMode.Capture) ||
2183 e6a9ddaf humkyung
                ((e.LeftButton == MouseButtonState.Pressed) && mouseHandlingMode == MouseHandlingMode.DragZoom))
2184 787a4489 KangIngu
            {
2185
                Point curMouseDownPoint = e.GetPosition(drawingRotateCanvas);
2186
2187
                if (isDraggingSelectionRect)
2188
                {
2189 c7fde400 taeseongkim
                    UpdateDragSelectionRect(CanvasDrawingMouseDownPoint, curMouseDownPoint);
2190 787a4489 KangIngu
                    e.Handled = true;
2191
                }
2192
                else if (isLeftMouseButtonDownOnWindow)
2193
                {
2194 c7fde400 taeseongkim
                    var dragDelta = curMouseDownPoint - CanvasDrawingMouseDownPoint;
2195 787a4489 KangIngu
                    double dragDistance = Math.Abs(dragDelta.Length);
2196
2197
                    if (dragDistance > DragThreshold)
2198
                    {
2199
                        isDraggingSelectionRect = true;
2200 c7fde400 taeseongkim
                        InitDragSelectionRect(CanvasDrawingMouseDownPoint, curMouseDownPoint);
2201 787a4489 KangIngu
                    }
2202
2203
                    e.Handled = true;
2204
                }
2205
2206 c7fde400 taeseongkim
                if (CanvasDrawingMouseDownPoint == curMouseDownPoint)
2207 787a4489 KangIngu
                {
2208
                }
2209
                else
2210
                {
2211
                    e.Handled = true;
2212
                }
2213
            }
2214 7211e0c2 ljiyeon
            /*
2215 e6a9ddaf humkyung
            else if ((e.LeftButton == MouseButtonState.Pressed) && mouseHandlingMode == MouseHandlingMode.DragSymbol)
2216 233ef333 taeseongkim
            { //symbol
2217 53880c83 ljiyeon
                if(_dragdropWindow != null)
2218
                {
2219
                    Win32Point w32Mouse = new Win32Point();
2220
                    GetCursorPos(ref w32Mouse);
2221
2222
                    this._dragdropWindow.Left = w32Mouse.X - (symbol_img.Width / 2);
2223
                    this._dragdropWindow.Top = w32Mouse.Y - (symbol_img.Height / 2);
2224 233ef333 taeseongkim
                }
2225 53880c83 ljiyeon
            }
2226 7211e0c2 ljiyeon
            */
2227 233ef333 taeseongkim
            else if ((e.LeftButton == MouseButtonState.Released) && (e.MiddleButton == MouseButtonState.Released) &&
2228 e6a9ddaf humkyung
                (e.RightButton == MouseButtonState.Released) && ViewerDataModel.Instance.MarkupControls_USER.Count > 0)
2229 787a4489 KangIngu
            {
2230 dbddfdd0 taeseongkim
                //var comment = drawingRotateCanvas.FindDistanceComment(getCurrentPoint);
2231
2232
2233
                //if (comment != null)
2234
                //{
2235
                //    comment.IsMouseEnter = true;
2236
2237
                //    if (enterMouse != comment)
2238
                //    {
2239
                //        if (enterMouse != null)
2240
                //            enterMouse.IsSelected = false;
2241
2242
                //        enterMouse = comment;
2243
                //    }
2244
                //}
2245
                //else
2246
                //{
2247
                //    if(enterMouse != null)
2248
                //        enterMouse.IsSelected = false;
2249
                //}
2250
2251 9380813b swate0609
2252 a342d378 taeseongkim
                var control = ViewerDataModel.Instance.MarkupControls_USER.Where(data => data.IsMouseEnter).FirstOrDefault();
2253 233ef333 taeseongkim
                if (control != null)
2254 787a4489 KangIngu
                {
2255
                    this.cursor = Cursors.Hand;
2256
                    SetCursor();
2257
                }
2258
                else
2259
                {
2260 902faaea taeseongkim
                    if (this.Cursor != Cursors.None)
2261
                    {
2262
                        this.cursor = new Cursor(App.DefaultArrowCursorStream);
2263
                        SetCursor();
2264
                    }
2265 787a4489 KangIngu
                }
2266
            }
2267
            else
2268
            {
2269 9380813b swate0609
                
2270 787a4489 KangIngu
            }
2271
        }
2272
2273 dbddfdd0 taeseongkim
        private CommentUserInfo enterMouse = null;
2274
2275
        private object IntersectsControls(Point mousePosition,Canvas drawingRotateCanvas)
2276
        {
2277
            object result = null;
2278
2279
            // 검색할 정사각형의 크기 및 반경 설정
2280
            double squareSize = 1;
2281
            Rect searchRect = new Rect(
2282
                mousePosition.X - squareSize,
2283
                mousePosition.Y - squareSize,
2284
                squareSize * 2,
2285
                squareSize * 2
2286
            );
2287
2288
            foreach (CommentUserInfo child in drawingRotateCanvas.ChildrenOfType<CommentUserInfo>())
2289
            {
2290
                if (child is CommentUserInfo comment)
2291
                {
2292
                    // 검색 영역과 Rectangle의 경계가 겹치는지 확인합니다.
2293
                    if (searchRect.IntersectsWith(child.ItemRect))
2294
                    {
2295
                        child.IsMouseEnter = true;
2296
                        result = (object)child;
2297
                        // Geometry를 적용하거나 원하는 작업을 수행합니다.
2298
                        // 예: rectangle.Fill = new SolidColorBrush(Colors.Red);
2299
                    }
2300
                    else
2301
                    {
2302
                        child.IsMouseEnter = false;
2303
                    }
2304
                }
2305
            }
2306
2307
            return result;
2308
        }
2309
2310 a1716fa5 KangIngu
        private void zoomAndPanControl2_MouseMove(object sender, MouseEventArgs e)
2311
        {
2312 e6a9ddaf humkyung
            if ((e.MiddleButton == MouseButtonState.Pressed) || (e.RightButton == MouseButtonState.Pressed))
2313 a1716fa5 KangIngu
            {
2314
                SetCursor();
2315
                Point currentCanvasDrawingMouseMovePoint = e.GetPosition(drawingRotateCanvas2);
2316
                Point currentCanvasZoomPanningMouseMovePoint = e.GetPosition(zoomAndPanCanvas2);
2317
2318
                Vector dragOffset = currentCanvasZoomPanningMouseMovePoint - canvasZoommovingMouseDownPoint;
2319
2320
                ViewerDataModel.Instance.Sync_ContentOffsetX -= dragOffset.X;
2321
                ViewerDataModel.Instance.Sync_ContentOffsetY -= dragOffset.Y;
2322
2323
                if (Sync.IsChecked)
2324
                {
2325
                    zoomAndPanControl.ContentOffsetX = ViewerDataModel.Instance.Sync_ContentOffsetX;
2326
                    zoomAndPanControl.ContentOffsetY = ViewerDataModel.Instance.Sync_ContentOffsetY;
2327
                }
2328
            }
2329
        }
2330
2331 787a4489 KangIngu
        private List<CommentUserInfo> hitList = new List<CommentUserInfo>();
2332
2333
        private EllipseGeometry hitArea = new EllipseGeometry();
2334
2335
        private void zoomAndPanControl_MouseUp(object sender, MouseButtonEventArgs e)
2336
        {
2337
            IsDrawing = false;
2338 233ef333 taeseongkim
2339 787a4489 KangIngu
            if (mouseHandlingMode != MouseHandlingMode.None)
2340
            {
2341
                if (mouseHandlingMode == MouseHandlingMode.Drawing)
2342
                {
2343 902faaea taeseongkim
                    this.cursor = new Cursor(App.DefaultArrowCursorStream);
2344 787a4489 KangIngu
2345
                    SetCursor();
2346
2347
                    switch (controlType)
2348
                    {
2349
                        case ControlType.None:
2350
                            break;
2351 233ef333 taeseongkim
2352 787a4489 KangIngu
                        case ControlType.Rectangle:
2353
                            {
2354
                            }
2355
                            break;
2356 233ef333 taeseongkim
2357 787a4489 KangIngu
                        case ControlType.PenControl:
2358
                            {
2359
                            }
2360
                            break;
2361 233ef333 taeseongkim
2362 787a4489 KangIngu
                        default:
2363
                            break;
2364 233ef333 taeseongkim
                    }
2365 787a4489 KangIngu
                }
2366 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)
2367 787a4489 KangIngu
                {
2368
                    if (isLeftMouseButtonDownOnWindow)
2369
                    {
2370
                        bool wasDragSelectionApplied = false;
2371
2372
                        if (isDraggingSelectionRect)
2373
                        {
2374 53880c83 ljiyeon
                            if (mouseHandlingMode == MouseHandlingMode.Capture && controlType == ControlType.ImgControl)
2375
                            {
2376
                                dragCaptureBorder.Visibility = Visibility.Collapsed;
2377
                                mouseHandlingMode = MouseHandlingMode.None;
2378
                                Point endPoint = e.GetPosition(zoomAndPanCanvas);
2379
                                symbolselectindex = symbolPanel_Instance.RadTab.SelectedIndex;
2380
                                Set_Symbol_Capture(endPoint);
2381
                                ViewerDataModel.Instance.ViewVisible = Visibility.Collapsed;
2382 233ef333 taeseongkim
                                ViewerDataModel.Instance.ViewVisible = Visibility.Visible;
2383 53880c83 ljiyeon
                                ViewerDataModel.Instance.Capture_Opacity = 0;
2384
                            }
2385
                            else if (mouseHandlingMode == MouseHandlingMode.Capture)
2386 787a4489 KangIngu
                            {
2387
                                dragCaptureBorder.Visibility = Visibility.Collapsed;
2388
                                mouseHandlingMode = MouseHandlingMode.None;
2389
                                Set_Capture();
2390
2391
                                ViewerDataModel.Instance.ViewVisible = Visibility.Collapsed;
2392
                                ViewerDataModel.Instance.ViewVisible = Visibility.Visible;
2393
                                ViewerDataModel.Instance.Capture_Opacity = 0;
2394
                            }
2395 9f473fb7 KangIngu
                            else if (mouseHandlingMode == MouseHandlingMode.Selecting)
2396 787a4489 KangIngu
                            {
2397
                                ApplyDragSelectionRect();
2398
                            }
2399 9f473fb7 KangIngu
                            else
2400
                            {
2401
                                double x = Canvas.GetLeft(dragZoomBorder);
2402
                                double y = Canvas.GetTop(dragZoomBorder);
2403
                                double width = dragZoomBorder.Width;
2404
                                double height = dragZoomBorder.Height;
2405
                                Rect dragRect = new Rect(x, y, width, height);
2406
2407
                                ViewerDataModel.Instance.SystemMain.dzMainMenu.zoomAndPanControl.ZoomTo(dragRect);
2408
2409
                                dragZoomBorder.Visibility = Visibility.Collapsed;
2410
                            }
2411 787a4489 KangIngu
2412 9f473fb7 KangIngu
                            isDraggingSelectionRect = false;
2413 787a4489 KangIngu
                            e.Handled = true;
2414
                            wasDragSelectionApplied = true;
2415
                        }
2416
2417
                        if (isLeftMouseButtonDownOnWindow)
2418
                        {
2419
                            isLeftMouseButtonDownOnWindow = false;
2420
                            this.ReleaseMouseCapture();
2421
                            e.Handled = true;
2422
                        }
2423
2424
                        if (!wasDragSelectionApplied)
2425
                        {
2426
                            init();
2427
                        }
2428
                    }
2429
                }
2430 e6a9ddaf humkyung
                else if (e.RightButton == MouseButtonState.Pressed)
2431 787a4489 KangIngu
                {
2432 902faaea taeseongkim
                    this.cursor = new Cursor(App.DefaultArrowCursorStream);
2433 787a4489 KangIngu
                    SetCursor();
2434
                }
2435
2436
                zoomAndPanControl.ReleaseMouseCapture();
2437
2438
                e.Handled = true;
2439
            }
2440
            else
2441
            {
2442 902faaea taeseongkim
                this.cursor = new Cursor(App.DefaultArrowCursorStream);
2443 787a4489 KangIngu
                SetCursor();
2444
            }
2445
2446 e6a9ddaf humkyung
            ///mouseButtonDown = MouseButton.Left;
2447 787a4489 KangIngu
            //controlType = ControlType.SingleLine;
2448
        }
2449
2450 53880c83 ljiyeon
        public void Set_Symbol_Capture(Point endPoint)
2451 233ef333 taeseongkim
        {
2452 c7fde400 taeseongkim
            double x = CanvasDrawingMouseDownPoint.X;
2453
            double y = CanvasDrawingMouseDownPoint.Y;
2454 233ef333 taeseongkim
            if (x > endPoint.X)
2455 53880c83 ljiyeon
            {
2456
                x = endPoint.X;
2457
                y = endPoint.Y;
2458
            }
2459
2460
            double width = dragCaptureBorder.Width;
2461
            double height = dragCaptureBorder.Height;
2462
2463
            canvasImage = ConverterBitmapImage(zoomAndPanCanvas);
2464
2465
            if (x < 0)
2466
            {
2467
                width += x;
2468
                x = 0;
2469
            }
2470
            if (y < 0)
2471
            {
2472
                height += y;
2473
                y = 0;
2474
2475
                width = (int)canvasImage.PixelWidth - x;
2476
            }
2477
            if (x + width > canvasImage.PixelWidth)
2478
            {
2479
                width = (int)canvasImage.PixelWidth - x;
2480
            }
2481
            if (y + height > canvasImage.PixelHeight)
2482
            {
2483
                height = (int)canvasImage.PixelHeight - y;
2484
            }
2485
            var rect = new Int32Rect((int)x, (int)y, (int)width, (int)height);
2486
2487 69f41aab humkyung
            string uri = this.GetImageURL(_ViewInfo.DocumentItemID, Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber);
2488 53880c83 ljiyeon
            var defaultBitmapImage = new BitmapImage();
2489
            defaultBitmapImage.BeginInit();
2490
            defaultBitmapImage.CreateOptions = BitmapCreateOptions.IgnoreImageCache;
2491
            defaultBitmapImage.CacheOption = BitmapCacheOption.OnLoad;
2492
            defaultBitmapImage.UriSource = new Uri(uri);
2493
            defaultBitmapImage.EndInit();
2494
2495 90e7968d ljiyeon
            //GC.Collect();
2496 53880c83 ljiyeon
2497
            if (defaultBitmapImage.IsDownloading)
2498
            {
2499
                defaultBitmapImage.DownloadCompleted += (ex, arg) =>
2500
                {
2501
                    defaultBitmapImage.Freeze();
2502 90e7968d ljiyeon
                    //GC.Collect();
2503 53880c83 ljiyeon
                    BitmapSource bs = new CroppedBitmap(defaultBitmapImage, rect);
2504
                    Save_Symbol_Capture(bs, (int)x, (int)y, (int)width, (int)height);
2505
                };
2506
            }
2507
        }
2508
2509 a1716fa5 KangIngu
        private void zoomAndPanControl2_MouseUp(object sender, MouseButtonEventArgs e)
2510
        {
2511 e6a9ddaf humkyung
            ///mouseButtonDown = MouseButton.Left;
2512 a1716fa5 KangIngu
        }
2513
2514 787a4489 KangIngu
        private void zoomAndPanControl_MouseLeave(object sender, MouseEventArgs e)
2515
        {
2516 e6a9ddaf humkyung
            ///mouseButtonDown = MouseButton.Left;
2517 902faaea taeseongkim
            //this.cursor = new Cursor(App.DefaultArrowCursorStream);
2518 787a4489 KangIngu
        }
2519
2520
        private void zoomAndPanControl_MouseDoubleClick(object sender, MouseButtonEventArgs e)
2521
        {
2522
        }
2523
2524 4804a4fb humkyung
        /// <summary>
2525
        /// select items by dragging
2526
        /// </summary>
2527 787a4489 KangIngu
        private void ApplyDragSelectionRect()
2528
        {
2529
            dragSelectionBorder.Visibility = Visibility.Collapsed;
2530
2531
            double x = Canvas.GetLeft(dragSelectionBorder);
2532
            double y = Canvas.GetTop(dragSelectionBorder);
2533
            double width = dragSelectionBorder.Width;
2534
            double height = dragSelectionBorder.Height;
2535
            Boolean Flag = false;
2536
            List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>();
2537 f87a00b1 ljiyeon
            var Items = ViewerDataModel.Instance.MarkupControls_USER.Where(d => d.Visibility != Visibility.Hidden).ToList();
2538 787a4489 KangIngu
2539 e6a9ddaf humkyung
            Rect dragRect = new Rect(x, y, width, height);
2540
            ///dragRect.Inflate(width / 10, height / 10);
2541 787a4489 KangIngu
2542
            foreach (var item in Items)
2543
            {
2544 91efe37a humkyung
                Flag = SelectionSet.Instance.SelectControl(item, dragRect);
2545 787a4489 KangIngu
2546
                if (Flag)
2547
                {
2548
                    adornerSet.Add(item);
2549 05009a0e ljiyeon
                    ViewerDataModel.Instance.MarkupControls_USER.Remove(item);
2550 787a4489 KangIngu
                    Control_Style(item);
2551
                }
2552
            }
2553
            if (adornerSet.Count > 0)
2554
            {
2555
                Controls.AdornerFinal final = new Controls.AdornerFinal(adornerSet);
2556
                SelectLayer.Children.Add(final);
2557
            }
2558
        }
2559
2560
        private void InitDragSelectionRect(Point pt1, Point pt2)
2561
        {
2562 9f473fb7 KangIngu
            //캡쳐 중
2563
            if (mouseHandlingMode == MouseHandlingMode.Capture)
2564
            {
2565
                dragCaptureBorder.Visibility = Visibility.Visible;
2566
            }
2567 787a4489 KangIngu
            //선택 중
2568 9f473fb7 KangIngu
            else if (mouseHandlingMode == MouseHandlingMode.Selecting)
2569 787a4489 KangIngu
            {
2570
                dragSelectionBorder.Visibility = Visibility.Visible;
2571
            }
2572
            else
2573
            {
2574 9f473fb7 KangIngu
                dragZoomBorder.Visibility = Visibility.Visible;
2575 787a4489 KangIngu
            }
2576
            UpdateDragSelectionRect(pt1, pt2);
2577
        }
2578
2579
        /// <summary>
2580
        /// Update the position and size of the rectangle used for drag selection.
2581
        /// </summary>
2582
        private void UpdateDragSelectionRect(Point pt1, Point pt2)
2583
        {
2584
            double x, y, width, height;
2585
2586
            //
2587
            // Determine x,y,width and height of the rect inverting the points if necessary.
2588 233ef333 taeseongkim
            //
2589 787a4489 KangIngu
2590
            if (pt2.X < pt1.X)
2591
            {
2592
                x = pt2.X;
2593
                width = pt1.X - pt2.X;
2594
            }
2595
            else
2596
            {
2597
                x = pt1.X;
2598
                width = pt2.X - pt1.X;
2599
            }
2600
2601
            if (pt2.Y < pt1.Y)
2602
            {
2603
                y = pt2.Y;
2604
                height = pt1.Y - pt2.Y;
2605
            }
2606
            else
2607
            {
2608
                y = pt1.Y;
2609
                height = pt2.Y - pt1.Y;
2610
            }
2611
2612
            //
2613
            // Update the coordinates of the rectangle used for drag selection.
2614
            //
2615 9f473fb7 KangIngu
            //캡쳐 중
2616
            if (mouseHandlingMode == MouseHandlingMode.Capture)
2617
            {
2618
                Canvas.SetLeft(dragCaptureBorder, x);
2619
                Canvas.SetTop(dragCaptureBorder, y);
2620
                dragCaptureBorder.Width = width;
2621
                dragCaptureBorder.Height = height;
2622
            }
2623 787a4489 KangIngu
            //선택 중
2624 a1716fa5 KangIngu
            else if (mouseHandlingMode == MouseHandlingMode.Selecting)
2625 787a4489 KangIngu
            {
2626
                Canvas.SetLeft(dragSelectionBorder, x);
2627
                Canvas.SetTop(dragSelectionBorder, y);
2628
                dragSelectionBorder.Width = width;
2629
                dragSelectionBorder.Height = height;
2630
            }
2631
            else
2632
            {
2633 9f473fb7 KangIngu
                Canvas.SetLeft(dragZoomBorder, x);
2634
                Canvas.SetTop(dragZoomBorder, y);
2635
                dragZoomBorder.Width = width;
2636
                dragZoomBorder.Height = height;
2637 787a4489 KangIngu
            }
2638
        }
2639
2640
        private void drawingPannelRotate(double angle)
2641
        {
2642 548c696e ljiyeon
            Logger.sendCheckLog("pageNavigator_PageChanging_drawingPannelRotate Setting", 1);
2643 787a4489 KangIngu
            rotate.Angle = angle;
2644
            var rotationNum = Math.Abs((rotate.Angle / 90));
2645
2646
            if (angle == 90 || angle == 270)
2647
            {
2648
                double emptySize = zoomAndPanCanvas.Width;
2649
                zoomAndPanCanvas.Width = zoomAndPanCanvas.Height;
2650
                zoomAndPanCanvas.Height = emptySize;
2651
            }
2652
            if (angle == 0)
2653
            {
2654
                translate.X = 0;
2655
                translate.Y = 0;
2656
            }
2657
            else if (angle == 90)
2658
            {
2659
                translate.X = zoomAndPanCanvas.Width;
2660
                translate.Y = 0;
2661
            }
2662
            else if (angle == 180)
2663
            {
2664
                translate.X = zoomAndPanCanvas.Width;
2665
                translate.Y = zoomAndPanCanvas.Height;
2666
            }
2667
            else
2668
            {
2669
                translate.X = 0;
2670
                translate.Y = zoomAndPanCanvas.Height;
2671
            }
2672
2673
            zoomAndPanControl.RotationAngle = rotate.Angle;
2674
2675
            if (!testPanel2.IsHidden)
2676
            {
2677
                zoomAndPanControl2.RotationAngle = rotate.Angle;
2678
                zoomAndPanCanvas2.Width = zoomAndPanCanvas.Width;
2679
                zoomAndPanCanvas2.Height = zoomAndPanCanvas.Height;
2680
            }
2681
2682
            ViewerDataModel.Instance.ContentWidth = zoomAndPanCanvas.Width;
2683
            ViewerDataModel.Instance.ContentHeight = zoomAndPanCanvas.Height;
2684
            ViewerDataModel.Instance.AngleOffsetX = translate.X;
2685
            ViewerDataModel.Instance.AngleOffsetY = translate.Y;
2686 4f017ed3 taeseongkim
            ViewerDataModel.Instance.MarkupAngle = rotate.Angle;
2687 787a4489 KangIngu
        }
2688
2689 497bbe52 ljiyeon
        private void syncPannelRotate(double angle)
2690
        {
2691
            //Logger.sendCheckLog("pageNavigator_PageChanging_drawingPannelRotate Setting", 1);
2692
            rotate.Angle = angle;
2693
            var rotationNum = Math.Abs((rotate.Angle / 90));
2694
2695
            if (angle == 90 || angle == 270)
2696
            {
2697
                double emptySize = zoomAndPanCanvas2.Width;
2698
                zoomAndPanCanvas2.Width = zoomAndPanCanvas2.Height;
2699
                zoomAndPanCanvas2.Height = emptySize;
2700
            }
2701
            if (angle == 0)
2702
            {
2703
                translate2.X = 0;
2704
                translate2.Y = 0;
2705
            }
2706
            else if (angle == 90)
2707
            {
2708
                translate2.X = zoomAndPanCanvas2.Width;
2709
                translate2.Y = 0;
2710
            }
2711
            else if (angle == 180)
2712
            {
2713
                translate2.X = zoomAndPanCanvas2.Width;
2714
                translate2.Y = zoomAndPanCanvas2.Height;
2715
            }
2716
            else
2717
            {
2718
                translate2.X = 0;
2719
                translate2.Y = zoomAndPanCanvas2.Height;
2720
            }
2721
2722
            zoomAndPanControl2.RotationAngle = rotate.Angle;
2723
        }
2724
2725 53880c83 ljiyeon
        public void PlaceImageSymbol(string id, long group_id, int SelectedIndex, Point canvasZoomPanningMouseDownPoint)
2726 787a4489 KangIngu
        {
2727 53880c83 ljiyeon
            string Data_ = "";
2728
2729
            try
2730
            {
2731 664ea2e1 taeseongkim
                //Logger.sendReqLog("GetSymbolImageURL: ", id + "," + SelectedIndex, 1);
2732 53880c83 ljiyeon
                Data_ = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.GetSymbolImageURL(id, SelectedIndex);
2733
                if (Data_ != null || Data_ != "")
2734
                {
2735 664ea2e1 taeseongkim
                    //Logger.sendResLog("GetSymbolImageURL", "TRUE", 1);
2736 53880c83 ljiyeon
                }
2737
                else
2738
                {
2739 664ea2e1 taeseongkim
                    //Logger.sendResLog("GetSymbolImageURL", "FALSE", 1);
2740 53880c83 ljiyeon
                }
2741
2742 c0977e97 djkim
                //MARKUP_DATA_GROUP mARKUP_DATA_GROUP = new MARKUP_DATA_GROUP
2743
                //{
2744
                //    SYMBOL_ID = id,//InnerItem.Symbol_ID
2745
                //    STATE = 0,
2746
                //};
2747 53880c83 ljiyeon
                if (Data_ != null)
2748
                {
2749
                    Image img = new Image();
2750
                    //img.Source = new System.Windows.Media.Imaging.BitmapImage(new Uri(Data_));
2751
                    if (Data_.Contains(".svg"))
2752
                    {
2753 f1f822e9 taeseongkim
                        SharpVectors.Converters.SvgImageExtension svgImage = new SharpVectors.Converters.SvgImageExtension(Data_);
2754
                        img.Source = (DrawingImage)svgImage.ProvideValue(null);
2755 53880c83 ljiyeon
                    }
2756
                    else
2757
                    {
2758
                        img.Source = new BitmapImage(new Uri(Data_));
2759
                    }
2760
2761
                    var currentControl = new MarkupToPDF.Controls.Etc.ImgControl
2762
                    {
2763
                        PointSet = new List<Point>(),
2764
                        FilePath = Data_,
2765
                        ImageData = img.Source,
2766
                        StartPoint = canvasZoomPanningMouseDownPoint,
2767 233ef333 taeseongkim
                        EndPoint = new Point(canvasZoomPanningMouseDownPoint.X + img.Source.Width,
2768 53880c83 ljiyeon
                        canvasZoomPanningMouseDownPoint.Y + img.Source.Height),
2769 233ef333 taeseongkim
                        TopRightPoint = new Point(canvasZoomPanningMouseDownPoint.X + img.Source.Width,
2770 53880c83 ljiyeon
                        canvasZoomPanningMouseDownPoint.Y),
2771
                        LeftBottomPoint = new Point(canvasZoomPanningMouseDownPoint.X,
2772
                        canvasZoomPanningMouseDownPoint.Y + img.Source.Height)
2773
                    };
2774
2775
                    currentControl.PointSet = new List<Point>
2776
                                        {
2777
                                            currentControl.StartPoint,
2778
                                            currentControl.LeftBottomPoint,
2779
                                            currentControl.EndPoint,
2780
                                            currentControl.TopRightPoint,
2781
                                        };
2782 b79d6e7f humkyung
                    UndoData multi_UndoData = new UndoData();
2783 873011c4 humkyung
                    UndoDataGroup = new UndoDataGroup()
2784 53880c83 ljiyeon
                    {
2785
                        IsUndo = false,
2786 873011c4 humkyung
                        Event = EventType.Create,
2787 53880c83 ljiyeon
                        EventTime = DateTime.Now,
2788 b79d6e7f humkyung
                        MarkupDataColl = new List<UndoData>()
2789 53880c83 ljiyeon
                    };
2790
                    ViewerDataModel.Instance.UndoDataList.Where(data1 => data1.IsUndo == true).ToList().ForEach(i =>
2791
                    {
2792
                        ViewerDataModel.Instance.UndoDataList.Remove(i);
2793
                    });
2794
2795 873011c4 humkyung
                    //multi_UndoData = dzMainMenu.Control_Style(currentControl as MarkupToPDF.Common.CommentUserInfo);
2796
                    multi_UndoData = Control_Style(currentControl as MarkupToPDF.Common.CommentUserInfo);
2797
                    UndoDataGroup.MarkupDataColl.Add(multi_UndoData);
2798
                    ViewerDataModel.Instance.UndoDataList.Add(UndoDataGroup);
2799 53880c83 ljiyeon
2800
                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl as MarkupToPDF.Common.CommentUserInfo);
2801 24678e06 humkyung
                    currentControl.CommentID = Commons.shortGuid();
2802 53880c83 ljiyeon
                    currentControl.SymbolID = id;
2803
                    currentControl.GroupID = group_id;
2804
                    currentControl.ApplyTemplate();
2805
                    currentControl.SetImage();
2806
2807
                    ViewerDataModel.Instance.MarkupControls_USER.Remove(currentControl as MarkupToPDF.Common.CommentUserInfo);
2808
                    Controls.AdornerFinal final = new Controls.AdornerFinal(currentControl as MarkupToPDF.Common.CommentUserInfo);
2809
                    SelectLayer.Children.Add(final);
2810
                }
2811
            }
2812
            catch (Exception ex)
2813
            {
2814
                this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert(ex.Message, "Error");
2815
            }
2816
        }
2817
2818 6a19b48d taeseongkim
        // 저장전 textbox 입력 완료 때문에 public로 하여 savecommand에서 호출하도록 임시로 함.
2819
        public async void zoomAndPanControl_MouseDown(object sender, MouseButtonEventArgs e)
2820 10de973b taeseongkim
        {
2821 992a98b4 KangIngu
            var set_option = this.ParentOfType<MainWindow>().dzTopMenu.Parent.ChildrenOfType<RadNumericUpDown>().Where(item => item.IsKeyboardFocusWithin).FirstOrDefault();
2822 be04d12c djkim
            if (set_option != null && !string.IsNullOrEmpty(set_option.ContentText))
2823 992a98b4 KangIngu
            {
2824
                set_option.Value = double.Parse(set_option.ContentText);
2825 5d55f6fb ljiyeon
                //set_option.Focusable = false;
2826 3c71b3a5 taeseongkim
                zoomAndPanControl.Focus();
2827 992a98b4 KangIngu
            }
2828
2829 f959ea6f humkyung
            ConvertInkControlToPolygon();
2830 787a4489 KangIngu
2831 1b2cf911 taeseongkim
            // 텍스트가 없으면 삭제됨
2832 787a4489 KangIngu
            var text_item = ViewerDataModel.Instance.MarkupControls_USER.Where(data =>
2833
            (data as TextControl) != null && (data as TextControl).Text == "" || (data as ArrowTextControl) != null && (data as ArrowTextControl).ArrowText == "").FirstOrDefault();
2834
2835 a1716fa5 KangIngu
            if (text_item != null && (currentControl as ArrowTextControl) == null)
2836 787a4489 KangIngu
            {
2837 34ac8db7 humkyung
                UndoCommand.Instance.Push(EventType.Delete, new[] { text_item });
2838 787a4489 KangIngu
            }
2839 1305c420 taeseongkim
2840 d62c0439 humkyung
            /// up to here
2841 787a4489 KangIngu
2842 b7813553 djkim
            foreach (var item in ViewerDataModel.Instance.MarkupControls_USER)
2843 787a4489 KangIngu
            {
2844 b7813553 djkim
                if (item as ArrowTextControl != null)
2845 787a4489 KangIngu
                {
2846 b7813553 djkim
                    (item as ArrowTextControl).Base_TextBox.IsHitTestVisible = false;
2847 787a4489 KangIngu
                }
2848 76688e76 djkim
                else if (item as TextControl != null)
2849
                {
2850
                    (item as TextControl).Base_TextBox.IsHitTestVisible = false;
2851
                }
2852 787a4489 KangIngu
            }
2853
2854 49b217ad humkyung
            //if (currentControl != null)
2855 787a4489 KangIngu
            {
2856 a6f7f9b6 djkim
                var text_item_ = ViewerDataModel.Instance.MarkupControls_USER.Where(data => (data as TextControl) != null && (data as TextControl).IsEditingMode == true).FirstOrDefault();
2857
                if (text_item_ != null)
2858 787a4489 KangIngu
                {
2859
                    (text_item_ as TextControl).Base_TextBlock.Visibility = Visibility.Visible;
2860
                    (text_item_ as TextControl).Base_TextBox.Visibility = Visibility.Collapsed;
2861 233ef333 taeseongkim
                    (text_item_ as TextControl).IsEditingMode = false;
2862 49b217ad humkyung
                    currentControl = null;
2863 787a4489 KangIngu
                }
2864
2865
                var Arrowtext_item_ = ViewerDataModel.Instance.MarkupControls_USER.Where(data => (data as ArrowTextControl) != null && (data as ArrowTextControl).IsEditingMode == true).FirstOrDefault();
2866 49b217ad humkyung
                if (Arrowtext_item_ != null && ((Arrowtext_item_ as ArrowTextControl).IsNew == false))
2867 787a4489 KangIngu
                {
2868
                    (Arrowtext_item_ as ArrowTextControl).IsEditingMode = false;
2869
                    (Arrowtext_item_ as ArrowTextControl).Base_TextBox.Focusable = false;
2870 49b217ad humkyung
                    currentControl = null;
2871 787a4489 KangIngu
                }
2872
            }
2873
2874 233ef333 taeseongkim
            double Ang = 0;
2875 787a4489 KangIngu
            if (rotate.Angle != 0)
2876
            {
2877
                Ang = 360 - rotate.Angle;
2878
            }
2879
2880
            if (e.OriginalSource is System.Windows.Controls.Image)
2881
            {
2882
                (e.OriginalSource as System.Windows.Controls.Image).Focus();
2883
            }
2884 7211e0c2 ljiyeon
            /*
2885 e6a9ddaf humkyung
            if (mouseHandlingMode == MouseHandlingMode.DragSymbol && e.LeftButton == MouseButtonState.Pressed)
2886 233ef333 taeseongkim
            {
2887 53880c83 ljiyeon
                canvasZoomPanningMouseDownPoint = e.GetPosition(zoomAndPanCanvas);
2888
                if(symbol_id != null)
2889
                {
2890
                    PlaceImageSymbol(symbol_id, symbol_group_id, symbol_SelectedIndex, canvasZoomPanningMouseDownPoint);
2891 233ef333 taeseongkim
                }
2892 53880c83 ljiyeon
            }
2893
2894 e6a9ddaf humkyung
            if (mouseHandlingMode == MouseHandlingMode.DragSymbol && e.RightButton == MouseButtonState.Pressed)
2895 53880c83 ljiyeon
            {
2896
                if (this._dragdropWindow != null)
2897
                {
2898
                    this._dragdropWindow.Close();
2899
                    this._dragdropWindow = null;
2900
                    symbol_id = null;
2901
                }
2902
            }
2903 7211e0c2 ljiyeon
            */
2904 53880c83 ljiyeon
2905 e6a9ddaf humkyung
            if (e.LeftButton == MouseButtonState.Pressed)
2906 787a4489 KangIngu
            {
2907 c7fde400 taeseongkim
                CanvasDrawingMouseDownPoint = e.GetPosition(drawingRotateCanvas);
2908 1a7a7e62 이지연
                canvasZoomPanningMouseDownPoint = e.GetPosition(zoomAndPanCanvas);
2909 902faaea taeseongkim
                this.cursor = new Cursor(App.DefaultArrowCursorStream);
2910 787a4489 KangIngu
                SetCursor();
2911
2912 315ae55e taeseongkim
                if (!ViewerDataModel.Instance.IsPressCtrl)
2913
                {
2914
                    SelectionSet.Instance.UnSelect(this);
2915
                }
2916 787a4489 KangIngu
            }
2917 f513c215 humkyung
2918 e6a9ddaf humkyung
            if (e.MiddleButton == MouseButtonState.Pressed)
2919 787a4489 KangIngu
            {
2920
                canvasZoommovingMouseDownPoint = e.GetPosition(zoomAndPanCanvas);
2921
                cursor = Cursors.SizeAll;
2922
                SetCursor();
2923
            }
2924 e6a9ddaf humkyung
            if (e.RightButton == MouseButtonState.Pressed)
2925 787a4489 KangIngu
            {
2926
                canvasZoommovingMouseDownPoint = e.GetPosition(zoomAndPanCanvas);
2927
                cursor = Cursors.SizeAll;
2928
                SetCursor();
2929
            }
2930 e6a9ddaf humkyung
            else if (e.XButton1 == MouseButtonState.Pressed)
2931 787a4489 KangIngu
            {
2932
                if (this.pageNavigator.CurrentPage.PageNumber + 1 <= this.pageNavigator.PageCount)
2933
                {
2934 3908a575 humkyung
                    this.pageNavigator.GotoPage(this.pageNavigator.CurrentPage.PageNumber + 1);
2935 787a4489 KangIngu
                }
2936
2937 3908a575 humkyung
                //this.pageNavigator.GotoPage(this.pageNavigator._NextPage.PageNumber);
2938 787a4489 KangIngu
            }
2939 e6a9ddaf humkyung
            else if (e.XButton2 == MouseButtonState.Pressed)
2940 787a4489 KangIngu
            {
2941
                if (this.pageNavigator.CurrentPage.PageNumber > 1)
2942
                {
2943
                    this.pageNavigator.GotoPage(this.pageNavigator.CurrentPage.PageNumber - 1);
2944
                }
2945
            }
2946
2947 1305c420 taeseongkim
            bool isArrowTextEdit = false;
2948
2949
            if (currentControl is ArrowTextControl textControl)
2950
            {
2951
                if (textControl.IsEditingMode)
2952
                    isArrowTextEdit = true;
2953
            }
2954
2955 e6a9ddaf humkyung
            if (e.LeftButton == MouseButtonState.Pressed && mouseHandlingMode != MouseHandlingMode.Drawing && currentControl == null)
2956 787a4489 KangIngu
            {
2957
                if (mouseHandlingMode == MouseHandlingMode.Selecting)
2958
                {
2959
                    if (SelectLayer.Children.Count == 0)
2960
                    {
2961
                        isLeftMouseButtonDownOnWindow = true;
2962
                        mouseHandlingMode = MouseHandlingMode.Selecting;
2963
                    }
2964
2965
                    if (controlType == ControlType.None)
2966
                    {
2967
                        isLeftMouseButtonDownOnWindow = true;
2968
                    }
2969
                }
2970
2971 f513c215 humkyung
                /// 캡쳐 모드 설정
2972 9f473fb7 KangIngu
                if (mouseHandlingMode == MouseHandlingMode.Capture)
2973
                {
2974
                    dragCaptureBorder.Visibility = Visibility.Visible;
2975
                    isLeftMouseButtonDownOnWindow = true;
2976
                }
2977
2978 f513c215 humkyung
                /// 줌 모드 설정
2979 9f473fb7 KangIngu
                if (mouseHandlingMode == MouseHandlingMode.DragZoom)
2980
                {
2981
                    isLeftMouseButtonDownOnWindow = true;
2982 1066bae3 ljiyeon
                }
2983 787a4489 KangIngu
2984 a342d378 taeseongkim
                var control = ViewerDataModel.Instance.MarkupControls_USER.Where(data => data.IsMouseEnter).FirstOrDefault();
2985 b643fcca taeseongkim
2986 233ef333 taeseongkim
                if (control == null)
2987 787a4489 KangIngu
                {
2988 b643fcca taeseongkim
                    ViewerDataModel.Instance.SetAngleVisible(Visibility.Collapsed);
2989
                }
2990
                else
2991
                {
2992 233ef333 taeseongkim
                    if (ControlTypeExtansions.LineTypes.Contains(control.ControlType))
2993
                    {
2994
                        ViewerDataModel.Instance.SetAngleVisible(Visibility.Visible);
2995
                    }
2996 b643fcca taeseongkim
2997 d62c0439 humkyung
                    AdornerFinal final = null;
2998 787a4489 KangIngu
2999
                    if (!ViewerDataModel.Instance.IsPressCtrl)
3000
                    {
3001 d62c0439 humkyung
                        /// 기존 selection 해제
3002 077896be humkyung
                        SelectionSet.Instance.UnSelect(this);
3003 d62c0439 humkyung
3004 787a4489 KangIngu
                        final = new AdornerFinal(control);
3005
3006 f513c215 humkyung
                        this.Control_Style(control);
3007 787a4489 KangIngu
3008
                        if ((control as IPath) != null)
3009
                        {
3010
                            if ((control as IPath).LineSize != 0)
3011
                            {
3012
                                ViewerDataModel.Instance.LineSize = (control as IPath).LineSize;
3013
                            }
3014
                        }
3015
                        if ((control as IShapeControl) != null)
3016
                        {
3017
                            if ((control as IShapeControl).Paint == PaintSet.Hatch)
3018
                            {
3019
                                ViewerDataModel.Instance.checkHatchShape = true;
3020
                            }
3021
                            else if ((control as IShapeControl).Paint == PaintSet.Fill)
3022
                            {
3023
                                ViewerDataModel.Instance.checkFillShape = true;
3024
                            }
3025
                            else
3026
                            {
3027
                                ViewerDataModel.Instance.checkHatchShape = false;
3028
                                ViewerDataModel.Instance.checkFillShape = false;
3029
                            }
3030
                            ViewerDataModel.Instance.paintSet = (control as IShapeControl).Paint;
3031
                        }
3032 9f473fb7 KangIngu
3033 787a4489 KangIngu
                        ViewerDataModel.Instance.ControlOpacity = control.Opacity;
3034 d4b0c723 KangIngu
3035 f7ca524b humkyung
                        if (control is TextControl TextCtrl)
3036 d4b0c723 KangIngu
                        {
3037 f7ca524b humkyung
                            ViewerDataModel.Instance.SystemMain.dzTopMenu.SetFont(TextCtrl.TextFamily);
3038 c206d293 taeseongkim
3039 f7ca524b humkyung
                            if (!(TextCtrl.EnableEditing))
3040 233ef333 taeseongkim
                            {
3041 f7ca524b humkyung
                                TextCtrl.EnableEditing = true;
3042 71d7e0bf 송근호
                            }
3043 f7ca524b humkyung
                            if (TextCtrl.TextStyle == FontStyles.Italic)
3044 d4b0c723 KangIngu
                            {
3045
                                ViewerDataModel.Instance.checkTextStyle = true;
3046
                            }
3047
                            else
3048
                            {
3049
                                ViewerDataModel.Instance.checkTextStyle = false;
3050
                            }
3051 f7ca524b humkyung
                            if (TextCtrl.TextWeight == FontWeights.Bold)
3052 d4b0c723 KangIngu
                            {
3053
                                ViewerDataModel.Instance.checkTextWeight = true;
3054
                            }
3055
                            else
3056
                            {
3057
                                ViewerDataModel.Instance.checkTextWeight = false;
3058
                            }
3059 f7ca524b humkyung
                            if (TextCtrl.UnderLine == TextDecorations.Underline)
3060 d4b0c723 KangIngu
                            {
3061
                                ViewerDataModel.Instance.checkUnderLine = true;
3062
                            }
3063
                            else
3064
                            {
3065
                                ViewerDataModel.Instance.checkUnderLine = false;
3066
                            }
3067 f7ca524b humkyung
                            ViewerDataModel.Instance.TextSize = TextCtrl.TextSize;
3068
                            ViewerDataModel.Instance.checkHighlight = TextCtrl.IsHighLight;
3069
                            ViewerDataModel.Instance.ArcLength = TextCtrl.ArcLength;
3070 d4b0c723 KangIngu
                        }
3071 b79d6e7f humkyung
                        else if (control is ArrowTextControl ArrowTextCtrl)
3072 d4b0c723 KangIngu
                        {
3073 24c5e56c taeseongkim
                            ViewerDataModel.Instance.SystemMain.dzTopMenu.SetFont((control as ArrowTextControl).TextFamily);
3074
3075 120b8b00 송근호
                            if (!((control as ArrowTextControl).EnableEditing))
3076
                            {
3077 b79d6e7f humkyung
                                ArrowTextCtrl.EnableEditing = true;
3078 71d7e0bf 송근호
                            }
3079 e17af42b KangIngu
                            if ((control as ArrowTextControl).TextStyle == FontStyles.Italic)
3080 d4b0c723 KangIngu
                            {
3081 e17af42b KangIngu
                                ViewerDataModel.Instance.checkTextStyle = true;
3082
                            }
3083
                            else
3084 d4b0c723 KangIngu
                            {
3085 e17af42b KangIngu
                                ViewerDataModel.Instance.checkTextStyle = false;
3086 d4b0c723 KangIngu
                            }
3087 e17af42b KangIngu
                            if ((control as ArrowTextControl).TextWeight == FontWeights.Bold)
3088 d4b0c723 KangIngu
                            {
3089 e17af42b KangIngu
                                ViewerDataModel.Instance.checkTextWeight = true;
3090
                            }
3091
                            else
3092
                            {
3093
                                ViewerDataModel.Instance.checkTextWeight = false;
3094
                            }
3095
                            if ((control as ArrowTextControl).UnderLine == TextDecorations.Underline)
3096
                            {
3097
                                ViewerDataModel.Instance.checkUnderLine = true;
3098
                            }
3099
                            else
3100
                            {
3101
                                ViewerDataModel.Instance.checkUnderLine = false;
3102 d4b0c723 KangIngu
                            }
3103 b79d6e7f humkyung
                            ViewerDataModel.Instance.checkHighlight = ArrowTextCtrl.isHighLight;
3104
                            ViewerDataModel.Instance.TextSize = ArrowTextCtrl.TextSize;
3105
                            ViewerDataModel.Instance.ArcLength = ArrowTextCtrl.ArcLength;
3106 d4b0c723 KangIngu
                        }
3107 f7ca524b humkyung
                        else if (control is RectCloudControl RectCloudCtrl)
3108 9f473fb7 KangIngu
                        {
3109 f7ca524b humkyung
                            ViewerDataModel.Instance.ArcLength = RectCloudCtrl.ArcLength;
3110 9f473fb7 KangIngu
                        }
3111 f7ca524b humkyung
                        else if (control is CloudControl CloudCtrl)
3112 9f473fb7 KangIngu
                        {
3113 f7ca524b humkyung
                            ViewerDataModel.Instance.ArcLength = CloudCtrl.ArcLength;
3114 9f473fb7 KangIngu
                        }
3115 787a4489 KangIngu
                    }
3116
                    else
3117
                    {
3118 d62c0439 humkyung
                        List<CommentUserInfo> comment = SelectionSet.Instance.SelectedItems;
3119
                        SelectionSet.Instance.UnSelect(this);
3120 787a4489 KangIngu
                        comment.Add(control);
3121
3122
                        Control_Style(control);
3123
3124
                        final = new AdornerFinal(comment);
3125
                    }
3126
3127 f513c215 humkyung
                    if (final != null)
3128
                    {
3129
                        this.SelectLayer.Children.Add(final);
3130
                    }
3131 b643fcca taeseongkim
                }
3132 787a4489 KangIngu
            }
3133
            else if (mouseHandlingMode == MouseHandlingMode.Drawing)
3134 233ef333 taeseongkim
            {
3135 787a4489 KangIngu
                init();
3136
                //강인구 추가(우 클릭 일 경우 커서 변경 하지 않음)
3137
                if (cursor != Cursors.SizeAll)
3138
                {
3139
                    cursor = Cursors.Cross;
3140
                    SetCursor();
3141
                }
3142
                bool init_user = false;
3143
                foreach (var user in gridViewMarkup.Items)
3144
                {
3145
                    if ((user as MarkupInfoItem).UserID == App.ViewInfo.UserID)
3146
                    {
3147
                        init_user = true;
3148
                    }
3149
                }
3150
                if (init_user && gridViewMarkup.SelectedItems.Where(d => (d as MarkupInfoItem).UserID == App.ViewInfo.UserID).FirstOrDefault() == null && e.LeftButton == MouseButtonState.Pressed)
3151
                {
3152 d7e20d2d taeseongkim
                    // 기존의 코멘트가 존재합니다. 사용자 리스트에서 먼저 선택해주세요
3153 787a4489 KangIngu
                    RadWindow.Alert(new DialogParameters
3154
                    {
3155 b9b01f8e ljiyeon
                        Owner = Application.Current.MainWindow,
3156 787a4489 KangIngu
                        Theme = new VisualStudio2013Theme(),
3157 d7e20d2d taeseongkim
                        Header = "Info",
3158 f458ee80 이지연
                        Content = "Select a layer and write a comment.",//"Existing comments already existed. Select from the user list first",
3159 787a4489 KangIngu
                    });
3160
                    return;
3161
                }
3162
                else
3163
                {
3164 e31e5b1b humkyung
                    var item = gridViewMarkup.SelectedItems.FirstOrDefault(d => (d as MarkupInfoItem).UserID == App.ViewInfo.UserID) as MarkupInfoItem;
3165 787a4489 KangIngu
                    if (item != null)
3166
                    {
3167
                        App.Custom_ViewInfoId = item.MarkupInfoID;
3168
                    }
3169
                }
3170 1305c420 taeseongkim
                
3171 75448f5e ljiyeon
                switch (controlType)
3172 787a4489 KangIngu
                {
3173 684ef11c ljiyeon
                    case ControlType.Coordinate:
3174
                        {
3175 e6a9ddaf humkyung
                            if (e.LeftButton == MouseButtonState.Pressed)
3176 684ef11c ljiyeon
                            {
3177
                                if (currentControl is CoordinateControl)
3178
                                {
3179
                                    if (IsGetoutpoint((currentControl as CoordinateControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3180
                                    {
3181
                                        return;
3182
                                    }
3183
3184 f513c215 humkyung
                                    CreateCommand.Instance.Execute(currentControl);
3185 684ef11c ljiyeon
3186
                                    currentControl = null;
3187
                                    this.cursor = Cursors.Arrow;
3188
                                }
3189
                                else
3190
                                {
3191
                                    this.ParentOfType<MainWindow>().dzTopMenu._SaveEvent(null, null);
3192 d62c0439 humkyung
                                    if (ViewerDataModel.Instance.MyMarkupList.Where(d => d.PageNumber == Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber
3193 684ef11c ljiyeon
                                     && d.Data_Type == Convert.ToInt32(MarkupToPDF.Controls.Common.ControlType.Coordinate)).Count() > 0)
3194
                                    {
3195
                                        currentControl = null;
3196
                                        this.cursor = Cursors.Arrow;
3197
                                        Common.ViewerDataModel.Instance.SystemMain.DialogMessage_Alert("이미 해당 페이지의 도면 영역을 설정하셨습니다.", "Notice");
3198
                                        return;
3199
                                    }
3200
                                    else
3201
                                    {
3202
                                        currentControl = new CoordinateControl
3203
                                        {
3204
                                            Background = new SolidColorBrush(Colors.Black),
3205 c7fde400 taeseongkim
                                            StartPoint = this.CanvasDrawingMouseDownPoint,
3206 684ef11c ljiyeon
                                            ControlType = ControlType.Coordinate
3207
                                        };
3208
3209 24678e06 humkyung
                                        currentControl.CommentID = Commons.shortGuid();
3210 684ef11c ljiyeon
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3211
                                        currentControl.IsNew = true;
3212
3213
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3214
3215
                                        currentControl.SetValue(Canvas.ZIndexProperty, 3);
3216
                                    }
3217
                                }
3218
                            }
3219
                        }
3220
                        break;
3221 233ef333 taeseongkim
3222 684ef11c ljiyeon
                    case ControlType.InsideWhite:
3223
                        {
3224 e6a9ddaf humkyung
                            if (e.LeftButton == MouseButtonState.Pressed)
3225 684ef11c ljiyeon
                            {
3226
                                if (currentControl is InsideWhiteControl)
3227
                                {
3228
                                    if (IsGetoutpoint((currentControl as InsideWhiteControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3229
                                    {
3230
                                        return;
3231
                                    }
3232
3233 f513c215 humkyung
                                    CreateCommand.Instance.Execute(currentControl);
3234 684ef11c ljiyeon
3235
                                    currentControl = null;
3236
                                    this.cursor = Cursors.Arrow;
3237
                                }
3238
                                else
3239
                                {
3240
                                    currentControl = new InsideWhiteControl
3241
                                    {
3242
                                        Background = new SolidColorBrush(Colors.Black),
3243 c7fde400 taeseongkim
                                        StartPoint = this.CanvasDrawingMouseDownPoint,
3244 684ef11c ljiyeon
                                        ControlType = ControlType.InsideWhite
3245
                                    };
3246
3247 24678e06 humkyung
                                    currentControl.CommentID = Commons.shortGuid();
3248 684ef11c ljiyeon
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3249
                                    currentControl.IsNew = true;
3250
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3251
3252
                                    currentControl.SetValue(Canvas.ZIndexProperty, 3);
3253
                                }
3254
                            }
3255
                        }
3256
                        break;
3257 233ef333 taeseongkim
3258 684ef11c ljiyeon
                    case ControlType.OverlapWhite:
3259
                        {
3260 e6a9ddaf humkyung
                            if (e.LeftButton == MouseButtonState.Pressed)
3261 684ef11c ljiyeon
                            {
3262
                                if (currentControl is OverlapWhiteControl)
3263
                                {
3264
                                    if (IsGetoutpoint((currentControl as OverlapWhiteControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3265
                                    {
3266
                                        return;
3267
                                    }
3268
3269 f513c215 humkyung
                                    CreateCommand.Instance.Execute(currentControl);
3270 684ef11c ljiyeon
3271
                                    currentControl = null;
3272
                                    this.cursor = Cursors.Arrow;
3273
                                }
3274
                                else
3275
                                {
3276
                                    currentControl = new OverlapWhiteControl
3277
                                    {
3278
                                        Background = new SolidColorBrush(Colors.Black),
3279 c7fde400 taeseongkim
                                        StartPoint = this.CanvasDrawingMouseDownPoint,
3280 684ef11c ljiyeon
                                        ControlType = ControlType.OverlapWhite
3281
                                    };
3282
3283 24678e06 humkyung
                                    currentControl.CommentID = Commons.shortGuid();
3284 684ef11c ljiyeon
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3285
                                    currentControl.IsNew = true;
3286
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3287
3288
                                    currentControl.SetValue(Canvas.ZIndexProperty, 3);
3289
                                }
3290
                            }
3291
                        }
3292
                        break;
3293 233ef333 taeseongkim
3294 684ef11c ljiyeon
                    case ControlType.ClipWhite:
3295
                        {
3296 e6a9ddaf humkyung
                            if (e.LeftButton == MouseButtonState.Pressed)
3297 684ef11c ljiyeon
                            {
3298
                                if (currentControl is ClipWhiteControl)
3299
                                {
3300
                                    if (IsGetoutpoint((currentControl as ClipWhiteControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3301
                                    {
3302
                                        return;
3303
                                    }
3304
3305 f513c215 humkyung
                                    CreateCommand.Instance.Execute(currentControl);
3306 684ef11c ljiyeon
3307
                                    currentControl = null;
3308
                                    this.cursor = Cursors.Arrow;
3309
                                }
3310
                                else
3311
                                {
3312
                                    currentControl = new ClipWhiteControl
3313
                                    {
3314
                                        Background = new SolidColorBrush(Colors.Black),
3315 c7fde400 taeseongkim
                                        StartPoint = this.CanvasDrawingMouseDownPoint,
3316 684ef11c ljiyeon
                                        ControlType = ControlType.ClipWhite
3317
                                    };
3318
3319 24678e06 humkyung
                                    currentControl.CommentID = Commons.shortGuid();
3320 684ef11c ljiyeon
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3321
                                    currentControl.IsNew = true;
3322
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3323
3324
                                    currentControl.SetValue(Canvas.ZIndexProperty, 3);
3325
                                }
3326
                            }
3327
                        }
3328
                        break;
3329 233ef333 taeseongkim
3330 787a4489 KangIngu
                    case ControlType.Rectangle:
3331
                        {
3332 e6a9ddaf humkyung
                            if (e.LeftButton == MouseButtonState.Pressed)
3333 787a4489 KangIngu
                            {
3334 f67f164e humkyung
                                if (currentControl is RectangleControl)
3335
                                {
3336
                                    //20180906 LJY TEST IsRotationDrawingEnable
3337
                                    if (IsGetoutpoint((currentControl as RectangleControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3338 787a4489 KangIngu
                                    {
3339 f67f164e humkyung
                                        return;
3340
                                    }
3341 787a4489 KangIngu
3342 f67f164e humkyung
                                    CreateCommand.Instance.Execute(currentControl);
3343
                                    currentControl = null;
3344 902faaea taeseongkim
                                    this.cursor = new Cursor(App.DefaultArrowCursorStream);
3345 f67f164e humkyung
                                }
3346
                                else
3347
                                {
3348
                                    currentControl = new RectangleControl
3349 787a4489 KangIngu
                                    {
3350 f67f164e humkyung
                                        Background = new SolidColorBrush(Colors.Black),
3351 c7fde400 taeseongkim
                                        StartPoint = this.CanvasDrawingMouseDownPoint,
3352 f67f164e humkyung
                                        ControlType = ControlType.Rectangle
3353
                                    };
3354 787a4489 KangIngu
3355 f67f164e humkyung
                                    currentControl.CommentID = Commons.shortGuid();
3356
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3357
                                    currentControl.IsNew = true;
3358
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3359 787a4489 KangIngu
3360 f67f164e humkyung
                                    currentControl.SetValue(Canvas.ZIndexProperty, 3);
3361
                                }
3362 787a4489 KangIngu
                            }
3363
                        }
3364
                        break;
3365 233ef333 taeseongkim
3366 787a4489 KangIngu
                    case ControlType.RectCloud:
3367
                        {
3368 e6a9ddaf humkyung
                            if (e.LeftButton == MouseButtonState.Pressed)
3369 787a4489 KangIngu
                            {
3370 f67f164e humkyung
                                if (currentControl is RectCloudControl)
3371
                                {
3372
                                    //20180906 LJY TEST IsRotationDrawingEnable
3373
                                    if (IsGetoutpoint((currentControl as RectCloudControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3374 787a4489 KangIngu
                                    {
3375 f67f164e humkyung
                                        return;
3376
                                    }
3377 e66f22eb KangIngu
3378 f67f164e humkyung
                                    CreateCommand.Instance.Execute(currentControl);
3379 787a4489 KangIngu
3380 f67f164e humkyung
                                    currentControl = null;
3381 233ef333 taeseongkim
3382 902faaea taeseongkim
                                    this.cursor = new Cursor(App.DefaultArrowCursorStream);
3383 f67f164e humkyung
                                }
3384
                                else
3385
                                {
3386
                                    currentControl = new RectCloudControl
3387 787a4489 KangIngu
                                    {
3388 c7fde400 taeseongkim
                                        StartPoint = this.CanvasDrawingMouseDownPoint,
3389 f67f164e humkyung
                                        ControlType = ControlType.RectCloud,
3390
                                        Background = new SolidColorBrush(Colors.Black)
3391
                                    };
3392 787a4489 KangIngu
3393 f67f164e humkyung
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3394
                                    currentControl.CommentID = Commons.shortGuid();
3395
                                    currentControl.IsNew = true;
3396
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3397
                                }
3398 787a4489 KangIngu
                            }
3399
                        }
3400
                        break;
3401 233ef333 taeseongkim
3402 787a4489 KangIngu
                    case ControlType.Circle:
3403
                        {
3404 e6a9ddaf humkyung
                            if (e.LeftButton == MouseButtonState.Pressed)
3405 787a4489 KangIngu
                            {
3406 f67f164e humkyung
                                if (currentControl is CircleControl)
3407
                                {
3408
                                    //20180906 LJY TEST IsRotationDrawingEnable
3409
                                    if (IsGetoutpoint((currentControl as CircleControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3410 787a4489 KangIngu
                                    {
3411 f67f164e humkyung
                                        return;
3412
                                    }
3413 e66f22eb KangIngu
3414 f67f164e humkyung
                                    CreateCommand.Instance.Execute(currentControl);
3415 787a4489 KangIngu
3416 f67f164e humkyung
                                    currentControl = null;
3417
                                }
3418
                                else
3419
                                {
3420
                                    currentControl = new CircleControl
3421 787a4489 KangIngu
                                    {
3422 c7fde400 taeseongkim
                                        StartPoint = this.CanvasDrawingMouseDownPoint,
3423
                                        LeftBottomPoint = this.CanvasDrawingMouseDownPoint,
3424 f67f164e humkyung
                                        Background = new SolidColorBrush(Colors.Black)
3425
                                    };
3426 787a4489 KangIngu
3427 f67f164e humkyung
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3428
                                    currentControl.CommentID = Commons.shortGuid();
3429
                                    currentControl.IsNew = true;
3430
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3431
                                }
3432 787a4489 KangIngu
                            }
3433
                        }
3434
                        break;
3435 233ef333 taeseongkim
3436 787a4489 KangIngu
                    case ControlType.Triangle:
3437
                        {
3438 e6a9ddaf humkyung
                            if (e.LeftButton == MouseButtonState.Pressed)
3439 787a4489 KangIngu
                            {
3440 f67f164e humkyung
                                if (currentControl is TriControl)
3441
                                {
3442
                                    var content = currentControl as TriControl;
3443
                                    if (content.MidPoint == new Point(0, 0))
3444 787a4489 KangIngu
                                    {
3445 c7fde400 taeseongkim
                                        content.MidPoint = new Point(CanvasDrawingMouseDownPoint.X, CanvasDrawingMouseDownPoint.Y);
3446 787a4489 KangIngu
                                    }
3447
                                    else
3448
                                    {
3449 ca40e004 ljiyeon
                                        //20180906 LJY TEST IsRotationDrawingEnable
3450 f67f164e humkyung
                                        if (IsGetoutpoint((currentControl as TriControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3451 e66f22eb KangIngu
                                        {
3452
                                            return;
3453
                                        }
3454
3455 f513c215 humkyung
                                        CreateCommand.Instance.Execute(currentControl);
3456 787a4489 KangIngu
3457
                                        currentControl = null;
3458
                                    }
3459 f67f164e humkyung
                                }
3460
                                else
3461
                                {
3462
                                    currentControl = new TriControl
3463 787a4489 KangIngu
                                    {
3464 1a7a7e62 이지연
                                        StartPoint = new Point(CanvasDrawingMouseDownPoint.X, CanvasDrawingMouseDownPoint.Y),
3465 f67f164e humkyung
                                        Background = new SolidColorBrush(Colors.Black),
3466
                                    };
3467 787a4489 KangIngu
3468 f67f164e humkyung
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3469
                                    currentControl.CommentID = Commons.shortGuid();
3470
                                    currentControl.IsNew = true;
3471
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3472
                                }
3473 787a4489 KangIngu
                            }
3474
                        }
3475
                        break;
3476
                    case ControlType.CancelLine:
3477 f67f164e humkyung
                    case ControlType.SingleLine:
3478
                    case ControlType.ArrowLine:
3479
                    case ControlType.TwinLine:
3480
                    case ControlType.DimLine:
3481 787a4489 KangIngu
                        {
3482 e6a9ddaf humkyung
                            if (e.LeftButton == MouseButtonState.Pressed)
3483 787a4489 KangIngu
                            {
3484 f67f164e humkyung
                                if (currentControl is LineControl)
3485
                                {
3486
                                    //20180906 LJY TEST IsRotationDrawingEnable
3487
                                    if (IsGetoutpoint((currentControl as LineControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3488 787a4489 KangIngu
                                    {
3489 f67f164e humkyung
                                        return;
3490 787a4489 KangIngu
                                    }
3491 f67f164e humkyung
3492
                                    CreateCommand.Instance.Execute(currentControl);
3493
                                    currentControl = null;
3494 b643fcca taeseongkim
                                    ViewerDataModel.Instance.SetAngleVisible(Visibility.Collapsed);
3495 f67f164e humkyung
                                }
3496
                                else
3497
                                {
3498
                                    currentControl = new LineControl
3499 787a4489 KangIngu
                                    {
3500 f67f164e humkyung
                                        ControlType = this.controlType,
3501 c7fde400 taeseongkim
                                        StartPoint = new Point(CanvasDrawingMouseDownPoint.X, CanvasDrawingMouseDownPoint.Y),
3502 f67f164e humkyung
                                        Background = new SolidColorBrush(Colors.Black)
3503
                                    };
3504 787a4489 KangIngu
3505 f67f164e humkyung
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3506
                                    currentControl.CommentID = Commons.shortGuid();
3507
                                    currentControl.IsNew = true;
3508
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3509 b643fcca taeseongkim
                                    ViewerDataModel.Instance.SetAngleVisible(Visibility.Visible);
3510 f67f164e humkyung
                                }
3511 787a4489 KangIngu
                            }
3512
                        }
3513
                        break;
3514 f67f164e humkyung
                    case ControlType.PolygonControl:
3515 787a4489 KangIngu
                        {
3516 f67f164e humkyung
                            if (currentControl is PolygonControl)
3517 787a4489 KangIngu
                            {
3518 f67f164e humkyung
                                var control = currentControl as PolygonControl;
3519 e66f22eb KangIngu
3520 f67f164e humkyung
                                if (e.RightButton == MouseButtonState.Pressed)
3521
                                {
3522
                                    control.IsCompleted = true;
3523
                                }
3524 787a4489 KangIngu
3525 f67f164e humkyung
                                if (!control.IsCompleted)
3526
                                {
3527
                                    control.PointSet.Add(control.EndPoint);
3528
                                }
3529
                                else
3530
                                {
3531
                                    //20180906 LJY TEST IsRotationDrawingEnable
3532
                                    if (IsGetoutpoint((currentControl as PolygonControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3533 787a4489 KangIngu
                                    {
3534 f67f164e humkyung
                                        return;
3535 787a4489 KangIngu
                                    }
3536 e66f22eb KangIngu
3537 f67f164e humkyung
                                    var firstPoint = control.PointSet.First();
3538
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
3539
                                    control.LineSize = ViewerDataModel.Instance.LineSize;
3540
                                    control.PointSet.Add(firstPoint);
3541 787a4489 KangIngu
3542 f67f164e humkyung
                                    control.ApplyOverViewData();
3543
3544
                                    CreateCommand.Instance.Execute(currentControl);
3545 0d00f9c8 humkyung
                                    control.UpdateControl();
3546 f67f164e humkyung
                                    currentControl = null;
3547
                                }
3548 787a4489 KangIngu
                            }
3549 f67f164e humkyung
                            else
3550 787a4489 KangIngu
                            {
3551 f67f164e humkyung
                                if (e.LeftButton == MouseButtonState.Pressed)
3552
                                {
3553
                                    currentControl = new PolygonControl
3554 787a4489 KangIngu
                                    {
3555 f67f164e humkyung
                                        PointSet = new List<Point>(),
3556
                                    };
3557 787a4489 KangIngu
3558 f67f164e humkyung
                                    var polygonControl = (currentControl as PolygonControl);
3559
                                    currentControl.CommentID = Commons.shortGuid();
3560
                                    currentControl.IsNew = true;
3561
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3562 c7fde400 taeseongkim
                                    polygonControl.StartPoint = CanvasDrawingMouseDownPoint;
3563
                                    polygonControl.EndPoint = CanvasDrawingMouseDownPoint;
3564
                                    polygonControl.PointSet.Add(CanvasDrawingMouseDownPoint);
3565
                                    polygonControl.PointSet.Add(CanvasDrawingMouseDownPoint);
3566 f67f164e humkyung
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3567
                                    polygonControl.ApplyTemplate();
3568
                                    polygonControl.Visibility = Visibility.Visible;
3569
                                }
3570 787a4489 KangIngu
                            }
3571
                        }
3572
                        break;
3573
                    case ControlType.ChainLine:
3574
                        {
3575
                            if (currentControl is PolygonControl)
3576
                            {
3577
                                var control = currentControl as PolygonControl;
3578
3579 e6a9ddaf humkyung
                                if (e.RightButton == MouseButtonState.Pressed)
3580 787a4489 KangIngu
                                {
3581 ca40e004 ljiyeon
                                    //20180906 LJY TEST IsRotationDrawingEnable
3582
                                    if (IsGetoutpoint((currentControl as PolygonControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3583 e66f22eb KangIngu
                                    {
3584
                                        return;
3585
                                    }
3586
3587 f513c215 humkyung
                                    CreateCommand.Instance.Execute(currentControl);
3588 787a4489 KangIngu
3589
                                    currentControl = null;
3590 b643fcca taeseongkim
                                    ViewerDataModel.Instance.SetAngleVisible(Visibility.Collapsed);
3591 787a4489 KangIngu
                                    return;
3592
                                }
3593
3594
                                if (!control.IsCompleted)
3595
                                {
3596
                                    control.PointSet.Add(control.EndPoint);
3597 b643fcca taeseongkim
                                    ViewerDataModel.Instance.SetAngleVisible(Visibility.Visible);
3598 787a4489 KangIngu
                                }
3599
                            }
3600
                            else
3601
                            {
3602 e6a9ddaf humkyung
                                if (e.LeftButton == MouseButtonState.Pressed)
3603 787a4489 KangIngu
                                {
3604 2eac4f76 KangIngu
                                    MainAngle.Visibility = Visibility.Visible;
3605 787a4489 KangIngu
                                    currentControl = new PolygonControl
3606
                                    {
3607
                                        PointSet = new List<Point>(),
3608
                                        //강인구 추가(ChainLine일때는 채우기 스타일을 주지 않기 위해 설정)
3609
                                        ControlType = ControlType.ChainLine,
3610
                                        DashSize = ViewerDataModel.Instance.DashSize,
3611
                                        LineSize = ViewerDataModel.Instance.LineSize,
3612
                                        //PointC = new StylusPointSet()
3613
                                    };
3614
3615 e66f22eb KangIngu
                                    //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3616
                                    //{
3617 233ef333 taeseongkim
                                    var polygonControl = (currentControl as PolygonControl);
3618
                                    currentControl.CommentID = Commons.shortGuid();
3619
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3620
                                    currentControl.IsNew = true;
3621
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3622
                                    //currentControl.OnApplyTemplate();
3623
                                    //polygonControl.PointC.pointSet.Add(canvasDrawingMouseDownPoint);
3624
                                    //polygonControl.PointC.pointSet.Add(canvasDrawingMouseDownPoint);
3625
                                    polygonControl.PointSet.Add(CanvasDrawingMouseDownPoint);
3626
                                    polygonControl.PointSet.Add(CanvasDrawingMouseDownPoint);
3627 e66f22eb KangIngu
                                    //}
3628 787a4489 KangIngu
                                }
3629
                            }
3630
                        }
3631
                        break;
3632
                    case ControlType.ArcLine:
3633
                        {
3634 e6a9ddaf humkyung
                            if (e.LeftButton == MouseButtonState.Pressed)
3635 787a4489 KangIngu
                            {
3636 f67f164e humkyung
                                if (currentControl is ArcControl)
3637
                                {
3638
                                    //20180906 LJY TEST IsRotationDrawingEnable
3639
                                    if (IsGetoutpoint((currentControl as ArcControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3640 787a4489 KangIngu
                                    {
3641 f67f164e humkyung
                                        return;
3642
                                    }
3643 e66f22eb KangIngu
3644 f67f164e humkyung
                                    CreateCommand.Instance.Execute(currentControl);
3645 787a4489 KangIngu
3646 f67f164e humkyung
                                    currentControl = null;
3647 b643fcca taeseongkim
                                    ViewerDataModel.Instance.SetAngleVisible(Visibility.Collapsed);
3648 f67f164e humkyung
                                }
3649
                                else
3650
                                {
3651
                                    currentControl = new ArcControl
3652 787a4489 KangIngu
                                    {
3653 c7fde400 taeseongkim
                                        StartPoint = new Point(CanvasDrawingMouseDownPoint.X, CanvasDrawingMouseDownPoint.Y),
3654 f67f164e humkyung
                                        Background = new SolidColorBrush(Colors.Black)
3655
                                    };
3656
                                    currentControl.CommentID = Commons.shortGuid();
3657
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3658
                                    currentControl.IsNew = true;
3659
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3660 b643fcca taeseongkim
                                    ViewerDataModel.Instance.SetAngleVisible(Visibility.Visible);
3661 f67f164e humkyung
                                }
3662 787a4489 KangIngu
                            }
3663 e6a9ddaf humkyung
                            else if (e.RightButton == MouseButtonState.Pressed)
3664 787a4489 KangIngu
                            {
3665
                                if (currentControl != null)
3666
                                {
3667
                                    (currentControl as ArcControl).setClock();
3668 05f4d127 KangIngu
                                    (currentControl as ArcControl).MidPoint = new Point(0, 0);
3669 787a4489 KangIngu
                                }
3670
                            }
3671
                        }
3672
                        break;
3673
                    case ControlType.ArcArrow:
3674
                        {
3675 e6a9ddaf humkyung
                            if (e.LeftButton == MouseButtonState.Pressed)
3676 787a4489 KangIngu
                            {
3677 e66f22eb KangIngu
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3678
                                //{
3679 40b3ce25 ljiyeon
                                if (currentControl is ArrowArcControl)
3680
                                {
3681
                                    //20180906 LJY TEST IsRotationDrawingEnable
3682
                                    if (IsGetoutpoint((currentControl as ArrowArcControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3683 787a4489 KangIngu
                                    {
3684 40b3ce25 ljiyeon
                                        return;
3685
                                    }
3686 e66f22eb KangIngu
3687 f513c215 humkyung
                                    CreateCommand.Instance.Execute(currentControl);
3688 787a4489 KangIngu
3689 40b3ce25 ljiyeon
                                    currentControl = null;
3690 b643fcca taeseongkim
                                    ViewerDataModel.Instance.SetAngleVisible(Visibility.Collapsed);
3691 40b3ce25 ljiyeon
                                }
3692
                                else
3693
                                {
3694
                                    currentControl = new ArrowArcControl
3695 787a4489 KangIngu
                                    {
3696 c7fde400 taeseongkim
                                        StartPoint = new Point(CanvasDrawingMouseDownPoint.X, CanvasDrawingMouseDownPoint.Y),
3697 40b3ce25 ljiyeon
                                        Background = new SolidColorBrush(Colors.Black)
3698
                                    };
3699 24678e06 humkyung
                                    currentControl.CommentID = Commons.shortGuid();
3700 40b3ce25 ljiyeon
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3701
                                    currentControl.IsNew = true;
3702
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3703 b643fcca taeseongkim
                                    ViewerDataModel.Instance.SetAngleVisible(Visibility.Visible);
3704 40b3ce25 ljiyeon
                                }
3705 e66f22eb KangIngu
                                //}
3706 787a4489 KangIngu
                            }
3707 e6a9ddaf humkyung
                            else if (e.RightButton == MouseButtonState.Pressed)
3708 787a4489 KangIngu
                            {
3709 40b3ce25 ljiyeon
                                if (currentControl != null)
3710
                                {
3711
                                    (currentControl as ArrowArcControl).setClock();
3712 24c5e56c taeseongkim
                                    (currentControl as ArrowArcControl).MiddlePoint = new Point(0, 0);
3713 40b3ce25 ljiyeon
                                    //(currentControl as ArcControl).ApplyTemplate();
3714
                                }
3715 787a4489 KangIngu
                            }
3716
                        }
3717
                        break;
3718
                    case ControlType.ArrowMultiLine:
3719
                        {
3720 e6a9ddaf humkyung
                            if (e.LeftButton == MouseButtonState.Pressed)
3721 787a4489 KangIngu
                            {
3722 e66f22eb KangIngu
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3723
                                //{
3724 233ef333 taeseongkim
                                if (currentControl is ArrowControl_Multi)
3725
                                {
3726
                                    var content = currentControl as ArrowControl_Multi;
3727
                                    if (content.MiddlePoint == new Point(0, 0))
3728 787a4489 KangIngu
                                    {
3729 233ef333 taeseongkim
                                        if (ViewerDataModel.Instance.IsAxisLock || ViewerDataModel.Instance.IsPressShift)
3730 787a4489 KangIngu
                                        {
3731 233ef333 taeseongkim
                                            content.MiddlePoint = content.EndPoint;
3732 787a4489 KangIngu
                                        }
3733
                                        else
3734
                                        {
3735 233ef333 taeseongkim
                                            content.MiddlePoint = new Point(CanvasDrawingMouseDownPoint.X, CanvasDrawingMouseDownPoint.Y);
3736 787a4489 KangIngu
                                        }
3737
                                    }
3738
                                    else
3739
                                    {
3740 233ef333 taeseongkim
                                        //20180906 LJY TEST IsRotationDrawingEnable
3741
                                        if (IsGetoutpoint((currentControl as ArrowControl_Multi).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3742 787a4489 KangIngu
                                        {
3743 233ef333 taeseongkim
                                            return;
3744
                                        }
3745
3746
                                        CreateCommand.Instance.Execute(currentControl);
3747
3748
                                        currentControl = null;
3749
                                        ViewerDataModel.Instance.SetAngleVisible(Visibility.Collapsed);
3750 787a4489 KangIngu
                                    }
3751 233ef333 taeseongkim
                                }
3752
                                else
3753
                                {
3754
                                    currentControl = new ArrowControl_Multi
3755
                                    {
3756
                                        StartPoint = new Point(CanvasDrawingMouseDownPoint.X, CanvasDrawingMouseDownPoint.Y),
3757
                                        Background = new SolidColorBrush(Colors.Black)
3758
                                    };
3759
                                    currentControl.CommentID = Commons.shortGuid();
3760
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3761
                                    currentControl.IsNew = true;
3762
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3763
                                    ViewerDataModel.Instance.SetAngleVisible(Visibility.Visible);
3764
                                }
3765 e66f22eb KangIngu
                                //}
3766 787a4489 KangIngu
                            }
3767
                        }
3768
                        break;
3769
                    case ControlType.PolygonCloud:
3770
                        {
3771
                            if (currentControl is CloudControl)
3772
                            {
3773
                                var control = currentControl as CloudControl;
3774 e6a9ddaf humkyung
                                if (e.RightButton == MouseButtonState.Pressed)
3775 787a4489 KangIngu
                                {
3776
                                    control.IsCompleted = true;
3777
                                }
3778
3779
                                if (!control.IsCompleted)
3780
                                {
3781
                                    control.PointSet.Add(control.EndPoint);
3782
                                }
3783
                                else
3784
                                {
3785 ca40e004 ljiyeon
                                    //20180906 LJY TEST IsRotationDrawingEnable
3786
                                    if (IsGetoutpoint((currentControl as CloudControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3787 e66f22eb KangIngu
                                    {
3788
                                        return;
3789
                                    }
3790
3791 f513c215 humkyung
                                    CreateCommand.Instance.Execute(currentControl);
3792 787a4489 KangIngu
3793
                                    control.isTransOn = true;
3794
                                    var firstPoint = control.PointSet.First();
3795
3796
                                    control.PointSet.Add(firstPoint);
3797
                                    control.DrawingCloud();
3798
                                    control.ApplyOverViewData();
3799
3800
                                    currentControl = null;
3801
                                }
3802
                            }
3803
                            else
3804
                            {
3805 e6a9ddaf humkyung
                                if (e.LeftButton == MouseButtonState.Pressed)
3806 787a4489 KangIngu
                                {
3807
                                    currentControl = new CloudControl
3808
                                    {
3809
                                        PointSet = new List<Point>(),
3810
                                        PointC = new StylusPointSet()
3811
                                    };
3812
3813 e66f22eb KangIngu
                                    //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3814
                                    //{
3815 233ef333 taeseongkim
                                    var polygonControl = (currentControl as CloudControl);
3816
                                    currentControl.CommentID = Commons.shortGuid();
3817
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3818
                                    currentControl.IsNew = true;
3819
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3820
3821
                                    polygonControl.PointSet.Add(CanvasDrawingMouseDownPoint);
3822
                                    polygonControl.PointSet.Add(CanvasDrawingMouseDownPoint);
3823 787a4489 KangIngu
3824 e66f22eb KangIngu
                                    //}
3825 787a4489 KangIngu
                                }
3826
                            }
3827
                        }
3828
                        break;
3829 233ef333 taeseongkim
3830 787a4489 KangIngu
                    case ControlType.ImgControl:
3831
                        {
3832 e6a9ddaf humkyung
                            if (e.LeftButton == MouseButtonState.Pressed)
3833 787a4489 KangIngu
                            {
3834 233ef333 taeseongkim
                                if (currentControl is ImgControl)
3835
                                {
3836
                                    //20180906 LJY TEST IsRotationDrawingEnable
3837 e31e5b1b humkyung
                                    if (IsGetoutpoint((currentControl as ImgControl).PointSet.Find(data => IsRotationDrawingEnable(data))))
3838 787a4489 KangIngu
                                    {
3839 233ef333 taeseongkim
                                        return;
3840 787a4489 KangIngu
                                    }
3841 233ef333 taeseongkim
3842
                                    CreateCommand.Instance.Execute(currentControl);
3843
                                    controlType = ControlType.ImgControl;
3844
                                    currentControl = null;
3845
                                }
3846
                                else
3847
                                {
3848
                                    string extension = System.IO.Path.GetExtension(filename).ToUpper();
3849
                                    if (extension == ".PNG" || extension == ".JPEG" || extension == ".GIF" || extension == ".BMP" || extension == ".JPG" || extension == ".SVG")
3850 787a4489 KangIngu
                                    {
3851 b42dd24d taeseongkim
                                        UriBuilder downloadUri = new UriBuilder(App.BaseAddress);
3852
                                        UriBuilder uri = new UriBuilder(filename);
3853
                                        uri.Host = downloadUri.Host;
3854
                                        uri.Port = downloadUri.Port;
3855
3856 233ef333 taeseongkim
                                        Image img = new Image();
3857
                                        if (filename.Contains(".svg"))
3858 787a4489 KangIngu
                                        {
3859 f1f822e9 taeseongkim
                                            SharpVectors.Converters.SvgImageExtension svgImage = new SharpVectors.Converters.SvgImageExtension(uri.Uri.ToString());
3860
                                            img.Source = (DrawingImage)svgImage.ProvideValue(null);
3861 233ef333 taeseongkim
                                        }
3862
                                        else
3863
                                        {
3864 b42dd24d taeseongkim
                                            img.Source = new BitmapImage(uri.Uri);
3865 233ef333 taeseongkim
                                        }
3866 787a4489 KangIngu
3867 233ef333 taeseongkim
                                        currentControl = new ImgControl
3868
                                        {
3869
                                            Background = new SolidColorBrush(Colors.Black),
3870
                                            PointSet = new List<Point>(),
3871 b42dd24d taeseongkim
                                            FilePath = uri.Uri.ToString(),
3872 233ef333 taeseongkim
                                            ImageData = img.Source,
3873
                                            StartPoint = CanvasDrawingMouseDownPoint,
3874
                                            EndPoint = new Point(CanvasDrawingMouseDownPoint.X + 100, CanvasDrawingMouseDownPoint.Y + 100),
3875
                                            TopRightPoint = new Point(CanvasDrawingMouseDownPoint.X, CanvasDrawingMouseDownPoint.Y + 100),
3876
                                            LeftBottomPoint = new Point(CanvasDrawingMouseDownPoint.X + 100, CanvasDrawingMouseDownPoint.Y),
3877
                                            ControlType = ControlType.ImgControl
3878
                                        };
3879
3880
                                        currentControl.CommentID = Commons.shortGuid();
3881
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3882
                                        currentControl.IsNew = true;
3883
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3884
3885
                                        //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정
3886 fa48eb85 taeseongkim
                                        (currentControl as ImgControl).CommentAngle -= rotate.Angle;
3887
                                    }
3888 233ef333 taeseongkim
                                }
3889 787a4489 KangIngu
                            }
3890
                        }
3891
                        break;
3892 233ef333 taeseongkim
3893 787a4489 KangIngu
                    case ControlType.Date:
3894
                        {
3895 e6a9ddaf humkyung
                            if (e.LeftButton == MouseButtonState.Pressed)
3896 787a4489 KangIngu
                            {
3897 e66f22eb KangIngu
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3898
                                //{
3899 6b6e937c taeseongkim
                                if (currentControl is DateControl)
3900
                                {
3901
                                    //20180906 LJY TEST IsRotationDrawingEnable
3902
                                    if (IsGetoutpoint((currentControl as DateControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3903 787a4489 KangIngu
                                    {
3904 6b6e937c taeseongkim
                                        return;
3905
                                    }
3906 e66f22eb KangIngu
3907 6b6e937c taeseongkim
                                    CreateCommand.Instance.Execute(currentControl);
3908
                                    currentControl = null;
3909 787a4489 KangIngu
3910 6b6e937c taeseongkim
                                    if (Common.ViewerDataModel.Instance.SelectedControl == "Batch")
3911 b74a9c91 taeseongkim
                                    { 
3912 6b6e937c taeseongkim
                                        controlType = ControlType.None;
3913
                                        IsSwingMode = false;
3914
                                        Common.ViewerDataModel.Instance.SelectedControl = "";
3915
                                        Common.ViewerDataModel.Instance.ControlTag = null;
3916
                                        mouseHandlingMode = MouseHandlingMode.None;
3917
                                        this.ParentOfType<MainWindow>().dzTopMenu.btn_Batch.IsChecked = false;
3918
                                        txtBatch.Visibility = Visibility.Collapsed;
3919 787a4489 KangIngu
                                    }
3920 6b6e937c taeseongkim
                                }
3921
                                else
3922
                                {
3923
                                    currentControl = new DateControl
3924 787a4489 KangIngu
                                    {
3925 6b6e937c taeseongkim
                                        StartPoint = CanvasDrawingMouseDownPoint,
3926
                                        Background = new SolidColorBrush(Colors.Black)
3927
                                    };
3928
                                    currentControl.CommentID = Commons.shortGuid();
3929
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3930
                                    currentControl.IsNew = true;
3931
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3932 ca40e004 ljiyeon
3933 233ef333 taeseongkim
                                    //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정
3934 6b6e937c taeseongkim
                                    if (currentControl is ImgControl)
3935
                                    {
3936 fa48eb85 taeseongkim
                                        (currentControl as ImgControl).CommentAngle -= rotate.Angle;
3937 6b6e937c taeseongkim
                                    }
3938 ca40e004 ljiyeon
                                }
3939 e66f22eb KangIngu
                                //}
3940 787a4489 KangIngu
                            }
3941
                        }
3942
                        break;
3943 233ef333 taeseongkim
3944 787a4489 KangIngu
                    case ControlType.TextControl:
3945
                        {
3946 e6a9ddaf humkyung
                            if (e.LeftButton == MouseButtonState.Pressed)
3947 787a4489 KangIngu
                            {
3948
                                if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3949
                                {
3950
                                    currentControl = new TextControl
3951
                                    {
3952
                                        ControlType = controlType
3953
                                    };
3954 14963423 swate0609
                                    
3955 24678e06 humkyung
                                    currentControl.CommentID = Commons.shortGuid();
3956 8742caa5 humkyung
                                    currentControl.IsNew = true;
3957
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3958
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3959 1066bae3 ljiyeon
                                    currentControl.SetValue(Canvas.ZIndexProperty, 3);
3960 c7fde400 taeseongkim
                                    currentControl.SetValue(TextControl.CanvasXProperty, CanvasDrawingMouseDownPoint.X);
3961
                                    currentControl.SetValue(TextControl.CanvasYProperty, CanvasDrawingMouseDownPoint.Y);
3962 233ef333 taeseongkim
3963 14963423 swate0609
                                    (currentControl as TextControl).TextSize = ViewerDataModel.Instance.TextSize;
3964
                                    (currentControl as TextControl).IsHighLight = ViewerDataModel.Instance.checkHighShape;
3965 8742caa5 humkyung
                                    (currentControl as TextControl).ControlType_No = 0;
3966 fa48eb85 taeseongkim
                                    (currentControl as TextControl).CommentAngle -= rotate.Angle;
3967 6b5d33c6 djkim
                                    (currentControl as TextControl).ApplyTemplate();
3968
                                    (currentControl as TextControl).Base_TextBox.Focus();
3969 4fcb686a taeseongkim
                                    (currentControl as TextControl).SetFontFamily(this.ParentOfType<MainWindow>().dzTopMenu.GetFontFamily().FontFamily);
3970 9380813b swate0609
3971
                                    if(previousControl == null)
3972
                                    {
3973
                                        previousControl = currentControl as TextControl;
3974
                                    }
3975
                                    else
3976
                                    {
3977
                                        var vPreviousControl = previousControl as TextControl;
3978
                                        if (string.IsNullOrEmpty(vPreviousControl.Text))
3979
                                        {
3980 34ac8db7 humkyung
                                            UndoCommand.Instance.Push(EventType.Delete, new[] { previousControl });
3981 9380813b swate0609
                                            previousControl = null;
3982
                                        }
3983
                                        else
3984
                                        {
3985
                                            previousControl = currentControl as TextControl;
3986
                                        }
3987
                                    }
3988 f513c215 humkyung
                                    CreateCommand.Instance.Execute(currentControl);
3989 9380813b swate0609
                                    if (previousControl == null)
3990
                                        previousControl = currentControl;
3991 787a4489 KangIngu
                                }
3992
                            }
3993
                        }
3994
                        break;
3995 233ef333 taeseongkim
3996 787a4489 KangIngu
                    case ControlType.TextBorder:
3997
                        {
3998 e6a9ddaf humkyung
                            if (e.LeftButton == MouseButtonState.Pressed)
3999 787a4489 KangIngu
                            {
4000
                                if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4001
                                {
4002
                                    currentControl = new TextControl
4003
                                    {
4004
                                        ControlType = controlType
4005
                                    };
4006
4007 610a4b86 KangIngu
                                    (currentControl as TextControl).TextSize = ViewerDataModel.Instance.TextSize;
4008 787a4489 KangIngu
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4009 24678e06 humkyung
                                    currentControl.CommentID = Commons.shortGuid();
4010 787a4489 KangIngu
                                    currentControl.IsNew = true;
4011
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4012
                                    currentControl.SetValue(Canvas.ZIndexProperty, 3);
4013 c7fde400 taeseongkim
                                    currentControl.SetValue(TextControl.CanvasXProperty, CanvasDrawingMouseDownPoint.X);
4014
                                    currentControl.SetValue(TextControl.CanvasYProperty, CanvasDrawingMouseDownPoint.Y);
4015 233ef333 taeseongkim
4016 787a4489 KangIngu
                                    (currentControl as TextControl).ControlType_No = 1;
4017 fa48eb85 taeseongkim
                                    (currentControl as TextControl).CommentAngle = Ang;
4018 787a4489 KangIngu
                                    (currentControl as TextControl).IsHighLight = ViewerDataModel.Instance.checkHighShape;
4019 6b5d33c6 djkim
                                    (currentControl as TextControl).ApplyTemplate();
4020
                                    (currentControl as TextControl).Base_TextBox.Focus();
4021 4fcb686a taeseongkim
                                    (currentControl as TextControl).SetFontFamily(this.ParentOfType<MainWindow>().dzTopMenu.GetFontFamily().FontFamily);
4022 7b031678 swate0609
4023
                                    if (previousControl == null)
4024
                                    {
4025
                                        previousControl = currentControl as TextControl;
4026
                                    }
4027
                                    else
4028
                                    {
4029
                                        var vPreviousControl = previousControl as TextControl;
4030
                                        if (string.IsNullOrEmpty(vPreviousControl.Text))
4031
                                        {
4032 34ac8db7 humkyung
                                            UndoCommand.Instance.Push(EventType.Delete, new[] { previousControl });
4033 7b031678 swate0609
                                            previousControl = null;
4034
                                        }
4035
                                        else
4036
                                        {
4037
                                            previousControl = currentControl as TextControl;
4038
                                        }
4039
                                    }
4040 f513c215 humkyung
                                    CreateCommand.Instance.Execute(currentControl);
4041 7b031678 swate0609
                                    if (previousControl == null)
4042
                                        previousControl = currentControl;
4043 787a4489 KangIngu
                                }
4044
                            }
4045
                        }
4046
                        break;
4047 233ef333 taeseongkim
4048 787a4489 KangIngu
                    case ControlType.TextCloud:
4049
                        {
4050 e6a9ddaf humkyung
                            if (e.LeftButton == MouseButtonState.Pressed)
4051 787a4489 KangIngu
                            {
4052
                                if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4053
                                {
4054
                                    currentControl = new TextControl
4055
                                    {
4056
                                        ControlType = controlType
4057
                                    };
4058 610a4b86 KangIngu
4059
                                    (currentControl as TextControl).TextSize = ViewerDataModel.Instance.TextSize;
4060 24678e06 humkyung
                                    currentControl.CommentID = Commons.shortGuid();
4061 787a4489 KangIngu
                                    currentControl.IsNew = true;
4062
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4063
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4064
4065
                                    currentControl.SetValue(Canvas.ZIndexProperty, 3);
4066 c7fde400 taeseongkim
                                    currentControl.SetValue(TextControl.CanvasXProperty, CanvasDrawingMouseDownPoint.X);
4067
                                    currentControl.SetValue(TextControl.CanvasYProperty, CanvasDrawingMouseDownPoint.Y);
4068 787a4489 KangIngu
4069 fa48eb85 taeseongkim
                                    (currentControl as TextControl).CommentAngle = Ang;
4070 787a4489 KangIngu
                                    (currentControl as TextControl).ControlType_No = 2;
4071
                                    (currentControl as TextControl).IsHighLight = ViewerDataModel.Instance.checkHighShape;
4072 666bb823 이지연
                                    (currentControl as TextControl).ArcLength = ViewerDataModel.Instance.ArcLength;
4073 6b5d33c6 djkim
                                    (currentControl as TextControl).ApplyTemplate();
4074 666bb823 이지연
                                    
4075 4fcb686a taeseongkim
                                    (currentControl as TextControl).SetFontFamily(this.ParentOfType<MainWindow>().dzTopMenu.GetFontFamily().FontFamily);
4076
4077 6b5d33c6 djkim
                                    (currentControl as TextControl).Base_TextBox.Focus();
4078 7b031678 swate0609
                                    if (previousControl == null)
4079
                                    {
4080
                                        previousControl = currentControl as TextControl;
4081
                                    }
4082
                                    else
4083
                                    {
4084
                                        var vPreviousControl = previousControl as TextControl;
4085
                                        if (string.IsNullOrEmpty(vPreviousControl.Text))
4086
                                        {
4087 34ac8db7 humkyung
                                            UndoCommand.Instance.Push(EventType.Delete, new[] { previousControl });
4088 7b031678 swate0609
                                            previousControl = null;
4089
                                        }
4090
                                        else
4091
                                        {
4092
                                            previousControl = currentControl as TextControl;
4093
                                        }
4094
                                    }
4095 f513c215 humkyung
                                    CreateCommand.Instance.Execute(currentControl);
4096 7b031678 swate0609
                                    if (previousControl == null)
4097
                                        previousControl = currentControl;
4098
4099 49b217ad humkyung
                                    //currentControl = null;
4100 787a4489 KangIngu
                                }
4101
                            }
4102
                        }
4103
                        break;
4104 233ef333 taeseongkim
4105 787a4489 KangIngu
                    case ControlType.ArrowTextControl:
4106 233ef333 taeseongkim
                        {
4107 e6a9ddaf humkyung
                            if (e.LeftButton == MouseButtonState.Pressed)
4108 787a4489 KangIngu
                            {
4109
                                if (currentControl is ArrowTextControl)
4110
                                {
4111 ca40e004 ljiyeon
                                    //20180906 LJY TEST IsRotationDrawingEnable
4112
                                    if (IsGetoutpoint((currentControl as ArrowTextControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
4113 e66f22eb KangIngu
                                    {
4114
                                        return;
4115 f513c215 humkyung
                                    }
4116 e66f22eb KangIngu
4117 f513c215 humkyung
                                    CreateCommand.Instance.Execute(currentControl);
4118 1305c420 taeseongkim
4119 b74a9c91 taeseongkim
                                    try
4120
                                    {
4121 1305c420 taeseongkim
                                        if(!(currentControl as ArrowTextControl).IsEditingMode)
4122
                                        {
4123
                                            ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4124
                                        }
4125 b74a9c91 taeseongkim
                                    }
4126
                                    catch (Exception ex)
4127
                                    {
4128
                                        System.Diagnostics.Debug.WriteLine(ex.ToString());
4129
                                    }
4130 7ad417d8 이지연
                                    (currentControl as ArrowTextControl).ArcLength = ViewerDataModel.Instance.ArcLength;
4131 787a4489 KangIngu
                                    (currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false;
4132
                                    (currentControl as ArrowTextControl).EnableEditing = false;
4133 49b217ad humkyung
                                    (currentControl as ArrowTextControl).IsNew = false;
4134 787a4489 KangIngu
                                    currentControl = null;
4135
                                }
4136
                                else
4137
                                {
4138 e66f22eb KangIngu
                                    //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4139
                                    //{
4140 907a99b3 taeseongkim
                                    currentControl = new ArrowTextControl()
4141
                                    {
4142
                                        PageAngle = ViewerDataModel.Instance.PageAngle
4143
                                    };
4144
4145 233ef333 taeseongkim
                                    currentControl.CommentID = Commons.shortGuid();
4146
                                    currentControl.IsNew = true;
4147
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4148 1305c420 taeseongkim
4149
                                    try
4150
                                    {
4151
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4152
                                    }
4153
                                    catch (Exception ex)
4154
                                    {
4155
                                        System.Diagnostics.Debug.WriteLine(ex.ToString());
4156
                                    }
4157 787a4489 KangIngu
4158 233ef333 taeseongkim
                                    currentControl.SetValue(Canvas.ZIndexProperty, 3);
4159
                                    currentControl.SetValue(ArrowTextControl.StartPointProperty, CanvasDrawingMouseDownPoint);
4160
                                    currentControl.SetValue(ArrowTextControl.EndPointProperty, CanvasDrawingMouseDownPoint);
4161
                                    (currentControl as ArrowTextControl).TextSize = ViewerDataModel.Instance.TextSize;
4162
                                    (currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape;
4163 787a4489 KangIngu
4164 233ef333 taeseongkim
                                    //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정
4165 fa48eb85 taeseongkim
                                    (currentControl as ArrowTextControl).CommentAngle -= rotate.Angle;
4166 787a4489 KangIngu
4167 fa48eb85 taeseongkim
                                    (currentControl as ArrowTextControl).ApplyTemplate();
4168 233ef333 taeseongkim
                                    (currentControl as ArrowTextControl).Base_TextBox.Focus();
4169 4fcb686a taeseongkim
                                    (currentControl as ArrowTextControl).SetFontFamily(this.ParentOfType<MainWindow>().dzTopMenu.GetFontFamily().FontFamily);
4170 233ef333 taeseongkim
                                    ViewerDataModel.Instance.SetAngleVisible(Visibility.Visible);
4171 ca40e004 ljiyeon
4172 e66f22eb KangIngu
                                    //}
4173 787a4489 KangIngu
                                }
4174
                            }
4175
                        }
4176
                        break;
4177 233ef333 taeseongkim
4178 787a4489 KangIngu
                    case ControlType.ArrowTransTextControl:
4179
                        {
4180 e6a9ddaf humkyung
                            if (e.LeftButton == MouseButtonState.Pressed)
4181 787a4489 KangIngu
                            {
4182
                                if (currentControl is ArrowTextControl)
4183
                                {
4184 ca40e004 ljiyeon
                                    //20180906 LJY TEST IsRotationDrawingEnable
4185
                                    if (IsGetoutpoint((currentControl as ArrowTextControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
4186 e66f22eb KangIngu
                                    {
4187
                                        return;
4188 f513c215 humkyung
                                    }
4189 e66f22eb KangIngu
4190 f513c215 humkyung
                                    CreateCommand.Instance.Execute(currentControl);
4191 55d4f382 송근호
4192 787a4489 KangIngu
                                    (currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false;
4193 233ef333 taeseongkim
4194 49b217ad humkyung
                                    currentControl.IsNew = false;
4195 787a4489 KangIngu
                                    currentControl = null;
4196 b643fcca taeseongkim
                                    ViewerDataModel.Instance.SetAngleVisible(Visibility.Collapsed);
4197 787a4489 KangIngu
                                }
4198
                                else
4199
                                {
4200 e66f22eb KangIngu
                                    //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4201
                                    //{
4202 120b8b00 송근호
                                    currentControl = new ArrowTextControl()
4203
                                    {
4204 907a99b3 taeseongkim
                                        ControlType = ControlType.ArrowTransTextControl,
4205
                                        PageAngle = ViewerDataModel.Instance.PageAngle
4206 120b8b00 송근호
                                    };
4207
                                    currentControl.CommentID = Commons.shortGuid();
4208
                                    currentControl.IsNew = true;
4209
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4210
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4211
                                    currentControl.SetValue(Canvas.ZIndexProperty, 3);
4212 c7fde400 taeseongkim
                                    currentControl.SetValue(ArrowTextControl.StartPointProperty, CanvasDrawingMouseDownPoint);
4213 233ef333 taeseongkim
                                    currentControl.SetValue(ArrowTextControl.EndPointProperty, CanvasDrawingMouseDownPoint);
4214 120b8b00 송근호
                                    (currentControl as ArrowTextControl).TextSize = ViewerDataModel.Instance.TextSize;
4215
                                    (currentControl as ArrowTextControl).isFixed = true;
4216
                                    (currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape;
4217 787a4489 KangIngu
4218 233ef333 taeseongkim
                                    //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정
4219 fa48eb85 taeseongkim
                                    (currentControl as ArrowTextControl).CommentAngle -= rotate.Angle;
4220 ca40e004 ljiyeon
4221 120b8b00 송근호
                                    (currentControl as ArrowTextControl).ApplyTemplate();
4222
                                    (currentControl as ArrowTextControl).Base_TextBox.Focus();
4223
                                    (currentControl as ArrowTextControl).isTrans = true;
4224 4fcb686a taeseongkim
                                    (currentControl as ArrowTextControl).SetFontFamily(this.ParentOfType<MainWindow>().dzTopMenu.GetFontFamily().FontFamily);
4225 787a4489 KangIngu
                                }
4226
                            }
4227
                        }
4228
                        break;
4229 233ef333 taeseongkim
4230 787a4489 KangIngu
                    case ControlType.ArrowTextBorderControl:
4231 233ef333 taeseongkim
                        {
4232 e6a9ddaf humkyung
                            if (e.LeftButton == MouseButtonState.Pressed)
4233 787a4489 KangIngu
                            {
4234
                                if (currentControl is ArrowTextControl)
4235
                                {
4236 ca40e004 ljiyeon
                                    //20180906 LJY TEST IsRotationDrawingEnable
4237
                                    if (IsGetoutpoint((currentControl as ArrowTextControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
4238 e66f22eb KangIngu
                                    {
4239
                                        return;
4240
                                    }
4241
4242 f513c215 humkyung
                                    CreateCommand.Instance.Execute(currentControl);
4243 787a4489 KangIngu
                                    (currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false;
4244 49b217ad humkyung
                                    currentControl.IsNew = false;
4245 787a4489 KangIngu
                                    currentControl = null;
4246 b643fcca taeseongkim
                                    ViewerDataModel.Instance.SetAngleVisible(Visibility.Collapsed);
4247 787a4489 KangIngu
                                }
4248
                                else
4249
                                {
4250 e66f22eb KangIngu
                                    //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4251
                                    //{
4252 233ef333 taeseongkim
                                    currentControl = new ArrowTextControl()
4253
                                    {
4254 907a99b3 taeseongkim
                                        ArrowTextStyle = MarkupToPDF.Controls.Text.ArrowTextControl.ArrowTextStyleSet.Rect,
4255
                                        PageAngle = ViewerDataModel.Instance.PageAngle
4256 233ef333 taeseongkim
                                    };
4257
                                    currentControl.CommentID = Commons.shortGuid();
4258
                                    currentControl.IsNew = true;
4259
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4260
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4261 787a4489 KangIngu
4262 233ef333 taeseongkim
                                    currentControl.SetValue(Canvas.ZIndexProperty, 3);
4263
4264
                                    currentControl.SetValue(ArrowTextControl.StartPointProperty, CanvasDrawingMouseDownPoint);
4265 787a4489 KangIngu
4266 233ef333 taeseongkim
                                    currentControl.SetValue(ArrowTextControl.EndPointProperty, CanvasDrawingMouseDownPoint);
4267
                                    (currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape;
4268
                                    (currentControl as ArrowTextControl).TextSize = ViewerDataModel.Instance.TextSize;
4269 4fcb686a taeseongkim
                                    (currentControl as ArrowTextControl).SetFontFamily(this.ParentOfType<MainWindow>().dzTopMenu.GetFontFamily().FontFamily);
4270 233ef333 taeseongkim
                                    //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정
4271
                                    (currentControl as ArrowTextControl).CommentAngle -= rotate.Angle;
4272
                                    (currentControl as ArrowTextControl).ApplyTemplate();
4273
                                    (currentControl as ArrowTextControl).Base_TextBox.Focus();
4274
                                    ViewerDataModel.Instance.SetAngleVisible(Visibility.Visible);
4275 e66f22eb KangIngu
                                    //}
4276 787a4489 KangIngu
                                }
4277
                            }
4278
                        }
4279
                        break;
4280 233ef333 taeseongkim
4281 787a4489 KangIngu
                    case ControlType.ArrowTransTextBorderControl:
4282
                        {
4283 e6a9ddaf humkyung
                            if (e.LeftButton == MouseButtonState.Pressed)
4284 787a4489 KangIngu
                            {
4285
                                if (currentControl is ArrowTextControl)
4286
                                {
4287 ca40e004 ljiyeon
                                    //20180906 LJY TEST IsRotationDrawingEnable
4288
                                    if (IsGetoutpoint((currentControl as ArrowTextControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
4289 e66f22eb KangIngu
                                    {
4290
                                        return;
4291
                                    }
4292 f513c215 humkyung
                                    CreateCommand.Instance.Execute(currentControl);
4293 787a4489 KangIngu
                                    (currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false;
4294 49b217ad humkyung
                                    currentControl.IsNew = false;
4295 787a4489 KangIngu
                                    currentControl = null;
4296 55d4f382 송근호
4297 b643fcca taeseongkim
                                    ViewerDataModel.Instance.SetAngleVisible(Visibility.Collapsed);
4298 787a4489 KangIngu
                                }
4299
                                else
4300
                                {
4301 e66f22eb KangIngu
                                    //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4302
                                    //{
4303 ca40e004 ljiyeon
                                    currentControl = new ArrowTextControl()
4304 120b8b00 송근호
                                    {
4305
                                        ArrowTextStyle = MarkupToPDF.Controls.Text.ArrowTextControl.ArrowTextStyleSet.Rect,
4306 4f017ed3 taeseongkim
                                        ControlType = ControlType.ArrowTransTextBorderControl,
4307
                                        PageAngle = ViewerDataModel.Instance.PageAngle
4308 120b8b00 송근호
                                    };
4309 4f017ed3 taeseongkim
                                    
4310 233ef333 taeseongkim
                                    currentControl.CommentID = Commons.shortGuid();
4311
                                    currentControl.IsNew = true;
4312
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4313
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4314 787a4489 KangIngu
4315 233ef333 taeseongkim
                                    currentControl.SetValue(Canvas.ZIndexProperty, 3);
4316
4317
                                    currentControl.SetValue(ArrowTextControl.StartPointProperty, CanvasDrawingMouseDownPoint);
4318
                                    currentControl.SetValue(ArrowTextControl.EndPointProperty, CanvasDrawingMouseDownPoint);
4319
                                    (currentControl as ArrowTextControl).TextSize = ViewerDataModel.Instance.TextSize;
4320
                                    (currentControl as ArrowTextControl).isFixed = true;
4321
                                    (currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape;
4322
4323
                                    //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정
4324
                                    (currentControl as ArrowTextControl).CommentAngle -= rotate.Angle;
4325
                                    (currentControl as ArrowTextControl).ApplyTemplate();
4326 4fcb686a taeseongkim
                                    (currentControl as ArrowTextControl).SetFontFamily(this.ParentOfType<MainWindow>().dzTopMenu.GetFontFamily().FontFamily);
4327 233ef333 taeseongkim
                                    (currentControl as ArrowTextControl).Base_TextBox.Focus();
4328
                                    ViewerDataModel.Instance.SetAngleVisible(Visibility.Visible);
4329 787a4489 KangIngu
4330 ca40e004 ljiyeon
                                    //20180911 LJY
4331 233ef333 taeseongkim
                                    (currentControl as ArrowTextControl).isTrans = true;
4332 ca40e004 ljiyeon
4333 e66f22eb KangIngu
                                    //}
4334 787a4489 KangIngu
                                }
4335
                            }
4336
                        }
4337
                        break;
4338 233ef333 taeseongkim
4339 787a4489 KangIngu
                    case ControlType.ArrowTextCloudControl:
4340
                        {
4341 e6a9ddaf humkyung
                            if (e.LeftButton == MouseButtonState.Pressed)
4342 787a4489 KangIngu
                            {
4343
                                if (currentControl is ArrowTextControl)
4344
                                {
4345 ca40e004 ljiyeon
                                    //20180906 LJY TEST IsRotationDrawingEnable
4346
                                    if (IsGetoutpoint((currentControl as ArrowTextControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
4347 e66f22eb KangIngu
                                    {
4348
                                        return;
4349
                                    }
4350 f513c215 humkyung
                                    CreateCommand.Instance.Execute(currentControl);
4351 787a4489 KangIngu
                                    (currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false;
4352 49b217ad humkyung
                                    currentControl.IsNew = false;
4353 787a4489 KangIngu
                                    currentControl = null;
4354 b643fcca taeseongkim
                                    ViewerDataModel.Instance.SetAngleVisible(Visibility.Collapsed);
4355 787a4489 KangIngu
                                }
4356
                                else
4357
                                {
4358 e66f22eb KangIngu
                                    //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4359
                                    //{
4360 233ef333 taeseongkim
                                    currentControl = new ArrowTextControl()
4361
                                    {
4362 907a99b3 taeseongkim
                                        ArrowTextStyle = MarkupToPDF.Controls.Text.ArrowTextControl.ArrowTextStyleSet.Cloud,
4363 4fcb686a taeseongkim
                                        PageAngle = ViewerDataModel.Instance.PageAngle,
4364
                                        ControlType = ControlType.ArrowTextCloudControl
4365 233ef333 taeseongkim
                                    };
4366
                                    currentControl.CommentID = Commons.shortGuid();
4367
                                    currentControl.IsNew = true;
4368
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4369
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4370 787a4489 KangIngu
4371 233ef333 taeseongkim
                                    currentControl.SetValue(Canvas.ZIndexProperty, 3);
4372
                                    currentControl.SetValue(ArrowTextControl.StartPointProperty, CanvasDrawingMouseDownPoint);
4373
                                    currentControl.SetValue(ArrowTextControl.EndPointProperty, CanvasDrawingMouseDownPoint);
4374
                                    (currentControl as ArrowTextControl).TextSize = ViewerDataModel.Instance.TextSize;
4375
                                    (currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape;
4376 4fcb686a taeseongkim
                                    (currentControl as ArrowTextControl).SetFontFamily((this.ParentOfType<MainWindow>().dzTopMenu.comboFontFamily.SelectedValue as Markus.Fonts.MarkusFont).FontFamily);
4377 233ef333 taeseongkim
                                    //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정
4378
                                    (currentControl as ArrowTextControl).CommentAngle -= rotate.Angle;
4379 7ad417d8 이지연
                                    (currentControl as ArrowTextControl).ArcLength = ViewerDataModel.Instance.ArcLength;
4380 233ef333 taeseongkim
                                    (currentControl as ArrowTextControl).ApplyTemplate();
4381
                                    (currentControl as ArrowTextControl).Base_TextBox.Focus();
4382
                                    ViewerDataModel.Instance.SetAngleVisible(Visibility.Visible);
4383 e66f22eb KangIngu
                                    //}
4384 787a4489 KangIngu
                                }
4385
                            }
4386
                        }
4387
                        break;
4388 233ef333 taeseongkim
4389 787a4489 KangIngu
                    case ControlType.ArrowTransTextCloudControl:
4390
                        {
4391 e6a9ddaf humkyung
                            if (e.LeftButton == MouseButtonState.Pressed)
4392 787a4489 KangIngu
                            {
4393
                                if (currentControl is ArrowTextControl)
4394
                                {
4395 ca40e004 ljiyeon
                                    //20180906 LJY TEST IsRotationDrawingEnable
4396
                                    if (IsGetoutpoint((currentControl as ArrowTextControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
4397 e66f22eb KangIngu
                                    {
4398
                                        return;
4399
                                    }
4400 f513c215 humkyung
                                    CreateCommand.Instance.Execute(currentControl);
4401 787a4489 KangIngu
                                    (currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false;
4402 49b217ad humkyung
                                    currentControl.IsNew = false;
4403 787a4489 KangIngu
                                    currentControl = null;
4404 b643fcca taeseongkim
                                    ViewerDataModel.Instance.SetAngleVisible(Visibility.Collapsed);
4405 787a4489 KangIngu
                                }
4406
                                else
4407
                                {
4408 e66f22eb KangIngu
                                    //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4409
                                    //{
4410 233ef333 taeseongkim
                                    currentControl = new ArrowTextControl()
4411
                                    {
4412
                                        ArrowTextStyle = MarkupToPDF.Controls.Text.ArrowTextControl.ArrowTextStyleSet.Cloud,
4413 907a99b3 taeseongkim
                                        ControlType = ControlType.ArrowTransTextCloudControl,
4414
                                        PageAngle = ViewerDataModel.Instance.PageAngle
4415 233ef333 taeseongkim
                                    };
4416
                                    currentControl.CommentID = Commons.shortGuid();
4417
                                    currentControl.IsNew = true;
4418
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4419
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4420
                                    currentControl.SetValue(Canvas.ZIndexProperty, 3);
4421 120b8b00 송근호
4422 233ef333 taeseongkim
                                    currentControl.SetValue(ArrowTextControl.StartPointProperty, CanvasDrawingMouseDownPoint);
4423
                                    currentControl.SetValue(ArrowTextControl.EndPointProperty, CanvasDrawingMouseDownPoint);
4424
                                    (currentControl as ArrowTextControl).TextSize = ViewerDataModel.Instance.TextSize;
4425
                                    (currentControl as ArrowTextControl).isFixed = true;
4426
                                    (currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape;
4427
4428
                                    //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정
4429
                                    (currentControl as ArrowTextControl).CommentAngle -= rotate.Angle;
4430 7ad417d8 이지연
                                    (currentControl as ArrowTextControl).ArcLength = ViewerDataModel.Instance.ArcLength;
4431 4fcb686a taeseongkim
                                    (currentControl as ArrowTextControl).SetFontFamily(this.ParentOfType<MainWindow>().dzTopMenu.GetFontFamily().FontFamily);
4432 233ef333 taeseongkim
                                    (currentControl as ArrowTextControl).ApplyTemplate();
4433
                                    (currentControl as ArrowTextControl).Base_TextBox.Focus();
4434
                                    ViewerDataModel.Instance.SetAngleVisible(Visibility.Visible);
4435 787a4489 KangIngu
4436 ca40e004 ljiyeon
                                    //20180911 LJY
4437 233ef333 taeseongkim
                                    (currentControl as ArrowTextControl).isTrans = true;
4438 e66f22eb KangIngu
                                    //}
4439 787a4489 KangIngu
                                }
4440
                            }
4441
                        }
4442
                        break;
4443
                    //강인구 추가
4444
                    case ControlType.Sign:
4445
                        {
4446 e6a9ddaf humkyung
                            if (e.LeftButton == MouseButtonState.Pressed)
4447 787a4489 KangIngu
                            {
4448 e66f22eb KangIngu
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4449
                                //{
4450 d7e20d2d taeseongkim
                                var _sign = await BaseTaskClient.GetSignDataAsync(App.ViewInfo.ProjectNO, App.ViewInfo.UserID);
4451 992a98b4 KangIngu
4452 d7e20d2d taeseongkim
                                if (_sign == null)
4453 233ef333 taeseongkim
                                {
4454
                                    txtBatch.Visibility = Visibility.Collapsed;
4455
                                    mouseHandlingMode = IKCOM.MouseHandlingMode.None;
4456
                                    controlType = ControlType.None;
4457
4458
                                    this.ParentOfType<MainWindow>().DialogMessage_Alert("등록된 Sign이 없습니다.", "Alert");
4459
                                    this.ParentOfType<MainWindow>().ChildrenOfType<RadToggleButton>().Where(data => data.IsChecked == true).FirstOrDefault().IsChecked = false;
4460
                                    return;
4461
                                }
4462 74abcf6f taeseongkim
                                else
4463
                                {
4464
                                    if ( Application.Current.Resources.Keys.OfType<string>().Count(x => x == "UserSign") == 0)
4465
                                    {
4466
                                        Application.Current.Resources.Add("UserSign", _sign);
4467
                                    }
4468
                                    else
4469
                                    {
4470
                                        Application.Current.Resources["UserSign"] = _sign;
4471
                                    }
4472
                                }
4473 992a98b4 KangIngu
4474 233ef333 taeseongkim
                                if (currentControl is SignControl)
4475
                                {
4476
                                    //20180906 LJY TEST IsRotationDrawingEnable
4477
                                    if (IsGetoutpoint((currentControl as SignControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
4478
                                    {
4479 992a98b4 KangIngu
                                        return;
4480
                                    }
4481
4482 233ef333 taeseongkim
                                    CreateCommand.Instance.Execute(currentControl);
4483
                                    currentControl = null;
4484
                                    if (Common.ViewerDataModel.Instance.SelectedControl == "Batch")
4485 787a4489 KangIngu
                                    {
4486 233ef333 taeseongkim
                                        txtBatch.Text = "Place Date";
4487
                                        controlType = ControlType.Date;
4488 787a4489 KangIngu
                                    }
4489 233ef333 taeseongkim
                                }
4490
                                else
4491
                                {
4492
                                    currentControl = new SignControl
4493 787a4489 KangIngu
                                    {
4494 233ef333 taeseongkim
                                        Background = new SolidColorBrush(Colors.Black),
4495
                                        UserNumber = App.ViewInfo.UserID,
4496
                                        ProjectNO = App.ViewInfo.ProjectNO,
4497
                                        StartPoint = new Point(CanvasDrawingMouseDownPoint.X, CanvasDrawingMouseDownPoint.Y),
4498
                                        EndPoint = new Point(CanvasDrawingMouseDownPoint.X, CanvasDrawingMouseDownPoint.Y),
4499
                                        ControlType = ControlType.Sign
4500
                                    };
4501 787a4489 KangIngu
4502 233ef333 taeseongkim
                                    currentControl.CommentID = Commons.shortGuid();
4503
                                    currentControl.IsNew = true;
4504
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4505
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4506 ca40e004 ljiyeon
4507 233ef333 taeseongkim
                                    //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정
4508
                                    (currentControl as SignControl).CommentAngle -= rotate.Angle;
4509 ca40e004 ljiyeon
                                }
4510 e66f22eb KangIngu
                                //}
4511 787a4489 KangIngu
                            }
4512
                        }
4513
                        break;
4514 233ef333 taeseongkim
4515 787a4489 KangIngu
                    case ControlType.Mark:
4516
                        {
4517 e6a9ddaf humkyung
                            if (e.LeftButton == MouseButtonState.Pressed)
4518 787a4489 KangIngu
                            {
4519 e66f22eb KangIngu
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4520
                                //{
4521 233ef333 taeseongkim
                                if (currentControl is RectangleControl)
4522
                                {
4523
                                    //20180906 LJY TEST IsRotationDrawingEnable
4524
                                    if (IsGetoutpoint((currentControl as RectangleControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
4525 787a4489 KangIngu
                                    {
4526 233ef333 taeseongkim
                                        return;
4527
                                    }
4528 e66f22eb KangIngu
4529 233ef333 taeseongkim
                                    CreateCommand.Instance.Execute(currentControl);
4530
                                    (currentControl as RectangleControl).ApplyOverViewData();
4531
                                    currentControl = null;
4532 787a4489 KangIngu
4533 902faaea taeseongkim
                                    this.cursor = new Cursor(App.DefaultArrowCursorStream);
4534 233ef333 taeseongkim
4535
                                    if (Common.ViewerDataModel.Instance.SelectedControl == "Batch")
4536
                                    {
4537
                                        txtBatch.Text = "Place Signature";
4538
                                        controlType = ControlType.Sign;
4539 787a4489 KangIngu
                                    }
4540 233ef333 taeseongkim
                                }
4541
                                else
4542
                                {
4543
                                    currentControl = new RectangleControl
4544 787a4489 KangIngu
                                    {
4545 233ef333 taeseongkim
                                        StartPoint = new Point(CanvasDrawingMouseDownPoint.X, CanvasDrawingMouseDownPoint.Y),
4546
                                        Background = new SolidColorBrush(Colors.Black),
4547
                                        ControlType = ControlType.Mark,
4548
                                        Paint = PaintSet.Fill
4549
                                    };
4550 787a4489 KangIngu
4551 233ef333 taeseongkim
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4552
                                    currentControl.CommentID = Commons.shortGuid();
4553
                                    currentControl.IsNew = true;
4554
                                    (currentControl as RectangleControl).DashSize = ViewerDataModel.Instance.DashSize;
4555
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4556
                                }
4557 e66f22eb KangIngu
                                //}
4558 787a4489 KangIngu
                            }
4559
                        }
4560
                        break;
4561 233ef333 taeseongkim
4562 787a4489 KangIngu
                    case ControlType.Symbol:
4563
                        {
4564 e6a9ddaf humkyung
                            if (e.LeftButton == MouseButtonState.Pressed)
4565 787a4489 KangIngu
                            {
4566 a6272c57 humkyung
                                if (currentControl is SymControl)
4567
                                {
4568
                                    //20180906 LJY TEST IsRotationDrawingEnable
4569
                                    if (IsGetoutpoint((currentControl as SymControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
4570 787a4489 KangIngu
                                    {
4571 a6272c57 humkyung
                                        return;
4572 787a4489 KangIngu
                                    }
4573 a6272c57 humkyung
                                    CreateCommand.Instance.Execute(currentControl);
4574
                                    currentControl = null;
4575 233ef333 taeseongkim
4576 902faaea taeseongkim
                                    this.cursor = new Cursor(App.DefaultArrowCursorStream);
4577 a6272c57 humkyung
                                }
4578
                                else
4579
                                {
4580
                                    currentControl = new SymControl
4581 787a4489 KangIngu
                                    {
4582 c7fde400 taeseongkim
                                        StartPoint = new Point(CanvasDrawingMouseDownPoint.X, CanvasDrawingMouseDownPoint.Y),
4583 a6272c57 humkyung
                                        Background = new SolidColorBrush(Colors.Black),
4584
                                        LineSize = ViewerDataModel.Instance.LineSize + 3,
4585
                                        ControlType = ControlType.Symbol
4586
                                    };
4587 787a4489 KangIngu
4588 a6272c57 humkyung
                                    currentControl.IsNew = true;
4589
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4590
                                    currentControl.CommentID = Commons.shortGuid();
4591
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4592 ca40e004 ljiyeon
4593 233ef333 taeseongkim
                                    //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정
4594 fa48eb85 taeseongkim
                                    (currentControl as SymControl).CommentAngle -= rotate.Angle;
4595 ca40e004 ljiyeon
                                }
4596 e66f22eb KangIngu
                                //}
4597 787a4489 KangIngu
                            }
4598
                        }
4599
                        break;
4600 233ef333 taeseongkim
4601 787a4489 KangIngu
                    case ControlType.Stamp:
4602
                        {
4603 e6a9ddaf humkyung
                            if (e.LeftButton == MouseButtonState.Pressed)
4604 787a4489 KangIngu
                            {
4605 e66f22eb KangIngu
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4606
                                //{
4607 233ef333 taeseongkim
                                if (currentControl is SymControlN)
4608
                                {
4609
                                    //20180906 LJY TEST IsRotationDrawingEnable
4610
                                    if (IsGetoutpoint((currentControl as SymControlN).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
4611 787a4489 KangIngu
                                    {
4612 233ef333 taeseongkim
                                        return;
4613
                                    }
4614 e66f22eb KangIngu
4615 233ef333 taeseongkim
                                    CreateCommand.Instance.Execute(currentControl);
4616
                                    currentControl = null;
4617 510cbd2a ljiyeon
4618 902faaea taeseongkim
                                    this.cursor = new Cursor(App.DefaultArrowCursorStream);
4619 233ef333 taeseongkim
                                }
4620
                                else
4621
                                {
4622
                                    currentControl = new SymControlN
4623 787a4489 KangIngu
                                    {
4624 233ef333 taeseongkim
                                        StartPoint = new Point(CanvasDrawingMouseDownPoint.X, CanvasDrawingMouseDownPoint.Y),
4625
                                        Background = new SolidColorBrush(Colors.Black),
4626
                                        STAMP = App.SystemInfo.STAMP,
4627 43e1d368 taeseongkim
                                        STAMP_Contents = App.SystemInfo.STAMP_CONTENTS,
4628 233ef333 taeseongkim
                                        ControlType = ControlType.Stamp
4629
                                    };
4630 787a4489 KangIngu
4631 233ef333 taeseongkim
                                    currentControl.IsNew = true;
4632
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4633
                                    currentControl.CommentID = Commons.shortGuid();
4634
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4635
                                    //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정
4636
                                    (currentControl as SymControlN).CommentAngle -= rotate.Angle;
4637
                                }
4638 e66f22eb KangIngu
                                //}
4639 787a4489 KangIngu
                            }
4640
                        }
4641
                        break;
4642 233ef333 taeseongkim
4643 787a4489 KangIngu
                    case ControlType.PenControl:
4644
                        {
4645
                            if (inkBoard.Tag.ToString() == "Ink")
4646
                            {
4647
                                inkBoard.IsEnabled = true;
4648 c7fde400 taeseongkim
                                StartNewStroke(CanvasDrawingMouseDownPoint);
4649 787a4489 KangIngu
                            }
4650
                            else if (inkBoard.Tag.ToString() == "EraseByPoint")
4651
                            {
4652 c7fde400 taeseongkim
                                RemovePointStroke(CanvasDrawingMouseDownPoint);
4653 787a4489 KangIngu
                            }
4654
                            else if (inkBoard.Tag.ToString() == "EraseByStroke")
4655
                            {
4656 c7fde400 taeseongkim
                                RemoveLineStroke(CanvasDrawingMouseDownPoint);
4657 787a4489 KangIngu
                            }
4658
                            IsDrawing = true;
4659
                            return;
4660
                        }
4661
                    default:
4662
                        if (currentControl != null)
4663
                        {
4664
                            currentControl.CommentID = null;
4665
                            currentControl.IsNew = false;
4666
                        }
4667
                        break;
4668
                }
4669 fa48eb85 taeseongkim
4670 4fcb686a taeseongkim
                try
4671
                {
4672
                    if (currentControl is ITextControl)
4673
                    {
4674
                        var textBox = currentControl.ChildrenOfType<TextBox>().Where(x=> x.Name == "PART_ArrowTextBox" || x.Name == "Base_TextBox" || x.Name == "PART_TextBox");
4675
4676
                        if(textBox.Count() > 0)
4677
                        {
4678
                            Behaviors.SpecialcharRemove specialcharRemove = new Behaviors.SpecialcharRemove();
4679
                            specialcharRemove.Attach(textBox.First());
4680
                        }
4681
                        else
4682
                        {
4683
4684
                        }
4685
4686
                    }
4687
                }
4688
                catch (Exception ex)
4689
                {
4690
                    System.Diagnostics.Debug.WriteLine(ex);
4691
4692
                }
4693
4694 1b2cf911 taeseongkim
                if (currentControl is ArrowTextControl)
4695
                {
4696
                    (currentControl as ArrowTextControl).EditEnded += (snd, evt) =>
4697
                    {
4698
                        var control = snd as ArrowTextControl;
4699
4700
                        if (string.IsNullOrEmpty(control.ArrowText))
4701
                        {
4702 34ac8db7 humkyung
                            UndoCommand.Instance.Push(EventType.Delete, new [] { control });
4703 1b2cf911 taeseongkim
                        }
4704
                    };
4705
4706
                }
4707 b74a9c91 taeseongkim
4708
                if (Common.ViewerDataModel.Instance.IsMacroCommand)
4709
                {
4710
                    if (currentControl == null && mouseHandlingMode == MouseHandlingMode.Drawing)
4711
                    {
4712
                        MacroHelper.MacroAction();
4713
                    }
4714
                    //if (currentControl.ControlType)
4715
                    //txtBatch.Text = "Draw a TextBox";
4716
                    //controlType = ControlType.ArrowTextBorderControl;
4717
                }
4718
4719 4f017ed3 taeseongkim
                //if (currentControl != null)
4720
                //{
4721
                //    currentControl.PageAngle = pageNavigator.CurrentPage.Angle;
4722
                //}
4723 787a4489 KangIngu
            }
4724 e6a9ddaf humkyung
            if (mouseHandlingMode != MouseHandlingMode.None && e.LeftButton == MouseButtonState.Pressed)
4725 787a4489 KangIngu
            {
4726 b74a9c91 taeseongkim
                // MACRO 버튼클릭하여 CLOUD RECT 그린 후
4727
             
4728
4729 787a4489 KangIngu
                if (mouseHandlingMode == MouseHandlingMode.Adorner && SelectLayer.Children.Count > 0)
4730
                {
4731
                    bool mouseOff = false;
4732
                    foreach (var item in SelectLayer.Children)
4733
                    {
4734
                        if (item is AdornerFinal)
4735
                        {
4736 4913851c humkyung
                            var over = (item as AdornerFinal).Members.Where(data => data.DrawingData.IsMouseOver).FirstOrDefault();
4737 787a4489 KangIngu
                            if (over != null)
4738
                            {
4739
                                mouseOff = true;
4740
                            }
4741 8295a079 이지연
4742 787a4489 KangIngu
                        }
4743
                    }
4744
4745
                    if (!mouseOff)
4746
                    {
4747 077896be humkyung
                        SelectionSet.Instance.UnSelect(this);
4748 787a4489 KangIngu
                    }
4749
                }
4750
                zoomAndPanControl.CaptureMouse();
4751
                e.Handled = true;
4752
            }
4753 9380813b swate0609
4754 787a4489 KangIngu
        }
4755 e54660e8 KangIngu
4756 a1716fa5 KangIngu
        private void zoomAndPanControl2_MouseDown(object sender, MouseButtonEventArgs e)
4757
        {
4758 e6a9ddaf humkyung
            ///mouseButtonDown = e.ChangedButton;
4759 a1716fa5 KangIngu
            canvasZoommovingMouseDownPoint = e.GetPosition(zoomAndPanCanvas2);
4760
        }
4761
4762 787a4489 KangIngu
        private void RemoveLineStroke(Point P)
4763
        {
4764 a342d378 taeseongkim
            var control = ViewerDataModel.Instance.MarkupControls_USER.Where(data => data.IsMouseEnter).FirstOrDefault();
4765 787a4489 KangIngu
            if (control != null)
4766
            {
4767 34ac8db7 humkyung
                UndoCommand.Instance.Push(EventType.Delete, new List<CommentUserInfo>() { control });
4768 787a4489 KangIngu
            }
4769
        }
4770
4771
        private void RemovePointStroke(Point P)
4772
        {
4773
            foreach (Stroke hits in inkBoard.Strokes)
4774
            {
4775
                foreach (StylusPoint sty in hits.StylusPoints)
4776
                {
4777
                }
4778
                if (hits.HitTest(P))
4779
                {
4780
                    inkBoard.Strokes.Remove(hits);
4781
                    return;
4782
                }
4783
            }
4784
        }
4785
4786
        private void StartNewStroke(Point P)
4787
        {
4788
            strokePoints = new StylusPointCollection();
4789
            StylusPoint segment1Start = new StylusPoint(P.X, P.Y);
4790
            strokePoints.Add(segment1Start);
4791
            stroke = new Stroke(strokePoints);
4792
4793
            stroke.DrawingAttributes.Color = Colors.Red;
4794
            stroke.DrawingAttributes.Width = 4;
4795
            stroke.DrawingAttributes.Height = 4;
4796
4797
            inkBoard.Strokes.Add(stroke);
4798
        }
4799
4800 77cdac33 taeseongkim
        private async  void btnConsolidate_Click(object sender, RoutedEventArgs e)
4801 787a4489 KangIngu
        {
4802 b42dd24d taeseongkim
            //SelectionSet.Instance.UnSelect(this.ParentOfType<MainWindow>().dzMainMenu);
4803
            //// update mylist and gridview
4804
            //this.UpdateMyMarkupList();
4805
4806
            //bool result = await this.ParentOfType<MainWindow>().dzTopMenu.ExecuteSaveCommand(this);
4807
4808
            //if (result)
4809
            //{
4810 6a19b48d taeseongkim
            btnFinalPDF.IsEnabled = false;
4811
            btnConsolidate.IsEnabled = false;
4812 dbddfdd0 taeseongkim
            var result = await  ConsolidationMethod();
4813
4814
            if(result)
4815
            {
4816
                 var consolidateItem = ViewerDataModel.Instance._markupInfoList.Where(x => x.Consolidate == 1 && x.AvoidConsolidate == 0);
4817
4818
                if(consolidateItem?.Count() > 0)
4819
                {
4820
                    gridViewMarkup.Select(consolidateItem);
4821
                }
4822
            }
4823 38d69491 taeseongkim
            else
4824
            {
4825
                btnFinalPDF.IsEnabled = true;
4826
                btnConsolidate.IsEnabled = true;
4827
            }
4828 787a4489 KangIngu
        }
4829
4830 102476f6 humkyung
        /// <summary>
4831
        /// execute TeamConsolidationCommand
4832
        /// </summary>
4833 77cdac33 taeseongkim
        public async void TeamConsolidationMethod()
4834 787a4489 KangIngu
        {
4835
            if (this.gridViewMarkup.SelectedItems.Count == 0)
4836
            {
4837
                this.ParentOfType<MainWindow>().DialogMessage_Alert("Please select at least one user", "Alert");
4838
            }
4839
            else
4840 90e7968d ljiyeon
            {
4841 77cdac33 taeseongkim
                foreach (MarkupInfoItem item in this.gridViewMarkup.SelectedItems)
4842 35a96e24 humkyung
                {
4843 77cdac33 taeseongkim
                    if (!this.userData.DEPARTMENT.Equals(item.Depatment))
4844
                    {
4845
                        this.ParentOfType<MainWindow>().DialogMessage_Alert("Please select at your department", "Alert");
4846
                    }
4847 35a96e24 humkyung
                }
4848 233ef333 taeseongkim
4849 77cdac33 taeseongkim
                var isSave = await this.ParentOfType<MainWindow>().dzTopMenu.SaveEventAsync();
4850
                if (isSave)
4851
                {
4852 f5f788c2 taeseongkim
                    var token = ViewerDataModel.Instance.NewMarkupCancelToken();
4853 77cdac33 taeseongkim
4854
                    await MarkupLoadAsync(pageNavigator.CurrentPage.PageNumber, ViewerDataModel.Instance.PageAngle, token);
4855 e31e5b1b humkyung
4856
                    #region 로그인 사용자가 같은 부서의 마크업을 취합하여 Team Consolidate을 수행한다.
4857 77cdac33 taeseongkim
                    List<IKCOM.MarkupInfoItem> MySelectItem = new List<IKCOM.MarkupInfoItem>();
4858
                    foreach (var item in this.gridViewMarkup.SelectedItems)
4859
                    {
4860 e31e5b1b humkyung
                        if((item as IKCOM.MarkupInfoItem).Depatment.Equals(this.userData.DEPARTMENT))
4861
                            MySelectItem.Add(item as IKCOM.MarkupInfoItem);
4862 77cdac33 taeseongkim
                    }
4863
4864
                    TeamConsolidateCommand.Instance.Execute(MySelectItem);
4865 e31e5b1b humkyung
                    #endregion
4866 77cdac33 taeseongkim
                }
4867
            }
4868
        }
4869
4870 e31e5b1b humkyung
        /// <summary>
4871
        /// Consolidate를 수행한다.
4872
        /// </summary>
4873
        /// <returns></returns>
4874 77cdac33 taeseongkim
        public async Task<bool> ConsolidationMethod()
4875
        {
4876
            bool result = false;
4877
4878
            if (this.gridViewMarkup.SelectedItems.Count == 0)
4879
            {
4880
                this.ParentOfType<MainWindow>().DialogMessage_Alert("Please select at least one user", "Alert");
4881
            }
4882
            else
4883
            {
4884 1d79913e taeseongkim
                var isSave = await this.ParentOfType<MainWindow>().dzTopMenu.SaveEventAsync();
4885 77cdac33 taeseongkim
4886
                if (isSave)
4887
                {
4888 f5f788c2 taeseongkim
                    var token = ViewerDataModel.Instance.NewMarkupCancelToken();
4889 77cdac33 taeseongkim
                    await MarkupLoadAsync(pageNavigator.CurrentPage.PageNumber, ViewerDataModel.Instance.PageAngle, token);
4890
4891
                    List<IKCOM.MarkupInfoItem> MySelectItem = new List<IKCOM.MarkupInfoItem>();
4892
                    foreach (var item in this.gridViewMarkup.SelectedItems)
4893
                    {
4894
                        MySelectItem.Add(item as IKCOM.MarkupInfoItem);
4895
                    }
4896
                    int iPageNo = Convert.ToInt32(this.ParentOfType<MainWindow>().dzTopMenu.tlcurrentPage.Text);
4897
4898 1d79913e taeseongkim
                    result = await ConsolidateCommand.Instance.ExecuteAsync(MySelectItem, iPageNo);
4899 77cdac33 taeseongkim
                }
4900 787a4489 KangIngu
            }
4901 b42dd24d taeseongkim
4902
            return result;
4903 787a4489 KangIngu
        }
4904
4905 e31e5b1b humkyung
        /// <summary>
4906
        /// 조건에 맞게 Consolidate 버튼을 비활성화 시킨다.
4907
        /// </summary>
4908
        /// <param name="sender"></param>
4909
        /// <param name="e"></param>
4910 787a4489 KangIngu
        private void btnConsolidate_Loaded(object sender, RoutedEventArgs e)
4911
        {
4912
            if (App.ViewInfo != null)
4913
            {
4914
                btnConsolidate = (sender as RadRibbonButton);
4915
                if (!App.ViewInfo.NewCommentPermission)
4916
                {
4917
                    (sender as RadRibbonButton).Visibility = System.Windows.Visibility.Collapsed;
4918
                }
4919
            }
4920
        }
4921
4922
        private void btnTeamConsolidate_Click(object sender, RoutedEventArgs e)
4923
        {
4924 04a7385a djkim
            TeamConsolidationMethod();
4925 787a4489 KangIngu
        }
4926
4927 e31e5b1b humkyung
        /// <summary>
4928
        /// 조건에 따라 Team Consoidate 버튼을 비활성화 시킨다.
4929
        /// </summary>
4930
        /// <param name="sender"></param>
4931
        /// <param name="e"></param>
4932 787a4489 KangIngu
        private void btnTeamConsolidate_Loaded(object sender, RoutedEventArgs e)
4933
        {
4934
            btnTeamConsolidate = sender as RadRibbonButton;
4935
            if (App.ViewInfo != null)
4936
            {
4937
                if (!App.ViewInfo.CreateFinalPDFPermission) //파이널이 True가 아니면
4938
                {
4939
                    if (btnConsolidate != null)
4940
                    {
4941
                        btnConsolidate.Visibility = Visibility.Collapsed;
4942
                    }
4943
4944
                    if (!App.ViewInfo.NewCommentPermission)
4945
                    {
4946
                        btnTeamConsolidate.Visibility = Visibility.Collapsed;
4947
                    }
4948
                }
4949
                else
4950
                {
4951
                    btnTeamConsolidate.Visibility = Visibility.Collapsed;
4952
                }
4953
            }
4954
        }
4955
4956 bae83c92 taeseongkim
        private async void FinalPDFEvent(object sender, RoutedEventArgs e)
4957 787a4489 KangIngu
        {
4958 b42dd24d taeseongkim
            SelectionSet.Instance.UnSelect(this.ParentOfType<MainWindow>().dzMainMenu);
4959
            // update mylist and gridview
4960
            this.UpdateMyMarkupList();
4961 a1e2ba68 taeseongkim
4962 43e1d368 taeseongkim
            var result = await this.ParentOfType<MainWindow>().dzTopMenu.ExecuteSaveCommandAsync(this);
4963 b42dd24d taeseongkim
4964 bae83c92 taeseongkim
            if(!result)
4965
            {
4966 a1e2ba68 taeseongkim
4967 bae83c92 taeseongkim
            }
4968
            else
4969 787a4489 KangIngu
            {
4970 bae83c92 taeseongkim
                var item = gridViewMarkup.Items.Cast<MarkupInfoItem>().Where(d => d.Consolidate == 1 && d.AvoidConsolidate == 0).FirstOrDefault();
4971
4972
                if (item != null)
4973 81e3c9f6 ljiyeon
                {
4974 bae83c92 taeseongkim
                    if (BaseClient.FinalPDF_GetFinalPDFStatus(_DocInfo.ID, item.MarkupInfoID, _ViewInfo.UserID))
4975
                    {
4976
                        //Logger.sendReqLog("SetFinalPDFAsync", _ViewInfo.ProjectNO + "," + _DocInfo.ID + "," + item.MarkupInfoID + "," + _ViewInfo.UserID, 1);
4977 a1e2ba68 taeseongkim
4978 bae83c92 taeseongkim
                        BaseClient.SetFinalPDFAsync(_ViewInfo.ProjectNO, _DocInfo.ID, item.MarkupInfoID, _ViewInfo.UserID);
4979
4980
                        ViewerDataModel.Instance.FinalPDFTime = DateTime.Now;
4981
                    }
4982
                    else
4983
                    {
4984
                        DialogMessage_Alert("Merged PDF가 수행중입니다", "안내");
4985
                    }
4986 81e3c9f6 ljiyeon
                }
4987
                else
4988
                {
4989 bae83c92 taeseongkim
                    //Consolidate 가 없는 경우
4990
                    DialogMessage_Alert("Consolidation 된 코멘트가 존재하지 않습니다", "안내");
4991 81e3c9f6 ljiyeon
                }
4992 233ef333 taeseongkim
            }
4993 bae83c92 taeseongkim
4994 787a4489 KangIngu
        }
4995
4996
        private void btnFinalPDF_Loaded(object sender, RoutedEventArgs e)
4997
        {
4998
            btnFinalPDF = sender as RadRibbonButton;
4999
            if (App.ViewInfo != null)
5000
            {
5001 b42dd24d taeseongkim
                //btnFinalPDF.IsEnabled = false;
5002
5003 787a4489 KangIngu
                if (!App.ViewInfo.CreateFinalPDFPermission) //파이널이 True가 아니면
5004
                {
5005
                    btnFinalPDF.Visibility = System.Windows.Visibility.Collapsed;
5006
                    if (btnConsolidate != null)
5007
                    {
5008
                        btnConsolidate.Visibility = Visibility.Collapsed;
5009
                    }
5010
                }
5011
            }
5012
        }
5013
5014 b42dd24d taeseongkim
        private async void ConsolidateFinalPDFEvent(object sender, RoutedEventArgs e)
5015 80458c15 ljiyeon
        {
5016 b42dd24d taeseongkim
            //UpdateMyMarkupList();
5017 80458c15 ljiyeon
5018
            if (this.gridViewMarkup.SelectedItems.Count == 0)
5019
            {
5020
                this.ParentOfType<MainWindow>().DialogMessage_Alert("Please select at least one user", "Alert");
5021
            }
5022
            else
5023
            {
5024 b42dd24d taeseongkim
                //if ((App.ViewInfo.CreateFinalPDFPermission || App.ViewInfo.NewCommentPermission))
5025
                //{
5026
                //컨트롤을 그리는 도중일 경우 컨트롤 삭제
5027
                //ViewerDataModel.Instance.MarkupControls_USER.Remove(ViewerDataModel.Instance.SystemMain.dzMainMenu.currentControl);
5028
                //ViewerDataModel.Instance.SystemMain.dzMainMenu.currentControl = null;
5029 80458c15 ljiyeon
5030 b42dd24d taeseongkim
                //SelectionSet.Instance.UnSelect(this.ParentOfType<MainWindow>().dzMainMenu);
5031
                //// update mylist and gridview
5032
                //this.UpdateMyMarkupList();
5033
5034
                //var result = await this.ParentOfType<MainWindow>().dzTopMenu.ExecuteSaveCommand(this);
5035 324fcf3e taeseongkim
5036 1305c420 taeseongkim
                Mouse.SetCursor(Cursors.Wait);
5037 324fcf3e taeseongkim
5038 77cdac33 taeseongkim
                bool result = await ConsolidationMethod();
5039 80458c15 ljiyeon
5040 5c64268e taeseongkim
                //System.Threading.Thread.Sleep(500);
5041 1305c420 taeseongkim
5042
                if (result)
5043 80458c15 ljiyeon
                {
5044 1305c420 taeseongkim
                    var items = this.BaseClient.GetMarkupInfoItems(App.ViewInfo.ProjectNO, _DocInfo.ID);
5045
5046
                    var item2 = items.Where(d => d.Consolidate == 1 && d.AvoidConsolidate == 0).FirstOrDefault();
5047
                    if (item2 != null)
5048 bae83c92 taeseongkim
                    {
5049 1305c420 taeseongkim
                        if (BaseClient.FinalPDF_GetFinalPDFStatus(_DocInfo.ID, item2.MarkupInfoID, _ViewInfo.UserID))
5050
                        {
5051
                            //Logger.sendReqLog("SetFinalPDFAsync", _ViewInfo.ProjectNO + "," + _DocInfo.ID + "," + item2.MarkupInfoID + "," + _ViewInfo.UserID, 1);
5052 80458c15 ljiyeon
5053 1305c420 taeseongkim
                            BaseClient.SetFinalPDFAsync(_ViewInfo.ProjectNO, _DocInfo.ID, item2.MarkupInfoID, _ViewInfo.UserID);
5054
                            BaseClient.GetMarkupInfoItemsAsync(App.ViewInfo.ProjectNO, _DocInfo.ID);
5055 bae83c92 taeseongkim
5056 1305c420 taeseongkim
                            ViewerDataModel.Instance.FinalPDFTime = DateTime.Now;
5057
5058
                            Mouse.SetCursor(Cursors.Arrow);
5059
                        }
5060
                        else
5061
                        {
5062
                            DialogMessage_Alert("Merged PDF가 수행중입니다. 잠시 후 수행가능합니다.", "안내");
5063
                        }
5064 bae83c92 taeseongkim
                    }
5065
                    else
5066
                    {
5067 1305c420 taeseongkim
                        DialogMessage_Alert("Consolidation 된 코멘트가 존재하지 않습니다", "안내");
5068 bae83c92 taeseongkim
                    }
5069 80458c15 ljiyeon
                }
5070
                else
5071
                {
5072 1305c420 taeseongkim
                    DialogMessage_Alert("서버가 원활하지 않습니다. 다시 수행 바랍니다.", "안내");
5073 80458c15 ljiyeon
                }
5074 1305c420 taeseongkim
5075
                Mouse.SetCursor(Cursors.Arrow);
5076 90e7968d ljiyeon
            }
5077 80458c15 ljiyeon
        }
5078
5079
        private void btnConsolidateFinalPDF_Loaded(object sender, RoutedEventArgs e)
5080 90e7968d ljiyeon
        {
5081 80458c15 ljiyeon
            btnConsolidateFinalPDF = (sender as RadRibbonButton);
5082 84605c0c taeseongkim
#if Hyosung
5083
            btnConsolidateFinalPDF.Visibility = System.Windows.Visibility.Collapsed;
5084
#else
5085 b42dd24d taeseongkim
5086
            //btnConsolidateFinalPDF.IsEnabled = false;
5087
5088 80458c15 ljiyeon
            if (App.ViewInfo != null)
5089
            {
5090
                if (!App.ViewInfo.NewCommentPermission || !App.ViewInfo.CreateFinalPDFPermission)
5091
                {
5092 90e7968d ljiyeon
                    btnConsolidateFinalPDF.Visibility = System.Windows.Visibility.Collapsed;
5093 80458c15 ljiyeon
                }
5094 90e7968d ljiyeon
            }
5095 84605c0c taeseongkim
#endif
5096 80458c15 ljiyeon
        }
5097
5098 3abe8d4e taeseongkim
        private void btnColorList_Click(object sender, RoutedEventArgs e)
5099
        {
5100
5101
        }
5102
5103 787a4489 KangIngu
        private void SyncCompare_Click(object sender, RoutedEventArgs e)
5104
        {
5105 adce8360 humkyung
            SetCompareRect();
5106 787a4489 KangIngu
        }
5107
5108 9cd2865b KangIngu
        private void Sync_Click(object sender, RoutedEventArgs e)
5109
        {
5110 a1716fa5 KangIngu
            if (Sync.IsChecked)
5111 9cd2865b KangIngu
            {
5112
                ViewerDataModel.Instance.Sync_ContentOffsetX = zoomAndPanControl.ContentOffsetX;
5113
                ViewerDataModel.Instance.Sync_ContentOffsetY = zoomAndPanControl.ContentOffsetY;
5114
                ViewerDataModel.Instance.Sync_ContentScale = zoomAndPanControl.ContentScale;
5115
            }
5116
        }
5117
5118 787a4489 KangIngu
        private void SyncUserListExpender_Click(object sender, RoutedEventArgs e)
5119
        {
5120
            if (UserList.IsChecked)
5121
            {
5122
                this.gridViewRevMarkup.Visibility = Visibility.Visible;
5123
            }
5124
            else
5125
            {
5126
                this.gridViewRevMarkup.Visibility = Visibility.Collapsed;
5127
            }
5128
        }
5129
5130
        private void SyncPageBalance_Click(object sender, RoutedEventArgs e)
5131
        {
5132
            if (BalanceMode.IsChecked)
5133
            {
5134
                ViewerDataModel.Instance.PageBalanceMode = true;
5135
            }
5136
            else
5137
            {
5138
                ViewerDataModel.Instance.PageBalanceMode = false;
5139
                ViewerDataModel.Instance.PageBalanceNumber = 0;
5140
            }
5141
        }
5142
5143
        private void SyncExit_Click(object sender, RoutedEventArgs e)
5144
        {
5145
            //초기화
5146
            testPanel2.IsHidden = true;
5147
            ViewerDataModel.Instance.PageBalanceMode = false;
5148
            ViewerDataModel.Instance.PageBalanceNumber = 0;
5149 752b18ef taeseongkim
            ViewerDataModel.Instance.SyncPageNumber = 0;
5150 787a4489 KangIngu
            ViewerDataModel.Instance.MarkupControls_Sync.Clear();
5151
            this.gridViewRevMarkup.Visibility = Visibility.Collapsed;
5152
            UserList.IsChecked = false;
5153
            BalanceMode.IsChecked = false;
5154
        }
5155
5156 ac4f1e13 taeseongkim
        private async void SyncPageChange_Click(object sender, RoutedEventArgs e)
5157 787a4489 KangIngu
        {
5158
            if ((sender as System.Windows.Controls.Control).Tag != null)
5159
            {
5160
                //Compare 초기화
5161
                CompareMode.IsChecked = false;
5162
                var balancePoint = Convert.ToInt32((sender as System.Windows.Controls.Control).Tag);
5163 752b18ef taeseongkim
                
5164
                if (ViewerDataModel.Instance.SyncPageNumber == 0)
5165 787a4489 KangIngu
                {
5166 752b18ef taeseongkim
                    ViewerDataModel.Instance.SyncPageNumber = 1;
5167 787a4489 KangIngu
                }
5168
5169
                if (ViewerDataModel.Instance.PageBalanceNumber == pageNavigator.PageCount)
5170
                {
5171
                }
5172
                else
5173
                {
5174
                    ViewerDataModel.Instance.PageBalanceNumber += balancePoint;
5175
                }
5176
5177 752b18ef taeseongkim
                if (ViewerDataModel.Instance.SyncPageNumber == pageNavigator.PageCount && balancePoint > 0)
5178 787a4489 KangIngu
                {
5179
                }
5180 752b18ef taeseongkim
                else if ((ViewerDataModel.Instance.SyncPageNumber + balancePoint) >= 1)
5181 787a4489 KangIngu
                {
5182 752b18ef taeseongkim
                    ViewerDataModel.Instance.SyncPageNumber += balancePoint;
5183 787a4489 KangIngu
                }
5184
5185 d04e8ee9 taeseongkim
                //pageNavigator.GotoPage(ViewerDataModel.Instance.PageNumber);
5186 6b6e937c taeseongkim
5187 787a4489 KangIngu
                if (!testPanel2.IsHidden)
5188
                {
5189
                    if (IsSyncPDFMode)
5190
                    {
5191
                        Get_FinalImage.Get_PdfImage get_PdfImage = new Get_FinalImage.Get_PdfImage();
5192 752b18ef taeseongkim
                        var pdfpath = new BitmapImage(new Uri(get_PdfImage.Run(CurrentRev.TO_VENDOR, App.ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, ViewerDataModel.Instance.SyncPageNumber)));
5193 787a4489 KangIngu
5194
                        if (pdfpath.IsDownloading)
5195
                        {
5196
                            pdfpath.DownloadCompleted += (ex, arg) =>
5197
                            {
5198
                                ViewerDataModel.Instance.ImageViewPath_C = pdfpath;
5199
                                ViewerDataModel.Instance.ImageViewWidth_C = pdfpath.PixelWidth;
5200
                                ViewerDataModel.Instance.ImageViewHeight_C = pdfpath.PixelHeight;
5201
                                zoomAndPanCanvas2.Width = pdfpath.PixelWidth;
5202
                                zoomAndPanCanvas2.Height = pdfpath.PixelHeight;
5203
                            };
5204
                        }
5205
                        else
5206
                        {
5207
                            ViewerDataModel.Instance.ImageViewPath_C = pdfpath;
5208
                            ViewerDataModel.Instance.ImageViewWidth_C = pdfpath.PixelWidth;
5209
                            ViewerDataModel.Instance.ImageViewHeight_C = pdfpath.PixelHeight;
5210
5211
                            zoomAndPanCanvas2.Width = pdfpath.PixelWidth;
5212
                            zoomAndPanCanvas2.Height = pdfpath.PixelHeight;
5213
                        }
5214
                    }
5215
                    else
5216
                    {
5217 752b18ef taeseongkim
                        string uri = this.GetImageURL(CurrentRev.DOCUMENT_ID, ViewerDataModel.Instance.SyncPageNumber);
5218 787a4489 KangIngu
5219 752b18ef taeseongkim
                        var isOriginalSize = !(ViewerDataModel.Instance.SyncPageNumber == pageNavigator.CurrentPage.PageNumber);
5220
                        ComparePageLoad(uri, isOriginalSize);
5221 787a4489 KangIngu
                    }
5222 4f017ed3 taeseongkim
                   
5223 787a4489 KangIngu
                    //강인구 추가(페이지 이동시 코멘트 재 호출)
5224
                    ViewerDataModel.Instance.MarkupControls_Sync.Clear();
5225
                    List<MarkupInfoItem> gridSelectionRevItem = gridViewRevMarkup.SelectedItems.Cast<MarkupInfoItem>().ToList();
5226
5227
                    foreach (var item in gridSelectionRevItem)
5228
                    {
5229 752b18ef taeseongkim
                        var markupitems = item.MarkupList.Where(pageItem => pageItem.PageNumber == ViewerDataModel.Instance.SyncPageNumber).ToList();
5230 ac4f1e13 taeseongkim
                        foreach (var markupitem in markupitems)
5231 787a4489 KangIngu
                        {
5232 f5f788c2 taeseongkim
                            await MarkupParser.ParseExAsync(App.BaseAddress, ViewerDataModel.Instance.NewMarkupCancelToken(), App.ViewInfo.ProjectNO, markupitem.Data, Common.ViewerDataModel.Instance.MarkupControls_Sync,0, item.DisplayColor, "", item.MarkupInfoID);
5233 ac4f1e13 taeseongkim
                        }
5234 787a4489 KangIngu
                    }
5235 e54660e8 KangIngu
5236 752b18ef taeseongkim
                    tlSyncPageNum.Text = String.Format("Current Page : {0}", ViewerDataModel.Instance.SyncPageNumber);
5237 787a4489 KangIngu
                }
5238
            }
5239
        }
5240
5241 43d2041c taeseongkim
        private void SyncRotation_Click(object sender,RoutedEventArgs e)
5242
        {
5243
            var direction = int.Parse((sender as Telerik.Windows.Controls.RadPathButton).Tag.ToString());
5244
5245
            double translateX = 0;
5246
            double translateY = 0;
5247
            double angle = rotate2.Angle;
5248
5249
            if (direction == 1)
5250
            {
5251
                if (angle < 270)
5252
                {
5253
                    angle += 90;
5254
                }
5255
                else
5256
                {
5257
                    angle = 0;
5258
                }
5259
            }
5260
            else
5261
            {
5262
                if (angle > 0)
5263
                {
5264
                    angle -= 90;
5265
                }
5266
                else
5267
                {
5268
                    angle = 270;
5269
                }
5270
            }
5271
            zoomAndPanControl2.RotationAngle = angle;
5272
            zoomAndPanControl2.ScaleToFit();
5273
5274
            //if (angle == 90 || angle == 270)
5275
            //{
5276
                double emptySize = zoomAndPanCanvas2.Width;
5277
                zoomAndPanCanvas2.Width = zoomAndPanCanvas2.Height;
5278
                zoomAndPanCanvas2.Height = emptySize;
5279
            //}
5280
5281
            if (angle == 90)
5282
            {
5283
                translateX = zoomAndPanCanvas2.Width;
5284
                translateY = 0;
5285
            }
5286
            else if (angle == 180)
5287
            {
5288
                translateX = zoomAndPanCanvas2.Width;
5289
                translateY = zoomAndPanCanvas2.Height;
5290
            }
5291
            else if (angle == 270)
5292
            {
5293
                translateX = 0;
5294
                translateY = zoomAndPanCanvas2.Height;
5295
            }
5296
            zoomAndPanControl2.ContentViewportWidth = zoomAndPanCanvas2.Width;
5297
            zoomAndPanControl2.ContentViewportHeight = zoomAndPanCanvas2.Height;
5298
            translate2.X = translateX;
5299
            translate2.Y = translateY;
5300
            rotate2.Angle = angle;
5301
            //translate2CompareBorder.X = translateX;
5302
            //translate2CompareBorder.Y = translateY;
5303
            //rotate2CompareBorder.Angle = angle;
5304
5305
        }
5306
5307 787a4489 KangIngu
        private void SyncChange_Click(object sender, RoutedEventArgs e)
5308
        {
5309
            if (MarkupMode.IsChecked)
5310
            {
5311
                IsSyncPDFMode = true;
5312
5313
                var uri = CurrentRev.TO_VENDOR;
5314 ae56d52d KangIngu
5315 752b18ef taeseongkim
                if (ViewerDataModel.Instance.SyncPageNumber == 0)
5316 787a4489 KangIngu
                {
5317 752b18ef taeseongkim
                    ViewerDataModel.Instance.SyncPageNumber = 1;
5318 787a4489 KangIngu
                }
5319
5320
                //PDF모드 잠시 대기(강인구)
5321
                Get_FinalImage.Get_PdfImage get_PdfImage = new Get_FinalImage.Get_PdfImage();
5322 752b18ef taeseongkim
                var pdfpath = new BitmapImage(new Uri(get_PdfImage.Run(CurrentRev.TO_VENDOR, App.ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, ViewerDataModel.Instance.SyncPageNumber)));
5323 787a4489 KangIngu
5324
                if (pdfpath.IsDownloading)
5325
                {
5326
                    pdfpath.DownloadCompleted += (ex, arg) =>
5327
                    {
5328
                        ViewerDataModel.Instance.ImageViewPath_C = pdfpath;
5329
                        ViewerDataModel.Instance.ImageViewWidth_C = pdfpath.PixelWidth;
5330
                        ViewerDataModel.Instance.ImageViewHeight_C = pdfpath.PixelHeight;
5331
                        zoomAndPanCanvas2.Width = pdfpath.PixelWidth;
5332
                        zoomAndPanCanvas2.Height = pdfpath.PixelHeight;
5333
                    };
5334
                }
5335
                else
5336
                {
5337
                    ViewerDataModel.Instance.ImageViewPath_C = pdfpath;
5338
                    ViewerDataModel.Instance.ImageViewWidth_C = pdfpath.PixelWidth;
5339
                    ViewerDataModel.Instance.ImageViewHeight_C = pdfpath.PixelHeight;
5340
5341
                    zoomAndPanCanvas2.Width = pdfpath.PixelWidth;
5342
                    zoomAndPanCanvas2.Height = pdfpath.PixelHeight;
5343
                }
5344
            }
5345
            else
5346
            {
5347
                IsSyncPDFMode = false;
5348 69f41aab humkyung
                string uri = this.GetImageURL(CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber);
5349 787a4489 KangIngu
5350 752b18ef taeseongkim
                ComparePageLoad(uri,false);
5351 787a4489 KangIngu
5352
                zoomAndPanControl2.ApplyTemplate();
5353
                zoomAndPanControl2.UpdateLayout();
5354
                zoomAndPanCanvas2.Width = Convert.ToDouble(Common.ViewerDataModel.Instance.ContentWidth);
5355
                zoomAndPanCanvas2.Height = Convert.ToDouble(Common.ViewerDataModel.Instance.ContentHeight);
5356
            }
5357
        }
5358
5359 adce8360 humkyung
        /// <summary>
5360
        /// Compare된 영역을 초기화
5361
        /// </summary>
5362
        private void ClearCompareRect()
5363
        {
5364
            da.From = 1;
5365
            da.To = 1;
5366
            da.Duration = new Duration(TimeSpan.FromSeconds(9999));
5367
            da.AutoReverse = false;
5368
            canvas_compareBorder.Children.Clear();
5369
            canvas_compareBorder.BeginAnimation(OpacityProperty, da);
5370
        }
5371
5372
        /// <summary>
5373 233ef333 taeseongkim
        /// 문서 Comprare
5374 adce8360 humkyung
        /// </summary>
5375
        private void SetCompareRect()
5376
        {
5377 43d2041c taeseongkim
            canvas_compareBorder.Children.Clear();
5378
5379 adce8360 humkyung
            if (CompareMode.IsChecked)
5380
            {
5381
                if (ViewerDataModel.Instance.PageBalanceMode && ViewerDataModel.Instance.PageBalanceNumber == 0)
5382
                {
5383
                    ViewerDataModel.Instance.PageBalanceNumber = 1;
5384
                }
5385 752b18ef taeseongkim
                if (ViewerDataModel.Instance.SyncPageNumber == 0)
5386 adce8360 humkyung
                {
5387 752b18ef taeseongkim
                    ViewerDataModel.Instance.SyncPageNumber = 1;
5388 adce8360 humkyung
                }
5389
5390 664ea2e1 taeseongkim
                //Logger.sendReqLog("GetCompareRectAsync", _ViewInfo.ProjectNO + "," + _ViewInfo.DocumentItemID + "," + CurrentRev.DOCUMENT_ID +"," + pageNavigator.CurrentPage.PageNumber.ToString() + "," + ViewerDataModel.Instance.PageNumber.ToString() + "," + userData.COMPANY != "EXT" ? "true" : "false", 1);
5391 adce8360 humkyung
5392 41c4405e taeseongkim
                /// 비교대상원본, 비교할 대상
5393 752b18ef taeseongkim
                BaseClient.GetCompareRectAsync(_ViewInfo.ProjectNO, _ViewInfo.DocumentItemID,  CurrentRev.DOCUMENT_ID,  ViewerDataModel.Instance.SyncPageNumber.ToString(), pageNavigator.CurrentPage.PageNumber.ToString(), userData.COMPANY != "EXT" ? "true" : "false");
5394 adce8360 humkyung
            }
5395
            else
5396
            {
5397 43d2041c taeseongkim
                canvas_compareBorder.Visibility = Visibility.Hidden;
5398 adce8360 humkyung
                ClearCompareRect();
5399
            }
5400
        }
5401
5402 3212270d taeseongkim
        private void btnSync_Click(object sender, RoutedEventArgs e)
5403 787a4489 KangIngu
        {
5404
            gridViewHistory_Busy.IsBusy = true;
5405
5406
            RadButton instance = sender as RadButton;
5407
            if (instance.CommandParameter != null)
5408
            {
5409
                CurrentRev = instance.CommandParameter as VPRevision;
5410 adce8360 humkyung
                System.EventHandler<ServiceDeepView.GetSyncMarkupInfoItemsCompletedEventArgs> GetSyncMarkupInfoItemshandler = null;
5411
5412
                GetSyncMarkupInfoItemshandler = (sen, ea) =>
5413 787a4489 KangIngu
                {
5414
                    if (ea.Error == null && ea.Result != null)
5415
                    {
5416
                        testPanel2.IsHidden = false;
5417
5418 d128ceb2 humkyung
                        ViewerDataModel.Instance._markupInfoRevList.Clear();
5419 233ef333 taeseongkim
                        foreach (var info in ea.Result)
5420 d128ceb2 humkyung
                        {
5421 233ef333 taeseongkim
                            if (info.UserID == App.ViewInfo.UserID)
5422 d128ceb2 humkyung
                            {
5423
                                info.userDelete = true;
5424 8f7f8073 taeseongkim
                                info.DisplayColor = "#FFFF0000";
5425 d128ceb2 humkyung
                            }
5426
                            else
5427
                            {
5428
                                info.userDelete = false;
5429
                            }
5430
                            ViewerDataModel.Instance._markupInfoRevList.Add(info);
5431
                        }
5432 787a4489 KangIngu
                        gridViewRevMarkup.ItemsSource = ViewerDataModel.Instance._markupInfoRevList;
5433
5434 69f41aab humkyung
                        string uri = this.GetImageURL(CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber);
5435 752b18ef taeseongkim
                        ComparePageLoad(uri,false);
5436 787a4489 KangIngu
5437
                        Sync_Offset_Point = new Point(zoomAndPanControl.ContentOffsetX, zoomAndPanControl.ContentOffsetY);
5438
5439
                        zoomAndPanControl2.ApplyTemplate();
5440
                        zoomAndPanControl2.UpdateLayout();
5441 43d2041c taeseongkim
5442 787a4489 KangIngu
                        if (Sync_Offset_Point != new Point(zoomAndPanControl.ContentOffsetX, zoomAndPanControl.ContentOffsetY))
5443
                        {
5444
                            zoomAndPanControl.ContentOffsetX = Sync_Offset_Point.X;
5445
                            zoomAndPanControl.ContentOffsetY = Sync_Offset_Point.Y;
5446
                        }
5447
5448 9cd2865b KangIngu
                        ViewerDataModel.Instance.Sync_ContentOffsetX = Sync_Offset_Point.X;
5449
                        ViewerDataModel.Instance.Sync_ContentOffsetY = Sync_Offset_Point.Y;
5450
                        ViewerDataModel.Instance.Sync_ContentScale = zoomAndPanControl.ContentScale;
5451
5452 787a4489 KangIngu
                        tlSyncRev.Text = String.Format("Rev. {0}", CurrentRev.RevNo);
5453
                        tlSyncPageNum.Text = String.Format("Current Page : {0}", pageNavigator.CurrentPage.PageNumber);
5454 43d2041c taeseongkim
5455
                        zoomAndPanControl.ScaleToFit();
5456
                        zoomAndPanControl2.ScaleToFit();
5457
5458 787a4489 KangIngu
                        gridViewHistory_Busy.IsBusy = false;
5459
                    }
5460 0f065e57 ljiyeon
5461 664ea2e1 taeseongkim
                    //Logger.sendResLog("GetSyncMarkupInfoItemsCompleted", "UserState : " + ea.UserState + "\r Result :" + ea.Result + "\r Cancelled :" + ea.Cancelled + "\r Error :" + ea.Error, 1);
5462 adce8360 humkyung
5463
                    if (GetSyncMarkupInfoItemshandler != null)
5464
                    {
5465
                        BaseClient.GetSyncMarkupInfoItemsCompleted -= GetSyncMarkupInfoItemshandler;
5466
                    }
5467
5468 43d2041c taeseongkim
                    //ClearCompareRect();
5469 adce8360 humkyung
                    SetCompareRect();
5470 90e7968d ljiyeon
                };
5471 adce8360 humkyung
5472
                /// 중복 실행이 발생하여 수정함.
5473
                BaseClient.GetSyncMarkupInfoItemsCompleted += GetSyncMarkupInfoItemshandler;
5474 787a4489 KangIngu
                BaseClient.GetSyncMarkupInfoItemsAsync(_ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, _ViewInfo.UserID);
5475 adce8360 humkyung
5476 664ea2e1 taeseongkim
                //Logger.sendReqLog("GetSyncMarkupInfoItemsAsync", _ViewInfo.ProjectNO + "," + CurrentRev.DOCUMENT_ID + "," + _ViewInfo.UserID, 1);
5477 787a4489 KangIngu
            }
5478
        }
5479 4eb052e4 ljiyeon
5480 752b18ef taeseongkim
        private void OriginalSizeMode_Click(object sender,RoutedEventArgs e)
5481
        {
5482
            string uri = this.GetImageURL(CurrentRev.DOCUMENT_ID, ViewerDataModel.Instance.SyncPageNumber);
5483
            var isOriginalSize = !(ViewerDataModel.Instance.SyncPageNumber == pageNavigator.CurrentPage.PageNumber);
5484
5485 ffa5dbc7 taeseongkim
            ComparePageLoad(uri, OriginalSizeMode.IsChecked);
5486 752b18ef taeseongkim
        }
5487
5488 94b7c12c djkim
        private void EnsembleLink_Button_Click(object sender, RoutedEventArgs e)
5489
        {
5490
            try
5491
            {
5492
                if (sender is RadButton)
5493
                {
5494
                    if ((sender as RadButton).Tag != null)
5495
                    {
5496
                        var url = (sender as RadButton).Tag.ToString();
5497
                        System.Diagnostics.Process.Start(url);
5498
                    }
5499
                    else
5500
                    {
5501
                        this.ParentOfType<MainWindow>().DialogMessage_Alert("Link 정보가 잘못 되었습니다", "안내");
5502
                    }
5503
                }
5504
            }
5505
            catch (Exception ex)
5506
            {
5507 664ea2e1 taeseongkim
                //Logger.sendResLog("EnsembleLink_Button_Click", ex.Message, 0);
5508 94b7c12c djkim
            }
5509
        }
5510 787a4489 KangIngu
5511
        public void Sync_Event(VPRevision Currnet_Rev)
5512
        {
5513
            CurrentRev = Currnet_Rev;
5514
5515
            BaseClient.GetSyncMarkupInfoItemsCompleted += (sen, ea) =>
5516
            {
5517
                if (ea.Error == null && ea.Result != null)
5518
                {
5519
                    testPanel2.IsHidden = false;
5520
5521 d128ceb2 humkyung
                    ViewerDataModel.Instance._markupInfoRevList.Clear();
5522 233ef333 taeseongkim
                    foreach (var info in ea.Result)
5523 d128ceb2 humkyung
                    {
5524 233ef333 taeseongkim
                        if (info.UserID == App.ViewInfo.UserID)
5525 d128ceb2 humkyung
                        {
5526
                            info.userDelete = true;
5527 cf1cc862 taeseongkim
                            info.DisplayColor = "#FFFF0000";
5528 d128ceb2 humkyung
                        }
5529
                        else
5530
                        {
5531
                            info.userDelete = false;
5532
                        }
5533
                        ViewerDataModel.Instance._markupInfoRevList.Add(info);
5534
                    }
5535 787a4489 KangIngu
                    gridViewRevMarkup.ItemsSource = ViewerDataModel.Instance._markupInfoRevList;
5536
5537 69f41aab humkyung
                    string uri = this.GetImageURL(CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber);
5538 787a4489 KangIngu
5539
                    Sync_Offset_Point = new Point(zoomAndPanControl.ContentOffsetX, zoomAndPanControl.ContentOffsetY);
5540
5541 752b18ef taeseongkim
                    ComparePageLoad(uri,false);
5542 90e7968d ljiyeon
5543 787a4489 KangIngu
                    zoomAndPanCanvas2.Width = Convert.ToDouble(Common.ViewerDataModel.Instance.ContentWidth);
5544
                    zoomAndPanCanvas2.Height = Convert.ToDouble(Common.ViewerDataModel.Instance.ContentHeight);
5545
                    zoomAndPanControl2.ApplyTemplate();
5546
                    zoomAndPanControl2.UpdateLayout();
5547
5548
                    if (Sync_Offset_Point != new Point(zoomAndPanControl.ContentOffsetX, zoomAndPanControl.ContentOffsetY))
5549
                    {
5550
                        zoomAndPanControl.ContentOffsetX = Sync_Offset_Point.X;
5551
                        zoomAndPanControl.ContentOffsetY = Sync_Offset_Point.Y;
5552
                    }
5553
                    //}
5554 30878507 taeseongkim
                    
5555 787a4489 KangIngu
                    tlSyncRev.Text = String.Format("Rev. {0}", CurrentRev.RevNo);
5556
                    tlSyncPageNum.Text = String.Format("Current Page : {0}", pageNavigator.CurrentPage.PageNumber);
5557 90e7968d ljiyeon
                    gridViewHistory_Busy.IsBusy = false;
5558 787a4489 KangIngu
                }
5559 664ea2e1 taeseongkim
                //Logger.sendResLog("GetSyncMarkupInfoItemsCompleted", "UserState : " + ea.UserState + "\r Result :" + ea.Result + "\r Cancelled :" + ea.Cancelled + "\r Error :" + ea.Error, 1);
5560 787a4489 KangIngu
            };
5561 664ea2e1 taeseongkim
            //Logger.sendReqLog("GetSyncMarkupInfoItemsAsync", _ViewInfo.ProjectNO + "," + CurrentRev.DOCUMENT_ID + "," + _ViewInfo.UserID, 1);
5562 90e7968d ljiyeon
            BaseClient.GetSyncMarkupInfoItemsAsync(_ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, _ViewInfo.UserID);
5563 787a4489 KangIngu
        }
5564
5565
        private void PdfLink_ButtonDown(object sender, MouseButtonEventArgs e)
5566
        {
5567
            if (sender is Image)
5568
            {
5569
                if ((sender as Image).Tag != null)
5570
                {
5571
                    var pdfUrl = (sender as Image).Tag.ToString();
5572
                    System.Diagnostics.Process.Start(pdfUrl);
5573
                }
5574
                else
5575
                {
5576
                    this.ParentOfType<MainWindow>().DialogMessage_Alert("문서 정보가 잘못 되었습니다", "안내");
5577
                }
5578
            }
5579
        }
5580
5581
        private void Create_Symbol(object sender, RoutedEventArgs e)
5582
        {
5583 5529d2a2 humkyung
            MarkupToPDF.Controls.Parsing.MarkupParser.MarkupReturn markupReturn = new MarkupToPDF.Controls.Parsing.MarkupParser.MarkupReturn();
5584 787a4489 KangIngu
5585
            if (SelectLayer.Children.Count < 1) //선택된 것이 없으면
5586
            {
5587
                DialogMessage_Alert("Please Select Controls", "Alert");
5588
            }
5589
            else //선택된 것이 있으면
5590
            {
5591
                string MarkupData = "";
5592
                adorner_ = new AdornerFinal();
5593
5594
                foreach (var item in SelectLayer.Children)
5595
                {
5596
                    if (item.GetType().Name == "AdornerFinal")
5597
                    {
5598
                        adorner_ = (item as Controls.AdornerFinal);
5599 4913851c humkyung
                        foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
5600 787a4489 KangIngu
                        {
5601
                            if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
5602
                            {
5603 5529d2a2 humkyung
                                markupReturn = MarkupParser.MarkupToString(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo, App.ViewInfo.UserID);
5604 787a4489 KangIngu
                                MarkupData += markupReturn.ConvertData;
5605
                            }
5606
                        }
5607
                    }
5608
                }
5609
                DialogParameters parameters = new DialogParameters()
5610
                {
5611 b9b01f8e ljiyeon
                    Owner = Application.Current.MainWindow,
5612 787a4489 KangIngu
                    Closed = (obj, args) => this.MarkupNamePromptClose(MarkupData, args),
5613
                    DefaultPromptResultValue = "Custom State",
5614
                    Content = "Name :",
5615
                    Header = "Insert Custom Symbol Name",
5616
                    Theme = new VisualStudio2013Theme(),
5617
                    ModalBackground = new SolidColorBrush { Color = Colors.Black, Opacity = 0.6 },
5618
                };
5619
                RadWindow.Prompt(parameters);
5620
            }
5621
        }
5622 233ef333 taeseongkim
5623 53880c83 ljiyeon
        public int symbolselectindex = 0;
5624 233ef333 taeseongkim
5625 53880c83 ljiyeon
        private void SymbolMarkupNamePromptClose(byte[] Img_byte, string data, WindowClosedEventArgs args)
5626
        {
5627
            //Save save = new Save();
5628
            try
5629
            {
5630
                string svgfilename = null;
5631
                if (symbolname != null)
5632
                {
5633
                    if (symbolpng == true || symbolsvg == true)
5634
                    {
5635 76dc223b taeseongkim
                        kr.co.devdoftech.cloud.FileUpload fileUploader = App.FileUploader;
5636 24678e06 humkyung
                        string guid = Commons.shortGuid();
5637 53880c83 ljiyeon
5638
                        fileUploader.RunAsync(App.ViewInfo.ProjectNO, _DocItem.DOCUMENT_NO, App.ViewInfo.UserID, guid + ".png", Img_byte);
5639 c73426a9 ljiyeon
                        //Check_Uri.UriCheck();
5640 53880c83 ljiyeon
                        fileUploader.RunCompleted += (ex, arg) =>
5641
                        {
5642
                            filename = arg.Result;
5643
                            if (symbolpng == true)
5644
                            {
5645
                                if (filename != null)
5646 233ef333 taeseongkim
                                {
5647 53880c83 ljiyeon
                                    if (symbolselectindex == 0)
5648
                                    {
5649
                                        SymbolSave(symbolname, filename, data);
5650
                                    }
5651
                                    else
5652
                                    {
5653
                                        SymbolSave_Public(symbolname, filename, data, ViewerDataModel.Instance.SystemMain.dzMainMenu.userData.DEPARTMENT);
5654
                                    }
5655
                                    DataBind();
5656 233ef333 taeseongkim
                                }
5657 53880c83 ljiyeon
                            }
5658
5659
                            if (symbolsvg == true)
5660
                            {
5661 c73426a9 ljiyeon
                                try
5662 53880c83 ljiyeon
                                {
5663 c73426a9 ljiyeon
                                    var defaultBitmapImage = new BitmapImage();
5664
                                    defaultBitmapImage.BeginInit();
5665
                                    defaultBitmapImage.CreateOptions = BitmapCreateOptions.IgnoreImageCache;
5666
                                    defaultBitmapImage.CacheOption = BitmapCacheOption.OnLoad;
5667
                                    Check_Uri.UriCheck(filename);
5668
                                    defaultBitmapImage.UriSource = new Uri(filename);
5669
                                    defaultBitmapImage.EndInit();
5670 53880c83 ljiyeon
5671 c73426a9 ljiyeon
                                    System.Drawing.Bitmap image;
5672 53880c83 ljiyeon
5673 c73426a9 ljiyeon
                                    if (defaultBitmapImage.IsDownloading)
5674
                                    {
5675
                                        defaultBitmapImage.DownloadCompleted += (ex2, arg2) =>
5676 53880c83 ljiyeon
                                        {
5677 c73426a9 ljiyeon
                                            defaultBitmapImage.Freeze();
5678
                                            image = GetBitmap(defaultBitmapImage);
5679
                                            image.Save(@AppDomain.CurrentDomain.BaseDirectory + "potrace.bmp", System.Drawing.Imaging.ImageFormat.Bmp);
5680
                                            Process potrace = new Process
5681 53880c83 ljiyeon
                                            {
5682 c73426a9 ljiyeon
                                                StartInfo = new ProcessStartInfo
5683
                                                {
5684
                                                    FileName = @AppDomain.CurrentDomain.BaseDirectory + "potrace.exe",
5685
                                                    Arguments = "-b svg " + @AppDomain.CurrentDomain.BaseDirectory + "potrace.bmp",
5686
                                                    RedirectStandardInput = true,
5687
                                                    RedirectStandardOutput = true,
5688
                                                    RedirectStandardError = true,
5689
                                                    UseShellExecute = false,
5690
                                                    CreateNoWindow = true,
5691
                                                    WindowStyle = ProcessWindowStyle.Hidden
5692
                                                },
5693
                                            };
5694 53880c83 ljiyeon
5695 c73426a9 ljiyeon
                                            StringBuilder svgBuilder = new StringBuilder();
5696
                                            potrace.OutputDataReceived += (object sender2, DataReceivedEventArgs e2) =>
5697 53880c83 ljiyeon
                                            {
5698 c73426a9 ljiyeon
                                                svgBuilder.AppendLine(e2.Data);
5699
                                            };
5700
5701
                                            potrace.EnableRaisingEvents = true;
5702
                                            potrace.Start();
5703
                                            potrace.Exited += (sender, e) =>
5704 53880c83 ljiyeon
                                            {
5705 c73426a9 ljiyeon
                                                byte[] bytes = System.IO.File.ReadAllBytes(@AppDomain.CurrentDomain.BaseDirectory + "potrace.svg");
5706
                                                svgfilename = fileUploader.Run(App.ViewInfo.ProjectNO, _DocItem.DOCUMENT_NO, App.ViewInfo.UserID, guid + ".svg", bytes);
5707
                                                Check_Uri.UriCheck(svgfilename);
5708
                                                if (symbolselectindex == 0)
5709
                                                {
5710
                                                    SymbolSave(symbolname, svgfilename, data);
5711
                                                }
5712
                                                else
5713
                                                {
5714
                                                    SymbolSave_Public(symbolname, svgfilename, data, ViewerDataModel.Instance.SystemMain.dzMainMenu.userData.DEPARTMENT);
5715
                                                }
5716 53880c83 ljiyeon
5717 c73426a9 ljiyeon
                                                DataBind();
5718
                                            };
5719
                                            potrace.WaitForExit();
5720 53880c83 ljiyeon
                                        };
5721 c73426a9 ljiyeon
                                    }
5722
                                    else
5723
                                    {
5724
                                        //GC.Collect();
5725
                                    }
5726 53880c83 ljiyeon
                                }
5727 233ef333 taeseongkim
                                catch (Exception ee)
5728 90e7968d ljiyeon
                                {
5729 c73426a9 ljiyeon
                                    DialogMessage_Alert("" + ee, "Alert");
5730 90e7968d ljiyeon
                                }
5731 53880c83 ljiyeon
                            }
5732 233ef333 taeseongkim
                        };
5733 53880c83 ljiyeon
                    }
5734
                }
5735
            }
5736
            catch (Exception e)
5737
            {
5738
                //DialogMessage_Alert(e + "", "Alert");
5739 233ef333 taeseongkim
            }
5740 53880c83 ljiyeon
        }
5741
5742
        public void SymbolSave(string Name, string Url, string Data)
5743
        {
5744
            try
5745
            {
5746
                SYMBOL_PRIVATE symbol_private = new SYMBOL_PRIVATE
5747
                {
5748 24678e06 humkyung
                    ID = Commons.shortGuid(),
5749 53880c83 ljiyeon
                    MEMBER_USER_ID = App.ViewInfo.UserID,
5750
                    NAME = Name,
5751
                    IMAGE_URL = Url,
5752
                    DATA = Data
5753
                };
5754
5755
                Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.SaveSymbolCompleted += BaseClient_SaveSymbolCompleted;
5756 664ea2e1 taeseongkim
                //Logger.sendReqLog("SaveSymbolAsync: ", symbol_private.ID + "," + symbol_private.MEMBER_USER_ID + "," + symbol_private.NAME + "," + symbol_private.IMAGE_URL + "," + symbol_private.DATA, 1);
5757 53880c83 ljiyeon
                Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.SaveSymbolAsync(symbol_private);
5758
            }
5759
            catch (Exception)
5760
            {
5761
                throw;
5762
            }
5763
        }
5764
5765
        public void SymbolSave_Public(string Name, string Url, string Data, string Department)
5766
        {
5767
            try
5768
            {
5769
                SYMBOL_PUBLIC symbol_public = new SYMBOL_PUBLIC
5770
                {
5771 24678e06 humkyung
                    ID = Commons.shortGuid(),
5772 53880c83 ljiyeon
                    DEPARTMENT = Department,
5773
                    NAME = Name,
5774
                    IMAGE_URL = Url,
5775
                    DATA = Data
5776
                };
5777
                Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.AddPublicSymbolCompleted += BaseClient_AddPublicSymbolCompleted;
5778 664ea2e1 taeseongkim
                //Logger.sendReqLog("AddPublicSymbol: ", symbol_public.ID + "," + symbol_public.DEPARTMENT + "," + symbol_public.NAME + "," + symbol_public.IMAGE_URL + "," + symbol_public.DATA, 1);
5779 53880c83 ljiyeon
                Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.AddPublicSymbol(symbol_public);
5780
            }
5781
            catch (Exception)
5782
            {
5783
                throw;
5784
            }
5785
        }
5786
5787
        private void BaseClient_AddPublicSymbolCompleted(object sender, ServiceDeepView.AddPublicSymbolCompletedEventArgs e)
5788 233ef333 taeseongkim
        {
5789 664ea2e1 taeseongkim
            //Logger.sendResLog("AddPublicSymbolCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1);
5790 53880c83 ljiyeon
            DataBind();
5791
        }
5792
5793
        private void BaseClient_SaveSymbolCompleted(object sender, ServiceDeepView.SaveSymbolCompletedEventArgs e)
5794
        {
5795 664ea2e1 taeseongkim
            //Logger.sendResLog("RenameSymbolCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1);
5796 53880c83 ljiyeon
            DataBind();
5797
        }
5798 233ef333 taeseongkim
5799 53880c83 ljiyeon
        private void DataBind()
5800
        {
5801
            try
5802
            {
5803
                Symbol_Custom Custom = new Symbol_Custom();
5804
                List<Symbol_Custom> Custom_List = new List<Symbol_Custom>();
5805 233ef333 taeseongkim
5806 bb3a236d ljiyeon
                var symbol_Private = BaseClient.GetSymbolList(App.ViewInfo.UserID);
5807 53880c83 ljiyeon
                foreach (var item in symbol_Private)
5808
                {
5809
                    Custom.Name = item.NAME;
5810
                    Custom.ImageUri = item.IMAGE_URL;
5811
                    Custom.ID = item.ID;
5812
                    Custom_List.Add(Custom);
5813
                    Custom = new Symbol_Custom();
5814
                }
5815
                symbolPanel_Instance.lstSymbolPrivate.ItemsSource = Custom_List;
5816 233ef333 taeseongkim
5817 53880c83 ljiyeon
                Custom = new Symbol_Custom();
5818
                Custom_List = new List<Symbol_Custom>();
5819
5820 bb3a236d ljiyeon
                symbolPanel_Instance.deptlist.ItemsSource = BaseClient.GetPublicSymbolDeptList();
5821 53880c83 ljiyeon
5822
                List<SYMBOL_PUBLIC> symbol_Public;
5823 787a4489 KangIngu
5824 53880c83 ljiyeon
                if (symbolPanel_Instance.deptlist.SelectedValue != null)
5825
                {
5826 bb3a236d ljiyeon
                    symbol_Public = BaseClient.GetPublicSymbolList(symbolPanel_Instance.deptlist.SelectedValue.ToString());
5827 53880c83 ljiyeon
                }
5828
                else
5829
                {
5830 bb3a236d ljiyeon
                    symbol_Public = BaseClient.GetPublicSymbolList(null);
5831 53880c83 ljiyeon
                }
5832
                foreach (var item in symbol_Public)
5833
                {
5834
                    Custom.Name = item.NAME;
5835
                    Custom.ImageUri = item.IMAGE_URL;
5836
                    Custom.ID = item.ID;
5837
                    Custom_List.Add(Custom);
5838
                    Custom = new Symbol_Custom();
5839
                }
5840
                symbolPanel_Instance.lstSymbolPublic.ItemsSource = Custom_List;
5841 233ef333 taeseongkim
                BaseClient.Close();
5842 53880c83 ljiyeon
            }
5843 233ef333 taeseongkim
            catch (Exception e)
5844 53880c83 ljiyeon
            {
5845
                //DialogMessage_Alert("DataBind", "Alert");
5846
            }
5847
        }
5848 233ef333 taeseongkim
5849 ac4f1e13 taeseongkim
        private async void MarkupNamePromptClose(string data, WindowClosedEventArgs args)
5850 787a4489 KangIngu
        {
5851 c73426a9 ljiyeon
            try
5852 787a4489 KangIngu
            {
5853 c73426a9 ljiyeon
                if (args.PromptResult != null)
5854 53880c83 ljiyeon
                {
5855 c73426a9 ljiyeon
                    if (args.DialogResult.Value)
5856
                    {
5857 ac4f1e13 taeseongkim
                        PngBitmapEncoder _Encoder = await symImageAsync(data);
5858 787a4489 KangIngu
5859 c73426a9 ljiyeon
                        System.IO.MemoryStream fs = new System.IO.MemoryStream();
5860
                        _Encoder.Save(fs);
5861
                        System.Drawing.Image ImgOut = System.Drawing.Image.FromStream(fs);
5862 787a4489 KangIngu
5863 c73426a9 ljiyeon
                        byte[] Img_byte = fs.ToArray();
5864 787a4489 KangIngu
5865 76dc223b taeseongkim
                        kr.co.devdoftech.cloud.FileUpload fileUploader = App.FileUploader;
5866 24678e06 humkyung
                        filename = fileUploader.Run(App.ViewInfo.ProjectNO, _DocItem.DOCUMENT_NO, App.ViewInfo.UserID, Commons.shortGuid() + ".png", Img_byte);
5867 c73426a9 ljiyeon
                        Check_Uri.UriCheck(filename);
5868
                        if (symbolPanel_Instance.RadTab.SelectedIndex == 0)
5869
                        {
5870 de6499db humkyung
                            SaveCommand.Instance.SymbolSave(args.PromptResult, filename, data);
5871 c73426a9 ljiyeon
                        }
5872
                        else
5873
                        {
5874 de6499db humkyung
                            SaveCommand.Instance.SymbolSave_Public(args.PromptResult, filename, data, ViewerDataModel.Instance.SystemMain.dzMainMenu.userData.DEPARTMENT);
5875 c73426a9 ljiyeon
                        }
5876
                        DataBind();
5877 53880c83 ljiyeon
                    }
5878
                }
5879 787a4489 KangIngu
            }
5880 233ef333 taeseongkim
            catch (Exception ex)
5881 c73426a9 ljiyeon
            {
5882
                DialogMessage_Alert("" + ex, "Alert");
5883
            }
5884 787a4489 KangIngu
        }
5885
5886 ac4f1e13 taeseongkim
        public async Task<PngBitmapEncoder> symImageAsync(string data)
5887 787a4489 KangIngu
        {
5888
            Canvas _canvas = new Canvas();
5889
            _canvas.Background = Brushes.White;
5890
            _canvas.Width = adorner_.BorderSize.Width;
5891
            _canvas.Height = adorner_.BorderSize.Height;
5892 f5f788c2 taeseongkim
            await MarkupParser.ParseAsync(App.BaseAddress, App.ViewInfo.ProjectNO, data, _canvas,ViewerDataModel.Instance.PageAngle, "#FFFF0000", "", ViewerDataModel.Instance.NewMarkupCancelToken());
5893 787a4489 KangIngu
5894
            BitmapEncoder encoder = new PngBitmapEncoder();
5895
5896
            RenderTargetBitmap renderBitmap = new RenderTargetBitmap((int)_canvas.Width + 50, (int)_canvas.Height + 50, 96d, 96d, PixelFormats.Pbgra32);
5897
5898
            DrawingVisual dv = new DrawingVisual();
5899
5900
            _canvas.Measure(new System.Windows.Size(adorner_.BorderSize.Width + 50, adorner_.BorderSize.Height + 50));
5901
            _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)));
5902
5903
            using (DrawingContext ctx = dv.RenderOpen())
5904
            {
5905
                VisualBrush vb = new VisualBrush(_canvas);
5906
                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)));
5907
            }
5908
5909
            try
5910
            {
5911
                renderBitmap.Render(dv);
5912
5913 2007ecaa taeseongkim
                GC.Collect(2);
5914 787a4489 KangIngu
                GC.WaitForPendingFinalizers();
5915 90e7968d ljiyeon
                //GC.Collect();
5916 787a4489 KangIngu
                // encode png data
5917
                PngBitmapEncoder pngEncoder = new PngBitmapEncoder();
5918
                // puch rendered bitmap into it
5919
                pngEncoder.Interlace = PngInterlaceOption.Off;
5920
                pngEncoder.Frames.Add(BitmapFrame.Create(renderBitmap));
5921
                return pngEncoder;
5922
            }
5923 53880c83 ljiyeon
            catch //(Exception ex)
5924 787a4489 KangIngu
            {
5925
                return null;
5926
            }
5927
        }
5928
5929
        public void DialogMessage_Alert(string content, string header)
5930
        {
5931 68e3cd94 taeseongkim
            App.splashScreen.Close();
5932 cf1cc862 taeseongkim
            App.FileLogger.Error(content + " " + header);
5933 68e3cd94 taeseongkim
5934 787a4489 KangIngu
            DialogParameters parameters = new DialogParameters()
5935
            {
5936 4279e717 djkim
                Owner = this.ParentOfType<MainWindow>(),
5937 0d32593b ljiyeon
                Content = new TextBlock()
5938 233ef333 taeseongkim
                {
5939 0d32593b ljiyeon
                    MinWidth = 400,
5940
                    FontSize = 11,
5941
                    Text = content,
5942
                    TextWrapping = System.Windows.TextWrapping.Wrap
5943
                },
5944 b79f786f 송근호
                DialogStartupLocation = WindowStartupLocation.CenterOwner,
5945 787a4489 KangIngu
                Header = header,
5946
                Theme = new VisualStudio2013Theme(),
5947
                ModalBackground = new SolidColorBrush { Color = Colors.Black, Opacity = 0.6 },
5948 233ef333 taeseongkim
            };
5949 787a4489 KangIngu
            RadWindow.Alert(parameters);
5950
        }
5951
5952 233ef333 taeseongkim
        #region 캡쳐 기능
5953 787a4489 KangIngu
5954
        public BitmapSource CutAreaToImage(int x, int y, int width, int height)
5955
        {
5956
            if (x < 0)
5957
            {
5958
                width += x;
5959
                x = 0;
5960
            }
5961
            if (y < 0)
5962
            {
5963
                height += y;
5964
                y = 0;
5965
5966
                width = (int)zoomAndPanCanvas.ActualWidth - x;
5967
            }
5968
            if (x + width > zoomAndPanCanvas.ActualWidth)
5969
            {
5970
                width = (int)zoomAndPanCanvas.ActualWidth - x;
5971
            }
5972
            if (y + height > zoomAndPanCanvas.ActualHeight)
5973
            {
5974
                height = (int)zoomAndPanCanvas.ActualHeight - y;
5975
            }
5976
5977
            byte[] pixels = CopyPixels(x, y, width, height);
5978
5979
            int stride = (width * canvasImage.Format.BitsPerPixel + 7) / 8;
5980
5981
            return BitmapSource.Create(width, height, 96, 96, PixelFormats.Pbgra32, null, pixels, stride);
5982
        }
5983
5984
        public byte[] CopyPixels(int x, int y, int width, int height)
5985
        {
5986
            byte[] pixels = new byte[width * height * 4];
5987
            int stride = (width * canvasImage.Format.BitsPerPixel + 7) / 8;
5988
5989
            // Canvas 이미지에서 객체 역역만큼 픽셀로 복사
5990
            canvasImage.CopyPixels(new Int32Rect(x, y, width, height), pixels, stride, 0);
5991
5992
            return pixels;
5993
        }
5994
5995
        public RenderTargetBitmap ConverterBitmapImage(FrameworkElement element)
5996
        {
5997
            DrawingVisual drawingVisual = new DrawingVisual();
5998
            DrawingContext drawingContext = drawingVisual.RenderOpen();
5999
6000
            // 해당 객체의 그래픽요소로 사각형의 그림을 그립니다.
6001
            drawingContext.DrawRectangle(new VisualBrush(element), null,
6002
                new Rect(new Point(0, 0), new Point(element.ActualWidth, element.ActualHeight)));
6003
            drawingContext.Close();
6004
6005
            // 비트맵으로 변환합니다.
6006
            RenderTargetBitmap target =
6007
                new RenderTargetBitmap((int)element.ActualWidth, (int)element.ActualHeight,
6008
                96, 96, System.Windows.Media.PixelFormats.Pbgra32);
6009
6010
            target.Render(drawingVisual);
6011
            return target;
6012
        }
6013
6014 233ef333 taeseongkim
        private System.Drawing.Bitmap GetBitmap(BitmapSource source)
6015 53880c83 ljiyeon
        {
6016
            System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(source.PixelWidth, source.PixelHeight, System.Drawing.Imaging.PixelFormat.Format32bppPArgb);
6017
            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);
6018
            source.CopyPixels(Int32Rect.Empty, data.Scan0, data.Height * data.Stride, data.Stride);
6019
            bmp.UnlockBits(data);
6020
            return bmp;
6021
        }
6022 233ef333 taeseongkim
6023 53880c83 ljiyeon
        public string symbolname = null;
6024
        public bool symbolsvg = true;
6025
        public bool symbolpng = true;
6026
6027
        public void Save_Symbol_Capture(BitmapSource source, int x, int y, int width, int height)
6028
        {
6029
            System.Drawing.Bitmap image = GetBitmap(source);
6030
            //흰색 제거
6031
            //image.MakeTransparent(System.Drawing.Color.White);
6032
6033
            var imageStream = new System.IO.MemoryStream();
6034
            byte[] imageBytes = null;
6035
            using (imageStream)
6036
            {
6037
                image.Save(imageStream, System.Drawing.Imaging.ImageFormat.Png);
6038
                // test.Save(@"E:\test.png", System.Drawing.Imaging.ImageFormat.Png);
6039
                imageStream.Position = 0;
6040
                imageBytes = imageStream.ToArray();
6041
            }
6042
6043
            SymbolPrompt symbolPrompt = new SymbolPrompt();
6044
6045
            RadWindow CheckPop = new RadWindow();
6046
            //Alert check = new Alert(Msg);
6047
6048
            CheckPop = new RadWindow
6049
            {
6050
                MinWidth = 400,
6051
                MinHeight = 100,
6052 233ef333 taeseongkim
                // Closed = (obj, args) => this.SymbolMarkupNamePromptClose(imageBytes, "", args),
6053 53880c83 ljiyeon
                Header = "Alert",
6054
                Content = symbolPrompt,
6055 233ef333 taeseongkim
                //DialogResult =
6056 53880c83 ljiyeon
                ResizeMode = System.Windows.ResizeMode.NoResize,
6057
                WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen,
6058
                IsTopmost = true,
6059
            };
6060
            CheckPop.Closed += (obj, args) => this.SymbolMarkupNamePromptClose(imageBytes, "", args);
6061
            StyleManager.SetTheme(CheckPop, new Office2013Theme());
6062
            CheckPop.ShowDialog();
6063
6064
            /*
6065
            DialogParameters parameters = new DialogParameters()
6066
            {
6067
                Owner = Application.Current.MainWindow,
6068
                Closed = (obj, args) => this.SymbolMarkupNamePromptClose(imageBytes, "", args),
6069
                DefaultPromptResultValue = "Custom State",
6070
                Content = "Name :",
6071
                Header = "Insert Custom Symbol Name",
6072
                Theme = new VisualStudio2013Theme(),
6073
                ModalBackground = new SolidColorBrush { Color = Colors.Black, Opacity = 0.6 },
6074 233ef333 taeseongkim
            };
6075 53880c83 ljiyeon
            RadWindow.Prompt(parameters);
6076
            */
6077
        }
6078
6079 787a4489 KangIngu
        public void Save_Capture(BitmapSource source, int x, int y, int width, int height)
6080
        {
6081
            KCOM.Common.Converter.FileStreamToBase64 streamToBase64 = new Common.Converter.FileStreamToBase64();
6082
            KCOMDataModel.DataModel.CHECK_LIST check_;
6083
            string Result = streamToBase64.ImageToBase64(source);
6084
            KCOMDataModel.DataModel.CHECK_LIST Item = new KCOMDataModel.DataModel.CHECK_LIST();
6085 6c781c0c djkim
            string projectno = App.ViewInfo.ProjectNO;
6086
            string checklist_id = ViewerDataModel.Instance.CheckList_ID;
6087 0f065e57 ljiyeon
6088 664ea2e1 taeseongkim
            //Logger.sendReqLog("GetCheckList", projectno + "," + checklist_id, 1);
6089 6c781c0c djkim
            Item = this.BaseClient.GetCheckList(projectno, checklist_id);
6090 90e7968d ljiyeon
            if (Item != null)
6091 0f065e57 ljiyeon
            {
6092 664ea2e1 taeseongkim
                //Logger.sendResLog("GetCheckList", "TRUE", 1);
6093 0f065e57 ljiyeon
            }
6094
            else
6095
            {
6096 664ea2e1 taeseongkim
                //Logger.sendResLog("GetCheckList", "FALSE", 1);
6097 0f065e57 ljiyeon
            }
6098 90e7968d ljiyeon
6099 6c781c0c djkim
            if (Item == null)
6100 787a4489 KangIngu
            {
6101 6c781c0c djkim
                check_ = new KCOMDataModel.DataModel.CHECK_LIST
6102 787a4489 KangIngu
                {
6103 24678e06 humkyung
                    ID = Commons.shortGuid(),
6104 6c781c0c djkim
                    USER_ID = App.ViewInfo.UserID,
6105
                    IMAGE_URL = Result,
6106
                    IMAGE_ANCHOR = x + "," + y + "," + width + "," + height,
6107
                    PAGENUMBER = this.pageNavigator.CurrentPage.PageNumber,
6108
                    REVISION = ViewerDataModel.Instance.SystemMain.dzMainMenu.CurrentDoc.Revision,
6109
                    DOCUMENT_ID = App.ViewInfo.DocumentItemID,
6110
                    PROJECT_NO = App.ViewInfo.ProjectNO,
6111
                    STATUS = "False",
6112
                    CREATE_TIME = DateTime.Now,
6113
                    UPDATE_TIME = DateTime.Now,
6114
                    DOCUMENT_NO = _DocItem.DOCUMENT_NO,
6115
                    STATUS_DESC_OPEN = "Vendor 반영 필요",
6116
                };
6117 274cde11 taeseongkim
                Logger.sendReqLog("AddCheckList", projectno + "," + check_, 1);
6118 664ea2e1 taeseongkim
                //Logger.sendResLog("AddCheckList", this.BaseClient.AddCheckList(projectno, check_).ToString(), 1);
6119 274cde11 taeseongkim
                this.BaseClient.AddCheckList(projectno, check_);
6120 787a4489 KangIngu
            }
6121 6c781c0c djkim
            else
6122
            {
6123
                Item.IMAGE_URL = Result;
6124
                Item.IMAGE_ANCHOR = x + "," + y + "," + width + "," + height;
6125 90e7968d ljiyeon
                Item.PAGENUMBER = this.pageNavigator.CurrentPage.PageNumber;
6126 274cde11 taeseongkim
                Logger.sendReqLog("SaveCheckList", projectno + "," + checklist_id + "," + Item, 1);
6127 664ea2e1 taeseongkim
                //Logger.sendResLog("SaveCheckList", this.BaseClient.SaveCheckList(projectno, checklist_id, Item).ToString(), 1);
6128 274cde11 taeseongkim
                this.BaseClient.SaveCheckList(projectno, checklist_id, Item);
6129 6c781c0c djkim
            }
6130 787a4489 KangIngu
        }
6131
6132
        public void Set_Capture()
6133 90e7968d ljiyeon
        {
6134 c7fde400 taeseongkim
            double x = CanvasDrawingMouseDownPoint.X;
6135
            double y = CanvasDrawingMouseDownPoint.Y;
6136 787a4489 KangIngu
            double width = dragCaptureBorder.Width;
6137
            double height = dragCaptureBorder.Height;
6138
6139
            if (width > 5 || height > 5)
6140
            {
6141
                canvasImage = ConverterBitmapImage(zoomAndPanCanvas);
6142
                BitmapSource source = CutAreaToImage((int)x, (int)y, (int)width, (int)height);
6143
                Save_Capture(source, (int)x, (int)y, (int)width, (int)height);
6144
            }
6145
        }
6146 233ef333 taeseongkim
6147
        #endregion 캡쳐 기능
6148 787a4489 KangIngu
6149 b79d6e7f humkyung
        public UndoData Control_Style(CommentUserInfo control)
6150 787a4489 KangIngu
        {
6151 b79d6e7f humkyung
            multi_UndoData = new UndoData();
6152 787a4489 KangIngu
6153 873011c4 humkyung
            multi_UndoData.Markup = control;
6154 787a4489 KangIngu
6155 ab7fe8c0 humkyung
            if (control is IShapeControl)
6156 787a4489 KangIngu
            {
6157 873011c4 humkyung
                multi_UndoData.paint = (control as IShapeControl).Paint;
6158 787a4489 KangIngu
            }
6159 ab7fe8c0 humkyung
            if (control is IDashControl)
6160 787a4489 KangIngu
            {
6161 873011c4 humkyung
                multi_UndoData.DashSize = (control as IDashControl).DashSize;
6162 787a4489 KangIngu
            }
6163 ab7fe8c0 humkyung
            if (control is IPath)
6164 787a4489 KangIngu
            {
6165 873011c4 humkyung
                multi_UndoData.LineSize = (control as IPath).LineSize;
6166 787a4489 KangIngu
            }
6167
            if ((control as UIElement) != null)
6168
            {
6169 873011c4 humkyung
                multi_UndoData.Opacity = (control as UIElement).Opacity;
6170 787a4489 KangIngu
            }
6171
6172 873011c4 humkyung
            return multi_UndoData;
6173 787a4489 KangIngu
        }
6174
6175 ac4f1e13 taeseongkim
        private async void Comment_Move(object sender, MouseButtonEventArgs e)
6176 787a4489 KangIngu
        {
6177 d2279f18 taeseongkim
            string Select_ID = (((e.Source as Telerik.Windows.Controls.RadButton).DataContext) as IKCOM.MarkupInfoItem).MarkupInfoID;
6178 787a4489 KangIngu
            foreach (var items in ViewerDataModel.Instance._markupInfoRevList)
6179
            {
6180 4f017ed3 taeseongkim
                if (items.MarkupInfoID == Select_ID)
6181 787a4489 KangIngu
                {
6182
                    foreach (var item in items.MarkupList)
6183
                    {
6184
                        if (item.PageNumber == pageNavigator.CurrentPage.PageNumber)
6185
                        {
6186 f5f788c2 taeseongkim
                            await MarkupParser.ParseExAsync(App.BaseAddress, ViewerDataModel.Instance.NewMarkupCancelToken(), App.ViewInfo.ProjectNO, item.Data, Common.ViewerDataModel.Instance.MarkupControls_USER,ViewerDataModel.Instance.PageAngle, "#FFFF0000", "",
6187 233ef333 taeseongkim
                                 items.MarkupInfoID, Commons.shortGuid());
6188 787a4489 KangIngu
                        }
6189
                    }
6190
                }
6191
            }
6192
        }
6193 d62c0439 humkyung
6194 f959ea6f humkyung
        /// <summary>
6195
        /// convert inkcontrol to polygoncontrol
6196
        /// </summary>
6197
        public void ConvertInkControlToPolygon()
6198 787a4489 KangIngu
        {
6199
            if (inkBoard.Strokes.Count > 0)
6200
            {
6201
                inkBoard.Strokes.ToList().ForEach(stroke =>
6202
                {
6203
                    InkToPath ip = new InkToPath();
6204 f959ea6f humkyung
6205 787a4489 KangIngu
                    List<Point> inkPointSet = new List<Point>();
6206 f959ea6f humkyung
                    inkPointSet.AddRange(ip.GetPointsFrom(stroke));
6207
6208
                    PolygonControl pc = new PolygonControl()
6209 787a4489 KangIngu
                    {
6210 fa48eb85 taeseongkim
                        CommentAngle = 0,
6211 f959ea6f humkyung
                        PointSet = inkPointSet,
6212 787a4489 KangIngu
                        ControlType = ControlType.Ink
6213
                    };
6214 f959ea6f humkyung
                    pc.StartPoint = inkPointSet[0];
6215
                    pc.EndPoint = inkPointSet[inkPointSet.Count - 1];
6216
                    pc.LineSize = 3;
6217
                    pc.CommentID = Commons.shortGuid();
6218
                    pc.StrokeColor = new SolidColorBrush(Colors.Red);
6219 787a4489 KangIngu
6220 f959ea6f humkyung
                    if (pc.PointSet.Count > 0)
6221
                    {
6222
                        CreateCommand.Instance.Execute(pc);
6223 787a4489 KangIngu
                        ViewerDataModel.Instance.MarkupControls_USER.Add(pc);
6224
                    }
6225
                });
6226 f959ea6f humkyung
                inkBoard.Strokes.Clear();
6227 787a4489 KangIngu
            }
6228
        }
6229 17a22987 KangIngu
6230 4318fdeb KangIngu
        /// <summary>
6231 e66f22eb KangIngu
        /// 캔버스에 그릴때 모든 포인트가 캔버스를 벗어 났는지 체크하여 넘겨줌
6232
        /// </summary>
6233
        /// <author>ingu</author>
6234
        /// <date>2018.06.05</date>
6235
        /// <param name="getPoint"></param>
6236
        /// <returns></returns>
6237
        private bool IsGetoutpoint(Point getPoint)
6238 670a4be2 humkyung
        {
6239 e66f22eb KangIngu
            if (getPoint == new Point())
6240 670a4be2 humkyung
            {
6241 e66f22eb KangIngu
                ViewerDataModel.Instance.MarkupControls_USER.Remove(currentControl);
6242
                currentControl = null;
6243
                return true;
6244 670a4be2 humkyung
            }
6245
6246 e66f22eb KangIngu
            return false;
6247 670a4be2 humkyung
        }
6248 e66f22eb KangIngu
6249 5b46312f djkim
        private void zoomAndPanControl_DragOver(object sender, DragEventArgs e)
6250
        {
6251
            e.Effects = DragDropEffects.Copy;
6252
        }
6253
6254
        private void zoomAndPanControl_DragEnter(object sender, DragEventArgs e)
6255
        {
6256
            e.Effects = DragDropEffects.Copy;
6257
        }
6258
6259
        private void zoomAndPanControl_DragLeave(object sender, DragEventArgs e)
6260
        {
6261
            e.Effects = DragDropEffects.None;
6262
        }
6263
6264 92442e4a taeseongkim
        private void ZoomAndPanControl_ScaleChanged(object sender, RoutedEventArgs e)
6265 cdfb57ff taeseongkim
        {
6266
            var pageWidth = ViewerDataModel.Instance.ImageViewWidth;
6267
            var pageHeight = ViewerDataModel.Instance.ImageViewHeight;
6268
6269 92442e4a taeseongkim
            ScaleImage(pageWidth, pageHeight);
6270
        }
6271
6272
        /// <summary>
6273
        /// 페이지를 scale의 변화에 맞춰서 DecodePixel을 변경한다.
6274
        /// </summary>
6275
        /// <param name="pageWidth">원본 사이즈</param>
6276
        /// <param name="pageHeight">원본 사이즈</param>
6277
        /// <returns></returns>
6278 233ef333 taeseongkim
        private void ScaleImage(double pageWidth, double pageHeight)
6279 92442e4a taeseongkim
        {
6280 7e2d682c taeseongkim
            //mainPanel.Scale = zoomAndPanControl.ContentScale;// (zoomAndPanControl.ContentScale >= 0.1) ? 1 : zoomAndPanControl.ContentScale;
6281 cdfb57ff taeseongkim
        }
6282
6283 d0eda156 ljiyeon
        private void thumbnailPanel_SizeChanged(object sender, SizeChangedEventArgs e)
6284
        {
6285
            CommonLib.Common.WriteConfigString("SetThumbnail", "WIDTH", thumbnailPanel.Width.ToString());
6286
        }
6287
6288 53deabaf taeseongkim
        private void gridViewMarkupAllSelect_Click(object sender, RoutedEventArgs e)
6289
        {
6290
            var checkbox = (sender as CheckBox);
6291
6292
            if (checkbox != null)
6293
            {
6294
                if (checkbox.IsChecked.GetValueOrDefault())
6295
                {
6296 92c9cab8 taeseongkim
                    if (!App.ViewInfo.CreateFinalPDFPermission && App.ViewInfo.NewCommentPermission)
6297
                    {
6298
                        var currentItem = gridViewMarkup.Items.OfType<IKCOM.MarkupInfoItem>().Where(x => x.UserID == App.ViewInfo.UserID);
6299
6300
                        if (currentItem.Count() > 0)
6301
                        {
6302
                            foreach (var item in gridViewMarkup.Items.OfType<IKCOM.MarkupInfoItem>())
6303
                            {
6304
                                if (item.Consolidate == 0 &&  item.Depatment == currentItem.First().Depatment)
6305
                                {
6306
                                    gridViewMarkup.SelectedItems.Add(item);
6307
                                }
6308
                            }
6309
                        }
6310
                    }
6311
                    else
6312
                    {
6313
                        gridViewMarkup.SelectAll();
6314
                    }
6315 53deabaf taeseongkim
                }
6316
                else
6317
                {
6318
                    gridViewMarkup.UnselectAll();
6319
                }
6320
            }
6321
        }
6322 3abe8d4e taeseongkim
6323
        private void gridViewMarkup_MouseRightButtonDown(object sender, MouseButtonEventArgs e)
6324
        {
6325
            var dataSet = gridViewMarkup.SelectedItems.Cast<MarkupInfoItem>();
6326
6327
            if (dataSet?.Count() == 1)
6328
            {
6329
                PopupWindow popup = new PopupWindow();
6330
                
6331
            }
6332
        }
6333 552af7c7 swate0609
6334
        private void gridViewMarkup_AddingNewDataItem(object sender, Telerik.Windows.Controls.GridView.GridViewAddingNewEventArgs e)
6335
        {
6336
            foreach(var vCol in e.OwnerGridViewItemsControl.Columns)
6337
            {
6338
                vCol.IsReadOnly = false;
6339
            }
6340
        }
6341
6342
        private void gridViewMarkup_RowEditEnded(object sender, GridViewRowEditEndedEventArgs e)
6343
        {
6344
            var vEditItem = e.EditedItem;
6345
            ((MarkupInfoItem)vEditItem).UserID = App.ViewInfo.UserID;
6346
            ((MarkupInfoItem)vEditItem).UpdateTime = DateTime.Now;
6347
            //((GridViewRow)e.Row).MarkupInfoItem).UserID == App.ViewInfo.UserID
6348
6349
            foreach (var vCol in ((RadGridView)e.OriginalSource).Columns)
6350
            {
6351
                vCol.IsReadOnly = true;
6352
            }
6353
        }
6354
6355
6356 3abe8d4e taeseongkim
6357 e6a9ddaf humkyung
        /*
6358 5b46312f djkim
        private void zoomAndPanControl_Drop(object sender, DragEventArgs e)
6359
        {
6360 90e7968d ljiyeon
            try
6361 5b46312f djkim
            {
6362 90e7968d ljiyeon
                if (e.Data.GetDataPresent(typeof(string)))
6363
                {
6364
                    this.getCurrentPoint = e.GetPosition(drawingRotateCanvas);
6365
                    string dragData = e.Data.GetData(typeof(string)) as string;
6366
                    Move_Symbol(sender, dragData);
6367
                }
6368 5b46312f djkim
            }
6369 90e7968d ljiyeon
            catch (Exception ex)
6370
            {
6371 664ea2e1 taeseongkim
                //Logger.sendResLog("zoomAndPanControl_Drop", ex.ToString(), 0);
6372 233ef333 taeseongkim
            }
6373 5b46312f djkim
        }
6374 e6a9ddaf humkyung
        */
6375 787a4489 KangIngu
    }
6376 f65e6c02 taeseongkim
6377
    public class testItem
6378
    {
6379
        public string Title { get; set; }
6380
    }
6381 26ec6226 taeseongkim
6382
6383 233ef333 taeseongkim
}
클립보드 이미지 추가 (최대 크기: 500 MB)