프로젝트

일반

사용자정보

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

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

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