프로젝트

일반

사용자정보

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

markus / KCOM / Events / Implementation / TopMenuEvent.cs @ d2050059

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