프로젝트

일반

사용자정보

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

markus / KCOM / Events / Implementation / TopMenuEvent.cs @ 6707a5c7

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

1
using KCOM.Common;
2
using KCOM.Common.Converter;
3
using KCOM.Controls;
4
using KCOM.Events;
5
using MarkupToPDF.Common;
6
using System;
7
using System.Collections.Generic;
8
using System.Linq;
9
using System.Text;
10
using System.Windows;
11
using System.Windows.Controls;
12
using System.Windows.Input;
13
using System.Windows.Media;
14
using Telerik.Windows.Controls;
15

    
16
namespace KCOM.Views
17
{
18
    public partial class TopMenu : UserControl
19
    {
20
        public int rotateOffSet = 0;
21
        private double[] rotateValue = { 0, 90, 180, 270 };
22
        public System.Windows.Threading.DispatcherTimer SaveTimer { get; set; }
23
        public bool isClosed = true;
24
        public RadWindow CheckPop;
25
        public MarkupToPDF.Common.Undo_data UndoData;
26
        MarkupToPDF.Controls.Parsing.LayerControl.MarkupReturn markupReturn = new MarkupToPDF.Controls.Parsing.LayerControl.MarkupReturn();
27
        MarkupToPDF.Controls.Parsing.LayerControl layer = new MarkupToPDF.Controls.Parsing.LayerControl();
28

    
29
        //임시파일
30
        TempFile temp = new TempFile();
31
        /// <summary>
32
        /// TaskBar에 메시지를 입력합니다
33
        /// </summary>
34
        /// <param name="message"></param>
35
        /// <param name="type"></param>
36
        public void TaskMessage(string message, TaskMessageType type)
37
        {
38
            //if (taskBar != null)
39
            //{
40
            //    string color = "";
41
            //    taskBar.Content = message;
42
            //    DicTaskMessage.TryGetValue(type, out color);
43
            //    taskBar.Foreground = new SolidColorBrush(StringToColorConverter.Parse(color));
44
            //}
45
        }
46

    
47
        /// <summary>
48
        /// Task Type명을 Key값으로 지정합니다
49
        /// </summary>
50
        public enum TaskMessageType
51
        {
52
            Normal,
53
            Caption,
54
            Error,
55
        }
56

    
57
        private void CheckShapeState()
58
        {
59

    
60

    
61
            if (cbHatchShape.IsChecked == true)
62
            {
63
                cbFillShape.IsChecked = false;
64
                ViewerDataModel.Instance.paintSet = MarkupToPDF.Controls.Common.PaintSet.Hatch;
65
            }
66
            else if(cbFillShape.IsChecked == true)
67
            {
68
                cbHatchShape.IsChecked = false;
69
                ViewerDataModel.Instance.paintSet = MarkupToPDF.Controls.Common.PaintSet.Fill;
70
            }
71
            else
72
            {
73
                ViewerDataModel.Instance.paintSet = MarkupToPDF.Controls.Common.PaintSet.None;
74
            }
75
        }
76

    
77
        //강인구 추가(Undo End)
78
        private void SetPaintEvent()
79
        {
80
            List<AdornerMember> AdonerList = GetAdornerItem();
81

    
82
            if (AdonerList.Count > 0)
83
            {
84
                Undo_data UndoData = new Undo_data()
85
                {
86
                    IsUndo = false,
87
                    Event = Event_Type.Option,
88
                    EventTime = DateTime.Now,
89
                    paint = ViewerDataModel.Instance.paintSet,
90
                    Markup_List = new List<Multi_Undo_data>()
91
                };
92
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
93

    
94
                foreach (AdornerMember InnerItem in AdonerList)
95
                {
96
                    multi_Undo_Data.PointSet = new List<Point>();
97

    
98
                    if ((InnerItem.DrawingData as MarkupToPDF.Controls.Common.IShapeControl) != null)
99
                    {
100
                        (InnerItem.DrawingData as MarkupToPDF.Controls.Common.IShapeControl).Paint = ViewerDataModel.Instance.paintSet;
101
                    }
102

    
103
                    multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
104
                    UndoData.Markup_List.Add(multi_Undo_Data);
105
                    multi_Undo_Data = new Multi_Undo_data();
106
                }
107

    
108
                ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
109
                {
110
                    ViewerDataModel.Instance.UndoDataList.Remove(i);                    
111
                });
112
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
113
                
114

    
115
            }
116

    
117
        }
118

    
119
        private void SetHighlightEvent()
120
        {
121
            List<AdornerMember> AdonerList = GetAdornerItem();
122

    
123
            if (AdonerList.Count > 0)
124
            {
125
                foreach (AdornerMember InnerItem in AdonerList)
126
                {
127
                    switch (InnerItem.DrawingData.GetType().Name)
128
                    {
129
                        case ("TextControl"):
130
                            {
131
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).IsHighLight = ViewerDataModel.Instance.checkHighShape;
132
                            }
133
                            break;
134
                        case ("ArrowTextControl"):
135
                            {
136
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape;
137
                            }
138
                            break;
139
                    }
140
                }
141
            }
142

    
143
        }
144

    
145
        private void FillShapeEvent(object sender, RoutedEventArgs e)
146
        {
147
            #region 주석
148
            //if ((sender as CheckBox).IsChecked.Value)
149
            //{
150
            //    cbHatchShape.IsChecked = false;
151
            //    imgShape_RectCloud.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/RectCloud_Fill.png", UriKind.Relative));
152
            //    imgShape_Cloud.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/Cloud_Fill.png", UriKind.Relative));
153
            //    imgShape_Rect.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/Rectangle_Fill.png", UriKind.Relative));
154
            //    imgShape_Tri.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/triangle-icon.png", UriKind.Relative));
155
            //    imgShape_Cicle.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/circle-icon.png", UriKind.Relative));
156
            //    imgShape_Poly.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/polygon_Fill.png", UriKind.Relative));
157
            //    TaskMessage("채우기 옵션이 적용되었습니다", TaskMessageType.Normal);
158
            //}
159
            //else
160
            //{
161

    
162
            //    imgShape_RectCloud.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/RectCloud.png", UriKind.Relative));
163
            //    imgShape_Cloud.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/Cloud.png", UriKind.Relative));
164
            //    imgShape_Rect.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/Rectangle.png", UriKind.Relative));
165
            //    imgShape_Tri.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/triangle-icon_None.png", UriKind.Relative));
166
            //    imgShape_Cicle.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/circle-icon_None.png", UriKind.Relative));
167
            //    imgShape_Poly.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/polygon.png", UriKind.Relative));
168
            //    TaskMessage("채우기 옵션이 해제되었습니다", TaskMessageType.Caption);
169
            //}
170
            #endregion
171
            ViewerDataModel.Instance.checkFillShape = (sender as CheckBox).IsChecked.Value;
172

    
173
            if (ViewerDataModel.Instance.checkFillShape)
174
            {
175
                cbHatchShape.IsChecked = false;
176
                ViewerDataModel.Instance.paintSet = MarkupToPDF.Controls.Common.PaintSet.Fill;
177
            }
178
            else
179
            {
180
                ViewerDataModel.Instance.paintSet = MarkupToPDF.Controls.Common.PaintSet.None;
181
            }
182
            SetPaintEvent();
183
        }
184

    
185
        /// <summary>
186
        /// 도형 빗금 처리
187
        /// </summary>
188
        /// <param name="sender"></param>
189
        /// <param name="e"></param>
190
        private void HatchShapeEvent(object sender, RoutedEventArgs e)
191
        {
192
			#region 주석
193
            //if ((sender as CheckBox).IsChecked.Value)
194
            //{
195
            //    cbFillShape.IsChecked = false;
196
            //    imgShape_RectCloud.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/RectCloud_Hatch.png", UriKind.Relative));
197
            //    imgShape_Cloud.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/Cloud_Hatch.png", UriKind.Relative));
198
            //    imgShape_Rect.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/rectangle-icon_Hatch.png", UriKind.Relative));
199
            //    imgShape_Tri.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/triangle-icon_Hatch.png", UriKind.Relative));
200
            //    imgShape_Cicle.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/circle-icon_Hatch.png", UriKind.Relative));
201
            //    imgShape_Poly.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/polygon_hatch.png", UriKind.Relative));
202
            //    TaskMessage("무늬 옵션이 적용되었습니다", TaskMessageType.Normal);
203
            //}
204
            //else
205
            //{
206
            //    imgShape_RectCloud.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/RectCloud.png", UriKind.Relative));
207
            //    imgShape_Cloud.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/Cloud.png", UriKind.Relative));
208
            //    imgShape_Rect.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/Rectangle.png", UriKind.Relative));
209
            //    imgShape_Tri.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/triangle-icon_None.png", UriKind.Relative));
210
            //    imgShape_Cicle.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/circle-icon_None.png", UriKind.Relative));
211
            //    imgShape_Poly.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/polygon.png", UriKind.Relative));
212
            //    TaskMessage("무늬 옵션이 해제되었습니다", TaskMessageType.Caption);
213
            //} 
214
            #endregion
215

    
216
            //강인구 추가
217
            ViewerDataModel.Instance.checkHatchShape = (sender as CheckBox).IsChecked.Value;
218
            if (ViewerDataModel.Instance.checkHatchShape)
219
            {
220
                cbFillShape.IsChecked = false;
221
                ViewerDataModel.Instance.paintSet = MarkupToPDF.Controls.Common.PaintSet.Hatch;
222
            }
223
            else
224
            {
225
                ViewerDataModel.Instance.paintSet = MarkupToPDF.Controls.Common.PaintSet.None;  
226
            }
227
            SetPaintEvent();
228
        }
229

    
230
 		//강인구 추가
231
        private string SetColor(string ID)
232
        {
233
            try
234
            {
235
                return ViewerDataModel.Instance._markupInfoList.Where(info => info.MarkupInfoID == ID).First().DisplayColor;
236
            }
237
            catch (Exception)
238
            {
239
                return "#FFFFFF";
240
            }
241
        }
242

    
243
        void SaveTimer_Tick(object sender, EventArgs e)
244
        {
245
            //if (this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode != IKCOM.MouseHandlingMode.Drawing)
246
            if (this.ParentOfType<MainWindow>().dzMainMenu.currentControl == null && this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count == 0)
247
            {
248
                SaveEvent(null, null);
249
            }
250

    
251
        }
252

    
253
        private void SaveTime(bool IsRun)
254
        {
255
            if(SaveTimer == null)
256
            {
257
                SaveTimer = new System.Windows.Threading.DispatcherTimer();
258
                SaveTimer.Interval = new TimeSpan(0, 0, 5);
259
                SaveTimer.Tick += new EventHandler(SaveTimer_Tick);
260
            }
261

    
262
            if (IsRun)
263
            {
264
                SaveTimer.Start();
265
            }
266
            else
267
            {
268
                SaveTimer.Stop();
269
            }
270
        }
271
        private void SaveTime(bool IsRun,int timeinterval)
272
        {
273
            if (SaveTimer == null)
274
            {
275
                SaveTimer = new System.Windows.Threading.DispatcherTimer();
276
                SaveTimer.Interval = new TimeSpan(0, timeinterval, 0);
277
                SaveTimer.Tick += new EventHandler(SaveTimer_Tick);
278
            }
279
            else
280
            {
281
                SaveTimer.Stop();
282
                SaveTimer.Interval = new TimeSpan(0, timeinterval, 0);
283
            }
284

    
285
            if (IsRun)
286
            {
287
                SaveTimer.Start();
288
            }
289
            else
290
            {
291
                SaveTimer.Stop();
292
            }
293
        }
294
        /// <summary>
295
        /// enable busy indicator and then call _SaveEvent method.
296
        /// </summary>
297
        /// <param name="sender"></param>
298
        /// <param name="e"></param>
299
        public void SaveEvent(object sender, RoutedEventArgs e)
