프로젝트

일반

사용자정보

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

markus / KCOM / Events / Implementation / TopMenuEvent.cs @ 3abe8d4e

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

1 787a4489 KangIngu
using KCOM.Common;
2
using KCOM.Common.Converter;
3
using KCOM.Controls;
4
using KCOM.Events;
5 53880c83 ljiyeon
using KCOMDataModel.DataModel;
6 787a4489 KangIngu
using MarkupToPDF.Common;
7
using System;
8
using System.Collections.Generic;
9
using System.Linq;
10
using System.Text;
11
using System.Windows;
12
using System.Windows.Controls;
13
using System.Windows.Input;
14
using System.Windows.Media;
15 53880c83 ljiyeon
using System.Windows.Media.Imaging;
16 787a4489 KangIngu
using Telerik.Windows.Controls;
17 684ef11c ljiyeon
using IKCOM;
18
using Microsoft.Win32;
19
using System.IO;
20
using System.Reflection;
21
using System.Windows.Controls.Primitives;
22 036650a0 humkyung
using MarkupToPDF.Controls.Parsing;
23 2dfbf711 ljiyeon
using Telerik.Windows.Data;
24
using System.ComponentModel;
25 6dcbe4a7 humkyung
using System.Web;
26 24c5e56c taeseongkim
using Markus.Fonts;
27 b42dd24d taeseongkim
using System.Threading.Tasks;
28 787a4489 KangIngu
29
namespace KCOM.Views
30
{
31
    public partial class TopMenu : UserControl
32
    {
33
        public int rotateOffSet = 0;
34
        private double[] rotateValue = { 0, 90, 180, 270 };
35
        public System.Windows.Threading.DispatcherTimer SaveTimer { get; set; }
36
        public bool isClosed = true;
37
        public RadWindow CheckPop;
38 53880c83 ljiyeon
        public RadWindow OptionPop;
39 787a4489 KangIngu
40
        /// <summary>
41
        /// TaskBar에 메시지를 입력합니다
42
        /// </summary>
43
        /// <param name="message"></param>
44
        /// <param name="type"></param>
45
        public void TaskMessage(string message, TaskMessageType type)
46
        {
47 129ca191 humkyung
            /*
48
            if (taskBar != null)
49
            {
50
                string color = "";
51
                taskBar.Content = message;
52
                DicTaskMessage.TryGetValue(type, out color);
53 3abe8d4e taeseongkim
                taskBar.Foreground = new SolidColorBrush(StringToColorBrushConverter.Parse(color));
54 129ca191 humkyung
            }
55
            */
56 787a4489 KangIngu
        }
57
58
        /// <summary>
59
        /// Task Type명을 Key값으로 지정합니다
60
        /// </summary>
61
        public enum TaskMessageType
62
        {
63
            Normal,
64
            Caption,
65
            Error,
66
        }
67
68
        private void CheckShapeState()
69
        {
70
71
72
            if (cbHatchShape.IsChecked == true)
73
            {
74
                cbFillShape.IsChecked = false;
75
                ViewerDataModel.Instance.paintSet = MarkupToPDF.Controls.Common.PaintSet.Hatch;
76
            }
77
            else if(cbFillShape.IsChecked == true)
78
            {
79
                cbHatchShape.IsChecked = false;
80
                ViewerDataModel.Instance.paintSet = MarkupToPDF.Controls.Common.PaintSet.Fill;
81
            }
82
            else
83
            {
84
                ViewerDataModel.Instance.paintSet = MarkupToPDF.Controls.Common.PaintSet.None;
85
            }
86
        }
87
88 c5519c44 taeseongkim
        /// <summary>
89
        ///  comment의 속성 변경시 저장여부 확인 하도록 undocommand에 추가
90
        /// </summary>
91
        /// <param name="adnoerFinal"></param>
92
        public void ChangeComment(Controls.AdornerFinal adnoerFinal)
93
        {
94
            var adornerMembers = adnoerFinal.Members.Cast<Controls.AdornerMember>();
95
96
            if (adornerMembers.Count() > 0)
97
            {
98
                UndoCommand.Instance.Push(adornerMembers.Select(x => x.DrawingData).Cast<CommentUserInfo>().ToList(), adnoerFinal.AngleValue);
99
            }
100
        }
101
102 787a4489 KangIngu
        //강인구 추가(Undo End)
103
        private void SetPaintEvent()
104
        {
105
            List<AdornerMember> AdonerList = GetAdornerItem();
106
107
            if (AdonerList.Count > 0)
108
            {
109
                Undo_data UndoData = new Undo_data()
110
                {
111
                    IsUndo = false,
112
                    Event = Event_Type.Option,
113
                    EventTime = DateTime.Now,
114
                    paint = ViewerDataModel.Instance.paintSet,
115
                    Markup_List = new List<Multi_Undo_data>()
116
                };
117
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
118
119
                foreach (AdornerMember InnerItem in AdonerList)
120
                {
121
                    multi_Undo_Data.PointSet = new List<Point>();
122
123
                    if ((InnerItem.DrawingData as MarkupToPDF.Controls.Common.IShapeControl) != null)
124
                    {
125
                        (InnerItem.DrawingData as MarkupToPDF.Controls.Common.IShapeControl).Paint = ViewerDataModel.Instance.paintSet;
126
                    }
127
128
                    multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
129
                    UndoData.Markup_List.Add(multi_Undo_Data);
130
                    multi_Undo_Data = new Multi_Undo_data();
131
                }
132
133
                ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
134
                {
135 ccf944bb ljiyeon
                    ViewerDataModel.Instance.UndoDataList.Remove(i);                    
136 787a4489 KangIngu
                });
137
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
138
            }
139
        }
140
141
        private void SetHighlightEvent()
142
        {
143
            List<AdornerMember> AdonerList = GetAdornerItem();
144
145
            if (AdonerList.Count > 0)
146
            {
147
                foreach (AdornerMember InnerItem in AdonerList)
148
                {
149
                    switch (InnerItem.DrawingData.GetType().Name)
150
                    {
151
                        case ("TextControl"):
152
                            {
153
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).IsHighLight = ViewerDataModel.Instance.checkHighShape;
154
                            }
155
                            break;
156
                        case ("ArrowTextControl"):
157
                            {
158
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape;
159
                            }
160
                            break;
161
                    }
162
                }
163 5ba8f2d5 taeseongkim
164
                ViewerDataModel.Instance.IsMarkupUpdate = true;
165 787a4489 KangIngu
            }
166
167
        }
168
169
        private void FillShapeEvent(object sender, RoutedEventArgs e)
170
        {
171
            #region 주석
172
            //if ((sender as CheckBox).IsChecked.Value)
173
            //{
174
            //    cbHatchShape.IsChecked = false;
175
            //    imgShape_RectCloud.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/RectCloud_Fill.png", UriKind.Relative));
176
            //    imgShape_Cloud.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/Cloud_Fill.png", UriKind.Relative));
177
            //    imgShape_Rect.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/Rectangle_Fill.png", UriKind.Relative));
178
            //    imgShape_Tri.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/triangle-icon.png", UriKind.Relative));
179
            //    imgShape_Cicle.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/circle-icon.png", UriKind.Relative));
180
            //    imgShape_Poly.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/polygon_Fill.png", UriKind.Relative));
181
            //    TaskMessage("채우기 옵션이 적용되었습니다", TaskMessageType.Normal);
182
            //}
183
            //else
184
            //{
185
186
            //    imgShape_RectCloud.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/RectCloud.png", UriKind.Relative));
187
            //    imgShape_Cloud.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/Cloud.png", UriKind.Relative));
188
            //    imgShape_Rect.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/Rectangle.png", UriKind.Relative));
189
            //    imgShape_Tri.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/triangle-icon_None.png", UriKind.Relative));
190
            //    imgShape_Cicle.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/circle-icon_None.png", UriKind.Relative));
191
            //    imgShape_Poly.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/polygon.png", UriKind.Relative));
192
            //    TaskMessage("채우기 옵션이 해제되었습니다", TaskMessageType.Caption);
193
            //}
194
            #endregion
195
            ViewerDataModel.Instance.checkFillShape = (sender as CheckBox).IsChecked.Value;
196
197
            if (ViewerDataModel.Instance.checkFillShape)
198
            {
199
                cbHatchShape.IsChecked = false;
200
                ViewerDataModel.Instance.paintSet = MarkupToPDF.Controls.Common.PaintSet.Fill;
201
            }
202
            else
203
            {
204
                ViewerDataModel.Instance.paintSet = MarkupToPDF.Controls.Common.PaintSet.None;
205
            }
206
            SetPaintEvent();
207
        }
208
209
        /// <summary>
210
        /// 도형 빗금 처리
211
        /// </summary>
212
        /// <param name="sender"></param>
213
        /// <param name="e"></param>
214
        private void HatchShapeEvent(object sender, RoutedEventArgs e)
215
        {
216
			#region 주석
217
            //if ((sender as CheckBox).IsChecked.Value)
218
            //{
219
            //    cbFillShape.IsChecked = false;
220
            //    imgShape_RectCloud.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/RectCloud_Hatch.png", UriKind.Relative));
221
            //    imgShape_Cloud.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/Cloud_Hatch.png", UriKind.Relative));
222
            //    imgShape_Rect.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/rectangle-icon_Hatch.png", UriKind.Relative));
223
            //    imgShape_Tri.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/triangle-icon_Hatch.png", UriKind.Relative));
224
            //    imgShape_Cicle.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/circle-icon_Hatch.png", UriKind.Relative));
225
            //    imgShape_Poly.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/polygon_hatch.png", UriKind.Relative));
226
            //    TaskMessage("무늬 옵션이 적용되었습니다", TaskMessageType.Normal);
227
            //}
228
            //else
229
            //{
230
            //    imgShape_RectCloud.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/RectCloud.png", UriKind.Relative));
231
            //    imgShape_Cloud.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/Cloud.png", UriKind.Relative));
232
            //    imgShape_Rect.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/Rectangle.png", UriKind.Relative));
233
            //    imgShape_Tri.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/triangle-icon_None.png", UriKind.Relative));
234
            //    imgShape_Cicle.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/circle-icon_None.png", UriKind.Relative));
235
            //    imgShape_Poly.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/polygon.png", UriKind.Relative));
236
            //    TaskMessage("무늬 옵션이 해제되었습니다", TaskMessageType.Caption);
237
            //} 
238
            #endregion
239
240
            //강인구 추가
241
            ViewerDataModel.Instance.checkHatchShape = (sender as CheckBox).IsChecked.Value;
242
            if (ViewerDataModel.Instance.checkHatchShape)
243
            {
244
                cbFillShape.IsChecked = false;
245
                ViewerDataModel.Instance.paintSet = MarkupToPDF.Controls.Common.PaintSet.Hatch;
246
            }
247
            else
248
            {
249
                ViewerDataModel.Instance.paintSet = MarkupToPDF.Controls.Common.PaintSet.None;  
250
            }
251
            SetPaintEvent();
252
        }
253
254
        void SaveTimer_Tick(object sender, EventArgs e)
255
        {
256
            //if (this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode != IKCOM.MouseHandlingMode.Drawing)
257
            if (this.ParentOfType<MainWindow>().dzMainMenu.currentControl == null && this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count == 0)
258
            {
259 cb5c7f06 humkyung
                SaveEventCallback(null, null);
260 787a4489 KangIngu
            }
261
        }
262
263
        private void SaveTime(bool IsRun)
264
        {
265
            if(SaveTimer == null)
266
            {
267
                SaveTimer = new System.Windows.Threading.DispatcherTimer();
268
                SaveTimer.Interval = new TimeSpan(0, 0, 5);
269
                SaveTimer.Tick += new EventHandler(SaveTimer_Tick);
270
            }
271
272
            if (IsRun)
273
            {
274
                SaveTimer.Start();
275
            }
276
            else
277
            {
278
                SaveTimer.Stop();
279
            }
280
        }
281 537f4cd8 djkim
        private void SaveTime(bool IsRun,int timeinterval)
282
        {
283
            if (SaveTimer == null)
284
            {
285
                SaveTimer = new System.Windows.Threading.DispatcherTimer();
286
                SaveTimer.Interval = new TimeSpan(0, timeinterval, 0);
287
                SaveTimer.Tick += new EventHandler(SaveTimer_Tick);
288
            }
289
            else
290
            {
291
                SaveTimer.Stop();
292
                SaveTimer.Interval = new TimeSpan(0, timeinterval, 0);
293
            }
294 787a4489 KangIngu
295 537f4cd8 djkim
            if (IsRun)
296
            {
297
                SaveTimer.Start();
298
            }
299
            else
300
            {
301
                SaveTimer.Stop();
302
            }
303
        }
304 532d83ef humkyung
        /// <summary>
305
        /// enable busy indicator and then call _SaveEvent method.
306
        /// </summary>
307
        /// <param name="sender"></param>
308
        /// <param name="e"></param>
309 1d79913e taeseongkim
        public  void SaveEventCallback(object sender, RoutedEventArgs e)
310 787a4489 KangIngu
        {
311 f65e6c02 taeseongkim
            var mianMenu = this.ParentOfType<MainWindow>().dzMainMenu;
312 787a4489 KangIngu
313 f65e6c02 taeseongkim
            if (mianMenu.busyIndicator.IsBusy == true)
314 532d83ef humkyung
            {
315 f65e6c02 taeseongkim
                return;
316
            }
317
318 77cdac33 taeseongkim
            //var result = await Dispatcher.InvokeAsync<bool>(()=>
319
            //{
320 f65e6c02 taeseongkim
                this.ParentOfType<MainWindow>().dzMainMenu.busyIndicator.IsBusy = true;
321
322
                _SaveEvent(sender, e);
323
324
                mianMenu.busyIndicator.IsBusy = false;
325 77cdac33 taeseongkim
               
326
            //});
327 f65e6c02 taeseongkim
328
            //System.Threading.Tasks.Task SaveTask = System.Threading.Tasks.Task.Factory.StartNew(() =>
329
            //{
330
            //    Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, new Action<object, RoutedEventArgs>(_SaveEvent), sender, e);
331
            //}).ContinueWith(task =>
332
            //{
333
            //    Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate () { this.ParentOfType<MainWindow>().dzMainMenu.busyIndicator.IsBusy = false; }));
334
            //});
335 532d83ef humkyung
        }
336 787a4489 KangIngu
337 532d83ef humkyung
        /// <summary>
338 d62c0439 humkyung
        /// save markup
339 cb5c7f06 humkyung
        ///  - convert ink control to polygon control if ink control exists
340
        ///  - unselect and update my markup list
341 532d83ef humkyung
        /// <param name="sender"></param>
342
        /// <param name="e"></param>
343 b42dd24d taeseongkim
        public bool _SaveEvent(object sender, RoutedEventArgs e)
344 532d83ef humkyung
        {
345 b42dd24d taeseongkim
            bool result = false;
346
347 f65e6c02 taeseongkim
            var mainMenu = this.ParentOfType<MainWindow>().dzMainMenu;
348 532d83ef humkyung
            try
349 787a4489 KangIngu
            {
350 f65e6c02 taeseongkim
                mainMenu.ConvertInkControlToPolygon();
351 f729ef4e humkyung
352 6a19b48d taeseongkim
                //Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.zoomAndPanControl_MouseDown(this, new MouseButtonEventArgs(Mouse.PrimaryDevice, 0, MouseButton.Right));
353
354
                //SelectionSet.Instance.UnSelect(this.ParentOfType<MainWindow>().dzMainMenu);
355 8129f2a5 ljiyeon
                // update mylist and gridview
356 f65e6c02 taeseongkim
                mainMenu.UpdateMyMarkupList();
357 8129f2a5 ljiyeon
358 f65e6c02 taeseongkim
                if (mainMenu.gridViewMarkup.SelectedItems.Count == 0 && mainMenu.gridViewMarkup.Items.Count > 0)
359 787a4489 KangIngu
                {
360 532d83ef humkyung
                    this.ParentOfType<MainWindow>().DialogMessage_Alert("Please Select Your Comment List Item", "Alert");
361
                }
362
                else
363 8129f2a5 ljiyeon
                {                    
364 f65e6c02 taeseongkim
                    foreach (var item in mainMenu.gridViewMarkup.SelectedItems)
365 787a4489 KangIngu
                    {
366 532d83ef humkyung
                        if ((item as IKCOM.MarkupInfoItem).UserID == App.ViewInfo.UserID)
367
                        {
368 eeb0a39c taeseongkim
                            /// 저장 서비스 호출
369 43e1d368 taeseongkim
                            this.ExecuteSaveCommandAsync(mainMenu);
370 eeb0a39c taeseongkim
371 532d83ef humkyung
                            ViewerDataModel.Instance._markupInfoList.Where(data => data.MarkupInfoID == (item as IKCOM.MarkupInfoItem).MarkupInfoID).FirstOrDefault().UpdateTime = DateTime.Now;
372 cb5c7f06 humkyung
                            if (!ViewerDataModel.Instance.IsConsolidate && (sender != null))
373 532d83ef humkyung
                            {
374 c5519c44 taeseongkim
                                this.ParentOfType<MainWindow>().DialogMessage_Alert("Save is complete.", "Info");
375 b42dd24d taeseongkim
                                
376 532d83ef humkyung
                            }
377 b42dd24d taeseongkim
378
                            result = true;
379 316d0f5c KangIngu
                        }
380 787a4489 KangIngu
                    }
381 532d83ef humkyung
                }
382 cb5c7f06 humkyung
383 24c5e56c taeseongkim
                mainMenu.SetCommentPages(null);
384 f65e6c02 taeseongkim
385 cb5c7f06 humkyung
                ViewerDataModel.Instance.UndoDataList.Clear();
386 787a4489 KangIngu
            }
387 cb5c7f06 humkyung
            catch (Exception ex)
388 399976da ljiyeon
            {
389 0585d5cc taeseongkim
                System.Diagnostics.Debug.WriteLine("_SaveEvent Error : " + ex.ToString());
390 399976da ljiyeon
            }
391 532d83ef humkyung
            finally
392 316d0f5c KangIngu
            {
393 8129f2a5 ljiyeon
                /*
394 d62c0439 humkyung
                /// delete markup information when 코멘트가 없을 경우
395
                if (ViewerDataModel.Instance.MyMarkupList.Count == 0)
396
                {
397
                    foreach (var item in menu.gridViewMarkup.SelectedItems)
398
                    {
399
                        if ((item as IKCOM.MarkupInfoItem).UserID == App.ViewInfo.UserID)
400
                        {
401 8129f2a5 ljiyeon
                            //this.ParentOfType<MainWindow>().dzMainMenu.DeleteItem((item as IKCOM.MarkupInfoItem));
402 d62c0439 humkyung
                        }
403
                    }
404
                }
405 8129f2a5 ljiyeon
                */
406 316d0f5c KangIngu
            }
407 b42dd24d taeseongkim
408
            return result;
409 787a4489 KangIngu
        }
