프로젝트

일반

사용자정보

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

markus / KCOM / Events / Implementation / TopMenuEvent.cs @ 40b3ce25

이력 | 보기 | 이력해설 | 다운로드 (119 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

    
568
            Logger.sendReqLog("GetPrintDocItemList: ", App.ViewInfo.ProjectNO + "," + App.ViewInfo.DocumentItemID + "," + ViewerDataModel.Instance._markupInfoList.ToList(), 1);
569
            markupinfo = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.GetPrintDocItemList(App.ViewInfo.ProjectNO, App.ViewInfo.DocumentItemID, ViewerDataModel.Instance._markupInfoList.ToList());
570

    
571
            if (markupinfo.Count() > 0)
572
            {
573
                Logger.sendResLog("GetPrintDocItemList", "TRUE", 1);
574
            }
575
            else
576
            {
577
                Logger.sendResLog("GetPrintDocItemList", "FALSE", 1);
578
            }
579

    
580
            var Tile_Url = string.Format(@"{0}/TileSource/{1}_Tile/{2}/{3}/",
581
                App.SystemInfo.HostName,
582
                App.ViewInfo.ProjectNO,
583
                (Convert.ToInt64(App.ViewInfo.DocumentItemID) / 100).ToString(),
584
                App.ViewInfo.DocumentItemID
585
                );
586

    
587
            PrintWindow.Content = new KCOM.Control.PrintControl(
588
                      Tile_Url,
589
                      App.ViewInfo.ProjectNO,
590
                      this.ParentOfType<MainWindow>().dzMainMenu._DocInfo, markupinfo,
591
                      this.ParentOfType<MainWindow>().dzMainMenu.pageNavigator.CurrentPage.PageNumber,
592
                      App.ViewInfo.DocumentItemID,
593
                      this.ParentOfType<MainWindow>().dzMainMenu._DocItem.DOCUMENT_NO,
594
                      this.ParentOfType<MainWindow>().dzMainMenu._DocItem.ORIGINAL_FILE, isprint);
595

    
596
            //프린트 팝업 옵션
597
            //PrintWindow.BorderThickness = new Thickness(3);
598
            //PrintWindow.BorderBrush = new SolidColorBrush(Color.FromArgb(255, 37, 160, 218));
599
            PrintWindow.ResizeMode = System.Windows.ResizeMode.NoResize;
600
            PrintWindow.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
601
            PrintWindow.Background = new SolidColorBrush(Colors.Black);
602
            PrintWindow.Background.Opacity = 0.6;
603

    
604
            Telerik.Windows.Controls.StyleManager.SetTheme(PrintWindow, new Telerik.Windows.Controls.VisualStudio2013Theme());
605
            PrintWindow.ShowDialog();
606
        }
607

    
608
        //강인구 추가
609
        private void PrintEvent(object sender, RoutedEventArgs e)
610
        {
611
            RadRibbonButton button = sender as RadRibbonButton;
612
            Print_Start(button.Content.ToString());
613
        }
614

    
615
        private List<AdornerMember> GetAdornerItem()
616
        {
617
            List<AdornerMember> AdonerList = new List<AdornerMember>();
618

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

    
658
                foreach (AdornerMember InnerItem in AdonerList)
659
                {
660
                    InnerItem.DrawingData.Opacity = ViewerDataModel.Instance.ControlOpacity;
661
                  
662
                    multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
663
                    UndoData.Markup_List.Add(multi_Undo_Data);
664
                    multi_Undo_Data = new Multi_Undo_data();
665
                }
666

    
667
                ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
668
                {
669
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
670
                });
671
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
672
            }
673
        }
674

    
675
        //강인구 추가(Undo End)
676
        private void cbLineSize_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
677
        {
678
            if (string.IsNullOrEmpty(cbLineSize.Value.ToString()))
679
            {
680
                cbLineSize.Value = cbLineSize.Minimum;
681
            }
682
            List<AdornerMember> AdonerList = GetAdornerItem();
683
            if (AdonerList.Count > 0)
684
            {
685
                Undo_data UndoData = new Undo_data()
686
                {
687
                    IsUndo = false,
688
                    Event = Event_Type.Option,
689
                    EventTime = DateTime.Now,
690
                    LineSize = ViewerDataModel.Instance.LineSize,
691
                    Markup_List = new List<Multi_Undo_data>()
692
                };
693
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
694

    
695
                foreach (AdornerMember InnerItem in AdonerList)
696
                {
697
                    switch (InnerItem.DrawingData.GetType().Name)
698
                    {
699
                        case ("LineControl"):
700
                            {
701
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Line.LineControl).LineSize = ViewerDataModel.Instance.LineSize;
702
                            }
703
                            break;
704
                        case ("ArcControl"):
705
                            {
706
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Line.ArcControl).LineSize = ViewerDataModel.Instance.LineSize;
707
                            }
708
                            break;
709
                        case ("ArrowArcControl"):
710
                            {
711
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Line.ArrowArcControl).LineSize = ViewerDataModel.Instance.LineSize;
712
                            }
713
                            break;
714
                        case ("ArrowControl_Multi"):
715
                            {
716
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Line.ArrowControl_Multi).LineSize = ViewerDataModel.Instance.LineSize;
717
                            }
718
                            break;
719
                        case ("CloudControl"):
720
                            {
721
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Polygon.CloudControl).LineSize = ViewerDataModel.Instance.LineSize;
722
                            }
723
                            break;
724
                        case ("PolygonControl"):
725
                            {
726
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Polygon.PolygonControl).LineSize = ViewerDataModel.Instance.LineSize;
727
                            }
728
                            break;
729
                        case ("RectangleControl"):
730
                            {
731
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.RectangleControl).LineSize = ViewerDataModel.Instance.LineSize;
732
                            }
733
                            break;
734
                        case ("RectCloudControl"):
735
                            {
736
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.RectCloudControl).LineSize = ViewerDataModel.Instance.LineSize;
737
                            }
738
                            break;
739
                        case ("TriControl"):
740
                            {
741
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.TriControl).LineSize = ViewerDataModel.Instance.LineSize;
742
                            }
743
                            break;
744
                        case ("CircleControl"):
745
                            {
746
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.CircleControl).LineSize = ViewerDataModel.Instance.LineSize;
747
                            }
748
                            break;
749
                    }
750
                    
751

    
752
                    multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
753
                    UndoData.Markup_List.Add(multi_Undo_Data);
754
                    multi_Undo_Data = new Multi_Undo_data();
755
                }
756

    
757
                ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
758
                {
759
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
760
                });
761
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
762

    
763
                
764
            }
765
            KCOM.Properties.Settings.Default.LineSize = (double)cbLineSize.Value;
766
            Properties.Settings.Default.Save();
767
        }
768

    
769

    
770
        private void cbIntervalSize_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
771
        {
772
            if (string.IsNullOrEmpty(cbIntervalSize.Value.ToString()))
773
            {
774
                cbIntervalSize.Value = cbIntervalSize.Minimum;
775
            }
776
            List<AdornerMember> AdonerList = GetAdornerItem();
777
            if (AdonerList.Count > 0)
778
            {
779

    
780
                Undo_data UndoData = new Undo_data()
781
                {
782
                    IsUndo = false,
783
                    Event = Event_Type.Option,
784
                    EventTime = DateTime.Now,
785
                    Interval = ViewerDataModel.Instance.Interval,
786
                    Markup_List = new List<Multi_Undo_data>()
787
                };
788
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
789

    
790
                foreach (AdornerMember InnerItem in AdonerList)
791
                {
792
                    switch (InnerItem.DrawingData.GetType().Name)
793
                    {
794
                        case ("LineControl"):
795
                            {
796
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Line.LineControl).Interval = ViewerDataModel.Instance.Interval;
797

    
798
                                multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
799
                                UndoData.Markup_List.Add(multi_Undo_Data);
800
                                multi_Undo_Data = new Multi_Undo_data();
801
                            }
802
                            break;
803
                    }
804
                }
805

    
806
                ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
807
                {
808
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
809
                });
810
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
811
            }
812
            KCOM.Properties.Settings.Default.Interval = (double)cbIntervalSize.Value;
813
            Properties.Settings.Default.Save();
814
        }
815
        
816
        private void cbArcLength_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
817
        {
818
            if (string.IsNullOrEmpty(cbArcLength.Value.ToString()))
819
            {
820
                cbArcLength.Value = cbArcLength.Minimum;
821
            }
822
            List<AdornerMember> AdonerList = GetAdornerItem();
823
            if (AdonerList.Count > 0)
824
            {
825

    
826
                //Undo_data UndoData = new Undo_data()
827
                //{
828
                //    IsUndo = false,
829
                //    Event = Event_Type.Option,
830
                //    EventTime = DateTime.Now,
831
                //    Interval = ViewerDataModel.Instance.Interval,
832
                //    Markup_List = new List<Multi_Undo_data>()
833
                //};
834
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
835

    
836
                foreach (AdornerMember InnerItem in AdonerList)
837
                {
838
                    switch (InnerItem.DrawingData.GetType().Name)
839
                    {
840
                        case ("RectCloudControl"):
841
                            {
842
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.RectCloudControl).ArcLength = ViewerDataModel.Instance.ArcLength;
843

    
844
                                //multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
845
                                //UndoData.Markup_List.Add(multi_Undo_Data);
846
                                //multi_Undo_Data = new Multi_Undo_data();
847
                            }
848
                            break;
849
                        case ("CloudControl"):
850
                            {
851
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Polygon.CloudControl).ArcLength = ViewerDataModel.Instance.ArcLength;
852

    
853
                                //multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
854
                                //UndoData.Markup_List.Add(multi_Undo_Data);
855
                                //multi_Undo_Data = new Multi_Undo_data();
856
                            }
857
                            break;
858
                    }
859
                }