300
        {
301
            this.ParentOfType<MainWindow>().dzMainMenu.EmptyControlCheck();
302

    
303
            if (this.ParentOfType<MainWindow>().dzMainMenu.busyIndicator.IsBusy == true) return;
304

    
305
            this.ParentOfType<MainWindow>().dzMainMenu.busyIndicator.IsBusy = true;
306

    
307
            System.Threading.Tasks.Task SaveTask = System.Threading.Tasks.Task.Factory.StartNew(() =>
308
            {
309
                Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, new Action<object, RoutedEventArgs>(_SaveEvent), sender, e);
310
            }).ContinueWith(task =>
311
            {
312
                Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate () { this.ParentOfType<MainWindow>().dzMainMenu.busyIndicator.IsBusy = false; }));
313
            });
314
        }
315

    
316
        /// <summary>
317
        /// save document
318
        /// </summary>
319
        /// <param name="sender"></param>
320
        /// <param name="e"></param>
321
        public void _SaveEvent(object sender, RoutedEventArgs e)
322
        {
323
            try
324
            {
325
                this.ParentOfType<MainWindow>().dzMainMenu.ReleaseAdorner();
326

    
327
                this.ParentOfType<MainWindow>().dzMainMenu.InkControl_Convert();
328

    
329
                var menu = this.ParentOfType<MainWindow>().dzMainMenu;
330

    
331
                //콘솔리 데잇일 경우 
332
                //if (ViewerDataModel.Instance.IsConsolidate && menu.gridViewMarkup.SelectedItems.Count > 1)
333
                //if (ViewerDataModel.Instance.IsConsolidate)
334
                //{
335
                //    ViewerDataModel.Instance.IsConsolidate = false;
336
                //    return;
337
                //}
338

    
339
                //코멘트가 없을 경우
340
                //if (ViewerDataModel.Instance.MarkupControls_USER.Count == 0)
341
                //{
342
                //    foreach (var item in menu.gridViewMarkup.SelectedItems)
343
                //    {
344
                //        if ((item as IKCOM.MarkupInfoItem).UserID == App.ViewInfo.UserID)
345
                //        {
346
                //            this.ParentOfType<MainWindow>().dzMainMenu.DeleteItem((item as IKCOM.MarkupInfoItem));
347
                //            return;
348
                //        }
349
                //    }
350
                //}
351

    
352
                //코멘트가 없을 경우
353
                if (ViewerDataModel.Instance.MarkupList_USER.Count == 0)
354
                {
355
                    foreach (var item in menu.gridViewMarkup.SelectedItems)
356
                    {
357
                        if ((item as IKCOM.MarkupInfoItem).UserID == App.ViewInfo.UserID)
358
                        {
359
                            this.ParentOfType<MainWindow>().dzMainMenu.DeleteItem((item as IKCOM.MarkupInfoItem));
360
                            return;
361
                        }
362
                    }
363
                }
364

    
365
                if (ViewerDataModel.Instance.MarkupList_USER.Count > 0)
366
                {
367
                    foreach (var item in menu.gridViewMarkup.SelectedItems)
368
                    {
369
                        if ((item as IKCOM.MarkupInfoItem).UserID == App.ViewInfo.UserID)
370
                        {
371
                            /*
372
                            if (menu.UndoData.Markup_List[0].Markup..GetType().Name == "TextControl" && ((MarkupToPDF.Controls.Text.TextControl)(item as IKCOM.MarkupInfoItem).MarkupList[0].).OverViewText == null)
373
                            {
374
                            }
375

    
376
                            this.ParentOfType<MainWindow>().dzMainMenu.DeleteItem((item as IKCOM.MarkupInfoItem));
377
                            return;*/
378
                        }
379
                    }
380
                }
381
                
382

    
383
                    //코멘트가 없을 경우
384
                    //if (ViewerDataModel.Instance.MarkupControls_USER.Count == 0)
385
                    //if (ViewerDataModel.Instance.MarkupControls_USER.Count == 0 && menu.gridViewMarkup.SelectedItems.Count == 0)
386
                    //{
387
                    //    foreach (var item in menu.gridViewMarkup.SelectedItems)
388
                    //    {
389
                    //        if ((item as IKCOM.MarkupInfoItem).UserID == App.ViewInfo.UserID)
390
                    //        {
391
                    //            this.ParentOfType<MainWindow>().dzMainMenu.DeleteItem((item as IKCOM.MarkupInfoItem));
392
                    //            return;
393
                    //        }
394
                    //    }
395
                    //}
396

    
397
                    menu.ChangeCommentReact();
398

    
399
                if (menu.PreviewUserMarkupInfoItem != null && menu.PreviewUserMarkupInfoItem.IsPreviewUser == true)
400
                {
401
                    RefactoryCommentReact(menu);
402
                }
403
                else if (menu.gridViewMarkup.SelectedItems.Count == 0)
404
                {
405
                    this.ParentOfType<MainWindow>().DialogMessage_Alert("Please Select Your Comment List Item", "Alert");
406
                    return;
407
                }
408
                //else if (menu.gridViewMarkup.SelectedItems.Count == 0 || (menu.gridViewMarkup.SelectedItems.FirstOrDefault() as  IKCOM.MarkupInfoItem).UserID != App.ViewInfo.UserID)
409
                //{
410
                //    this.ParentOfType<MainWindow>().DialogMessage_Alert("Please Select Your Comment List Item", "Alert");
411
                //    return;
412
                //}
413
                // 변경
414
                else
415
                {
416
                    foreach (var item in menu.gridViewMarkup.SelectedItems)
417
                    {
418
                        if ((item as IKCOM.MarkupInfoItem).UserID == App.ViewInfo.UserID)
419
                        {
420
                            RefactoryCommentReact(menu);
421
                            ViewerDataModel.Instance._markupInfoList.Where(data => data.MarkupInfoID == (item as IKCOM.MarkupInfoItem).MarkupInfoID).FirstOrDefault().UpdateTime = DateTime.Now;
422

    
423
                            if (ViewerDataModel.Instance.IsConsolidate)
424
                            {
425
                                return;
426
                            }
427
                            menu.gridViewMarkup.ItemsSource = null;
428
                            menu.gridViewMarkup.ItemsSource = ViewerDataModel.Instance._markupInfoList;
429
                            menu.gridViewMarkup.SelectedItem = item;
430

    
431
                            if (sender != null)
432
                            {
433
                                if (ViewerDataModel.Instance.IsPressCtrl)
434
                                {
435
                                    ViewerDataModel.Instance.IsPressCtrl = false;
436
                                }
437
                                this.ParentOfType<MainWindow>().DialogMessage_Alert("Save 가 완료되었습니다.", "Alert");
438
                            }
439
                            return;
440
                        }
441
                    }
442
                    ////강인구 변경
443
                    //this.ParentOfType<MainWindow>().DialogMessage_Alert("Please Select Your Comment List Item", "Alert");
444
                }
445
                if (sender != null)
446
                {
447
                    if (ViewerDataModel.Instance.IsPressCtrl)
448
                    {
449
                        ViewerDataModel.Instance.IsPressCtrl = false;
450
                    }
451
                    this.ParentOfType<MainWindow>().DialogMessage_Alert("Save 가 완료되었습니다.", "Alert");
452
                }
453
            }
454
            finally
455
            {
456
            }
457
        }
458

    
459
		public void RefactoryCommentReact(MainMenu menu)
460
        {
461
            this.ParentOfType<MainWindow>().dzMainMenu.InkControl_Convert();
462

    
463
            Save save = new Save();
464

    
465
            //추가
466
            List<IKCOM.MarkupInfoItem> MySelectItem = new List<IKCOM.MarkupInfoItem>();
467

    
468
            foreach(var item in menu.gridViewMarkup.SelectedItems)
469
            {
470
                if ((item as IKCOM.MarkupInfoItem).UserID == App.ViewInfo.UserID)
471
                {
472
                    MySelectItem.Add(item as IKCOM.MarkupInfoItem);
473
                }
474
            }
475

    
476
            //MySelectItem = (menu.gridViewMarkup.SelectedItems.FirstOrDefault() as IKCOM.MarkupInfoItem);
477

    
478

    
479
            save.Project_No = App.ViewInfo.ProjectNO;
480
            save.document_id = App.ViewInfo.DocumentItemID;
481
            save.user_id = App.ViewInfo.UserID;
482
            save.page_no = Convert.ToInt32(tlcurrentPage.Text);
483

    
484
            try
485
            {
486
                menu.ChangeCommentReact();
487
                if (menu.PreviewUserMarkupInfoItem != null) //신규 코멘트인지(MarkupInfo가 없는 경우)
488
                {
489
                    if (menu.gridViewMarkup.SelectedItems.FirstOrDefault() != null) //복수 페이지 혹은 저장한 경우
490
                    {
491
                        foreach(var item in MySelectItem)
492
                        {
493
                            save.MarkupSave(item);
494
                        }
495
                        //save.MarkupSave(menu.gridViewMarkup.SelectedItems.FirstOrDefault() as IKCOM.MarkupInfoItem);
496
                    }
497
                    else  //단일 페이지인 경우
498
                    {
499
                        //menu.ChangeCommentReact();
500
                        foreach (var item in MySelectItem)
501
                        {
502
                            save.MarkupSave(item);
503
                        }
504
                        //save.MarkupSave(menu.gridViewMarkup.SelectedItems.FirstOrDefault() as IKCOM.MarkupInfoItem);
505
                    }
506
                }
507
                else //기존 코멘트에 작업하는 경우
508
                {
509
                    if (menu.gridViewMarkup.SelectedItems.FirstOrDefault() != null)
510
                    {
511
                        foreach (var item in MySelectItem)
512
                        {
513
                            save.MarkupSave(item);
514
                        }
515
                        //save.MarkupSave(menu.gridViewMarkup.SelectedItems.FirstOrDefault() as IKCOM.MarkupInfoItem);
516
                    }
517
                }
518
                save.PageAngleSave(App.ViewInfo.ProjectNO, ViewerDataModel.Instance.RotationDocs);
519

    
520
            }
521
            catch (Exception ex)
522
            {
523
                this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert("세이브 실패", "Alert");
524
            }
525
        }
526

    
527
        //강인구 추가
528
        public void Print_Start(string Type)
