프로젝트

일반

사용자정보

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

markus / KCOM / Views / MainMenu.xaml.cs @ 3a52c0a7

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

1 787a4489 KangIngu

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