프로젝트

일반

사용자정보

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

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

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

1 787a4489 KangIngu

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