860

    
861
                //ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
862
                //{
863
                //    ViewerDataModel.Instance.UndoDataList.Remove(i);
864
                //});
865
                //ViewerDataModel.Instance.UndoDataList.Add(UndoData);
866
            }
867

    
868
            KCOM.Properties.Settings.Default.ArcLength = (double)cbArcLength.Value;
869
            Properties.Settings.Default.Save();
870
        }
871

    
872
        //강인구 추가(Undo End)
873
        private void cbDashStyle_SelectionChanged(object sender, SelectionChangedEventArgs e)
874
        {
875
            //강인구 추가
876
            if (this.ParentOfType<MainWindow>() != null)
877
            {
878
                ViewerDataModel.Instance.DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
879
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
880
                {
881
                    Undo_data UndoData = new Undo_data()
882
                    {
883
                        IsUndo = false,
884
                        Event = Event_Type.Option,
885
                        EventTime = DateTime.Now,
886
                        DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData,
887
                        Markup_List = new List<Multi_Undo_data>()
888
                    };
889
                    Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
890

    
891
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
892
                    {
893
                        if (item.GetType().Name == "AdornerFinal")
894
                        {
895
                            foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
896
                            {
897
                                switch (InnerItem.DrawingData.GetType().Name)
898
                                {
899
                                    case ("LineControl"):
900
                                        {
901
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Line.LineControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
902
                                        }
903
                                        break;
904
                                    case ("ArcControl"):
905
                                        {
906
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Line.ArcControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
907
                                        }
908
                                        break;
909
                                    case ("ArrowArcControl"):
910
                                        {
911
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Line.ArrowArcControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
912
                                        }
913
                                        break;
914
                                    case ("ArrowControl_Multi"):
915
                                        {
916
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Line.ArrowControl_Multi).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
917
                                        }
918
                                        break;
919
                                    case ("CloudControl"):
920
                                        {
921
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Polygon.CloudControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
922
                                        }
923
                                        break;
924
                                    case ("PolygonControl"):
925
                                        {
926
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Polygon.PolygonControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
927
                                        }
928
                                        break;
929
                                    case ("RectangleControl"):
930
                                        {
931
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.RectangleControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
932
                                        }
933
                                        break;
934
                                    case ("RectCloudControl"):
935
                                        {
936
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.RectCloudControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
937
                                        }
938
                                        break;
939
                                    case ("TriControl"):
940
                                        {
941
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.TriControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
942
                                        }
943
                                        break;
944
                                    case ("CircleControl"):
945
                                        {
946
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.CircleControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
947
                                        }
948
                                        break;
949
                                }
950

    
951
                                multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
952
                                UndoData.Markup_List.Add(multi_Undo_Data);
953
                                multi_Undo_Data = new Multi_Undo_data();
954
                            }
955

    
956
                            ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
957
                            {
958
                                ViewerDataModel.Instance.UndoDataList.Remove(i);
959
                            });
960
                            ViewerDataModel.Instance.UndoDataList.Add(UndoData);
961
                        }
962
                    }
963
                }
964
            }
965
        }
966

    
967
        //강인구 추가
968
        private void comboFontSize_SelectionChanged(object sender, SelectionChangedEventArgs e)
969
        {
970
            //if (this.ParentOfType<MainWindow>() != null)
971
            //{
972
            //    if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
973
            //    {
974
            //        foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
975
            //        {
976
            //            if (item.GetType().Name == "AdornerFinal")
977
            //            {
978
            //                foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
979
            //                {
980
            //                    switch (InnerItem.DrawingData.GetType().Name)
981
            //                    {
982
            //                        case ("TextControl"):
983
            //                            {
984
            //                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextSize = int.Parse(comboFontSize.Text);
985
            //                            }
986
            //                            break;
987
            //                        case ("ArrowTextControl"):
988
            //                            {
989
            //                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextSize = int.Parse(comboFontSize.Text);
990
            //                            }
991
            //                            break;
992
            //                    }
993
            //                }
994
            //            }
995
            //        }
996
            //    }
997
            //}
998
        }
999

    
1000
        //강인구 추가
1001
        private void btnBold_Checked(object sender, RoutedEventArgs e)
1002
        {
1003
            if (this.ParentOfType<MainWindow>() != null)
1004
            {
1005
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
1006
                {
1007
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
1008
                    {
1009
                        if (item.GetType().Name == "AdornerFinal")
1010
                        {
1011
                            foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
1012
                            {
1013
                                switch (InnerItem.DrawingData.GetType().Name)
1014
                                {
1015
                                    case ("TextControl"):
1016
                                        {
1017
                                            if((InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextWeight == FontWeights.Bold)
1018
                                            {
1019
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextWeight = FontWeights.Normal;
1020
                                            }
1021
                                            else
1022
                                            {
1023
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextWeight = FontWeights.Bold;
1024
                                            }
1025

    
1026
                                        }
1027
                                        break;
1028
                                    case ("ArrowTextControl"):
1029
                                        {
1030
                                            if ((InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextWeight == FontWeights.Bold)
1031
                                            {
1032
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextWeight = FontWeights.Normal;
1033
                                            }
1034
                                            else
1035
                                            {
1036
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextWeight = FontWeights.Bold;
1037
                                            }
1038
                                        }
1039
                                        break;
1040
                                }
1041
                            }
1042
                        }
1043
                    }
1044
                }
1045
            }
1046
        }
1047

    
1048
        //강인구 추가
1049
        private void btnItalic_Checked(object sender, RoutedEventArgs e)
1050
        {
1051
            if (this.ParentOfType<MainWindow>() != null)
1052
            {
1053
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
1054
                {
1055
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
1056
                    {
1057
                        if (item.GetType().Name == "AdornerFinal")
1058
                        {
1059
                            foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
1060
                            {
1061
                                switch (InnerItem.DrawingData.GetType().Name)
1062
                                {
1063
                                    case ("TextControl"):
1064
                                        {
1065
                                            if((InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextStyle == FontStyles.Italic)
1066
                                            {
1067
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextStyle = System.Windows.FontStyles.Normal;
1068
                                            }
1069
                                            else
1070
                                            {
1071
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextStyle = FontStyles.Italic;
1072
                                            }
1073

    
1074
                                        }
1075
                                        break;
1076
                                    case ("ArrowTextControl"):
1077
                                        {
1078
                                            if((InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextStyle == FontStyles.Italic)
1079
                                            {
1080
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextStyle = FontStyles.Normal;
1081
                                            }
1082
                                            else
1083
                                            {
1084
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextStyle = FontStyles.Italic;
1085
                                            }
1086
                                        }
1087
                                        break;
1088
                                }
1089
                            }
1090
                        }
1091
                    }
1092
                }
1093
            }
1094
        }
1095

    
1096
        //강인구 추가
1097
        private void btnUnderLine_Checked(object sender, RoutedEventArgs e)
1098
        {
1099
            if (this.ParentOfType<MainWindow>() != null)
1100
            {
1101
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
1102
                {
1103
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
1104
                    {
1105
                        if (item.GetType().Name == "AdornerFinal")
1106
                        {
1107
                            foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
1108
                            {
1109
                                switch (InnerItem.DrawingData.GetType().Name)
1110
                                {
1111
                                    case ("TextControl"):
1112
                                        {
1113
                                            if ((InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).UnderLine == TextDecorations.Underline)
1114
                                            {
1115
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).UnderLine = null;
1116
                                            }
1117
                                            else
1118
                                            {
1119
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).UnderLine = TextDecorations.Underline;
1120
                                            }
1121
                                        }
1122
                                        break;
1123
                                    case ("ArrowTextControl"):
1124
                                        {
1125
                                            if ((InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).UnderLine == TextDecorations.Underline)
1126
                                            {
1127
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).UnderLine = null;
1128
                                            }
1129
                                            else
1130
                                            {
1131
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).UnderLine = TextDecorations.Underline;
1132
                                            }
1133
                                        }
1134
                                        break;
1135
                                }
1136
                            }
1137
                        }
1138
                    }
1139
                }
1140
            }
1141
        }
1142

    
1143
        private void AxisLockEvent(object sender, RoutedEventArgs e)
1144
        {
1145
            ViewerDataModel.Instance.checkAxis = cbAxisLock.IsChecked.Value;
1146
        }
1147

    
1148
        private void comboFontSize_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
