프로젝트

일반

사용자정보

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

markus / KCOM / Views / MainMenu.xaml.cs @ 6c6baf40

이력 | 보기 | 이력해설 | 다운로드 (285 KB)

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