프로젝트

일반

사용자정보

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

markus / KCOM / Views / MainMenu.xaml.cs @ 43e1d368

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