1149
        {
1150
            if (string.IsNullOrEmpty(comboFontSize.Value.ToString()))
1151
            {
1152
                comboFontSize.Value = comboFontSize.Minimum;
1153
            }
1154
            if (this.ParentOfType<MainWindow>() != null)
1155
            {
1156
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
1157
                {
1158
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
1159
                    {
1160
                        if (item.GetType().Name == "AdornerFinal")
1161
                        {
1162
                            foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
1163
                            {
1164
                                switch (InnerItem.DrawingData.GetType().Name)
1165
                                {
1166
                                    case ("TextControl"):
1167
                                        {
1168
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextSize = int.Parse(comboFontSize.Value.ToString());
1169
                                        }
1170
                                        break;
1171
                                    case ("ArrowTextControl"):
1172
                                        {
1173
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextSize = int.Parse(comboFontSize.Value.ToString());
1174
                                        }
1175
                                        break;
1176
                                }
1177
                            }
1178
                        }
1179
                    }
1180
                }
1181
            }
1182
            KCOM.Properties.Settings.Default.TextSize = (double)comboFontSize.Value;
1183
            Properties.Settings.Default.Save();
1184
        }
1185

    
1186
        //강인구 추가
1187
        private void RadRibbonComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
1188
        {
1189
            if (this.ParentOfType<MainWindow>() != null)
1190
            {
1191
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
1192
                {
1193
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
1194
                    {
1195
                        if (item.GetType().Name == "AdornerFinal")
1196
                        {
1197
                            foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
1198
                            {
1199
                                switch (InnerItem.DrawingData.GetType().Name)
1200
                                {
1201
                                    case ("TextControl"):
1202
                                        {
1203
                                            //if ((InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).FontFamily == TextDecorations.Underline)
1204
                                            //{
1205
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).FontFamily = new FontFamily(comboFontFamily.Text);
1206
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).Base_TextBlock.FontFamily = new FontFamily(comboFontFamily.Text);
1207
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).Base_TextBox.FontFamily = new FontFamily(comboFontFamily.Text);
1208
                                            //}
1209
                                            //else
1210
                                            //{
1211
                                            //    (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).UnderLine = TextDecorations.Underline;
1212
                                            //}
1213
                                        }
1214
                                        break;
1215
                                    case ("ArrowTextControl"):
1216
                                        {
1217
                                            //if ((InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).UnderLine == TextDecorations.Underline)
1218
                                            //{
1219
                                            //    (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).UnderLine = null;
1220
                                            //}
1221
                                            //else
1222
                                            //{
1223
                                            //    (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).UnderLine = TextDecorations.Underline;
1224
                                            //}
1225
                                        }
1226
                                        break;
1227
                                }
1228
                            }
1229
                        }
1230
                    }
1231
                }
1232
            }
1233
        }
1234

    
1235
        /// <summary>
1236
        /// 텍스트 컨트롤 하일라이트 처리
1237
        /// </summary>
1238
        /// <param name="sender"></param>
1239
        /// <param name="e"></param>
1240
        private void HighlightEvent(object sender, RoutedEventArgs e)
1241
        {
1242

    
1243
            ViewerDataModel.Instance.checkHighShape = (sender as CheckBox).IsChecked.Value;
1244
            SetHighlightEvent();
1245
            //if ((sender as CheckBox).IsChecked.Value)
1246
            //{
1247
            //    TaskMessage("HighLight가 설정되었습니다", TaskMessageType.Normal);
1248
            //}
1249
            //else
1250
            //{
1251
            //    TaskMessage("HighLight가 해제되었습니다", TaskMessageType.Caption);
1252
            //}
1253
            //if (ViewerDataModel.Instance.SelectedEditor as MarkupToPDF.Controls.Text.TextControl != null)
1254
            //{
1255
            //    MarkupToPDF.Controls.Text.TextControl instance = (ViewerDataModel.Instance.SelectedEditor as MarkupToPDF.Controls.Text.TextControl);
1256
            //    instance.IsHighLight = ViewerDataModel.Instance.checkHighShape;
1257
            //    instance.SetText();
1258
            //}
1259
        }
1260

    
1261
        //강인구 추가페이지 이동 엔터
1262
        private void tlcurrentPage_KeyDown(object sender, KeyEventArgs e)
1263
        {
1264
            //강인구 추가 tlcurrentPage을 이상하게 입력할수 있기때문에 Try Catch
1265
            if (e.Key == Key.Enter)
1266
            {
1267
                try
1268
                {
1269
                    var instanceMain = this.ParentOfType<MainWindow>();
1270
                    instanceMain.dzMainMenu.pageNavigator.GotoPage(Convert.ToInt32(tlcurrentPage.Text));
1271
                }
1272
                catch (Exception)
1273
                {
1274
                    RadWindow.Alert(new DialogParameters
1275
                    {
1276
                        Theme = new VisualStudio2013Theme(),
1277
                        Header = "안내",
1278
                        Content = "페이지 번호를 정확하게 입력해 주세요",
1279
                    });
1280
                }
1281
                
1282
            }
1283
        }
1284

    
1285
        public event EventHandler<WindowClosedEventArgs> Closed;
1286

    
1287
        //private void CheckEvent(object sender, RoutedEventArgs e)
1288
        //{
1289
        //    RadWindow CheckPop = new RadWindow();
1290
        //    test check = new test();
1291

    
1292
        //    CheckPop = new RadWindow
1293
        //    {
1294
        //        Width = 1700,
1295
        //        Height = 510,
1296
        //        Header = "My Check List",
1297
        //        Content = check,
1298
        //        Owner = this,
1299
        //        ResizeMode = System.Windows.ResizeMode.NoResize,
1300
        //        WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen,
1301
        //    };
1302
        //    StyleManager.SetTheme(CheckPop, new VisualStudio2013Theme());
1303

    
1304
        //    CheckPop.Closed += CheckPop_Closed;
1305
        //    CheckPop.ShowDialog();
1306
        //}
1307

    
1308
        private void PanoramaEvent(object sender, RoutedEventArgs e)
1309
        {
1310
            PanoramaShow();
1311
        }
1312

    
1313
        public void PanoramaShow()
1314
        {
1315
            Panorama check = new Panorama();
1316
            double screenWidth = System.Windows.SystemParameters.PrimaryScreenWidth;
1317
            double screenHeight = System.Windows.SystemParameters.PrimaryScreenHeight;
1318
            //double windowWidth = this.Width;
1319
            //double windowHeight = this.Height;
1320

    
1321
            var PanoramaPop = new RadWindow
1322
            {
1323
                //MinWidth = 600,
1324
                //MinHeight = 400,
1325
                //Header = "My Check List",
1326
                Header = "Document No : " + this.ParentOfType<MainWindow>().dzMainMenu._DocItem.DOCUMENT_NO + " / Revision :" + this.ParentOfType<MainWindow>().dzMainMenu._DocItem.REVISION,
1327
                Content = check,
1328
                Owner = this,
1329
                ResizeMode = System.Windows.ResizeMode.CanResizeWithGrip,
1330
                //ResizeMode = System.Windows.ResizeMode.NoResize,
1331
                WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen,
1332
                IsTopmost = false,
1333
                //Left = (screenWidth / 2) - (windowWidth / 2),
1334
                //Top = (screenHeight / 2) - (windowHeight / 2),
1335
                //Left = (screenWidth / 2),
1336
                //Top = (screenHeight / 2),
1337
                Width = screenWidth * 0.4,
1338
                Height = screenHeight * 0.4,
1339
            };
1340
            StyleManager.SetTheme(PanoramaPop, new VisualStudio2013Theme());
1341
            //CheckPop.ShowDialog();
1342
            PanoramaPop.Show();
1343
        }
1344

    
1345
        private void CheckEvent(object sender, RoutedEventArgs e)
1346
        {
1347
            //창이 떠있을 경우 재 실행 방지
1348
            if (isClosed)
1349
            {
1350
                //토글 및 마우스 상태 초기화
1351
                var toggleList = this.Parent.ChildrenOfType<RadToggleButton>();
1352
                foreach(var togle in toggleList)
1353
                {
1354
                    togle.IsChecked = false;
1355
                }
1356
                this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
1357

    
1358
                isClosed = false;
1359

    
1360
                
1361
                CheckList check = new CheckList();
1362

    
1363
                CheckPop = new RadWindow
1364
                {
1365
                    MinWidth = 1200,
1366
                    MinHeight = 500,
1367
                    //Header = "My Check List",
1368
                    Header = "Document No : " + this.ParentOfType<MainWindow>().dzMainMenu._DocItem.DOCUMENT_NO + " / Revision :" + this.ParentOfType<MainWindow>().dzMainMenu._DocItem.REVISION,
1369
                    Content = check,
1370
                    //Owner = this,
1371
                    //ResizeMode = System.Windows.ResizeMode.CanResizeWithGrip,
1372
                    ResizeMode = System.Windows.ResizeMode.NoResize,
1373
                    WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen,
1374
                    IsTopmost = true,
1375
                };
1376
                StyleManager.SetTheme(CheckPop, new Office2013Theme());
1377
                CheckPop.Closed += CheckPop_Closed;
1378
                
1379
                //CheckPop.ShowDialog();
1380
                CheckPop.Show();
1381
            }
1382
        }
1383

    
1384
        private void CheckPop_Closed(object sender, WindowClosedEventArgs e)
1385
        {
1386
            isClosed = true;
1387
            //this.ParentOfType<MainWindow>().dzMainMenu.PN_Navi.IsEnabled = true;
1388
            this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
1389
            ViewerDataModel.Instance.Capture_Opacity = 0;
1390
        }