410 43e1d368 taeseongkim
411 77cdac33 taeseongkim
        public async Task<bool>  SaveEventAsync()
412
        {
413
            bool result = false;
414
415
            var mainMenu = this.ParentOfType<MainWindow>().dzMainMenu;
416
            try
417
            {
418
                mainMenu.ConvertInkControlToPolygon();
419
420
                SelectionSet.Instance.UnSelect(this.ParentOfType<MainWindow>().dzMainMenu);
421
                // update mylist and gridview
422
                mainMenu.UpdateMyMarkupList();
423
424
                if (mainMenu.gridViewMarkup.SelectedItems.Count == 0 && mainMenu.gridViewMarkup.Items.Count > 0)
425
                {
426
                    this.ParentOfType<MainWindow>().DialogMessage_Alert("Please Select Your Comment List Item", "Alert");
427
                }
428
                else
429
                {
430
                    foreach (var item in mainMenu.gridViewMarkup.SelectedItems)
431
                    {
432
                        if ((item as IKCOM.MarkupInfoItem).UserID == App.ViewInfo.UserID)
433
                        {
434
                            /// 저장 서비스 호출
435 43e1d368 taeseongkim
                            result = await this.ExecuteSaveCommandAsync(mainMenu);
436
437
                            ViewerDataModel.Instance._markupInfoList.Where(data => data.MarkupInfoID == (item as IKCOM.MarkupInfoItem).MarkupInfoID).FirstOrDefault().UpdateTime = DateTime.Now;
438
                        }
439
                    }
440
                }
441
442
                mainMenu.SetCommentPages(null);
443
444
                ViewerDataModel.Instance.UndoDataList.Clear();
445
                result = true;
446
            }
447
            catch (Exception ex)
448
            {
449
                System.Diagnostics.Debug.WriteLine("_SaveEvent Error : " + ex.ToString());
450
            }
451
            finally
452
            {
453
                /*
454
                /// delete markup information when 코멘트가 없을 경우
455
                if (ViewerDataModel.Instance.MyMarkupList.Count == 0)
456
                {
457
                    foreach (var item in menu.gridViewMarkup.SelectedItems)
458
                    {
459
                        if ((item as IKCOM.MarkupInfoItem).UserID == App.ViewInfo.UserID)
460
                        {
461
                            //this.ParentOfType<MainWindow>().dzMainMenu.DeleteItem((item as IKCOM.MarkupInfoItem));
462
                        }
463
                    }
464
                }
465
                */
466
            }
467
468
            return result;
469
        }
470
471
        public bool SaveEvent()
472
        {
473
            bool result = false;
474
475
            var mainMenu = this.ParentOfType<MainWindow>().dzMainMenu;
476
            try
477
            {
478
                mainMenu.ConvertInkControlToPolygon();
479
480
                SelectionSet.Instance.UnSelect(this.ParentOfType<MainWindow>().dzMainMenu);
481
                // update mylist and gridview
482
                mainMenu.UpdateMyMarkupList();
483
484
                if (mainMenu.gridViewMarkup.SelectedItems.Count == 0 && mainMenu.gridViewMarkup.Items.Count > 0)
485
                {
486
                    this.ParentOfType<MainWindow>().DialogMessage_Alert("Please Select Your Comment List Item", "Alert");
487
                }
488
                else
489
                {
490
                    foreach (var item in mainMenu.gridViewMarkup.SelectedItems)
491
                    {
492
                        if ((item as IKCOM.MarkupInfoItem).UserID == App.ViewInfo.UserID)
493
                        {
494
                            /// 저장 서비스 호출
495
                            result = this.ExecuteSaveCommandAsync(mainMenu).GetAwaiter().GetResult();
496 77cdac33 taeseongkim
497
                            ViewerDataModel.Instance._markupInfoList.Where(data => data.MarkupInfoID == (item as IKCOM.MarkupInfoItem).MarkupInfoID).FirstOrDefault().UpdateTime = DateTime.Now;
498
                        }
499
                    }
500
                }
501
502
                mainMenu.SetCommentPages(null);
503
504
                ViewerDataModel.Instance.UndoDataList.Clear();
505
                result = true;
506
            }
507
            catch (Exception ex)
508
            {
509
                System.Diagnostics.Debug.WriteLine("_SaveEvent Error : " + ex.ToString());
510
            }
511
            finally
512
            {
513
                /*
514
                /// delete markup information when 코멘트가 없을 경우
515
                if (ViewerDataModel.Instance.MyMarkupList.Count == 0)
516
                {
517
                    foreach (var item in menu.gridViewMarkup.SelectedItems)
518
                    {
519
                        if ((item as IKCOM.MarkupInfoItem).UserID == App.ViewInfo.UserID)
520
                        {
521
                            //this.ParentOfType<MainWindow>().dzMainMenu.DeleteItem((item as IKCOM.MarkupInfoItem));
522
                        }
523
                    }
524
                }
525
                */
526
            }
527
528
            return result;
529
        }
530 787a4489 KangIngu
531 d62c0439 humkyung
        /// <summary>
532
        /// call save command
533
        /// </summary>
534
        /// <param name="menu"></param>
535 b42dd24d taeseongkim
		public void ExecuteSaveCommand2(MainMenu menu)
536 787a4489 KangIngu
        {
537 0585d5cc taeseongkim
            if (menu.pageNavigator.CurrentPage != null)
538 787a4489 KangIngu
            {
539 0585d5cc taeseongkim
                SaveCommand.Instance.Project_No = App.ViewInfo.ProjectNO;
540
                SaveCommand.Instance.document_id = App.ViewInfo.DocumentItemID;
541
                SaveCommand.Instance.user_id = App.ViewInfo.UserID;
542
                SaveCommand.Instance.page_no = menu.pageNavigator.CurrentPage.PageNumber;
543
544
                try
545 787a4489 KangIngu
                {
546 0585d5cc taeseongkim
                    if (ViewerDataModel.Instance.UndoDataList.Count > 0)
547 787a4489 KangIngu
                    {
548 0585d5cc taeseongkim
                        List<IKCOM.MarkupInfoItem> SelectedMarkupInfos = new List<IKCOM.MarkupInfoItem>();
549
                        foreach (var item in menu.gridViewMarkup.SelectedItems)
550 129ca191 humkyung
                        {
551 0585d5cc taeseongkim
                            if ((item as IKCOM.MarkupInfoItem).UserID == App.ViewInfo.UserID)
552
                            {
553
                                SelectedMarkupInfos.Add(item as IKCOM.MarkupInfoItem);
554
                            }
555 129ca191 humkyung
                        }
556 0585d5cc taeseongkim
557
                        SaveCommand.Instance.Execute(SelectedMarkupInfos);
558 787a4489 KangIngu
                    }
559 129ca191 humkyung
560 0585d5cc taeseongkim
                    if (ViewerDataModel.Instance.RotationDocs.Count > 0)
561
                    {
562
                        SaveCommand.Instance.PageAngleSave(App.ViewInfo.ProjectNO, ViewerDataModel.Instance.RotationDocs);
563
                    }
564 787a4489 KangIngu
                }
565 0585d5cc taeseongkim
                catch (Exception ex)
566 eeb0a39c taeseongkim
                {
567 0585d5cc taeseongkim
                    this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert(string.Format("세이브 실패:{0}", ex.Message), "Alert");
568
                    throw ex;
569 eeb0a39c taeseongkim
                }
570 787a4489 KangIngu
            }
571 0585d5cc taeseongkim
            else
572 787a4489 KangIngu
            {
573 0585d5cc taeseongkim
                System.Diagnostics.Debug.WriteLine("ExecuteSaveCommand Error - pageNavigator.CurrentPage null");
574 787a4489 KangIngu
            }
575
        }
576 43e1d368 taeseongkim
        public async Task<bool> ExecuteSaveCommandAsync(MainMenu menu)
577 b42dd24d taeseongkim
        {
578
            bool result = false;
579
580
            if (menu.pageNavigator.CurrentPage != null)
581
            {
582
                SaveCommand.Instance.Project_No = App.ViewInfo.ProjectNO;
583
                SaveCommand.Instance.document_id = App.ViewInfo.DocumentItemID;
584
                SaveCommand.Instance.user_id = App.ViewInfo.UserID;
585
                SaveCommand.Instance.page_no = menu.pageNavigator.CurrentPage.PageNumber;
586
587
                try
588
                {
589 5ba8f2d5 taeseongkim
                    if (ViewerDataModel.Instance.UndoDataList.Count > 0 || ViewerDataModel.Instance.IsMarkupUpdate)
590 b42dd24d taeseongkim
                    {
591
                        List<IKCOM.MarkupInfoItem> SelectedMarkupInfos = new List<IKCOM.MarkupInfoItem>();
592
                        foreach (var item in menu.gridViewMarkup.SelectedItems)
593
                        {
594
                            if ((item as IKCOM.MarkupInfoItem).UserID == App.ViewInfo.UserID)
595
                            {
596
                                SelectedMarkupInfos.Add(item as IKCOM.MarkupInfoItem);
597
                            }
598
                        }
599
600
                        result = await SaveCommand.Instance.Execute(SelectedMarkupInfos);
601 5ba8f2d5 taeseongkim
                        ViewerDataModel.Instance.IsMarkupUpdate = false;
602 b42dd24d taeseongkim
                    }
603
                    else
604
                    {
605
                        result = true;
606
                    }
607
608
                    if (ViewerDataModel.Instance.RotationDocs.Count > 0)
609
                    {
610
                        SaveCommand.Instance.PageAngleSave(App.ViewInfo.ProjectNO, ViewerDataModel.Instance.RotationDocs);
611
                    }
612
                }
613
                catch (Exception ex)
614
                {
615
                    this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert(string.Format("세이브 실패:{0}", ex.Message), "Alert");
616
                    throw ex;
617
                }
618
            }
619
            else
620
            {
621
                System.Diagnostics.Debug.WriteLine("ExecuteSaveCommand Error - pageNavigator.CurrentPage null");
622
            }
623
624
            return result;
625
        }
626
627 43e1d368 taeseongkim
        public bool ExecuteSaveCommand(MainMenu menu)
628
        {
629
            bool result = false;
630
631
            if (menu.pageNavigator.CurrentPage != null)
632
            {
633
                SaveCommand.Instance.Project_No = App.ViewInfo.ProjectNO;
634
                SaveCommand.Instance.document_id = App.ViewInfo.DocumentItemID;
635
                SaveCommand.Instance.user_id = App.ViewInfo.UserID;
636
                SaveCommand.Instance.page_no = menu.pageNavigator.CurrentPage.PageNumber;
637
638
                try
639
                {
640
                    if (ViewerDataModel.Instance.UndoDataList.Count > 0 || ViewerDataModel.Instance.IsMarkupUpdate)
641
                    {
642
                        List<IKCOM.MarkupInfoItem> SelectedMarkupInfos = new List<IKCOM.MarkupInfoItem>();
643
                        foreach (var item in menu.gridViewMarkup.SelectedItems)
644
                        {
645
                            if ((item as IKCOM.MarkupInfoItem).UserID == App.ViewInfo.UserID)
646
                            {
647
                                SelectedMarkupInfos.Add(item as IKCOM.MarkupInfoItem);
648
                            }
649
                        }
650
651
                        result = SaveCommand.Instance.Execute(SelectedMarkupInfos).GetAwaiter().GetResult();
652
                        ViewerDataModel.Instance.IsMarkupUpdate = false;
653
                    }
654
                    else
655
                    {
656
                        result = true;
657
                    }
658
659
                    if (ViewerDataModel.Instance.RotationDocs.Count > 0)
660
                    {
661
                        SaveCommand.Instance.PageAngleSave(App.ViewInfo.ProjectNO, ViewerDataModel.Instance.RotationDocs);
662
                    }
663
                }
664
                catch (Exception ex)
665
                {
666
                    this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert(string.Format("세이브 실패:{0}", ex.Message), "Alert");
667
                    throw ex;
668
                }
669
            }
670
            else
671
            {
672
                System.Diagnostics.Debug.WriteLine("ExecuteSaveCommand Error - pageNavigator.CurrentPage null");
673
            }
674
675
            return result;
676
        }
677
678 787a4489 KangIngu
        //강인구 추가
679
        public void Print_Start(string Type)
680
        {
681 4c8bb207 djkim
            if (ViewerDataModel.Instance.MarkupControls_USER.Count > 0 || this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
682 787a4489 KangIngu
            {
683
                var menu = this.ParentOfType<MainWindow>().dzMainMenu;
684 077896be humkyung
                SelectionSet.Instance.UnSelect(menu);
685 787a4489 KangIngu
                if (menu.PreviewUserMarkupInfoItem != null && menu.PreviewUserMarkupInfoItem.IsPreviewUser == true)
686
                {
687 cb5c7f06 humkyung
                    this.SaveEventCallback(null, null);
688 787a4489 KangIngu
                }
689
                else if (menu.gridViewMarkup.SelectedItems.Count == 0 || (menu.gridViewMarkup.SelectedItems.FirstOrDefault() as IKCOM.MarkupInfoItem).UserID != App.ViewInfo.UserID)
690
                {
691
692
                }
693
                else
694
                {
695 cb5c7f06 humkyung
                    this.SaveEventCallback(null, null);
696 787a4489 KangIngu
                }
697
            }
698
699
            bool isprint = false;
700
            if (Type == "Print")
701
            {
702
                isprint = true;
703
            }
704
705
            RadWindow PrintWindow = new RadWindow();
706
            PrintWindow.Width = 850;
707
            PrintWindow.Height = 600;
708
            PrintWindow.Header = Type;
709
710
            List<IKCOM.MarkupInfoItem> markupinfo = new List<IKCOM.MarkupInfoItem>();
711 0f065e57 ljiyeon
712 6c781c0c djkim
            markupinfo = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.GetPrintDocItemList(App.ViewInfo.ProjectNO, App.ViewInfo.DocumentItemID, ViewerDataModel.Instance._markupInfoList.ToList());
713
714 285635d3 taeseongkim
            if (markupinfo?.Count() > 0)
715 0f065e57 ljiyeon
            {
716 664ea2e1 taeseongkim
                //Logger.sendResLog("GetPrintDocItemList", "TRUE", 1);
717 0f065e57 ljiyeon
            }
718
            else
719
            {
720 664ea2e1 taeseongkim
                //Logger.sendResLog("GetPrintDocItemList", "FALSE", 1);
721 0f065e57 ljiyeon
            }
722
723 6dcbe4a7 humkyung
            /// Tile Source URL을 구한다
724 c3bb196c taeseongkim
725 6dcbe4a7 humkyung
            string sImageURL = ViewerDataModel.Instance.SystemMain.dzMainMenu.GetImageURL(App.ViewInfo.DocumentItemID, this.ParentOfType<MainWindow>().dzMainMenu.pageNavigator.CurrentPage.PageNumber);
726
            var url = new Uri(sImageURL);
727 71f5a3be humkyung
            string sFolder = App.ViewInfo.DocumentItemID.All(char.IsDigit) ? (Convert.ToInt64(App.ViewInfo.DocumentItemID) / 100).ToString() : App.ViewInfo.DocumentItemID.Substring(0, 5);
728 6dcbe4a7 humkyung
            var Tile_Url = string.Format(@"{0}://{1}:{2}/TileSource/{3}_Tile/{4}/{5}/",
729
                url.Scheme, url.Host, url.Port,
730 6c781c0c djkim
                App.ViewInfo.ProjectNO,
731 71f5a3be humkyung
                sFolder,
732 6c781c0c djkim
                App.ViewInfo.DocumentItemID
733
                );
734 6dcbe4a7 humkyung
            /// up to here
735 6c781c0c djkim
736 00143658 taeseongkim
            var docitem = this.ParentOfType<MainWindow>().dzMainMenu._DocItem;
737
738 6c781c0c djkim
            PrintWindow.Content = new KCOM.Control.PrintControl(
739
                      Tile_Url,
740
                      App.ViewInfo.ProjectNO,
741 00143658 taeseongkim
                      this.ParentOfType<MainWindow>().dzMainMenu._DocInfo,
742
                      markupinfo,
743 6c781c0c djkim
                      this.ParentOfType<MainWindow>().dzMainMenu.pageNavigator.CurrentPage.PageNumber,
744 00143658 taeseongkim
                      docitem.GROUP_NO,
745
                      docitem.DOCUMENT_NO,
746
                      docitem.ORIGINAL_FILE,
747
                      isprint);
748 787a4489 KangIngu
749
            //프린트 팝업 옵션
750
            //PrintWindow.BorderThickness = new Thickness(3);
751
            //PrintWindow.BorderBrush = new SolidColorBrush(Color.FromArgb(255, 37, 160, 218));
752
            PrintWindow.ResizeMode = System.Windows.ResizeMode.NoResize;
753
            PrintWindow.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
754
            PrintWindow.Background = new SolidColorBrush(Colors.Black);
755
            PrintWindow.Background.Opacity = 0.6;
756 b9b01f8e ljiyeon
            PrintWindow.Owner = Application.Current.MainWindow;
757 787a4489 KangIngu
            Telerik.Windows.Controls.StyleManager.SetTheme(PrintWindow, new Telerik.Windows.Controls.VisualStudio2013Theme());
758
            PrintWindow.ShowDialog();
759
        }
760
761
        //강인구 추가
762
        private void PrintEvent(object sender, RoutedEventArgs e)
763
        {
764
            RadRibbonButton button = sender as RadRibbonButton;
765
            Print_Start(button.Content.ToString());
766
        }
767
768
        private List<AdornerMember> GetAdornerItem()
769
        {
770
            List<AdornerMember> AdonerList = new List<AdornerMember>();
771
772
            if (this.ParentOfType<MainWindow>() != null)
773
            {
774
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
775
                {
776
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
777
                    {
778
                        if (item.GetType().Name == "AdornerFinal")
779
                        {
780 4913851c humkyung
                            foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
781 787a4489 KangIngu
                            {
782
                                AdonerList.Add(InnerItem);
783
                            }
784
                        }
785
                    }
786
                }
787
            }
788 4913851c humkyung
789 787a4489 KangIngu
            return AdonerList;
790
        }
791
        /// <summary>
792
        /// 투명도
793
        /// </summary>
794
        /// <param name="sender"></param>
795
        /// <param name="e"></param>
796
        //강인구 추가(Undo End)
797
        private void sdOpacity_ValueChanged(object sender, RoutedEventArgs e)
798
        {
799
            List<AdornerMember> AdonerList = GetAdornerItem();
800
            if(AdonerList.Count > 0)
801
            {
802
                Undo_data UndoData = new Undo_data()
803
                {
804
                    IsUndo = false,
805
                    Event = Event_Type.Option,
806
                    EventTime = DateTime.Now,
807
                    Opacity = ViewerDataModel.Instance.ControlOpacity,
808
                    Markup_List = new List<Multi_Undo_data>()
809
                };
810
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
811
812
                foreach (AdornerMember InnerItem in AdonerList)
813
                {
814
                    InnerItem.DrawingData.Opacity = ViewerDataModel.Instance.ControlOpacity;
815
                  
816
                    multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
817
                    UndoData.Markup_List.Add(multi_Undo_Data);
818
                    multi_Undo_Data = new Multi_Undo_data();
819
                }
820
821
                ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
822
                {
823
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
824
                });
825
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
826
            }
827
        }
