프로젝트

일반

사용자정보

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

markus / KCOM / Views / MainMenu.xaml.cs @ 5beaf28e

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