1391

    
1392
        /// <summary>
1393
        /// 사용자가 선택한 페이지로 이동(썸네일 동기화 시킴)
1394
        /// </summary>
1395
        /// <param name="sender"></param>
1396
        /// <param name="e"></param>
1397
        private void PageGoEvent(object sender, RoutedEventArgs e)
1398
        {
1399
            RadButton button = sender as RadButton;
1400
            var instanceMain = this.ParentOfType<MainWindow>();
1401
            
1402
            //강인구 추가 tlcurrentPage을 이상하게 입력할수 있기때문에 Try Catch
1403
            try
1404
            {
1405
                switch (button.CommandParameter.ToString())
1406
                {
1407
                    case "Down":
1408
                        {
1409
                            instanceMain.dzMainMenu.pageNavigator.GotoPage(Convert.ToInt32(tlcurrentPage.Text) + 1);
1410
                        }
1411
                        break;
1412
                    case "Up":
1413
                        {
1414
                            instanceMain.dzMainMenu.pageNavigator.GotoPage(Convert.ToInt32(tlcurrentPage.Text) - 1);
1415
                        }
1416
                        break;
1417
                }
1418
            }
1419
            catch (Exception)
1420
            {
1421
                RadWindow.Alert(new DialogParameters
1422
                {
1423
                    Theme = new VisualStudio2013Theme(),
1424
                    Header = "안내",
1425
                    Content = "페이지 번호를 정확하게 입력해 주세요",
1426
                });
1427
            }
1428
        }
1429

    
1430
        private void viewEvent(object sender, RoutedEventArgs e)
1431
        {
1432
            RadRibbonToggleButton viewButton = sender as RadRibbonToggleButton;
1433
            var instanceMain = this.ParentOfType<MainWindow>();
1434

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

    
1437
            //if ((sender as RadRibbonToggleButton) != null)
1438
            //{
1439
            //    Common.ViewerDataModel.Instance.ControlTag = (sender as RadRibbonToggleButton).Tag.ToString();
1440
            //    instanceToggle = (sender as RadRibbonToggleButton);
1441
            //}
1442

    
1443
            //instanceToggle.IsChecked = false;
1444

    
1445
            switch (viewButton.CommandParameter.ToString())
1446
            {
1447
                case "zoomout":
1448
                    {
1449
                        //장원
1450
                        //instanceMain.dzMainMenu.zoomAndPanControl.ZoomTo(new Rect(0, 0, instanceMain.dzMainMenu.zoomAndPanCanvas.ActualWidth, instanceMain.dzMainMenu.zoomAndPanCanvas.ActualHeight));
1451
                        instanceMain.dzMainMenu.zoomAndPanControl.ZoomPointToViewportCenter(ViewerDataModel.Instance.ContentScale -= 0.1, point);
1452
                        viewButton.IsChecked = false;
1453
                        //Common.ViewerDataModel.Instance.zom
1454
                    }
1455
                    break;
1456
                case "zoomin":
1457
                    {
1458
                        instanceMain.dzMainMenu.zoomAndPanControl.ZoomPointToViewportCenter(ViewerDataModel.Instance.ContentScale += 0.1, point);
1459
                        viewButton.IsChecked = false;
1460
                    }
1461
                    break;
1462
                case "fullscreen":
1463
                    {
1464
                        instanceMain.WindowState = WindowState.Maximized;
1465
                        //Sizemode 대기(강인구)
1466
                        //instanceMain.dzMainMenu.imageViewer.SizeMode = Leadtools.Windows.Controls.SizeMode.Fit;
1467
                        instanceMain.dzMainMenu.zoomAndPanControl.ScaleToFit();
1468
                        viewButton.IsChecked = false;
1469
                    }
1470
                    break;
1471
                case "fitWidth":
1472
                    {
1473
                        instanceMain.dzMainMenu.zoomAndPanControl.ScaleToFit();
1474
                        viewButton.IsChecked = false;
1475
                    }
1476
                    break;
1477
                case "fitHeight":
1478
                    {
1479
                        instanceMain.dzMainMenu.zoomAndPanControl.ScaleToFit();
1480
                        viewButton.IsChecked = false;
1481
                    }
1482
                    break;
1483
                case "boundzoom":
1484
                    {
1485

    
1486
                    }
1487
                    break;
1488
                case "Rotate_M":
1489
                    {
1490
                        drawingPannelRotate(false);
1491
                        viewButton.IsChecked = false;
1492
                    }
1493
                    break;
1494
                case "Rotate_P":
1495
                    {
1496
                        drawingPannelRotate(true);
1497
                        viewButton.IsChecked = false;
1498
                    }
1499
                    break;
1500
                case "Rotate_half":
1501
                    {
1502
                        drawingPannelRotate(true);
1503
                        drawingPannelRotate(true);
1504
                        viewButton.IsChecked = false;
1505
                    }
1506
                    break;
1507
            }
1508
        }
1509

    
1510
        private void Control_Event(object sender, RoutedEventArgs e)
1511
        {
1512

    
1513
        }
1514

    
1515
        #region 대기
1516

    
1517
        public void drawingPannelRotate(bool Flag)
1518
        {
1519
            var instanceMain = this.ParentOfType<MainWindow>();
1520

    
1521
            //if (rotateOffSet > 3)
1522
            //    rotateOffSet = 0;
1523

    
1524
            //if (rotateOffSet < 0)
1525
            //    rotateOffSet = 3;
1526

    
1527
            if(Flag)
1528
            {
1529
                if (instanceMain.dzMainMenu.rotate.Angle == 270)
1530
                {
1531
                    instanceMain.dzMainMenu.rotate.Angle = 0;
1532
                }
1533
                else
1534
                {
1535
                    instanceMain.dzMainMenu.rotate.Angle += 90;
1536
                }
1537
            }
1538
            else
1539
            {
1540
                if(instanceMain.dzMainMenu.rotate.Angle == 0)
1541
                {
1542
                    instanceMain.dzMainMenu.rotate.Angle = 270;
1543
                }
1544
                else
1545
                {
1546
                    instanceMain.dzMainMenu.rotate.Angle -= 90;
1547
                }
1548
            }
1549
            //double angle = (double)rotateValue.GetValue(rotateOffSet);
1550
            //instanceMain.dzMainMenu.rotate.Angle = angle;
1551
            var rotationNum = Math.Abs((instanceMain.dzMainMenu.rotate.Angle / 90));
1552

    
1553
            if (instanceMain.dzMainMenu.zoomAndPanCanvas.Width == ViewerDataModel.Instance.ContentWidth)
1554
            {
1555
                double emptySize = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
1556
                instanceMain.dzMainMenu.zoomAndPanCanvas.Width = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
1557
                instanceMain.dzMainMenu.zoomAndPanCanvas.Height = emptySize;
1558
            }
1559
            if (instanceMain.dzMainMenu.rotate.Angle == 0)
1560
            {
1561
                instanceMain.dzMainMenu.translate.X = 0;
1562
                instanceMain.dzMainMenu.translate.Y = 0;
1563
            }
1564
            else if (instanceMain.dzMainMenu.rotate.Angle == 90)
1565
            {
1566
                instanceMain.dzMainMenu.translate.X = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
1567
                instanceMain.dzMainMenu.translate.Y = 0;
1568
            }
1569
            else if (instanceMain.dzMainMenu.rotate.Angle == 180)
1570
            {
1571
                instanceMain.dzMainMenu.translate.X = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
1572
                instanceMain.dzMainMenu.translate.Y = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
1573
            }
1574
            else
1575
            {
1576
                instanceMain.dzMainMenu.translate.X = 0;
1577
                instanceMain.dzMainMenu.translate.Y = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
1578
            }
1579

    
1580
            //instanceMain.dzMainMenu.zoomAndPanControl.RenderTransformOrigin = new Point(0.5, 0.5);
1581
            instanceMain.dzMainMenu.zoomAndPanControl.RotationAngle = instanceMain.dzMainMenu.rotate.Angle;
1582
            //대기(강인구)
1583
            //instanceMain.dzMainMenu.imageViewer.RotateAngle = instanceMain.dzMainMenu.rotate.Angle;
1584

    
1585

    
1586
            //instanceMain.dzMainMenu.imageViewer.RenderTransformOrigin = new Point(0.5, 0.5);
1587
            //RotateTransform rotateTransform = new RotateTransform(instanceMain.dzMainMenu.rotate.Angle);
1588
            //instanceMain.dzMainMenu.imageViewer.RenderTransform = rotateTransform;
1589

    
1590

    
1591
            ViewerDataModel.Instance.ContentWidth = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
1592
            ViewerDataModel.Instance.ContentHeight = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
1593
            ViewerDataModel.Instance.AngleOffsetX = instanceMain.dzMainMenu.translate.X;
1594
            ViewerDataModel.Instance.AngleOffsetY = instanceMain.dzMainMenu.translate.Y;
1595
            ViewerDataModel.Instance.Angle = instanceMain.dzMainMenu.rotate.Angle;
1596
            //ViewerDataModel.Instance.Document_Info.Clear();
1597
            //ViewerDataModel.Instance.Document_Info.Where(i => i.PAGE_NUMBER == instanceMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber).ToList().ForEach(value =>
1598
            //{
1599
            //    value.PAGE_ANGLE = int.Parse(instanceMain.dzMainMenu.rotate.Angle.ToString());
1600
            //});
1601

    
1602

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

    
1608
                instanceMain.dzMainMenu.pageNavigator.ImgListbox.ItemsSource = instanceMain.dzMainMenu.pageNavigator._thumbnailItems;
1609
                var instance = instanceMain.dzMainMenu.CurrentDoc.docInfo.DOCPAGE.Where(p => p.PAGE_NUMBER == instanceMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber).FirstOrDefault();
1610
                instance.PAGE_ANGLE = int.Parse(instanceMain.dzMainMenu.rotate.Angle.ToString());
1611

    
1612
                instanceMain.dzMainMenu.pageNavigator.setPageChange(data);
1613

    
1614
                //rotation page add or update
1615
                var rotationdoc = ViewerDataModel.Instance.RotationDocs.Where(d => d.ID == instance.ID).FirstOrDefault();
1616
                if (rotationdoc != null)
1617
                {
1618
                    rotationdoc.PAGE_ANGLE = instance.PAGE_ANGLE;
1619
                }
1620
                else
1621
                {
1622
                    ViewerDataModel.Instance.RotationDocs.Add(instance);
1623
                }
1624
            });