828
829
        //강인구 추가(Undo End)
830
        private void cbLineSize_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
831
        {
832 be04d12c djkim
            if (string.IsNullOrEmpty(cbLineSize.Value.ToString()))
833
            {
834
                cbLineSize.Value = cbLineSize.Minimum;
835
            }
836 787a4489 KangIngu
            List<AdornerMember> AdonerList = GetAdornerItem();
837
            if (AdonerList.Count > 0)
838
            {
839
                Undo_data UndoData = new Undo_data()
840
                {
841
                    IsUndo = false,
842
                    Event = Event_Type.Option,
843
                    EventTime = DateTime.Now,
844
                    LineSize = ViewerDataModel.Instance.LineSize,
845
                    Markup_List = new List<Multi_Undo_data>()
846
                };
847
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
848
849
                foreach (AdornerMember InnerItem in AdonerList)
850
                {
851
                    switch (InnerItem.DrawingData.GetType().Name)
852
                    {
853
                        case ("LineControl"):
854
                            {
855
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Line.LineControl).LineSize = ViewerDataModel.Instance.LineSize;
856
                            }
857
                            break;
858
                        case ("ArcControl"):
859
                            {
860
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Line.ArcControl).LineSize = ViewerDataModel.Instance.LineSize;
861
                            }
862
                            break;
863 40b3ce25 ljiyeon
                        case ("ArrowArcControl"):
864
                            {
865
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Line.ArrowArcControl).LineSize = ViewerDataModel.Instance.LineSize;
866
                            }
867
                            break;
868 787a4489 KangIngu
                        case ("ArrowControl_Multi"):
869
                            {
870
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Line.ArrowControl_Multi).LineSize = ViewerDataModel.Instance.LineSize;
871
                            }
872
                            break;
873
                        case ("CloudControl"):
874
                            {
875
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Polygon.CloudControl).LineSize = ViewerDataModel.Instance.LineSize;
876
                            }
877
                            break;
878
                        case ("PolygonControl"):
879
                            {
880
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Polygon.PolygonControl).LineSize = ViewerDataModel.Instance.LineSize;
881
                            }
882
                            break;
883
                        case ("RectangleControl"):
884
                            {
885
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.RectangleControl).LineSize = ViewerDataModel.Instance.LineSize;
886
                            }
887
                            break;
888
                        case ("RectCloudControl"):
889
                            {
890
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.RectCloudControl).LineSize = ViewerDataModel.Instance.LineSize;
891
                            }
892
                            break;
893
                        case ("TriControl"):
894
                            {
895
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.TriControl).LineSize = ViewerDataModel.Instance.LineSize;
896
                            }
897
                            break;
898
                        case ("CircleControl"):
899
                            {
900
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.CircleControl).LineSize = ViewerDataModel.Instance.LineSize;
901
                            }
902
                            break;
903 f8769f8a ljiyeon
                        case ("ArrowTextControl"):
904
                            {
905
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).LineSize = ViewerDataModel.Instance.LineSize;
906
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).BorderSize = new Thickness(ViewerDataModel.Instance.LineSize);
907
                            }
908
                            break;
909
                        case ("TextControl"):
910
                            {
911
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).LineSize = new Thickness(ViewerDataModel.Instance.LineSize);
912
                            }
913
                            break;
914 684ef11c ljiyeon
                        case ("InsideWhiteControl"):
915
                            {
916
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Cad.InsideWhiteControl).LineSize = ViewerDataModel.Instance.LineSize;
917
                            }
918
                            break;
919
                        case ("OverlapWhiteControl"):
920
                            {
921
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Cad.OverlapWhiteControl).LineSize = ViewerDataModel.Instance.LineSize;
922
                            }
923
                            break;
924
                        case ("ClipWhiteControl"):
925
                            {
926
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Cad.ClipWhiteControl).LineSize = ViewerDataModel.Instance.LineSize;
927
                            }
928
                            break;
929
                        case ("CoordinateControl"):
930
                            {
931
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Cad.CoordinateControl).LineSize = 10; //ViewerDataModel.Instance.LineSize
932
                            }
933
                            break;
934 787a4489 KangIngu
                    }
935
                    
936
937
                    multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
938
                    UndoData.Markup_List.Add(multi_Undo_Data);
939
                    multi_Undo_Data = new Multi_Undo_data();
940
                }
941
942
                ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
943
                {
944
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
945
                });
946
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
947 5822e146 ljiyeon
948
                
949 787a4489 KangIngu
            }
950 5822e146 ljiyeon
            KCOM.Properties.Settings.Default.LineSize = (double)cbLineSize.Value;
951
            Properties.Settings.Default.Save();
952 787a4489 KangIngu
        }
953
954 5ce56a3a KangIngu
955
        private void cbIntervalSize_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
956
        {
957 be04d12c djkim
            if (string.IsNullOrEmpty(cbIntervalSize.Value.ToString()))
958
            {
959
                cbIntervalSize.Value = cbIntervalSize.Minimum;
960
            }
961 5ce56a3a KangIngu
            List<AdornerMember> AdonerList = GetAdornerItem();
962
            if (AdonerList.Count > 0)
963
            {
964
965
                Undo_data UndoData = new Undo_data()
966
                {
967
                    IsUndo = false,
968
                    Event = Event_Type.Option,
969
                    EventTime = DateTime.Now,
970
                    Interval = ViewerDataModel.Instance.Interval,
971
                    Markup_List = new List<Multi_Undo_data>()
972
                };
973
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
974
975
                foreach (AdornerMember InnerItem in AdonerList)
976
                {
977
                    switch (InnerItem.DrawingData.GetType().Name)
978
                    {
979
                        case ("LineControl"):
980
                            {
981
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Line.LineControl).Interval = ViewerDataModel.Instance.Interval;
982
983
                                multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
984
                                UndoData.Markup_List.Add(multi_Undo_Data);
985
                                multi_Undo_Data = new Multi_Undo_data();
986
                            }
987
                            break;
988
                    }
989
                }
990
991
                ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
992
                {
993
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
994
                });
995
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
996
            }
997 5822e146 ljiyeon
            KCOM.Properties.Settings.Default.Interval = (double)cbIntervalSize.Value;
998
            Properties.Settings.Default.Save();
999 5ce56a3a KangIngu
        }
1000 537f4cd8 djkim
        
1001 9f473fb7 KangIngu
        private void cbArcLength_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
1002
        {
1003 be04d12c djkim
            if (string.IsNullOrEmpty(cbArcLength.Value.ToString()))
1004
            {
1005
                cbArcLength.Value = cbArcLength.Minimum;
1006
            }
1007 9f473fb7 KangIngu
            List<AdornerMember> AdonerList = GetAdornerItem();
1008
            if (AdonerList.Count > 0)
1009
            {
1010
1011
                //Undo_data UndoData = new Undo_data()
1012
                //{
1013
                //    IsUndo = false,
1014
                //    Event = Event_Type.Option,
1015
                //    EventTime = DateTime.Now,
1016
                //    Interval = ViewerDataModel.Instance.Interval,
1017
                //    Markup_List = new List<Multi_Undo_data>()
1018
                //};
1019
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
1020
1021
                foreach (AdornerMember InnerItem in AdonerList)
1022
                {
1023
                    switch (InnerItem.DrawingData.GetType().Name)
1024
                    {
1025
                        case ("RectCloudControl"):
1026
                            {
1027
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.RectCloudControl).ArcLength = ViewerDataModel.Instance.ArcLength;
1028
1029
                                //multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
1030
                                //UndoData.Markup_List.Add(multi_Undo_Data);
1031
                                //multi_Undo_Data = new Multi_Undo_data();
1032
                            }
1033
                            break;
1034
                        case ("CloudControl"):
1035
                            {
1036
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Polygon.CloudControl).ArcLength = ViewerDataModel.Instance.ArcLength;
1037
1038
                                //multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
1039
                                //UndoData.Markup_List.Add(multi_Undo_Data);
1040
                                //multi_Undo_Data = new Multi_Undo_data();
1041
                            }
1042
                            break;
1043
                    }
1044
                }
1045
1046
                //ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
1047
                //{
1048
                //    ViewerDataModel.Instance.UndoDataList.Remove(i);
1049
                //});
1050
                //ViewerDataModel.Instance.UndoDataList.Add(UndoData);
1051
            }
1052 5822e146 ljiyeon
1053
            KCOM.Properties.Settings.Default.ArcLength = (double)cbArcLength.Value;
1054
            Properties.Settings.Default.Save();
1055 9f473fb7 KangIngu
        }
1056
1057 787a4489 KangIngu
        //강인구 추가(Undo End)
1058
        private void cbDashStyle_SelectionChanged(object sender, SelectionChangedEventArgs e)
1059
        {
1060
            //강인구 추가
1061
            if (this.ParentOfType<MainWindow>() != null)
1062
            {
1063
                ViewerDataModel.Instance.DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
1064
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
1065
                {
1066
                    Undo_data UndoData = new Undo_data()
1067
                    {
1068
                        IsUndo = false,
1069
                        Event = Event_Type.Option,
1070
                        EventTime = DateTime.Now,
1071
                        DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData,
1072
                        Markup_List = new List<Multi_Undo_data>()
1073
                    };
1074
                    Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
1075
1076
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
1077
                    {
1078
                        if (item.GetType().Name == "AdornerFinal")
1079
                        {
1080 4913851c humkyung
                            foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
1081 787a4489 KangIngu
                            {
1082
                                switch (InnerItem.DrawingData.GetType().Name)
1083
                                {
1084
                                    case ("LineControl"):
1085
                                        {
1086
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Line.LineControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
1087
                                        }
1088
                                        break;
1089
                                    case ("ArcControl"):
1090
                                        {
1091
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Line.ArcControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
1092
                                        }
1093
                                        break;
1094 40b3ce25 ljiyeon
                                    case ("ArrowArcControl"):
1095
                                        {
1096
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Line.ArrowArcControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
1097
                                        }
1098
                                        break;
1099 787a4489 KangIngu
                                    case ("ArrowControl_Multi"):
1100
                                        {
1101
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Line.ArrowControl_Multi).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
1102
                                        }
1103
                                        break;
1104
                                    case ("CloudControl"):
1105
                                        {
1106
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Polygon.CloudControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
1107
                                        }
1108
                                        break;
1109
                                    case ("PolygonControl"):
1110
                                        {
1111
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Polygon.PolygonControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
1112
                                        }
1113
                                        break;
1114
                                    case ("RectangleControl"):
1115
                                        {
1116
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.RectangleControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
1117
                                        }
1118
                                        break;
1119
                                    case ("RectCloudControl"):
1120
                                        {
1121
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.RectCloudControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
1122
                                        }
1123
                                        break;
1124
                                    case ("TriControl"):
1125
                                        {
1126
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.TriControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
1127
                                        }
1128
                                        break;
1129
                                    case ("CircleControl"):
1130
                                        {
1131
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.CircleControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
1132
                                        }
1133 684ef11c ljiyeon
                                        break;
1134
                                    case ("InsideWhiteControl"):
1135
                                        {
1136
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Cad.InsideWhiteControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
1137
                                        }
1138
                                        break;
1139
                                    case ("OverlapWhiteControl"):
1140
                                        {
1141
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Cad.OverlapWhiteControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
1142
                                        }
1143
                                        break;
1144
                                    case ("ClipWhiteControl"):
1145
                                        {
1146
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Cad.ClipWhiteControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
1147
                                        }
1148
                                        break;
1149
                                    case ("CoordinateControl"):
1150
                                        {
1151
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Cad.CoordinateControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
1152
                                        }
1153
                                        break;
1154 787a4489 KangIngu
                                }
1155
1156
                                multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
1157
                                UndoData.Markup_List.Add(multi_Undo_Data);
1158
                                multi_Undo_Data = new Multi_Undo_data();
1159
                            }
1160
1161
                            ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
1162
                            {
1163
                                ViewerDataModel.Instance.UndoDataList.Remove(i);
1164
                            });
1165
                            ViewerDataModel.Instance.UndoDataList.Add(UndoData);
1166
                        }
1167
                    }
1168
                }
1169
            }
1170
        }
1171
1172
        //강인구 추가
1173
        private void comboFontSize_SelectionChanged(object sender, SelectionChangedEventArgs e)
1174
        {
1175 d4b0c723 KangIngu
            //if (this.ParentOfType<MainWindow>() != null)
1176
            //{
1177
            //    if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
1178
            //    {
1179
            //        foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
1180
            //        {
1181
            //            if (item.GetType().Name == "AdornerFinal")
1182
            //            {
1183
            //                foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
1184
            //                {
1185
            //                    switch (InnerItem.DrawingData.GetType().Name)
1186
            //                    {
1187
            //                        case ("TextControl"):
1188
            //                            {
1189
            //                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextSize = int.Parse(comboFontSize.Text);
1190
            //                            }
1191
            //                            break;
1192
            //                        case ("ArrowTextControl"):
1193
            //                            {
1194
            //                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextSize = int.Parse(comboFontSize.Text);
1195
            //                            }
1196
            //                            break;
1197
            //                    }
1198
            //                }
1199
            //            }
1200
            //        }
1201
            //    }
1202
            //}
1203 787a4489 KangIngu
        }
1204
1205
        //강인구 추가
1206
        private void btnBold_Checked(object sender, RoutedEventArgs e)
1207
        {
1208
            if (this.ParentOfType<MainWindow>() != null)
1209
            {
1210
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
1211
                {
1212
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
1213
                    {
1214
                        if (item.GetType().Name == "AdornerFinal")
1215
                        {
1216 4913851c humkyung
                            foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
1217 787a4489 KangIngu
                            {
1218
                                switch (InnerItem.DrawingData.GetType().Name)
1219
                                {
1220
                                    case ("TextControl"):
1221
                                        {
1222 d4b0c723 KangIngu
                                            if((InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextWeight == FontWeights.Bold)
1223 787a4489 KangIngu
                                            {
1224
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextWeight = FontWeights.Normal;
1225 5ba8f2d5 taeseongkim
                                                ViewerDataModel.Instance.IsMarkupUpdate = true;
1226 787a4489 KangIngu
                                            }
1227
                                            else
1228
                                            {
1229 d4b0c723 KangIngu
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextWeight = FontWeights.Bold;
1230 5ba8f2d5 taeseongkim
                                                ViewerDataModel.Instance.IsMarkupUpdate = true;
1231 787a4489 KangIngu
                                            }
1232
1233
                                        }
1234
                                        break;
1235
                                    case ("ArrowTextControl"):
1236
                                        {
1237 d4b0c723 KangIngu
                                            if ((InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextWeight == FontWeights.Bold)
1238 787a4489 KangIngu
                                            {
1239
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextWeight = FontWeights.Normal;
1240 5ba8f2d5 taeseongkim
                                                ViewerDataModel.Instance.IsMarkupUpdate = true;
1241 787a4489 KangIngu
                                            }
1242
                                            else
1243
                                            {
1244 d4b0c723 KangIngu
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextWeight = FontWeights.Bold;
1245 5ba8f2d5 taeseongkim
                                                ViewerDataModel.Instance.IsMarkupUpdate = true;
1246 787a4489 KangIngu
                                            }
1247
                                        }
1248
                                        break;
1249
                                }
1250
                            }
1251
                        }
1252
                    }
1253
                }
1254
            }
1255
        }
1256
1257
        //강인구 추가
1258
        private void btnItalic_Checked(object sender, RoutedEventArgs e)
1259
        {
1260
            if (this.ParentOfType<MainWindow>() != null)
1261
            {
1262
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
1263
                {
1264
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
1265
                    {
1266
                        if (item.GetType().Name == "AdornerFinal")
1267
                        {
1268 4913851c humkyung
                            foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
1269 787a4489 KangIngu
                            {
1270
                                switch (InnerItem.DrawingData.GetType().Name)
1271
                                {
1272
                                    case ("TextControl"):
1273
                                        {
1274
                                            if((InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextStyle == FontStyles.Italic)
1275
                                            {
1276
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextStyle = System.Windows.FontStyles.Normal;
1277 5ba8f2d5 taeseongkim
                                                ViewerDataModel.Instance.IsMarkupUpdate = true;
1278 787a4489 KangIngu
                                            }
1279
                                            else
1280
                                            {
1281
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextStyle = FontStyles.Italic;
1282 5ba8f2d5 taeseongkim
                                                ViewerDataModel.Instance.IsMarkupUpdate = true;
1283 787a4489 KangIngu
                                            }
1284
1285
                                        }
1286
                                        break;
1287
                                    case ("ArrowTextControl"):
1288
                                        {
1289
                                            if((InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextStyle == FontStyles.Italic)
1290
                                            {
1291
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextStyle = FontStyles.Normal;
1292 5ba8f2d5 taeseongkim
                                                ViewerDataModel.Instance.IsMarkupUpdate = true;
1293 787a4489 KangIngu
                                            }
1294
                                            else
1295
                                            {
1296
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextStyle = FontStyles.Italic;
1297 5ba8f2d5 taeseongkim
                                                ViewerDataModel.Instance.IsMarkupUpdate = true;
1298 787a4489 KangIngu
                                            }
1299
                                        }
1300
                                        break;
1301
                                }
1302
                            }
1303
                        }
1304
                    }
1305
                }
1306
            }
1307
        }
1308
1309
        //강인구 추가
1310
        private void btnUnderLine_Checked(object sender, RoutedEventArgs e)
1311
        {
1312
            if (this.ParentOfType<MainWindow>() != null)
1313
            {
1314
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
1315
                {
1316
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
1317
                    {
1318
                        if (item.GetType().Name == "AdornerFinal")
1319
                        {
1320 4913851c humkyung
                            foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
1321 787a4489 KangIngu
                            {
1322
                                switch (InnerItem.DrawingData.GetType().Name)
1323
                                {
1324
                                    case ("TextControl"):
1325
                                        {
1326
                                            if ((InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).UnderLine == TextDecorations.Underline)
1327
                                            {
1328
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).UnderLine = null;
1329
                                            }
1330
                                            else
1331
                                            {
1332
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).UnderLine = TextDecorations.Underline;
1333
                                            }
1334
                                        }
1335
                                        break;
1336
                                    case ("ArrowTextControl"):
1337
                                        {
1338
                                            if ((InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).UnderLine == TextDecorations.Underline)
1339
                                            {
1340
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).UnderLine = null;
1341
                                            }
1342
                                            else
1343
                                            {
1344
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).UnderLine = TextDecorations.Underline;
1345
                                            }
1346
                                        }
1347
                                        break;
1348
                                }
1349 5ba8f2d5 taeseongkim
1350
                                ViewerDataModel.Instance.IsMarkupUpdate = true;
1351 787a4489 KangIngu
                            }
1352
                        }
1353
                    }
1354
                }
1355
            }
1356
        }
