프로젝트

일반

사용자정보

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

markus / KCOM / Views / MainMenu.xaml.cs @ 53deabaf

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

1 787a4489 KangIngu

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