1625
        }
1626
        #endregion
1627

    
1628
        private void ImageConverter()
1629
        {
1630
            var instanceMain = this.ParentOfType<MainWindow>();
1631
            //http://cloud.devdoftech.co.kr:5977/ImageUpload/FileUpload.asmx
1632

    
1633

    
1634
            Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
1635
            dlg.Filter = "All files (*.*)|*.*|PNG Images (*.png)|*.png";
1636
            Nullable<bool> result = dlg.ShowDialog();
1637
            if (result == true)
1638
            {
1639
                instanceMain.dzMainMenu.filename = dlg.FileName;
1640
                instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ImgControl;
1641

    
1642
                System.IO.FileInfo fileInfo = new System.IO.FileInfo(instanceMain.dzMainMenu.filename);
1643
                String strFile = System.IO.Path.GetFileName(instanceMain.dzMainMenu.filename);
1644
                long numByte = fileInfo.Length;
1645
                double dLen = Convert.ToDouble(fileInfo.Length / 1000000);
1646
                kr.co.devdoftech.cloud.FileUpload fileUploader = new kr.co.devdoftech.cloud.FileUpload();
1647

    
1648
                if (dLen < 4)
1649
                {
1650
                    System.IO.FileStream fStream = new System.IO.FileStream(instanceMain.dzMainMenu.filename, System.IO.FileMode.Open, System.IO.FileAccess.Read);
1651
                    System.IO.BinaryReader br = new System.IO.BinaryReader(fStream);
1652
                    byte[] data = br.ReadBytes((int)numByte);
1653
                    br.Close();
1654

    
1655
                    instanceMain.dzMainMenu.filename = fileUploader.Run(App.ViewInfo.ProjectNO, instanceMain.dzMainMenu._DocItem.DOCUMENT_NO, App.ViewInfo.UserID, strFile, data);
1656
                    fStream.Close();
1657
                    fStream.Dispose();
1658
                }
1659
                else
1660
                {
1661
                    this.ParentOfType<MainWindow>().DialogMessage_Alert("Available Memory less than 4 mega byte", "Alert");
1662
                }
1663
            }
1664
        }
1665

    
1666
        private void Control_Init(RadToggleButton instanceToggle, object sender)
1667
        {
1668

    
1669
        }
1670

    
1671
        private void ControlEvent(object sender, RoutedEventArgs e)