1357 5ce56a3a KangIngu
1358 d4b0c723 KangIngu
        private void comboFontSize_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
1359
        {
1360 be04d12c djkim
            if (string.IsNullOrEmpty(comboFontSize.Value.ToString()))
1361
            {
1362
                comboFontSize.Value = comboFontSize.Minimum;
1363
            }
1364 d4b0c723 KangIngu
            if (this.ParentOfType<MainWindow>() != null)
1365
            {
1366
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
1367
                {
1368
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
1369
                    {
1370
                        if (item.GetType().Name == "AdornerFinal")
1371
                        {
1372 4913851c humkyung
                            foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
1373 d4b0c723 KangIngu
                            {
1374
                                switch (InnerItem.DrawingData.GetType().Name)
1375
                                {
1376
                                    case ("TextControl"):
1377
                                        {
1378
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextSize = int.Parse(comboFontSize.Value.ToString());
1379
                                        }
1380
                                        break;
1381
                                    case ("ArrowTextControl"):
1382
                                        {
1383
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextSize = int.Parse(comboFontSize.Value.ToString());
1384
                                        }
1385
                                        break;
1386
                                }
1387
                            }
1388 c5519c44 taeseongkim
1389
                            ChangeComment(item as Controls.AdornerFinal);
1390 d4b0c723 KangIngu
                        }
1391
                    }
1392
                }
1393
            }
1394 c5519c44 taeseongkim
1395 5822e146 ljiyeon
            KCOM.Properties.Settings.Default.TextSize = (double)comboFontSize.Value;
1396
            Properties.Settings.Default.Save();
1397 d4b0c723 KangIngu
        }
1398
1399 787a4489 KangIngu
        //강인구 추가
1400 4fcb686a taeseongkim
        private void comboFontFamily_SelectionChanged(object sender, SelectionChangedEventArgs e)
1401 787a4489 KangIngu
        {
1402 4fcb686a taeseongkim
            
1403
            if (comboFontFamily.SelectedItem != null && !IsSuspendChange)
1404 787a4489 KangIngu
            {
1405 4fcb686a taeseongkim
                var main = this.ParentOfType<MainWindow>()?.dzMainMenu;
1406 24c5e56c taeseongkim
                var font = comboFontFamily.SelectedItem as Markus.Fonts.MarkusFont;
1407 4fcb686a taeseongkim
                var lstTextCtrl = SelectTextControl();
1408 24c5e56c taeseongkim
1409 4fcb686a taeseongkim
                foreach (var item in lstTextCtrl)
1410 787a4489 KangIngu
                {
1411 4fcb686a taeseongkim
                    if (item is MarkupToPDF.Controls.Text.ArrowTextControl ctrl1)
1412 787a4489 KangIngu
                    {
1413 5ba8f2d5 taeseongkim
                        ViewerDataModel.Instance.IsMarkupUpdate = true;
1414 4fcb686a taeseongkim
                        ctrl1.SetFontFamily(font.FontFamily);
1415
                    }
1416
                    else if (item is MarkupToPDF.Controls.Text.TextControl ctrl2)
1417
                    {
1418 5ba8f2d5 taeseongkim
                        ViewerDataModel.Instance.IsMarkupUpdate = true;
1419 4fcb686a taeseongkim
                        ctrl2.SetFontFamily(font.FontFamily);
1420 787a4489 KangIngu
                    }
1421
                }
1422 c5519c44 taeseongkim
1423 24c5e56c taeseongkim
                KCOM.Properties.Settings.Default.FontFamily = font.FontFamily.FontName();
1424
                Properties.Settings.Default.Save();
1425
            }
1426 787a4489 KangIngu
        }
1427
1428 4fcb686a taeseongkim
        private List<UIElement> SelectTextControl()
1429
        {
1430
            List<UIElement> lstTextCtrl = new List<UIElement>();
1431
1432
            var main = this.ParentOfType<MainWindow>()?.dzMainMenu;
1433
            var font = comboFontFamily.SelectedItem as Markus.Fonts.MarkusFont;
1434
1435
1436
            if (main.SelectLayer.FindChildByType<AdornerFinal>() != null)
1437
            {
1438
                lstTextCtrl.AddRange(main.SelectLayer.FindChildByType<AdornerFinal>().Members.Where(x => x.DrawingData is MarkupToPDF.Controls.Common.ITextControl).Select(x => x.DrawingData));
1439
            }
1440
1441
            lstTextCtrl.AddRange(main.zoomAndPanCanvas.FindAllChildren(x => x is MarkupToPDF.Controls.Common.ITextControl c && (c.IsSelected || c.IsEditingMode == true)).Select(x => (UIElement)x));
1442
1443
            return lstTextCtrl;
1444
        }
1445
1446 c5519c44 taeseongkim
1447 787a4489 KangIngu
        /// <summary>
1448
        /// 텍스트 컨트롤 하일라이트 처리
1449
        /// </summary>
1450
        /// <param name="sender"></param>
1451
        /// <param name="e"></param>
1452
        private void HighlightEvent(object sender, RoutedEventArgs e)
1453
        {
1454
1455
            ViewerDataModel.Instance.checkHighShape = (sender as CheckBox).IsChecked.Value;
1456
            SetHighlightEvent();
1457
            //if ((sender as CheckBox).IsChecked.Value)
1458
            //{
1459
            //    TaskMessage("HighLight가 설정되었습니다", TaskMessageType.Normal);
1460
            //}
1461
            //else
1462
            //{
1463
            //    TaskMessage("HighLight가 해제되었습니다", TaskMessageType.Caption);
1464
            //}
1465
            //if (ViewerDataModel.Instance.SelectedEditor as MarkupToPDF.Controls.Text.TextControl != null)
1466
            //{
1467
            //    MarkupToPDF.Controls.Text.TextControl instance = (ViewerDataModel.Instance.SelectedEditor as MarkupToPDF.Controls.Text.TextControl);
1468
            //    instance.IsHighLight = ViewerDataModel.Instance.checkHighShape;
1469
            //    instance.SetText();
1470
            //}
1471
        }
1472
1473 3026d214 ljiyeon
        //추가페이지 이동 엔터
1474 787a4489 KangIngu
        private void tlcurrentPage_KeyDown(object sender, KeyEventArgs e)
1475
        {
1476
            //강인구 추가 tlcurrentPage을 이상하게 입력할수 있기때문에 Try Catch
1477
            if (e.Key == Key.Enter)
1478
            {
1479
                try
1480
                {
1481
                    var instanceMain = this.ParentOfType<MainWindow>();
1482 baacbc36 송근호
                    var max = instanceMain.dzMainMenu.pageNavigator._thumbnailItems.Max(f => f.PageNumber);
1483
                    if (string.IsNullOrEmpty(tlcurrentPage.Text))
1484
                    {
1485
                        RadWindow.Alert(new DialogParameters
1486
                        {
1487
                            Owner = Application.Current.MainWindow,
1488
                            Theme = new VisualStudio2013Theme(),
1489 eeb0a39c taeseongkim
                            Header = "Info",
1490
                            Content = "Enter the correct page number.",
1491 baacbc36 송근호
                        });
1492
                    }
1493
                    else
1494
                    {
1495
                        if (Convert.ToInt32(tlcurrentPage.Text) > max || Convert.ToInt32(tlcurrentPage.Text) == 0)
1496
                        {
1497
                            RadWindow.Alert(new DialogParameters
1498
                            {
1499
                                Owner = Application.Current.MainWindow,
1500
                                Theme = new VisualStudio2013Theme(),
1501 eeb0a39c taeseongkim
                                Header = "Info",
1502
                                Content = "Enter the correct page number.",
1503 baacbc36 송근호
                            });
1504
                        }
1505
                        else
1506
                        {
1507
                            instanceMain.dzMainMenu.pageNavigator.GotoPage(Convert.ToInt32(tlcurrentPage.Text));
1508
                        }
1509
                    }
1510
                    
1511 787a4489 KangIngu
                }
1512
                catch (Exception)
1513
                {
1514
                    RadWindow.Alert(new DialogParameters
1515
                    {
1516 b9b01f8e ljiyeon
                        Owner = Application.Current.MainWindow,
1517 787a4489 KangIngu
                        Theme = new VisualStudio2013Theme(),
1518 eeb0a39c taeseongkim
                        Header = "Info",
1519
                        Content = "Enter the correct page number.",
1520 787a4489 KangIngu
                    });
1521
                }
1522
                
1523
            }
1524
        }
1525 baacbc36 송근호
        private string previousText;
1526
        private void TlcurrentPage_PreviewTextInput(object sender, TextCompositionEventArgs e)
1527
        {
1528
            System.Text.RegularExpressions.Regex regex = new System.Text.RegularExpressions.Regex("[^0-9]+");
1529
            e.Handled = regex.IsMatch(e.Text);
1530
        }
1531
        private void TlcurrentPage_TextChanged(object sender, TextChangedEventArgs e)
1532
        {
1533
            double num = 0;
1534
            bool success = double.TryParse(((TextBox)sender).Text, out num);
1535
            if (success & num >= 0)
1536
                previousText = ((TextBox)sender).Text;
1537
            else
1538
            {
1539
                if (string.IsNullOrEmpty(((TextBox)sender).Text))
1540
                {
1541
                    ((TextBox)sender).Text = "";
1542
                }
1543
                else
1544
                {
1545
1546
                    ((TextBox)sender).Text = previousText;
1547
                }
1548
            }
1549
        }
1550
1551 3908a575 humkyung
        /// <summary>
1552
        /// 입력한 페이지로 이동한다
1553
        /// </summary>
1554
        /// <param name="sender"></param>
1555
        /// <param name="e"></param>
1556 3026d214 ljiyeon
        private void tlcurrentPage_readonly_KeyDown(object sender, KeyEventArgs e)
1557
        {
1558
            if (e.Key == Key.Enter)
1559
            {
1560
                try
1561
                {
1562
                    var instanceMain = this.ParentOfType<MainWindow>();
1563
                    instanceMain.dzMainMenu.pageNavigator.GotoPage(Convert.ToInt32(tlcurrentPage_readonly.Text));
1564
                }
1565
                catch (Exception)
1566
                {
1567
                    RadWindow.Alert(new DialogParameters
1568
                    {
1569 b9b01f8e ljiyeon
                        Owner = Application.Current.MainWindow,
1570 3026d214 ljiyeon
                        Theme = new VisualStudio2013Theme(),
1571 eeb0a39c taeseongkim
                        Header = "Info",
1572
                        Content = "Enter the correct page number.",
1573 3026d214 ljiyeon
                    });
1574
                }
1575
            }
1576
        }
1577
        
1578 787a4489 KangIngu
        private void PanoramaEvent(object sender, RoutedEventArgs e)
1579
        {
1580
            PanoramaShow();
1581
        }
1582
1583
        public void PanoramaShow()
1584
        {
1585
            Panorama check = new Panorama();
1586
            double screenWidth = System.Windows.SystemParameters.PrimaryScreenWidth;
1587
            double screenHeight = System.Windows.SystemParameters.PrimaryScreenHeight;
1588
            //double windowWidth = this.Width;
1589
            //double windowHeight = this.Height;
1590
1591
            var PanoramaPop = new RadWindow
1592
            {
1593
                //MinWidth = 600,
1594
                //MinHeight = 400,
1595
                //Header = "My Check List",
1596
                Header = "Document No : " + this.ParentOfType<MainWindow>().dzMainMenu._DocItem.DOCUMENT_NO + " / Revision :" + this.ParentOfType<MainWindow>().dzMainMenu._DocItem.REVISION,
1597
                Content = check,
1598
                Owner = this,
1599
                ResizeMode = System.Windows.ResizeMode.CanResizeWithGrip,
1600
                //ResizeMode = System.Windows.ResizeMode.NoResize,
1601
                WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen,
1602
                IsTopmost = false,
1603
                //Left = (screenWidth / 2) - (windowWidth / 2),
1604
                //Top = (screenHeight / 2) - (windowHeight / 2),
1605
                //Left = (screenWidth / 2),
1606
                //Top = (screenHeight / 2),
1607
                Width = screenWidth * 0.4,
1608
                Height = screenHeight * 0.4,
1609
            };
1610
            StyleManager.SetTheme(PanoramaPop, new VisualStudio2013Theme());
1611
            //CheckPop.ShowDialog();
1612 b9b01f8e ljiyeon
            PanoramaPop.Owner = Application.Current.MainWindow;
1613 787a4489 KangIngu
            PanoramaPop.Show();
1614
        }
1615 d4b0c723 KangIngu
1616 787a4489 KangIngu
        private void CheckEvent(object sender, RoutedEventArgs e)
1617
        {
1618
            //창이 떠있을 경우 재 실행 방지
1619
            if (isClosed)
1620
            {
1621
                //토글 및 마우스 상태 초기화
1622
                var toggleList = this.Parent.ChildrenOfType<RadToggleButton>();
1623
                foreach(var togle in toggleList)
1624
                {
1625
                    togle.IsChecked = false;
1626
                }
1627
                this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
1628
1629
                isClosed = false;
1630
1631
                
1632 77922798 송근호
                CheckList check = new CheckList(this.ParentOfType<MainWindow>());
1633 787a4489 KangIngu
1634
                CheckPop = new RadWindow
1635
                {
1636
                    MinWidth = 1200,
1637
                    MinHeight = 500,
1638
                    //Header = "My Check List",
1639
                    Header = "Document No : " + this.ParentOfType<MainWindow>().dzMainMenu._DocItem.DOCUMENT_NO + " / Revision :" + this.ParentOfType<MainWindow>().dzMainMenu._DocItem.REVISION,
1640
                    Content = check,
1641
                    //Owner = this,
1642
                    //ResizeMode = System.Windows.ResizeMode.CanResizeWithGrip,
1643
                    ResizeMode = System.Windows.ResizeMode.NoResize,
1644
                    WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen,
1645
                    IsTopmost = true,
1646
                };
1647
                StyleManager.SetTheme(CheckPop, new Office2013Theme());
1648
                CheckPop.Closed += CheckPop_Closed;
1649 29010418 ljiyeon
                
1650 787a4489 KangIngu
                //CheckPop.ShowDialog();
1651
                CheckPop.Show();
1652
            }
1653
        }
1654
1655 cf1cc862 taeseongkim
        private void SignManagerEvent(object sender,RoutedEventArgs e)
1656
        {
1657
            SignManager signManager = new SignManager();
1658
1659 74abcf6f taeseongkim
            RadWindow signManagerPop = new RadWindow
1660 cf1cc862 taeseongkim
            {
1661
                MinWidth = 1200,
1662
                MinHeight = 500,
1663
                //Header = "My Check List",
1664
                Header = "",
1665
                Content = signManager,
1666
                Owner = this,
1667
                //ResizeMode = System.Windows.ResizeMode.CanResizeWithGrip,
1668
                ResizeMode = System.Windows.ResizeMode.CanResize,
1669
                WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen,
1670
            };
1671 74abcf6f taeseongkim
            StyleManager.SetTheme(signManagerPop, new Office2013Theme());
1672 cf1cc862 taeseongkim
1673
            //CheckPop.ShowDialog();
1674 74abcf6f taeseongkim
            signManagerPop.ShowDialog();
1675 cf1cc862 taeseongkim
        }
1676
1677 53880c83 ljiyeon
        private void OptionPop_Closed(object sender, WindowClosedEventArgs e)
1678
        {
1679
            isClosed = true;
1680
            //this.ParentOfType<MainWindow>().dzMainMenu.PN_Navi.IsEnabled = true;
1681
            this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
1682
            ViewerDataModel.Instance.Capture_Opacity = 0;
1683
        }
1684
1685 787a4489 KangIngu
        private void CheckPop_Closed(object sender, WindowClosedEventArgs e)
1686
        {
1687
            isClosed = true;
1688
            //this.ParentOfType<MainWindow>().dzMainMenu.PN_Navi.IsEnabled = true;
1689
            this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
1690
            ViewerDataModel.Instance.Capture_Opacity = 0;
1691
        }
1692
1693 64f6713a humkyung
        /// <summary>
1694
        /// 사용자가 선택한 페이지로 이동(썸네일 동기화 시킴)
1695
        /// </summary>
1696
        /// <param name="sender"></param>
1697
        /// <param name="e"></param>
1698 787a4489 KangIngu
        private void PageGoEvent(object sender, RoutedEventArgs e)
1699
        {
1700
            RadButton button = sender as RadButton;
1701
            var instanceMain = this.ParentOfType<MainWindow>();
1702
            
1703
            //강인구 추가 tlcurrentPage을 이상하게 입력할수 있기때문에 Try Catch
1704
            try
1705
            {
1706
                switch (button.CommandParameter.ToString())
1707
                {
1708
                    case "Down":
1709
                        {
1710
                            instanceMain.dzMainMenu.pageNavigator.GotoPage(Convert.ToInt32(tlcurrentPage.Text) + 1);
1711
                        }
1712
                        break;
1713
                    case "Up":
1714
                        {
1715
                            instanceMain.dzMainMenu.pageNavigator.GotoPage(Convert.ToInt32(tlcurrentPage.Text) - 1);
1716
                        }
1717
                        break;
1718
                }
1719
            }
1720
            catch (Exception)
1721
            {
1722
                RadWindow.Alert(new DialogParameters
1723
                {
1724 b9b01f8e ljiyeon
                    Owner = Application.Current.MainWindow,
1725 787a4489 KangIngu
                    Theme = new VisualStudio2013Theme(),
1726 eeb0a39c taeseongkim
                    Header = "Info",
1727
                    Content = "Enter the correct page number.",
1728 787a4489 KangIngu
                });
1729
            }
1730
        }
1731
1732
        private void viewEvent(object sender, RoutedEventArgs e)
