프로젝트

일반

사용자정보

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

markus / KCOM / Views / MainMenu.xaml.cs @ 552af7c7

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

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