1672
        {
1673
            RadToggleButton instanceToggle = sender as RadToggleButton;
1674
            var instanceMain = this.ParentOfType<MainWindow>();
1675

    
1676
            #region Ctrl + A 눌렀을 때 대처 방법 
1677
            //원인 : Ctrl + A를 누르면 UIElementSet에 등록을 시키지 않는다(이유는 한꺼번에 많은 양의 컨트롤의 동작이 유입되기 때문에
1678
            //       시스템의 성능저하를 불러올 수 있기 때문이다. 그래서 선택 후 다른 컨트롤을 누르면 등록되지 않은 컨트롤이기 때문에 삭제된다
1679
            //       이를 대처하는 방법으로 아래 코드를 사용한다.
1680
            if (Common.ViewerDataModel.Instance.MarkupControls.Count == 0 && Common.ViewerDataModel.Instance.MarkupControls.Count >= 1)
1681
            {
1682
                //var lstItem = instanceMain.DeepLayer._SelectLayer.ChildrenOfType<AdornerFinal>().ToList();
1683
                //foreach (var item in lstItem)
1684
                //{
1685
                //    foreach (var member in item.MemberSet)
1686
                //    {
1687
                //        if (!instanceMain.DeepLayer.UIElementSet.Contains(member.DrawingData))
1688
                //        {
1689
                //            instanceMain.DeepLayer.UIElementSet.Add(member.DrawingData);
1690
                //        }
1691
                //    }
1692
                //}
1693
            }
1694
            #endregion
1695

    
1696
            //if (!instanceMain.IsFreeSelectionMode)
1697
            //{
1698
            //    instanceMain.IsSwingMode = true;
1699
            //}
1700

    
1701
            #region 다른 컨트롤 버튼 선택 해제
1702
            System.Reactive.Linq.Observable2.FromPropertyChangedPattern(Common.ViewerDataModel.Instance, temp => temp.SelectedControl).Subscribe(ControlState =>
1703
            {
1704
                if (ControlState == null)
1705
                {
1706
                    instanceToggle.IsChecked = false;
1707
                    HiddenControlHide();
1708
                }
1709
            });
1710
            #endregion
1711

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

    
1714
            if (instanceToggle != null)
1715
            {
1716
                Common.ViewerDataModel.Instance.ControlTag = instanceToggle.Tag.ToString();
1717
            }
1718
            else if ((sender as RadRibbonToggleButton) != null)
1719
            {
1720
                Common.ViewerDataModel.Instance.ControlTag = (sender as RadRibbonToggleButton).Tag.ToString();
1721
                instanceToggle = (sender as RadRibbonToggleButton);
1722
            }
1723
            else if ((sender as RadRibbonButton) != null)
1724
            {
1725
                RadRibbonButton instanceButton = sender as RadRibbonButton;
1726
                Common.ViewerDataModel.Instance.ControlTag = instanceButton.Tag.ToString();
1727
            }
1728
            else
1729
            {
1730
                RadButton instanceButton = sender as RadButton;
1731
                Common.ViewerDataModel.Instance.ControlTag = instanceButton.Tag.ToString();
1732
            }
1733

    
1734

    
1735

    
1736
            System.Reactive.Linq.Observable2.FromPropertyChangedPattern(Common.ViewerDataModel.Instance, temp => temp.AngleVisibility).Subscribe(isSee =>
1737
            {
1738
                instanceMain.dzMainMenu.MainAngle.Visibility = isSee;
1739
                System.Reactive.Linq.Observable2.FromPropertyChangedPattern(Common.ViewerDataModel.Instance, temp => temp.AngleValue).Subscribe(p =>
1740
                {
1741
                    instanceMain.dzMainMenu.MainAngle.AngleValue = p;
1742
                });
1743
            });
1744
            instanceMain.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Drawing;
1745

    
1746
            instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = false;
1747

    
1748
            if (instanceToggle.IsChecked != false)
1749
            {
1750
                #region 컨트롤이 체크되었다면
1751
                switch (instanceToggle.CommandParameter.ToString())
1752
                {
1753
                    #region Line
1754
                    case "Line":
1755
                        Common.ViewerDataModel.Instance.SelectedControl = "Line";
1756
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1757
                        if (instanceToggle.Tag.ToString() == "LineDelete")
1758
                        {
1759
                            //HiddenInterval.Visibility = Visibility.Visible;
1760
                        }
1761
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.SingleLine;
1762
                        break;
1763
                    #endregion
1764
                    #region ChainLine
1765
                    case "ChainLine":
1766
                        Common.ViewerDataModel.Instance.SelectedControl = "ChainLine";
1767
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1768
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ChainLine;
1769
                        break;
1770
                    #endregion
1771
                    #region DimLine
1772
                    case "DimLine":
1773
                        Common.ViewerDataModel.Instance.SelectedControl = "DimLine";
1774
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1775
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.DimLine;
1776
                        break;
1777
                    #endregion
1778
                    #region TwinLine
1779
                    case "TwinLine":
1780
                        Common.ViewerDataModel.Instance.SelectedControl = "TwinLine";
1781
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1782
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.TwinLine;
1783
                        break;
1784
                    #endregion
1785
                    #region CancelLine
1786
                    case "CancelLine":
1787
                        Common.ViewerDataModel.Instance.SelectedControl = "CancelLine";
1788
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1789
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.CancelLine;
1790
                        break;
1791
                    #endregion
1792
                    #region PolygonCloud
1793
                    case "PolygonCloud":
1794
                        Common.ViewerDataModel.Instance.SelectedControl = "PolygonCloud";
1795
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1796
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.PolygonCloud;
1797
                        break;
1798
                    #endregion
1799
                    #region RectCloud
1800
                    case "RectCloud":
1801
                        Common.ViewerDataModel.Instance.SelectedControl = "RectCloud";
1802
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1803
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.RectCloud;
1804
                        break;
1805
                    #endregion
1806
                    #region Rectangle
1807
                    case "Rectangle":
1808
                        Common.ViewerDataModel.Instance.SelectedControl = "Rectangle";
1809
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1810
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Rectangle;
1811
                        break;
1812
                    #endregion
1813
                    #region Triangle
1814
                    case "Triangle":
1815
                        Common.ViewerDataModel.Instance.SelectedControl = "Triangle";
1816
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1817
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Triangle;
1818
                        break;
1819
                    #endregion
1820
                    #region RectCloud
1821
                    case "Circle":
1822
                        Common.ViewerDataModel.Instance.SelectedControl = "Circle";
1823
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1824
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Circle;
1825
                        break;
1826
                    #endregion
1827
                    #region Symbol
1828
                    case "Symbol":
1829
                        Common.ViewerDataModel.Instance.SelectedControl = "Symbol";
1830
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
1831
                        break;
1832
                    #endregion
1833
                    #region SymbolN
1834
                    case "SymbolN":
1835
                        Common.ViewerDataModel.Instance.SelectedControl = "SymbolN";
1836
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Stamp;
1837
                        break;
1838
                    #endregion
1839
                    #region Text
1840
                    case "Text":
1841
                        Common.ViewerDataModel.Instance.SelectedControl = "Text";
1842
                        TaskMessage("Text 도구는 텍스트 영역을 더블 클릭하여 텍스트를 재 편집 할 수 있습니다", TaskMessageType.Normal);
1843
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.TextControl;
1844
                        break;
1845
                    #endregion
1846
                    #region TextBorder
1847
                    case "TextBorder":
1848
                        Common.ViewerDataModel.Instance.SelectedControl = "TextBorder";
1849
                        TaskMessage("Text 도구는 텍스트 영역을 더블 클릭하여 텍스트를 재 편집 할 수 있습니다", TaskMessageType.Normal);
1850
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.TextBorder;
1851
                        break;
1852
                    #endregion
1853
                    #region TextCloud
1854
                    case "TextCloud":
1855
                        Common.ViewerDataModel.Instance.SelectedControl = "TextCloud";
1856
                        TaskMessage("Text 도구는 텍스트 영역을 더블 클릭하여 텍스트를 재 편집 할 수 있습니다", TaskMessageType.Normal);
1857
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.TextCloud;
1858
                        break;
1859
                    #endregion
1860
                    #region Date
1861
                    case "Date":
1862
                        Common.ViewerDataModel.Instance.SelectedControl = "Date";
1863
                        TaskMessage("날짜 컨트롤을 더블 클릭하면 날짜를 변경할 수 있습니다", TaskMessageType.Normal);
1864
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Date;
1865
                        break;
1866
                    #endregion
1867
                    #region ArrowText
1868
                    case "ArrowText":
1869
                        TaskMessage("ArrowText 컨트롤은 그린 후 컨트롤을 선택하였을 시 중간점을 조정할 수 있습니다", TaskMessageType.Normal);
1870
                        if (instanceToggle.Tag.ToString() == "ArrowText_Cloud")
1871
                        {
1872
                            Common.ViewerDataModel.Instance.SelectedControl = "ArrowText_Cloud";
1873
                            instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowTextCloudControl;
1874
                        }
1875
                        else if (instanceToggle.Tag.ToString() == "ArrowText_Border")
1876
                        {
1877
                            Common.ViewerDataModel.Instance.SelectedControl = "ArrowTextBorderControl";
1878
                            instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowTextBorderControl;
1879
                        }
1880
                        else if (instanceToggle.Tag.ToString() == "ArrowTextFix_Normal")
1881
                        {
1882
                            Common.ViewerDataModel.Instance.SelectedControl = "ArrowTransTextControl";
1883
                            instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowTransTextControl;
1884
                        }
1885
                        else if (instanceToggle.Tag.ToString() == "ArrowTextFix_Border")
1886
                        {
1887
                            Common.ViewerDataModel.Instance.SelectedControl = "ArrowTransTextBorderControl";
1888
                            instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowTransTextBorderControl;
1889
                        }
1890
                        else if (instanceToggle.Tag.ToString() == "ArrowTextFix_Cloud")
1891
                        {
1892
                            Common.ViewerDataModel.Instance.SelectedControl = "ArrowTransTextCloudControl";
1893
                            instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowTransTextCloudControl;
1894
                        }
1895
                        else
1896
                        {
1897
                            Common.ViewerDataModel.Instance.SelectedControl = "ArrowText";
1898
                            instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowTextControl;
1899
                            //HiddenAxisLock.Visibility = Visibility.Visible;
1900
                        }
1901
                        break;
1902
                    #endregion
1903
                    #region Arrow
1904
                    case "Arrow":
1905
                        Common.ViewerDataModel.Instance.SelectedControl = "Arrow";
1906
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1907
                        //HiddenDimSize.Visibility = Visibility.Visible;
1908
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowLine;
1909
                        break;
1910
                    #endregion
1911
                    #region Shape
1912
                    case "Shape":
1913
                        Common.ViewerDataModel.Instance.SelectedControl = "Shape";
1914
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Mark;
1915
                        break;
1916
                    #endregion
1917
                    #region Polygon
1918
                    case "Polygon":
1919
                        Common.ViewerDataModel.Instance.SelectedControl = "Polygon";
1920
                        TaskMessage("자유형 코멘트 도구는 오른쪽 마우스 클릭을 통해 그리기를 마칠 수 있습니다", TaskMessageType.Normal);
1921
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1922
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.PolygonControl;
1923
                        break;
1924
                    #endregion
1925
                    #region Arc
1926
                    case "Arc":
1927
                        Common.ViewerDataModel.Instance.SelectedControl = "Arc";
1928
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArcLine;
1929
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1930
                        TaskMessage("Arc 코멘트 도구는 오른쪽 마우스를 사용해 좌우 반전을 사용하실 수 있습니다", TaskMessageType.Normal);
1931
                        break;
1932
                    #endregion
1933
                    #region ArrowArc
1934
                    case "ArrowArc":
1935
                        Common.ViewerDataModel.Instance.SelectedControl = "ArrowArc";
1936
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArcArrow;
1937
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1938
                        TaskMessage("ArcArrow 코멘트 도구는 오른쪽 마우스를 사용해 좌우 반전을 사용하실 수 있습니다", TaskMessageType.Normal);
1939
                        break;
1940
                    #endregion
1941
                    #region ArrowMulti
1942
                    case "ArrowMulti":
1943
                        Common.ViewerDataModel.Instance.SelectedControl = "ArrowMulti";
1944
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowMultiLine;
1945
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1946
                        break;
1947
                    #endregion
1948
                    #region Etc
1949
                    case "Etc":
1950
                        Common.ViewerDataModel.Instance.SelectedControl = "Etc";
1951
                        break;
1952
                    #endregion
1953
                    #region Ink
1954
                    case "Ink":
1955
                        if (instanceToggle.Tag.ToString() == "EraserClear")
1956
                        {
1957
                            TaskMessage("해당 컨트롤은 점 단위로 그려진 펜을 지웁니다", TaskMessageType.Normal);
1958
                            //instanceMain.dzMainMenu.inkDrawingCanvas.EditingMode = InkCanvasEditingMode.EraseByPoint;
1959
                            instanceMain.dzMainMenu.inkBoard.Tag = "EraseByPoint";
1960
                        }
1961
                        else if (instanceToggle.Tag.ToString() == "Eraser")
1962
                        {
1963
                            TaskMessage("해당 컨트롤은 선 단위로 그려진 펜을 지웁니다", TaskMessageType.Normal);
1964
                            instanceMain.dzMainMenu.inkBoard.Tag = "EraseByStroke";
1965
                            //instanceMain.dzMainMenu.inkDrawingCanvas.EditingMode = InkCanvasEditingMode.EraseByStroke;
1966
                        }
1967
                        else
1968
                        {
1969
                            instanceMain.dzMainMenu.inkBoard.Tag = "Ink";
1970
                            //instanceMain.dzMainMenu.inkDrawingCanvas.EditingMode = InkCanvasEditingMode.Ink;
1971
                        }
1972

    
1973
                        //instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = true;
1974

    
1975
                        Common.ViewerDataModel.Instance.SelectedControl = "Ink";
1976
                        Common.ViewerDataModel.Instance.LineSize = (double)cbLineSize.Value;
1977
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.PenControl;
1978
                        break;
1979
                    #endregion
1980
                    #region Select
1981
                    case "Select":
1982
                        if(this.ParentOfType<MainWindow>().dzMainMenu.currentControl != null)
1983
                        {
1984
                            ViewerDataModel.Instance.MarkupControls_USER.Remove(this.ParentOfType<MainWindow>().dzMainMenu.currentControl);
1985
                            this.ParentOfType<MainWindow>().dzMainMenu.currentControl = null;
1986
                        }
1987
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Selecting;
1988
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
1989
                        instanceMain.dzMainMenu.isLeftMouseButtonDownOnWindow = false;
1990
                        break;
1991
                    #endregion
1992
                    #region Image
1993
                    case "Image":
1994
                        Common.ViewerDataModel.Instance.SelectedControl = "ImgControl";
1995
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ImgControl;
1996
                        ImageConverter();
1997
                        break;
1998
                    #endregion
1999
                    #region Sign
2000
                    case "Sign":
2001
                        Common.ViewerDataModel.Instance.SelectedControl = "Sign";
2002
                        Common.ViewerDataModel.Instance.ControlTag = instanceMain.dzMainMenu._ViewInfo.UserID; //사번
2003
                        //강인구 추가
2004
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Sign;
2005
                        //instanceMain.BaseClient.GetUserSignCompleted += (sen, ea) =>
2006
                        //{
2007
                        //    if (ea.Result == null)
2008
                        //    {
2009

    
2010
                        //        this.ParentOfType<MainPage>().DialogMessage_Alert("You Don't Have Sign Data", "Alert");
2011
                        //    }
2012
                        //    else
2013
                        //    {
2014
                        //        byte[] imageBytes = System.Convert.FromBase64String(ea.Result);
2015
                        //        using (MemoryStream ms = new MemoryStream(imageBytes))
2016
                        //        {
2017
                        //            BitmapImage im = new BitmapImage();
2018
                        //            im.SetSource(ms);
2019
                        //            instanceMain.DeepLayer.SignImage = im;
2020
                        //            ms.Close();
2021
                        //        }
2022
                        //    }
2023
                        //};
2024
                        //instanceMain.BaseClient.GetUserSignAsync(instanceMain._ViewInfo.UserID);
2025
                        break;
2026
                    #endregion
2027
                    #region Check
2028
                    case "Check":
2029
                        Common.ViewerDataModel.Instance.SelectedControl = "Check";
2030
                        Common.ViewerDataModel.Instance.ControlTag = instanceMain.dzMainMenu._ViewInfo.UserID; //사번
2031
                        //강인구 추가
2032
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Symbol;
2033
                        break;
2034
                    #endregion
2035
                    #region Batch
2036
                    case "Batch":
2037
                        Common.ViewerDataModel.Instance.SelectedControl = "Batch";
2038
                        Common.ViewerDataModel.Instance.ControlTag = instanceMain.dzMainMenu._ViewInfo.UserID; //사번
2039
                        //강인구 추가
2040
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Mark;
2041
                        instanceMain.dzMainMenu.txtBatch.Visibility = Visibility.Visible;
2042
                        instanceMain.dzMainMenu.txtBatch.Text = "Place Mark";
2043
                        break;
2044
                    #endregion
2045
                    #region Copy
2046
                    case "Copy":
2047
                        Copy_Start();
2048
                        instanceToggle.IsChecked = false;
2049
                        ViewerDataModel.Instance.SelectedControl = "";
2050
                        ViewerDataModel.Instance.ControlTag = null;
2051
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2052
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2053
                        break;
2054
                    #endregion
2055
                    #region Cut
2056
                    case "Cut":
2057
                        Cut_Start();
2058
                        instanceToggle.IsChecked = false;
2059
                        ViewerDataModel.Instance.SelectedControl = "";
2060
                        ViewerDataModel.Instance.ControlTag = null;
2061
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2062
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2063
                        break;
2064
                    #endregion
2065
                    #region Paste
2066
                    case "Paste":
2067
                        Paste_Start();
2068
                        instanceToggle.IsChecked = false;
2069
                        ViewerDataModel.Instance.SelectedControl = "";
2070
                        ViewerDataModel.Instance.ControlTag = null;
2071
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2072
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;                        
2073
                        break;
2074
                    #endregion
2075
                    #region Delete
2076
                    case "Delete":
2077
                        Delete_Start();
2078
                        instanceToggle.IsChecked = false;
2079
                        ViewerDataModel.Instance.SelectedControl = "";
2080
                        ViewerDataModel.Instance.ControlTag = null;
2081
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2082
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2083
                        break;
2084
                    #endregion
2085
                    #region Undo
2086
                    case "Undo":
2087
                        this.ParentOfType<MainWindow>().dzMainMenu.Undo();
2088
                        instanceToggle.IsChecked = false;
2089
                        ViewerDataModel.Instance.SelectedControl = "";
2090
                        ViewerDataModel.Instance.ControlTag = null;
2091
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2092
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2093
                        break;
2094
                    #endregion
2095
                    #region Redo
2096
                    case "Redo":
2097
                        this.ParentOfType<MainWindow>().dzMainMenu.Redo();
2098
                        instanceToggle.IsChecked = false;
2099
                        ViewerDataModel.Instance.SelectedControl = "";
2100
                        ViewerDataModel.Instance.ControlTag = null;
2101
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2102
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2103
                        break;
2104
                    #endregion
2105
                    #region DragZoom
2106
                    case "DragZoom":
2107
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.DragZoom;
2108
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2109
                        instanceMain.dzMainMenu.isLeftMouseButtonDownOnWindow = false;
2110
                        break;
2111
                    #endregion
2112

    
2113
                    default:
2114
                        break;
2115
                }
2116
                #endregion
2117
            }
2118
            else
2119
            {
2120

    
2121
                if (!instanceMain.dzMainMenu.IsFreeSelectionMode)
2122
                {
2123
                    instanceMain.dzMainMenu.IsSwingMode = false;
2124
                    Common.ViewerDataModel.Instance.SelectedControl = "";
2125
                    Common.ViewerDataModel.Instance.ControlTag = null;
2126
                    this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2127
                    this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2128
                }
2129
            }
2130
        }