1733
        {
1734 9f473fb7 KangIngu
            RadRibbonToggleButton viewButton = sender as RadRibbonToggleButton;
1735 787a4489 KangIngu
            var instanceMain = this.ParentOfType<MainWindow>();
1736
1737
            Point point = new Point(instanceMain.dzMainMenu.zoomAndPanCanvas.Width / 2, instanceMain.dzMainMenu.zoomAndPanCanvas.Height / 2);
1738
1739 9f473fb7 KangIngu
            //if ((sender as RadRibbonToggleButton) != null)
1740
            //{
1741
            //    Common.ViewerDataModel.Instance.ControlTag = (sender as RadRibbonToggleButton).Tag.ToString();
1742
            //    instanceToggle = (sender as RadRibbonToggleButton);
1743
            //}
1744
1745
            //instanceToggle.IsChecked = false;
1746
1747 787a4489 KangIngu
            switch (viewButton.CommandParameter.ToString())
1748
            {
1749
                case "zoomout":
1750
                    {
1751
                        //장원
1752
                        //instanceMain.dzMainMenu.zoomAndPanControl.ZoomTo(new Rect(0, 0, instanceMain.dzMainMenu.zoomAndPanCanvas.ActualWidth, instanceMain.dzMainMenu.zoomAndPanCanvas.ActualHeight));
1753
                        instanceMain.dzMainMenu.zoomAndPanControl.ZoomPointToViewportCenter(ViewerDataModel.Instance.ContentScale -= 0.1, point);
1754 9f473fb7 KangIngu
                        viewButton.IsChecked = false;
1755 787a4489 KangIngu
                        //Common.ViewerDataModel.Instance.zom
1756
                    }
1757
                    break;
1758
                case "zoomin":
1759
                    {
1760
                        instanceMain.dzMainMenu.zoomAndPanControl.ZoomPointToViewportCenter(ViewerDataModel.Instance.ContentScale += 0.1, point);
1761 9f473fb7 KangIngu
                        viewButton.IsChecked = false;
1762 787a4489 KangIngu
                    }
1763
                    break;
1764
                case "fullscreen":
1765
                    {
1766
                        instanceMain.WindowState = WindowState.Maximized;
1767
                        //Sizemode 대기(강인구)
1768
                        //instanceMain.dzMainMenu.imageViewer.SizeMode = Leadtools.Windows.Controls.SizeMode.Fit;
1769
                        instanceMain.dzMainMenu.zoomAndPanControl.ScaleToFit();
1770 9f473fb7 KangIngu
                        viewButton.IsChecked = false;
1771 787a4489 KangIngu
                    }
1772
                    break;
1773
                case "fitWidth":
1774
                    {
1775
                        instanceMain.dzMainMenu.zoomAndPanControl.ScaleToFit();
1776 9f473fb7 KangIngu
                        viewButton.IsChecked = false;
1777 787a4489 KangIngu
                    }
1778
                    break;
1779
                case "fitHeight":
1780
                    {
1781
                        instanceMain.dzMainMenu.zoomAndPanControl.ScaleToFit();
1782 9f473fb7 KangIngu
                        viewButton.IsChecked = false;
1783 787a4489 KangIngu
                    }
1784
                    break;
1785
                case "boundzoom":
1786
                    {
1787 9f473fb7 KangIngu
1788 787a4489 KangIngu
                    }
1789
                    break;
1790
                case "Rotate_M":
1791
                    {
1792
                        drawingPannelRotate(false);
1793 9f473fb7 KangIngu
                        viewButton.IsChecked = false;
1794 787a4489 KangIngu
                    }
1795
                    break;
1796
                case "Rotate_P":
1797
                    {
1798
                        drawingPannelRotate(true);
1799 9f473fb7 KangIngu
                        viewButton.IsChecked = false;
1800 787a4489 KangIngu
                    }
1801
                    break;
1802
                case "Rotate_half":
1803
                    {
1804
                        drawingPannelRotate(true);
1805
                        drawingPannelRotate(true);
1806 9f473fb7 KangIngu
                        viewButton.IsChecked = false;
1807 787a4489 KangIngu
                    }
1808
                    break;
1809
            }
1810
        }
1811
1812 d4b0c723 KangIngu
        private void Control_Event(object sender, RoutedEventArgs e)
1813
        {
1814
1815
        }
1816
1817 787a4489 KangIngu
        #region 대기
1818
1819
        public void drawingPannelRotate(bool Flag)
1820
        {
1821
            var instanceMain = this.ParentOfType<MainWindow>();
1822
1823
            //if (rotateOffSet > 3)
1824
            //    rotateOffSet = 0;
1825
1826
            //if (rotateOffSet < 0)
1827
            //    rotateOffSet = 3;
1828
1829
            if(Flag)
1830
            {
1831
                if (instanceMain.dzMainMenu.rotate.Angle == 270)
1832
                {
1833
                    instanceMain.dzMainMenu.rotate.Angle = 0;
1834
                }
1835
                else
1836
                {
1837
                    instanceMain.dzMainMenu.rotate.Angle += 90;
1838
                }
1839
            }
1840
            else
1841
            {
1842
                if(instanceMain.dzMainMenu.rotate.Angle == 0)
1843
                {
1844
                    instanceMain.dzMainMenu.rotate.Angle = 270;
1845
                }
1846
                else
1847
                {
1848
                    instanceMain.dzMainMenu.rotate.Angle -= 90;
1849
                }
1850
            }
1851
            //double angle = (double)rotateValue.GetValue(rotateOffSet);
1852
            //instanceMain.dzMainMenu.rotate.Angle = angle;
1853
            var rotationNum = Math.Abs((instanceMain.dzMainMenu.rotate.Angle / 90));
1854
1855
            if (instanceMain.dzMainMenu.zoomAndPanCanvas.Width == ViewerDataModel.Instance.ContentWidth)
1856
            {
1857
                double emptySize = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
1858
                instanceMain.dzMainMenu.zoomAndPanCanvas.Width = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
1859
                instanceMain.dzMainMenu.zoomAndPanCanvas.Height = emptySize;
1860
            }
1861
            if (instanceMain.dzMainMenu.rotate.Angle == 0)
1862
            {
1863
                instanceMain.dzMainMenu.translate.X = 0;
1864
                instanceMain.dzMainMenu.translate.Y = 0;
1865
            }
1866
            else if (instanceMain.dzMainMenu.rotate.Angle == 90)
1867
            {
1868
                instanceMain.dzMainMenu.translate.X = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
1869
                instanceMain.dzMainMenu.translate.Y = 0;
1870
            }
1871
            else if (instanceMain.dzMainMenu.rotate.Angle == 180)
1872
            {
1873
                instanceMain.dzMainMenu.translate.X = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
1874
                instanceMain.dzMainMenu.translate.Y = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
1875
            }
1876
            else
1877
            {
1878
                instanceMain.dzMainMenu.translate.X = 0;
1879
                instanceMain.dzMainMenu.translate.Y = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
1880
            }
1881
1882
            //instanceMain.dzMainMenu.zoomAndPanControl.RenderTransformOrigin = new Point(0.5, 0.5);
1883
            instanceMain.dzMainMenu.zoomAndPanControl.RotationAngle = instanceMain.dzMainMenu.rotate.Angle;
1884
            //대기(강인구)
1885
            //instanceMain.dzMainMenu.imageViewer.RotateAngle = instanceMain.dzMainMenu.rotate.Angle;
1886
1887
1888
            //instanceMain.dzMainMenu.imageViewer.RenderTransformOrigin = new Point(0.5, 0.5);
1889
            //RotateTransform rotateTransform = new RotateTransform(instanceMain.dzMainMenu.rotate.Angle);
1890
            //instanceMain.dzMainMenu.imageViewer.RenderTransform = rotateTransform;
1891
1892
1893
            ViewerDataModel.Instance.ContentWidth = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
1894
            ViewerDataModel.Instance.ContentHeight = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
1895
            ViewerDataModel.Instance.AngleOffsetX = instanceMain.dzMainMenu.translate.X;
1896
            ViewerDataModel.Instance.AngleOffsetY = instanceMain.dzMainMenu.translate.Y;
1897 4f017ed3 taeseongkim
            ViewerDataModel.Instance.PageAngle = instanceMain.dzMainMenu.rotate.Angle;
1898 787a4489 KangIngu
            //ViewerDataModel.Instance.Document_Info.Clear();
1899
            //ViewerDataModel.Instance.Document_Info.Where(i => i.PAGE_NUMBER == instanceMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber).ToList().ForEach(value =>
1900
            //{
1901
            //    value.PAGE_ANGLE = int.Parse(instanceMain.dzMainMenu.rotate.Angle.ToString());
1902
            //});
1903
1904
1905
            //이미지 각도 변경 시 실시간 Thumbnail 각도 변경(강인구 추가)
1906 6c687be8 taeseongkim
            var thumbnaillist = instanceMain.dzMainMenu.pageNavigator._thumbnailItems.Where(info => info.PageNumber == instanceMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber);
1907
1908
            foreach (var data in thumbnaillist)
1909 787a4489 KangIngu
            {
1910
                data.Angle = int.Parse(instanceMain.dzMainMenu.rotate.Angle.ToString());
1911
1912 6c687be8 taeseongkim
                //instanceMain.dzMainMenu.pageNavigator.ImgListbox.ItemsSource = instanceMain.dzMainMenu.pageNavigator._thumbnailItems;
1913 787a4489 KangIngu
                var instance = instanceMain.dzMainMenu.CurrentDoc.docInfo.DOCPAGE.Where(p => p.PAGE_NUMBER == instanceMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber).FirstOrDefault();
1914
                instance.PAGE_ANGLE = int.Parse(instanceMain.dzMainMenu.rotate.Angle.ToString());
1915
1916 3908a575 humkyung
                instanceMain.dzMainMenu.pageNavigator.GotoPage(data.PageNumber);
1917 2b19f5f2 djkim
1918
                //rotation page add or update
1919
                var rotationdoc = ViewerDataModel.Instance.RotationDocs.Where(d => d.ID == instance.ID).FirstOrDefault();
1920
                if (rotationdoc != null)
1921
                {
1922
                    rotationdoc.PAGE_ANGLE = instance.PAGE_ANGLE;
1923
                }
1924
                else
1925
                {
1926
                    ViewerDataModel.Instance.RotationDocs.Add(instance);
1927
                }
1928 6c687be8 taeseongkim
            }
1929 787a4489 KangIngu
        }
1930
        #endregion
1931
1932 83d916a3 ljiyeon
        private void ImageConverter(RadToggleButton instanceToggle)
1933 787a4489 KangIngu
        {
1934 83d916a3 ljiyeon
            try
1935
            {           
1936
                var instanceMain = this.ParentOfType<MainWindow>();
1937
1938
                Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
1939
                dlg.Filter = "All files (*.*)|*.*|PNG Images (*.png)|*.png";
1940
                Nullable<bool> result = dlg.ShowDialog();
1941
                if (result == true)
1942
                {
1943
                    instanceMain.dzMainMenu.filename = dlg.FileName;
1944
                    instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ImgControl;
1945 787a4489 KangIngu
1946 83d916a3 ljiyeon
                    System.IO.FileInfo fileInfo = new System.IO.FileInfo(instanceMain.dzMainMenu.filename);
1947
                    String strFile = System.IO.Path.GetFileName(instanceMain.dzMainMenu.filename);
1948
                    long numByte = fileInfo.Length;
1949
                    double dLen = Convert.ToDouble(fileInfo.Length / 1000000);
1950 76dc223b taeseongkim
                    kr.co.devdoftech.cloud.FileUpload fileUploader = App.FileUploader;
1951
             
1952 83d916a3 ljiyeon
                    if (dLen < 4)
1953
                    {
1954
                        System.IO.FileStream fStream = new System.IO.FileStream(instanceMain.dzMainMenu.filename, System.IO.FileMode.Open, System.IO.FileAccess.Read);
1955
                        System.IO.BinaryReader br = new System.IO.BinaryReader(fStream);
1956
                        byte[] data = br.ReadBytes((int)numByte);
1957
                        br.Close();
1958
1959
                        string filepath = fileUploader.Run(App.ViewInfo.ProjectNO, instanceMain.dzMainMenu._DocItem.DOCUMENT_NO, App.ViewInfo.UserID, strFile, data);
1960 c73426a9 ljiyeon
1961
                        Check_Uri.UriCheck(filepath);
1962
1963 83d916a3 ljiyeon
                        instanceMain.dzMainMenu.filename = filepath;
1964 787a4489 KangIngu
1965 83d916a3 ljiyeon
                        fStream.Close();
1966
                        fStream.Dispose();
1967
                    }
1968
                    else
1969
                    {
1970
                        this.ParentOfType<MainWindow>().DialogMessage_Alert("Available Memory less than 4 mega byte", "Alert");
1971
                    }
1972 787a4489 KangIngu
                }
1973 08af623d ljiyeon
                else
1974
                {
1975
                    instanceToggle.IsChecked = false;
1976
                    Common.ViewerDataModel.Instance.SelectedControl = "";
1977
                    Common.ViewerDataModel.Instance.ControlTag = null;
1978
                    this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
1979
                    this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
1980 4c1692a1 ljiyeon
                    this.ParentOfType<MainWindow>().DialogMessage_Alert("No Image selected.", "Alert");
1981 08af623d ljiyeon
                }
1982 787a4489 KangIngu
            }
1983 83d916a3 ljiyeon
            catch(Exception ex)
1984
            {
1985
                instanceToggle.IsChecked = false;
1986
                Common.ViewerDataModel.Instance.SelectedControl = "";
1987
                Common.ViewerDataModel.Instance.ControlTag = null;
1988
                this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
1989
                this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
1990 76dc223b taeseongkim
                App.FileLogger.Error("Image Converter ",ex);
1991
1992
                this.ParentOfType<MainWindow>().DialogMessage_Alert("System Error" , "Alert");
1993 83d916a3 ljiyeon
            }
1994 787a4489 KangIngu
        }
1995
1996 d4b0c723 KangIngu
        private void Control_Init(RadToggleButton instanceToggle, object sender)
1997
        {
1998
1999
        }
2000
2001 787a4489 KangIngu
        private void ControlEvent(object sender, RoutedEventArgs e)