529
        {
530
            if (ViewerDataModel.Instance.IsPressCtrl)
531
            {
532
                ViewerDataModel.Instance.IsPressCtrl = false;
533
            }
534
            if (ViewerDataModel.Instance.MarkupControls_USER.Count > 0 || this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
535
            {
536
                var menu = this.ParentOfType<MainWindow>().dzMainMenu;
537
                menu.ReleaseAdorner();
538
                if (menu.PreviewUserMarkupInfoItem != null && menu.PreviewUserMarkupInfoItem.IsPreviewUser == true)
539
                {
540
                    RefactoryCommentReact(menu);
541
                }
542
                else if (menu.gridViewMarkup.SelectedItems.Count == 0 || (menu.gridViewMarkup.SelectedItems.FirstOrDefault() as IKCOM.MarkupInfoItem).UserID != App.ViewInfo.UserID)
543
                {
544

    
545
                }
546
                else
547
                {
548
                    RefactoryCommentReact(menu);
549
                }
550
            }
551

    
552
            bool isprint = false;
553
            if (Type == "Print")
554
            {
555
                isprint = true;
556
            }
557

    
558
            RadWindow PrintWindow = new RadWindow();
559
            IKCOM.MarkupInfoItem _result = null;
560
            PrintWindow.Width = 850;
561
            PrintWindow.Height = 600;
562
            //PrintWindow.Width = 650;
563
            //PrintWindow.Height = 550;
564
            PrintWindow.Header = Type;
565

    
566
            List<IKCOM.MarkupInfoItem> markupinfo = new List<IKCOM.MarkupInfoItem>();
567
            markupinfo = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.GetPrintDocItemList(App.ViewInfo.ProjectNO, App.ViewInfo.DocumentItemID, ViewerDataModel.Instance._markupInfoList.ToList());
568

    
569
            var Tile_Url = string.Format(@"{0}/TileSource/{1}_Tile/{2}/{3}/",
570
                App.SystemInfo.HostName,
571
                App.ViewInfo.ProjectNO,
572
                (Convert.ToInt64(App.ViewInfo.DocumentItemID) / 100).ToString(),
573
                App.ViewInfo.DocumentItemID
574
                );
575

    
576
            PrintWindow.Content = new KCOM.Control.PrintControl(
577
                      Tile_Url,
578
                      App.ViewInfo.ProjectNO,
579
                      this.ParentOfType<MainWindow>().dzMainMenu._DocInfo, markupinfo,
580
                      this.ParentOfType<MainWindow>().dzMainMenu.pageNavigator.CurrentPage.PageNumber,
581
                      App.ViewInfo.DocumentItemID,
582
                      this.ParentOfType<MainWindow>().dzMainMenu._DocItem.DOCUMENT_NO,
583
                      this.ParentOfType<MainWindow>().dzMainMenu._DocItem.ORIGINAL_FILE, isprint);
584

    
585
            //프린트 팝업 옵션
586
            //PrintWindow.BorderThickness = new Thickness(3);
587
            //PrintWindow.BorderBrush = new SolidColorBrush(Color.FromArgb(255, 37, 160, 218));
588
            PrintWindow.ResizeMode = System.Windows.ResizeMode.NoResize;
589
            PrintWindow.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
590
            PrintWindow.Background = new SolidColorBrush(Colors.Black);
591
            PrintWindow.Background.Opacity = 0.6;
592

    
593
            Telerik.Windows.Controls.StyleManager.SetTheme(PrintWindow, new Telerik.Windows.Controls.VisualStudio2013Theme());
594
            PrintWindow.ShowDialog();
595
        }
596

    
597
        //강인구 추가
598
        private void PrintEvent(object sender, RoutedEventArgs e)
599
        {
600
            RadRibbonButton button = sender as RadRibbonButton;
601
            Print_Start(button.Content.ToString());
602
        }
603

    
604
        private List<AdornerMember> GetAdornerItem()
605
        {
606
            List<AdornerMember> AdonerList = new List<AdornerMember>();
607

    
608
            if (this.ParentOfType<MainWindow>() != null)
609
            {
610
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
611
                {
612
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
613
                    {
614
                        if (item.GetType().Name == "AdornerFinal")
615
                        {
616
                            foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
617
                            {
618
                                AdonerList.Add(InnerItem);
619
                            }
620
                        }
621
                    }
622
                }
623
            }
624
            return AdonerList;
625
        }
626
        /// <summary>
627
        /// 투명도
628
        /// </summary>
629
        /// <param name="sender"></param>
630
        /// <param name="e"></param>
631
        //강인구 추가(Undo End)
632
        private void sdOpacity_ValueChanged(object sender, RoutedEventArgs e)
633
        {
634
            List<AdornerMember> AdonerList = GetAdornerItem();
635
            if(AdonerList.Count > 0)
636
            {
637
                Undo_data UndoData = new Undo_data()
638
                {
639
                    IsUndo = false,
640
                    Event = Event_Type.Option,
641
                    EventTime = DateTime.Now,
642
                    Opacity = ViewerDataModel.Instance.ControlOpacity,
643
                    Markup_List = new List<Multi_Undo_data>()
644
                };
645
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
646

    
647
                foreach (AdornerMember InnerItem in AdonerList)
648
                {
649
                    InnerItem.DrawingData.Opacity = ViewerDataModel.Instance.ControlOpacity;
650
                  
651
                    multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
652
                    UndoData.Markup_List.Add(multi_Undo_Data);
653
                    multi_Undo_Data = new Multi_Undo_data();
654
                }
655

    
656
                ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
657
                {
658
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
659
                });
660
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
661
            }
662
        }
663

    
664
        //강인구 추가(Undo End)
665
        private void cbLineSize_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
666
        {
667
            List<AdornerMember> AdonerList = GetAdornerItem();
668
            if (AdonerList.Count > 0)
669
            {
670
                Undo_data UndoData = new Undo_data()
671
                {
672
                    IsUndo = false,
673
                    Event = Event_Type.Option,
674
                    EventTime = DateTime.Now,
675
                    LineSize = ViewerDataModel.Instance.LineSize,
676
                    Markup_List = new List<Multi_Undo_data>()
677
                };
678
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
679

    
680
                foreach (AdornerMember InnerItem in AdonerList)
681
                {
682
                    switch (InnerItem.DrawingData.GetType().Name)
683
                    {
684
                        case ("LineControl"):
685
                            {
686
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Line.LineControl).LineSize = ViewerDataModel.Instance.LineSize;
687
                            }
688
                            break;
689
                        case ("ArcControl"):
690
                            {
691
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Line.ArcControl).LineSize = ViewerDataModel.Instance.LineSize;
692
                            }
693
                            break;
694
                        case ("ArrowControl_Multi"):
695
                            {
696
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Line.ArrowControl_Multi).LineSize = ViewerDataModel.Instance.LineSize;
697
                            }
698
                            break;
699
                        case ("CloudControl"):
700
                            {
701
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Polygon.CloudControl).LineSize = ViewerDataModel.Instance.LineSize;
702
                            }
703
                            break;
704
                        case ("PolygonControl"):
705
                            {
706
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Polygon.PolygonControl).LineSize = ViewerDataModel.Instance.LineSize;
707
                            }
708
                            break;
709
                        case ("RectangleControl"):
710
                            {
711
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.RectangleControl).LineSize = ViewerDataModel.Instance.LineSize;
712
                            }
713
                            break;
714
                        case ("RectCloudControl"):
715
                            {
716
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.RectCloudControl).LineSize = ViewerDataModel.Instance.LineSize;
717
                            }
718
                            break;
719
                        case ("TriControl"):
720
                            {
721
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.TriControl).LineSize = ViewerDataModel.Instance.LineSize;
722
                            }
723
                            break;
724
                        case ("CircleControl"):
725
                            {
726
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.CircleControl).LineSize = ViewerDataModel.Instance.LineSize;
727
                            }
728
                            break;
729
                    }
730
                    
731

    
732
                    multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
733
                    UndoData.Markup_List.Add(multi_Undo_Data);
734
                    multi_Undo_Data = new Multi_Undo_data();
735
                }
736

    
737
                ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
738
                {
739
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
740
                });
741
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
742
            }
743
        }
744

    
745

    
746
        private void cbIntervalSize_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
747
        {
748
            List<AdornerMember> AdonerList = GetAdornerItem();
749
            if (AdonerList.Count > 0)
750
            {
751

    
752
                Undo_data UndoData = new Undo_data()
753
                {
754
                    IsUndo = false,
755
                    Event = Event_Type.Option,
756
                    EventTime = DateTime.Now,
757
                    Interval = ViewerDataModel.Instance.Interval,
758
                    Markup_List = new List<Multi_Undo_data>()
759
                };
760
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
761

    
762
                foreach (AdornerMember InnerItem in AdonerList)
763
                {
764
                    switch (InnerItem.DrawingData.GetType().Name)
765
                    {
766
                        case ("LineControl"):
767
                            {
768
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Line.LineControl).Interval = ViewerDataModel.Instance.Interval;
769

    
770
                                multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
771
                                UndoData.Markup_List.Add(multi_Undo_Data);
772
                                multi_Undo_Data = new Multi_Undo_data();
773
                            }
774
                            break;
775
                    }
776
                }
777

    
778
                ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
779
                {
780
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
781
                });
782
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
783
            }
784
        }
785
        
786
        private void cbArcLength_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
787
        {
788
            List<AdornerMember> AdonerList = GetAdornerItem();
789
            if (AdonerList.Count > 0)
790
            {
791

    
792
                //Undo_data UndoData = new Undo_data()
793
                //{
794
                //    IsUndo = false,
795
                //    Event = Event_Type.Option,
796
                //    EventTime = DateTime.Now,
797
                //    Interval = ViewerDataModel.Instance.Interval,
798
                //    Markup_List = new List<Multi_Undo_data>()
799
                //};
800
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
801

    
802
                foreach (AdornerMember InnerItem in AdonerList)
803
                {
804
                    switch (InnerItem.DrawingData.GetType().Name)
805
                    {
806
                        case ("RectCloudControl"):
807
                            {
808
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.RectCloudControl).ArcLength = ViewerDataModel.Instance.ArcLength;
809

    
810
                                //multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
811
                                //UndoData.Markup_List.Add(multi_Undo_Data);
812
                                //multi_Undo_Data = new Multi_Undo_data();
813
                            }
814
                            break;
815
                        case ("CloudControl"):
816
                            {
817
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Polygon.CloudControl).ArcLength = ViewerDataModel.Instance.ArcLength;
818

    
819
                                //multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
820
                                //UndoData.Markup_List.Add(multi_Undo_Data);
821
                                //multi_Undo_Data = new Multi_Undo_data();
822
                            }
823
                            break;
824
                    }
825
                }
826

    
827
                //ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
828
                //{
829
                //    ViewerDataModel.Instance.UndoDataList.Remove(i);
830
                //});
831
                //ViewerDataModel.Instance.UndoDataList.Add(UndoData);
832
            }
833
        }
834

    
835
        //강인구 추가(Undo End)
836
        private void cbDashStyle_SelectionChanged(object sender, SelectionChangedEventArgs e)
837
        {
838
            //강인구 추가
839
            if (this.ParentOfType<MainWindow>() != null)
840
            {
841
                ViewerDataModel.Instance.DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
842
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
843
                {
844
                    Undo_data UndoData = new Undo_data()
845
                    {
846
                        IsUndo = false,
847
                        Event = Event_Type.Option,
848
                        EventTime = DateTime.Now,
849
                        DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData,
850
                        Markup_List = new List<Multi_Undo_data>()
851
                    };
852
                    Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
853

    
854
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
855
                    {
856
                        if (item.GetType().Name == "AdornerFinal")
857
                        {
858
                            foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
859
                            {
860
                                switch (InnerItem.DrawingData.GetType().Name)
861
                                {
862
                                    case ("LineControl"):
863
                                        {
864
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Line.LineControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
865
                                        }
866
                                        break;
867
                                    case ("ArcControl"):
868
                                        {
869
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Line.ArcControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
870
                                        }
871
                                        break;
872
                                    case ("ArrowControl_Multi"):
873
                                        {
874
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Line.ArrowControl_Multi).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
875
                                        }
876
                                        break;
877
                                    case ("CloudControl"):
878
                                        {
879
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Polygon.CloudControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
880
                                        }
881
                                        break;
882
                                    case ("PolygonControl"):
883
                                        {
884
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Polygon.PolygonControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
885
                                        }
886
                                        break;
887
                                    case ("RectangleControl"):
888
                                        {
889
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.RectangleControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
890
                                        }
891
                                        break;
892
                                    case ("RectCloudControl"):
893
                                        {
894
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.RectCloudControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
895
                                        }
896
                                        break;
897
                                    case ("TriControl"):
898
                                        {
899
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.TriControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
900
                                        }
901
                                        break;
902
                                    case ("CircleControl"):
903
                                        {
904
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.CircleControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
905
                                        }
906
                                        break;
907
                                }
908

    
909
                                multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
910
                                UndoData.Markup_List.Add(multi_Undo_Data);
911
                                multi_Undo_Data = new Multi_Undo_data();
912
                            }
913

    
914
                            ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
915
                            {
916
                                ViewerDataModel.Instance.UndoDataList.Remove(i);
917
                            });
918
                            ViewerDataModel.Instance.UndoDataList.Add(UndoData);
919
                        }
920
                    }
921
                }
922
            }
923
        }
924

    
925
        //강인구 추가
926
        private void comboFontSize_SelectionChanged(object sender, SelectionChangedEventArgs e)
927
        {
928
            //if (this.ParentOfType<MainWindow>() != null)
929
            //{
930
            //    if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
931
            //    {
932
            //        foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
933
            //        {
934
            //            if (item.GetType().Name == "AdornerFinal")
935
            //            {
936
            //                foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
937
            //                {
938
            //                    switch (InnerItem.DrawingData.GetType().Name)
939
            //                    {
940
            //                        case ("TextControl"):
941
            //                            {
942
            //                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextSize = int.Parse(comboFontSize.Text);
943
            //                            }
944
            //                            break;
945
            //                        case ("ArrowTextControl"):
946
            //                            {
947
            //                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextSize = int.Parse(comboFontSize.Text);
948
            //                            }
949
            //                            break;
950
            //                    }
951
            //                }
952
            //            }
953
            //        }
954
            //    }
955
            //}
956
        }