2131

    
2132
        private void cbAutoSave_Checked(object sender, RoutedEventArgs e)
2133
        {            
2134
            if (cbAutoSave.IsChecked == true)
2135
            {
2136
                SaveTime(true, (int)cbSaveInterval.Value);
2137
            }
2138
            else
2139
            {
2140
                SaveTime(false, (int)cbSaveInterval.Value);
2141
            }
2142
        }
2143
        private void cbSaveInterval_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
2144
        {
2145
            if(string.IsNullOrEmpty(cbSaveInterval.Value.ToString()))
2146
            {
2147
                cbSaveInterval.Value = cbSaveInterval.Minimum;
2148
            }
2149
            if (cbAutoSave.IsChecked == true)
2150
            {
2151
                SaveTime(true, (int)cbSaveInterval.Value);
2152
            }
2153

    
2154
            KCOM.Properties.Settings.Default.SaveInterval = (double)cbSaveInterval.Value;
2155
            Properties.Settings.Default.Save();
2156
        }
2157
        //강인구 자동 저장 추가
2158
        private void AutoSave(object sender, RoutedEventArgs e)
2159
        {
2160
            RadToggleButton instanceToggle = sender as RadToggleButton;
2161

    
2162
            if(instanceToggle.IsChecked == true)
2163
            {
2164
                SaveTime(true);
2165
            }
2166
            else
2167
            {
2168
                SaveTime(false);
2169
            }
2170
        }
2171

    
2172
        public void Copy_Start()
2173
        {
2174
            if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
2175
            {
2176
                string MarkupData = "";
2177

    
2178
                foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
2179
                {
2180
                    if (item.GetType().Name == "AdornerFinal")
2181
                    {
2182
                        foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
2183

    
2184
                        {
2185
                            if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
2186
                            {
2187
                                markupReturn = layer.MarkupToString(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo, App.ViewInfo.UserID);
2188
                                MarkupData += "|OR|" + markupReturn.ConvertData;
2189
                            }
2190
                        }
2191
                        Clipboard.SetText(MarkupData);
2192
                    }
2193
                }
2194
            }
2195
        }
2196

    
2197
        public void Cut_Start()
2198
        {
2199
            if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
2200
            {
2201
                foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
2202
                {
2203
                    string MarkupData = "";
2204

    
2205
                    if (item.GetType().Name == "AdornerFinal")
2206
                    {
2207
                        foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
2208
                        {
2209
                            if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
2210
                            {
2211
                                markupReturn = layer.MarkupToString(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo, App.ViewInfo.UserID);
2212
                                MarkupData += "|OR|" + markupReturn.ConvertData;
2213
                            }
2214
                        }
2215
                        //클립보드에 넣음
2216
                        Clipboard.SetText(MarkupData);
2217
                    }
2218
                }
2219
                this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Clear();
2220
            }
2221
        }
2222

    
2223
        public void Paste_Start()