2002
        {
2003
            RadToggleButton instanceToggle = sender as RadToggleButton;
2004
            var instanceMain = this.ParentOfType<MainWindow>();
2005
2006
            #region Ctrl + A 눌렀을 때 대처 방법 
2007
            //원인 : Ctrl + A를 누르면 UIElementSet에 등록을 시키지 않는다(이유는 한꺼번에 많은 양의 컨트롤의 동작이 유입되기 때문에
2008
            //       시스템의 성능저하를 불러올 수 있기 때문이다. 그래서 선택 후 다른 컨트롤을 누르면 등록되지 않은 컨트롤이기 때문에 삭제된다
2009
            //       이를 대처하는 방법으로 아래 코드를 사용한다.
2010
            if (Common.ViewerDataModel.Instance.MarkupControls.Count == 0 && Common.ViewerDataModel.Instance.MarkupControls.Count >= 1)
2011
            {
2012
                //var lstItem = instanceMain.DeepLayer._SelectLayer.ChildrenOfType<AdornerFinal>().ToList();
2013
                //foreach (var item in lstItem)
2014
                //{
2015
                //    foreach (var member in item.MemberSet)
2016
                //    {
2017
                //        if (!instanceMain.DeepLayer.UIElementSet.Contains(member.DrawingData))
2018
                //        {
2019
                //            instanceMain.DeepLayer.UIElementSet.Add(member.DrawingData);
2020
                //        }
2021
                //    }
2022
                //}
2023
            }
2024
            #endregion
2025
2026
            //if (!instanceMain.IsFreeSelectionMode)
2027
            //{
2028
            //    instanceMain.IsSwingMode = true;
2029
            //}
2030
2031 b643fcca taeseongkim
            //#region 다른 컨트롤 버튼 선택 해제
2032
            //System.Reactive.Linq.Observable2.FromPropertyChangedPattern(Common.ViewerDataModel.Instance, temp => temp.SelectedControl).Subscribe(ControlState =>
2033
            //{
2034
            //    if (ControlState == null)
2035
            //    {
2036
            //        instanceToggle.IsChecked = false;
2037
            //        HiddenControlHide();
2038
            //    }
2039
            //});
2040
            //#endregion
2041 d4b0c723 KangIngu
2042 787a4489 KangIngu
            Release_ToggleButton(sender); //-> 해당 컨트롤을 제외한 모든 컨트롤에 대해 해제 처리
2043 d4b0c723 KangIngu
2044 787a4489 KangIngu
            if (instanceToggle != null)
2045
            {
2046
                Common.ViewerDataModel.Instance.ControlTag = instanceToggle.Tag.ToString();
2047
            }
2048
            else if ((sender as RadRibbonToggleButton) != null)
2049
            {
2050
                Common.ViewerDataModel.Instance.ControlTag = (sender as RadRibbonToggleButton).Tag.ToString();
2051
                instanceToggle = (sender as RadRibbonToggleButton);
2052
            }
2053
            else if ((sender as RadRibbonButton) != null)
2054
            {
2055
                RadRibbonButton instanceButton = sender as RadRibbonButton;
2056
                Common.ViewerDataModel.Instance.ControlTag = instanceButton.Tag.ToString();
2057
            }
2058
            else
2059
            {
2060
                RadButton instanceButton = sender as RadButton;
2061
                Common.ViewerDataModel.Instance.ControlTag = instanceButton.Tag.ToString();
2062
            }
2063
2064
2065 b643fcca taeseongkim
            //System.Reactive.Linq.Observable2.FromPropertyChangedPattern(Common.ViewerDataModel.Instance, temp => temp.AngleVisibility).Subscribe(isSee =>
2066
            //{
2067
            //    if (instanceToggle.CommandParameter.ToString() == "ChainLine")
2068
            //    {
2069 6b6e937c taeseongkim
2070 b643fcca taeseongkim
            //    }
2071
            //    else
2072
            //    {
2073
            //        System.Diagnostics.Debug.WriteLine(" instanceMain.dzMainMenu.MainAngle.Visibility   " + isSee);
2074
2075
            //        if (instanceMain.dzMainMenu.MainAngle.Visibility != isSee)
2076
            //        {
2077
            //            instanceMain.dzMainMenu.MainAngle.Visibility = isSee;
2078
            //        }
2079
            //    }
2080
            //    //System.Reactive.Linq.Observable2.FromPropertyChangedPattern(Common.ViewerDataModel.Instance, temp => temp.AngleValue).Subscribe(p =>
2081
            //    //{
2082
            //    //    instanceMain.dzMainMenu.MainAngle.AngleValue = p;
2083
            //    //});
2084
            //});
2085 6b6e937c taeseongkim
2086 787a4489 KangIngu
            instanceMain.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Drawing;
2087
2088
            instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = false;
2089
2090
            if (instanceToggle.IsChecked != false)
2091
            {
2092 b74a9c91 taeseongkim
                string param = instanceToggle.CommandParameter.ToString();
2093
                string MacroIndex = "";
2094
2095
                if (param.StartsWith("MACRO"))
2096
                {
2097
                    param = "MACRO";
2098
                    MacroIndex = param.Replace("MACRO;","");
2099
2100
                    //Common.ViewerDataModel.Instance.MacroItems = MacroHelper.LoadMacroItems(MacroIndex);
2101
                    //var items = MacroHelper.TopMenuItems();
2102
2103
                    Common.ViewerDataModel.Instance.MacroItems = new List<MacroItem>
2104
                    {
2105
                        new MacroItem
2106
                        {
2107
                            Desc = "Cloud Rectangle",
2108
                            ControlType = MarkupToPDF.Controls.Common.ControlType.RectCloud
2109
                        },
2110
                        new MacroItem
2111
                        {
2112
                             Desc = "Arrow TextBox",
2113
                            ControlType = MarkupToPDF.Controls.Common.ControlType.ArrowTextBorderControl
2114
                        }
2115
                    };
2116
                }
2117
2118 787a4489 KangIngu
                #region 컨트롤이 체크되었다면
2119 b74a9c91 taeseongkim
                switch (param)
2120 787a4489 KangIngu
                {
2121
                    #region Line
2122
                    case "Line":
2123
                        Common.ViewerDataModel.Instance.SelectedControl = "Line";
2124
                        //HiddenAxisLock.Visibility = Visibility.Visible;
2125
                        if (instanceToggle.Tag.ToString() == "LineDelete")
2126
                        {
2127
                            //HiddenInterval.Visibility = Visibility.Visible;
2128
                        }
2129
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.SingleLine;
2130
                        break;
2131
                    #endregion
2132
                    #region ChainLine
2133
                    case "ChainLine":
2134
                        Common.ViewerDataModel.Instance.SelectedControl = "ChainLine";
2135
                        //HiddenAxisLock.Visibility = Visibility.Visible;
2136
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ChainLine;
2137
                        break;
2138
                    #endregion
2139
                    #region DimLine
2140
                    case "DimLine":
2141
                        Common.ViewerDataModel.Instance.SelectedControl = "DimLine";
2142
                        //HiddenAxisLock.Visibility = Visibility.Visible;
2143
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.DimLine;
2144
                        break;
2145
                    #endregion
2146
                    #region TwinLine
2147
                    case "TwinLine":
2148
                        Common.ViewerDataModel.Instance.SelectedControl = "TwinLine";
2149
                        //HiddenAxisLock.Visibility = Visibility.Visible;
2150
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.TwinLine;
2151
                        break;
2152
                    #endregion
2153
                    #region CancelLine
2154
                    case "CancelLine":
2155
                        Common.ViewerDataModel.Instance.SelectedControl = "CancelLine";
2156
                        //HiddenAxisLock.Visibility = Visibility.Visible;
2157
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.CancelLine;
2158
                        break;
2159
                    #endregion
2160
                    #region PolygonCloud
2161
                    case "PolygonCloud":
2162
                        Common.ViewerDataModel.Instance.SelectedControl = "PolygonCloud";
2163
                        //HiddenAxisLock.Visibility = Visibility.Visible;
2164
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.PolygonCloud;
2165
                        break;
2166
                    #endregion
2167
                    #region RectCloud
2168
                    case "RectCloud":
2169
                        Common.ViewerDataModel.Instance.SelectedControl = "RectCloud";
2170
                        //HiddenAxisLock.Visibility = Visibility.Visible;
2171
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.RectCloud;
2172
                        break;
2173
                    #endregion
2174 4318fdeb KangIngu
                    #region Rectangle
2175 787a4489 KangIngu
                    case "Rectangle":
2176
                        Common.ViewerDataModel.Instance.SelectedControl = "Rectangle";
2177
                        //HiddenAxisLock.Visibility = Visibility.Visible;
2178
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Rectangle;
2179
                        break;
2180
                    #endregion
2181 4318fdeb KangIngu
                    #region Triangle
2182 787a4489 KangIngu
                    case "Triangle":
2183
                        Common.ViewerDataModel.Instance.SelectedControl = "Triangle";
2184
                        //HiddenAxisLock.Visibility = Visibility.Visible;
2185
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Triangle;
2186
                        break;
2187
                    #endregion
2188
                    #region RectCloud
2189
                    case "Circle":
2190
                        Common.ViewerDataModel.Instance.SelectedControl = "Circle";
2191
                        //HiddenAxisLock.Visibility = Visibility.Visible;
2192
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Circle;
2193
                        break;
2194
                    #endregion
2195
                    #region Symbol
2196
                    case "Symbol":
2197
                        Common.ViewerDataModel.Instance.SelectedControl = "Symbol";
2198
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2199
                        break;
2200
                    #endregion
2201
                    #region SymbolN
2202
                    case "SymbolN":
2203
                        Common.ViewerDataModel.Instance.SelectedControl = "SymbolN";
2204
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Stamp;
2205
                        break;
2206
                    #endregion
2207
                    #region Text
2208
                    case "Text":
2209
                        Common.ViewerDataModel.Instance.SelectedControl = "Text";
2210
                        TaskMessage("Text 도구는 텍스트 영역을 더블 클릭하여 텍스트를 재 편집 할 수 있습니다", TaskMessageType.Normal);
2211
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.TextControl;
2212
                        break;
2213
                    #endregion
2214
                    #region TextBorder
2215
                    case "TextBorder":
2216
                        Common.ViewerDataModel.Instance.SelectedControl = "TextBorder";
2217
                        TaskMessage("Text 도구는 텍스트 영역을 더블 클릭하여 텍스트를 재 편집 할 수 있습니다", TaskMessageType.Normal);
2218
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.TextBorder;
2219
                        break;
2220
                    #endregion
2221
                    #region TextCloud
2222
                    case "TextCloud":
2223
                        Common.ViewerDataModel.Instance.SelectedControl = "TextCloud";
2224
                        TaskMessage("Text 도구는 텍스트 영역을 더블 클릭하여 텍스트를 재 편집 할 수 있습니다", TaskMessageType.Normal);
2225
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.TextCloud;
2226
                        break;
2227
                    #endregion
2228
                    #region Date
2229
                    case "Date":
2230
                        Common.ViewerDataModel.Instance.SelectedControl = "Date";
2231
                        TaskMessage("날짜 컨트롤을 더블 클릭하면 날짜를 변경할 수 있습니다", TaskMessageType.Normal);
2232
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Date;
2233
                        break;
2234
                    #endregion
2235
                    #region ArrowText
2236
                    case "ArrowText":
2237
                        TaskMessage("ArrowText 컨트롤은 그린 후 컨트롤을 선택하였을 시 중간점을 조정할 수 있습니다", TaskMessageType.Normal);
2238
                        if (instanceToggle.Tag.ToString() == "ArrowText_Cloud")
2239
                        {
2240
                            Common.ViewerDataModel.Instance.SelectedControl = "ArrowText_Cloud";
2241
                            instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowTextCloudControl;
2242
                        }
2243
                        else if (instanceToggle.Tag.ToString() == "ArrowText_Border")
2244
                        {
2245
                            Common.ViewerDataModel.Instance.SelectedControl = "ArrowTextBorderControl";
2246
                            instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowTextBorderControl;
2247
                        }
2248
                        else if (instanceToggle.Tag.ToString() == "ArrowTextFix_Normal")
2249
                        {
2250
                            Common.ViewerDataModel.Instance.SelectedControl = "ArrowTransTextControl";
2251
                            instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowTransTextControl;
2252
                        }
2253
                        else if (instanceToggle.Tag.ToString() == "ArrowTextFix_Border")
2254
                        {
2255
                            Common.ViewerDataModel.Instance.SelectedControl = "ArrowTransTextBorderControl";
2256
                            instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowTransTextBorderControl;
2257
                        }
2258
                        else if (instanceToggle.Tag.ToString() == "ArrowTextFix_Cloud")
2259
                        {
2260
                            Common.ViewerDataModel.Instance.SelectedControl = "ArrowTransTextCloudControl";
2261
                            instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowTransTextCloudControl;
2262
                        }
2263
                        else
2264
                        {
2265
                            Common.ViewerDataModel.Instance.SelectedControl = "ArrowText";
2266
                            instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowTextControl;
2267
                            //HiddenAxisLock.Visibility = Visibility.Visible;
2268
                        }
2269
                        break;
2270
                    #endregion
2271
                    #region Arrow
2272
                    case "Arrow":
2273
                        Common.ViewerDataModel.Instance.SelectedControl = "Arrow";
2274
                        //HiddenAxisLock.Visibility = Visibility.Visible;
2275
                        //HiddenDimSize.Visibility = Visibility.Visible;
2276
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowLine;
2277
                        break;
2278
                    #endregion
2279
                    #region Shape
2280
                    case "Shape":
2281
                        Common.ViewerDataModel.Instance.SelectedControl = "Shape";
2282
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Mark;
2283
                        break;
2284
                    #endregion
2285
                    #region Polygon
2286
                    case "Polygon":
2287
                        Common.ViewerDataModel.Instance.SelectedControl = "Polygon";
2288
                        TaskMessage("자유형 코멘트 도구는 오른쪽 마우스 클릭을 통해 그리기를 마칠 수 있습니다", TaskMessageType.Normal);
2289
                        //HiddenAxisLock.Visibility = Visibility.Visible;
2290
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.PolygonControl;
2291
                        break;
2292
                    #endregion
2293
                    #region Arc
2294
                    case "Arc":
2295
                        Common.ViewerDataModel.Instance.SelectedControl = "Arc";
2296
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArcLine;
2297
                        //HiddenAxisLock.Visibility = Visibility.Visible;
2298
                        TaskMessage("Arc 코멘트 도구는 오른쪽 마우스를 사용해 좌우 반전을 사용하실 수 있습니다", TaskMessageType.Normal);
2299
                        break;
2300
                    #endregion
2301 40b3ce25 ljiyeon
                    #region ArrowArc
2302
                    case "ArrowArc":
2303
                        Common.ViewerDataModel.Instance.SelectedControl = "ArrowArc";
2304
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArcArrow;
2305
                        //HiddenAxisLock.Visibility = Visibility.Visible;
2306
                        TaskMessage("ArcArrow 코멘트 도구는 오른쪽 마우스를 사용해 좌우 반전을 사용하실 수 있습니다", TaskMessageType.Normal);
2307
                        break;
2308
                    #endregion
2309 787a4489 KangIngu
                    #region ArrowMulti
2310
                    case "ArrowMulti":
2311
                        Common.ViewerDataModel.Instance.SelectedControl = "ArrowMulti";
2312
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowMultiLine;
2313
                        //HiddenAxisLock.Visibility = Visibility.Visible;
2314
                        break;
2315
                    #endregion
2316
                    #region Etc
2317
                    case "Etc":
2318
                        Common.ViewerDataModel.Instance.SelectedControl = "Etc";
2319
                        break;
2320
                    #endregion
2321
                    #region Ink
2322
                    case "Ink":
2323
                        if (instanceToggle.Tag.ToString() == "EraserClear")
2324
                        {
2325
                            TaskMessage("해당 컨트롤은 점 단위로 그려진 펜을 지웁니다", TaskMessageType.Normal);
2326
                            //instanceMain.dzMainMenu.inkDrawingCanvas.EditingMode = InkCanvasEditingMode.EraseByPoint;
2327
                            instanceMain.dzMainMenu.inkBoard.Tag = "EraseByPoint";
2328
                        }
2329
                        else if (instanceToggle.Tag.ToString() == "Eraser")
2330
                        {
2331
                            TaskMessage("해당 컨트롤은 선 단위로 그려진 펜을 지웁니다", TaskMessageType.Normal);
2332
                            instanceMain.dzMainMenu.inkBoard.Tag = "EraseByStroke";
2333
                            //instanceMain.dzMainMenu.inkDrawingCanvas.EditingMode = InkCanvasEditingMode.EraseByStroke;
2334
                        }
2335
                        else
2336
                        {
2337
                            instanceMain.dzMainMenu.inkBoard.Tag = "Ink";
2338
                            //instanceMain.dzMainMenu.inkDrawingCanvas.EditingMode = InkCanvasEditingMode.Ink;
2339
                        }
2340
2341
                        //instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = true;
2342
2343
                        Common.ViewerDataModel.Instance.SelectedControl = "Ink";
2344
                        Common.ViewerDataModel.Instance.LineSize = (double)cbLineSize.Value;
2345
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.PenControl;
2346
                        break;
2347
                    #endregion
2348
                    #region Select
2349
                    case "Select":
2350 65246dc9 KangIngu
                        if(this.ParentOfType<MainWindow>().dzMainMenu.currentControl != null)
2351
                        {
2352
                            ViewerDataModel.Instance.MarkupControls_USER.Remove(this.ParentOfType<MainWindow>().dzMainMenu.currentControl);
2353
                            this.ParentOfType<MainWindow>().dzMainMenu.currentControl = null;
2354
                        }
2355 787a4489 KangIngu
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Selecting;
2356
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2357 9f473fb7 KangIngu
                        instanceMain.dzMainMenu.isLeftMouseButtonDownOnWindow = false;
2358 787a4489 KangIngu
                        break;
2359
                    #endregion
2360
                    #region Image
2361
                    case "Image":
2362
                        Common.ViewerDataModel.Instance.SelectedControl = "ImgControl";
2363
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ImgControl;
2364 83d916a3 ljiyeon
                        ImageConverter(instanceToggle);
2365 787a4489 KangIngu
                        break;
2366
                    #endregion
2367
                    #region Sign
2368
                    case "Sign":
2369
                        Common.ViewerDataModel.Instance.SelectedControl = "Sign";
2370
                        Common.ViewerDataModel.Instance.ControlTag = instanceMain.dzMainMenu._ViewInfo.UserID; //사번
2371
                        //강인구 추가
2372
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Sign;
2373
                        //instanceMain.BaseClient.GetUserSignCompleted += (sen, ea) =>
2374
                        //{
2375
                        //    if (ea.Result == null)
2376
                        //    {
2377
2378
                        //        this.ParentOfType<MainPage>().DialogMessage_Alert("You Don't Have Sign Data", "Alert");
2379
                        //    }
2380
                        //    else
2381
                        //    {
2382
                        //        byte[] imageBytes = System.Convert.FromBase64String(ea.Result);
2383
                        //        using (MemoryStream ms = new MemoryStream(imageBytes))
2384
                        //        {
2385
                        //            BitmapImage im = new BitmapImage();
2386
                        //            im.SetSource(ms);
2387
                        //            instanceMain.DeepLayer.SignImage = im;
2388
                        //            ms.Close();
2389
                        //        }
2390
                        //    }
2391
                        //};
2392
                        //instanceMain.BaseClient.GetUserSignAsync(instanceMain._ViewInfo.UserID);
2393
                        break;
2394
                    #endregion
2395
                    #region Check
2396
                    case "Check":
2397
                        Common.ViewerDataModel.Instance.SelectedControl = "Check";
2398
                        Common.ViewerDataModel.Instance.ControlTag = instanceMain.dzMainMenu._ViewInfo.UserID; //사번
2399
                        //강인구 추가
2400
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Symbol;
2401
                        break;
2402
                    #endregion
2403
                    #region Batch
2404
                    case "Batch":
2405
                        Common.ViewerDataModel.Instance.SelectedControl = "Batch";
2406
                        Common.ViewerDataModel.Instance.ControlTag = instanceMain.dzMainMenu._ViewInfo.UserID; //사번
2407
                        //강인구 추가
2408
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Mark;
2409
                        instanceMain.dzMainMenu.txtBatch.Visibility = Visibility.Visible;
2410 999c9e40 humkyung
                        instanceMain.dzMainMenu.txtBatch.Text = "Place Mark";
2411 787a4489 KangIngu
                        break;
2412 d4b0c723 KangIngu
                    #endregion
2413 b74a9c91 taeseongkim
2414
                    #region MACRO -MACRO1
2415
                    case "MACRO":
2416
                        Common.ViewerDataModel.Instance.SelectedControl = "MACRO";
2417
                        Common.ViewerDataModel.Instance.ControlTag = instanceMain.dzMainMenu._ViewInfo.UserID; //사번
2418
2419
                        MacroHelper.MacroAction();
2420
2421
                        break;
2422
                    #endregion
2423
2424 d4b0c723 KangIngu
                    #region Copy
2425
                    case "Copy":
2426
                        Copy_Start();
2427
                        instanceToggle.IsChecked = false;
2428
                        ViewerDataModel.Instance.SelectedControl = "";
2429
                        ViewerDataModel.Instance.ControlTag = null;
2430
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2431
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2432
                        break;
2433
                    #endregion
2434
                    #region Cut
2435
                    case "Cut":
2436 93420e5a ljiyeon
                        //Cut_Start();
2437
                        CutCommand.Instance.Execute();
2438 d4b0c723 KangIngu
                        instanceToggle.IsChecked = false;
2439
                        ViewerDataModel.Instance.SelectedControl = "";
2440
                        ViewerDataModel.Instance.ControlTag = null;
2441
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2442
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2443
                        break;
2444
                    #endregion
2445
                    #region Paste
2446
                    case "Paste":
2447
                        Paste_Start();
2448
                        instanceToggle.IsChecked = false;
2449
                        ViewerDataModel.Instance.SelectedControl = "";
2450
                        ViewerDataModel.Instance.ControlTag = null;
2451
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2452 ccf944bb ljiyeon
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;                        
2453 d4b0c723 KangIngu
                        break;
2454
                    #endregion
2455
                    #region Delete
2456
                    case "Delete":
2457 d62c0439 humkyung
                        DeleteCommand.Instance.Execute(SelectionSet.Instance.SelectedItems);
2458 24678e06 humkyung
                        this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Clear();
2459
2460 d4b0c723 KangIngu
                        instanceToggle.IsChecked = false;
2461
                        ViewerDataModel.Instance.SelectedControl = "";
2462
                        ViewerDataModel.Instance.ControlTag = null;
2463
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2464
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2465
                        break;
2466
                    #endregion
2467
                    #region Undo
2468
                    case "Undo":
2469 f816dd63 humkyung
                        UndoCommand.Instance.Execute();
2470 d4b0c723 KangIngu
                        instanceToggle.IsChecked = false;
2471
                        ViewerDataModel.Instance.SelectedControl = "";
2472
                        ViewerDataModel.Instance.ControlTag = null;
2473
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2474
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2475
                        break;
2476
                    #endregion
2477
                    #region Redo
2478
                    case "Redo":
2479 f816dd63 humkyung
                        RedoCommand.Instance.Execute();
2480 d4b0c723 KangIngu
                        instanceToggle.IsChecked = false;
2481
                        ViewerDataModel.Instance.SelectedControl = "";
2482
                        ViewerDataModel.Instance.ControlTag = null;
2483
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2484
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2485 9f473fb7 KangIngu
                        break;
2486
                    #endregion
2487
                    #region DragZoom
2488
                    case "DragZoom":
2489
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.DragZoom;
2490
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2491
                        instanceMain.dzMainMenu.isLeftMouseButtonDownOnWindow = false;
2492
                        break;
2493 d4b0c723 KangIngu
                    #endregion
2494 53880c83 ljiyeon
                    #region Grouping
2495
                    case "Group":
2496 c0977e97 djkim
                        //var GrouptoggleList = this.Parent.ChildrenOfType<RadRibbonToggleButton>();
2497
                        //foreach (var togle in GrouptoggleList)
2498
                        //{
2499
                        //    togle.IsChecked = false;
2500
                        //}
2501 53880c83 ljiyeon
2502 c0977e97 djkim
                        //if (this.ParentOfType<MainWindow>().dzMainMenu.currentControl != null)
2503
                        //{
2504
                        //    ViewerDataModel.Instance.MarkupControls_USER.Remove(this.ParentOfType<MainWindow>().dzMainMenu.currentControl);
2505
                        //    this.ParentOfType<MainWindow>().dzMainMenu.currentControl = null;
2506
                        //}
2507
                        //this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2508
                        //instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2509
                        //instanceMain.dzMainMenu.isLeftMouseButtonDownOnWindow = false;
2510
                        //if (ViewerDataModel.Instance.SystemMain.dzMainMenu.SelectLayer.Children.Count < 1) //선택된 것이 없으면
2511
                        //{
2512
                        //    this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert("Please Select Controls", "Alert");
2513
                        //}
2514
                        //else//if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
2515
                        //{
2516
                        //    // string MarkupData = "";
2517
                        //    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
2518
                        //    {
2519
                        //        if (item.GetType().Name == "AdornerFinal" && (item as AdornerFinal).MemberSet.Count >= 2) // 얘가 2개 이상이여야 그룹가능 버튼도 막을거긴하지만 일단..
2520
                        //        {
2521
                        //            //MARKUP_DATA_GROUP INSERT
2522
                        //            MARKUP_DATA_GROUP mARKUP_DATA_GROUP = new MARKUP_DATA_GROUP
2523
                        //            {
2524
                        //                SYMBOL_ID = null,//InnerItem.Symbol_ID
2525
                        //                STATE = 0,
2526
                        //            };
2527
                        //            long group_id = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.AddMarkupDataGroup(mARKUP_DATA_GROUP, App.ViewInfo.ProjectNO);
2528 664ea2e1 taeseongkim
                        //            //Logger.sendReqLog("AddMarkupDataGroup: ", "", 1);
2529 c0977e97 djkim
                        //            if (group_id > 0)
2530
                        //            {
2531
                        //                foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
2532
                        //                {
2533
                        //                    if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
2534
                        //                    {
2535
                        //                        //MARKUP_DATA UPDATE
2536
                        //                        //Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.UpdateMarkupData((InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo).CommentID, group_id, App.ViewInfo.ProjectNO);
2537 664ea2e1 taeseongkim
                        //                        ////Logger.sendReqLog("UpdateMarkupData: ", "", 1);
2538 c0977e97 djkim
                        //                        ViewerDataModel.Instance.MyMarkupList.Where(d => d.ID == (InnerItem.DrawingData as CommentUserInfo).CommentID).FirstOrDefault().Group_ID = group_id;
2539
                        //                        ViewerDataModel.Instance.MyMarkupList.Where(d => d.ID == (InnerItem.DrawingData as CommentUserInfo).CommentID).FirstOrDefault().IsUpdate = true;
2540
                        //                    }
2541
                        //                }
2542
                        //            }
2543
                        //        }
2544
                        //    }
2545
                        //}
2546 53880c83 ljiyeon
                        break;
2547
                    case "UnGroup":
2548 c0977e97 djkim
                        //var UnGrouptoggleList = this.Parent.ChildrenOfType<RadRibbonToggleButton>();
2549
                        //foreach (var togle in UnGrouptoggleList)
2550
                        //{
2551
                        //    togle.IsChecked = false;
2552
                        //}
2553
                        //if (this.ParentOfType<MainWindow>().dzMainMenu.currentControl != null)
2554
                        //{
2555
                        //    ViewerDataModel.Instance.MarkupControls_USER.Remove(this.ParentOfType<MainWindow>().dzMainMenu.currentControl);
2556
                        //    this.ParentOfType<MainWindow>().dzMainMenu.currentControl = null;
2557
                        //}
2558
                        //this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2559
                        //instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2560
                        //instanceMain.dzMainMenu.isLeftMouseButtonDownOnWindow = false;
2561
2562
                        //if (ViewerDataModel.Instance.SystemMain.dzMainMenu.SelectLayer.Children.Count < 1) //선택된 것이 없으면
2563
                        //{
2564
                        //    this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert("Please Select Controls", "Alert");
2565
                        //}
2566
                        //else//if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
2567
                        //{
2568
                        //    // string MarkupData = "";
2569
                        //    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
2570
                        //    {
2571
                        //        if (item.GetType().Name == "AdornerFinal" && (item as AdornerFinal).MemberSet.Count >= 1) // 1개 이상 
2572
                        //        {
2573
                        //            //MARKUP_DATA UPDATE
2574
                        //            foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
2575
                        //            {
2576
                        //                if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
2577
                        //                {
2578
                        //                    long group_id = ViewerDataModel.Instance.MyMarkupList.Where(d => d.ID == (InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo).CommentID).FirstOrDefault().Group_ID;
2579
                        //                    //MARKUP_DATA UPDATE
2580
                        //                    //Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.UpdateMarkupData((InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo).CommentID, 0, App.ViewInfo.ProjectNO);
2581 664ea2e1 taeseongkim
                        //                    ////Logger.sendReqLog("UpdateMarkupData: ", "", 1);
2582 c0977e97 djkim
                        //                    ViewerDataModel.Instance.MyMarkupList.Where(d => d.ID == (InnerItem.DrawingData as CommentUserInfo).CommentID).FirstOrDefault().Group_ID = 0;
2583
                        //                    ViewerDataModel.Instance.MyMarkupList.Where(d => d.ID == (InnerItem.DrawingData as CommentUserInfo).CommentID).FirstOrDefault().IsUpdate = true;
2584
2585
2586
                        //                    //MARKUP_DATA_GROUP UPDATE
2587
                        //                    //bool value = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.UpdateMarkupDataGroup(group_id, App.ViewInfo.ProjectNO);
2588 664ea2e1 taeseongkim
                        //                    ////Logger.sendReqLog("AddMarkupDataGroup: ", value.ToString(), 1);
2589 c0977e97 djkim
                        //                }
2590
                        //            }
2591
                        //        }
2592
                        //    }
2593
                        //}
2594 53880c83 ljiyeon
                        break;
2595
                    #endregion
2596
                    #region Capture
2597
                    case "Capture":
2598
                        SyncInit();
2599
                        //   instanceToggle.IsChecked = false;
2600
                        var CaptureList = this.Parent.ChildrenOfType<RadRibbonToggleButton>();
2601
                        foreach (var togle in CaptureList)
2602
                        {
2603
                            togle.IsChecked = false;
2604
                        }
2605
2606
                        if (this.ParentOfType<MainWindow>().dzMainMenu.currentControl != null)
2607
                        {
2608
                            ViewerDataModel.Instance.MarkupControls_USER.Remove(this.ParentOfType<MainWindow>().dzMainMenu.currentControl);
2609
                            this.ParentOfType<MainWindow>().dzMainMenu.currentControl = null;
2610
                        }
2611
2612
                        ViewerDataModel.Instance.SelectedControl = "ImgControl";
2613
                   //     ViewerDataModel.Instance.ControlTag = null;
2614
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ImgControl;
2615
2616
                        /*
2617
                        //캡쳐 하기 전에 코멘트 저장
2618
                        if (Common.ViewerDataModel.Instance.MarkupControls_USER.Count > 0 || (Application.Current.MainWindow as MainWindow).dzMainMenu.SelectLayer.Children.Count > 0)
2619
                        {
2620
                            var menu = (Application.Current.MainWindow as MainWindow).dzMainMenu;
2621
                            menu.ReleaseAdorner();
2622
                            if (menu.PreviewUserMarkupInfoItem != null && menu.PreviewUserMarkupInfoItem.IsPreviewUser == true)
2623
                            {
2624
                                (Application.Current.MainWindow as MainWindow).dzTopMenu.RefactoryCommentReact(menu);
2625
                            }
2626
                            else if (menu.gridViewMarkup.SelectedItems.Count == 0 || (menu.gridViewMarkup.SelectedItems.FirstOrDefault() as IKCOM.MarkupInfoItem).UserID != App.ViewInfo.UserID)
2627
                            {
2628
2629
                            }
2630
                            else
2631
                            {
2632
                                (Application.Current.MainWindow as MainWindow).dzTopMenu.RefactoryCommentReact(menu);
2633
                            }
2634
                        }*/
2635
2636
                        //Common.ViewerDataModel.Instance.CheckList_ID = ((e.Source as Telerik.Windows.Controls.RadButton).DataContext as Customer).ID;
2637
                        //Common.ViewerDataModel.Instance.CheckList_ID = ((e.Source as Image).DataContext as Customer).ID;
2638
                        //Common.ViewerDataModel.Instance.PageNumber = ((e.Source as Image).DataContext as Customer).PAGENUMBER;
2639
                        Application.Current.MainWindow.Focus();
2640
                        Common.ViewerDataModel.Instance.Capture_Opacity = 0.49;
2641
                        (Application.Current.MainWindow as MainWindow).dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Capture;
2642
                        break;
2643
                    #endregion
2644 f65e6c02 taeseongkim
                    #region Cad
2645
                    case "Inside":
2646
                        //instanceMain.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Drawing;
2647
                        //instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = false;
2648
                        Common.ViewerDataModel.Instance.SelectedControl = "InsideWhite";
2649
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.InsideWhite;
2650
                        break;
2651
                    case "Overlap":
2652
                        //instanceMain.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Drawing;
2653
                        //instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = false;
2654
                        Common.ViewerDataModel.Instance.SelectedControl = "OverlapWhite";
2655
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.OverlapWhite;
2656
                        break;
2657
                    case "Clip":
2658
                        //instanceMain.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Drawing;
2659
                        //instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = false;
2660
                        Common.ViewerDataModel.Instance.SelectedControl = "ClipWhite";
2661
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ClipWhite;
2662
                        break;
2663
                    case "CadExport":
2664
                        //if (isClosed)
2665
                        //{
2666
                        //    //토글 및 마우스 상태 초기화
2667
                        //    var toggleList = this.Parent.ChildrenOfType<RadRibbonToggleButton>();
2668
                        //    foreach (var togle in toggleList)
2669
                        //    {
2670
                        //        togle.IsChecked = false;
2671
                        //    }
2672
                        //    this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2673
2674
                        //    isClosed = false;
2675
                        //    //Control 파일 먼저 생성
2676
                        //    CollapsedButton_Click();
2677
                        //    CadViewer check = new CadViewer();
2678
                        //    check.WindowStartupLocation = WindowStartupLocation.CenterScreen;
2679
                        //    check.Title = "Export Viewer";
2680
                        //    //check.Topmost = true;
2681
                        //    check.Show();
2682
                        //    check.Closed += Check_Closed;
2683
                        //    instanceToggle.IsChecked = false;
2684
                        //}
2685
                        //break;
2686
                    case "CadViewer":
2687
                        //if (isClosed)
2688
                        //{
2689
                        //    //토글 및 마우스 상태 초기화
2690
                        //    var toggleList = this.Parent.ChildrenOfType<RadRibbonToggleButton>();
2691
                        //    foreach (var togle in toggleList)
2692
                        //    {
2693
                        //        togle.IsChecked = false;
2694
                        //    }
2695
                        //    this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2696
2697
                        //    isClosed = false;
2698
                        //    CadResultViewer check = new CadResultViewer();
2699
                        //    check.WindowStartupLocation = WindowStartupLocation.CenterScreen;
2700
                        //    check.Title = "Viewer";
2701
                        //    check.Show();
2702
2703
                        //    check.Closed += Check_Closed;
2704
2705
                        //}
2706
                        break;
2707
                    #endregion
2708 787a4489 KangIngu
                    default:
2709
                        break;
2710
                }
2711
                #endregion
2712
            }
2713
            else
2714
            {
2715 fc4e50f2 taeseongkim
                if (Common.ViewerDataModel.Instance.IsMacroCommand)
2716
                {
2717
                    MacroHelper.Clear();
2718
                }
2719 992a98b4 KangIngu
2720 787a4489 KangIngu
                if (!instanceMain.dzMainMenu.IsFreeSelectionMode)
2721
                {
2722
                    instanceMain.dzMainMenu.IsSwingMode = false;
2723
                    Common.ViewerDataModel.Instance.SelectedControl = "";
2724
                    Common.ViewerDataModel.Instance.ControlTag = null;
2725
                    this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2726
                    this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2727
                }
2728
            }
2729 eeb0a39c taeseongkim
2730 787a4489 KangIngu
        }
