프로젝트

일반

사용자정보

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

markus / KCOM / Views / MainMenu.xaml.cs @ 4fcb686a

이력 | 보기 | 이력해설 | 다운로드 (279 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 168f8027 taeseongkim
                    }
1781
1782 233ef333 taeseongkim
                    #endregion // 모든 컨트롤의 공통기능 제어
1783 168f8027 taeseongkim
1784
                    #region // 각 컨트롤의 특별한 기능을 제어한다.
1785
1786 787a4489 KangIngu
                    switch (controlType)
1787
                    {
1788 684ef11c ljiyeon
                        case (ControlType.Coordinate):
1789
                            {
1790
                                var control = currentControl as CoordinateControl;
1791
                                if (control != null)
1792
                                {
1793 168f8027 taeseongkim
                                    //control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1794 684ef11c ljiyeon
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1795
                                    control.Paint = ViewerDataModel.Instance.paintSet;
1796
                                }
1797
                            }
1798
                            break;
1799 233ef333 taeseongkim
1800 684ef11c ljiyeon
                        case (ControlType.InsideWhite):
1801
                            {
1802
                                var control = currentControl as InsideWhiteControl;
1803
                                if (control != null)
1804
                                {
1805 168f8027 taeseongkim
                                    //control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1806 684ef11c ljiyeon
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1807
                                    control.Paint = ViewerDataModel.Instance.paintSet;
1808
                                    control.Paint = PaintSet.Fill;
1809
                                }
1810
                            }
1811
                            break;
1812 233ef333 taeseongkim
1813 a6272c57 humkyung
                        case ControlType.OverlapWhite:
1814 684ef11c ljiyeon
                            {
1815
                                var control = currentControl as OverlapWhiteControl;
1816
                                if (control != null)
1817
                                {
1818 168f8027 taeseongkim
                                    //control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1819 684ef11c ljiyeon
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1820
                                    control.Paint = ViewerDataModel.Instance.paintSet;
1821
                                    control.Paint = PaintSet.Fill;
1822
                                }
1823
                            }
1824
                            break;
1825 233ef333 taeseongkim
1826 a6272c57 humkyung
                        case ControlType.ClipWhite:
1827 684ef11c ljiyeon
                            {
1828
                                var control = currentControl as ClipWhiteControl;
1829
                                if (control != null)
1830
                                {
1831 168f8027 taeseongkim
                                    //control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1832 684ef11c ljiyeon
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1833
                                    control.Paint = ViewerDataModel.Instance.paintSet;
1834
                                    control.Paint = PaintSet.Fill;
1835
                                }
1836
                            }
1837
                            break;
1838 233ef333 taeseongkim
1839 787a4489 KangIngu
                        case ControlType.RectCloud:
1840
                            {
1841
                                var control = currentControl as RectCloudControl;
1842
                                if (control != null)
1843
                                {
1844 168f8027 taeseongkim
                                    //control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1845 787a4489 KangIngu
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1846
                                    control.Paint = ViewerDataModel.Instance.paintSet;
1847
                                }
1848
                            }
1849
                            break;
1850 233ef333 taeseongkim
1851 787a4489 KangIngu
                        case ControlType.SingleLine:
1852
                        case ControlType.CancelLine:
1853
                        case ControlType.ArrowLine:
1854
                        case ControlType.TwinLine:
1855
                        case ControlType.DimLine:
1856
                            {
1857 d71ee575 djkim
                                var control = currentControl as LineControl;
1858
                                if (control != null)
1859 787a4489 KangIngu
                                {
1860 168f8027 taeseongkim
                                    //control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1861 787a4489 KangIngu
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1862
                                }
1863
                            }
1864
                            break;
1865
1866
                        case ControlType.ArcLine:
1867
                            {
1868 d71ee575 djkim
                                var control = currentControl as ArcControl;
1869
                                if (control != null)
1870 787a4489 KangIngu
                                {
1871 168f8027 taeseongkim
                                    //control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1872 787a4489 KangIngu
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1873
                                }
1874
                            }
1875
                            break;
1876
1877
                        case ControlType.ArcArrow:
1878
                            {
1879 40b3ce25 ljiyeon
                                var control = currentControl as ArrowArcControl;
1880 d71ee575 djkim
                                if (control != null)
1881 787a4489 KangIngu
                                {
1882 168f8027 taeseongkim
                                    //control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1883 787a4489 KangIngu
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1884
                                }
1885
                            }
1886
                            break;
1887
1888
                        case ControlType.ArrowMultiLine:
1889
                            {
1890 d71ee575 djkim
                                var control = currentControl as ArrowControl_Multi;
1891
                                if (control != null)
1892 787a4489 KangIngu
                                {
1893 168f8027 taeseongkim
                                    //control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1894 787a4489 KangIngu
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1895
                                }
1896
                            }
1897
                            break;
1898
1899
                        case ControlType.Circle:
1900
                            {
1901 168f8027 taeseongkim
                                var control = currentControl as CircleControl;
1902
1903
                                if (control != null)
1904 787a4489 KangIngu
                                {
1905 168f8027 taeseongkim
                                    //control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1906
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1907
                                    control.Paint = ViewerDataModel.Instance.paintSet;
1908 787a4489 KangIngu
                                }
1909
                            }
1910
                            break;
1911
1912
                        case ControlType.PolygonCloud:
1913
                            {
1914
                                var control = currentControl as CloudControl;
1915
                                if (control != null)
1916
                                {
1917 168f8027 taeseongkim
                                    //control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1918 787a4489 KangIngu
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1919
                                    control.Paint = ViewerDataModel.Instance.paintSet;
1920
                                }
1921
                            }
1922
                            break;
1923
1924
                        case ControlType.Triangle:
1925
                            {
1926
                                var control = currentControl as TriControl;
1927
                                if (control != null)
1928
                                {
1929 168f8027 taeseongkim
                                    //control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1930 787a4489 KangIngu
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1931
                                    control.Paint = ViewerDataModel.Instance.paintSet;
1932
                                }
1933
                            }
1934
                            break;
1935
1936
                        case ControlType.ImgControl:
1937
                            {
1938
                                var control = currentControl as ImgControl;
1939
                                if (control != null)
1940
                                {
1941 168f8027 taeseongkim
                                    //control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1942 787a4489 KangIngu
                                }
1943
                            }
1944
                            break;
1945
1946
                        case ControlType.Date:
1947
                            {
1948
                                var control = currentControl as DateControl;
1949
                                if (control != null)
1950
                                {
1951 168f8027 taeseongkim
                                    //control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1952 787a4489 KangIngu
                                }
1953
                            }
1954
                            break;
1955
1956
                        case ControlType.ArrowTextControl:
1957
                        case ControlType.ArrowTransTextControl:
1958
                        case ControlType.ArrowTextBorderControl:
1959
                        case ControlType.ArrowTransTextBorderControl:
1960
                        case ControlType.ArrowTextCloudControl:
1961
                        case ControlType.ArrowTransTextCloudControl:
1962
                            {
1963
                                var control = currentControl as ArrowTextControl;
1964
                                if (control != null)
1965
                                {
1966 168f8027 taeseongkim
                                    //control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1967 787a4489 KangIngu
                                }
1968
                            }
1969
                            break;
1970 233ef333 taeseongkim
1971 787a4489 KangIngu
                        case ControlType.PolygonControl:
1972 e6a9ddaf humkyung
                        case ControlType.ChainLine:
1973 787a4489 KangIngu
                            {
1974
                                var control = currentControl as PolygonControl;
1975
                                if (control != null)
1976
                                {
1977 168f8027 taeseongkim
                                    //control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1978 787a4489 KangIngu
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1979
                                    control.Paint = ViewerDataModel.Instance.paintSet;
1980
                                }
1981
                            }
1982
                            break;
1983 233ef333 taeseongkim
1984 787a4489 KangIngu
                        case ControlType.Sign:
1985
                            {
1986
                                var control = currentControl as SignControl;
1987
                                if (control != null)
1988
                                {
1989 168f8027 taeseongkim
                                    //control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1990 787a4489 KangIngu
                                }
1991
                            }
1992
                            break;
1993 233ef333 taeseongkim
1994 787a4489 KangIngu
                        case ControlType.Symbol:
1995
                            {
1996
                                var control = currentControl as SymControl;
1997
                                if (control != null)
1998
                                {
1999 168f8027 taeseongkim
                                    //control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
2000 787a4489 KangIngu
                                }
2001
                            }
2002
                            break;
2003 233ef333 taeseongkim
2004 787a4489 KangIngu
                        case ControlType.Stamp:
2005
                            {
2006 cd988cd8 djkim
                                var control = currentControl as SymControlN;
2007
                                if (control != null)
2008 787a4489 KangIngu
                                {
2009 cd988cd8 djkim
                                    if (control.STAMP != null)
2010 cbaa3c91 ljiyeon
                                    {
2011 168f8027 taeseongkim
                                        //control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
2012 cbaa3c91 ljiyeon
                                    }
2013 cd988cd8 djkim
                                    else
2014
                                    {
2015
                                        currentControl = null;
2016 902faaea taeseongkim
                                        this.cursor = new Cursor(App.DefaultArrowCursorStream);
2017 cd988cd8 djkim
                                        DialogMessage_Alert("Approved Stamp 가 등록되어 있지 않습니다. \n관리자에게 문의하세요.", "안내");
2018
                                    }
2019 168f8027 taeseongkim
                                }
2020 787a4489 KangIngu
                            }
2021
                            break;
2022 233ef333 taeseongkim
2023 a6272c57 humkyung
                        case ControlType.Rectangle:
2024 787a4489 KangIngu
                        case ControlType.Mark:
2025
                            {
2026
                                var control = currentControl as RectangleControl;
2027
                                if (control != null)
2028
                                {
2029 168f8027 taeseongkim
                                    //control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
2030
                                    if (control.ControlType == ControlType.Mark) control.Paint = PaintSet.Fill;
2031 7a5210f1 humkyung
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
2032 787a4489 KangIngu
                                }
2033
                            }
2034
                            break;
2035 233ef333 taeseongkim
2036 787a4489 KangIngu
                        case ControlType.PenControl:
2037
                            {
2038
                                stroke.StylusPoints.Add(new StylusPoint(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y));
2039
                                //inkBoard.Strokes.Add(stroke);
2040
                            }
2041
                            break;
2042 233ef333 taeseongkim
2043 787a4489 KangIngu
                        default:
2044
                            break;
2045
                    }
2046 168f8027 taeseongkim
2047 233ef333 taeseongkim
                    #endregion // 각 컨트롤의 특별한 기능을 제어한다.
2048
2049 4f017ed3 taeseongkim
                    if (ViewerDataModel.Instance.MarkupAngleVisibility == Visibility.Visible)
2050 168f8027 taeseongkim
                    {
2051 4f017ed3 taeseongkim
                        ViewerDataModel.Instance.MarkupAngle = currentControl.CommentAngle;
2052 168f8027 taeseongkim
                    }
2053 787a4489 KangIngu
                }
2054
            }
2055 233ef333 taeseongkim
            else if (mouseHandlingMode == MouseHandlingMode.Drawing && e.LeftButton == MouseButtonState.Pressed)
2056 29cf2c0c humkyung
            {
2057
                Point currentCanvasDrawingMouseMovePoint = e.GetPosition(drawingRotateCanvas);
2058
                Point currentCanvasZoomPanningMouseMovePoint = e.GetPosition(zoomAndPanCanvas);
2059
                SetCursor();
2060
                if (currentControl == null)
2061
                {
2062
                    switch (controlType)
2063
                    {
2064
                        case ControlType.PenControl:
2065
                            {
2066
                                if (inkBoard.Tag.ToString() == "Ink")
2067
                                {
2068
                                    stroke.StylusPoints.Add(new StylusPoint(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y));
2069
                                }
2070
                                else if (inkBoard.Tag.ToString() == "EraseByPoint")
2071
                                {
2072
                                    RemovePointStroke(currentCanvasDrawingMouseMovePoint);
2073
                                }
2074
                                else if (inkBoard.Tag.ToString() == "EraseByStroke")
2075
                                {
2076
                                    RemoveLineStroke(currentCanvasDrawingMouseMovePoint);
2077
                                }
2078
2079
                                //inkBoard.Strokes.Add(stroke);
2080
                            }
2081
                            break;
2082
                    }
2083
                    return;
2084
                }
2085
            }
2086 233ef333 taeseongkim
            else if (((e.LeftButton == MouseButtonState.Pressed) && mouseHandlingMode == MouseHandlingMode.Selecting) ||
2087
                ((e.LeftButton == MouseButtonState.Pressed) && mouseHandlingMode == MouseHandlingMode.Capture) ||
2088 e6a9ddaf humkyung
                ((e.LeftButton == MouseButtonState.Pressed) && mouseHandlingMode == MouseHandlingMode.DragZoom))
2089 787a4489 KangIngu
            {
2090
                Point curMouseDownPoint = e.GetPosition(drawingRotateCanvas);
2091
2092
                if (isDraggingSelectionRect)
2093
                {
2094 c7fde400 taeseongkim
                    UpdateDragSelectionRect(CanvasDrawingMouseDownPoint, curMouseDownPoint);
2095 787a4489 KangIngu
                    e.Handled = true;
2096
                }
2097
                else if (isLeftMouseButtonDownOnWindow)
2098
                {
2099 c7fde400 taeseongkim
                    var dragDelta = curMouseDownPoint - CanvasDrawingMouseDownPoint;
2100 787a4489 KangIngu
                    double dragDistance = Math.Abs(dragDelta.Length);
2101
2102
                    if (dragDistance > DragThreshold)
2103
                    {
2104
                        isDraggingSelectionRect = true;
2105 c7fde400 taeseongkim
                        InitDragSelectionRect(CanvasDrawingMouseDownPoint, curMouseDownPoint);
2106 787a4489 KangIngu
                    }
2107
2108
                    e.Handled = true;
2109
                }
2110
2111 c7fde400 taeseongkim
                if (CanvasDrawingMouseDownPoint == curMouseDownPoint)
2112 787a4489 KangIngu
                {
2113
                }
2114
                else
2115
                {
2116
                    e.Handled = true;
2117
                }
2118
            }
2119 7211e0c2 ljiyeon
            /*
2120 e6a9ddaf humkyung
            else if ((e.LeftButton == MouseButtonState.Pressed) && mouseHandlingMode == MouseHandlingMode.DragSymbol)
2121 233ef333 taeseongkim
            { //symbol
2122 53880c83 ljiyeon
                if(_dragdropWindow != null)
2123
                {
2124
                    Win32Point w32Mouse = new Win32Point();
2125
                    GetCursorPos(ref w32Mouse);
2126
2127
                    this._dragdropWindow.Left = w32Mouse.X - (symbol_img.Width / 2);
2128
                    this._dragdropWindow.Top = w32Mouse.Y - (symbol_img.Height / 2);
2129 233ef333 taeseongkim
                }
2130 53880c83 ljiyeon
            }
2131 7211e0c2 ljiyeon
            */
2132 233ef333 taeseongkim
            else if ((e.LeftButton == MouseButtonState.Released) && (e.MiddleButton == MouseButtonState.Released) &&
2133 e6a9ddaf humkyung
                (e.RightButton == MouseButtonState.Released) && ViewerDataModel.Instance.MarkupControls_USER.Count > 0)
2134 787a4489 KangIngu
            {
2135 a342d378 taeseongkim
                var control = ViewerDataModel.Instance.MarkupControls_USER.Where(data => data.IsMouseEnter).FirstOrDefault();
2136 233ef333 taeseongkim
                if (control != null)
2137 787a4489 KangIngu
                {
2138
                    this.cursor = Cursors.Hand;
2139
                    SetCursor();
2140
                }
2141
                else
2142
                {
2143 902faaea taeseongkim
                    if (this.Cursor != Cursors.None)
2144
                    {
2145
                        this.cursor = new Cursor(App.DefaultArrowCursorStream);
2146
                        SetCursor();
2147
                    }
2148 787a4489 KangIngu
                }
2149
            }
2150
            else
2151
            {
2152
            }
2153
        }
2154
2155 a1716fa5 KangIngu
        private void zoomAndPanControl2_MouseMove(object sender, MouseEventArgs e)
2156
        {
2157 e6a9ddaf humkyung
            if ((e.MiddleButton == MouseButtonState.Pressed) || (e.RightButton == MouseButtonState.Pressed))
2158 a1716fa5 KangIngu
            {
2159
                SetCursor();
2160
                Point currentCanvasDrawingMouseMovePoint = e.GetPosition(drawingRotateCanvas2);
2161
                Point currentCanvasZoomPanningMouseMovePoint = e.GetPosition(zoomAndPanCanvas2);
2162
2163
                Vector dragOffset = currentCanvasZoomPanningMouseMovePoint - canvasZoommovingMouseDownPoint;
2164
2165
                ViewerDataModel.Instance.Sync_ContentOffsetX -= dragOffset.X;
2166
                ViewerDataModel.Instance.Sync_ContentOffsetY -= dragOffset.Y;
2167
2168
                if (Sync.IsChecked)
2169
                {
2170
                    zoomAndPanControl.ContentOffsetX = ViewerDataModel.Instance.Sync_ContentOffsetX;
2171
                    zoomAndPanControl.ContentOffsetY = ViewerDataModel.Instance.Sync_ContentOffsetY;
2172
                }
2173
            }
2174
        }
2175
2176 787a4489 KangIngu
        private List<CommentUserInfo> hitList = new List<CommentUserInfo>();
2177
2178
        private EllipseGeometry hitArea = new EllipseGeometry();
2179
2180
        private void zoomAndPanControl_MouseUp(object sender, MouseButtonEventArgs e)
2181
        {
2182
            IsDrawing = false;
2183 233ef333 taeseongkim
2184 787a4489 KangIngu
            if (mouseHandlingMode != MouseHandlingMode.None)
2185
            {
2186
                if (mouseHandlingMode == MouseHandlingMode.Drawing)
2187
                {
2188 902faaea taeseongkim
                    this.cursor = new Cursor(App.DefaultArrowCursorStream);
2189 787a4489 KangIngu
2190
                    SetCursor();
2191
2192
                    switch (controlType)
2193
                    {
2194
                        case ControlType.None:
2195
                            break;
2196 233ef333 taeseongkim
2197 787a4489 KangIngu
                        case ControlType.Rectangle:
2198
                            {
2199
                            }
2200
                            break;
2201 233ef333 taeseongkim
2202 787a4489 KangIngu
                        case ControlType.PenControl:
2203
                            {
2204
                            }
2205
                            break;
2206 233ef333 taeseongkim
2207 787a4489 KangIngu
                        default:
2208
                            break;
2209 233ef333 taeseongkim
                    }
2210 787a4489 KangIngu
                }
2211 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)
2212 787a4489 KangIngu
                {
2213
                    if (isLeftMouseButtonDownOnWindow)
2214
                    {
2215
                        bool wasDragSelectionApplied = false;
2216
2217
                        if (isDraggingSelectionRect)
2218
                        {
2219 53880c83 ljiyeon
                            if (mouseHandlingMode == MouseHandlingMode.Capture && controlType == ControlType.ImgControl)
2220
                            {
2221
                                dragCaptureBorder.Visibility = Visibility.Collapsed;
2222
                                mouseHandlingMode = MouseHandlingMode.None;
2223
                                Point endPoint = e.GetPosition(zoomAndPanCanvas);
2224
                                symbolselectindex = symbolPanel_Instance.RadTab.SelectedIndex;
2225
                                Set_Symbol_Capture(endPoint);
2226
                                ViewerDataModel.Instance.ViewVisible = Visibility.Collapsed;
2227 233ef333 taeseongkim
                                ViewerDataModel.Instance.ViewVisible = Visibility.Visible;
2228 53880c83 ljiyeon
                                ViewerDataModel.Instance.Capture_Opacity = 0;
2229
                            }
2230
                            else if (mouseHandlingMode == MouseHandlingMode.Capture)
2231 787a4489 KangIngu
                            {
2232
                                dragCaptureBorder.Visibility = Visibility.Collapsed;
2233
                                mouseHandlingMode = MouseHandlingMode.None;
2234
                                Set_Capture();
2235
2236
                                ViewerDataModel.Instance.ViewVisible = Visibility.Collapsed;
2237
                                ViewerDataModel.Instance.ViewVisible = Visibility.Visible;
2238
                                ViewerDataModel.Instance.Capture_Opacity = 0;
2239
                            }
2240 9f473fb7 KangIngu
                            else if (mouseHandlingMode == MouseHandlingMode.Selecting)
2241 787a4489 KangIngu
                            {
2242
                                ApplyDragSelectionRect();
2243
                            }
2244 9f473fb7 KangIngu
                            else
2245
                            {
2246
                                double x = Canvas.GetLeft(dragZoomBorder);
2247
                                double y = Canvas.GetTop(dragZoomBorder);
2248
                                double width = dragZoomBorder.Width;
2249
                                double height = dragZoomBorder.Height;
2250
                                Rect dragRect = new Rect(x, y, width, height);
2251
2252
                                ViewerDataModel.Instance.SystemMain.dzMainMenu.zoomAndPanControl.ZoomTo(dragRect);
2253
2254
                                dragZoomBorder.Visibility = Visibility.Collapsed;
2255
                            }
2256 787a4489 KangIngu
2257 9f473fb7 KangIngu
                            isDraggingSelectionRect = false;
2258 787a4489 KangIngu
                            e.Handled = true;
2259
                            wasDragSelectionApplied = true;
2260
                        }
2261
2262
                        if (isLeftMouseButtonDownOnWindow)
2263
                        {
2264
                            isLeftMouseButtonDownOnWindow = false;
2265
                            this.ReleaseMouseCapture();
2266
                            e.Handled = true;
2267
                        }
2268
2269
                        if (!wasDragSelectionApplied)
2270
                        {
2271
                            init();
2272
                        }
2273
                    }
2274
                }
2275 e6a9ddaf humkyung
                else if (e.RightButton == MouseButtonState.Pressed)
2276 787a4489 KangIngu
                {
2277 902faaea taeseongkim
                    this.cursor = new Cursor(App.DefaultArrowCursorStream);
2278 787a4489 KangIngu
                    SetCursor();
2279
                }
2280
2281
                zoomAndPanControl.ReleaseMouseCapture();
2282
2283
                e.Handled = true;
2284
            }
2285
            else
2286
            {
2287 902faaea taeseongkim
                this.cursor = new Cursor(App.DefaultArrowCursorStream);
2288 787a4489 KangIngu
                SetCursor();
2289
            }
2290
2291 e6a9ddaf humkyung
            ///mouseButtonDown = MouseButton.Left;
2292 787a4489 KangIngu
            //controlType = ControlType.SingleLine;
2293
        }
2294
2295 53880c83 ljiyeon
        public void Set_Symbol_Capture(Point endPoint)
2296 233ef333 taeseongkim
        {
2297 c7fde400 taeseongkim
            double x = CanvasDrawingMouseDownPoint.X;
2298
            double y = CanvasDrawingMouseDownPoint.Y;
2299 233ef333 taeseongkim
            if (x > endPoint.X)
2300 53880c83 ljiyeon
            {
2301
                x = endPoint.X;
2302
                y = endPoint.Y;
2303
            }
2304
2305
            double width = dragCaptureBorder.Width;
2306
            double height = dragCaptureBorder.Height;
2307
2308
            canvasImage = ConverterBitmapImage(zoomAndPanCanvas);
2309
2310
            if (x < 0)
2311
            {
2312
                width += x;
2313
                x = 0;
2314
            }
2315
            if (y < 0)
2316
            {
2317
                height += y;
2318
                y = 0;
2319
2320
                width = (int)canvasImage.PixelWidth - x;
2321
            }
2322
            if (x + width > canvasImage.PixelWidth)
2323
            {
2324
                width = (int)canvasImage.PixelWidth - x;
2325
            }
2326
            if (y + height > canvasImage.PixelHeight)
2327
            {
2328
                height = (int)canvasImage.PixelHeight - y;
2329
            }
2330
            var rect = new Int32Rect((int)x, (int)y, (int)width, (int)height);
2331
2332 69f41aab humkyung
            string uri = this.GetImageURL(_ViewInfo.DocumentItemID, Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber);
2333 53880c83 ljiyeon
            var defaultBitmapImage = new BitmapImage();
2334
            defaultBitmapImage.BeginInit();
2335
            defaultBitmapImage.CreateOptions = BitmapCreateOptions.IgnoreImageCache;
2336
            defaultBitmapImage.CacheOption = BitmapCacheOption.OnLoad;
2337
            defaultBitmapImage.UriSource = new Uri(uri);
2338
            defaultBitmapImage.EndInit();
2339
2340 90e7968d ljiyeon
            //GC.Collect();
2341 53880c83 ljiyeon
2342
            if (defaultBitmapImage.IsDownloading)
2343
            {
2344
                defaultBitmapImage.DownloadCompleted += (ex, arg) =>
2345
                {
2346
                    defaultBitmapImage.Freeze();
2347 90e7968d ljiyeon
                    //GC.Collect();
2348 53880c83 ljiyeon
                    BitmapSource bs = new CroppedBitmap(defaultBitmapImage, rect);
2349
                    Save_Symbol_Capture(bs, (int)x, (int)y, (int)width, (int)height);
2350
                };
2351
            }
2352
        }
2353
2354 a1716fa5 KangIngu
        private void zoomAndPanControl2_MouseUp(object sender, MouseButtonEventArgs e)
2355
        {
2356 e6a9ddaf humkyung
            ///mouseButtonDown = MouseButton.Left;
2357 a1716fa5 KangIngu
        }
2358
2359 787a4489 KangIngu
        private void zoomAndPanControl_MouseLeave(object sender, MouseEventArgs e)
2360
        {
2361 e6a9ddaf humkyung
            ///mouseButtonDown = MouseButton.Left;
2362 902faaea taeseongkim
            //this.cursor = new Cursor(App.DefaultArrowCursorStream);
2363 787a4489 KangIngu
        }
2364
2365
        private void zoomAndPanControl_MouseDoubleClick(object sender, MouseButtonEventArgs e)
2366
        {
2367
        }
2368
2369 4804a4fb humkyung
        /// <summary>
2370
        /// select items by dragging
2371
        /// </summary>
2372 787a4489 KangIngu
        private void ApplyDragSelectionRect()
2373
        {
2374
            dragSelectionBorder.Visibility = Visibility.Collapsed;
2375
2376
            double x = Canvas.GetLeft(dragSelectionBorder);
2377
            double y = Canvas.GetTop(dragSelectionBorder);
2378
            double width = dragSelectionBorder.Width;
2379
            double height = dragSelectionBorder.Height;
2380
            Boolean Flag = false;
2381
            List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>();
2382 f87a00b1 ljiyeon
            var Items = ViewerDataModel.Instance.MarkupControls_USER.Where(d => d.Visibility != Visibility.Hidden).ToList();
2383 787a4489 KangIngu
2384 e6a9ddaf humkyung
            Rect dragRect = new Rect(x, y, width, height);
2385
            ///dragRect.Inflate(width / 10, height / 10);
2386 787a4489 KangIngu
2387
            foreach (var item in Items)
2388
            {
2389 91efe37a humkyung
                Flag = SelectionSet.Instance.SelectControl(item, dragRect);
2390 787a4489 KangIngu
2391
                if (Flag)
2392
                {
2393
                    adornerSet.Add(item);
2394 05009a0e ljiyeon
                    ViewerDataModel.Instance.MarkupControls_USER.Remove(item);
2395 787a4489 KangIngu
                    Control_Style(item);
2396
                }
2397
            }
2398
            if (adornerSet.Count > 0)
2399
            {
2400
                Controls.AdornerFinal final = new Controls.AdornerFinal(adornerSet);
2401
                SelectLayer.Children.Add(final);
2402
            }
2403
        }
