프로젝트

일반

사용자정보

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

markus / KCOM / Views / MainMenu.xaml.cs @ 646a4bb9

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