957

    
958
        //강인구 추가
959
        private void btnBold_Checked(object sender, RoutedEventArgs e)
960
        {
961
            if (this.ParentOfType<MainWindow>() != null)
962
            {
963
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
964
                {
965
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
966
                    {
967
                        if (item.GetType().Name == "AdornerFinal")
968
                        {
969
                            foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
970
                            {
971
                                switch (InnerItem.DrawingData.GetType().Name)
972
                                {
973
                                    case ("TextControl"):
974
                                        {
975
                                            if((InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextWeight == FontWeights.Bold)
976
                                            {
977
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextWeight = FontWeights.Normal;
978
                                            }
979
                                            else
980
                                            {
981
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextWeight = FontWeights.Bold;
982
                                            }
983

    
984
                                        }
985
                                        break;
986
                                    case ("ArrowTextControl"):
987
                                        {
988
                                            if ((InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextWeight == FontWeights.Bold)
989
                                            {
990
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextWeight = FontWeights.Normal;
991
                                            }
992
                                            else
993
                                            {
994
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextWeight = FontWeights.Bold;
995
                                            }
996
                                        }
997
                                        break;
998
                                }
999
                            }
1000
                        }
1001
                    }
1002
                }
1003
            }
1004
        }
1005

    
1006
        //강인구 추가
1007
        private void btnItalic_Checked(object sender, RoutedEventArgs e)
1008
        {
1009
            if (this.ParentOfType<MainWindow>() != null)
1010
            {
1011
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
1012
                {
1013
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
1014
                    {
1015
                        if (item.GetType().Name == "AdornerFinal")
1016
                        {
1017
                            foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
1018
                            {
1019
                                switch (InnerItem.DrawingData.GetType().Name)
1020
                                {
1021
                                    case ("TextControl"):
1022
                                        {
1023
                                            if((InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextStyle == FontStyles.Italic)
1024
                                            {
1025
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextStyle = System.Windows.FontStyles.Normal;
1026
                                            }
1027
                                            else
1028
                                            {
1029
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextStyle = FontStyles.Italic;
1030
                                            }
1031

    
1032
                                        }
1033
                                        break;
1034
                                    case ("ArrowTextControl"):
1035
                                        {
1036
                                            if((InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextStyle == FontStyles.Italic)
1037
                                            {
1038
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextStyle = FontStyles.Normal;
1039
                                            }
1040
                                            else
1041
                                            {
1042
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextStyle = FontStyles.Italic;
1043
                                            }
1044
                                        }
1045
                                        break;
1046
                                }
1047
                            }
1048
                        }
1049
                    }
1050
                }
1051
            }
1052
        }
1053

    
1054
        //강인구 추가
1055
        private void btnUnderLine_Checked(object sender, RoutedEventArgs e)
1056
        {
1057
            if (this.ParentOfType<MainWindow>() != null)
1058
            {
1059
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
1060
                {
1061
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
1062
                    {
1063
                        if (item.GetType().Name == "AdornerFinal")
1064
                        {
1065
                            foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
1066
                            {
1067
                                switch (InnerItem.DrawingData.GetType().Name)
1068
                                {
1069
                                    case ("TextControl"):
1070
                                        {
1071
                                            if ((InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).UnderLine == TextDecorations.Underline)
1072
                                            {
1073
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).UnderLine = null;
1074
                                            }
1075
                                            else
1076
                                            {
1077
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).UnderLine = TextDecorations.Underline;
1078
                                            }
1079
                                        }
1080
                                        break;
1081
                                    case ("ArrowTextControl"):
1082
                                        {
1083
                                            if ((InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).UnderLine == TextDecorations.Underline)
1084
                                            {
1085
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).UnderLine = null;
1086
                                            }
1087
                                            else
1088
                                            {
1089
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).UnderLine = TextDecorations.Underline;
1090
                                            }
1091
                                        }
1092
                                        break;
1093
                                }
1094
                            }
1095
                        }
1096
                    }
1097
                }
1098
            }
1099
        }
1100

    
1101
        private void AxisLockEvent(object sender, RoutedEventArgs e)
1102
        {
1103
            ViewerDataModel.Instance.checkAxis = cbAxisLock.IsChecked.Value;
1104
        }
1105

    
1106
        private void comboFontSize_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
1107
        {
1108
            if (this.ParentOfType<MainWindow>() != null)
1109
            {
1110
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
1111
                {
1112
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
1113
                    {
1114
                        if (item.GetType().Name == "AdornerFinal")
1115
                        {
1116
                            foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
1117
                            {
1118
                                switch (InnerItem.DrawingData.GetType().Name)
1119
                                {
1120
                                    case ("TextControl"):
1121
                                        {
1122
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextSize = int.Parse(comboFontSize.Value.ToString());
1123
                                        }
1124
                                        break;
1125
                                    case ("ArrowTextControl"):
1126
                                        {
1127
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextSize = int.Parse(comboFontSize.Value.ToString());
1128
                                        }
1129
                                        break;
1130
                                }
1131
                            }
1132
                        }
1133
                    }
1134
                }
1135
            }
1136
        }
1137

    
1138
        //강인구 추가
1139
        private void RadRibbonComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
1140
        {
1141
            if (this.ParentOfType<MainWindow>() != null)
1142
            {
1143
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
1144
                {
1145
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
1146
                    {
1147
                        if (item.GetType().Name == "AdornerFinal")
1148
                        {
1149
                            foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
1150
                            {
1151
                                switch (InnerItem.DrawingData.GetType().Name)
1152
                                {
1153
                                    case ("TextControl"):
1154
                                        {
1155
                                            //if ((InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).FontFamily == TextDecorations.Underline)
1156
                                            //{
1157
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).FontFamily = new FontFamily(comboFontFamily.Text);
1158
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).Base_TextBlock.FontFamily = new FontFamily(comboFontFamily.Text);
1159
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).Base_TextBox.FontFamily = new FontFamily(comboFontFamily.Text);
1160
                                            //}
1161
                                            //else
1162
                                            //{
1163
                                            //    (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).UnderLine = TextDecorations.Underline;
1164
                                            //}
1165
                                        }
1166
                                        break;
1167
                                    case ("ArrowTextControl"):
1168
                                        {
1169
                                            //if ((InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).UnderLine == TextDecorations.Underline)
1170
                                            //{
1171
                                            //    (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).UnderLine = null;
1172
                                            //}
1173
                                            //else
1174
                                            //{
1175
                                            //    (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).UnderLine = TextDecorations.Underline;
1176
                                            //}
1177
                                        }
1178
                                        break;
1179
                                }
1180
                            }
1181
                        }
1182
                    }
1183
                }
1184
            }
1185
        }
1186

    
1187
        /// <summary>
1188
        /// 텍스트 컨트롤 하일라이트 처리
1189
        /// </summary>
1190
        /// <param name="sender"></param>
1191
        /// <param name="e"></param>
1192
        private void HighlightEvent(object sender, RoutedEventArgs e)
1193
        {
1194

    
1195
            ViewerDataModel.Instance.checkHighShape = (sender as CheckBox).IsChecked.Value;
1196
            SetHighlightEvent();
1197
            //if ((sender as CheckBox).IsChecked.Value)
1198
            //{
1199
            //    TaskMessage("HighLight가 설정되었습니다", TaskMessageType.Normal);
1200
            //}
1201
            //else
1202
            //{
1203
            //    TaskMessage("HighLight가 해제되었습니다", TaskMessageType.Caption);
1204
            //}
1205
            //if (ViewerDataModel.Instance.SelectedEditor as MarkupToPDF.Controls.Text.TextControl != null)
1206
            //{
1207
            //    MarkupToPDF.Controls.Text.TextControl instance = (ViewerDataModel.Instance.SelectedEditor as MarkupToPDF.Controls.Text.TextControl);
1208
            //    instance.IsHighLight = ViewerDataModel.Instance.checkHighShape;
1209
            //    instance.SetText();
1210
            //}
1211
        }
1212

    
1213
        //강인구 추가페이지 이동 엔터
1214
        private void tlcurrentPage_KeyDown(object sender, KeyEventArgs e)
1215
        {
1216
            //강인구 추가 tlcurrentPage을 이상하게 입력할수 있기때문에 Try Catch
1217
            if (e.Key == Key.Enter)
1218
            {
1219
                try
1220
                {
1221
                    var instanceMain = this.ParentOfType<MainWindow>();
1222
                    instanceMain.dzMainMenu.pageNavigator.GotoPage(Convert.ToInt32(tlcurrentPage.Text));
1223
                }
1224
                catch (Exception)
1225
                {
1226
                    RadWindow.Alert(new DialogParameters
1227
                    {
1228
                        Theme = new VisualStudio2013Theme(),
1229
                        Header = "안내",
1230
                        Content = "페이지 번호를 정확하게 입력해 주세요",
1231
                    });
1232
                }
1233
                
1234
            }
1235
        }
1236

    
1237
        public event EventHandler<WindowClosedEventArgs> Closed;
1238

    
1239
        //private void CheckEvent(object sender, RoutedEventArgs e)
1240
        //{
1241
        //    RadWindow CheckPop = new RadWindow();
1242
        //    test check = new test();
1243

    
1244
        //    CheckPop = new RadWindow
1245
        //    {
1246
        //        Width = 1700,
1247
        //        Height = 510,
1248
        //        Header = "My Check List",
1249
        //        Content = check,
1250
        //        Owner = this,
1251
        //        ResizeMode = System.Windows.ResizeMode.NoResize,
1252
        //        WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen,
1253
        //    };
1254
        //    StyleManager.SetTheme(CheckPop, new VisualStudio2013Theme());
1255

    
1256
        //    CheckPop.Closed += CheckPop_Closed;
1257
        //    CheckPop.ShowDialog();
1258
        //}
1259

    
1260
        private void PanoramaEvent(object sender, RoutedEventArgs e)
1261
        {
1262
            PanoramaShow();
1263
        }
1264

    
1265
        public void PanoramaShow()
1266
        {
1267
            Panorama check = new Panorama();
1268
            double screenWidth = System.Windows.SystemParameters.PrimaryScreenWidth;
1269
            double screenHeight = System.Windows.SystemParameters.PrimaryScreenHeight;
1270
            //double windowWidth = this.Width;
1271
            //double windowHeight = this.Height;
1272

    
1273
            var PanoramaPop = new RadWindow
1274
            {
1275
                //MinWidth = 600,
1276
                //MinHeight = 400,
1277
                //Header = "My Check List",
1278
                Header = "Document No : " + this.ParentOfType<MainWindow>().dzMainMenu._DocItem.DOCUMENT_NO + " / Revision :" + this.ParentOfType<MainWindow>().dzMainMenu._DocItem.REVISION,
1279
                Content = check,
1280
                Owner = this,
1281
                ResizeMode = System.Windows.ResizeMode.CanResizeWithGrip,
1282
                //ResizeMode = System.Windows.ResizeMode.NoResize,
1283
                WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen,
1284
                IsTopmost = false,
1285
                //Left = (screenWidth / 2) - (windowWidth / 2),
1286
                //Top = (screenHeight / 2) - (windowHeight / 2),
1287
                //Left = (screenWidth / 2),
1288
                //Top = (screenHeight / 2),
1289
                Width = screenWidth * 0.4,
1290
                Height = screenHeight * 0.4,
1291
            };
1292
            StyleManager.SetTheme(PanoramaPop, new VisualStudio2013Theme());
1293
            //CheckPop.ShowDialog();
1294
            PanoramaPop.Show();
1295
        }
1296

    
1297
        private void CheckEvent(object sender, RoutedEventArgs e)
