프로젝트

일반

사용자정보

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

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

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