프로젝트

일반

사용자정보

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

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

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