1298
        {
1299
            //창이 떠있을 경우 재 실행 방지
1300
            if (isClosed)
1301
            {
1302
                //토글 및 마우스 상태 초기화
1303
                var toggleList = this.Parent.ChildrenOfType<RadToggleButton>();
1304
                foreach(var togle in toggleList)
1305
                {
1306
                    togle.IsChecked = false;
1307
                }
1308
                this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
1309

    
1310
                isClosed = false;
1311

    
1312
                
1313
                CheckList check = new CheckList();
1314

    
1315
                CheckPop = new RadWindow
1316
                {
1317
                    MinWidth = 1200,
1318
                    MinHeight = 500,
1319
                    //Header = "My Check List",
1320
                    Header = "Document No : " + this.ParentOfType<MainWindow>().dzMainMenu._DocItem.DOCUMENT_NO + " / Revision :" + this.ParentOfType<MainWindow>().dzMainMenu._DocItem.REVISION,
1321
                    Content = check,
1322
                    //Owner = this,
1323
                    //ResizeMode = System.Windows.ResizeMode.CanResizeWithGrip,
1324
                    ResizeMode = System.Windows.ResizeMode.NoResize,
1325
                    WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen,
1326
                    IsTopmost = true,
1327
                };
1328
                StyleManager.SetTheme(CheckPop, new Office2013Theme());
1329
                CheckPop.Closed += CheckPop_Closed;
1330
                
1331
                //CheckPop.ShowDialog();
1332
                CheckPop.Show();
1333
            }
1334
        }
1335

    
1336
        private void CheckPop_Closed(object sender, WindowClosedEventArgs e)
1337
        {
1338
            isClosed = true;
1339
            //this.ParentOfType<MainWindow>().dzMainMenu.PN_Navi.IsEnabled = true;
1340
            this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
1341
            ViewerDataModel.Instance.Capture_Opacity = 0;
1342
        }
1343

    
1344
        /// <summary>
1345
        /// 사용자가 선택한 페이지로 이동(썸네일 동기화 시킴)
1346
        /// </summary>
1347
        /// <param name="sender"></param>
1348
        /// <param name="e"></param>
1349
        private void PageGoEvent(object sender, RoutedEventArgs e)
1350
        {
1351
            RadButton button = sender as RadButton;
1352
            var instanceMain = this.ParentOfType<MainWindow>();
1353
            
1354
            //강인구 추가 tlcurrentPage을 이상하게 입력할수 있기때문에 Try Catch
1355
            try
1356
            {
1357
                switch (button.CommandParameter.ToString())
1358
                {
1359
                    case "Down":
1360
                        {
1361
                            instanceMain.dzMainMenu.pageNavigator.GotoPage(Convert.ToInt32(tlcurrentPage.Text) + 1);
1362
                        }
1363
                        break;
1364
                    case "Up":
1365
                        {
1366
                            instanceMain.dzMainMenu.pageNavigator.GotoPage(Convert.ToInt32(tlcurrentPage.Text) - 1);
1367
                        }
1368
                        break;
1369
                }
1370
            }
1371
            catch (Exception)
1372
            {
1373
                RadWindow.Alert(new DialogParameters
1374
                {
1375
                    Theme = new VisualStudio2013Theme(),
1376
                    Header = "안내",
1377
                    Content = "페이지 번호를 정확하게 입력해 주세요",
1378
                });
1379
            }
1380
        }
1381

    
1382
        private void viewEvent(object sender, RoutedEventArgs e)
1383
        {
1384
            RadRibbonToggleButton viewButton = sender as RadRibbonToggleButton;
1385
            var instanceMain = this.ParentOfType<MainWindow>();
1386

    
1387
            Point point = new Point(instanceMain.dzMainMenu.zoomAndPanCanvas.Width / 2, instanceMain.dzMainMenu.zoomAndPanCanvas.Height / 2);
1388

    
1389
            //if ((sender as RadRibbonToggleButton) != null)
1390
            //{
1391
            //    Common.ViewerDataModel.Instance.ControlTag = (sender as RadRibbonToggleButton).Tag.ToString();
1392
            //    instanceToggle = (sender as RadRibbonToggleButton);
1393
            //}
1394

    
1395
            //instanceToggle.IsChecked = false;
1396

    
1397
            switch (viewButton.CommandParameter.ToString())
1398
            {
1399
                case "zoomout":
1400
                    {
1401
                        //장원
1402
                        //instanceMain.dzMainMenu.zoomAndPanControl.ZoomTo(new Rect(0, 0, instanceMain.dzMainMenu.zoomAndPanCanvas.ActualWidth, instanceMain.dzMainMenu.zoomAndPanCanvas.ActualHeight));
1403
                        instanceMain.dzMainMenu.zoomAndPanControl.ZoomPointToViewportCenter(ViewerDataModel.Instance.ContentScale -= 0.1, point);
1404
                        viewButton.IsChecked = false;
1405
                        //Common.ViewerDataModel.Instance.zom
1406
                    }
1407
                    break;
1408
                case "zoomin":
1409
                    {
1410
                        instanceMain.dzMainMenu.zoomAndPanControl.ZoomPointToViewportCenter(ViewerDataModel.Instance.ContentScale += 0.1, point);
1411
                        viewButton.IsChecked = false;
1412
                    }
1413
                    break;
1414
                case "fullscreen":
1415
                    {
1416
                        instanceMain.WindowState = WindowState.Maximized;
1417
                        //Sizemode 대기(강인구)
1418
                        //instanceMain.dzMainMenu.imageViewer.SizeMode = Leadtools.Windows.Controls.SizeMode.Fit;
1419
                        instanceMain.dzMainMenu.zoomAndPanControl.ScaleToFit();
1420
                        viewButton.IsChecked = false;
1421
                    }
1422
                    break;
1423
                case "fitWidth":
1424
                    {
1425
                        instanceMain.dzMainMenu.zoomAndPanControl.ScaleToFit();
1426
                        viewButton.IsChecked = false;
1427
                    }
1428
                    break;
1429
                case "fitHeight":
1430
                    {
1431
                        instanceMain.dzMainMenu.zoomAndPanControl.ScaleToFit();
1432
                        viewButton.IsChecked = false;
1433
                    }
1434
                    break;
1435
                case "boundzoom":
1436
                    {
1437

    
1438
                    }
1439
                    break;
1440
                case "Rotate_M":
1441
                    {
1442
                        drawingPannelRotate(false);
1443
                        viewButton.IsChecked = false;
1444
                    }
1445
                    break;
1446
                case "Rotate_P":
1447
                    {
1448
                        drawingPannelRotate(true);
1449
                        viewButton.IsChecked = false;
1450
                    }
1451
                    break;
1452
                case "Rotate_half":
1453
                    {
1454
                        drawingPannelRotate(true);
1455
                        drawingPannelRotate(true);
1456
                        viewButton.IsChecked = false;
1457
                    }
1458
                    break;
1459
            }
1460
        }
1461

    
1462
        private void Control_Event(object sender, RoutedEventArgs e)
1463
        {
1464

    
1465
        }
1466

    
1467
        #region 대기
1468

    
1469
        public void drawingPannelRotate(bool Flag)
1470
        {
1471
            var instanceMain = this.ParentOfType<MainWindow>();
1472

    
1473
            //if (rotateOffSet > 3)
1474
            //    rotateOffSet = 0;
1475

    
1476
            //if (rotateOffSet < 0)
1477
            //    rotateOffSet = 3;
1478

    
1479
            if(Flag)
1480
            {
1481
                if (instanceMain.dzMainMenu.rotate.Angle == 270)
1482
                {
1483
                    instanceMain.dzMainMenu.rotate.Angle = 0;
1484
                }
1485
                else
1486
                {
1487
                    instanceMain.dzMainMenu.rotate.Angle += 90;
1488
                }
1489
            }
1490
            else
1491
            {
1492
                if(instanceMain.dzMainMenu.rotate.Angle == 0)
1493
                {
1494
                    instanceMain.dzMainMenu.rotate.Angle = 270;
1495
                }
1496
                else
1497
                {
1498
                    instanceMain.dzMainMenu.rotate.Angle -= 90;
1499
                }
1500
            }
1501
            //double angle = (double)rotateValue.GetValue(rotateOffSet);
1502
            //instanceMain.dzMainMenu.rotate.Angle = angle;
1503
            var rotationNum = Math.Abs((instanceMain.dzMainMenu.rotate.Angle / 90));
1504

    
1505
            if (instanceMain.dzMainMenu.zoomAndPanCanvas.Width == ViewerDataModel.Instance.ContentWidth)
1506
            {
1507
                double emptySize = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
1508
                instanceMain.dzMainMenu.zoomAndPanCanvas.Width = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
1509
                instanceMain.dzMainMenu.zoomAndPanCanvas.Height = emptySize;
1510
            }
1511
            if (instanceMain.dzMainMenu.rotate.Angle == 0)
1512
            {
1513
                instanceMain.dzMainMenu.translate.X = 0;
1514
                instanceMain.dzMainMenu.translate.Y = 0;
1515
            }
1516
            else if (instanceMain.dzMainMenu.rotate.Angle == 90)
1517
            {
1518
                instanceMain.dzMainMenu.translate.X = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
1519
                instanceMain.dzMainMenu.translate.Y = 0;
1520
            }
1521
            else if (instanceMain.dzMainMenu.rotate.Angle == 180)
1522
            {
1523
                instanceMain.dzMainMenu.translate.X = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
1524
                instanceMain.dzMainMenu.translate.Y = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
1525
            }
1526
            else
1527
            {
1528
                instanceMain.dzMainMenu.translate.X = 0;
1529
                instanceMain.dzMainMenu.translate.Y = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
1530
            }
1531

    
1532
            //instanceMain.dzMainMenu.zoomAndPanControl.RenderTransformOrigin = new Point(0.5, 0.5);
1533
            instanceMain.dzMainMenu.zoomAndPanControl.RotationAngle = instanceMain.dzMainMenu.rotate.Angle;
1534
            //대기(강인구)
1535
            //instanceMain.dzMainMenu.imageViewer.RotateAngle = instanceMain.dzMainMenu.rotate.Angle;
1536

    
1537

    
1538
            //instanceMain.dzMainMenu.imageViewer.RenderTransformOrigin = new Point(0.5, 0.5);
1539
            //RotateTransform rotateTransform = new RotateTransform(instanceMain.dzMainMenu.rotate.Angle);
1540
            //instanceMain.dzMainMenu.imageViewer.RenderTransform = rotateTransform;
1541

    
1542

    
1543
            ViewerDataModel.Instance.ContentWidth = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
1544
            ViewerDataModel.Instance.ContentHeight = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
1545
            ViewerDataModel.Instance.AngleOffsetX = instanceMain.dzMainMenu.translate.X;
1546
            ViewerDataModel.Instance.AngleOffsetY = instanceMain.dzMainMenu.translate.Y;
1547
            ViewerDataModel.Instance.Angle = instanceMain.dzMainMenu.rotate.Angle;
1548
            //ViewerDataModel.Instance.Document_Info.Clear();
1549
            //ViewerDataModel.Instance.Document_Info.Where(i => i.PAGE_NUMBER == instanceMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber).ToList().ForEach(value =>
1550
            //{
1551
            //    value.PAGE_ANGLE = int.Parse(instanceMain.dzMainMenu.rotate.Angle.ToString());
1552
            //});
1553

    
1554

    
1555
            //이미지 각도 변경 시 실시간 Thumbnail 각도 변경(강인구 추가)
1556
            instanceMain.dzMainMenu.pageNavigator._thumbnailItems.Where(info => info.PageNumber == instanceMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber).ToList().ForEach(data =>
1557
            {
1558
                data.Angle = int.Parse(instanceMain.dzMainMenu.rotate.Angle.ToString());
1559

    
1560
                instanceMain.dzMainMenu.pageNavigator.ImgListbox.ItemsSource = instanceMain.dzMainMenu.pageNavigator._thumbnailItems;
1561
                var instance = instanceMain.dzMainMenu.CurrentDoc.docInfo.DOCPAGE.Where(p => p.PAGE_NUMBER == instanceMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber).FirstOrDefault();
1562
                instance.PAGE_ANGLE = int.Parse(instanceMain.dzMainMenu.rotate.Angle.ToString());
1563

    
1564
                instanceMain.dzMainMenu.pageNavigator.setPageChange(data);
1565

    
1566
                //rotation page add or update
1567
                var rotationdoc = ViewerDataModel.Instance.RotationDocs.Where(d => d.ID == instance.ID).FirstOrDefault();
1568
                if (rotationdoc != null)
1569
                {
1570
                    rotationdoc.PAGE_ANGLE = instance.PAGE_ANGLE;
1571
                }
1572
                else
1573
                {
1574
                    ViewerDataModel.Instance.RotationDocs.Add(instance);
1575
                }
1576
            });
1577
        }