2731
2732 53880c83 ljiyeon
        private void SyncInit()
2733
        {
2734
            try
2735
            {
2736
                if (!ViewerDataModel.Instance.SystemMain.dzMainMenu.testPanel2.IsHidden)
2737
                {
2738
                    ViewerDataModel.Instance.SystemMain.dzMainMenu.testPanel2.IsHidden = true;
2739
                    ViewerDataModel.Instance.PageBalanceMode = false;
2740
                    ViewerDataModel.Instance.PageBalanceNumber = 0;
2741 752b18ef taeseongkim
                    ViewerDataModel.Instance.SyncPageNumber = 0;
2742 53880c83 ljiyeon
                    ViewerDataModel.Instance.MarkupControls_Sync.Clear();
2743
                    ViewerDataModel.Instance.SystemMain.dzMainMenu.gridViewRevMarkup.Visibility = Visibility.Collapsed;
2744
                    ViewerDataModel.Instance.SystemMain.dzMainMenu.UserList.IsChecked = false;
2745
                    ViewerDataModel.Instance.SystemMain.dzMainMenu.BalanceMode.IsChecked = false;
2746
                }
2747
            }
2748
            catch (Exception ex)
2749
            {
2750 664ea2e1 taeseongkim
                //Logger.sendResLog("SyncInit", ex.Message, 0);
2751 53880c83 ljiyeon
            }
2752
2753
        }
2754
2755 684ef11c ljiyeon
        Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
2756
        CommentUserInfo currentControl { get; set; }
2757
        private void Check_Closed(object sender, EventArgs e)
2758
        {
2759
            isClosed = true;
2760
            //this.ParentOfType<MainWindow>().dzMainMenu.PN_Navi.IsEnabled = true;
2761
            //토글 및 마우스 상태 초기화
2762
            var toggleList = this.Parent.ChildrenOfType<RadToggleButton>();
2763
            foreach (var togle in toggleList)
2764
            {
2765
                togle.IsChecked = false;
2766
            }
2767
            this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2768
            ViewerDataModel.Instance.Capture_Opacity = 0;
2769
2770
        }
2771
2772
        /* public class test 
2773
         {
2774
             public double width { get; set; }
2775
             public double height { get; set; }
2776
         }
2777
         */
2778 ac4f1e13 taeseongkim
        private async void CollapsedButton_Click()
2779 684ef11c ljiyeon
        {
2780
            this.ParentOfType<MainWindow>().dzTopMenu._SaveEvent(null, null); // 저장하지 못한 데이터가 있다면 저장
2781
2782
            string[] data = new string[0];
2783
2784
            int cnt = 0;
2785
            var menu = this.ParentOfType<MainWindow>().dzMainMenu;
2786
2787
            List<MarkupInfoItem> gridSelectionItem = menu.gridViewMarkup.SelectedItems.Cast<MarkupInfoItem>().ToList(); //선택 된 마크업
2788
2789
            foreach (var item in gridSelectionItem)
2790
            {
2791
                if ((item.UserID == App.ViewInfo.UserID) && (ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.CurrentPage != null))
2792
                {
2793 d62c0439 humkyung
                    var instance = ViewerDataModel.Instance.MyMarkupList.Where(d => d.PageNumber == ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber &&
2794 684ef11c ljiyeon
                    d.MarkupInfoID == item.MarkupInfoID).ToList();
2795
                    data = new string[instance.Count];
2796
                    foreach (var markup in instance)
2797
                    {
2798 d2050059 taeseongkim
                        data[cnt++] = await MarkupToPDF.Serialize.Core.JsonSerializerHelper.UnCompressStringAsync(markup.Data,ViewerDataModel.Instance.NewMarkupCancelToken());
2799 684ef11c ljiyeon
                    }
2800
                }
2801
            }
2802
2803 cf2671a6 ljiyeon
            if (data != null && KCOM.Properties.Settings.Default.cad == 1)
2804 684ef11c ljiyeon
            {
2805
                string FilePath = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\Cad");
2806
                string FileName = FilePath + "\\commentstring.json"; // Default file name
2807
                if (!File.Exists(FilePath))
2808
                {
2809
                    Directory.CreateDirectory(FilePath);
2810
                }
2811
2812
                if (!string.IsNullOrEmpty(FileName))
2813
                {
2814
                    //  File.WriteAllText(SaveDig.FileName, data);
2815
                    File.WriteAllLines(FileName, data);
2816
                }
2817
            }
2818
        }
2819
2820
        private double minHeight;
2821
        private double minWidth;
2822
2823
        private double maxHeight;
2824
        private double maxWidth;
2825
2826
        public bool CanVResize { get; private set; }
2827
        public bool CanHResize { get; private set; }
2828
2829
        public void DesignerComponent(FrameworkElement content)
2830
        {
2831
            this.InitializeComponent();
2832
2833
            if (!double.IsNaN(content.Width))
2834
            {
2835
                CanHResize = false;
2836
                this.Width = content.Width;
2837
            }
2838
            else
2839
            {
2840
                CanHResize = true;
2841
                this.Width = 23.0;
2842
            }
2843
            if (!double.IsNaN(content.Height))
2844
            {
2845
                CanVResize = false;
2846
                this.Height = content.Height; ;
2847
            }
2848
            else
2849
            {
2850
                CanVResize = true;
2851
                this.Height = 23.0;
2852
            }
2853
2854
            minWidth = content.MinWidth < 10.0 ? 10.0 : content.MinWidth;
2855
            minHeight = content.MinHeight < 10.0 ? 10.0 : content.MinHeight;
2856
            maxWidth = content.MaxWidth;
2857
            maxHeight = content.MaxHeight;
2858
2859
            double top = (double)content.GetValue(Canvas.TopProperty);
2860
            if (double.IsNaN(top))
2861
                top = 0.0;
2862
            double left = (double)content.GetValue(Canvas.LeftProperty);
2863
            if (double.IsNaN(left))
2864
                left = 0.0;
2865
            SetValue(Canvas.TopProperty, top);
2866
            SetValue(Canvas.LeftProperty, left);
2867
2868
            //Set the actual content. Note that "Content" property is a new property. See below
2869
            this.Content = content;
2870
        }
