프로젝트

일반

사용자정보

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

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

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