프로젝트

일반

사용자정보

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

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

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

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