1578
        #endregion
1579

    
1580
        private void ImageConverter()
1581
        {
1582
            var instanceMain = this.ParentOfType<MainWindow>();
1583
            //http://cloud.devdoftech.co.kr:5977/ImageUpload/FileUpload.asmx
1584

    
1585

    
1586
            Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
1587
            dlg.Filter = "All files (*.*)|*.*|PNG Images (*.png)|*.png";
1588
            Nullable<bool> result = dlg.ShowDialog();
1589
            if (result == true)
1590
            {
1591
                instanceMain.dzMainMenu.filename = dlg.FileName;
1592
                instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ImgControl;
1593

    
1594
                System.IO.FileInfo fileInfo = new System.IO.FileInfo(instanceMain.dzMainMenu.filename);
1595
                String strFile = System.IO.Path.GetFileName(instanceMain.dzMainMenu.filename);
1596
                long numByte = fileInfo.Length;
1597
                double dLen = Convert.ToDouble(fileInfo.Length / 1000000);
1598
                kr.co.devdoftech.cloud.FileUpload fileUploader = new kr.co.devdoftech.cloud.FileUpload();
1599

    
1600
                if (dLen < 4)
1601
                {
1602
                    System.IO.FileStream fStream = new System.IO.FileStream(instanceMain.dzMainMenu.filename, System.IO.FileMode.Open, System.IO.FileAccess.Read);
1603
                    System.IO.BinaryReader br = new System.IO.BinaryReader(fStream);
1604
                    byte[] data = br.ReadBytes((int)numByte);
1605
                    br.Close();
1606

    
1607
                    instanceMain.dzMainMenu.filename = fileUploader.Run(App.ViewInfo.ProjectNO, instanceMain.dzMainMenu._DocItem.DOCUMENT_NO, App.ViewInfo.UserID, strFile, data);
1608
                    fStream.Close();
1609
                    fStream.Dispose();
1610
                }
1611
                else
1612
                {
1613
                    this.ParentOfType<MainWindow>().DialogMessage_Alert("Available Memory less than 4 mega byte", "Alert");
1614
                }
1615
            }
1616
        }
1617

    
1618
        private void Control_Init(RadToggleButton instanceToggle, object sender)
1619
        {
1620

    
1621
        }
1622

    
1623
        private void ControlEvent(object sender, RoutedEventArgs e)
