프로젝트

일반

사용자정보

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

markus / KCOM / Views / MainMenu.xaml.cs @ b627aa5a

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

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