2404
2405
        private void InitDragSelectionRect(Point pt1, Point pt2)
2406
        {
2407 9f473fb7 KangIngu
            //캡쳐 중
2408
            if (mouseHandlingMode == MouseHandlingMode.Capture)
2409
            {
2410
                dragCaptureBorder.Visibility = Visibility.Visible;
2411
            }
2412 787a4489 KangIngu
            //선택 중
2413 9f473fb7 KangIngu
            else if (mouseHandlingMode == MouseHandlingMode.Selecting)
2414 787a4489 KangIngu
            {
2415
                dragSelectionBorder.Visibility = Visibility.Visible;
2416
            }
2417
            else
2418
            {
2419 9f473fb7 KangIngu
                dragZoomBorder.Visibility = Visibility.Visible;
2420 787a4489 KangIngu
            }
2421
            UpdateDragSelectionRect(pt1, pt2);
2422
        }
2423
2424
        /// <summary>
2425
        /// Update the position and size of the rectangle used for drag selection.
2426
        /// </summary>
2427
        private void UpdateDragSelectionRect(Point pt1, Point pt2)
2428
        {
2429
            double x, y, width, height;
2430
2431
            //
2432
            // Determine x,y,width and height of the rect inverting the points if necessary.
2433 233ef333 taeseongkim
            //
2434 787a4489 KangIngu
2435
            if (pt2.X < pt1.X)
2436
            {
2437
                x = pt2.X;
2438
                width = pt1.X - pt2.X;
2439
            }
2440
            else
2441
            {
2442
                x = pt1.X;
2443
                width = pt2.X - pt1.X;
2444
            }
2445
2446
            if (pt2.Y < pt1.Y)
2447
            {
2448
                y = pt2.Y;
2449
                height = pt1.Y - pt2.Y;
2450
            }
2451
            else
2452
            {
2453
                y = pt1.Y;
2454
                height = pt2.Y - pt1.Y;
2455
            }
2456
2457
            //
2458
            // Update the coordinates of the rectangle used for drag selection.
2459
            //
2460 9f473fb7 KangIngu
            //캡쳐 중
2461
            if (mouseHandlingMode == MouseHandlingMode.Capture)
2462
            {
2463
                Canvas.SetLeft(dragCaptureBorder, x);
2464
                Canvas.SetTop(dragCaptureBorder, y);
2465
                dragCaptureBorder.Width = width;
2466
                dragCaptureBorder.Height = height;
2467
            }
2468 787a4489 KangIngu
            //선택 중
2469 a1716fa5 KangIngu
            else if (mouseHandlingMode == MouseHandlingMode.Selecting)
2470 787a4489 KangIngu
            {
2471
                Canvas.SetLeft(dragSelectionBorder, x);
2472
                Canvas.SetTop(dragSelectionBorder, y);
2473
                dragSelectionBorder.Width = width;
2474
                dragSelectionBorder.Height = height;
2475
            }
2476
            else
2477
            {
2478 9f473fb7 KangIngu
                Canvas.SetLeft(dragZoomBorder, x);
2479
                Canvas.SetTop(dragZoomBorder, y);
2480
                dragZoomBorder.Width = width;
2481
                dragZoomBorder.Height = height;
2482 787a4489 KangIngu
            }
2483
        }
2484
2485
        private void drawingPannelRotate(double angle)
2486
        {
2487 548c696e ljiyeon
            Logger.sendCheckLog("pageNavigator_PageChanging_drawingPannelRotate Setting", 1);
2488 787a4489 KangIngu
            rotate.Angle = angle;
2489
            var rotationNum = Math.Abs((rotate.Angle / 90));
2490
2491
            if (angle == 90 || angle == 270)
2492
            {
2493
                double emptySize = zoomAndPanCanvas.Width;
2494
                zoomAndPanCanvas.Width = zoomAndPanCanvas.Height;
2495
                zoomAndPanCanvas.Height = emptySize;
2496
            }
2497
            if (angle == 0)
2498
            {
2499
                translate.X = 0;
2500
                translate.Y = 0;
2501
            }
2502
            else if (angle == 90)
2503
            {
2504
                translate.X = zoomAndPanCanvas.Width;
2505
                translate.Y = 0;
2506
            }
2507
            else if (angle == 180)
2508
            {
2509
                translate.X = zoomAndPanCanvas.Width;
2510
                translate.Y = zoomAndPanCanvas.Height;
2511
            }
2512
            else
2513
            {
2514
                translate.X = 0;
2515
                translate.Y = zoomAndPanCanvas.Height;
2516
            }
2517
2518
            zoomAndPanControl.RotationAngle = rotate.Angle;
2519
2520
            if (!testPanel2.IsHidden)
2521
            {
2522
                zoomAndPanControl2.RotationAngle = rotate.Angle;
2523
                zoomAndPanCanvas2.Width = zoomAndPanCanvas.Width;
2524
                zoomAndPanCanvas2.Height = zoomAndPanCanvas.Height;
2525
            }
2526
2527
            ViewerDataModel.Instance.ContentWidth = zoomAndPanCanvas.Width;
2528
            ViewerDataModel.Instance.ContentHeight = zoomAndPanCanvas.Height;
2529
            ViewerDataModel.Instance.AngleOffsetX = translate.X;
2530
            ViewerDataModel.Instance.AngleOffsetY = translate.Y;
2531 4f017ed3 taeseongkim
            ViewerDataModel.Instance.MarkupAngle = rotate.Angle;
2532 787a4489 KangIngu
        }
2533
2534 497bbe52 ljiyeon
        private void syncPannelRotate(double angle)
2535
        {
2536
            //Logger.sendCheckLog("pageNavigator_PageChanging_drawingPannelRotate Setting", 1);
2537
            rotate.Angle = angle;
2538
            var rotationNum = Math.Abs((rotate.Angle / 90));
2539
2540
            if (angle == 90 || angle == 270)
2541
            {
2542
                double emptySize = zoomAndPanCanvas2.Width;
2543
                zoomAndPanCanvas2.Width = zoomAndPanCanvas2.Height;
2544
                zoomAndPanCanvas2.Height = emptySize;
2545
            }
2546
            if (angle == 0)
2547
            {
2548
                translate2.X = 0;
2549
                translate2.Y = 0;
2550
            }
2551
            else if (angle == 90)
2552
            {
2553
                translate2.X = zoomAndPanCanvas2.Width;
2554
                translate2.Y = 0;
2555
            }
2556
            else if (angle == 180)
2557
            {
2558
                translate2.X = zoomAndPanCanvas2.Width;
2559
                translate2.Y = zoomAndPanCanvas2.Height;
2560
            }
2561
            else
2562
            {
2563
                translate2.X = 0;
2564
                translate2.Y = zoomAndPanCanvas2.Height;
2565
            }
2566
2567
            zoomAndPanControl2.RotationAngle = rotate.Angle;
2568
        }
2569
2570 53880c83 ljiyeon
        public void PlaceImageSymbol(string id, long group_id, int SelectedIndex, Point canvasZoomPanningMouseDownPoint)
2571 787a4489 KangIngu
        {
2572 53880c83 ljiyeon
            string Data_ = "";
2573
2574
            try
2575
            {
2576 664ea2e1 taeseongkim
                //Logger.sendReqLog("GetSymbolImageURL: ", id + "," + SelectedIndex, 1);
2577 53880c83 ljiyeon
                Data_ = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.GetSymbolImageURL(id, SelectedIndex);
2578
                if (Data_ != null || Data_ != "")
2579
                {
2580 664ea2e1 taeseongkim
                    //Logger.sendResLog("GetSymbolImageURL", "TRUE", 1);
2581 53880c83 ljiyeon
                }
2582
                else
2583
                {
2584 664ea2e1 taeseongkim
                    //Logger.sendResLog("GetSymbolImageURL", "FALSE", 1);
2585 53880c83 ljiyeon
                }
2586
2587 c0977e97 djkim
                //MARKUP_DATA_GROUP mARKUP_DATA_GROUP = new MARKUP_DATA_GROUP
2588
                //{
2589
                //    SYMBOL_ID = id,//InnerItem.Symbol_ID
2590
                //    STATE = 0,
2591
                //};
2592 53880c83 ljiyeon
                if (Data_ != null)
2593
                {
2594
                    Image img = new Image();
2595
                    //img.Source = new System.Windows.Media.Imaging.BitmapImage(new Uri(Data_));
2596
                    if (Data_.Contains(".svg"))
2597
                    {
2598
                        byte[] imageData = null;
2599
                        DrawingImage image = null;
2600
                        using (System.Net.WebClient web = new System.Net.WebClient())
2601
                        {
2602
                            imageData = web.DownloadData(new Uri(Data_));
2603
                            System.IO.Stream stream = new System.IO.MemoryStream(imageData);
2604
                            image = SvgReader.Load(stream);
2605
                        }
2606
                        img.Source = image;
2607
                    }
2608
                    else
2609
                    {
2610
                        img.Source = new BitmapImage(new Uri(Data_));
2611
                    }
2612
2613
                    var currentControl = new MarkupToPDF.Controls.Etc.ImgControl
2614
                    {
2615
                        PointSet = new List<Point>(),
2616
                        FilePath = Data_,
2617
                        ImageData = img.Source,
2618
                        StartPoint = canvasZoomPanningMouseDownPoint,
2619 233ef333 taeseongkim
                        EndPoint = new Point(canvasZoomPanningMouseDownPoint.X + img.Source.Width,
2620 53880c83 ljiyeon
                        canvasZoomPanningMouseDownPoint.Y + img.Source.Height),
2621 233ef333 taeseongkim
                        TopRightPoint = new Point(canvasZoomPanningMouseDownPoint.X + img.Source.Width,
2622 53880c83 ljiyeon
                        canvasZoomPanningMouseDownPoint.Y),
2623
                        LeftBottomPoint = new Point(canvasZoomPanningMouseDownPoint.X,
2624
                        canvasZoomPanningMouseDownPoint.Y + img.Source.Height)
2625
                    };
2626
2627
                    currentControl.PointSet = new List<Point>
2628
                                        {
2629
                                            currentControl.StartPoint,
2630
                                            currentControl.LeftBottomPoint,
2631
                                            currentControl.EndPoint,
2632
                                            currentControl.TopRightPoint,
2633
                                        };
2634
                    Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
2635
                    UndoData = new Undo_data()
2636
                    {
2637
                        IsUndo = false,
2638
                        Event = Event_Type.Create,
2639
                        EventTime = DateTime.Now,
2640
                        Markup_List = new List<Multi_Undo_data>()
2641
                    };
2642
                    ViewerDataModel.Instance.UndoDataList.Where(data1 => data1.IsUndo == true).ToList().ForEach(i =>
2643
                    {
2644
                        ViewerDataModel.Instance.UndoDataList.Remove(i);
2645
                    });
2646
2647
                    //multi_Undo_Data = dzMainMenu.Control_Style(currentControl as MarkupToPDF.Common.CommentUserInfo);
2648
                    multi_Undo_Data = Control_Style(currentControl as MarkupToPDF.Common.CommentUserInfo);
2649
                    UndoData.Markup_List.Add(multi_Undo_Data);
2650
                    ViewerDataModel.Instance.UndoDataList.Add(UndoData);
2651
2652
                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl as MarkupToPDF.Common.CommentUserInfo);
2653 24678e06 humkyung
                    currentControl.CommentID = Commons.shortGuid();
2654 53880c83 ljiyeon
                    currentControl.SymbolID = id;
2655
                    currentControl.GroupID = group_id;
2656
                    currentControl.ApplyTemplate();
2657
                    currentControl.SetImage();
2658
2659
                    ViewerDataModel.Instance.MarkupControls_USER.Remove(currentControl as MarkupToPDF.Common.CommentUserInfo);
2660
                    Controls.AdornerFinal final = new Controls.AdornerFinal(currentControl as MarkupToPDF.Common.CommentUserInfo);
2661
                    SelectLayer.Children.Add(final);
2662
                }
2663
            }
2664
            catch (Exception ex)
2665
            {
2666
                this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert(ex.Message, "Error");
2667
            }
2668
        }
2669
2670 d7e20d2d taeseongkim
        private async void zoomAndPanControl_MouseDown(object sender, MouseButtonEventArgs e)
