프로젝트

일반

사용자정보

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

markus / KCOM / Views / MainMenu.xaml.cs @ 95c73392

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

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