2224
        {
2225
            //마크업 붙여넣기
2226
            //if (Clipboard.GetText().Contains("|DZ|"))
2227
            if (Clipboard.GetText().Contains("|OR||DZ|"))
2228
            {
2229
                List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>();
2230

    
2231
                string[] delimiterChars = { "|OR|" };
2232
                string[] data = Clipboard.GetText().Split(delimiterChars, StringSplitOptions.RemoveEmptyEntries);
2233

    
2234
                this.ParentOfType<MainWindow>().dzMainMenu.ReleaseAdorner();
2235

    
2236
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
2237

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

    
2247
                ViewerDataModel.Instance.UndoDataList.Where(data1 => data1.IsUndo == true).ToList().ForEach(i =>
2248
                {
2249
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
2250
                });
2251

    
2252
                foreach (string parse in data)
2253
                {
2254
                    if (parse != "")
2255
                    {
2256
                        System.Windows.Controls.Control item = layer.markupParse_Paste(parse, ViewerDataModel.Instance.MarkupControls_USER);
2257
                        (item as MarkupToPDF.Common.CommentUserInfo).CommentID = Events.Save.shortGuid();
2258

    
2259
                        ViewerDataModel.Instance.MarkupControls.Remove(item as MarkupToPDF.Common.CommentUserInfo);
2260
                        ViewerDataModel.Instance.MarkupControls_USER.Remove(item as MarkupToPDF.Common.CommentUserInfo);
2261

    
2262
                        adornerSet.Add(item as MarkupToPDF.Common.CommentUserInfo);
2263

    
2264
                        //Controls.AdornerFinal final = new Controls.AdornerFinal(item as MarkupToPDF.Common.CommentUserInfo);
2265
                        //this.dzMainMenu.SelectLayer.Children.Add(final);
2266

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

    
2269
                        UndoData.Markup_List.Add(multi_Undo_Data);
2270
                        ViewerDataModel.Instance.UndoDataList.Add(UndoData);                        
2271
                    }
2272
                }
2273
                Controls.AdornerFinal final = new Controls.AdornerFinal(adornerSet);
2274

    
2275
                if(this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.X < 0)
2276
                {
2277
                    Canvas.SetLeft(final, 0);
2278
                    Canvas.SetTop(final, 0);
2279
                }
2280
                else
2281
                {
2282
                    double realPointX = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.X - final.BorderSize.X - (final.BorderSize.Width / 2);
2283
                    double realPointY = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.Y - final.BorderSize.Y - (final.BorderSize.Height / 2);
2284
                    final.MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(realPointX, realPointY));
2285

    
2286
                    if (final.MemberSet.Where(type => type.Drawingtype == MarkupToPDF.Controls.Common.ControlType.TextControl).FirstOrDefault() != null)
2287
                    {
2288
                        final.MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(0.001, 0.001)); //dummy
2289
                    }
2290

    
2291
                }
2292
                
2293

    
2294
                this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Add(final);
2295

    
2296
                //붙여 넣을때 원본 컨트롤과 겹치지 않도록 설정
2297
                //Canvas.SetLeft(final, 50);
2298
                //Canvas.SetTop(final, 50);
2299
            }
2300
            //외부 이미지 붙여넣기
2301
            else if (Clipboard.GetImage() != null)
2302
            {
2303
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
2304

    
2305
                //강인구 Undo/Redo 보류
2306
                UndoData = new Undo_data()
2307
                {
2308
                    IsUndo = false,
2309
                    Event = Event_Type.Create,
2310
                    EventTime = DateTime.Now,
2311
                    Markup_List = new List<Multi_Undo_data>()
2312
                };
2313

    
2314

    
2315
                string temppath = System.IO.Path.GetTempPath();
2316
                //string filename = KCOM.Events.Save.shortCommentKey();
2317
                string filename = KCOM.Events.Save.shortFileKey();
2318

    
2319
                System.Drawing.Image clipboardImage = System.Windows.Forms.Clipboard.GetImage();
2320
                clipboardImage.Save(temppath + "\\" + filename);
2321

    
2322
                System.IO.FileInfo fileInfo = new System.IO.FileInfo(temppath + "\\" + filename);
2323
                String strFile = System.IO.Path.GetFileName(fileInfo.FullName);
2324
                long numByte = fileInfo.Length;
2325
                double dLen = Convert.ToDouble(fileInfo.Length / 1000000);
2326
                kr.co.devdoftech.cloud.FileUpload fileUploader = new kr.co.devdoftech.cloud.FileUpload();
2327

    
2328
                if (dLen < 4)
2329
                {
2330
                    System.IO.FileStream fStream = new System.IO.FileStream(fileInfo.FullName,
2331
                    System.IO.FileMode.Open, System.IO.FileAccess.Read);
2332
                    System.IO.BinaryReader br = new System.IO.BinaryReader(fStream);
2333
                    byte[] data = br.ReadBytes((int)numByte);
2334

    
2335
                    filename = fileUploader.Run(App.ViewInfo.ProjectNO, this.ParentOfType<MainWindow>().dzMainMenu._DocItem.DOCUMENT_NO, App.ViewInfo.UserID, strFile + ".png", data);
2336
                    br.Close();
2337
                    fStream.Close();
2338
                    fStream.Dispose();
2339
                }
2340
                else
2341
                {
2342
                    this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert("Available Memory less than 4 mega byte", "Alert");
2343
                    return;
2344
                }
2345

    
2346
                fileInfo.Delete();
2347

    
2348
                //System.Drawing.Image clipboardImage = System.Windows.Forms.Clipboard.GetImage();
2349
                System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(clipboardImage);
2350
                IntPtr hBitmap = bmp.GetHbitmap();
2351
                System.Windows.Media.ImageSource WpfBitmap = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(hBitmap, IntPtr.Zero, Int32Rect.Empty, System.Windows.Media.Imaging.BitmapSizeOptions.FromEmptyOptions());
2352
                Image img = new Image();
2353
                img.Source = new System.Windows.Media.Imaging.BitmapImage(new Uri(filename));
2354

    
2355

    
2356

    
2357

    
2358

    
2359
                var currentControl = new MarkupToPDF.Controls.Etc.ImgControl
2360
                {
2361
                    PointSet = new List<Point>(),
2362
                    FilePath = img.Source.ToString(),
2363
                    ImageData = img.Source,
2364
                    StartPoint = new Point(100, 100),
2365
                    EndPoint = new Point(200, 200),
2366
                    TopRightPoint = new Point(100, 200),
2367
                    LeftBottomPoint = new Point(200, 100)
2368
                };
2369

    
2370
                currentControl.TopRightPoint = new Point(currentControl.StartPoint.X + clipboardImage.Width, currentControl.StartPoint.Y);
2371
                currentControl.LeftBottomPoint = new Point(currentControl.StartPoint.X, currentControl.StartPoint.Y + clipboardImage.Height);
2372
                currentControl.EndPoint = new Point(currentControl.StartPoint.X + clipboardImage.Width, currentControl.StartPoint.Y + clipboardImage.Height);
2373

    
2374
                currentControl.PointSet = new List<Point>
2375
                                        {
2376
                                            currentControl.StartPoint,
2377
                                            currentControl.LeftBottomPoint,
2378
                                            currentControl.EndPoint,
2379
                                            currentControl.TopRightPoint,
2380
                                        };
2381

    
2382
                multi_Undo_Data = this.ParentOfType<MainWindow>().dzMainMenu.Control_Style(currentControl as MarkupToPDF.Common.CommentUserInfo);
2383
                UndoData.Markup_List.Add(multi_Undo_Data);
2384
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
2385

    
2386
                ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl as MarkupToPDF.Common.CommentUserInfo);
2387
                currentControl.CommentID = Events.Save.shortGuid();
2388

    
2389
                currentControl.ApplyTemplate();
2390
                currentControl.SetImage();
2391

    
2392
                ViewerDataModel.Instance.MarkupControls_USER.Remove(currentControl as MarkupToPDF.Common.CommentUserInfo);
2393
                Controls.AdornerFinal final = new Controls.AdornerFinal(currentControl as MarkupToPDF.Common.CommentUserInfo);
2394
                this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Add(final);
2395

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

    
2400
            }
2401
        }
2402

    
2403
        public void Delete_Start()
2404
        {
2405
            if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
2406
            {
2407
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
2408

    
2409
                UndoData = new Undo_data()
2410
                {
2411
                    IsUndo = false,
2412
                    Event = Event_Type.Delete,
2413
                    EventTime = DateTime.Now,
2414
                    Markup_List = new List<Multi_Undo_data>()
2415
                };
2416

    
2417
                foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
2418
                {
2419
                    if (item.GetType().Name == "AdornerFinal")
2420
                    {
2421
                        (item as Controls.AdornerFinal).unRegister();
2422

    
2423
                        foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
2424
                        {
2425
                            //if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
2426
                            if (!ViewerDataModel.Instance.MarkupControls_USER.Contains(InnerItem.DrawingData))
2427
                            {
2428

    
2429
                                multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
2430
                                UndoData.Markup_List.Add(multi_Undo_Data);
2431
                                multi_Undo_Data = new Multi_Undo_data();
2432

    
2433
                                ViewerDataModel.Instance.MarkupControls.Remove(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo);
2434

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

    
2437
                                ViewerDataModel.Instance.MarkupList_USER.Remove(Item_);
2438

    
2439
                                //임시파일에서도 삭제한다.
2440
                                temp.DelTemp((InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo).CommentID, this.ParentOfType<MainWindow>().dzMainMenu.pageNavigator.CurrentPage.PageNumber.ToString());
2441
                                
2442
                            }
2443
                        }
2444
                    }
2445

    
2446
                    ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
2447
                    {
2448
                        ViewerDataModel.Instance.UndoDataList.Remove(i);
2449
                    });
2450
                    ViewerDataModel.Instance.UndoDataList.Add(UndoData);
2451
                }
2452
            }
2453
            this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Clear();
2454
        }
2455

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