2671 10de973b taeseongkim
        {
2672 992a98b4 KangIngu
            var set_option = this.ParentOfType<MainWindow>().dzTopMenu.Parent.ChildrenOfType<RadNumericUpDown>().Where(item => item.IsKeyboardFocusWithin).FirstOrDefault();
2673 be04d12c djkim
            if (set_option != null && !string.IsNullOrEmpty(set_option.ContentText))
2674 992a98b4 KangIngu
            {
2675
                set_option.Value = double.Parse(set_option.ContentText);
2676 5d55f6fb ljiyeon
                //set_option.Focusable = false;
2677 3c71b3a5 taeseongkim
                zoomAndPanControl.Focus();
2678 992a98b4 KangIngu
            }
2679
2680 f959ea6f humkyung
            ConvertInkControlToPolygon();
2681 787a4489 KangIngu
2682 1b2cf911 taeseongkim
            // 텍스트가 없으면 삭제됨
2683 787a4489 KangIngu
            var text_item = ViewerDataModel.Instance.MarkupControls_USER.Where(data =>
2684
            (data as TextControl) != null && (data as TextControl).Text == "" || (data as ArrowTextControl) != null && (data as ArrowTextControl).ArrowText == "").FirstOrDefault();
2685
2686 a1716fa5 KangIngu
            if (text_item != null && (currentControl as ArrowTextControl) == null)
2687 787a4489 KangIngu
            {
2688 1b2cf911 taeseongkim
                DeleteCommand.Instance.Execute(new[] { text_item });
2689
                //ViewerDataModel.Instance.MarkupControls_USER.Remove(text_item);
2690 787a4489 KangIngu
            }
2691 1305c420 taeseongkim
2692 d62c0439 humkyung
            /// up to here
2693 787a4489 KangIngu
2694 b7813553 djkim
            foreach (var item in ViewerDataModel.Instance.MarkupControls_USER)
2695 787a4489 KangIngu
            {
2696 b7813553 djkim
                if (item as ArrowTextControl != null)
2697 787a4489 KangIngu
                {
2698 b7813553 djkim
                    (item as ArrowTextControl).Base_TextBox.IsHitTestVisible = false;
2699 787a4489 KangIngu
                }
2700 76688e76 djkim
                else if (item as TextControl != null)
2701
                {
2702
                    (item as TextControl).Base_TextBox.IsHitTestVisible = false;
2703
                }
2704 787a4489 KangIngu
            }
2705
2706 49b217ad humkyung
            //if (currentControl != null)
2707 787a4489 KangIngu
            {
2708 a6f7f9b6 djkim
                var text_item_ = ViewerDataModel.Instance.MarkupControls_USER.Where(data => (data as TextControl) != null && (data as TextControl).IsEditingMode == true).FirstOrDefault();
2709
                if (text_item_ != null)
2710 787a4489 KangIngu
                {
2711
                    (text_item_ as TextControl).Base_TextBlock.Visibility = Visibility.Visible;
2712
                    (text_item_ as TextControl).Base_TextBox.Visibility = Visibility.Collapsed;
2713 233ef333 taeseongkim
                    (text_item_ as TextControl).IsEditingMode = false;
2714 49b217ad humkyung
                    currentControl = null;
2715 787a4489 KangIngu
                }
2716
2717
                var Arrowtext_item_ = ViewerDataModel.Instance.MarkupControls_USER.Where(data => (data as ArrowTextControl) != null && (data as ArrowTextControl).IsEditingMode == true).FirstOrDefault();
2718 49b217ad humkyung
                if (Arrowtext_item_ != null && ((Arrowtext_item_ as ArrowTextControl).IsNew == false))
2719 787a4489 KangIngu
                {
2720
                    (Arrowtext_item_ as ArrowTextControl).IsEditingMode = false;
2721
                    (Arrowtext_item_ as ArrowTextControl).Base_TextBox.Focusable = false;
2722 49b217ad humkyung
                    currentControl = null;
2723 787a4489 KangIngu
                }
2724
            }
2725
2726 233ef333 taeseongkim
            double Ang = 0;
2727 787a4489 KangIngu
            if (rotate.Angle != 0)
2728
            {
2729
                Ang = 360 - rotate.Angle;
2730
            }
2731
2732
            if (e.OriginalSource is System.Windows.Controls.Image)
2733
            {
2734
                (e.OriginalSource as System.Windows.Controls.Image).Focus();
2735
            }
2736 7211e0c2 ljiyeon
            /*
2737 e6a9ddaf humkyung
            if (mouseHandlingMode == MouseHandlingMode.DragSymbol && e.LeftButton == MouseButtonState.Pressed)
2738 233ef333 taeseongkim
            {
2739 53880c83 ljiyeon
                canvasZoomPanningMouseDownPoint = e.GetPosition(zoomAndPanCanvas);
2740
                if(symbol_id != null)
2741
                {
2742
                    PlaceImageSymbol(symbol_id, symbol_group_id, symbol_SelectedIndex, canvasZoomPanningMouseDownPoint);
2743 233ef333 taeseongkim
                }
2744 53880c83 ljiyeon
            }
2745
2746 e6a9ddaf humkyung
            if (mouseHandlingMode == MouseHandlingMode.DragSymbol && e.RightButton == MouseButtonState.Pressed)
2747 53880c83 ljiyeon
            {
2748
                if (this._dragdropWindow != null)
2749
                {
2750
                    this._dragdropWindow.Close();
2751
                    this._dragdropWindow = null;
2752
                    symbol_id = null;
2753
                }
2754
            }
2755 7211e0c2 ljiyeon
            */
2756 53880c83 ljiyeon
2757 e6a9ddaf humkyung
            if (e.LeftButton == MouseButtonState.Pressed)
2758 787a4489 KangIngu
            {
2759 c7fde400 taeseongkim
                CanvasDrawingMouseDownPoint = e.GetPosition(drawingRotateCanvas);
2760 787a4489 KangIngu
                canvasZoomPanningMouseDownPoint = e.GetPosition(zoomAndPanCanvas);
2761
2762 902faaea taeseongkim
                this.cursor = new Cursor(App.DefaultArrowCursorStream);
2763 787a4489 KangIngu
                SetCursor();
2764
2765 315ae55e taeseongkim
                if (!ViewerDataModel.Instance.IsPressCtrl)
2766
                {
2767
                    SelectionSet.Instance.UnSelect(this);
2768
                }
2769 787a4489 KangIngu
            }
2770 f513c215 humkyung
2771 e6a9ddaf humkyung
            if (e.MiddleButton == MouseButtonState.Pressed)
2772 787a4489 KangIngu
            {
2773
                canvasZoommovingMouseDownPoint = e.GetPosition(zoomAndPanCanvas);
2774
                cursor = Cursors.SizeAll;
2775
                SetCursor();
2776
            }
2777 e6a9ddaf humkyung
            if (e.RightButton == MouseButtonState.Pressed)
2778 787a4489 KangIngu
            {
2779
                canvasZoommovingMouseDownPoint = e.GetPosition(zoomAndPanCanvas);
2780
                cursor = Cursors.SizeAll;
2781
                SetCursor();
2782
            }
2783 e6a9ddaf humkyung
            else if (e.XButton1 == MouseButtonState.Pressed)
2784 787a4489 KangIngu
            {
2785
                if (this.pageNavigator.CurrentPage.PageNumber + 1 <= this.pageNavigator.PageCount)
2786
                {
2787 3908a575 humkyung
                    this.pageNavigator.GotoPage(this.pageNavigator.CurrentPage.PageNumber + 1);
2788 787a4489 KangIngu
                }
2789
2790 3908a575 humkyung
                //this.pageNavigator.GotoPage(this.pageNavigator._NextPage.PageNumber);
2791 787a4489 KangIngu
            }
2792 e6a9ddaf humkyung
            else if (e.XButton2 == MouseButtonState.Pressed)
2793 787a4489 KangIngu
            {
2794
                if (this.pageNavigator.CurrentPage.PageNumber > 1)
2795
                {
2796
                    this.pageNavigator.GotoPage(this.pageNavigator.CurrentPage.PageNumber - 1);
2797
                }
2798
            }
2799
2800 1305c420 taeseongkim
            bool isArrowTextEdit = false;
2801
2802
            if (currentControl is ArrowTextControl textControl)
2803
            {
2804
                if (textControl.IsEditingMode)
2805
                    isArrowTextEdit = true;
2806
            }
2807
2808 e6a9ddaf humkyung
            if (e.LeftButton == MouseButtonState.Pressed && mouseHandlingMode != MouseHandlingMode.Drawing && currentControl == null)
2809 787a4489 KangIngu
            {
2810
                if (mouseHandlingMode == MouseHandlingMode.Selecting)
2811
                {
2812
                    if (SelectLayer.Children.Count == 0)
2813
                    {
2814
                        isLeftMouseButtonDownOnWindow = true;
2815
                        mouseHandlingMode = MouseHandlingMode.Selecting;
2816
                    }
2817
2818
                    if (controlType == ControlType.None)
2819
                    {
2820
                        isLeftMouseButtonDownOnWindow = true;
2821
                    }
2822
                }
2823
2824 f513c215 humkyung
                /// 캡쳐 모드 설정
2825 9f473fb7 KangIngu
                if (mouseHandlingMode == MouseHandlingMode.Capture)
2826
                {
2827
                    dragCaptureBorder.Visibility = Visibility.Visible;
2828
                    isLeftMouseButtonDownOnWindow = true;
2829
                }
2830
2831 f513c215 humkyung
                /// 줌 모드 설정
2832 9f473fb7 KangIngu
                if (mouseHandlingMode == MouseHandlingMode.DragZoom)
2833
                {
2834
                    isLeftMouseButtonDownOnWindow = true;
2835 1066bae3 ljiyeon
                }
2836 787a4489 KangIngu
2837 a342d378 taeseongkim
                var control = ViewerDataModel.Instance.MarkupControls_USER.Where(data => data.IsMouseEnter).FirstOrDefault();
2838 b643fcca taeseongkim
2839 233ef333 taeseongkim
                if (control == null)
2840 787a4489 KangIngu
                {
2841 b643fcca taeseongkim
                    ViewerDataModel.Instance.SetAngleVisible(Visibility.Collapsed);
2842
                }
2843
                else
2844
                {
2845 233ef333 taeseongkim
                    if (ControlTypeExtansions.LineTypes.Contains(control.ControlType))
2846
                    {
2847
                        ViewerDataModel.Instance.SetAngleVisible(Visibility.Visible);
2848
                    }
2849 b643fcca taeseongkim
2850 d62c0439 humkyung
                    AdornerFinal final = null;
2851 787a4489 KangIngu
2852
                    if (!ViewerDataModel.Instance.IsPressCtrl)
2853
                    {
2854 d62c0439 humkyung
                        /// 기존 selection 해제
2855 077896be humkyung
                        SelectionSet.Instance.UnSelect(this);
2856 d62c0439 humkyung
2857 787a4489 KangIngu
                        final = new AdornerFinal(control);
2858
2859 f513c215 humkyung
                        this.Control_Style(control);
2860 787a4489 KangIngu
2861
                        if ((control as IPath) != null)
2862
                        {
2863
                            if ((control as IPath).LineSize != 0)
2864
                            {
2865
                                ViewerDataModel.Instance.LineSize = (control as IPath).LineSize;
2866
                            }
2867
                        }
2868
                        if ((control as IShapeControl) != null)
2869
                        {
2870
                            if ((control as IShapeControl).Paint == PaintSet.Hatch)
2871
                            {
2872
                                ViewerDataModel.Instance.checkHatchShape = true;
2873
                            }
2874
                            else if ((control as IShapeControl).Paint == PaintSet.Fill)
2875
                            {
2876
                                ViewerDataModel.Instance.checkFillShape = true;
2877
                            }
2878
                            else
2879
                            {
2880
                                ViewerDataModel.Instance.checkHatchShape = false;
2881
                                ViewerDataModel.Instance.checkFillShape = false;
2882
                            }
2883
                            ViewerDataModel.Instance.paintSet = (control as IShapeControl).Paint;
2884
                        }
2885 9f473fb7 KangIngu
2886 787a4489 KangIngu
                        ViewerDataModel.Instance.ControlOpacity = control.Opacity;
2887 d4b0c723 KangIngu
2888
                        if ((control as TextControl) != null)
2889
                        {
2890 c206d293 taeseongkim
                            ViewerDataModel.Instance.SystemMain.dzTopMenu.SetFont((control as TextControl).TextFamily);
2891
2892 233ef333 taeseongkim
                            if (!((control as TextControl).EnableEditing))
2893
                            {
2894 71d7e0bf 송근호
                                (control as TextControl).EnableEditing = true;
2895
                            }
2896 d4b0c723 KangIngu
                            if ((control as TextControl).TextStyle == FontStyles.Italic)
2897
                            {
2898
                                ViewerDataModel.Instance.checkTextStyle = true;
2899
                            }
2900
                            else
2901
                            {
2902
                                ViewerDataModel.Instance.checkTextStyle = false;
2903
                            }
2904
                            if ((control as TextControl).TextWeight == FontWeights.Bold)
2905
                            {
2906
                                ViewerDataModel.Instance.checkTextWeight = true;
2907
                            }
2908
                            else
2909
                            {
2910
                                ViewerDataModel.Instance.checkTextWeight = false;
2911
                            }
2912
                            if ((control as TextControl).UnderLine == TextDecorations.Underline)
2913
                            {
2914
                                ViewerDataModel.Instance.checkUnderLine = true;
2915
                            }
2916
                            else
2917
                            {
2918
                                ViewerDataModel.Instance.checkUnderLine = false;
2919
                            }
2920
                            ViewerDataModel.Instance.TextSize = (control as TextControl).TextSize;
2921
                            ViewerDataModel.Instance.checkHighlight = (control as TextControl).IsHighLight;
2922
                        }
2923
                        else if ((control as ArrowTextControl) != null)
2924
                        {
2925 24c5e56c taeseongkim
                            ViewerDataModel.Instance.SystemMain.dzTopMenu.SetFont((control as ArrowTextControl).TextFamily);
2926
2927 120b8b00 송근호
                            if (!((control as ArrowTextControl).EnableEditing))
2928
                            {
2929 71d7e0bf 송근호
                                (control as ArrowTextControl).EnableEditing = true;
2930
                            }
2931 e17af42b KangIngu
                            if ((control as ArrowTextControl).TextStyle == FontStyles.Italic)
2932 d4b0c723 KangIngu
                            {
2933 e17af42b KangIngu
                                ViewerDataModel.Instance.checkTextStyle = true;
2934
                            }
2935
                            else
2936 d4b0c723 KangIngu
                            {
2937 e17af42b KangIngu
                                ViewerDataModel.Instance.checkTextStyle = false;
2938 d4b0c723 KangIngu
                            }
2939 e17af42b KangIngu
                            if ((control as ArrowTextControl).TextWeight == FontWeights.Bold)
2940 d4b0c723 KangIngu
                            {
2941 e17af42b KangIngu
                                ViewerDataModel.Instance.checkTextWeight = true;
2942
                            }
2943
                            else
2944
                            {
2945
                                ViewerDataModel.Instance.checkTextWeight = false;
2946
                            }
2947
                            if ((control as ArrowTextControl).UnderLine == TextDecorations.Underline)
2948
                            {
2949
                                ViewerDataModel.Instance.checkUnderLine = true;
2950
                            }
2951
                            else
2952
                            {
2953
                                ViewerDataModel.Instance.checkUnderLine = false;
2954 d4b0c723 KangIngu
                            }
2955
                            ViewerDataModel.Instance.checkHighlight = (control as ArrowTextControl).isHighLight;
2956
                            ViewerDataModel.Instance.TextSize = (control as ArrowTextControl).TextSize;
2957
                        }
2958 9f473fb7 KangIngu
                        else if ((control as RectCloudControl) != null)
2959
                        {
2960
                            ViewerDataModel.Instance.ArcLength = (control as RectCloudControl).ArcLength;
2961
                        }
2962
                        else if ((control as CloudControl) != null)
2963
                        {
2964
                            ViewerDataModel.Instance.ArcLength = (control as CloudControl).ArcLength;
2965
                        }
2966 787a4489 KangIngu
                    }
2967
                    else
2968
                    {
2969 d62c0439 humkyung
                        List<CommentUserInfo> comment = SelectionSet.Instance.SelectedItems;
2970
                        SelectionSet.Instance.UnSelect(this);
2971 787a4489 KangIngu
                        comment.Add(control);
2972
2973
                        Control_Style(control);
2974
2975
                        final = new AdornerFinal(comment);
2976
                    }
2977
2978 f513c215 humkyung
                    if (final != null)
2979
                    {
2980
                        this.SelectLayer.Children.Add(final);
2981
                    }
2982 b643fcca taeseongkim
                }
2983 787a4489 KangIngu
            }
2984
            else if (mouseHandlingMode == MouseHandlingMode.Drawing)
2985 233ef333 taeseongkim
            {
2986 1305c420 taeseongkim
2987
2988 787a4489 KangIngu
                init();
2989
                //강인구 추가(우 클릭 일 경우 커서 변경 하지 않음)
2990
                if (cursor != Cursors.SizeAll)
2991
                {
2992
                    cursor = Cursors.Cross;
2993
                    SetCursor();
2994
                }
2995
                bool init_user = false;
2996
                foreach (var user in gridViewMarkup.Items)
2997
                {
2998
                    if ((user as MarkupInfoItem).UserID == App.ViewInfo.UserID)
2999
                    {
3000
                        init_user = true;
3001
                    }
3002
                }
3003
                if (init_user && gridViewMarkup.SelectedItems.Where(d => (d as MarkupInfoItem).UserID == App.ViewInfo.UserID).FirstOrDefault() == null && e.LeftButton == MouseButtonState.Pressed)
3004
                {
3005 d7e20d2d taeseongkim
                    // 기존의 코멘트가 존재합니다. 사용자 리스트에서 먼저 선택해주세요
3006 787a4489 KangIngu
                    RadWindow.Alert(new DialogParameters
3007
                    {
3008 b9b01f8e ljiyeon
                        Owner = Application.Current.MainWindow,
3009 787a4489 KangIngu
                        Theme = new VisualStudio2013Theme(),
3010 d7e20d2d taeseongkim
                        Header = "Info",
3011
                        Content = "Existing comments already existed. Select from the user list first",
3012 787a4489 KangIngu
                    });
3013
                    return;
3014
                }
3015
                else
3016
                {
3017
                    var item = gridViewMarkup.SelectedItems.Where(d => (d as MarkupInfoItem).UserID == App.ViewInfo.UserID).FirstOrDefault() as MarkupInfoItem;
3018
                    if (item != null)
3019
                    {
3020
                        App.Custom_ViewInfoId = item.MarkupInfoID;
3021
                    }
3022
                }
3023 1305c420 taeseongkim
                
3024 75448f5e ljiyeon
                switch (controlType)
3025 787a4489 KangIngu
                {
3026 684ef11c ljiyeon
                    case ControlType.Coordinate:
3027
                        {
3028 e6a9ddaf humkyung
                            if (e.LeftButton == MouseButtonState.Pressed)
3029 684ef11c ljiyeon
                            {
3030
                                if (currentControl is CoordinateControl)
3031
                                {
3032
                                    if (IsGetoutpoint((currentControl as CoordinateControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3033
                                    {
3034
                                        return;
3035
                                    }
3036
3037 f513c215 humkyung
                                    CreateCommand.Instance.Execute(currentControl);
3038 684ef11c ljiyeon
3039
                                    currentControl = null;
3040
                                    this.cursor = Cursors.Arrow;
3041
                                }
3042
                                else
3043
                                {
3044
                                    this.ParentOfType<MainWindow>().dzTopMenu._SaveEvent(null, null);
3045 d62c0439 humkyung
                                    if (ViewerDataModel.Instance.MyMarkupList.Where(d => d.PageNumber == Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber
3046 684ef11c ljiyeon
                                     && d.Data_Type == Convert.ToInt32(MarkupToPDF.Controls.Common.ControlType.Coordinate)).Count() > 0)
3047
                                    {
3048
                                        currentControl = null;
3049
                                        this.cursor = Cursors.Arrow;
3050
                                        Common.ViewerDataModel.Instance.SystemMain.DialogMessage_Alert("이미 해당 페이지의 도면 영역을 설정하셨습니다.", "Notice");
3051
                                        return;
3052
                                    }
3053
                                    else
3054
                                    {
3055
                                        currentControl = new CoordinateControl
3056
                                        {
3057
                                            Background = new SolidColorBrush(Colors.Black),
3058 c7fde400 taeseongkim
                                            StartPoint = this.CanvasDrawingMouseDownPoint,
3059 684ef11c ljiyeon
                                            ControlType = ControlType.Coordinate
3060
                                        };
3061
3062 24678e06 humkyung
                                        currentControl.CommentID = Commons.shortGuid();
3063 684ef11c ljiyeon
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3064
                                        currentControl.IsNew = true;
3065
3066
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3067
3068
                                        currentControl.SetValue(Canvas.ZIndexProperty, 3);
3069
                                    }
3070
                                }
3071
                            }
3072
                        }
3073
                        break;
3074 233ef333 taeseongkim
3075 684ef11c ljiyeon
                    case ControlType.InsideWhite:
3076
                        {
3077 e6a9ddaf humkyung
                            if (e.LeftButton == MouseButtonState.Pressed)
3078 684ef11c ljiyeon
                            {
3079
                                if (currentControl is InsideWhiteControl)
3080
                                {
3081
                                    if (IsGetoutpoint((currentControl as InsideWhiteControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3082
                                    {
3083
                                        return;
3084
                                    }
3085
3086 f513c215 humkyung
                                    CreateCommand.Instance.Execute(currentControl);
3087 684ef11c ljiyeon
3088
                                    currentControl = null;
3089
                                    this.cursor = Cursors.Arrow;
3090
                                }
3091
                                else
3092
                                {
3093
                                    currentControl = new InsideWhiteControl
3094
                                    {
3095
                                        Background = new SolidColorBrush(Colors.Black),
3096 c7fde400 taeseongkim
                                        StartPoint = this.CanvasDrawingMouseDownPoint,
3097 684ef11c ljiyeon
                                        ControlType = ControlType.InsideWhite
3098
                                    };
3099
3100 24678e06 humkyung
                                    currentControl.CommentID = Commons.shortGuid();
3101 684ef11c ljiyeon
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3102
                                    currentControl.IsNew = true;
3103
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3104
3105
                                    currentControl.SetValue(Canvas.ZIndexProperty, 3);
3106
                                }
3107
                            }
3108
                        }
3109
                        break;
3110 233ef333 taeseongkim
3111 684ef11c ljiyeon
                    case ControlType.OverlapWhite:
3112
                        {
3113 e6a9ddaf humkyung
                            if (e.LeftButton == MouseButtonState.Pressed)
3114 684ef11c ljiyeon
                            {
3115
                                if (currentControl is OverlapWhiteControl)
3116
                                {
3117
                                    if (IsGetoutpoint((currentControl as OverlapWhiteControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3118
                                    {
3119
                                        return;
3120
                                    }
3121
3122 f513c215 humkyung
                                    CreateCommand.Instance.Execute(currentControl);
3123 684ef11c ljiyeon
3124
                                    currentControl = null;
3125
                                    this.cursor = Cursors.Arrow;
3126
                                }
3127
                                else
3128
                                {
3129
                                    currentControl = new OverlapWhiteControl
3130
                                    {
3131
                                        Background = new SolidColorBrush(Colors.Black),
3132 c7fde400 taeseongkim
                                        StartPoint = this.CanvasDrawingMouseDownPoint,
3133 684ef11c ljiyeon
                                        ControlType = ControlType.OverlapWhite
3134
                                    };
3135
3136 24678e06 humkyung
                                    currentControl.CommentID = Commons.shortGuid();
3137 684ef11c ljiyeon
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3138
                                    currentControl.IsNew = true;
3139
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3140
3141
                                    currentControl.SetValue(Canvas.ZIndexProperty, 3);
3142
                                }
3143
                            }
3144
                        }
3145
                        break;
3146 233ef333 taeseongkim
3147 684ef11c ljiyeon
                    case ControlType.ClipWhite:
3148
                        {
3149 e6a9ddaf humkyung
                            if (e.LeftButton == MouseButtonState.Pressed)
3150 684ef11c ljiyeon
                            {
3151
                                if (currentControl is ClipWhiteControl)
3152
                                {
3153
                                    if (IsGetoutpoint((currentControl as ClipWhiteControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3154
                                    {
3155
                                        return;
3156
                                    }
3157
3158 f513c215 humkyung
                                    CreateCommand.Instance.Execute(currentControl);
3159 684ef11c ljiyeon
3160
                                    currentControl = null;
3161
                                    this.cursor = Cursors.Arrow;
3162
                                }
3163
                                else
3164
                                {
3165
                                    currentControl = new ClipWhiteControl
3166
                                    {
3167
                                        Background = new SolidColorBrush(Colors.Black),
3168 c7fde400 taeseongkim
                                        StartPoint = this.CanvasDrawingMouseDownPoint,
3169 684ef11c ljiyeon
                                        ControlType = ControlType.ClipWhite
3170
                                    };
3171
3172 24678e06 humkyung
                                    currentControl.CommentID = Commons.shortGuid();
3173 684ef11c ljiyeon
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3174
                                    currentControl.IsNew = true;
3175
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3176
3177
                                    currentControl.SetValue(Canvas.ZIndexProperty, 3);
3178
                                }
3179
                            }
3180
                        }
3181
                        break;
3182 233ef333 taeseongkim
3183 787a4489 KangIngu
                    case ControlType.Rectangle:
3184
                        {
3185 e6a9ddaf humkyung
                            if (e.LeftButton == MouseButtonState.Pressed)
3186 787a4489 KangIngu
                            {
3187 f67f164e humkyung
                                if (currentControl is RectangleControl)
3188
                                {
3189
                                    //20180906 LJY TEST IsRotationDrawingEnable
3190
                                    if (IsGetoutpoint((currentControl as RectangleControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3191 787a4489 KangIngu
                                    {
3192 f67f164e humkyung
                                        return;
3193
                                    }
3194 787a4489 KangIngu
3195 f67f164e humkyung
                                    CreateCommand.Instance.Execute(currentControl);
3196
                                    currentControl = null;
3197 902faaea taeseongkim
                                    this.cursor = new Cursor(App.DefaultArrowCursorStream);
3198 f67f164e humkyung
                                }
3199
                                else
3200
                                {
3201
                                    currentControl = new RectangleControl
3202 787a4489 KangIngu
                                    {
3203 f67f164e humkyung
                                        Background = new SolidColorBrush(Colors.Black),
3204 c7fde400 taeseongkim
                                        StartPoint = this.CanvasDrawingMouseDownPoint,
3205 f67f164e humkyung
                                        ControlType = ControlType.Rectangle
3206
                                    };
3207 787a4489 KangIngu
3208 f67f164e humkyung
                                    currentControl.CommentID = Commons.shortGuid();
3209
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3210
                                    currentControl.IsNew = true;
3211
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3212 787a4489 KangIngu
3213 f67f164e humkyung
                                    currentControl.SetValue(Canvas.ZIndexProperty, 3);
3214
                                }
3215 787a4489 KangIngu
                            }
3216
                        }
3217
                        break;
3218 233ef333 taeseongkim
3219 787a4489 KangIngu
                    case ControlType.RectCloud:
3220
                        {
3221 e6a9ddaf humkyung
                            if (e.LeftButton == MouseButtonState.Pressed)
3222 787a4489 KangIngu
                            {
3223 f67f164e humkyung
                                if (currentControl is RectCloudControl)
3224
                                {
3225
                                    //20180906 LJY TEST IsRotationDrawingEnable
3226
                                    if (IsGetoutpoint((currentControl as RectCloudControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3227 787a4489 KangIngu
                                    {
3228 f67f164e humkyung
                                        return;
3229
                                    }
3230 e66f22eb KangIngu
3231 f67f164e humkyung
                                    CreateCommand.Instance.Execute(currentControl);
3232 787a4489 KangIngu
3233 f67f164e humkyung
                                    currentControl = null;
3234 233ef333 taeseongkim
3235 902faaea taeseongkim
                                    this.cursor = new Cursor(App.DefaultArrowCursorStream);
3236 f67f164e humkyung
                                }
3237
                                else
3238
                                {
3239
                                    currentControl = new RectCloudControl
3240 787a4489 KangIngu
                                    {
3241 c7fde400 taeseongkim
                                        StartPoint = this.CanvasDrawingMouseDownPoint,
3242 f67f164e humkyung
                                        ControlType = ControlType.RectCloud,
3243
                                        Background = new SolidColorBrush(Colors.Black)
3244
                                    };
3245 787a4489 KangIngu
3246 f67f164e humkyung
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3247
                                    currentControl.CommentID = Commons.shortGuid();
3248
                                    currentControl.IsNew = true;
3249
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3250
                                }
3251 787a4489 KangIngu
                            }
3252
                        }
3253
                        break;
3254 233ef333 taeseongkim
3255 787a4489 KangIngu
                    case ControlType.Circle:
3256
                        {
3257 e6a9ddaf humkyung
                            if (e.LeftButton == MouseButtonState.Pressed)
3258 787a4489 KangIngu
                            {
3259 f67f164e humkyung
                                if (currentControl is CircleControl)
3260
                                {
3261
                                    //20180906 LJY TEST IsRotationDrawingEnable
3262
                                    if (IsGetoutpoint((currentControl as CircleControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3263 787a4489 KangIngu
                                    {
3264 f67f164e humkyung
                                        return;
3265
                                    }
3266 e66f22eb KangIngu
3267 f67f164e humkyung
                                    CreateCommand.Instance.Execute(currentControl);
3268 787a4489 KangIngu
3269 f67f164e humkyung
                                    currentControl = null;
3270
                                }
3271
                                else
3272
                                {
3273
                                    currentControl = new CircleControl
3274 787a4489 KangIngu
                                    {
3275 c7fde400 taeseongkim
                                        StartPoint = this.CanvasDrawingMouseDownPoint,
3276
                                        LeftBottomPoint = this.CanvasDrawingMouseDownPoint,
3277 f67f164e humkyung
                                        Background = new SolidColorBrush(Colors.Black)
3278
                                    };
3279 787a4489 KangIngu
3280 f67f164e humkyung
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3281
                                    currentControl.CommentID = Commons.shortGuid();
3282
                                    currentControl.IsNew = true;
3283
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3284
                                }
3285 787a4489 KangIngu
                            }
3286
                        }
3287
                        break;
3288 233ef333 taeseongkim
3289 787a4489 KangIngu
                    case ControlType.Triangle:
3290
                        {
3291 e6a9ddaf humkyung
                            if (e.LeftButton == MouseButtonState.Pressed)
3292 787a4489 KangIngu
                            {
3293 f67f164e humkyung
                                if (currentControl is TriControl)
3294
                                {
3295
                                    var content = currentControl as TriControl;
3296
                                    if (content.MidPoint == new Point(0, 0))
3297 787a4489 KangIngu
                                    {
3298 c7fde400 taeseongkim
                                        content.MidPoint = new Point(CanvasDrawingMouseDownPoint.X, CanvasDrawingMouseDownPoint.Y);
3299 787a4489 KangIngu
                                    }
3300
                                    else
3301
                                    {
3302 ca40e004 ljiyeon
                                        //20180906 LJY TEST IsRotationDrawingEnable
3303 f67f164e humkyung
                                        if (IsGetoutpoint((currentControl as TriControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3304 e66f22eb KangIngu
                                        {
3305
                                            return;
3306
                                        }
3307
3308 f513c215 humkyung
                                        CreateCommand.Instance.Execute(currentControl);
3309 787a4489 KangIngu
3310
                                        currentControl = null;
3311
                                    }
3312 f67f164e humkyung
                                }
3313
                                else
3314
                                {
3315
                                    currentControl = new TriControl
3316 787a4489 KangIngu
                                    {
3317 c7fde400 taeseongkim
                                        StartPoint = new Point(CanvasDrawingMouseDownPoint.X, CanvasDrawingMouseDownPoint.Y),
3318 f67f164e humkyung
                                        Background = new SolidColorBrush(Colors.Black),
3319
                                    };
3320 787a4489 KangIngu
3321 f67f164e humkyung
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3322
                                    currentControl.CommentID = Commons.shortGuid();
3323
                                    currentControl.IsNew = true;
3324
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3325
                                }
3326 787a4489 KangIngu
                            }
3327
                        }
3328
                        break;
3329 233ef333 taeseongkim
3330 787a4489 KangIngu
                    case ControlType.CancelLine:
3331 f67f164e humkyung
                    case ControlType.SingleLine:
3332
                    case ControlType.ArrowLine:
3333
                    case ControlType.TwinLine:
3334
                    case ControlType.DimLine:
3335 787a4489 KangIngu
                        {
3336 e6a9ddaf humkyung
                            if (e.LeftButton == MouseButtonState.Pressed)
3337 787a4489 KangIngu
                            {
3338 f67f164e humkyung
                                if (currentControl is LineControl)
3339
                                {
3340
                                    //20180906 LJY TEST IsRotationDrawingEnable
3341
                                    if (IsGetoutpoint((currentControl as LineControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3342 787a4489 KangIngu
                                    {
3343 f67f164e humkyung
                                        return;
3344 787a4489 KangIngu
                                    }
3345 f67f164e humkyung
3346
                                    CreateCommand.Instance.Execute(currentControl);
3347
                                    currentControl = null;
3348 b643fcca taeseongkim
                                    ViewerDataModel.Instance.SetAngleVisible(Visibility.Collapsed);
3349 f67f164e humkyung
                                }
3350
                                else
3351
                                {
3352
                                    currentControl = new LineControl
3353 787a4489 KangIngu
                                    {
3354 f67f164e humkyung
                                        ControlType = this.controlType,
3355 c7fde400 taeseongkim
                                        StartPoint = new Point(CanvasDrawingMouseDownPoint.X, CanvasDrawingMouseDownPoint.Y),
3356 f67f164e humkyung
                                        Background = new SolidColorBrush(Colors.Black)
3357
                                    };
3358 787a4489 KangIngu
3359 f67f164e humkyung
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3360
                                    currentControl.CommentID = Commons.shortGuid();
3361
                                    currentControl.IsNew = true;
3362
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3363 b643fcca taeseongkim
                                    ViewerDataModel.Instance.SetAngleVisible(Visibility.Visible);
3364 f67f164e humkyung
                                }
3365 787a4489 KangIngu
                            }
3366
                        }
3367
                        break;
3368 233ef333 taeseongkim
3369 f67f164e humkyung
                    case ControlType.PolygonControl:
3370 787a4489 KangIngu
                        {
3371 f67f164e humkyung
                            if (currentControl is PolygonControl)
3372 787a4489 KangIngu
                            {
3373 f67f164e humkyung
                                var control = currentControl as PolygonControl;
3374 e66f22eb KangIngu
3375 f67f164e humkyung
                                if (e.RightButton == MouseButtonState.Pressed)
3376
                                {
3377
                                    control.IsCompleted = true;
3378
                                }
3379 787a4489 KangIngu
3380 f67f164e humkyung
                                if (!control.IsCompleted)
3381
                                {
3382
                                    control.PointSet.Add(control.EndPoint);
3383
                                }
3384
                                else
3385
                                {
3386
                                    //20180906 LJY TEST IsRotationDrawingEnable
3387
                                    if (IsGetoutpoint((currentControl as PolygonControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3388 787a4489 KangIngu
                                    {
3389 f67f164e humkyung
                                        return;
3390 787a4489 KangIngu
                                    }
3391 e66f22eb KangIngu
3392 f67f164e humkyung
                                    var firstPoint = control.PointSet.First();
3393
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
3394
                                    control.LineSize = ViewerDataModel.Instance.LineSize;
3395
                                    control.PointSet.Add(firstPoint);
3396 787a4489 KangIngu
3397 f67f164e humkyung
                                    control.ApplyOverViewData();
3398
3399
                                    CreateCommand.Instance.Execute(currentControl);
3400 0d00f9c8 humkyung
                                    control.UpdateControl();
3401 f67f164e humkyung
                                    currentControl = null;
3402
                                }
3403 787a4489 KangIngu
                            }
3404 f67f164e humkyung
                            else
3405 787a4489 KangIngu
                            {
3406 f67f164e humkyung
                                if (e.LeftButton == MouseButtonState.Pressed)
3407
                                {
3408
                                    currentControl = new PolygonControl
3409 787a4489 KangIngu
                                    {
3410 f67f164e humkyung
                                        PointSet = new List<Point>(),
3411
                                    };
3412 787a4489 KangIngu
3413 f67f164e humkyung
                                    var polygonControl = (currentControl as PolygonControl);
3414
                                    currentControl.CommentID = Commons.shortGuid();
3415
                                    currentControl.IsNew = true;
3416
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3417 c7fde400 taeseongkim
                                    polygonControl.StartPoint = CanvasDrawingMouseDownPoint;
3418
                                    polygonControl.EndPoint = CanvasDrawingMouseDownPoint;
3419
                                    polygonControl.PointSet.Add(CanvasDrawingMouseDownPoint);
3420
                                    polygonControl.PointSet.Add(CanvasDrawingMouseDownPoint);
3421 f67f164e humkyung
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3422
                                    polygonControl.ApplyTemplate();
3423
                                    polygonControl.Visibility = Visibility.Visible;
3424
                                }
3425 787a4489 KangIngu
                            }
3426
                        }
3427
                        break;
3428 233ef333 taeseongkim
3429 787a4489 KangIngu
                    case ControlType.ChainLine:
3430
                        {
3431
                            if (currentControl is PolygonControl)
3432
                            {
3433
                                var control = currentControl as PolygonControl;
3434
3435 e6a9ddaf humkyung
                                if (e.RightButton == MouseButtonState.Pressed)
3436 787a4489 KangIngu
                                {
3437 ca40e004 ljiyeon
                                    //20180906 LJY TEST IsRotationDrawingEnable
3438
                                    if (IsGetoutpoint((currentControl as PolygonControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3439 e66f22eb KangIngu
                                    {
3440
                                        return;
3441
                                    }
3442
3443 f513c215 humkyung
                                    CreateCommand.Instance.Execute(currentControl);
3444 787a4489 KangIngu
3445
                                    currentControl = null;
3446 b643fcca taeseongkim
                                    ViewerDataModel.Instance.SetAngleVisible(Visibility.Collapsed);
3447 787a4489 KangIngu
                                    return;
3448
                                }
3449
3450
                                if (!control.IsCompleted)
3451
                                {
3452
                                    control.PointSet.Add(control.EndPoint);
3453 b643fcca taeseongkim
                                    ViewerDataModel.Instance.SetAngleVisible(Visibility.Visible);
3454 787a4489 KangIngu
                                }
3455
                            }
3456
                            else
3457
                            {
3458 e6a9ddaf humkyung
                                if (e.LeftButton == MouseButtonState.Pressed)
3459 787a4489 KangIngu
                                {
3460 2eac4f76 KangIngu
                                    MainAngle.Visibility = Visibility.Visible;
3461 787a4489 KangIngu
                                    currentControl = new PolygonControl
3462
                                    {
3463
                                        PointSet = new List<Point>(),
3464
                                        //강인구 추가(ChainLine일때는 채우기 스타일을 주지 않기 위해 설정)
3465
                                        ControlType = ControlType.ChainLine,
3466
                                        DashSize = ViewerDataModel.Instance.DashSize,
3467
                                        LineSize = ViewerDataModel.Instance.LineSize,
3468
                                        //PointC = new StylusPointSet()
3469
                                    };
3470
3471 e66f22eb KangIngu
                                    //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3472
                                    //{
3473 233ef333 taeseongkim
                                    var polygonControl = (currentControl as PolygonControl);
3474
                                    currentControl.CommentID = Commons.shortGuid();
3475
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3476
                                    currentControl.IsNew = true;
3477
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3478
                                    //currentControl.OnApplyTemplate();
3479
                                    //polygonControl.PointC.pointSet.Add(canvasDrawingMouseDownPoint);
3480
                                    //polygonControl.PointC.pointSet.Add(canvasDrawingMouseDownPoint);
3481
                                    polygonControl.PointSet.Add(CanvasDrawingMouseDownPoint);
3482
                                    polygonControl.PointSet.Add(CanvasDrawingMouseDownPoint);
3483 e66f22eb KangIngu
                                    //}
3484 787a4489 KangIngu
                                }
3485
                            }
3486
                        }
3487
                        break;
3488 233ef333 taeseongkim
3489 787a4489 KangIngu
                    case ControlType.ArcLine:
3490
                        {
3491 e6a9ddaf humkyung
                            if (e.LeftButton == MouseButtonState.Pressed)
3492 787a4489 KangIngu
                            {
3493 f67f164e humkyung
                                if (currentControl is ArcControl)
3494
                                {
3495
                                    //20180906 LJY TEST IsRotationDrawingEnable
3496
                                    if (IsGetoutpoint((currentControl as ArcControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3497 787a4489 KangIngu
                                    {
3498 f67f164e humkyung
                                        return;
3499
                                    }
3500 e66f22eb KangIngu
3501 f67f164e humkyung
                                    CreateCommand.Instance.Execute(currentControl);
3502 787a4489 KangIngu
3503 f67f164e humkyung
                                    currentControl = null;
3504 b643fcca taeseongkim
                                    ViewerDataModel.Instance.SetAngleVisible(Visibility.Collapsed);
3505 f67f164e humkyung
                                }
3506
                                else
3507
                                {
3508
                                    currentControl = new ArcControl
3509 787a4489 KangIngu
                                    {
3510 c7fde400 taeseongkim
                                        StartPoint = new Point(CanvasDrawingMouseDownPoint.X, CanvasDrawingMouseDownPoint.Y),
3511 f67f164e humkyung
                                        Background = new SolidColorBrush(Colors.Black)
3512
                                    };
3513
                                    currentControl.CommentID = Commons.shortGuid();
3514
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3515
                                    currentControl.IsNew = true;
3516
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3517 b643fcca taeseongkim
                                    ViewerDataModel.Instance.SetAngleVisible(Visibility.Visible);
3518 f67f164e humkyung
                                }
3519 787a4489 KangIngu
                            }
3520 e6a9ddaf humkyung
                            else if (e.RightButton == MouseButtonState.Pressed)
3521 787a4489 KangIngu
                            {
3522
                                if (currentControl != null)
3523
                                {
3524
                                    (currentControl as ArcControl).setClock();
3525 05f4d127 KangIngu
                                    (currentControl as ArcControl).MidPoint = new Point(0, 0);
3526 787a4489 KangIngu
                                }
3527
                            }
3528
                        }
3529
                        break;
3530 233ef333 taeseongkim
3531 787a4489 KangIngu
                    case ControlType.ArcArrow:
3532
                        {
3533 e6a9ddaf humkyung
                            if (e.LeftButton == MouseButtonState.Pressed)
3534 787a4489 KangIngu
                            {
3535 e66f22eb KangIngu
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3536
                                //{
3537 40b3ce25 ljiyeon
                                if (currentControl is ArrowArcControl)
3538
                                {
3539
                                    //20180906 LJY TEST IsRotationDrawingEnable
3540
                                    if (IsGetoutpoint((currentControl as ArrowArcControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3541 787a4489 KangIngu
                                    {
3542 40b3ce25 ljiyeon
                                        return;
3543
                                    }
3544 e66f22eb KangIngu
3545 f513c215 humkyung
                                    CreateCommand.Instance.Execute(currentControl);
3546 787a4489 KangIngu
3547 40b3ce25 ljiyeon
                                    currentControl = null;
3548 b643fcca taeseongkim
                                    ViewerDataModel.Instance.SetAngleVisible(Visibility.Collapsed);
3549 40b3ce25 ljiyeon
                                }
3550
                                else
3551
                                {
3552
                                    currentControl = new ArrowArcControl
3553 787a4489 KangIngu
                                    {
3554 c7fde400 taeseongkim
                                        StartPoint = new Point(CanvasDrawingMouseDownPoint.X, CanvasDrawingMouseDownPoint.Y),
3555 40b3ce25 ljiyeon
                                        Background = new SolidColorBrush(Colors.Black)
3556
                                    };
3557 24678e06 humkyung
                                    currentControl.CommentID = Commons.shortGuid();
3558 40b3ce25 ljiyeon
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3559
                                    currentControl.IsNew = true;
3560
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3561 b643fcca taeseongkim
                                    ViewerDataModel.Instance.SetAngleVisible(Visibility.Visible);
3562 40b3ce25 ljiyeon
                                }
3563 e66f22eb KangIngu
                                //}
3564 787a4489 KangIngu
                            }
3565 e6a9ddaf humkyung
                            else if (e.RightButton == MouseButtonState.Pressed)
3566 787a4489 KangIngu
                            {
3567 40b3ce25 ljiyeon
                                if (currentControl != null)
3568
                                {
3569
                                    (currentControl as ArrowArcControl).setClock();
3570 24c5e56c taeseongkim
                                    (currentControl as ArrowArcControl).MiddlePoint = new Point(0, 0);
3571 40b3ce25 ljiyeon
                                    //(currentControl as ArcControl).ApplyTemplate();
3572
                                }
3573 787a4489 KangIngu
                            }
3574
                        }
3575
                        break;
3576 233ef333 taeseongkim
3577 787a4489 KangIngu
                    case ControlType.ArrowMultiLine:
3578
                        {
3579 e6a9ddaf humkyung
                            if (e.LeftButton == MouseButtonState.Pressed)
3580 787a4489 KangIngu
                            {
3581 e66f22eb KangIngu
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3582
                                //{
3583 233ef333 taeseongkim
                                if (currentControl is ArrowControl_Multi)
3584
                                {
3585
                                    var content = currentControl as ArrowControl_Multi;
3586
                                    if (content.MiddlePoint == new Point(0, 0))
3587 787a4489 KangIngu
                                    {
3588 233ef333 taeseongkim
                                        if (ViewerDataModel.Instance.IsAxisLock || ViewerDataModel.Instance.IsPressShift)
3589 787a4489 KangIngu
                                        {
3590 233ef333 taeseongkim
                                            content.MiddlePoint = content.EndPoint;
3591 787a4489 KangIngu
                                        }
3592
                                        else
3593
                                        {
3594 233ef333 taeseongkim
                                            content.MiddlePoint = new Point(CanvasDrawingMouseDownPoint.X, CanvasDrawingMouseDownPoint.Y);
3595 787a4489 KangIngu
                                        }
3596
                                    }
3597
                                    else
3598
                                    {
3599 233ef333 taeseongkim
                                        //20180906 LJY TEST IsRotationDrawingEnable
3600
                                        if (IsGetoutpoint((currentControl as ArrowControl_Multi).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3601 787a4489 KangIngu
                                        {
3602 233ef333 taeseongkim
                                            return;
3603
                                        }
3604
3605
                                        CreateCommand.Instance.Execute(currentControl);
3606
3607
                                        currentControl = null;
3608
                                        ViewerDataModel.Instance.SetAngleVisible(Visibility.Collapsed);
3609 787a4489 KangIngu
                                    }
3610 233ef333 taeseongkim
                                }
3611
                                else
3612
                                {
3613
                                    currentControl = new ArrowControl_Multi
3614
                                    {
3615
                                        StartPoint = new Point(CanvasDrawingMouseDownPoint.X, CanvasDrawingMouseDownPoint.Y),
3616
                                        Background = new SolidColorBrush(Colors.Black)
3617
                                    };
3618
                                    currentControl.CommentID = Commons.shortGuid();
3619
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3620
                                    currentControl.IsNew = true;
3621
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3622
                                    ViewerDataModel.Instance.SetAngleVisible(Visibility.Visible);
3623
                                }
3624 e66f22eb KangIngu
                                //}
3625 787a4489 KangIngu
                            }
3626
                        }
3627
                        break;
3628 233ef333 taeseongkim
3629 787a4489 KangIngu
                    case ControlType.PolygonCloud:
3630
                        {
3631
                            if (currentControl is CloudControl)
3632
                            {
3633
                                var control = currentControl as CloudControl;
3634 e6a9ddaf humkyung
                                if (e.RightButton == MouseButtonState.Pressed)
3635 787a4489 KangIngu
                                {
3636
                                    control.IsCompleted = true;
3637
                                }
3638
3639
                                if (!control.IsCompleted)
3640
                                {
3641
                                    control.PointSet.Add(control.EndPoint);
3642
                                }
3643
                                else
3644
                                {
3645 ca40e004 ljiyeon
                                    //20180906 LJY TEST IsRotationDrawingEnable
3646
                                    if (IsGetoutpoint((currentControl as CloudControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3647 e66f22eb KangIngu
                                    {
3648
                                        return;
3649
                                    }
3650
3651 f513c215 humkyung
                                    CreateCommand.Instance.Execute(currentControl);
3652 787a4489 KangIngu
3653
                                    control.isTransOn = true;
3654
                                    var firstPoint = control.PointSet.First();
3655
3656
                                    control.PointSet.Add(firstPoint);
3657
                                    control.DrawingCloud();
3658
                                    control.ApplyOverViewData();
3659
3660
                                    currentControl = null;
3661
                                }
3662
                            }
3663
                            else
3664
                            {
3665 e6a9ddaf humkyung
                                if (e.LeftButton == MouseButtonState.Pressed)
3666 787a4489 KangIngu
                                {
3667
                                    currentControl = new CloudControl
3668
                                    {
3669
                                        PointSet = new List<Point>(),
3670
                                        PointC = new StylusPointSet()
3671
                                    };
3672
3673 e66f22eb KangIngu
                                    //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3674
                                    //{
3675 233ef333 taeseongkim
                                    var polygonControl = (currentControl as CloudControl);
3676
                                    currentControl.CommentID = Commons.shortGuid();
3677
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3678
                                    currentControl.IsNew = true;
3679
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3680
3681
                                    polygonControl.PointSet.Add(CanvasDrawingMouseDownPoint);
3682
                                    polygonControl.PointSet.Add(CanvasDrawingMouseDownPoint);
3683 787a4489 KangIngu
3684 e66f22eb KangIngu
                                    //}
3685 787a4489 KangIngu
                                }
3686
                            }
3687
                        }
3688
                        break;
3689 233ef333 taeseongkim
3690 787a4489 KangIngu
                    case ControlType.ImgControl:
3691
                        {
3692 e6a9ddaf humkyung
                            if (e.LeftButton == MouseButtonState.Pressed)
3693 787a4489 KangIngu
                            {
3694 e66f22eb KangIngu
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3695
                                //{
3696 233ef333 taeseongkim
                                if (currentControl is ImgControl)
3697
                                {
3698
                                    //20180906 LJY TEST IsRotationDrawingEnable
3699
                                    if (IsGetoutpoint((currentControl as ImgControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3700 787a4489 KangIngu
                                    {
3701 233ef333 taeseongkim
                                        return;
3702 787a4489 KangIngu
                                    }
3703 233ef333 taeseongkim
3704
                                    CreateCommand.Instance.Execute(currentControl);
3705
                                    controlType = ControlType.ImgControl;
3706
                                    currentControl = null;
3707
                                }
3708
                                else
3709
                                {
3710
                                    string extension = System.IO.Path.GetExtension(filename).ToUpper();
3711
                                    if (extension == ".PNG" || extension == ".JPEG" || extension == ".GIF" || extension == ".BMP" || extension == ".JPG" || extension == ".SVG")
3712 787a4489 KangIngu
                                    {
3713 b42dd24d taeseongkim
                                        UriBuilder downloadUri = new UriBuilder(App.BaseAddress);
3714
                                        UriBuilder uri = new UriBuilder(filename);
3715
                                        uri.Host = downloadUri.Host;
3716
                                        uri.Port = downloadUri.Port;
3717
3718 233ef333 taeseongkim
                                        Image img = new Image();
3719
                                        if (filename.Contains(".svg"))
3720 787a4489 KangIngu
                                        {
3721 233ef333 taeseongkim
                                            byte[] imageData = null;
3722
                                            DrawingImage image = null;
3723
                                            using (System.Net.WebClient web = new System.Net.WebClient())
3724 53880c83 ljiyeon
                                            {
3725 b42dd24d taeseongkim
                                                imageData = web.DownloadData(uri.Uri);
3726 233ef333 taeseongkim
                                                System.IO.Stream stream = new System.IO.MemoryStream(imageData);
3727
                                                image = SvgReader.Load(stream);
3728 53880c83 ljiyeon
                                            }
3729 233ef333 taeseongkim
                                            img.Source = image;
3730
                                        }
3731
                                        else
3732
                                        {
3733 b42dd24d taeseongkim
                                            img.Source = new BitmapImage(uri.Uri);
3734 233ef333 taeseongkim
                                        }
3735 787a4489 KangIngu
3736 233ef333 taeseongkim
                                        currentControl = new ImgControl
3737
                                        {
3738
                                            Background = new SolidColorBrush(Colors.Black),
3739
                                            PointSet = new List<Point>(),
3740 b42dd24d taeseongkim
                                            FilePath = uri.Uri.ToString(),
3741 233ef333 taeseongkim
                                            ImageData = img.Source,
3742
                                            StartPoint = CanvasDrawingMouseDownPoint,
3743
                                            EndPoint = new Point(CanvasDrawingMouseDownPoint.X + 100, CanvasDrawingMouseDownPoint.Y + 100),
3744
                                            TopRightPoint = new Point(CanvasDrawingMouseDownPoint.X, CanvasDrawingMouseDownPoint.Y + 100),
3745
                                            LeftBottomPoint = new Point(CanvasDrawingMouseDownPoint.X + 100, CanvasDrawingMouseDownPoint.Y),
3746
                                            ControlType = ControlType.ImgControl
3747
                                        };
3748
3749
                                        currentControl.CommentID = Commons.shortGuid();
3750
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3751
                                        currentControl.IsNew = true;
3752
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3753
3754
                                        //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정
3755 fa48eb85 taeseongkim
                                        (currentControl as ImgControl).CommentAngle -= rotate.Angle;
3756
                                    }
3757 233ef333 taeseongkim
                                }
3758 e66f22eb KangIngu
                                //}
3759 787a4489 KangIngu
                            }
3760
                        }
3761
                        break;
3762 233ef333 taeseongkim
3763 787a4489 KangIngu
                    case ControlType.Date:
3764
                        {
3765 e6a9ddaf humkyung
                            if (e.LeftButton == MouseButtonState.Pressed)
3766 787a4489 KangIngu
                            {
3767 e66f22eb KangIngu
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3768
                                //{
3769 6b6e937c taeseongkim
                                if (currentControl is DateControl)
3770
                                {
3771
                                    //20180906 LJY TEST IsRotationDrawingEnable
3772
                                    if (IsGetoutpoint((currentControl as DateControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3773 787a4489 KangIngu
                                    {
3774 6b6e937c taeseongkim
                                        return;
3775
                                    }
3776 e66f22eb KangIngu
3777 6b6e937c taeseongkim
                                    CreateCommand.Instance.Execute(currentControl);
3778
                                    currentControl = null;
3779 787a4489 KangIngu
3780 6b6e937c taeseongkim
                                    if (Common.ViewerDataModel.Instance.SelectedControl == "Batch")
3781 b74a9c91 taeseongkim
                                    { 
3782 6b6e937c taeseongkim
                                        controlType = ControlType.None;
3783
                                        IsSwingMode = false;
3784
                                        Common.ViewerDataModel.Instance.SelectedControl = "";
3785
                                        Common.ViewerDataModel.Instance.ControlTag = null;
3786
                                        mouseHandlingMode = MouseHandlingMode.None;
3787
                                        this.ParentOfType<MainWindow>().dzTopMenu.btn_Batch.IsChecked = false;
3788
                                        txtBatch.Visibility = Visibility.Collapsed;
3789 787a4489 KangIngu
                                    }
3790 6b6e937c taeseongkim
                                }
3791
                                else
3792
                                {
3793
                                    currentControl = new DateControl
3794 787a4489 KangIngu
                                    {
3795 6b6e937c taeseongkim
                                        StartPoint = CanvasDrawingMouseDownPoint,
3796
                                        Background = new SolidColorBrush(Colors.Black)
3797
                                    };
3798
                                    currentControl.CommentID = Commons.shortGuid();
3799
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3800
                                    currentControl.IsNew = true;
3801
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3802 ca40e004 ljiyeon
3803 233ef333 taeseongkim
                                    //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정
3804 6b6e937c taeseongkim
                                    if (currentControl is ImgControl)
3805
                                    {
3806 fa48eb85 taeseongkim
                                        (currentControl as ImgControl).CommentAngle -= rotate.Angle;
3807 6b6e937c taeseongkim
                                    }
3808 ca40e004 ljiyeon
                                }
3809 e66f22eb KangIngu
                                //}
3810 787a4489 KangIngu
                            }
3811
                        }
3812
                        break;
3813 233ef333 taeseongkim
3814 787a4489 KangIngu
                    case ControlType.TextControl:
3815
                        {
3816 e6a9ddaf humkyung
                            if (e.LeftButton == MouseButtonState.Pressed)
3817 787a4489 KangIngu
                            {
3818
                                if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3819
                                {
3820
                                    currentControl = new TextControl
3821
                                    {
3822
                                        ControlType = controlType
3823
                                    };
3824 610a4b86 KangIngu
                                    (currentControl as TextControl).TextSize = ViewerDataModel.Instance.TextSize;
3825 24678e06 humkyung
                                    currentControl.CommentID = Commons.shortGuid();
3826 8742caa5 humkyung
                                    currentControl.IsNew = true;
3827
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3828
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3829 1066bae3 ljiyeon
                                    currentControl.SetValue(Canvas.ZIndexProperty, 3);
3830
3831 c7fde400 taeseongkim
                                    currentControl.SetValue(TextControl.CanvasXProperty, CanvasDrawingMouseDownPoint.X);
3832
                                    currentControl.SetValue(TextControl.CanvasYProperty, CanvasDrawingMouseDownPoint.Y);
3833 233ef333 taeseongkim
3834 8742caa5 humkyung
                                    (currentControl as TextControl).ControlType_No = 0;
3835 fa48eb85 taeseongkim
                                    (currentControl as TextControl).CommentAngle -= rotate.Angle;
3836 8742caa5 humkyung
                                    (currentControl as TextControl).IsHighLight = ViewerDataModel.Instance.checkHighShape;
3837 6b5d33c6 djkim
                                    (currentControl as TextControl).ApplyTemplate();
3838
                                    (currentControl as TextControl).Base_TextBox.Focus();
3839 4fcb686a taeseongkim
                                    (currentControl as TextControl).SetFontFamily(this.ParentOfType<MainWindow>().dzTopMenu.GetFontFamily().FontFamily);
3840 f513c215 humkyung
                                    CreateCommand.Instance.Execute(currentControl);
3841 787a4489 KangIngu
                                }
3842
                            }
3843
                        }
3844
                        break;
3845 233ef333 taeseongkim
3846 787a4489 KangIngu
                    case ControlType.TextBorder:
3847
                        {
3848 e6a9ddaf humkyung
                            if (e.LeftButton == MouseButtonState.Pressed)
3849 787a4489 KangIngu
                            {
3850
                                if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3851
                                {
3852
                                    currentControl = new TextControl
3853
                                    {
3854
                                        ControlType = controlType
3855
                                    };
3856
3857 610a4b86 KangIngu
                                    (currentControl as TextControl).TextSize = ViewerDataModel.Instance.TextSize;
3858 787a4489 KangIngu
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3859 24678e06 humkyung
                                    currentControl.CommentID = Commons.shortGuid();
3860 787a4489 KangIngu
                                    currentControl.IsNew = true;
3861
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3862
                                    currentControl.SetValue(Canvas.ZIndexProperty, 3);
3863 c7fde400 taeseongkim
                                    currentControl.SetValue(TextControl.CanvasXProperty, CanvasDrawingMouseDownPoint.X);
3864
                                    currentControl.SetValue(TextControl.CanvasYProperty, CanvasDrawingMouseDownPoint.Y);
3865 233ef333 taeseongkim
3866 787a4489 KangIngu
                                    (currentControl as TextControl).ControlType_No = 1;
3867 fa48eb85 taeseongkim
                                    (currentControl as TextControl).CommentAngle = Ang;
3868 787a4489 KangIngu
                                    (currentControl as TextControl).IsHighLight = ViewerDataModel.Instance.checkHighShape;
3869 6b5d33c6 djkim
                                    (currentControl as TextControl).ApplyTemplate();
3870
                                    (currentControl as TextControl).Base_TextBox.Focus();
3871 4fcb686a taeseongkim
                                    (currentControl as TextControl).SetFontFamily(this.ParentOfType<MainWindow>().dzTopMenu.GetFontFamily().FontFamily);
3872 f513c215 humkyung
                                    CreateCommand.Instance.Execute(currentControl);
3873 787a4489 KangIngu
                                }
3874
                            }
3875
                        }
3876
                        break;
3877 233ef333 taeseongkim
3878 787a4489 KangIngu
                    case ControlType.TextCloud:
3879
                        {
3880 e6a9ddaf humkyung
                            if (e.LeftButton == MouseButtonState.Pressed)
3881 787a4489 KangIngu
                            {
3882
                                if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3883
                                {
3884
                                    currentControl = new TextControl
3885
                                    {
3886
                                        ControlType = controlType
3887
                                    };
3888 610a4b86 KangIngu
3889
                                    (currentControl as TextControl).TextSize = ViewerDataModel.Instance.TextSize;
3890 24678e06 humkyung
                                    currentControl.CommentID = Commons.shortGuid();
3891 787a4489 KangIngu
                                    currentControl.IsNew = true;
3892
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3893
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3894
3895
                                    currentControl.SetValue(Canvas.ZIndexProperty, 3);
3896 c7fde400 taeseongkim
                                    currentControl.SetValue(TextControl.CanvasXProperty, CanvasDrawingMouseDownPoint.X);
3897
                                    currentControl.SetValue(TextControl.CanvasYProperty, CanvasDrawingMouseDownPoint.Y);
3898 787a4489 KangIngu
3899 fa48eb85 taeseongkim
                                    (currentControl as TextControl).CommentAngle = Ang;
3900 787a4489 KangIngu
                                    (currentControl as TextControl).ControlType_No = 2;
3901
                                    (currentControl as TextControl).IsHighLight = ViewerDataModel.Instance.checkHighShape;
3902 6b5d33c6 djkim
                                    (currentControl as TextControl).ApplyTemplate();
3903 4fcb686a taeseongkim
3904
                                    (currentControl as TextControl).SetFontFamily(this.ParentOfType<MainWindow>().dzTopMenu.GetFontFamily().FontFamily);
3905
3906 6b5d33c6 djkim
                                    (currentControl as TextControl).Base_TextBox.Focus();
3907 f513c215 humkyung
                                    CreateCommand.Instance.Execute(currentControl);
3908 664ea2e1 taeseongkim
                                    
3909 49b217ad humkyung
                                    //currentControl = null;
3910 787a4489 KangIngu
                                }
3911
                            }
3912
                        }
3913
                        break;
3914 233ef333 taeseongkim
3915 787a4489 KangIngu
                    case ControlType.ArrowTextControl:
3916 233ef333 taeseongkim
                        {
3917 e6a9ddaf humkyung
                            if (e.LeftButton == MouseButtonState.Pressed)
3918 787a4489 KangIngu
                            {
3919
                                if (currentControl is ArrowTextControl)
3920
                                {
3921 ca40e004 ljiyeon
                                    //20180906 LJY TEST IsRotationDrawingEnable
3922
                                    if (IsGetoutpoint((currentControl as ArrowTextControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3923 e66f22eb KangIngu
                                    {
3924
                                        return;
3925 f513c215 humkyung
                                    }
3926 e66f22eb KangIngu
3927 f513c215 humkyung
                                    CreateCommand.Instance.Execute(currentControl);
3928 1305c420 taeseongkim
3929 b74a9c91 taeseongkim
                                    try
3930
                                    {
3931 1305c420 taeseongkim
                                        if(!(currentControl as ArrowTextControl).IsEditingMode)
3932
                                        {
3933
                                            ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3934
                                        }
3935 b74a9c91 taeseongkim
                                    }
3936
                                    catch (Exception ex)
3937
                                    {
3938
                                        System.Diagnostics.Debug.WriteLine(ex.ToString());
3939
                                    }
3940 787a4489 KangIngu
3941
                                    (currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false;
3942
                                    (currentControl as ArrowTextControl).EnableEditing = false;
3943 49b217ad humkyung
                                    (currentControl as ArrowTextControl).IsNew = false;
3944 787a4489 KangIngu
                                    currentControl = null;
3945
                                }
3946
                                else
3947
                                {
3948 e66f22eb KangIngu
                                    //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3949
                                    //{
3950 907a99b3 taeseongkim
                                    currentControl = new ArrowTextControl()
3951
                                    {
3952
                                        PageAngle = ViewerDataModel.Instance.PageAngle
3953
                                    };
3954
3955 233ef333 taeseongkim
                                    currentControl.CommentID = Commons.shortGuid();
3956
                                    currentControl.IsNew = true;
3957
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3958 1305c420 taeseongkim
3959
                                    try
3960
                                    {
3961
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3962
                                    }
3963
                                    catch (Exception ex)
3964
                                    {
3965
                                        System.Diagnostics.Debug.WriteLine(ex.ToString());
3966
                                    }
3967 787a4489 KangIngu
3968 233ef333 taeseongkim
                                    currentControl.SetValue(Canvas.ZIndexProperty, 3);
3969
                                    currentControl.SetValue(ArrowTextControl.StartPointProperty, CanvasDrawingMouseDownPoint);
3970
                                    currentControl.SetValue(ArrowTextControl.EndPointProperty, CanvasDrawingMouseDownPoint);
3971
                                    (currentControl as ArrowTextControl).TextSize = ViewerDataModel.Instance.TextSize;
3972
                                    (currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape;
3973 787a4489 KangIngu
3974 233ef333 taeseongkim
                                    //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정
3975 fa48eb85 taeseongkim
                                    (currentControl as ArrowTextControl).CommentAngle -= rotate.Angle;
3976 787a4489 KangIngu
3977 fa48eb85 taeseongkim
                                    (currentControl as ArrowTextControl).ApplyTemplate();
3978 233ef333 taeseongkim
                                    (currentControl as ArrowTextControl).Base_TextBox.Focus();
3979 4fcb686a taeseongkim
                                    (currentControl as ArrowTextControl).SetFontFamily(this.ParentOfType<MainWindow>().dzTopMenu.GetFontFamily().FontFamily);
3980 233ef333 taeseongkim
                                    ViewerDataModel.Instance.SetAngleVisible(Visibility.Visible);
3981 ca40e004 ljiyeon
3982 e66f22eb KangIngu
                                    //}
3983 787a4489 KangIngu
                                }
3984
                            }
3985
                        }
3986
                        break;
3987 233ef333 taeseongkim
3988 787a4489 KangIngu
                    case ControlType.ArrowTransTextControl:
3989
                        {
3990 e6a9ddaf humkyung
                            if (e.LeftButton == MouseButtonState.Pressed)
3991 787a4489 KangIngu
                            {
3992
                                if (currentControl is ArrowTextControl)
3993
                                {
3994 ca40e004 ljiyeon
                                    //20180906 LJY TEST IsRotationDrawingEnable
3995
                                    if (IsGetoutpoint((currentControl as ArrowTextControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3996 e66f22eb KangIngu
                                    {
3997
                                        return;
3998 f513c215 humkyung
                                    }
3999 e66f22eb KangIngu
4000 f513c215 humkyung
                                    CreateCommand.Instance.Execute(currentControl);
4001 55d4f382 송근호
4002 787a4489 KangIngu
                                    (currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false;
4003 233ef333 taeseongkim
4004 49b217ad humkyung
                                    currentControl.IsNew = false;
4005 787a4489 KangIngu
                                    currentControl = null;
4006 b643fcca taeseongkim
                                    ViewerDataModel.Instance.SetAngleVisible(Visibility.Collapsed);
4007 787a4489 KangIngu
                                }
4008
                                else
4009
                                {
4010 e66f22eb KangIngu
                                    //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4011
                                    //{
4012 120b8b00 송근호
                                    currentControl = new ArrowTextControl()
4013
                                    {
4014 907a99b3 taeseongkim
                                        ControlType = ControlType.ArrowTransTextControl,
4015
                                        PageAngle = ViewerDataModel.Instance.PageAngle
4016 120b8b00 송근호
                                    };
4017
                                    currentControl.CommentID = Commons.shortGuid();
4018
                                    currentControl.IsNew = true;
4019
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4020
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4021
                                    currentControl.SetValue(Canvas.ZIndexProperty, 3);
4022 c7fde400 taeseongkim
                                    currentControl.SetValue(ArrowTextControl.StartPointProperty, CanvasDrawingMouseDownPoint);
4023 233ef333 taeseongkim
                                    currentControl.SetValue(ArrowTextControl.EndPointProperty, CanvasDrawingMouseDownPoint);
4024 120b8b00 송근호
                                    (currentControl as ArrowTextControl).TextSize = ViewerDataModel.Instance.TextSize;
4025
                                    (currentControl as ArrowTextControl).isFixed = true;
4026
                                    (currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape;
4027 787a4489 KangIngu
4028 233ef333 taeseongkim
                                    //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정
4029 fa48eb85 taeseongkim
                                    (currentControl as ArrowTextControl).CommentAngle -= rotate.Angle;
4030 ca40e004 ljiyeon
4031 120b8b00 송근호
                                    (currentControl as ArrowTextControl).ApplyTemplate();
4032
                                    (currentControl as ArrowTextControl).Base_TextBox.Focus();
4033
                                    (currentControl as ArrowTextControl).isTrans = true;
4034 4fcb686a taeseongkim
                                    (currentControl as ArrowTextControl).SetFontFamily(this.ParentOfType<MainWindow>().dzTopMenu.GetFontFamily().FontFamily);
4035 787a4489 KangIngu
                                }
4036
                            }
4037
                        }
4038
                        break;
4039 233ef333 taeseongkim
4040 787a4489 KangIngu
                    case ControlType.ArrowTextBorderControl:
4041 233ef333 taeseongkim
                        {
4042 e6a9ddaf humkyung
                            if (e.LeftButton == MouseButtonState.Pressed)
4043 787a4489 KangIngu
                            {
4044
                                if (currentControl is ArrowTextControl)
4045
                                {
4046 ca40e004 ljiyeon
                                    //20180906 LJY TEST IsRotationDrawingEnable
4047
                                    if (IsGetoutpoint((currentControl as ArrowTextControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
4048 e66f22eb KangIngu
                                    {
4049
                                        return;
4050
                                    }
4051
4052 f513c215 humkyung
                                    CreateCommand.Instance.Execute(currentControl);
4053 787a4489 KangIngu
                                    (currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false;
4054 49b217ad humkyung
                                    currentControl.IsNew = false;
4055 787a4489 KangIngu
                                    currentControl = null;
4056 b643fcca taeseongkim
                                    ViewerDataModel.Instance.SetAngleVisible(Visibility.Collapsed);
4057 787a4489 KangIngu
                                }
4058
                                else
4059
                                {
4060 e66f22eb KangIngu
                                    //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4061
                                    //{
4062 233ef333 taeseongkim
                                    currentControl = new ArrowTextControl()
4063
                                    {
4064 907a99b3 taeseongkim
                                        ArrowTextStyle = MarkupToPDF.Controls.Text.ArrowTextControl.ArrowTextStyleSet.Rect,
4065
                                        PageAngle = ViewerDataModel.Instance.PageAngle
4066 233ef333 taeseongkim
                                    };
4067
                                    currentControl.CommentID = Commons.shortGuid();
4068
                                    currentControl.IsNew = true;
4069
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4070
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4071 787a4489 KangIngu
4072 233ef333 taeseongkim
                                    currentControl.SetValue(Canvas.ZIndexProperty, 3);
4073
4074
                                    currentControl.SetValue(ArrowTextControl.StartPointProperty, CanvasDrawingMouseDownPoint);
4075 787a4489 KangIngu
4076 233ef333 taeseongkim
                                    currentControl.SetValue(ArrowTextControl.EndPointProperty, CanvasDrawingMouseDownPoint);
4077
                                    (currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape;
4078
                                    (currentControl as ArrowTextControl).TextSize = ViewerDataModel.Instance.TextSize;
4079 4fcb686a taeseongkim
                                    (currentControl as ArrowTextControl).SetFontFamily(this.ParentOfType<MainWindow>().dzTopMenu.GetFontFamily().FontFamily);
4080 233ef333 taeseongkim
                                    //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정
4081
                                    (currentControl as ArrowTextControl).CommentAngle -= rotate.Angle;
4082
                                    (currentControl as ArrowTextControl).ApplyTemplate();
4083
                                    (currentControl as ArrowTextControl).Base_TextBox.Focus();
4084
                                    ViewerDataModel.Instance.SetAngleVisible(Visibility.Visible);
4085 e66f22eb KangIngu
                                    //}
4086 787a4489 KangIngu
                                }
4087
                            }
4088
                        }
4089
                        break;
4090 233ef333 taeseongkim
4091 787a4489 KangIngu
                    case ControlType.ArrowTransTextBorderControl:
4092
                        {
4093 e6a9ddaf humkyung
                            if (e.LeftButton == MouseButtonState.Pressed)
4094 787a4489 KangIngu
                            {
4095
                                if (currentControl is ArrowTextControl)
4096
                                {
4097 ca40e004 ljiyeon
                                    //20180906 LJY TEST IsRotationDrawingEnable
4098
                                    if (IsGetoutpoint((currentControl as ArrowTextControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
4099 e66f22eb KangIngu
                                    {
4100
                                        return;
4101
                                    }
4102 f513c215 humkyung
                                    CreateCommand.Instance.Execute(currentControl);
4103 787a4489 KangIngu
                                    (currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false;
4104 49b217ad humkyung
                                    currentControl.IsNew = false;
4105 787a4489 KangIngu
                                    currentControl = null;
4106 55d4f382 송근호
4107 b643fcca taeseongkim
                                    ViewerDataModel.Instance.SetAngleVisible(Visibility.Collapsed);
4108 787a4489 KangIngu
                                }
4109
                                else
4110
                                {
4111 e66f22eb KangIngu
                                    //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4112
                                    //{
4113 ca40e004 ljiyeon
                                    currentControl = new ArrowTextControl()
4114 120b8b00 송근호
                                    {
4115
                                        ArrowTextStyle = MarkupToPDF.Controls.Text.ArrowTextControl.ArrowTextStyleSet.Rect,
4116 4f017ed3 taeseongkim
                                        ControlType = ControlType.ArrowTransTextBorderControl,
4117
                                        PageAngle = ViewerDataModel.Instance.PageAngle
4118 120b8b00 송근호
                                    };
4119 4f017ed3 taeseongkim
                                    
4120 233ef333 taeseongkim
                                    currentControl.CommentID = Commons.shortGuid();
4121
                                    currentControl.IsNew = true;
4122
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4123
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4124 787a4489 KangIngu
4125 233ef333 taeseongkim
                                    currentControl.SetValue(Canvas.ZIndexProperty, 3);
4126
4127
                                    currentControl.SetValue(ArrowTextControl.StartPointProperty, CanvasDrawingMouseDownPoint);
4128
                                    currentControl.SetValue(ArrowTextControl.EndPointProperty, CanvasDrawingMouseDownPoint);
4129
                                    (currentControl as ArrowTextControl).TextSize = ViewerDataModel.Instance.TextSize;
4130
                                    (currentControl as ArrowTextControl).isFixed = true;
4131
                                    (currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape;
4132
4133
                                    //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정
4134
                                    (currentControl as ArrowTextControl).CommentAngle -= rotate.Angle;
4135
                                    (currentControl as ArrowTextControl).ApplyTemplate();
4136 4fcb686a taeseongkim
                                    (currentControl as ArrowTextControl).SetFontFamily(this.ParentOfType<MainWindow>().dzTopMenu.GetFontFamily().FontFamily);
4137 233ef333 taeseongkim
                                    (currentControl as ArrowTextControl).Base_TextBox.Focus();
4138
                                    ViewerDataModel.Instance.SetAngleVisible(Visibility.Visible);
4139 787a4489 KangIngu
4140 ca40e004 ljiyeon
                                    //20180911 LJY
4141 233ef333 taeseongkim
                                    (currentControl as ArrowTextControl).isTrans = true;
4142 ca40e004 ljiyeon
4143 e66f22eb KangIngu
                                    //}
4144 787a4489 KangIngu
                                }
4145
                            }
4146
                        }
4147
                        break;
4148 233ef333 taeseongkim
4149 787a4489 KangIngu
                    case ControlType.ArrowTextCloudControl:
4150
                        {
4151 e6a9ddaf humkyung
                            if (e.LeftButton == MouseButtonState.Pressed)
4152 787a4489 KangIngu
                            {
4153
                                if (currentControl is ArrowTextControl)
4154
                                {
4155 ca40e004 ljiyeon
                                    //20180906 LJY TEST IsRotationDrawingEnable
4156
                                    if (IsGetoutpoint((currentControl as ArrowTextControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
4157 e66f22eb KangIngu
                                    {
4158
                                        return;
4159
                                    }
4160 f513c215 humkyung
                                    CreateCommand.Instance.Execute(currentControl);
4161 787a4489 KangIngu
                                    (currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false;
4162 49b217ad humkyung
                                    currentControl.IsNew = false;
4163 787a4489 KangIngu
                                    currentControl = null;
4164 b643fcca taeseongkim
                                    ViewerDataModel.Instance.SetAngleVisible(Visibility.Collapsed);
4165 787a4489 KangIngu
                                }
4166
                                else
4167
                                {
4168 e66f22eb KangIngu
                                    //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4169
                                    //{
4170 233ef333 taeseongkim
                                    currentControl = new ArrowTextControl()
4171
                                    {
4172 907a99b3 taeseongkim
                                        ArrowTextStyle = MarkupToPDF.Controls.Text.ArrowTextControl.ArrowTextStyleSet.Cloud,
4173 4fcb686a taeseongkim
                                        PageAngle = ViewerDataModel.Instance.PageAngle,
4174
                                        ControlType = ControlType.ArrowTextCloudControl
4175 233ef333 taeseongkim
                                    };
4176
                                    currentControl.CommentID = Commons.shortGuid();
4177
                                    currentControl.IsNew = true;
4178
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4179
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4180 787a4489 KangIngu
4181 233ef333 taeseongkim
                                    currentControl.SetValue(Canvas.ZIndexProperty, 3);
4182
                                    currentControl.SetValue(ArrowTextControl.StartPointProperty, CanvasDrawingMouseDownPoint);
4183
                                    currentControl.SetValue(ArrowTextControl.EndPointProperty, CanvasDrawingMouseDownPoint);
4184
                                    (currentControl as ArrowTextControl).TextSize = ViewerDataModel.Instance.TextSize;
4185
                                    (currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape;
4186 4fcb686a taeseongkim
                                    (currentControl as ArrowTextControl).SetFontFamily((this.ParentOfType<MainWindow>().dzTopMenu.comboFontFamily.SelectedValue as Markus.Fonts.MarkusFont).FontFamily);
4187 233ef333 taeseongkim
                                    //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정
4188
                                    (currentControl as ArrowTextControl).CommentAngle -= rotate.Angle;
4189
4190
                                    (currentControl as ArrowTextControl).ApplyTemplate();
4191
                                    (currentControl as ArrowTextControl).Base_TextBox.Focus();
4192
                                    ViewerDataModel.Instance.SetAngleVisible(Visibility.Visible);
4193 e66f22eb KangIngu
                                    //}
4194 787a4489 KangIngu
                                }
4195
                            }
4196
                        }
4197
                        break;
4198 233ef333 taeseongkim
4199 787a4489 KangIngu
                    case ControlType.ArrowTransTextCloudControl:
4200
                        {
4201 e6a9ddaf humkyung
                            if (e.LeftButton == MouseButtonState.Pressed)
4202 787a4489 KangIngu
                            {
4203
                                if (currentControl is ArrowTextControl)
4204
                                {
4205 ca40e004 ljiyeon
                                    //20180906 LJY TEST IsRotationDrawingEnable
4206
                                    if (IsGetoutpoint((currentControl as ArrowTextControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
4207 e66f22eb KangIngu
                                    {
4208
                                        return;
4209
                                    }
4210 f513c215 humkyung
                                    CreateCommand.Instance.Execute(currentControl);
4211 787a4489 KangIngu
                                    (currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false;
4212 49b217ad humkyung
                                    currentControl.IsNew = false;
4213 787a4489 KangIngu
                                    currentControl = null;
4214 b643fcca taeseongkim
                                    ViewerDataModel.Instance.SetAngleVisible(Visibility.Collapsed);
4215 787a4489 KangIngu
                                }
4216
                                else
4217
                                {
4218 e66f22eb KangIngu
                                    //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4219
                                    //{
4220 233ef333 taeseongkim
                                    currentControl = new ArrowTextControl()
4221
                                    {
4222
                                        ArrowTextStyle = MarkupToPDF.Controls.Text.ArrowTextControl.ArrowTextStyleSet.Cloud,
4223 907a99b3 taeseongkim
                                        ControlType = ControlType.ArrowTransTextCloudControl,
4224
                                        PageAngle = ViewerDataModel.Instance.PageAngle
4225 233ef333 taeseongkim
                                    };
4226
                                    currentControl.CommentID = Commons.shortGuid();
4227
                                    currentControl.IsNew = true;
4228
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4229
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4230
                                    currentControl.SetValue(Canvas.ZIndexProperty, 3);
4231 120b8b00 송근호
4232 233ef333 taeseongkim
                                    currentControl.SetValue(ArrowTextControl.StartPointProperty, CanvasDrawingMouseDownPoint);
4233
                                    currentControl.SetValue(ArrowTextControl.EndPointProperty, CanvasDrawingMouseDownPoint);
4234
                                    (currentControl as ArrowTextControl).TextSize = ViewerDataModel.Instance.TextSize;
4235
                                    (currentControl as ArrowTextControl).isFixed = true;
4236
                                    (currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape;
4237
4238
                                    //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정
4239
                                    (currentControl as ArrowTextControl).CommentAngle -= rotate.Angle;
4240 4fcb686a taeseongkim
                                    (currentControl as ArrowTextControl).SetFontFamily(this.ParentOfType<MainWindow>().dzTopMenu.GetFontFamily().FontFamily);
4241 233ef333 taeseongkim
                                    (currentControl as ArrowTextControl).ApplyTemplate();
4242
                                    (currentControl as ArrowTextControl).Base_TextBox.Focus();
4243
                                    ViewerDataModel.Instance.SetAngleVisible(Visibility.Visible);
4244 787a4489 KangIngu
4245 ca40e004 ljiyeon
                                    //20180911 LJY
4246 233ef333 taeseongkim
                                    (currentControl as ArrowTextControl).isTrans = true;
4247 e66f22eb KangIngu
                                    //}
4248 787a4489 KangIngu
                                }
4249
                            }
4250
                        }
4251
                        break;
4252
                    //강인구 추가
4253
                    case ControlType.Sign:
4254
                        {
4255 e6a9ddaf humkyung
                            if (e.LeftButton == MouseButtonState.Pressed)
4256 787a4489 KangIngu
                            {
4257 e66f22eb KangIngu
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4258
                                //{
4259 d7e20d2d taeseongkim
                                var _sign = await BaseTaskClient.GetSignDataAsync(App.ViewInfo.ProjectNO, App.ViewInfo.UserID);
4260 992a98b4 KangIngu
4261 d7e20d2d taeseongkim
                                if (_sign == null)
4262 233ef333 taeseongkim
                                {
4263
                                    txtBatch.Visibility = Visibility.Collapsed;
4264
                                    mouseHandlingMode = IKCOM.MouseHandlingMode.None;
4265
                                    controlType = ControlType.None;
4266
4267
                                    this.ParentOfType<MainWindow>().DialogMessage_Alert("등록된 Sign이 없습니다.", "Alert");
4268
                                    this.ParentOfType<MainWindow>().ChildrenOfType<RadToggleButton>().Where(data => data.IsChecked == true).FirstOrDefault().IsChecked = false;
4269
                                    return;
4270
                                }
4271 74abcf6f taeseongkim
                                else
4272
                                {
4273
                                    if ( Application.Current.Resources.Keys.OfType<string>().Count(x => x == "UserSign") == 0)
4274
                                    {
4275
                                        Application.Current.Resources.Add("UserSign", _sign);
4276
                                    }
4277
                                    else
4278
                                    {
4279
                                        Application.Current.Resources["UserSign"] = _sign;
4280
                                    }
4281
                                }
4282 992a98b4 KangIngu
4283 233ef333 taeseongkim
                                if (currentControl is SignControl)
4284
                                {
4285
                                    //20180906 LJY TEST IsRotationDrawingEnable
4286
                                    if (IsGetoutpoint((currentControl as SignControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
4287
                                    {
4288 992a98b4 KangIngu
                                        return;
4289
                                    }
4290
4291 233ef333 taeseongkim
                                    CreateCommand.Instance.Execute(currentControl);
4292
                                    currentControl = null;
4293
                                    if (Common.ViewerDataModel.Instance.SelectedControl == "Batch")
4294 787a4489 KangIngu
                                    {
4295 233ef333 taeseongkim
                                        txtBatch.Text = "Place Date";
4296
                                        controlType = ControlType.Date;
4297 787a4489 KangIngu
                                    }
4298 233ef333 taeseongkim
                                }
4299
                                else
4300
                                {
4301
                                    currentControl = new SignControl
4302 787a4489 KangIngu
                                    {
4303 233ef333 taeseongkim
                                        Background = new SolidColorBrush(Colors.Black),
4304
                                        UserNumber = App.ViewInfo.UserID,
4305
                                        ProjectNO = App.ViewInfo.ProjectNO,
4306
                                        StartPoint = new Point(CanvasDrawingMouseDownPoint.X, CanvasDrawingMouseDownPoint.Y),
4307
                                        EndPoint = new Point(CanvasDrawingMouseDownPoint.X, CanvasDrawingMouseDownPoint.Y),
4308
                                        ControlType = ControlType.Sign
4309
                                    };
4310 787a4489 KangIngu
4311 233ef333 taeseongkim
                                    currentControl.CommentID = Commons.shortGuid();
4312
                                    currentControl.IsNew = true;
4313
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4314
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4315 ca40e004 ljiyeon
4316 233ef333 taeseongkim
                                    //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정
4317
                                    (currentControl as SignControl).CommentAngle -= rotate.Angle;
4318 ca40e004 ljiyeon
                                }
4319 e66f22eb KangIngu
                                //}
4320 787a4489 KangIngu
                            }
4321
                        }
4322
                        break;
4323 233ef333 taeseongkim
4324 787a4489 KangIngu
                    case ControlType.Mark:
4325
                        {
4326 e6a9ddaf humkyung
                            if (e.LeftButton == MouseButtonState.Pressed)
4327 787a4489 KangIngu
                            {
4328 e66f22eb KangIngu
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4329
                                //{
4330 233ef333 taeseongkim
                                if (currentControl is RectangleControl)
4331
                                {
4332
                                    //20180906 LJY TEST IsRotationDrawingEnable
4333
                                    if (IsGetoutpoint((currentControl as RectangleControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
4334 787a4489 KangIngu
                                    {
4335 233ef333 taeseongkim
                                        return;
4336
                                    }
4337 e66f22eb KangIngu
4338 233ef333 taeseongkim
                                    CreateCommand.Instance.Execute(currentControl);
4339
                                    (currentControl as RectangleControl).ApplyOverViewData();
4340
                                    currentControl = null;
4341 787a4489 KangIngu
4342 902faaea taeseongkim
                                    this.cursor = new Cursor(App.DefaultArrowCursorStream);
4343 233ef333 taeseongkim
4344
                                    if (Common.ViewerDataModel.Instance.SelectedControl == "Batch")
4345
                                    {
4346
                                        txtBatch.Text = "Place Signature";
4347
                                        controlType = ControlType.Sign;
4348 787a4489 KangIngu
                                    }
4349 233ef333 taeseongkim
                                }
4350
                                else
4351
                                {
4352
                                    currentControl = new RectangleControl
4353 787a4489 KangIngu
                                    {
4354 233ef333 taeseongkim
                                        StartPoint = new Point(CanvasDrawingMouseDownPoint.X, CanvasDrawingMouseDownPoint.Y),
4355
                                        Background = new SolidColorBrush(Colors.Black),
4356
                                        ControlType = ControlType.Mark,
4357
                                        Paint = PaintSet.Fill
4358
                                    };
4359 787a4489 KangIngu
4360 233ef333 taeseongkim
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4361
                                    currentControl.CommentID = Commons.shortGuid();
4362
                                    currentControl.IsNew = true;
4363
                                    (currentControl as RectangleControl).DashSize = ViewerDataModel.Instance.DashSize;
4364
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4365
                                }
4366 e66f22eb KangIngu
                                //}
4367 787a4489 KangIngu
                            }
4368
                        }
4369
                        break;
4370 233ef333 taeseongkim
4371 787a4489 KangIngu
                    case ControlType.Symbol:
4372
                        {
4373 e6a9ddaf humkyung
                            if (e.LeftButton == MouseButtonState.Pressed)
4374 787a4489 KangIngu
                            {
4375 a6272c57 humkyung
                                if (currentControl is SymControl)
4376
                                {
4377
                                    //20180906 LJY TEST IsRotationDrawingEnable
4378
                                    if (IsGetoutpoint((currentControl as SymControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
4379 787a4489 KangIngu
                                    {
4380 a6272c57 humkyung
                                        return;
4381 787a4489 KangIngu
                                    }
4382 a6272c57 humkyung
                                    CreateCommand.Instance.Execute(currentControl);
4383
                                    currentControl = null;
4384 233ef333 taeseongkim
4385 902faaea taeseongkim
                                    this.cursor = new Cursor(App.DefaultArrowCursorStream);
4386 a6272c57 humkyung
                                }
4387
                                else
4388
                                {
4389
                                    currentControl = new SymControl
4390 787a4489 KangIngu
                                    {
4391 c7fde400 taeseongkim
                                        StartPoint = new Point(CanvasDrawingMouseDownPoint.X, CanvasDrawingMouseDownPoint.Y),
4392 a6272c57 humkyung
                                        Background = new SolidColorBrush(Colors.Black),
4393
                                        LineSize = ViewerDataModel.Instance.LineSize + 3,
4394
                                        ControlType = ControlType.Symbol
4395
                                    };
4396 787a4489 KangIngu
4397 a6272c57 humkyung
                                    currentControl.IsNew = true;
4398
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4399
                                    currentControl.CommentID = Commons.shortGuid();
4400
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4401 ca40e004 ljiyeon
4402 233ef333 taeseongkim
                                    //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정
4403 fa48eb85 taeseongkim
                                    (currentControl as SymControl).CommentAngle -= rotate.Angle;
4404 ca40e004 ljiyeon
                                }
4405 e66f22eb KangIngu
                                //}
4406 787a4489 KangIngu
                            }
4407
                        }
4408
                        break;
4409 233ef333 taeseongkim
4410 787a4489 KangIngu
                    case ControlType.Stamp:
4411
                        {
4412 e6a9ddaf humkyung
                            if (e.LeftButton == MouseButtonState.Pressed)
4413 787a4489 KangIngu
                            {
4414 e66f22eb KangIngu
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4415
                                //{
4416 233ef333 taeseongkim
                                if (currentControl is SymControlN)
4417
                                {
4418
                                    //20180906 LJY TEST IsRotationDrawingEnable
4419
                                    if (IsGetoutpoint((currentControl as SymControlN).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
4420 787a4489 KangIngu
                                    {
4421 233ef333 taeseongkim
                                        return;
4422
                                    }
4423 e66f22eb KangIngu
4424 233ef333 taeseongkim
                                    CreateCommand.Instance.Execute(currentControl);
4425
                                    currentControl = null;
4426 510cbd2a ljiyeon
4427 902faaea taeseongkim
                                    this.cursor = new Cursor(App.DefaultArrowCursorStream);
4428 233ef333 taeseongkim
                                }
4429
                                else
4430
                                {
4431
                                    currentControl = new SymControlN
4432 787a4489 KangIngu
                                    {
4433 233ef333 taeseongkim
                                        StartPoint = new Point(CanvasDrawingMouseDownPoint.X, CanvasDrawingMouseDownPoint.Y),
4434
                                        Background = new SolidColorBrush(Colors.Black),
4435
                                        STAMP = App.SystemInfo.STAMP,
4436
                                        ControlType = ControlType.Stamp
4437
                                    };
4438 787a4489 KangIngu
4439 233ef333 taeseongkim
                                    currentControl.IsNew = true;
4440
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4441
                                    currentControl.CommentID = Commons.shortGuid();
4442
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4443
                                    //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정
4444
                                    (currentControl as SymControlN).CommentAngle -= rotate.Angle;
4445
                                }
4446 e66f22eb KangIngu
                                //}
4447 787a4489 KangIngu
                            }
4448
                        }
4449
                        break;
4450 233ef333 taeseongkim
4451 787a4489 KangIngu
                    case ControlType.PenControl:
4452
                        {
4453
                            if (inkBoard.Tag.ToString() == "Ink")
4454
                            {
4455
                                inkBoard.IsEnabled = true;
4456 c7fde400 taeseongkim
                                StartNewStroke(CanvasDrawingMouseDownPoint);
4457 787a4489 KangIngu
                            }
4458
                            else if (inkBoard.Tag.ToString() == "EraseByPoint")
4459
                            {
4460 c7fde400 taeseongkim
                                RemovePointStroke(CanvasDrawingMouseDownPoint);
4461 787a4489 KangIngu
                            }
4462
                            else if (inkBoard.Tag.ToString() == "EraseByStroke")
4463
                            {
4464 c7fde400 taeseongkim
                                RemoveLineStroke(CanvasDrawingMouseDownPoint);
4465 787a4489 KangIngu
                            }
4466
                            IsDrawing = true;
4467
                            return;
4468
                        }
4469
                    default:
4470
                        if (currentControl != null)
4471
                        {
4472
                            currentControl.CommentID = null;
4473
                            currentControl.IsNew = false;
4474
                        }
4475
                        break;
4476
                }
4477 fa48eb85 taeseongkim
4478 4fcb686a taeseongkim
                try
4479
                {
4480
                    if (currentControl is ITextControl)
4481
                    {
4482
                        var textBox = currentControl.ChildrenOfType<TextBox>().Where(x=> x.Name == "PART_ArrowTextBox" || x.Name == "Base_TextBox" || x.Name == "PART_TextBox");
4483
4484
                        if(textBox.Count() > 0)
4485
                        {
4486
                            Behaviors.SpecialcharRemove specialcharRemove = new Behaviors.SpecialcharRemove();
4487
                            specialcharRemove.Attach(textBox.First());
4488
                        }
4489
                        else
4490
                        {
4491
4492
                        }
4493
4494
                    }
4495
                }
4496
                catch (Exception ex)
4497
                {
4498
                    System.Diagnostics.Debug.WriteLine(ex);
4499
4500
                }
4501
4502 1b2cf911 taeseongkim
                if (currentControl is ArrowTextControl)
4503
                {
4504
                    (currentControl as ArrowTextControl).EditEnded += (snd, evt) =>
4505
                    {
4506
                        var control = snd as ArrowTextControl;
4507
4508
                        if (string.IsNullOrEmpty(control.ArrowText))
4509
                        {
4510
                            DeleteCommand.Instance.Execute(new [] { control });
4511
                        }
4512
                    };
4513
4514
                }
4515 b74a9c91 taeseongkim
4516
                if (Common.ViewerDataModel.Instance.IsMacroCommand)
4517
                {
4518
                    if (currentControl == null && mouseHandlingMode == MouseHandlingMode.Drawing)
4519
                    {
4520
                        MacroHelper.MacroAction();
4521
                    }
4522
                    //if (currentControl.ControlType)
4523
                    //txtBatch.Text = "Draw a TextBox";
4524
                    //controlType = ControlType.ArrowTextBorderControl;
4525
                }
4526
4527 4f017ed3 taeseongkim
                //if (currentControl != null)
4528
                //{
4529
                //    currentControl.PageAngle = pageNavigator.CurrentPage.Angle;
4530
                //}
4531 787a4489 KangIngu
            }
4532 e6a9ddaf humkyung
            if (mouseHandlingMode != MouseHandlingMode.None && e.LeftButton == MouseButtonState.Pressed)
4533 787a4489 KangIngu
            {
4534 b74a9c91 taeseongkim
                // MACRO 버튼클릭하여 CLOUD RECT 그린 후
4535
             
4536
4537 787a4489 KangIngu
                if (mouseHandlingMode == MouseHandlingMode.Adorner && SelectLayer.Children.Count > 0)
4538
                {
4539
                    bool mouseOff = false;
4540
                    foreach (var item in SelectLayer.Children)
4541
                    {
4542
                        if (item is AdornerFinal)
4543
                        {
4544 4913851c humkyung
                            var over = (item as AdornerFinal).Members.Where(data => data.DrawingData.IsMouseOver).FirstOrDefault();
4545 787a4489 KangIngu
                            if (over != null)
4546
                            {
4547
                                mouseOff = true;
4548
                            }
4549
                        }
4550
                    }
4551
4552
                    if (!mouseOff)
4553
                    {
4554 077896be humkyung
                        SelectionSet.Instance.UnSelect(this);
4555 787a4489 KangIngu
                    }
4556
                }
4557
                zoomAndPanControl.CaptureMouse();
4558
                e.Handled = true;
4559
            }
4560
        }
4561 e54660e8 KangIngu
4562 a1716fa5 KangIngu
        private void zoomAndPanControl2_MouseDown(object sender, MouseButtonEventArgs e)
4563
        {
4564 e6a9ddaf humkyung
            ///mouseButtonDown = e.ChangedButton;
4565 a1716fa5 KangIngu
            canvasZoommovingMouseDownPoint = e.GetPosition(zoomAndPanCanvas2);
4566
        }
4567
4568 787a4489 KangIngu
        private void RemoveLineStroke(Point P)
4569
        {
4570 a342d378 taeseongkim
            var control = ViewerDataModel.Instance.MarkupControls_USER.Where(data => data.IsMouseEnter).FirstOrDefault();
4571 787a4489 KangIngu
            if (control != null)
4572
            {
4573 f729ef4e humkyung
                DeleteCommand.Instance.Execute(new List<CommentUserInfo>() { control });
4574 787a4489 KangIngu
            }
4575
        }
4576
4577
        private void RemovePointStroke(Point P)
4578
        {
4579
            foreach (Stroke hits in inkBoard.Strokes)
4580
            {
4581
                foreach (StylusPoint sty in hits.StylusPoints)
4582
                {
4583
                }
4584
                if (hits.HitTest(P))
4585
                {
4586
                    inkBoard.Strokes.Remove(hits);
4587
                    return;
4588
                }
4589
            }
4590
        }
4591
4592
        private void StartNewStroke(Point P)
4593
        {
4594
            strokePoints = new StylusPointCollection();
4595
            StylusPoint segment1Start = new StylusPoint(P.X, P.Y);
4596
            strokePoints.Add(segment1Start);
4597
            stroke = new Stroke(strokePoints);
4598
4599
            stroke.DrawingAttributes.Color = Colors.Red;
4600
            stroke.DrawingAttributes.Width = 4;
4601
            stroke.DrawingAttributes.Height = 4;
4602
4603
            inkBoard.Strokes.Add(stroke);
4604
        }
4605
4606 77cdac33 taeseongkim
        private async  void btnConsolidate_Click(object sender, RoutedEventArgs e)
4607 787a4489 KangIngu
        {
4608 b42dd24d taeseongkim
            //SelectionSet.Instance.UnSelect(this.ParentOfType<MainWindow>().dzMainMenu);
4609
            //// update mylist and gridview
4610
            //this.UpdateMyMarkupList();
4611
4612
            //bool result = await this.ParentOfType<MainWindow>().dzTopMenu.ExecuteSaveCommand(this);
4613
4614
            //if (result)
4615
            //{
4616 cf1cc862 taeseongkim
                btnFinalPDF.IsEnabled = false;
4617
4618 77cdac33 taeseongkim
              await  ConsolidationMethod();
4619 b42dd24d taeseongkim
            //}
4620
            //else
4621
            //{
4622
            //    MessageBox.Show("오류");
4623
            //}
4624 787a4489 KangIngu
        }
4625
4626 102476f6 humkyung
        /// <summary>
4627
        /// execute TeamConsolidationCommand
4628
        /// </summary>
4629 77cdac33 taeseongkim
        public void TeamConsolidationMethod2()
4630 04a7385a djkim
        {
4631
            if (this.gridViewMarkup.SelectedItems.Count == 0)
4632
            {
4633
                this.ParentOfType<MainWindow>().DialogMessage_Alert("Please select at least one user", "Alert");
4634
            }
4635
            else
4636
            {
4637 8129f2a5 ljiyeon
4638 77cdac33 taeseongkim
                ViewerDataModel.Instance.IsConsolidate = true;
4639
                SelectionSet.Instance.UnSelect(Common.ViewerDataModel.Instance.SystemMain.dzMainMenu);
4640
                // update mylist and gridview
4641
        
4642
                Common.ViewerDataModel.Instance.SystemMain.dzTopMenu.ExecuteSaveCommand(Common.ViewerDataModel.Instance.SystemMain.dzMainMenu);
4643
                //this.ParentOfType<MainWindow>().dzTopMenu._SaveEvent(null, null);
4644
                ViewerDataModel.Instance.IsConsolidate = false;
4645
                Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.UpdateMyMarkupList();
4646 04a7385a djkim
                foreach (MarkupInfoItem item in this.gridViewMarkup.SelectedItems)
4647
                {
4648
                    if (!this.userData.DEPARTMENT.Equals(item.Depatment))
4649
                    {
4650
                        this.ParentOfType<MainWindow>().DialogMessage_Alert("Please select at your department", "Alert");
4651
                        return;
4652 233ef333 taeseongkim
                    }
4653 04a7385a djkim
                }
4654 102476f6 humkyung
                List<MarkupInfoItem> MarkupInfoList = new List<MarkupInfoItem>();
4655 04a7385a djkim
                foreach (MarkupInfoItem item in this.gridViewMarkup.SelectedItems)
4656 90e7968d ljiyeon
                {
4657 102476f6 humkyung
                    MarkupInfoList.Add(item);
4658 04a7385a djkim
                }
4659 77cdac33 taeseongkim
4660 102476f6 humkyung
                TeamConsolidateCommand.Instance.Execute(MarkupInfoList);
4661 04a7385a djkim
            }
4662
        }
4663 77cdac33 taeseongkim
        public async void TeamConsolidationMethod()
4664 787a4489 KangIngu
        {
4665 b42dd24d taeseongkim
            bool result = false;
4666
4667 787a4489 KangIngu
            if (this.gridViewMarkup.SelectedItems.Count == 0)
4668
            {
4669
                this.ParentOfType<MainWindow>().DialogMessage_Alert("Please select at least one user", "Alert");
4670
            }
4671
            else
4672 90e7968d ljiyeon
            {
4673 77cdac33 taeseongkim
                foreach (MarkupInfoItem item in this.gridViewMarkup.SelectedItems)
4674 35a96e24 humkyung
                {
4675 77cdac33 taeseongkim
                    if (!this.userData.DEPARTMENT.Equals(item.Depatment))
4676
                    {
4677
                        this.ParentOfType<MainWindow>().DialogMessage_Alert("Please select at your department", "Alert");
4678
                    }
4679 35a96e24 humkyung
                }
4680 233ef333 taeseongkim
4681 77cdac33 taeseongkim
                var isSave = await this.ParentOfType<MainWindow>().dzTopMenu.SaveEventAsync();
4682
4683
                if (isSave)
4684
                {
4685
                    var token = ViewerDataModel.Instance.NewCancellationToken();
4686
4687
                    await MarkupLoadAsync(pageNavigator.CurrentPage.PageNumber, ViewerDataModel.Instance.PageAngle, token);
4688
                     
4689
                    List<IKCOM.MarkupInfoItem> MySelectItem = new List<IKCOM.MarkupInfoItem>();
4690
                    foreach (var item in this.gridViewMarkup.SelectedItems)
4691
                    {
4692
                        MySelectItem.Add(item as IKCOM.MarkupInfoItem);
4693
                    }
4694
4695
                    TeamConsolidateCommand.Instance.Execute(MySelectItem);
4696
                    result = true;
4697
                }
4698
            }
4699
        }
4700
4701
        public async Task<bool> ConsolidationMethod()
4702
        {
4703
            bool result = false;
4704
4705
            if (this.gridViewMarkup.SelectedItems.Count == 0)
4706
            {
4707
                this.ParentOfType<MainWindow>().DialogMessage_Alert("Please select at least one user", "Alert");
4708
            }
4709
            else
4710
            {
4711
                var isSave = await this.ParentOfType<MainWindow>().dzTopMenu.SaveEventAsync();
4712
4713
                if (isSave)
4714
                {
4715
                    var token = ViewerDataModel.Instance.NewCancellationToken();
4716
                    await MarkupLoadAsync(pageNavigator.CurrentPage.PageNumber, ViewerDataModel.Instance.PageAngle, token);
4717
4718
                    List<IKCOM.MarkupInfoItem> MySelectItem = new List<IKCOM.MarkupInfoItem>();
4719
                    foreach (var item in this.gridViewMarkup.SelectedItems)
4720
                    {
4721
                        MySelectItem.Add(item as IKCOM.MarkupInfoItem);
4722
                    }
4723
                    int iPageNo = Convert.ToInt32(this.ParentOfType<MainWindow>().dzTopMenu.tlcurrentPage.Text);
4724
4725
                    result = ConsolidateCommand.Instance.Execute(MySelectItem, iPageNo);
4726
                }
4727 787a4489 KangIngu
            }
4728 b42dd24d taeseongkim
4729
            return result;
4730 787a4489 KangIngu
        }
4731
4732
        private void btnConsolidate_Loaded(object sender, RoutedEventArgs e)
4733
        {
4734
            if (App.ViewInfo != null)
4735
            {
4736
                btnConsolidate = (sender as RadRibbonButton);
4737
                if (!App.ViewInfo.NewCommentPermission)
4738
                {
4739
                    (sender as RadRibbonButton).Visibility = System.Windows.Visibility.Collapsed;
4740
                }
4741
            }
4742
        }
4743
4744
        private void btnTeamConsolidate_Click(object sender, RoutedEventArgs e)
4745
        {
4746 04a7385a djkim
            TeamConsolidationMethod();
4747 787a4489 KangIngu
        }
4748
4749
        private void btnTeamConsolidate_Loaded(object sender, RoutedEventArgs e)
4750
        {
4751
            btnTeamConsolidate = sender as RadRibbonButton;
4752
            if (App.ViewInfo != null)
4753
            {
4754
                if (!App.ViewInfo.CreateFinalPDFPermission) //파이널이 True가 아니면
4755
                {
4756
                    if (btnConsolidate != null)
4757
                    {
4758
                        btnConsolidate.Visibility = Visibility.Collapsed;
4759
                    }
4760
4761
                    if (!App.ViewInfo.NewCommentPermission)
4762
                    {
4763
                        btnTeamConsolidate.Visibility = Visibility.Collapsed;
4764
                    }
4765
                }
4766
                else
4767
                {
4768
                    btnTeamConsolidate.Visibility = Visibility.Collapsed;
4769
                }
4770
            }
4771
        }
4772
4773 bae83c92 taeseongkim
        private async void FinalPDFEvent(object sender, RoutedEventArgs e)
4774 787a4489 KangIngu
        {
4775 b42dd24d taeseongkim
            SelectionSet.Instance.UnSelect(this.ParentOfType<MainWindow>().dzMainMenu);
4776
            // update mylist and gridview
4777
            this.UpdateMyMarkupList();
4778 a1e2ba68 taeseongkim
4779 bae83c92 taeseongkim
            var result = await this.ParentOfType<MainWindow>().dzTopMenu.ExecuteSaveCommand(this);
4780 b42dd24d taeseongkim
4781 bae83c92 taeseongkim
            if(!result)
4782
            {
4783 a1e2ba68 taeseongkim
4784 bae83c92 taeseongkim
            }
4785
            else
4786 787a4489 KangIngu
            {
4787 bae83c92 taeseongkim
                var item = gridViewMarkup.Items.Cast<MarkupInfoItem>().Where(d => d.Consolidate == 1 && d.AvoidConsolidate == 0).FirstOrDefault();
4788
4789
                if (item != null)
4790 81e3c9f6 ljiyeon
                {
4791 bae83c92 taeseongkim
                    if (BaseClient.FinalPDF_GetFinalPDFStatus(_DocInfo.ID, item.MarkupInfoID, _ViewInfo.UserID))
4792
                    {
4793
                        //Logger.sendReqLog("SetFinalPDFAsync", _ViewInfo.ProjectNO + "," + _DocInfo.ID + "," + item.MarkupInfoID + "," + _ViewInfo.UserID, 1);
4794 a1e2ba68 taeseongkim
4795 bae83c92 taeseongkim
                        BaseClient.SetFinalPDFAsync(_ViewInfo.ProjectNO, _DocInfo.ID, item.MarkupInfoID, _ViewInfo.UserID);
4796
4797
                        ViewerDataModel.Instance.FinalPDFTime = DateTime.Now;
4798
                    }
4799
                    else
4800
                    {
4801
                        DialogMessage_Alert("Merged PDF가 수행중입니다", "안내");
4802
                    }
4803 81e3c9f6 ljiyeon
                }
4804
                else
4805
                {
4806 bae83c92 taeseongkim
                    //Consolidate 가 없는 경우
4807
                    DialogMessage_Alert("Consolidation 된 코멘트가 존재하지 않습니다", "안내");
4808 81e3c9f6 ljiyeon
                }
4809 233ef333 taeseongkim
            }
4810 bae83c92 taeseongkim
4811 787a4489 KangIngu
        }
4812
4813
        private void btnFinalPDF_Loaded(object sender, RoutedEventArgs e)
4814
        {
4815
            btnFinalPDF = sender as RadRibbonButton;
4816
            if (App.ViewInfo != null)
4817
            {
4818 b42dd24d taeseongkim
                //btnFinalPDF.IsEnabled = false;
4819
4820 787a4489 KangIngu
                if (!App.ViewInfo.CreateFinalPDFPermission) //파이널이 True가 아니면
4821
                {
4822
                    btnFinalPDF.Visibility = System.Windows.Visibility.Collapsed;
4823
                    if (btnConsolidate != null)
4824
                    {
4825
                        btnConsolidate.Visibility = Visibility.Collapsed;
4826
                    }
4827
                }
4828
            }
4829
        }
4830
4831 b42dd24d taeseongkim
        private async void ConsolidateFinalPDFEvent(object sender, RoutedEventArgs e)
4832 80458c15 ljiyeon
        {
4833 b42dd24d taeseongkim
            //UpdateMyMarkupList();
4834 80458c15 ljiyeon
4835
            if (this.gridViewMarkup.SelectedItems.Count == 0)
4836
            {
4837
                this.ParentOfType<MainWindow>().DialogMessage_Alert("Please select at least one user", "Alert");
4838
            }
4839
            else
4840
            {
4841 b42dd24d taeseongkim
                //if ((App.ViewInfo.CreateFinalPDFPermission || App.ViewInfo.NewCommentPermission))
4842
                //{
4843
                //컨트롤을 그리는 도중일 경우 컨트롤 삭제
4844
                //ViewerDataModel.Instance.MarkupControls_USER.Remove(ViewerDataModel.Instance.SystemMain.dzMainMenu.currentControl);
4845
                //ViewerDataModel.Instance.SystemMain.dzMainMenu.currentControl = null;
4846 80458c15 ljiyeon
4847 b42dd24d taeseongkim
                //SelectionSet.Instance.UnSelect(this.ParentOfType<MainWindow>().dzMainMenu);
4848
                //// update mylist and gridview
4849
                //this.UpdateMyMarkupList();
4850
4851
                //var result = await this.ParentOfType<MainWindow>().dzTopMenu.ExecuteSaveCommand(this);
4852 324fcf3e taeseongkim
4853 1305c420 taeseongkim
                Mouse.SetCursor(Cursors.Wait);
4854 324fcf3e taeseongkim
4855 77cdac33 taeseongkim
                bool result = await ConsolidationMethod();
4856 80458c15 ljiyeon
4857 77cdac33 taeseongkim
                System.Threading.Thread.Sleep(500);
4858 1305c420 taeseongkim
4859
                if (result)
4860 80458c15 ljiyeon
                {
4861 1305c420 taeseongkim
                    var items = this.BaseClient.GetMarkupInfoItems(App.ViewInfo.ProjectNO, _DocInfo.ID);
4862
4863
                    var item2 = items.Where(d => d.Consolidate == 1 && d.AvoidConsolidate == 0).FirstOrDefault();
4864
                    if (item2 != null)
4865 bae83c92 taeseongkim
                    {
4866 1305c420 taeseongkim
                        if (BaseClient.FinalPDF_GetFinalPDFStatus(_DocInfo.ID, item2.MarkupInfoID, _ViewInfo.UserID))
4867
                        {
4868
                            //Logger.sendReqLog("SetFinalPDFAsync", _ViewInfo.ProjectNO + "," + _DocInfo.ID + "," + item2.MarkupInfoID + "," + _ViewInfo.UserID, 1);
4869 80458c15 ljiyeon
4870 1305c420 taeseongkim
                            BaseClient.SetFinalPDFAsync(_ViewInfo.ProjectNO, _DocInfo.ID, item2.MarkupInfoID, _ViewInfo.UserID);
4871
                            BaseClient.GetMarkupInfoItemsAsync(App.ViewInfo.ProjectNO, _DocInfo.ID);
4872 bae83c92 taeseongkim
4873 1305c420 taeseongkim
                            ViewerDataModel.Instance.FinalPDFTime = DateTime.Now;
4874
4875
                            Mouse.SetCursor(Cursors.Arrow);
4876
                        }
4877
                        else
4878
                        {
4879
                            DialogMessage_Alert("Merged PDF가 수행중입니다. 잠시 후 수행가능합니다.", "안내");
4880
                        }
4881 bae83c92 taeseongkim
                    }
4882
                    else
4883
                    {
4884 1305c420 taeseongkim
                        DialogMessage_Alert("Consolidation 된 코멘트가 존재하지 않습니다", "안내");
4885 bae83c92 taeseongkim
                    }
4886 80458c15 ljiyeon
                }
4887
                else
4888
                {
4889 1305c420 taeseongkim
                    DialogMessage_Alert("서버가 원활하지 않습니다. 다시 수행 바랍니다.", "안내");
4890 80458c15 ljiyeon
                }
4891 1305c420 taeseongkim
4892
                Mouse.SetCursor(Cursors.Arrow);
4893 90e7968d ljiyeon
            }
4894 80458c15 ljiyeon
        }
4895
4896
        private void btnConsolidateFinalPDF_Loaded(object sender, RoutedEventArgs e)
4897 90e7968d ljiyeon
        {
4898 80458c15 ljiyeon
            btnConsolidateFinalPDF = (sender as RadRibbonButton);
4899 84605c0c taeseongkim
#if Hyosung
4900
            btnConsolidateFinalPDF.Visibility = System.Windows.Visibility.Collapsed;
4901
#else
4902 b42dd24d taeseongkim
4903
            //btnConsolidateFinalPDF.IsEnabled = false;
4904
4905 80458c15 ljiyeon
            if (App.ViewInfo != null)
4906
            {
4907
                if (!App.ViewInfo.NewCommentPermission || !App.ViewInfo.CreateFinalPDFPermission)
4908
                {
4909 90e7968d ljiyeon
                    btnConsolidateFinalPDF.Visibility = System.Windows.Visibility.Collapsed;
4910 80458c15 ljiyeon
                }
4911 90e7968d ljiyeon
            }
4912 84605c0c taeseongkim
#endif
4913 80458c15 ljiyeon
        }
4914
4915 787a4489 KangIngu
        private void SyncCompare_Click(object sender, RoutedEventArgs e)
4916
        {
4917 adce8360 humkyung
            SetCompareRect();
4918 787a4489 KangIngu
        }
4919
4920 9cd2865b KangIngu
        private void Sync_Click(object sender, RoutedEventArgs e)
4921
        {
4922 a1716fa5 KangIngu
            if (Sync.IsChecked)
4923 9cd2865b KangIngu
            {
4924
                ViewerDataModel.Instance.Sync_ContentOffsetX = zoomAndPanControl.ContentOffsetX;
4925
                ViewerDataModel.Instance.Sync_ContentOffsetY = zoomAndPanControl.ContentOffsetY;
4926
                ViewerDataModel.Instance.Sync_ContentScale = zoomAndPanControl.ContentScale;
4927
            }
4928
        }
4929
4930 787a4489 KangIngu
        private void SyncUserListExpender_Click(object sender, RoutedEventArgs e)
4931
        {
4932
            if (UserList.IsChecked)
4933
            {
4934
                this.gridViewRevMarkup.Visibility = Visibility.Visible;
4935
            }
4936
            else
4937
            {
4938
                this.gridViewRevMarkup.Visibility = Visibility.Collapsed;
4939
            }
4940
        }
4941
4942
        private void SyncPageBalance_Click(object sender, RoutedEventArgs e)
4943
        {
4944
            if (BalanceMode.IsChecked)
4945
            {
4946
                ViewerDataModel.Instance.PageBalanceMode = true;
4947
            }
4948
            else
4949
            {
4950
                ViewerDataModel.Instance.PageBalanceMode = false;
4951
                ViewerDataModel.Instance.PageBalanceNumber = 0;
4952
            }
4953
        }
4954
4955
        private void SyncExit_Click(object sender, RoutedEventArgs e)
4956
        {
4957
            //초기화
4958
            testPanel2.IsHidden = true;
4959
            ViewerDataModel.Instance.PageBalanceMode = false;
4960
            ViewerDataModel.Instance.PageBalanceNumber = 0;
4961 752b18ef taeseongkim
            ViewerDataModel.Instance.SyncPageNumber = 0;
4962 787a4489 KangIngu
            ViewerDataModel.Instance.MarkupControls_Sync.Clear();
4963
            this.gridViewRevMarkup.Visibility = Visibility.Collapsed;
4964
            UserList.IsChecked = false;
4965
            BalanceMode.IsChecked = false;
4966
        }
4967
4968 ac4f1e13 taeseongkim
        private async void SyncPageChange_Click(object sender, RoutedEventArgs e)
4969 787a4489 KangIngu
        {
4970
            if ((sender as System.Windows.Controls.Control).Tag != null)
4971
            {
4972
                //Compare 초기화
4973
                CompareMode.IsChecked = false;
4974
                var balancePoint = Convert.ToInt32((sender as System.Windows.Controls.Control).Tag);
4975 752b18ef taeseongkim
                
4976
                if (ViewerDataModel.Instance.SyncPageNumber == 0)
4977 787a4489 KangIngu
                {
4978 752b18ef taeseongkim
                    ViewerDataModel.Instance.SyncPageNumber = 1;
4979 787a4489 KangIngu
                }
4980
4981
                if (ViewerDataModel.Instance.PageBalanceNumber == pageNavigator.PageCount)
4982
                {
4983
                }
4984
                else
4985
                {
4986
                    ViewerDataModel.Instance.PageBalanceNumber += balancePoint;
4987
                }
4988
4989 752b18ef taeseongkim
                if (ViewerDataModel.Instance.SyncPageNumber == pageNavigator.PageCount && balancePoint > 0)
4990 787a4489 KangIngu
                {
4991
                }
4992 752b18ef taeseongkim
                else if ((ViewerDataModel.Instance.SyncPageNumber + balancePoint) >= 1)
4993 787a4489 KangIngu
                {
4994 752b18ef taeseongkim
                    ViewerDataModel.Instance.SyncPageNumber += balancePoint;
4995 787a4489 KangIngu
                }
4996
4997 d04e8ee9 taeseongkim
                //pageNavigator.GotoPage(ViewerDataModel.Instance.PageNumber);
4998 6b6e937c taeseongkim
4999 787a4489 KangIngu
                if (!testPanel2.IsHidden)
5000
                {
5001
                    if (IsSyncPDFMode)
5002
                    {
5003
                        Get_FinalImage.Get_PdfImage get_PdfImage = new Get_FinalImage.Get_PdfImage();
5004 752b18ef taeseongkim
                        var pdfpath = new BitmapImage(new Uri(get_PdfImage.Run(CurrentRev.TO_VENDOR, App.ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, ViewerDataModel.Instance.SyncPageNumber)));
5005 787a4489 KangIngu
5006
                        if (pdfpath.IsDownloading)
5007
                        {
5008
                            pdfpath.DownloadCompleted += (ex, arg) =>
5009
                            {
5010
                                ViewerDataModel.Instance.ImageViewPath_C = pdfpath;
5011
                                ViewerDataModel.Instance.ImageViewWidth_C = pdfpath.PixelWidth;
5012
                                ViewerDataModel.Instance.ImageViewHeight_C = pdfpath.PixelHeight;
5013
                                zoomAndPanCanvas2.Width = pdfpath.PixelWidth;
5014
                                zoomAndPanCanvas2.Height = pdfpath.PixelHeight;
5015
                            };
5016
                        }
5017
                        else
5018
                        {
5019
                            ViewerDataModel.Instance.ImageViewPath_C = pdfpath;
5020
                            ViewerDataModel.Instance.ImageViewWidth_C = pdfpath.PixelWidth;
5021
                            ViewerDataModel.Instance.ImageViewHeight_C = pdfpath.PixelHeight;
5022
5023
                            zoomAndPanCanvas2.Width = pdfpath.PixelWidth;
5024
                            zoomAndPanCanvas2.Height = pdfpath.PixelHeight;
5025
                        }
5026
                    }
5027
                    else
5028
                    {
5029 752b18ef taeseongkim
                        string uri = this.GetImageURL(CurrentRev.DOCUMENT_ID, ViewerDataModel.Instance.SyncPageNumber);
5030 787a4489 KangIngu
5031 752b18ef taeseongkim
                        var isOriginalSize = !(ViewerDataModel.Instance.SyncPageNumber == pageNavigator.CurrentPage.PageNumber);
5032
                        ComparePageLoad(uri, isOriginalSize);
5033 787a4489 KangIngu
                    }
5034 4f017ed3 taeseongkim
                   
5035 787a4489 KangIngu
                    //강인구 추가(페이지 이동시 코멘트 재 호출)
5036
                    ViewerDataModel.Instance.MarkupControls_Sync.Clear();
5037
                    List<MarkupInfoItem> gridSelectionRevItem = gridViewRevMarkup.SelectedItems.Cast<MarkupInfoItem>().ToList();
5038
5039
                    foreach (var item in gridSelectionRevItem)
5040
                    {
5041 752b18ef taeseongkim
                        var markupitems = item.MarkupList.Where(pageItem => pageItem.PageNumber == ViewerDataModel.Instance.SyncPageNumber).ToList();
5042 ac4f1e13 taeseongkim
                        foreach (var markupitem in markupitems)
5043 787a4489 KangIngu
                        {
5044 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);
5045 ac4f1e13 taeseongkim
                        }
5046 787a4489 KangIngu
                    }
5047 e54660e8 KangIngu
5048 752b18ef taeseongkim
                    tlSyncPageNum.Text = String.Format("Current Page : {0}", ViewerDataModel.Instance.SyncPageNumber);
5049 787a4489 KangIngu
                }
5050
            }
5051
        }
5052
5053 43d2041c taeseongkim
        private void SyncRotation_Click(object sender,RoutedEventArgs e)
5054
        {
5055
            var direction = int.Parse((sender as Telerik.Windows.Controls.RadPathButton).Tag.ToString());
5056
5057
            double translateX = 0;
5058
            double translateY = 0;
5059
            double angle = rotate2.Angle;
5060
5061
            if (direction == 1)
5062
            {
5063
                if (angle < 270)
5064
                {
5065
                    angle += 90;
5066
                }
5067
                else
5068
                {
5069
                    angle = 0;
5070
                }
5071
            }
5072
            else
5073
            {
5074
                if (angle > 0)
5075
                {
5076
                    angle -= 90;
5077
                }
5078
                else
5079
                {
5080
                    angle = 270;
5081
                }
5082
            }
5083
            zoomAndPanControl2.RotationAngle = angle;
5084
            zoomAndPanControl2.ScaleToFit();
5085
5086
            //if (angle == 90 || angle == 270)
5087
            //{
5088
                double emptySize = zoomAndPanCanvas2.Width;
5089
                zoomAndPanCanvas2.Width = zoomAndPanCanvas2.Height;
5090
                zoomAndPanCanvas2.Height = emptySize;
5091
            //}
5092
5093
            if (angle == 90)
5094
            {
5095
                translateX = zoomAndPanCanvas2.Width;
5096
                translateY = 0;
5097
            }
5098
            else if (angle == 180)
5099
            {
5100
                translateX = zoomAndPanCanvas2.Width;
5101
                translateY = zoomAndPanCanvas2.Height;
5102
            }
5103
            else if (angle == 270)
5104
            {
5105
                translateX = 0;
5106
                translateY = zoomAndPanCanvas2.Height;
5107
            }
5108
            zoomAndPanControl2.ContentViewportWidth = zoomAndPanCanvas2.Width;
5109
            zoomAndPanControl2.ContentViewportHeight = zoomAndPanCanvas2.Height;
5110
            translate2.X = translateX;
5111
            translate2.Y = translateY;
5112
            rotate2.Angle = angle;
5113
            //translate2CompareBorder.X = translateX;
5114
            //translate2CompareBorder.Y = translateY;
5115
            //rotate2CompareBorder.Angle = angle;
5116
5117
        }
5118
5119 787a4489 KangIngu
        private void SyncChange_Click(object sender, RoutedEventArgs e)
5120
        {
5121
            if (MarkupMode.IsChecked)
5122
            {
5123
                IsSyncPDFMode = true;
5124
5125
                var uri = CurrentRev.TO_VENDOR;
5126 ae56d52d KangIngu
5127 752b18ef taeseongkim
                if (ViewerDataModel.Instance.SyncPageNumber == 0)
5128 787a4489 KangIngu
                {
5129 752b18ef taeseongkim
                    ViewerDataModel.Instance.SyncPageNumber = 1;
5130 787a4489 KangIngu
                }
5131
5132
                //PDF모드 잠시 대기(강인구)
5133
                Get_FinalImage.Get_PdfImage get_PdfImage = new Get_FinalImage.Get_PdfImage();
5134 752b18ef taeseongkim
                var pdfpath = new BitmapImage(new Uri(get_PdfImage.Run(CurrentRev.TO_VENDOR, App.ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, ViewerDataModel.Instance.SyncPageNumber)));
5135 787a4489 KangIngu
5136
                if (pdfpath.IsDownloading)
5137
                {
5138
                    pdfpath.DownloadCompleted += (ex, arg) =>
5139
                    {
5140
                        ViewerDataModel.Instance.ImageViewPath_C = pdfpath;
5141
                        ViewerDataModel.Instance.ImageViewWidth_C = pdfpath.PixelWidth;
5142
                        ViewerDataModel.Instance.ImageViewHeight_C = pdfpath.PixelHeight;
5143
                        zoomAndPanCanvas2.Width = pdfpath.PixelWidth;
5144
                        zoomAndPanCanvas2.Height = pdfpath.PixelHeight;
5145
                    };
5146
                }
5147
                else
5148
                {
5149
                    ViewerDataModel.Instance.ImageViewPath_C = pdfpath;
5150
                    ViewerDataModel.Instance.ImageViewWidth_C = pdfpath.PixelWidth;
5151
                    ViewerDataModel.Instance.ImageViewHeight_C = pdfpath.PixelHeight;
5152
5153
                    zoomAndPanCanvas2.Width = pdfpath.PixelWidth;
5154
                    zoomAndPanCanvas2.Height = pdfpath.PixelHeight;
5155
                }
5156
            }
5157
            else
5158
            {
5159
                IsSyncPDFMode = false;
5160 69f41aab humkyung
                string uri = this.GetImageURL(CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber);
5161 787a4489 KangIngu
5162 752b18ef taeseongkim
                ComparePageLoad(uri,false);
5163 787a4489 KangIngu
5164
                zoomAndPanControl2.ApplyTemplate();
5165
                zoomAndPanControl2.UpdateLayout();
5166
                zoomAndPanCanvas2.Width = Convert.ToDouble(Common.ViewerDataModel.Instance.ContentWidth);
5167
                zoomAndPanCanvas2.Height = Convert.ToDouble(Common.ViewerDataModel.Instance.ContentHeight);
5168
            }
5169
        }
5170
5171 adce8360 humkyung
        /// <summary>
5172
        /// Compare된 영역을 초기화
5173
        /// </summary>
5174
        private void ClearCompareRect()
5175
        {
5176
            da.From = 1;
5177
            da.To = 1;
5178
            da.Duration = new Duration(TimeSpan.FromSeconds(9999));
5179
            da.AutoReverse = false;
5180
            canvas_compareBorder.Children.Clear();
5181
            canvas_compareBorder.BeginAnimation(OpacityProperty, da);
5182
        }
5183
5184
        /// <summary>
5185 233ef333 taeseongkim
        /// 문서 Comprare
5186 adce8360 humkyung
        /// </summary>
5187
        private void SetCompareRect()
5188
        {
5189 43d2041c taeseongkim
            canvas_compareBorder.Children.Clear();
5190
5191 adce8360 humkyung
            if (CompareMode.IsChecked)
5192
            {
5193
                if (ViewerDataModel.Instance.PageBalanceMode && ViewerDataModel.Instance.PageBalanceNumber == 0)
5194
                {
5195
                    ViewerDataModel.Instance.PageBalanceNumber = 1;
5196
                }
5197 752b18ef taeseongkim
                if (ViewerDataModel.Instance.SyncPageNumber == 0)
5198 adce8360 humkyung
                {
5199 752b18ef taeseongkim
                    ViewerDataModel.Instance.SyncPageNumber = 1;
5200 adce8360 humkyung
                }
5201
5202 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);
5203 adce8360 humkyung
5204 41c4405e taeseongkim
                /// 비교대상원본, 비교할 대상
5205 752b18ef taeseongkim
                BaseClient.GetCompareRectAsync(_ViewInfo.ProjectNO, _ViewInfo.DocumentItemID,  CurrentRev.DOCUMENT_ID,  ViewerDataModel.Instance.SyncPageNumber.ToString(), pageNavigator.CurrentPage.PageNumber.ToString(), userData.COMPANY != "EXT" ? "true" : "false");
5206 adce8360 humkyung
            }
5207
            else
5208
            {
5209 43d2041c taeseongkim
                canvas_compareBorder.Visibility = Visibility.Hidden;
5210 adce8360 humkyung
                ClearCompareRect();
5211
            }
5212
        }
5213
5214 3212270d taeseongkim
        private void btnSync_Click(object sender, RoutedEventArgs e)
5215 787a4489 KangIngu
        {
5216
            gridViewHistory_Busy.IsBusy = true;
5217
5218
            RadButton instance = sender as RadButton;
5219
            if (instance.CommandParameter != null)
5220
            {
5221
                CurrentRev = instance.CommandParameter as VPRevision;
5222 adce8360 humkyung
                System.EventHandler<ServiceDeepView.GetSyncMarkupInfoItemsCompletedEventArgs> GetSyncMarkupInfoItemshandler = null;
5223
5224
                GetSyncMarkupInfoItemshandler = (sen, ea) =>
5225 787a4489 KangIngu
                {
5226
                    if (ea.Error == null && ea.Result != null)
5227
                    {
5228
                        testPanel2.IsHidden = false;
5229
5230 d128ceb2 humkyung
                        ViewerDataModel.Instance._markupInfoRevList.Clear();
5231 233ef333 taeseongkim
                        foreach (var info in ea.Result)
5232 d128ceb2 humkyung
                        {
5233 233ef333 taeseongkim
                            if (info.UserID == App.ViewInfo.UserID)
5234 d128ceb2 humkyung
                            {
5235
                                info.userDelete = true;
5236 8f7f8073 taeseongkim
                                info.DisplayColor = "#FFFF0000";
5237 d128ceb2 humkyung
                            }
5238
                            else
5239
                            {
5240
                                info.userDelete = false;
5241
                            }
5242
                            ViewerDataModel.Instance._markupInfoRevList.Add(info);
5243
                        }
5244 787a4489 KangIngu
                        gridViewRevMarkup.ItemsSource = ViewerDataModel.Instance._markupInfoRevList;
5245
5246 69f41aab humkyung
                        string uri = this.GetImageURL(CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber);
5247 752b18ef taeseongkim
                        ComparePageLoad(uri,false);
5248 787a4489 KangIngu
5249
                        Sync_Offset_Point = new Point(zoomAndPanControl.ContentOffsetX, zoomAndPanControl.ContentOffsetY);
5250
5251
                        zoomAndPanControl2.ApplyTemplate();
5252
                        zoomAndPanControl2.UpdateLayout();
5253 43d2041c taeseongkim
5254 787a4489 KangIngu
                        if (Sync_Offset_Point != new Point(zoomAndPanControl.ContentOffsetX, zoomAndPanControl.ContentOffsetY))
5255
                        {
5256
                            zoomAndPanControl.ContentOffsetX = Sync_Offset_Point.X;
5257
                            zoomAndPanControl.ContentOffsetY = Sync_Offset_Point.Y;
5258
                        }
5259
5260 9cd2865b KangIngu
                        ViewerDataModel.Instance.Sync_ContentOffsetX = Sync_Offset_Point.X;
5261
                        ViewerDataModel.Instance.Sync_ContentOffsetY = Sync_Offset_Point.Y;
5262
                        ViewerDataModel.Instance.Sync_ContentScale = zoomAndPanControl.ContentScale;
5263
5264 787a4489 KangIngu
                        tlSyncRev.Text = String.Format("Rev. {0}", CurrentRev.RevNo);
5265
                        tlSyncPageNum.Text = String.Format("Current Page : {0}", pageNavigator.CurrentPage.PageNumber);
5266 43d2041c taeseongkim
5267
                        zoomAndPanControl.ScaleToFit();
5268
                        zoomAndPanControl2.ScaleToFit();
5269
5270 787a4489 KangIngu
                        gridViewHistory_Busy.IsBusy = false;
5271
                    }
5272 0f065e57 ljiyeon
5273 664ea2e1 taeseongkim
                    //Logger.sendResLog("GetSyncMarkupInfoItemsCompleted", "UserState : " + ea.UserState + "\r Result :" + ea.Result + "\r Cancelled :" + ea.Cancelled + "\r Error :" + ea.Error, 1);
5274 adce8360 humkyung
5275
                    if (GetSyncMarkupInfoItemshandler != null)
5276
                    {
5277
                        BaseClient.GetSyncMarkupInfoItemsCompleted -= GetSyncMarkupInfoItemshandler;
5278
                    }
5279
5280 43d2041c taeseongkim
                    //ClearCompareRect();
5281 adce8360 humkyung
                    SetCompareRect();
5282 90e7968d ljiyeon
                };
5283 adce8360 humkyung
5284
                /// 중복 실행이 발생하여 수정함.
5285
                BaseClient.GetSyncMarkupInfoItemsCompleted += GetSyncMarkupInfoItemshandler;
5286 787a4489 KangIngu
                BaseClient.GetSyncMarkupInfoItemsAsync(_ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, _ViewInfo.UserID);
5287 adce8360 humkyung
5288 664ea2e1 taeseongkim
                //Logger.sendReqLog("GetSyncMarkupInfoItemsAsync", _ViewInfo.ProjectNO + "," + CurrentRev.DOCUMENT_ID + "," + _ViewInfo.UserID, 1);
5289 787a4489 KangIngu
            }
5290
        }
5291 4eb052e4 ljiyeon
5292 752b18ef taeseongkim
        private void OriginalSizeMode_Click(object sender,RoutedEventArgs e)
5293
        {
5294
            string uri = this.GetImageURL(CurrentRev.DOCUMENT_ID, ViewerDataModel.Instance.SyncPageNumber);
5295
            var isOriginalSize = !(ViewerDataModel.Instance.SyncPageNumber == pageNavigator.CurrentPage.PageNumber);
5296
5297 ffa5dbc7 taeseongkim
            ComparePageLoad(uri, OriginalSizeMode.IsChecked);
5298 752b18ef taeseongkim
        }
5299
5300 94b7c12c djkim
        private void EnsembleLink_Button_Click(object sender, RoutedEventArgs e)
5301
        {
5302
            try
5303
            {
5304
                if (sender is RadButton)
5305
                {
5306
                    if ((sender as RadButton).Tag != null)
5307
                    {
5308
                        var url = (sender as RadButton).Tag.ToString();
5309
                        System.Diagnostics.Process.Start(url);
5310
                    }
5311
                    else
5312
                    {
5313
                        this.ParentOfType<MainWindow>().DialogMessage_Alert("Link 정보가 잘못 되었습니다", "안내");
5314
                    }
5315
                }
5316
            }
5317
            catch (Exception ex)
5318
            {
5319 664ea2e1 taeseongkim
                //Logger.sendResLog("EnsembleLink_Button_Click", ex.Message, 0);
5320 94b7c12c djkim
            }
5321
        }
5322 787a4489 KangIngu
5323
        public void Sync_Event(VPRevision Currnet_Rev)
5324
        {
5325
            CurrentRev = Currnet_Rev;
5326
5327
            BaseClient.GetSyncMarkupInfoItemsCompleted += (sen, ea) =>
5328
            {
5329
                if (ea.Error == null && ea.Result != null)
5330
                {
5331
                    testPanel2.IsHidden = false;
5332
5333 d128ceb2 humkyung
                    ViewerDataModel.Instance._markupInfoRevList.Clear();
5334 233ef333 taeseongkim
                    foreach (var info in ea.Result)
5335 d128ceb2 humkyung
                    {
5336 233ef333 taeseongkim
                        if (info.UserID == App.ViewInfo.UserID)
5337 d128ceb2 humkyung
                        {
5338
                            info.userDelete = true;
5339 cf1cc862 taeseongkim
                            info.DisplayColor = "#FFFF0000";
5340 d128ceb2 humkyung
                        }
5341
                        else
5342
                        {
5343
                            info.userDelete = false;
5344
                        }
5345
                        ViewerDataModel.Instance._markupInfoRevList.Add(info);
5346
                    }
5347 787a4489 KangIngu
                    gridViewRevMarkup.ItemsSource = ViewerDataModel.Instance._markupInfoRevList;
5348
5349 69f41aab humkyung
                    string uri = this.GetImageURL(CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber);
5350 787a4489 KangIngu
5351
                    Sync_Offset_Point = new Point(zoomAndPanControl.ContentOffsetX, zoomAndPanControl.ContentOffsetY);
5352
5353 752b18ef taeseongkim
                    ComparePageLoad(uri,false);
5354 90e7968d ljiyeon
5355 787a4489 KangIngu
                    zoomAndPanCanvas2.Width = Convert.ToDouble(Common.ViewerDataModel.Instance.ContentWidth);
5356
                    zoomAndPanCanvas2.Height = Convert.ToDouble(Common.ViewerDataModel.Instance.ContentHeight);
5357
                    zoomAndPanControl2.ApplyTemplate();
5358
                    zoomAndPanControl2.UpdateLayout();
5359
5360
                    if (Sync_Offset_Point != new Point(zoomAndPanControl.ContentOffsetX, zoomAndPanControl.ContentOffsetY))
5361
                    {
5362
                        zoomAndPanControl.ContentOffsetX = Sync_Offset_Point.X;
5363
                        zoomAndPanControl.ContentOffsetY = Sync_Offset_Point.Y;
5364
                    }
5365
                    //}
5366 30878507 taeseongkim
                    
5367 787a4489 KangIngu
                    tlSyncRev.Text = String.Format("Rev. {0}", CurrentRev.RevNo);
5368
                    tlSyncPageNum.Text = String.Format("Current Page : {0}", pageNavigator.CurrentPage.PageNumber);
5369 90e7968d ljiyeon
                    gridViewHistory_Busy.IsBusy = false;
5370 787a4489 KangIngu
                }
5371 664ea2e1 taeseongkim
                //Logger.sendResLog("GetSyncMarkupInfoItemsCompleted", "UserState : " + ea.UserState + "\r Result :" + ea.Result + "\r Cancelled :" + ea.Cancelled + "\r Error :" + ea.Error, 1);
5372 787a4489 KangIngu
            };
5373 664ea2e1 taeseongkim
            //Logger.sendReqLog("GetSyncMarkupInfoItemsAsync", _ViewInfo.ProjectNO + "," + CurrentRev.DOCUMENT_ID + "," + _ViewInfo.UserID, 1);
5374 90e7968d ljiyeon
            BaseClient.GetSyncMarkupInfoItemsAsync(_ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, _ViewInfo.UserID);
5375 787a4489 KangIngu
        }
5376
5377
        private void PdfLink_ButtonDown(object sender, MouseButtonEventArgs e)
5378
        {
5379
            if (sender is Image)
5380
            {
5381
                if ((sender as Image).Tag != null)
5382
                {
5383
                    var pdfUrl = (sender as Image).Tag.ToString();
5384
                    System.Diagnostics.Process.Start(pdfUrl);
5385
                }
5386
                else
5387
                {
5388
                    this.ParentOfType<MainWindow>().DialogMessage_Alert("문서 정보가 잘못 되었습니다", "안내");
5389
                }
5390
            }
5391
        }
5392
5393
        private void Create_Symbol(object sender, RoutedEventArgs e)
5394
        {
5395 5529d2a2 humkyung
            MarkupToPDF.Controls.Parsing.MarkupParser.MarkupReturn markupReturn = new MarkupToPDF.Controls.Parsing.MarkupParser.MarkupReturn();
5396 787a4489 KangIngu
5397
            if (SelectLayer.Children.Count < 1) //선택된 것이 없으면
5398
            {
5399
                DialogMessage_Alert("Please Select Controls", "Alert");
5400
            }
5401
            else //선택된 것이 있으면
5402
            {
5403
                string MarkupData = "";
5404
                adorner_ = new AdornerFinal();
5405
5406
                foreach (var item in SelectLayer.Children)
5407
                {
5408
                    if (item.GetType().Name == "AdornerFinal")
5409
                    {
5410
                        adorner_ = (item as Controls.AdornerFinal);
5411 4913851c humkyung
                        foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
5412 787a4489 KangIngu
                        {
5413
                            if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
5414
                            {
5415 5529d2a2 humkyung
                                markupReturn = MarkupParser.MarkupToString(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo, App.ViewInfo.UserID);
5416 787a4489 KangIngu
                                MarkupData += markupReturn.ConvertData;
5417
                            }
5418
                        }
5419
                    }
5420
                }
5421
                DialogParameters parameters = new DialogParameters()
5422
                {
5423 b9b01f8e ljiyeon
                    Owner = Application.Current.MainWindow,
5424 787a4489 KangIngu
                    Closed = (obj, args) => this.MarkupNamePromptClose(MarkupData, args),
5425
                    DefaultPromptResultValue = "Custom State",
5426
                    Content = "Name :",
5427
                    Header = "Insert Custom Symbol Name",
5428
                    Theme = new VisualStudio2013Theme(),
5429
                    ModalBackground = new SolidColorBrush { Color = Colors.Black, Opacity = 0.6 },
5430
                };
5431
                RadWindow.Prompt(parameters);
5432
            }
5433
        }
5434 233ef333 taeseongkim
5435 53880c83 ljiyeon
        public int symbolselectindex = 0;
5436 233ef333 taeseongkim
5437 53880c83 ljiyeon
        private void SymbolMarkupNamePromptClose(byte[] Img_byte, string data, WindowClosedEventArgs args)
5438
        {
5439
            //Save save = new Save();
5440
            try
5441
            {
5442
                string svgfilename = null;
5443
                if (symbolname != null)
5444
                {
5445
                    if (symbolpng == true || symbolsvg == true)
5446
                    {
5447 76dc223b taeseongkim
                        kr.co.devdoftech.cloud.FileUpload fileUploader = App.FileUploader;
5448 24678e06 humkyung
                        string guid = Commons.shortGuid();
5449 53880c83 ljiyeon
5450
                        fileUploader.RunAsync(App.ViewInfo.ProjectNO, _DocItem.DOCUMENT_NO, App.ViewInfo.UserID, guid + ".png", Img_byte);
5451 c73426a9 ljiyeon
                        //Check_Uri.UriCheck();
5452 53880c83 ljiyeon
                        fileUploader.RunCompleted += (ex, arg) =>
5453
                        {
5454
                            filename = arg.Result;
5455
                            if (symbolpng == true)
5456
                            {
5457
                                if (filename != null)
5458 233ef333 taeseongkim
                                {
5459 53880c83 ljiyeon
                                    if (symbolselectindex == 0)
5460
                                    {
5461
                                        SymbolSave(symbolname, filename, data);
5462
                                    }
5463
                                    else
5464
                                    {
5465
                                        SymbolSave_Public(symbolname, filename, data, ViewerDataModel.Instance.SystemMain.dzMainMenu.userData.DEPARTMENT);
5466
                                    }
5467
                                    DataBind();
5468 233ef333 taeseongkim
                                }
5469 53880c83 ljiyeon
                            }
5470
5471
                            if (symbolsvg == true)
5472
                            {
5473 c73426a9 ljiyeon
                                try
5474 53880c83 ljiyeon
                                {
5475 c73426a9 ljiyeon
                                    var defaultBitmapImage = new BitmapImage();
5476
                                    defaultBitmapImage.BeginInit();
5477
                                    defaultBitmapImage.CreateOptions = BitmapCreateOptions.IgnoreImageCache;
5478
                                    defaultBitmapImage.CacheOption = BitmapCacheOption.OnLoad;
5479
                                    Check_Uri.UriCheck(filename);
5480
                                    defaultBitmapImage.UriSource = new Uri(filename);
5481
                                    defaultBitmapImage.EndInit();
5482 53880c83 ljiyeon
5483 c73426a9 ljiyeon
                                    System.Drawing.Bitmap image;
5484 53880c83 ljiyeon
5485 c73426a9 ljiyeon
                                    if (defaultBitmapImage.IsDownloading)
5486
                                    {
5487
                                        defaultBitmapImage.DownloadCompleted += (ex2, arg2) =>
5488 53880c83 ljiyeon
                                        {
5489 c73426a9 ljiyeon
                                            defaultBitmapImage.Freeze();
5490
                                            image = GetBitmap(defaultBitmapImage);
5491
                                            image.Save(@AppDomain.CurrentDomain.BaseDirectory + "potrace.bmp", System.Drawing.Imaging.ImageFormat.Bmp);
5492
                                            Process potrace = new Process
5493 53880c83 ljiyeon
                                            {
5494 c73426a9 ljiyeon
                                                StartInfo = new ProcessStartInfo
5495
                                                {
5496
                                                    FileName = @AppDomain.CurrentDomain.BaseDirectory + "potrace.exe",
5497
                                                    Arguments = "-b svg " + @AppDomain.CurrentDomain.BaseDirectory + "potrace.bmp",
5498
                                                    RedirectStandardInput = true,
5499
                                                    RedirectStandardOutput = true,
5500
                                                    RedirectStandardError = true,
5501
                                                    UseShellExecute = false,
5502
                                                    CreateNoWindow = true,
5503
                                                    WindowStyle = ProcessWindowStyle.Hidden
5504
                                                },
5505
                                            };
5506 53880c83 ljiyeon
5507 c73426a9 ljiyeon
                                            StringBuilder svgBuilder = new StringBuilder();
5508
                                            potrace.OutputDataReceived += (object sender2, DataReceivedEventArgs e2) =>
5509 53880c83 ljiyeon
                                            {
5510 c73426a9 ljiyeon
                                                svgBuilder.AppendLine(e2.Data);
5511
                                            };
5512
5513
                                            potrace.EnableRaisingEvents = true;
5514
                                            potrace.Start();
5515
                                            potrace.Exited += (sender, e) =>
5516 53880c83 ljiyeon
                                            {
5517 c73426a9 ljiyeon
                                                byte[] bytes = System.IO.File.ReadAllBytes(@AppDomain.CurrentDomain.BaseDirectory + "potrace.svg");
5518
                                                svgfilename = fileUploader.Run(App.ViewInfo.ProjectNO, _DocItem.DOCUMENT_NO, App.ViewInfo.UserID, guid + ".svg", bytes);
5519
                                                Check_Uri.UriCheck(svgfilename);
5520
                                                if (symbolselectindex == 0)
5521
                                                {
5522
                                                    SymbolSave(symbolname, svgfilename, data);
5523
                                                }
5524
                                                else
5525
                                                {
5526
                                                    SymbolSave_Public(symbolname, svgfilename, data, ViewerDataModel.Instance.SystemMain.dzMainMenu.userData.DEPARTMENT);
5527
                                                }
5528 53880c83 ljiyeon
5529 c73426a9 ljiyeon
                                                DataBind();
5530
                                            };
5531
                                            potrace.WaitForExit();
5532 53880c83 ljiyeon
                                        };
5533 c73426a9 ljiyeon
                                    }
5534
                                    else
5535
                                    {
5536
                                        //GC.Collect();
5537
                                    }
5538 53880c83 ljiyeon
                                }
5539 233ef333 taeseongkim
                                catch (Exception ee)
5540 90e7968d ljiyeon
                                {
5541 c73426a9 ljiyeon
                                    DialogMessage_Alert("" + ee, "Alert");
5542 90e7968d ljiyeon
                                }
5543 53880c83 ljiyeon
                            }
5544 233ef333 taeseongkim
                        };
5545 53880c83 ljiyeon
                    }
5546
                }
5547
            }
5548
            catch (Exception e)
5549
            {
5550
                //DialogMessage_Alert(e + "", "Alert");
5551 233ef333 taeseongkim
            }
5552 53880c83 ljiyeon
        }
5553
5554
        public void SymbolSave(string Name, string Url, string Data)
5555
        {
5556
            try
5557
            {
5558
                SYMBOL_PRIVATE symbol_private = new SYMBOL_PRIVATE
5559
                {
5560 24678e06 humkyung
                    ID = Commons.shortGuid(),
5561 53880c83 ljiyeon
                    MEMBER_USER_ID = App.ViewInfo.UserID,
5562
                    NAME = Name,
5563
                    IMAGE_URL = Url,
5564
                    DATA = Data
5565
                };
5566
5567
                Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.SaveSymbolCompleted += BaseClient_SaveSymbolCompleted;
5568 664ea2e1 taeseongkim
                //Logger.sendReqLog("SaveSymbolAsync: ", symbol_private.ID + "," + symbol_private.MEMBER_USER_ID + "," + symbol_private.NAME + "," + symbol_private.IMAGE_URL + "," + symbol_private.DATA, 1);
5569 53880c83 ljiyeon
                Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.SaveSymbolAsync(symbol_private);
5570
            }
5571
            catch (Exception)
5572
            {
5573
                throw;
5574
            }
5575
        }
5576
5577
        public void SymbolSave_Public(string Name, string Url, string Data, string Department)
5578
        {
5579
            try
5580
            {
5581
                SYMBOL_PUBLIC symbol_public = new SYMBOL_PUBLIC
5582
                {
5583 24678e06 humkyung
                    ID = Commons.shortGuid(),
5584 53880c83 ljiyeon
                    DEPARTMENT = Department,
5585
                    NAME = Name,
5586
                    IMAGE_URL = Url,
5587
                    DATA = Data
5588
                };
5589
                Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.AddPublicSymbolCompleted += BaseClient_AddPublicSymbolCompleted;
5590 664ea2e1 taeseongkim
                //Logger.sendReqLog("AddPublicSymbol: ", symbol_public.ID + "," + symbol_public.DEPARTMENT + "," + symbol_public.NAME + "," + symbol_public.IMAGE_URL + "," + symbol_public.DATA, 1);
5591 53880c83 ljiyeon
                Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.AddPublicSymbol(symbol_public);
5592
            }
5593
            catch (Exception)
5594
            {
5595
                throw;
5596
            }
5597
        }
5598
5599
        private void BaseClient_AddPublicSymbolCompleted(object sender, ServiceDeepView.AddPublicSymbolCompletedEventArgs e)
5600 233ef333 taeseongkim
        {
5601 664ea2e1 taeseongkim
            //Logger.sendResLog("AddPublicSymbolCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1);
5602 53880c83 ljiyeon
            DataBind();
5603
        }
5604
5605
        private void BaseClient_SaveSymbolCompleted(object sender, ServiceDeepView.SaveSymbolCompletedEventArgs e)
5606
        {
5607 664ea2e1 taeseongkim
            //Logger.sendResLog("RenameSymbolCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1);
5608 53880c83 ljiyeon
            DataBind();
5609
        }
5610 233ef333 taeseongkim
5611 53880c83 ljiyeon
        private void DataBind()
5612
        {
5613
            try
5614
            {
5615
                Symbol_Custom Custom = new Symbol_Custom();
5616
                List<Symbol_Custom> Custom_List = new List<Symbol_Custom>();
5617 233ef333 taeseongkim
5618 bb3a236d ljiyeon
                var symbol_Private = BaseClient.GetSymbolList(App.ViewInfo.UserID);
5619 53880c83 ljiyeon
                foreach (var item in symbol_Private)
5620
                {
5621
                    Custom.Name = item.NAME;
5622
                    Custom.ImageUri = item.IMAGE_URL;
5623
                    Custom.ID = item.ID;
5624
                    Custom_List.Add(Custom);
5625
                    Custom = new Symbol_Custom();
5626
                }
5627
                symbolPanel_Instance.lstSymbolPrivate.ItemsSource = Custom_List;
5628 233ef333 taeseongkim
5629 53880c83 ljiyeon
                Custom = new Symbol_Custom();
5630
                Custom_List = new List<Symbol_Custom>();
5631
5632 bb3a236d ljiyeon
                symbolPanel_Instance.deptlist.ItemsSource = BaseClient.GetPublicSymbolDeptList();
5633 53880c83 ljiyeon
5634
                List<SYMBOL_PUBLIC> symbol_Public;
5635 787a4489 KangIngu
5636 53880c83 ljiyeon
                if (symbolPanel_Instance.deptlist.SelectedValue != null)
5637
                {
5638 bb3a236d ljiyeon
                    symbol_Public = BaseClient.GetPublicSymbolList(symbolPanel_Instance.deptlist.SelectedValue.ToString());
5639 53880c83 ljiyeon
                }
5640
                else
5641
                {
5642 bb3a236d ljiyeon
                    symbol_Public = BaseClient.GetPublicSymbolList(null);
5643 53880c83 ljiyeon
                }
5644
                foreach (var item in symbol_Public)
5645
                {
5646
                    Custom.Name = item.NAME;
5647
                    Custom.ImageUri = item.IMAGE_URL;
5648
                    Custom.ID = item.ID;
5649
                    Custom_List.Add(Custom);
5650
                    Custom = new Symbol_Custom();
5651
                }
5652
                symbolPanel_Instance.lstSymbolPublic.ItemsSource = Custom_List;
5653 233ef333 taeseongkim
                BaseClient.Close();
5654 53880c83 ljiyeon
            }
5655 233ef333 taeseongkim
            catch (Exception e)
5656 53880c83 ljiyeon
            {
5657
                //DialogMessage_Alert("DataBind", "Alert");
5658
            }
5659
        }
5660 233ef333 taeseongkim
5661 ac4f1e13 taeseongkim
        private async void MarkupNamePromptClose(string data, WindowClosedEventArgs args)
5662 787a4489 KangIngu
        {
5663 c73426a9 ljiyeon
            try
5664 787a4489 KangIngu
            {
5665 c73426a9 ljiyeon
                if (args.PromptResult != null)
5666 53880c83 ljiyeon
                {
5667 c73426a9 ljiyeon
                    if (args.DialogResult.Value)
5668
                    {
5669 ac4f1e13 taeseongkim
                        PngBitmapEncoder _Encoder = await symImageAsync(data);
5670 787a4489 KangIngu
5671 c73426a9 ljiyeon
                        System.IO.MemoryStream fs = new System.IO.MemoryStream();
5672
                        _Encoder.Save(fs);
5673
                        System.Drawing.Image ImgOut = System.Drawing.Image.FromStream(fs);
5674 787a4489 KangIngu
5675 c73426a9 ljiyeon
                        byte[] Img_byte = fs.ToArray();
5676 787a4489 KangIngu
5677 76dc223b taeseongkim
                        kr.co.devdoftech.cloud.FileUpload fileUploader = App.FileUploader;
5678 24678e06 humkyung
                        filename = fileUploader.Run(App.ViewInfo.ProjectNO, _DocItem.DOCUMENT_NO, App.ViewInfo.UserID, Commons.shortGuid() + ".png", Img_byte);
5679 c73426a9 ljiyeon
                        Check_Uri.UriCheck(filename);
5680
                        if (symbolPanel_Instance.RadTab.SelectedIndex == 0)
5681
                        {
5682 de6499db humkyung
                            SaveCommand.Instance.SymbolSave(args.PromptResult, filename, data);
5683 c73426a9 ljiyeon
                        }
5684
                        else
5685
                        {
5686 de6499db humkyung
                            SaveCommand.Instance.SymbolSave_Public(args.PromptResult, filename, data, ViewerDataModel.Instance.SystemMain.dzMainMenu.userData.DEPARTMENT);
5687 c73426a9 ljiyeon
                        }
5688
                        DataBind();
5689 53880c83 ljiyeon
                    }
5690
                }
5691 787a4489 KangIngu
            }
5692 233ef333 taeseongkim
            catch (Exception ex)
5693 c73426a9 ljiyeon
            {
5694
                DialogMessage_Alert("" + ex, "Alert");
5695
            }
5696 787a4489 KangIngu
        }
5697
5698 ac4f1e13 taeseongkim
        public async Task<PngBitmapEncoder> symImageAsync(string data)
5699 787a4489 KangIngu
        {
5700
            Canvas _canvas = new Canvas();
5701
            _canvas.Background = Brushes.White;
5702
            _canvas.Width = adorner_.BorderSize.Width;
5703
            _canvas.Height = adorner_.BorderSize.Height;
5704 a1e2ba68 taeseongkim
            await MarkupParser.ParseAsync(App.BaseAddress, App.ViewInfo.ProjectNO, data, _canvas,ViewerDataModel.Instance.PageAngle, "#FFFF0000", "", ViewerDataModel.Instance.CancellationToken());
5705 787a4489 KangIngu
5706
            BitmapEncoder encoder = new PngBitmapEncoder();
5707
5708
            RenderTargetBitmap renderBitmap = new RenderTargetBitmap((int)_canvas.Width + 50, (int)_canvas.Height + 50, 96d, 96d, PixelFormats.Pbgra32);
5709
5710
            DrawingVisual dv = new DrawingVisual();
5711
5712
            _canvas.Measure(new System.Windows.Size(adorner_.BorderSize.Width + 50, adorner_.BorderSize.Height + 50));
5713
            _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)));
5714
5715
            using (DrawingContext ctx = dv.RenderOpen())
5716
            {
5717
                VisualBrush vb = new VisualBrush(_canvas);
5718
                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)));
5719
            }
5720
5721
            try
5722
            {
5723
                renderBitmap.Render(dv);
5724
5725 2007ecaa taeseongkim
                GC.Collect(2);
5726 787a4489 KangIngu
                GC.WaitForPendingFinalizers();
5727 90e7968d ljiyeon
                //GC.Collect();
5728 787a4489 KangIngu
                // encode png data
5729
                PngBitmapEncoder pngEncoder = new PngBitmapEncoder();
5730
                // puch rendered bitmap into it
5731
                pngEncoder.Interlace = PngInterlaceOption.Off;
5732
                pngEncoder.Frames.Add(BitmapFrame.Create(renderBitmap));
5733
                return pngEncoder;
5734
            }
5735 53880c83 ljiyeon
            catch //(Exception ex)
5736 787a4489 KangIngu
            {
5737
                return null;
5738
            }
5739
        }
5740
5741
        public void DialogMessage_Alert(string content, string header)
5742
        {
5743 68e3cd94 taeseongkim
            App.splashScreen.Close();
5744 cf1cc862 taeseongkim
            App.FileLogger.Error(content + " " + header);
5745 68e3cd94 taeseongkim
5746 787a4489 KangIngu
            DialogParameters parameters = new DialogParameters()
5747
            {
5748 4279e717 djkim
                Owner = this.ParentOfType<MainWindow>(),
5749 0d32593b ljiyeon
                Content = new TextBlock()
5750 233ef333 taeseongkim
                {
5751 0d32593b ljiyeon
                    MinWidth = 400,
5752
                    FontSize = 11,
5753
                    Text = content,
5754
                    TextWrapping = System.Windows.TextWrapping.Wrap
5755
                },
5756 b79f786f 송근호
                DialogStartupLocation = WindowStartupLocation.CenterOwner,
5757 787a4489 KangIngu
                Header = header,
5758
                Theme = new VisualStudio2013Theme(),
5759
                ModalBackground = new SolidColorBrush { Color = Colors.Black, Opacity = 0.6 },
5760 233ef333 taeseongkim
            };
5761 787a4489 KangIngu
            RadWindow.Alert(parameters);
5762
        }
5763
5764 233ef333 taeseongkim
        #region 캡쳐 기능
5765 787a4489 KangIngu
5766
        public BitmapSource CutAreaToImage(int x, int y, int width, int height)
5767
        {
5768
            if (x < 0)
5769
            {
5770
                width += x;
5771
                x = 0;
5772
            }
5773
            if (y < 0)
5774
            {
5775
                height += y;
5776
                y = 0;
5777
5778
                width = (int)zoomAndPanCanvas.ActualWidth - x;
5779
            }
5780
            if (x + width > zoomAndPanCanvas.ActualWidth)
5781
            {
5782
                width = (int)zoomAndPanCanvas.ActualWidth - x;
5783
            }
5784
            if (y + height > zoomAndPanCanvas.ActualHeight)
5785
            {
5786
                height = (int)zoomAndPanCanvas.ActualHeight - y;
5787
            }
5788
5789
            byte[] pixels = CopyPixels(x, y, width, height);
5790
5791
            int stride = (width * canvasImage.Format.BitsPerPixel + 7) / 8;
5792
5793
            return BitmapSource.Create(width, height, 96, 96, PixelFormats.Pbgra32, null, pixels, stride);
5794
        }
5795
5796
        public byte[] CopyPixels(int x, int y, int width, int height)
5797
        {
5798
            byte[] pixels = new byte[width * height * 4];
5799
            int stride = (width * canvasImage.Format.BitsPerPixel + 7) / 8;
5800
5801
            // Canvas 이미지에서 객체 역역만큼 픽셀로 복사
5802
            canvasImage.CopyPixels(new Int32Rect(x, y, width, height), pixels, stride, 0);
5803
5804
            return pixels;
5805
        }
5806
5807
        public RenderTargetBitmap ConverterBitmapImage(FrameworkElement element)
5808
        {
5809
            DrawingVisual drawingVisual = new DrawingVisual();
5810
            DrawingContext drawingContext = drawingVisual.RenderOpen();
5811
5812
            // 해당 객체의 그래픽요소로 사각형의 그림을 그립니다.
5813
            drawingContext.DrawRectangle(new VisualBrush(element), null,
5814
                new Rect(new Point(0, 0), new Point(element.ActualWidth, element.ActualHeight)));
5815
            drawingContext.Close();
5816
5817
            // 비트맵으로 변환합니다.
5818
            RenderTargetBitmap target =
5819
                new RenderTargetBitmap((int)element.ActualWidth, (int)element.ActualHeight,
5820
                96, 96, System.Windows.Media.PixelFormats.Pbgra32);
5821
5822
            target.Render(drawingVisual);
5823
            return target;
5824
        }
5825
5826 233ef333 taeseongkim
        private System.Drawing.Bitmap GetBitmap(BitmapSource source)
5827 53880c83 ljiyeon
        {
5828
            System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(source.PixelWidth, source.PixelHeight, System.Drawing.Imaging.PixelFormat.Format32bppPArgb);
5829
            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);
5830
            source.CopyPixels(Int32Rect.Empty, data.Scan0, data.Height * data.Stride, data.Stride);
5831
            bmp.UnlockBits(data);
5832
            return bmp;
5833
        }
5834 233ef333 taeseongkim
5835 53880c83 ljiyeon
        public string symbolname = null;
5836
        public bool symbolsvg = true;
5837
        public bool symbolpng = true;
5838
5839
        public void Save_Symbol_Capture(BitmapSource source, int x, int y, int width, int height)
5840
        {
5841
            System.Drawing.Bitmap image = GetBitmap(source);
5842
            //흰색 제거
5843
            //image.MakeTransparent(System.Drawing.Color.White);
5844
5845
            var imageStream = new System.IO.MemoryStream();
5846
            byte[] imageBytes = null;
5847
            using (imageStream)
5848
            {
5849
                image.Save(imageStream, System.Drawing.Imaging.ImageFormat.Png);
5850
                // test.Save(@"E:\test.png", System.Drawing.Imaging.ImageFormat.Png);
5851
                imageStream.Position = 0;
5852
                imageBytes = imageStream.ToArray();
5853
            }
5854
5855
            SymbolPrompt symbolPrompt = new SymbolPrompt();
5856
5857
            RadWindow CheckPop = new RadWindow();
5858
            //Alert check = new Alert(Msg);
5859
5860
            CheckPop = new RadWindow
5861
            {
5862
                MinWidth = 400,
5863
                MinHeight = 100,
5864 233ef333 taeseongkim
                // Closed = (obj, args) => this.SymbolMarkupNamePromptClose(imageBytes, "", args),
5865 53880c83 ljiyeon
                Header = "Alert",
5866
                Content = symbolPrompt,
5867 233ef333 taeseongkim
                //DialogResult =
5868 53880c83 ljiyeon
                ResizeMode = System.Windows.ResizeMode.NoResize,
5869
                WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen,
5870
                IsTopmost = true,
5871
            };
5872
            CheckPop.Closed += (obj, args) => this.SymbolMarkupNamePromptClose(imageBytes, "", args);
5873
            StyleManager.SetTheme(CheckPop, new Office2013Theme());
5874
            CheckPop.ShowDialog();
5875
5876
            /*
5877
            DialogParameters parameters = new DialogParameters()
5878
            {
5879
                Owner = Application.Current.MainWindow,
5880
                Closed = (obj, args) => this.SymbolMarkupNamePromptClose(imageBytes, "", args),
5881
                DefaultPromptResultValue = "Custom State",
5882
                Content = "Name :",
5883
                Header = "Insert Custom Symbol Name",
5884
                Theme = new VisualStudio2013Theme(),
5885
                ModalBackground = new SolidColorBrush { Color = Colors.Black, Opacity = 0.6 },
5886 233ef333 taeseongkim
            };
5887 53880c83 ljiyeon
            RadWindow.Prompt(parameters);
5888
            */
5889
        }
5890
5891 787a4489 KangIngu
        public void Save_Capture(BitmapSource source, int x, int y, int width, int height)
5892
        {
5893
            KCOM.Common.Converter.FileStreamToBase64 streamToBase64 = new Common.Converter.FileStreamToBase64();
5894
            KCOMDataModel.DataModel.CHECK_LIST check_;
5895
            string Result = streamToBase64.ImageToBase64(source);
5896
            KCOMDataModel.DataModel.CHECK_LIST Item = new KCOMDataModel.DataModel.CHECK_LIST();
5897 6c781c0c djkim
            string projectno = App.ViewInfo.ProjectNO;
5898
            string checklist_id = ViewerDataModel.Instance.CheckList_ID;
5899 0f065e57 ljiyeon
5900 664ea2e1 taeseongkim
            //Logger.sendReqLog("GetCheckList", projectno + "," + checklist_id, 1);
5901 6c781c0c djkim
            Item = this.BaseClient.GetCheckList(projectno, checklist_id);
5902 90e7968d ljiyeon
            if (Item != null)
5903 0f065e57 ljiyeon
            {
5904 664ea2e1 taeseongkim
                //Logger.sendResLog("GetCheckList", "TRUE", 1);
5905 0f065e57 ljiyeon
            }
5906
            else
5907
            {
5908 664ea2e1 taeseongkim
                //Logger.sendResLog("GetCheckList", "FALSE", 1);
5909 0f065e57 ljiyeon
            }
5910 90e7968d ljiyeon
5911 6c781c0c djkim
            if (Item == null)
5912 787a4489 KangIngu
            {
5913 6c781c0c djkim
                check_ = new KCOMDataModel.DataModel.CHECK_LIST
5914 787a4489 KangIngu
                {
5915 24678e06 humkyung
                    ID = Commons.shortGuid(),
5916 6c781c0c djkim
                    USER_ID = App.ViewInfo.UserID,
5917
                    IMAGE_URL = Result,
5918
                    IMAGE_ANCHOR = x + "," + y + "," + width + "," + height,
5919
                    PAGENUMBER = this.pageNavigator.CurrentPage.PageNumber,
5920
                    REVISION = ViewerDataModel.Instance.SystemMain.dzMainMenu.CurrentDoc.Revision,
5921
                    DOCUMENT_ID = App.ViewInfo.DocumentItemID,
5922
                    PROJECT_NO = App.ViewInfo.ProjectNO,
5923
                    STATUS = "False",
5924
                    CREATE_TIME = DateTime.Now,
5925
                    UPDATE_TIME = DateTime.Now,
5926
                    DOCUMENT_NO = _DocItem.DOCUMENT_NO,
5927
                    STATUS_DESC_OPEN = "Vendor 반영 필요",
5928
                };
5929 274cde11 taeseongkim
                Logger.sendReqLog("AddCheckList", projectno + "," + check_, 1);
5930 664ea2e1 taeseongkim
                //Logger.sendResLog("AddCheckList", this.BaseClient.AddCheckList(projectno, check_).ToString(), 1);
5931 274cde11 taeseongkim
                this.BaseClient.AddCheckList(projectno, check_);
5932 787a4489 KangIngu
            }
5933 6c781c0c djkim
            else
5934
            {
5935
                Item.IMAGE_URL = Result;
5936
                Item.IMAGE_ANCHOR = x + "," + y + "," + width + "," + height;
5937 90e7968d ljiyeon
                Item.PAGENUMBER = this.pageNavigator.CurrentPage.PageNumber;
5938 274cde11 taeseongkim
                Logger.sendReqLog("SaveCheckList", projectno + "," + checklist_id + "," + Item, 1);
5939 664ea2e1 taeseongkim
                //Logger.sendResLog("SaveCheckList", this.BaseClient.SaveCheckList(projectno, checklist_id, Item).ToString(), 1);
5940 274cde11 taeseongkim
                this.BaseClient.SaveCheckList(projectno, checklist_id, Item);
5941 6c781c0c djkim
            }
5942 787a4489 KangIngu
        }
5943
5944
        public void Set_Capture()
5945 90e7968d ljiyeon
        {
5946 c7fde400 taeseongkim
            double x = CanvasDrawingMouseDownPoint.X;
5947
            double y = CanvasDrawingMouseDownPoint.Y;
5948 787a4489 KangIngu
            double width = dragCaptureBorder.Width;
5949
            double height = dragCaptureBorder.Height;
5950
5951
            if (width > 5 || height > 5)
5952
            {
5953
                canvasImage = ConverterBitmapImage(zoomAndPanCanvas);
5954
                BitmapSource source = CutAreaToImage((int)x, (int)y, (int)width, (int)height);
5955
                Save_Capture(source, (int)x, (int)y, (int)width, (int)height);
5956
            }
5957
        }
5958 233ef333 taeseongkim
5959
        #endregion 캡쳐 기능
5960 787a4489 KangIngu
5961
        public Multi_Undo_data Control_Style(CommentUserInfo control)
5962
        {
5963
            multi_Undo_Data = new Multi_Undo_data();
5964
5965
            multi_Undo_Data.Markup = control;
5966
5967
            if ((control as IShapeControl) != null)
5968
            {
5969
                multi_Undo_Data.paint = (control as IShapeControl).Paint;
5970
            }
5971
            if ((control as IDashControl) != null)
5972
            {
5973
                multi_Undo_Data.DashSize = (control as IDashControl).DashSize;
5974
            }
5975
            if ((control as IPath) != null)
5976
            {
5977
                multi_Undo_Data.LineSize = (control as IPath).LineSize;
5978
            }
5979
            if ((control as UIElement) != null)
5980
            {
5981
                multi_Undo_Data.Opacity = (control as UIElement).Opacity;
5982
            }
5983
5984
            return multi_Undo_Data;
5985
        }
5986
5987 ac4f1e13 taeseongkim
        private async void Comment_Move(object sender, MouseButtonEventArgs e)
5988 787a4489 KangIngu
        {
5989 d2279f18 taeseongkim
            string Select_ID = (((e.Source as Telerik.Windows.Controls.RadButton).DataContext) as IKCOM.MarkupInfoItem).MarkupInfoID;
5990 787a4489 KangIngu
            foreach (var items in ViewerDataModel.Instance._markupInfoRevList)
5991
            {
5992 4f017ed3 taeseongkim
                if (items.MarkupInfoID == Select_ID)
5993 787a4489 KangIngu
                {
5994
                    foreach (var item in items.MarkupList)
5995
                    {
5996
                        if (item.PageNumber == pageNavigator.CurrentPage.PageNumber)
5997
                        {
5998 a1e2ba68 taeseongkim
                            await MarkupParser.ParseExAsync(App.BaseAddress, ViewerDataModel.Instance.CancellationToken(), App.ViewInfo.ProjectNO, item.Data, Common.ViewerDataModel.Instance.MarkupControls_USER,ViewerDataModel.Instance.PageAngle, "#FFFF0000", "",
5999 233ef333 taeseongkim
                                 items.MarkupInfoID, Commons.shortGuid());
6000 787a4489 KangIngu
                        }
6001
                    }
6002
                }
6003
            }
6004
        }
6005 d62c0439 humkyung
6006 f959ea6f humkyung
        /// <summary>
6007
        /// convert inkcontrol to polygoncontrol
6008
        /// </summary>
6009
        public void ConvertInkControlToPolygon()
6010 787a4489 KangIngu
        {
6011
            if (inkBoard.Strokes.Count > 0)
6012
            {
6013
                inkBoard.Strokes.ToList().ForEach(stroke =>
6014
                {
6015
                    InkToPath ip = new InkToPath();
6016 f959ea6f humkyung
6017 787a4489 KangIngu
                    List<Point> inkPointSet = new List<Point>();
6018 f959ea6f humkyung
                    inkPointSet.AddRange(ip.GetPointsFrom(stroke));
6019
6020
                    PolygonControl pc = new PolygonControl()
6021 787a4489 KangIngu
                    {
6022 fa48eb85 taeseongkim
                        CommentAngle = 0,
6023 f959ea6f humkyung
                        PointSet = inkPointSet,
6024 787a4489 KangIngu
                        ControlType = ControlType.Ink
6025
                    };
6026 f959ea6f humkyung
                    pc.StartPoint = inkPointSet[0];
6027
                    pc.EndPoint = inkPointSet[inkPointSet.Count - 1];
6028
                    pc.LineSize = 3;
6029
                    pc.CommentID = Commons.shortGuid();
6030
                    pc.StrokeColor = new SolidColorBrush(Colors.Red);
6031 787a4489 KangIngu
6032 f959ea6f humkyung
                    if (pc.PointSet.Count > 0)
6033
                    {
6034
                        CreateCommand.Instance.Execute(pc);
6035 787a4489 KangIngu
                        ViewerDataModel.Instance.MarkupControls_USER.Add(pc);
6036
                    }
6037
                });
6038 f959ea6f humkyung
                inkBoard.Strokes.Clear();
6039 787a4489 KangIngu
            }
6040
        }
6041 17a22987 KangIngu
6042 4318fdeb KangIngu
        /// <summary>
6043 e66f22eb KangIngu
        /// 캔버스에 그릴때 모든 포인트가 캔버스를 벗어 났는지 체크하여 넘겨줌
6044
        /// </summary>
6045
        /// <author>ingu</author>
6046
        /// <date>2018.06.05</date>
6047
        /// <param name="getPoint"></param>
6048
        /// <returns></returns>
6049
        private bool IsGetoutpoint(Point getPoint)
6050 670a4be2 humkyung
        {
6051 e66f22eb KangIngu
            if (getPoint == new Point())
6052 670a4be2 humkyung
            {
6053 e66f22eb KangIngu
                ViewerDataModel.Instance.MarkupControls_USER.Remove(currentControl);
6054
                currentControl = null;
6055
                return true;
6056 670a4be2 humkyung
            }
6057
6058 e66f22eb KangIngu
            return false;
6059 670a4be2 humkyung
        }
6060 e66f22eb KangIngu
6061 5b46312f djkim
        private void zoomAndPanControl_DragOver(object sender, DragEventArgs e)
6062
        {
6063
            e.Effects = DragDropEffects.Copy;
6064
        }
6065
6066
        private void zoomAndPanControl_DragEnter(object sender, DragEventArgs e)
6067
        {
6068
            e.Effects = DragDropEffects.Copy;
6069
        }
6070
6071
        private void zoomAndPanControl_DragLeave(object sender, DragEventArgs e)
6072
        {
6073
            e.Effects = DragDropEffects.None;
6074
        }
6075
6076 92442e4a taeseongkim
        private void ZoomAndPanControl_ScaleChanged(object sender, RoutedEventArgs e)
6077 cdfb57ff taeseongkim
        {
6078
            var pageWidth = ViewerDataModel.Instance.ImageViewWidth;
6079
            var pageHeight = ViewerDataModel.Instance.ImageViewHeight;
6080
6081 92442e4a taeseongkim
            ScaleImage(pageWidth, pageHeight);
6082
        }
6083
6084
        /// <summary>
6085
        /// 페이지를 scale의 변화에 맞춰서 DecodePixel을 변경한다.
6086
        /// </summary>
6087
        /// <param name="pageWidth">원본 사이즈</param>
6088
        /// <param name="pageHeight">원본 사이즈</param>
6089
        /// <returns></returns>
6090 233ef333 taeseongkim
        private void ScaleImage(double pageWidth, double pageHeight)
6091 92442e4a taeseongkim
        {
6092 7e2d682c taeseongkim
            //mainPanel.Scale = zoomAndPanControl.ContentScale;// (zoomAndPanControl.ContentScale >= 0.1) ? 1 : zoomAndPanControl.ContentScale;
6093 cdfb57ff taeseongkim
        }
6094
6095 d0eda156 ljiyeon
        private void thumbnailPanel_SizeChanged(object sender, SizeChangedEventArgs e)
6096
        {
6097
            CommonLib.Common.WriteConfigString("SetThumbnail", "WIDTH", thumbnailPanel.Width.ToString());
6098
        }
6099
6100 53deabaf taeseongkim
        private void gridViewMarkupAllSelect_Click(object sender, RoutedEventArgs e)
6101
        {
6102
            var checkbox = (sender as CheckBox);
6103
6104
            if (checkbox != null)
6105
            {
6106
                if (checkbox.IsChecked.GetValueOrDefault())
6107
                {
6108
                    gridViewMarkup.SelectAll();
6109
                }
6110
                else
6111
                {
6112
                    gridViewMarkup.UnselectAll();
6113
                }
6114
            }
6115
        }
6116 c8dd192f taeseongkim
        
6117 e6a9ddaf humkyung
        /*
6118 5b46312f djkim
        private void zoomAndPanControl_Drop(object sender, DragEventArgs e)
6119
        {
6120 90e7968d ljiyeon
            try
6121 5b46312f djkim
            {
6122 90e7968d ljiyeon
                if (e.Data.GetDataPresent(typeof(string)))
6123
                {
6124
                    this.getCurrentPoint = e.GetPosition(drawingRotateCanvas);
6125
                    string dragData = e.Data.GetData(typeof(string)) as string;
6126
                    Move_Symbol(sender, dragData);
6127
                }
6128 5b46312f djkim
            }
6129 90e7968d ljiyeon
            catch (Exception ex)
6130
            {
6131 664ea2e1 taeseongkim
                //Logger.sendResLog("zoomAndPanControl_Drop", ex.ToString(), 0);
6132 233ef333 taeseongkim
            }
6133 5b46312f djkim
        }
6134 e6a9ddaf humkyung
        */
6135 787a4489 KangIngu
    }
6136 f65e6c02 taeseongkim
6137
    public class testItem
6138
    {
6139
        public string Title { get; set; }
6140
    }
6141 233ef333 taeseongkim
}
클립보드 이미지 추가 (최대 크기: 500 MB)