1624
        {
1625
            RadToggleButton instanceToggle = sender as RadToggleButton;
1626
            var instanceMain = this.ParentOfType<MainWindow>();
1627

    
1628
            #region Ctrl + A 눌렀을 때 대처 방법 
1629
            //원인 : Ctrl + A를 누르면 UIElementSet에 등록을 시키지 않는다(이유는 한꺼번에 많은 양의 컨트롤의 동작이 유입되기 때문에
1630
            //       시스템의 성능저하를 불러올 수 있기 때문이다. 그래서 선택 후 다른 컨트롤을 누르면 등록되지 않은 컨트롤이기 때문에 삭제된다
1631
            //       이를 대처하는 방법으로 아래 코드를 사용한다.
1632
            if (Common.ViewerDataModel.Instance.MarkupControls.Count == 0 && Common.ViewerDataModel.Instance.MarkupControls.Count >= 1)
1633
            {
1634
                //var lstItem = instanceMain.DeepLayer._SelectLayer.ChildrenOfType<AdornerFinal>().ToList();
1635
                //foreach (var item in lstItem)
1636
                //{
1637
                //    foreach (var member in item.MemberSet)
1638
                //    {
1639
                //        if (!instanceMain.DeepLayer.UIElementSet.Contains(member.DrawingData))
1640
                //        {
1641
                //            instanceMain.DeepLayer.UIElementSet.Add(member.DrawingData);
1642
                //        }
1643
                //    }
1644
                //}
1645
            }
1646
            #endregion
1647

    
1648
            //if (!instanceMain.IsFreeSelectionMode)
1649
            //{
1650
            //    instanceMain.IsSwingMode = true;
1651
            //}
1652

    
1653
            #region 다른 컨트롤 버튼 선택 해제
1654
            System.Reactive.Linq.Observable2.FromPropertyChangedPattern(Common.ViewerDataModel.Instance, temp => temp.SelectedControl).Subscribe(ControlState =>
1655
            {
1656
                if (ControlState == null)
1657
                {
1658
                    instanceToggle.IsChecked = false;
1659
                    HiddenControlHide();
1660
                }
1661
            });
1662
            #endregion
1663

    
1664
            Release_ToggleButton(sender); //-> 해당 컨트롤을 제외한 모든 컨트롤에 대해 해제 처리
1665

    
1666
            if (instanceToggle != null)
1667
            {
1668
                Common.ViewerDataModel.Instance.ControlTag = instanceToggle.Tag.ToString();
1669
            }
1670
            else if ((sender as RadRibbonToggleButton) != null)
1671
            {
1672
                Common.ViewerDataModel.Instance.ControlTag = (sender as RadRibbonToggleButton).Tag.ToString();
1673
                instanceToggle = (sender as RadRibbonToggleButton);
1674
            }
1675
            else if ((sender as RadRibbonButton) != null)
1676
            {
1677
                RadRibbonButton instanceButton = sender as RadRibbonButton;
1678
                Common.ViewerDataModel.Instance.ControlTag = instanceButton.Tag.ToString();
1679
            }
1680
            else
1681
            {
1682
                RadButton instanceButton = sender as RadButton;
1683
                Common.ViewerDataModel.Instance.ControlTag = instanceButton.Tag.ToString();
1684
            }
1685

    
1686

    
1687

    
1688
            System.Reactive.Linq.Observable2.FromPropertyChangedPattern(Common.ViewerDataModel.Instance, temp => temp.AngleVisibility).Subscribe(isSee =>
1689
            {
1690
                instanceMain.dzMainMenu.MainAngle.Visibility = isSee;
1691
                System.Reactive.Linq.Observable2.FromPropertyChangedPattern(Common.ViewerDataModel.Instance, temp => temp.AngleValue).Subscribe(p =>
1692
                {
1693
                    instanceMain.dzMainMenu.MainAngle.AngleValue = p;
1694
                });
1695
            });
1696
            instanceMain.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Drawing;
1697

    
1698
            instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = false;
1699

    
1700
            if (instanceToggle.IsChecked != false)
1701
            {
1702
                #region 컨트롤이 체크되었다면
1703
                switch (instanceToggle.CommandParameter.ToString())
1704
                {
1705
                    #region Line
1706
                    case "Line":
1707
                        Common.ViewerDataModel.Instance.SelectedControl = "Line";
1708
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1709
                        if (instanceToggle.Tag.ToString() == "LineDelete")
1710
                        {
1711
                            //HiddenInterval.Visibility = Visibility.Visible;
1712
                        }
1713
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.SingleLine;
1714
                        break;
1715
                    #endregion
1716
                    #region ChainLine
1717
                    case "ChainLine":
1718
                        Common.ViewerDataModel.Instance.SelectedControl = "ChainLine";
1719
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1720
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ChainLine;
1721
                        break;
1722
                    #endregion
1723
                    #region DimLine
1724
                    case "DimLine":
1725
                        Common.ViewerDataModel.Instance.SelectedControl = "DimLine";
1726
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1727
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.DimLine;
1728
                        break;
1729
                    #endregion
1730
                    #region TwinLine
1731
                    case "TwinLine":
1732
                        Common.ViewerDataModel.Instance.SelectedControl = "TwinLine";
1733
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1734
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.TwinLine;
1735
                        break;
1736
                    #endregion
1737
                    #region CancelLine
1738
                    case "CancelLine":
1739
                        Common.ViewerDataModel.Instance.SelectedControl = "CancelLine";
1740
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1741
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.CancelLine;
1742
                        break;
1743
                    #endregion
1744
                    #region PolygonCloud
1745
                    case "PolygonCloud":
1746
                        Common.ViewerDataModel.Instance.SelectedControl = "PolygonCloud";
1747
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1748
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.PolygonCloud;
1749
                        break;
1750
                    #endregion
1751
                    #region RectCloud
1752
                    case "RectCloud":
1753
                        Common.ViewerDataModel.Instance.SelectedControl = "RectCloud";
1754
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1755
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.RectCloud;
1756
                        break;
1757
                    #endregion
1758
                    #region Rectangle
1759
                    case "Rectangle":
1760
                        Common.ViewerDataModel.Instance.SelectedControl = "Rectangle";
1761
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1762
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Rectangle;
1763
                        break;
1764
                    #endregion
1765
                    #region Triangle
1766
                    case "Triangle":
1767
                        Common.ViewerDataModel.Instance.SelectedControl = "Triangle";
1768
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1769
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Triangle;
1770
                        break;
1771
                    #endregion
1772
                    #region RectCloud
1773
                    case "Circle":
1774
                        Common.ViewerDataModel.Instance.SelectedControl = "Circle";
1775
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1776
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Circle;
1777
                        break;
1778
                    #endregion
1779
                    #region Symbol
1780
                    case "Symbol":
1781
                        Common.ViewerDataModel.Instance.SelectedControl = "Symbol";
1782
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
1783
                        break;
1784
                    #endregion
1785
                    #region SymbolN
1786
                    case "SymbolN":
1787
                        Common.ViewerDataModel.Instance.SelectedControl = "SymbolN";
1788
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Stamp;
1789
                        break;
1790
                    #endregion
1791
                    #region Text
1792
                    case "Text":
1793
                        Common.ViewerDataModel.Instance.SelectedControl = "Text";
1794
                        TaskMessage("Text 도구는 텍스트 영역을 더블 클릭하여 텍스트를 재 편집 할 수 있습니다", TaskMessageType.Normal);
1795
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.TextControl;
1796
                        break;
1797
                    #endregion
1798
                    #region TextBorder
1799
                    case "TextBorder":
1800
                        Common.ViewerDataModel.Instance.SelectedControl = "TextBorder";
1801
                        TaskMessage("Text 도구는 텍스트 영역을 더블 클릭하여 텍스트를 재 편집 할 수 있습니다", TaskMessageType.Normal);
1802
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.TextBorder;
1803
                        break;
1804
                    #endregion
1805
                    #region TextCloud
1806
                    case "TextCloud":
1807
                        Common.ViewerDataModel.Instance.SelectedControl = "TextCloud";
1808
                        TaskMessage("Text 도구는 텍스트 영역을 더블 클릭하여 텍스트를 재 편집 할 수 있습니다", TaskMessageType.Normal);
1809
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.TextCloud;
1810
                        break;
1811
                    #endregion
1812
                    #region Date
1813
                    case "Date":
1814
                        Common.ViewerDataModel.Instance.SelectedControl = "Date";
1815
                        TaskMessage("날짜 컨트롤을 더블 클릭하면 날짜를 변경할 수 있습니다", TaskMessageType.Normal);
1816
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Date;
1817
                        break;
1818
                    #endregion
1819
                    #region ArrowText
1820
                    case "ArrowText":
1821
                        TaskMessage("ArrowText 컨트롤은 그린 후 컨트롤을 선택하였을 시 중간점을 조정할 수 있습니다", TaskMessageType.Normal);
1822
                        if (instanceToggle.Tag.ToString() == "ArrowText_Cloud")
1823
                        {
1824
                            Common.ViewerDataModel.Instance.SelectedControl = "ArrowText_Cloud";
1825
                            instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowTextCloudControl;
1826
                        }
1827
                        else if (instanceToggle.Tag.ToString() == "ArrowText_Border")
1828
                        {
1829
                            Common.ViewerDataModel.Instance.SelectedControl = "ArrowTextBorderControl";
1830
                            instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowTextBorderControl;
1831
                        }
1832
                        else if (instanceToggle.Tag.ToString() == "ArrowTextFix_Normal")
1833
                        {
1834
                            Common.ViewerDataModel.Instance.SelectedControl = "ArrowTransTextControl";
1835
                            instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowTransTextControl;
1836
                        }
1837
                        else if (instanceToggle.Tag.ToString() == "ArrowTextFix_Border")
1838
                        {
1839
                            Common.ViewerDataModel.Instance.SelectedControl = "ArrowTransTextBorderControl";
1840
                            instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowTransTextBorderControl;
1841
                        }
1842
                        else if (instanceToggle.Tag.ToString() == "ArrowTextFix_Cloud")
1843
                        {
1844
                            Common.ViewerDataModel.Instance.SelectedControl = "ArrowTransTextCloudControl";
1845
                            instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowTransTextCloudControl;
1846
                        }
1847
                        else
1848
                        {
1849
                            Common.ViewerDataModel.Instance.SelectedControl = "ArrowText";
1850
                            instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowTextControl;
1851
                            //HiddenAxisLock.Visibility = Visibility.Visible;
1852
                        }
1853
                        break;
1854
                    #endregion
1855
                    #region Arrow
1856
                    case "Arrow":
1857
                        Common.ViewerDataModel.Instance.SelectedControl = "Arrow";
1858
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1859
                        //HiddenDimSize.Visibility = Visibility.Visible;
1860
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowLine;
1861
                        break;
1862
                    #endregion
1863
                    #region Shape
1864
                    case "Shape":
1865
                        Common.ViewerDataModel.Instance.SelectedControl = "Shape";
1866
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Mark;
1867
                        break;
1868
                    #endregion
1869
                    #region Polygon
1870
                    case "Polygon":
1871
                        Common.ViewerDataModel.Instance.SelectedControl = "Polygon";
1872
                        TaskMessage("자유형 코멘트 도구는 오른쪽 마우스 클릭을 통해 그리기를 마칠 수 있습니다", TaskMessageType.Normal);
1873
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1874
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.PolygonControl;
1875
                        break;
1876
                    #endregion
1877
                    #region Arc
1878
                    case "Arc":
1879
                        Common.ViewerDataModel.Instance.SelectedControl = "Arc";
1880
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArcLine;
1881
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1882
                        TaskMessage("Arc 코멘트 도구는 오른쪽 마우스를 사용해 좌우 반전을 사용하실 수 있습니다", TaskMessageType.Normal);
1883
                        break;
1884
                    #endregion
1885
                    #region ArrowMulti
1886
                    case "ArrowMulti":
1887
                        Common.ViewerDataModel.Instance.SelectedControl = "ArrowMulti";
1888
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowMultiLine;
1889
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1890
                        break;
1891
                    #endregion
1892
                    #region Etc
1893
                    case "Etc":
1894
                        Common.ViewerDataModel.Instance.SelectedControl = "Etc";
1895
                        break;
1896
                    #endregion
1897
                    #region Ink
1898
                    case "Ink":
1899
                        if (instanceToggle.Tag.ToString() == "EraserClear")
1900
                        {
1901
                            TaskMessage("해당 컨트롤은 점 단위로 그려진 펜을 지웁니다", TaskMessageType.Normal);
1902
                            //instanceMain.dzMainMenu.inkDrawingCanvas.EditingMode = InkCanvasEditingMode.EraseByPoint;
1903
                            instanceMain.dzMainMenu.inkBoard.Tag = "EraseByPoint";
1904
                        }
1905
                        else if (instanceToggle.Tag.ToString() == "Eraser")
1906
                        {
1907
                            TaskMessage("해당 컨트롤은 선 단위로 그려진 펜을 지웁니다", TaskMessageType.Normal);
1908
                            instanceMain.dzMainMenu.inkBoard.Tag = "EraseByStroke";
1909
                            //instanceMain.dzMainMenu.inkDrawingCanvas.EditingMode = InkCanvasEditingMode.EraseByStroke;
1910
                        }
1911
                        else
1912
                        {
1913
                            instanceMain.dzMainMenu.inkBoard.Tag = "Ink";
1914
                            //instanceMain.dzMainMenu.inkDrawingCanvas.EditingMode = InkCanvasEditingMode.Ink;
1915
                        }
1916

    
1917
                        //instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = true;
1918

    
1919
                        Common.ViewerDataModel.Instance.SelectedControl = "Ink";
1920
                        Common.ViewerDataModel.Instance.LineSize = (double)cbLineSize.Value;
1921
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.PenControl;
1922
                        break;
1923
                    #endregion
1924
                    #region Select
1925
                    case "Select":
1926
                        if(this.ParentOfType<MainWindow>().dzMainMenu.currentControl != null)
1927
                        {
1928
                            ViewerDataModel.Instance.MarkupControls_USER.Remove(this.ParentOfType<MainWindow>().dzMainMenu.currentControl);
1929
                            this.ParentOfType<MainWindow>().dzMainMenu.currentControl = null;
1930
                        }
1931
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Selecting;
1932
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
1933
                        instanceMain.dzMainMenu.isLeftMouseButtonDownOnWindow = false;
1934
                        break;
1935
                    #endregion
1936
                    #region Image
1937
                    case "Image":
1938
                        Common.ViewerDataModel.Instance.SelectedControl = "ImgControl";
1939
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ImgControl;
1940
                        ImageConverter();
1941
                        break;
1942
                    #endregion
1943
                    #region Sign
1944
                    case "Sign":
1945
                        Common.ViewerDataModel.Instance.SelectedControl = "Sign";
1946
                        Common.ViewerDataModel.Instance.ControlTag = instanceMain.dzMainMenu._ViewInfo.UserID; //사번
1947
                        //강인구 추가
1948
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Sign;
1949
                        //instanceMain.BaseClient.GetUserSignCompleted += (sen, ea) =>
1950
                        //{
1951
                        //    if (ea.Result == null)
1952
                        //    {
1953

    
1954
                        //        this.ParentOfType<MainPage>().DialogMessage_Alert("You Don't Have Sign Data", "Alert");
1955
                        //    }
1956
                        //    else
1957
                        //    {
1958
                        //        byte[] imageBytes = System.Convert.FromBase64String(ea.Result);
1959
                        //        using (MemoryStream ms = new MemoryStream(imageBytes))
1960
                        //        {
1961
                        //            BitmapImage im = new BitmapImage();
1962
                        //            im.SetSource(ms);
1963
                        //            instanceMain.DeepLayer.SignImage = im;
1964
                        //            ms.Close();
1965
                        //        }
1966
                        //    }
1967
                        //};
1968
                        //instanceMain.BaseClient.GetUserSignAsync(instanceMain._ViewInfo.UserID);
1969
                        break;
1970
                    #endregion
1971
                    #region Check
1972
                    case "Check":
1973
                        Common.ViewerDataModel.Instance.SelectedControl = "Check";
1974
                        Common.ViewerDataModel.Instance.ControlTag = instanceMain.dzMainMenu._ViewInfo.UserID; //사번
1975
                        //강인구 추가
1976
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Symbol;
1977
                        break;
1978
                    #endregion
1979
                    #region Batch
1980
                    case "Batch":
1981
                        Common.ViewerDataModel.Instance.SelectedControl = "Batch";
1982
                        Common.ViewerDataModel.Instance.ControlTag = instanceMain.dzMainMenu._ViewInfo.UserID; //사번
1983
                        //강인구 추가
1984
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Mark;
1985
                        instanceMain.dzMainMenu.txtBatch.Visibility = Visibility.Visible;
1986
                        instanceMain.dzMainMenu.txtBatch.Text = "Place Mark";
1987
                        break;
1988
                    #endregion
1989
                    #region Copy
1990
                    case "Copy":
1991
                        Copy_Start();
1992
                        instanceToggle.IsChecked = false;
1993
                        ViewerDataModel.Instance.SelectedControl = "";
1994
                        ViewerDataModel.Instance.ControlTag = null;
1995
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
1996
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
1997
                        break;
1998
                    #endregion
1999
                    #region Cut
2000
                    case "Cut":
2001
                        Cut_Start();
2002
                        instanceToggle.IsChecked = false;
2003
                        ViewerDataModel.Instance.SelectedControl = "";
2004
                        ViewerDataModel.Instance.ControlTag = null;
2005
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2006
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2007
                        break;
2008
                    #endregion
2009
                    #region Paste
2010
                    case "Paste":
2011
                        Paste_Start();
2012
                        instanceToggle.IsChecked = false;
2013
                        ViewerDataModel.Instance.SelectedControl = "";
2014
                        ViewerDataModel.Instance.ControlTag = null;
2015
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2016
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;                        
2017
                        break;
2018
                    #endregion
2019
                    #region Delete
2020
                    case "Delete":
2021
                        Delete_Start();
2022
                        instanceToggle.IsChecked = false;
2023
                        ViewerDataModel.Instance.SelectedControl = "";
2024
                        ViewerDataModel.Instance.ControlTag = null;
2025
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2026
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2027
                        break;
2028
                    #endregion
2029
                    #region Undo
2030
                    case "Undo":
2031
                        this.ParentOfType<MainWindow>().dzMainMenu.Undo();
2032
                        instanceToggle.IsChecked = false;
2033
                        ViewerDataModel.Instance.SelectedControl = "";
2034
                        ViewerDataModel.Instance.ControlTag = null;
2035
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2036
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2037
                        break;
2038
                    #endregion
2039
                    #region Redo
2040
                    case "Redo":
2041
                        this.ParentOfType<MainWindow>().dzMainMenu.Redo();
2042
                        instanceToggle.IsChecked = false;
2043
                        ViewerDataModel.Instance.SelectedControl = "";
2044
                        ViewerDataModel.Instance.ControlTag = null;
2045
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2046
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2047
                        break;
2048
                    #endregion
2049
                    #region DragZoom
2050
                    case "DragZoom":
2051
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.DragZoom;
2052
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2053
                        instanceMain.dzMainMenu.isLeftMouseButtonDownOnWindow = false;
2054
                        break;
2055
                    #endregion
2056

    
2057
                    default:
2058
                        break;
2059
                }
2060
                #endregion
2061
            }
2062
            else
2063
            {
2064

    
2065
                if (!instanceMain.dzMainMenu.IsFreeSelectionMode)
2066
                {
2067
                    instanceMain.dzMainMenu.IsSwingMode = false;
2068
                    Common.ViewerDataModel.Instance.SelectedControl = "";
2069
                    Common.ViewerDataModel.Instance.ControlTag = null;
2070
                    this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2071
                    this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2072
                }
2073
            }
2074
        }
2075

    
2076
        private void cbAutoSave_Checked(object sender, RoutedEventArgs e)
2077
        {
2078
            if(cbAutoSave.IsChecked == true)
2079
            {
2080
                SaveTime(true, (int)cbSaveInterval.Value);
2081
            }
2082
            else
2083
            {
2084
                SaveTime(false, (int)cbSaveInterval.Value);
2085
            }
2086
        }
2087
        private void cbSaveInterval_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
2088
        {
2089
            if (cbAutoSave.IsChecked == true)
2090
            {
2091
                SaveTime(true, (int)cbSaveInterval.Value);
2092
            }            
2093
        }
2094
        //강인구 자동 저장 추가
2095
        private void AutoSave(object sender, RoutedEventArgs e)
2096
        {
2097
            RadToggleButton instanceToggle = sender as RadToggleButton;
2098

    
2099
            if(instanceToggle.IsChecked == true)
2100
            {
2101
                SaveTime(true);
2102
            }
2103
            else
2104
            {
2105
                SaveTime(false);
2106
            }
2107
        }
2108

    
2109
        public void Copy_Start()