2871
        private void Thumb_DragDelta(object sender, DragDeltaEventArgs e)
2872
        {
2873
            string name = ((Thumb)sender).Name;
2874
            if (name.Contains("Top"))
2875
            {
2876
                double newHeight = this.Height - e.VerticalChange;
2877
                if (newHeight >= minHeight && newHeight <= maxHeight)
2878
                {
2879
                    this.Height = newHeight;
2880
                    SetValue(Canvas.TopProperty,
2881
                (double)GetValue(Canvas.TopProperty) + e.VerticalChange);
2882
                }
2883
            }
2884
            if (name.Contains("Right"))
2885
            {
2886
                double newWidth = this.Width + e.HorizontalChange;
2887
                if (newWidth >= minWidth && newWidth <= maxWidth)
2888
                    this.Width = newWidth;
2889
            }
2890
            if (name.Contains("Bottom"))
2891
            {
2892
                double newHeight = this.Height + e.VerticalChange;
2893
                if (newHeight >= minHeight && newHeight <= maxHeight)
2894
                    this.Height = newHeight;
2895
            }
2896
            if (name.Contains("Left"))
2897
            {
2898
                double newWidth = this.Width - e.HorizontalChange;
2899
                if (newWidth >= minWidth && newWidth <= maxWidth)
2900
                {
2901
                    this.Width = newWidth;
2902
                    SetValue(Canvas.LeftProperty,
2903
                (double)GetValue(Canvas.LeftProperty) + e.HorizontalChange);
2904
                }
2905
            }
2906
        }
2907
2908
        private void drawControlBorder(object sender)
2909
        {
2910
            System.Windows.Controls.Control control = (System.Windows.Controls.Control)sender;
2911
        }
2912
2913
        private void ResizeThumb_DragDelta(object sender, MouseButtonEventArgs e)
2914
        {
2915
            System.Windows.Controls.Control designerItem = (System.Windows.Controls.Control)sender;
2916
            if (designerItem != null)
2917
            {
2918
                double deltaVertical, deltaHorizontal;
2919
2920
                switch (VerticalAlignment)
2921
                {
2922
                    case VerticalAlignment.Bottom:
2923
                        deltaVertical = designerItem.ActualHeight - designerItem.MinHeight;
2924
                        designerItem.Height -= deltaVertical;
2925
                        break;
2926
                    case VerticalAlignment.Top:
2927
                        deltaVertical = designerItem.ActualHeight - designerItem.MinHeight;
2928
                        Canvas.SetTop(designerItem, Canvas.GetTop(designerItem) + deltaVertical);
2929
                        designerItem.Height -= deltaVertical;
2930
                        break;
2931
                    default:
2932
                        break;
2933
                }
2934
2935
                switch (HorizontalAlignment)
2936
                {
2937
                    case HorizontalAlignment.Left:
2938
                        deltaHorizontal = designerItem.ActualWidth - designerItem.MinWidth;
2939
                        Canvas.SetLeft(designerItem, Canvas.GetLeft(designerItem) + deltaHorizontal);
2940
                        designerItem.Width -= deltaHorizontal;
2941
                        break;
2942
                    case HorizontalAlignment.Right:
2943
                        deltaHorizontal = designerItem.ActualWidth - designerItem.MinWidth;
2944
                        designerItem.Width -= deltaHorizontal;
2945
                        break;
2946
                    default:
2947
                        break;
2948
                }
2949
            }
2950
            e.Handled = true;
2951
        }
2952
2953
        SaveFileDialog SaveDig = new SaveFileDialog(); //파일 세이브 다이얼로그
2954
2955
        void ExportMethod()
2956
        {
2957
            //FileDialogFilter filterImage = new FileDialogFilter("Image Files", "*.jpg", "*.png");
2958
            SaveDig.Filter = "PDF file format|*.pdf";
2959
            SaveDig.Title = "Save an DWG File";
2960
            SaveDig.ShowDialog();
2961
        }
2962
2963 537f4cd8 djkim
        private void cbAutoSave_Checked(object sender, RoutedEventArgs e)
2964 be04d12c djkim
        {            
2965
            if (cbAutoSave.IsChecked == true)
2966 537f4cd8 djkim
            {
2967
                SaveTime(true, (int)cbSaveInterval.Value);
2968
            }
2969
            else
2970
            {
2971
                SaveTime(false, (int)cbSaveInterval.Value);
2972
            }
2973
        }
2974
        private void cbSaveInterval_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
2975
        {
2976 be04d12c djkim
            if(string.IsNullOrEmpty(cbSaveInterval.Value.ToString()))
2977
            {
2978
                cbSaveInterval.Value = cbSaveInterval.Minimum;
2979
            }
2980 537f4cd8 djkim
            if (cbAutoSave.IsChecked == true)
2981
            {
2982
                SaveTime(true, (int)cbSaveInterval.Value);
2983 5822e146 ljiyeon
            }
2984
2985
            KCOM.Properties.Settings.Default.SaveInterval = (double)cbSaveInterval.Value;
2986
            Properties.Settings.Default.Save();
2987 537f4cd8 djkim
        }
2988 787a4489 KangIngu
        //강인구 자동 저장 추가
2989
        private void AutoSave(object sender, RoutedEventArgs e)
2990
        {
2991
            RadToggleButton instanceToggle = sender as RadToggleButton;
2992
2993
            if(instanceToggle.IsChecked == true)
2994
            {
2995
                SaveTime(true);
2996
            }
2997
            else
2998
            {
2999
                SaveTime(false);
3000
            }
3001
        }
3002
3003 d4b0c723 KangIngu
        public void Copy_Start()
3004
        {
3005
            if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
3006
            {
3007
                string MarkupData = "";
3008
3009
                foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
3010
                {
3011
                    if (item.GetType().Name == "AdornerFinal")
3012
                    {
3013 4913851c humkyung
                        foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
3014 d4b0c723 KangIngu
3015
                        {
3016
                            if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
3017
                            {
3018 129ca191 humkyung
                                MarkupToPDF.Controls.Parsing.MarkupParser.MarkupReturn res = MarkupParser.MarkupToString(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo, App.ViewInfo.UserID);
3019
                                MarkupData += "|OR|" + res.ConvertData;
3020 d4b0c723 KangIngu
                            }
3021
                        }
3022 8f7f8073 taeseongkim
                        Clipboard.SetDataObject(MarkupData);
3023 d4b0c723 KangIngu
                    }
3024
                }
3025
            }
3026
        }
3027
3028
        public void Cut_Start()
3029
        {
3030
            if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
3031
            {
3032
                foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
3033
                {
3034
                    string MarkupData = "";
3035
3036
                    if (item.GetType().Name == "AdornerFinal")
3037
                    {
3038 4913851c humkyung
                        foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
3039 d4b0c723 KangIngu
                        {
3040
                            if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
3041
                            {
3042 129ca191 humkyung
                                MarkupToPDF.Controls.Parsing.MarkupParser.MarkupReturn res = MarkupParser.MarkupToString(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo, App.ViewInfo.UserID);
3043
                                MarkupData += "|OR|" + res.ConvertData;
3044 d4b0c723 KangIngu
                            }
3045
                        }
3046 ccf944bb ljiyeon
                        //클립보드에 넣음
3047 8f7f8073 taeseongkim
                        Clipboard.SetDataObject(MarkupData);
3048 d4b0c723 KangIngu
                    }
3049
                }
3050
                this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Clear();
3051
            }
3052
        }
3053
3054 ac4f1e13 taeseongkim
        public async void Paste_Start()
3055 d4b0c723 KangIngu
        {
3056
            //마크업 붙여넣기
3057
            if (Clipboard.GetText().Contains("|OR||DZ|"))
3058
            {
3059
                List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>();
3060
3061
                string[] delimiterChars = { "|OR|" };
3062
                string[] data = Clipboard.GetText().Split(delimiterChars, StringSplitOptions.RemoveEmptyEntries);
3063
3064 077896be humkyung
                SelectionSet.Instance.UnSelect(this.ParentOfType<MainWindow>().dzMainMenu);
3065 d4b0c723 KangIngu
3066
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
3067
3068
                //강인구 Undo/Redo 보류
3069 129ca191 humkyung
                MarkupToPDF.Common.Undo_data UndoData = new Undo_data()
3070 d4b0c723 KangIngu
                {
3071
                    IsUndo = false,
3072
                    Event = Event_Type.Create,
3073
                    EventTime = DateTime.Now,
3074
                    Markup_List = new List<Multi_Undo_data>()
3075
                };
3076
3077
                ViewerDataModel.Instance.UndoDataList.Where(data1 => data1.IsUndo == true).ToList().ForEach(i =>
3078
                {
3079
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
3080
                });
3081
3082
                foreach (string parse in data)
3083
                {
3084
                    if (parse != "")
3085
                    {
3086 d2050059 taeseongkim
                        System.Windows.Controls.Control item = await MarkupParser.ParseExAsync(App.BaseAddress,ViewerDataModel.Instance.NewMarkupCancelToken(),App.ViewInfo.ProjectNO, parse, ViewerDataModel.Instance.MarkupControls_USER, ViewerDataModel.Instance.PageAngle, string.Empty, string.Empty);
3087 24678e06 humkyung
                        (item as MarkupToPDF.Common.CommentUserInfo).CommentID = Commons.shortGuid();
3088 d4b0c723 KangIngu
3089
                        ViewerDataModel.Instance.MarkupControls.Remove(item as MarkupToPDF.Common.CommentUserInfo);
3090
                        ViewerDataModel.Instance.MarkupControls_USER.Remove(item as MarkupToPDF.Common.CommentUserInfo);
3091
3092
                        adornerSet.Add(item as MarkupToPDF.Common.CommentUserInfo);
3093
3094
                        multi_Undo_Data = this.ParentOfType<MainWindow>().dzMainMenu.Control_Style(item as MarkupToPDF.Common.CommentUserInfo);
3095
3096
                        UndoData.Markup_List.Add(multi_Undo_Data);
3097 6707a5c7 ljiyeon
                        ViewerDataModel.Instance.UndoDataList.Add(UndoData);                        
3098 d4b0c723 KangIngu
                    }
3099
                }
3100
                Controls.AdornerFinal final = new Controls.AdornerFinal(adornerSet);
3101
3102
                if(this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.X < 0)
3103
                {
3104
                    Canvas.SetLeft(final, 0);
3105
                    Canvas.SetTop(final, 0);
3106
                }
3107
                else
3108
                {
3109
                    double realPointX = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.X - final.BorderSize.X - (final.BorderSize.Width / 2);
3110
                    double realPointY = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.Y - final.BorderSize.Y - (final.BorderSize.Height / 2);
3111 0d00f9c8 humkyung
                    final.TranslateItems(realPointX, realPointY);
3112 d4b0c723 KangIngu
3113 4913851c humkyung
                    if (final.Members.Where(type => type.Drawingtype == MarkupToPDF.Controls.Common.ControlType.TextControl).FirstOrDefault() != null)
3114 d4b0c723 KangIngu
                    {
3115 0d00f9c8 humkyung
                        final.TranslateItems(0.001, 0.001); //dummy
3116 d4b0c723 KangIngu
                    }
3117
                }
3118
3119
                this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Add(final);
3120
            }
3121
            //외부 이미지 붙여넣기
3122
            else if (Clipboard.GetImage() != null)
3123
            {
3124 c73426a9 ljiyeon
                try
3125 d4b0c723 KangIngu
                {
3126 c73426a9 ljiyeon
                    Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
3127 d4b0c723 KangIngu
3128 c73426a9 ljiyeon
                    //강인구 Undo/Redo 보류
3129 129ca191 humkyung
                    MarkupToPDF.Common.Undo_data UndoData = new Undo_data()
3130 c73426a9 ljiyeon
                    {
3131
                        IsUndo = false,
3132
                        Event = Event_Type.Create,
3133
                        EventTime = DateTime.Now,
3134
                        Markup_List = new List<Multi_Undo_data>()
3135
                    };
3136 d4b0c723 KangIngu
3137
3138 c73426a9 ljiyeon
                    string temppath = System.IO.Path.GetTempPath();
3139
                    //string filename = KCOM.Events.Save.shortCommentKey();
3140 24678e06 humkyung
                    string filename = Commons.shortFileKey();
3141 d4b0c723 KangIngu
3142 c73426a9 ljiyeon
                    System.Drawing.Image clipboardImage = System.Windows.Forms.Clipboard.GetImage();
3143
                    clipboardImage.Save(temppath + "\\" + filename);
3144 d4b0c723 KangIngu
3145 c73426a9 ljiyeon
                    System.IO.FileInfo fileInfo = new System.IO.FileInfo(temppath + "\\" + filename);
3146
                    String strFile = System.IO.Path.GetFileName(fileInfo.FullName);
3147
                    long numByte = fileInfo.Length;
3148
                    double dLen = Convert.ToDouble(fileInfo.Length / 1000000);
3149 76dc223b taeseongkim
                    kr.co.devdoftech.cloud.FileUpload fileUploader = App.FileUploader;
3150 d4b0c723 KangIngu
3151 c73426a9 ljiyeon
                    if (dLen < 4)
3152
                    {
3153
                        System.IO.FileStream fStream = new System.IO.FileStream(fileInfo.FullName,
3154 43e1d368 taeseongkim
                        System.IO.FileMode.Open, System.IO.FileAccess.Read,FileShare.Read);
3155 c73426a9 ljiyeon
                        System.IO.BinaryReader br = new System.IO.BinaryReader(fStream);
3156
                        byte[] data = br.ReadBytes((int)numByte);
3157 d4b0c723 KangIngu
3158 c73426a9 ljiyeon
                        filename = fileUploader.Run(App.ViewInfo.ProjectNO, this.ParentOfType<MainWindow>().dzMainMenu._DocItem.DOCUMENT_NO, App.ViewInfo.UserID, strFile + ".png", data);
3159
                        Check_Uri.UriCheck(filename);
3160
                        br.Close();
3161
                        fStream.Close();
3162
                        fStream.Dispose();
3163
                    }
3164
                    else
3165
                    {
3166
                        this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert("Available Memory less than 4 mega byte", "Alert");
3167
                        return;
3168
                    }
3169 d4b0c723 KangIngu
3170 c73426a9 ljiyeon
                    fileInfo.Delete();
3171
3172
                    System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(clipboardImage);
3173
                    IntPtr hBitmap = bmp.GetHbitmap();
3174
                    System.Windows.Media.ImageSource WpfBitmap = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(hBitmap, IntPtr.Zero, Int32Rect.Empty, System.Windows.Media.Imaging.BitmapSizeOptions.FromEmptyOptions());
3175
                    Image img = new Image();
3176
                    if (filename.Contains(".svg"))
3177 53880c83 ljiyeon
                    {
3178 f1f822e9 taeseongkim
                        SharpVectors.Converters.SvgImageExtension svgImage = new SharpVectors.Converters.SvgImageExtension(filename);
3179
                        img.Source = (DrawingImage)svgImage.ProvideValue(null);
3180 c73426a9 ljiyeon
                    }
3181
                    else
3182
                    {
3183
                        img.Source = new BitmapImage(new Uri(filename));
3184 53880c83 ljiyeon
                    }
3185 d4b0c723 KangIngu
3186 c73426a9 ljiyeon
                    var currentControl = new MarkupToPDF.Controls.Etc.ImgControl
3187
                    {
3188
                        PointSet = new List<Point>(),
3189
                        FilePath = filename,
3190
                        ImageData = img.Source,
3191
                        StartPoint = new Point(100, 100),
3192
                        EndPoint = new Point(200, 200),
3193
                        TopRightPoint = new Point(100, 200),
3194
                        LeftBottomPoint = new Point(200, 100)
3195
                    };
3196 d4b0c723 KangIngu
3197 c73426a9 ljiyeon
                    currentControl.TopRightPoint = new Point(currentControl.StartPoint.X + clipboardImage.Width, currentControl.StartPoint.Y);
3198
                    currentControl.LeftBottomPoint = new Point(currentControl.StartPoint.X, currentControl.StartPoint.Y + clipboardImage.Height);
3199
                    currentControl.EndPoint = new Point(currentControl.StartPoint.X + clipboardImage.Width, currentControl.StartPoint.Y + clipboardImage.Height);
3200 d4b0c723 KangIngu
3201 c73426a9 ljiyeon
                    currentControl.PointSet = new List<Point>
3202 d4b0c723 KangIngu
                                        {
3203
                                            currentControl.StartPoint,
3204
                                            currentControl.LeftBottomPoint,
3205
                                            currentControl.EndPoint,
3206
                                            currentControl.TopRightPoint,
3207
                                        };
3208
3209 c73426a9 ljiyeon
                    multi_Undo_Data = this.ParentOfType<MainWindow>().dzMainMenu.Control_Style(currentControl as MarkupToPDF.Common.CommentUserInfo);
3210
                    UndoData.Markup_List.Add(multi_Undo_Data);
3211
                    ViewerDataModel.Instance.UndoDataList.Add(UndoData);
3212 d4b0c723 KangIngu
3213 c73426a9 ljiyeon
                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl as MarkupToPDF.Common.CommentUserInfo);
3214 24678e06 humkyung
                    currentControl.CommentID = Commons.shortGuid();
3215 d4b0c723 KangIngu
3216 c73426a9 ljiyeon
                    currentControl.ApplyTemplate();
3217
                    currentControl.SetImage();
3218 d4b0c723 KangIngu
3219 c73426a9 ljiyeon
                    ViewerDataModel.Instance.MarkupControls_USER.Remove(currentControl as MarkupToPDF.Common.CommentUserInfo);
3220
                    Controls.AdornerFinal final = new Controls.AdornerFinal(currentControl as MarkupToPDF.Common.CommentUserInfo);
3221
                    this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Add(final);
3222 ccf944bb ljiyeon
3223 c73426a9 ljiyeon
                    double realPointX = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.X - final.BorderSize.X - (final.BorderSize.Width / 2);
3224
                    double realPointY = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.Y - final.BorderSize.Y - (final.BorderSize.Height / 2);
3225 0d00f9c8 humkyung
                    final.TranslateItems(realPointX, realPointY);
3226 c73426a9 ljiyeon
                }
3227
                catch(Exception ex)
3228
                {
3229
                    this.ParentOfType<MainWindow>().DialogMessage_Alert("" + ex, "Alert");
3230
                }
3231 d4b0c723 KangIngu
            }
3232
        }
3233 787a4489 KangIngu
    }
3234
}
클립보드 이미지 추가 (최대 크기: 500 MB)