2110
        {
2111
            if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
2112
            {
2113
                string MarkupData = "";
2114

    
2115
                foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
2116
                {
2117
                    if (item.GetType().Name == "AdornerFinal")
2118
                    {
2119
                        foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
2120

    
2121
                        {
2122
                            if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
2123
                            {
2124
                                markupReturn = layer.MarkupToString(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo, App.ViewInfo.UserID);
2125
                                MarkupData += "|OR|" + markupReturn.ConvertData;
2126
                            }
2127
                        }
2128
                        Clipboard.SetText(MarkupData);
2129
                    }
2130
                }
2131
            }
2132
        }
2133

    
2134
        public void Cut_Start()
2135
        {
2136
            if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
2137
            {
2138
                foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
2139
                {
2140
                    string MarkupData = "";
2141

    
2142
                    if (item.GetType().Name == "AdornerFinal")
2143
                    {
2144
                        foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
2145
                        {
2146
                            if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
2147
                            {
2148
                                markupReturn = layer.MarkupToString(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo, App.ViewInfo.UserID);
2149
                                MarkupData += "|OR|" + markupReturn.ConvertData;
2150
                            }
2151
                        }
2152
                        //클립보드에 넣음
2153
                        Clipboard.SetText(MarkupData);
2154
                    }
2155
                }
2156
                this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Clear();
2157
            }
2158
        }
2159

    
2160
        public void Paste_Start()
2161
        {
2162
            //마크업 붙여넣기
2163
            //if (Clipboard.GetText().Contains("|DZ|"))
2164
            if (Clipboard.GetText().Contains("|OR||DZ|"))
2165
            {
2166
                List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>();
2167

    
2168
                string[] delimiterChars = { "|OR|" };
2169
                string[] data = Clipboard.GetText().Split(delimiterChars, StringSplitOptions.RemoveEmptyEntries);
2170

    
2171
                this.ParentOfType<MainWindow>().dzMainMenu.ReleaseAdorner();
2172

    
2173
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
2174

    
2175
                //강인구 Undo/Redo 보류
2176
                UndoData = new Undo_data()
2177
                {
2178
                    IsUndo = false,
2179
                    Event = Event_Type.Create,
2180
                    EventTime = DateTime.Now,
2181
                    Markup_List = new List<Multi_Undo_data>()
2182
                };
2183

    
2184
                ViewerDataModel.Instance.UndoDataList.Where(data1 => data1.IsUndo == true).ToList().ForEach(i =>
2185
                {
2186
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
2187
                });
2188

    
2189
                foreach (string parse in data)
2190
                {
2191
                    if (parse != "")
2192
                    {
2193
                        System.Windows.Controls.Control item = layer.markupParse_Paste(parse, ViewerDataModel.Instance.MarkupControls_USER);
2194
                        (item as MarkupToPDF.Common.CommentUserInfo).CommentID = Events.Save.shortGuid();
2195

    
2196
                        ViewerDataModel.Instance.MarkupControls.Remove(item as MarkupToPDF.Common.CommentUserInfo);
2197
                        ViewerDataModel.Instance.MarkupControls_USER.Remove(item as MarkupToPDF.Common.CommentUserInfo);
2198

    
2199
                        adornerSet.Add(item as MarkupToPDF.Common.CommentUserInfo);
2200

    
2201
                        //Controls.AdornerFinal final = new Controls.AdornerFinal(item as MarkupToPDF.Common.CommentUserInfo);
2202
                        //this.dzMainMenu.SelectLayer.Children.Add(final);
2203

    
2204
                        multi_Undo_Data = this.ParentOfType<MainWindow>().dzMainMenu.Control_Style(item as MarkupToPDF.Common.CommentUserInfo);
2205

    
2206
                        UndoData.Markup_List.Add(multi_Undo_Data);
2207
                        ViewerDataModel.Instance.UndoDataList.Add(UndoData);                        
2208
                    }
2209
                }
2210
                Controls.AdornerFinal final = new Controls.AdornerFinal(adornerSet);
2211

    
2212
                if(this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.X < 0)
2213
                {
2214
                    Canvas.SetLeft(final, 0);
2215
                    Canvas.SetTop(final, 0);
2216
                }
2217
                else
2218
                {
2219
                    double realPointX = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.X - final.BorderSize.X - (final.BorderSize.Width / 2);
2220
                    double realPointY = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.Y - final.BorderSize.Y - (final.BorderSize.Height / 2);
2221
                    final.MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(realPointX, realPointY));
2222

    
2223
                    if (final.MemberSet.Where(type => type.Drawingtype == MarkupToPDF.Controls.Common.ControlType.TextControl).FirstOrDefault() != null)
2224
                    {
2225
                        final.MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(0.001, 0.001)); //dummy
2226
                    }
2227

    
2228
                }
2229
                
2230

    
2231
                this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Add(final);
2232

    
2233
                //붙여 넣을때 원본 컨트롤과 겹치지 않도록 설정
2234
                //Canvas.SetLeft(final, 50);
2235
                //Canvas.SetTop(final, 50);
2236
            }
2237
            //외부 이미지 붙여넣기
2238
            else if (Clipboard.GetImage() != null)
2239
            {
2240
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
2241

    
2242
                //강인구 Undo/Redo 보류
2243
                UndoData = new Undo_data()
2244
                {
2245
                    IsUndo = false,
2246
                    Event = Event_Type.Create,
2247
                    EventTime = DateTime.Now,
2248
                    Markup_List = new List<Multi_Undo_data>()
2249
                };
2250

    
2251

    
2252
                string temppath = System.IO.Path.GetTempPath();
2253
                //string filename = KCOM.Events.Save.shortCommentKey();
2254
                string filename = KCOM.Events.Save.shortFileKey();
2255

    
2256
                System.Drawing.Image clipboardImage = System.Windows.Forms.Clipboard.GetImage();
2257
                clipboardImage.Save(temppath + "\\" + filename);
2258

    
2259
                System.IO.FileInfo fileInfo = new System.IO.FileInfo(temppath + "\\" + filename);
2260
                String strFile = System.IO.Path.GetFileName(fileInfo.FullName);
2261
                long numByte = fileInfo.Length;
2262
                double dLen = Convert.ToDouble(fileInfo.Length / 1000000);
2263
                kr.co.devdoftech.cloud.FileUpload fileUploader = new kr.co.devdoftech.cloud.FileUpload();
2264

    
2265
                if (dLen < 4)
2266
                {
2267
                    System.IO.FileStream fStream = new System.IO.FileStream(fileInfo.FullName,
2268
                    System.IO.FileMode.Open, System.IO.FileAccess.Read);
2269
                    System.IO.BinaryReader br = new System.IO.BinaryReader(fStream);
2270
                    byte[] data = br.ReadBytes((int)numByte);
2271

    
2272
                    filename = fileUploader.Run(App.ViewInfo.ProjectNO, this.ParentOfType<MainWindow>().dzMainMenu._DocItem.DOCUMENT_NO, App.ViewInfo.UserID, strFile + ".png", data);
2273
                    br.Close();
2274
                    fStream.Close();
2275
                    fStream.Dispose();
2276
                }
2277
                else
2278
                {
2279
                    this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert("Available Memory less than 4 mega byte", "Alert");
2280
                    return;
2281
                }
2282

    
2283
                fileInfo.Delete();
2284

    
2285
                //System.Drawing.Image clipboardImage = System.Windows.Forms.Clipboard.GetImage();
2286
                System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(clipboardImage);
2287
                IntPtr hBitmap = bmp.GetHbitmap();
2288
                System.Windows.Media.ImageSource WpfBitmap = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(hBitmap, IntPtr.Zero, Int32Rect.Empty, System.Windows.Media.Imaging.BitmapSizeOptions.FromEmptyOptions());
2289
                Image img = new Image();
2290
                img.Source = new System.Windows.Media.Imaging.BitmapImage(new Uri(filename));
2291

    
2292

    
2293

    
2294

    
2295

    
2296
                var currentControl = new MarkupToPDF.Controls.Etc.ImgControl
2297
                {
2298
                    PointSet = new List<Point>(),
2299
                    FilePath = img.Source.ToString(),
2300
                    ImageData = img.Source,
2301
                    StartPoint = new Point(100, 100),
2302
                    EndPoint = new Point(200, 200),
2303
                    TopRightPoint = new Point(100, 200),
2304
                    LeftBottomPoint = new Point(200, 100)
2305
                };
2306

    
2307
                currentControl.TopRightPoint = new Point(currentControl.StartPoint.X + clipboardImage.Width, currentControl.StartPoint.Y);
2308
                currentControl.LeftBottomPoint = new Point(currentControl.StartPoint.X, currentControl.StartPoint.Y + clipboardImage.Height);
2309
                currentControl.EndPoint = new Point(currentControl.StartPoint.X + clipboardImage.Width, currentControl.StartPoint.Y + clipboardImage.Height);
2310

    
2311
                currentControl.PointSet = new List<Point>
2312
                                        {
2313
                                            currentControl.StartPoint,
2314
                                            currentControl.LeftBottomPoint,
2315
                                            currentControl.EndPoint,
2316
                                            currentControl.TopRightPoint,
2317
                                        };
2318

    
2319
                multi_Undo_Data = this.ParentOfType<MainWindow>().dzMainMenu.Control_Style(currentControl as MarkupToPDF.Common.CommentUserInfo);
2320
                UndoData.Markup_List.Add(multi_Undo_Data);
2321
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
2322

    
2323
                ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl as MarkupToPDF.Common.CommentUserInfo);
2324
                currentControl.CommentID = Events.Save.shortGuid();
2325

    
2326
                currentControl.ApplyTemplate();
2327
                currentControl.SetImage();
2328

    
2329
                ViewerDataModel.Instance.MarkupControls_USER.Remove(currentControl as MarkupToPDF.Common.CommentUserInfo);
2330
                Controls.AdornerFinal final = new Controls.AdornerFinal(currentControl as MarkupToPDF.Common.CommentUserInfo);
2331
                this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Add(final);
2332

    
2333
                double realPointX = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.X - final.BorderSize.X - (final.BorderSize.Width / 2);
2334
                double realPointY = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.Y - final.BorderSize.Y - (final.BorderSize.Height / 2);
2335
                final.MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(realPointX, realPointY));
2336

    
2337
            }
2338
        }
2339

    
2340
        public void Delete_Start()
2341
        {
2342
            if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
2343
            {
2344
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
2345

    
2346
                UndoData = new Undo_data()
2347
                {
2348
                    IsUndo = false,
2349
                    Event = Event_Type.Delete,
2350
                    EventTime = DateTime.Now,
2351
                    Markup_List = new List<Multi_Undo_data>()
2352
                };
2353

    
2354
                foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
2355
                {
2356
                    if (item.GetType().Name == "AdornerFinal")
2357
                    {
2358
                        (item as Controls.AdornerFinal).unRegister();
2359

    
2360
                        foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
2361
                        {
2362
                            //if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
2363
                            if (!ViewerDataModel.Instance.MarkupControls_USER.Contains(InnerItem.DrawingData))
2364
                            {
2365

    
2366
                                multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
2367
                                UndoData.Markup_List.Add(multi_Undo_Data);
2368
                                multi_Undo_Data = new Multi_Undo_data();
2369

    
2370
                                ViewerDataModel.Instance.MarkupControls.Remove(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo);
2371

    
2372
                                var Item_ = ViewerDataModel.Instance.MarkupList_USER.Where(d => d.ID == (InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo).CommentID).FirstOrDefault();
2373

    
2374
                                ViewerDataModel.Instance.MarkupList_USER.Remove(Item_);
2375

    
2376
                                //임시파일에서도 삭제한다.
2377
                                temp.DelTemp((InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo).CommentID, this.ParentOfType<MainWindow>().dzMainMenu.pageNavigator.CurrentPage.PageNumber.ToString());
2378
                                
2379
                            }
2380
                        }
2381
                    }
2382

    
2383
                    ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
2384
                    {
2385
                        ViewerDataModel.Instance.UndoDataList.Remove(i);
2386
                    });
2387
                    ViewerDataModel.Instance.UndoDataList.Add(UndoData);
2388
                }
2389
            }
2390
            this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Clear();
2391
        }
2392

    
2393
    }
2394
}
클립보드 이미지 추가 (최대 크기: 500 MB)