프로젝트

일반

사용자정보

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

markus / KCOM / Events / Implementation / TopMenuEvent.cs @ 116801c9

이력 | 보기 | 이력해설 | 다운로드 (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 && menu.gridViewMarkup.Items.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
                        case ("ArrowTextControl"):
750
                            {
751
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).LineSize = ViewerDataModel.Instance.LineSize;
752
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).BorderSize = new Thickness(ViewerDataModel.Instance.LineSize);
753
                            }
754
                            break;
755
                        case ("TextControl"):
756
                            {
757
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).LineSize = new Thickness(ViewerDataModel.Instance.LineSize);
758
                            }
759
                            break;
760
                    }
761
                    
762

    
763
                    multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
764
                    UndoData.Markup_List.Add(multi_Undo_Data);
765
                    multi_Undo_Data = new Multi_Undo_data();
766
                }
767

    
768
                ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
769
                {
770
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
771
                });
772
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
773

    
774
                
775
            }
776
            KCOM.Properties.Settings.Default.LineSize = (double)cbLineSize.Value;
777
            Properties.Settings.Default.Save();
778
        }
779

    
780

    
781
        private void cbIntervalSize_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
782
        {
783
            if (string.IsNullOrEmpty(cbIntervalSize.Value.ToString()))
784
            {
785
                cbIntervalSize.Value = cbIntervalSize.Minimum;
786
            }
787
            List<AdornerMember> AdonerList = GetAdornerItem();
788
            if (AdonerList.Count > 0)
789
            {
790

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

    
801
                foreach (AdornerMember InnerItem in AdonerList)
802
                {
803
                    switch (InnerItem.DrawingData.GetType().Name)
804
                    {
805
                        case ("LineControl"):
806
                            {
807
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Line.LineControl).Interval = ViewerDataModel.Instance.Interval;
808

    
809
                                multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
810
                                UndoData.Markup_List.Add(multi_Undo_Data);
811
                                multi_Undo_Data = new Multi_Undo_data();
812
                            }
813
                            break;
814
                    }
815
                }
816

    
817
                ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
818
                {
819
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
820
                });
821
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
822
            }
823
            KCOM.Properties.Settings.Default.Interval = (double)cbIntervalSize.Value;
824
            Properties.Settings.Default.Save();
825
        }
826
        
827
        private void cbArcLength_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
828
        {
829
            if (string.IsNullOrEmpty(cbArcLength.Value.ToString()))
830
            {
831
                cbArcLength.Value = cbArcLength.Minimum;
832
            }
833
            List<AdornerMember> AdonerList = GetAdornerItem();
834
            if (AdonerList.Count > 0)
835
            {
836

    
837
                //Undo_data UndoData = new Undo_data()
838
                //{
839
                //    IsUndo = false,
840
                //    Event = Event_Type.Option,
841
                //    EventTime = DateTime.Now,
842
                //    Interval = ViewerDataModel.Instance.Interval,
843
                //    Markup_List = new List<Multi_Undo_data>()
844
                //};
845
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
846

    
847
                foreach (AdornerMember InnerItem in AdonerList)
848
                {
849
                    switch (InnerItem.DrawingData.GetType().Name)
850
                    {
851
                        case ("RectCloudControl"):
852
                            {
853
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.RectCloudControl).ArcLength = ViewerDataModel.Instance.ArcLength;
854

    
855
                                //multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
856
                                //UndoData.Markup_List.Add(multi_Undo_Data);
857
                                //multi_Undo_Data = new Multi_Undo_data();
858
                            }
859
                            break;
860
                        case ("CloudControl"):
861
                            {
862
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Polygon.CloudControl).ArcLength = ViewerDataModel.Instance.ArcLength;
863

    
864
                                //multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
865
                                //UndoData.Markup_List.Add(multi_Undo_Data);
866
                                //multi_Undo_Data = new Multi_Undo_data();
867
                            }
868
                            break;
869
                    }
870
                }
871

    
872
                //ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
873
                //{
874
                //    ViewerDataModel.Instance.UndoDataList.Remove(i);
875
                //});
876
                //ViewerDataModel.Instance.UndoDataList.Add(UndoData);
877
            }
878

    
879
            KCOM.Properties.Settings.Default.ArcLength = (double)cbArcLength.Value;
880
            Properties.Settings.Default.Save();
881
        }
882

    
883
        //강인구 추가(Undo End)
884
        private void cbDashStyle_SelectionChanged(object sender, SelectionChangedEventArgs e)
885
        {
886
            //강인구 추가
887
            if (this.ParentOfType<MainWindow>() != null)
888
            {
889
                ViewerDataModel.Instance.DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
890
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
891
                {
892
                    Undo_data UndoData = new Undo_data()
893
                    {
894
                        IsUndo = false,
895
                        Event = Event_Type.Option,
896
                        EventTime = DateTime.Now,
897
                        DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData,
898
                        Markup_List = new List<Multi_Undo_data>()
899
                    };
900
                    Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
901

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

    
962
                                multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
963
                                UndoData.Markup_List.Add(multi_Undo_Data);
964
                                multi_Undo_Data = new Multi_Undo_data();
965
                            }
966

    
967
                            ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
968
                            {
969
                                ViewerDataModel.Instance.UndoDataList.Remove(i);
970
                            });
971
                            ViewerDataModel.Instance.UndoDataList.Add(UndoData);
972
                        }
973
                    }
974
                }
975
            }
976
        }
977

    
978
        //강인구 추가
979
        private void comboFontSize_SelectionChanged(object sender, SelectionChangedEventArgs e)
980
        {
981
            //if (this.ParentOfType<MainWindow>() != null)
982
            //{
983
            //    if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
984
            //    {
985
            //        foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
986
            //        {
987
            //            if (item.GetType().Name == "AdornerFinal")
988
            //            {
989
            //                foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
990
            //                {
991
            //                    switch (InnerItem.DrawingData.GetType().Name)
992
            //                    {
993
            //                        case ("TextControl"):
994
            //                            {
995
            //                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextSize = int.Parse(comboFontSize.Text);
996
            //                            }
997
            //                            break;
998
            //                        case ("ArrowTextControl"):
999
            //                            {
1000
            //                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextSize = int.Parse(comboFontSize.Text);
1001
            //                            }
1002
            //                            break;
1003
            //                    }
1004
            //                }
1005
            //            }
1006
            //        }
1007
            //    }
1008
            //}
1009
        }
1010

    
1011
        //강인구 추가
1012
        private void btnBold_Checked(object sender, RoutedEventArgs e)
1013
        {
1014
            if (this.ParentOfType<MainWindow>() != null)
1015
            {
1016
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
1017
                {
1018
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
1019
                    {
1020
                        if (item.GetType().Name == "AdornerFinal")
1021
                        {
1022
                            foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
1023
                            {
1024
                                switch (InnerItem.DrawingData.GetType().Name)
1025
                                {
1026
                                    case ("TextControl"):
1027
                                        {
1028
                                            if((InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextWeight == FontWeights.Bold)
1029
                                            {
1030
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextWeight = FontWeights.Normal;
1031
                                            }
1032
                                            else
1033
                                            {
1034
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextWeight = FontWeights.Bold;
1035
                                            }
1036

    
1037
                                        }
1038
                                        break;
1039
                                    case ("ArrowTextControl"):
1040
                                        {
1041
                                            if ((InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextWeight == FontWeights.Bold)
1042
                                            {
1043
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextWeight = FontWeights.Normal;
1044
                                            }
1045
                                            else
1046
                                            {
1047
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextWeight = FontWeights.Bold;
1048
                                            }
1049
                                        }
1050
                                        break;
1051
                                }
1052
                            }
1053
                        }
1054
                    }
1055
                }
1056
            }
1057
        }
1058

    
1059
        //강인구 추가
1060
        private void btnItalic_Checked(object sender, RoutedEventArgs e)
1061
        {
1062
            if (this.ParentOfType<MainWindow>() != null)
1063
            {
1064
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
1065
                {
1066
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
1067
                    {
1068
                        if (item.GetType().Name == "AdornerFinal")
1069
                        {
1070
                            foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
1071
                            {
1072
                                switch (InnerItem.DrawingData.GetType().Name)
1073
                                {
1074
                                    case ("TextControl"):
1075
                                        {
1076
                                            if((InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextStyle == FontStyles.Italic)
1077
                                            {
1078
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextStyle = System.Windows.FontStyles.Normal;
1079
                                            }
1080
                                            else
1081
                                            {
1082
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextStyle = FontStyles.Italic;
1083
                                            }
1084

    
1085
                                        }
1086
                                        break;
1087
                                    case ("ArrowTextControl"):
1088
                                        {
1089
                                            if((InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextStyle == FontStyles.Italic)
1090
                                            {
1091
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextStyle = FontStyles.Normal;
1092
                                            }
1093
                                            else
1094
                                            {
1095
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextStyle = FontStyles.Italic;
1096
                                            }
1097
                                        }
1098
                                        break;
1099
                                }
1100
                            }
1101
                        }
1102
                    }
1103
                }
1104
            }
1105
        }
1106

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

    
1154
        private void AxisLockEvent(object sender, RoutedEventArgs e)
1155
        {
1156
            ViewerDataModel.Instance.checkAxis = cbAxisLock.IsChecked.Value;
1157
        }
1158

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

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

    
1246
        /// <summary>
1247
        /// 텍스트 컨트롤 하일라이트 처리
1248
        /// </summary>
1249
        /// <param name="sender"></param>
1250
        /// <param name="e"></param>
1251
        private void HighlightEvent(object sender, RoutedEventArgs e)
1252
        {
1253

    
1254
            ViewerDataModel.Instance.checkHighShape = (sender as CheckBox).IsChecked.Value;
1255
            SetHighlightEvent();
1256
            //if ((sender as CheckBox).IsChecked.Value)
1257
            //{
1258
            //    TaskMessage("HighLight가 설정되었습니다", TaskMessageType.Normal);
1259
            //}
1260
            //else
1261
            //{
1262
            //    TaskMessage("HighLight가 해제되었습니다", TaskMessageType.Caption);
1263
            //}
1264
            //if (ViewerDataModel.Instance.SelectedEditor as MarkupToPDF.Controls.Text.TextControl != null)
1265
            //{
1266
            //    MarkupToPDF.Controls.Text.TextControl instance = (ViewerDataModel.Instance.SelectedEditor as MarkupToPDF.Controls.Text.TextControl);
1267
            //    instance.IsHighLight = ViewerDataModel.Instance.checkHighShape;
1268
            //    instance.SetText();
1269
            //}
1270
        }
1271

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

    
1296
        public event EventHandler<WindowClosedEventArgs> Closed;
1297

    
1298
        //private void CheckEvent(object sender, RoutedEventArgs e)
1299
        //{
1300
        //    RadWindow CheckPop = new RadWindow();
1301
        //    test check = new test();
1302

    
1303
        //    CheckPop = new RadWindow
1304
        //    {
1305
        //        Width = 1700,
1306
        //        Height = 510,
1307
        //        Header = "My Check List",
1308
        //        Content = check,
1309
        //        Owner = this,
1310
        //        ResizeMode = System.Windows.ResizeMode.NoResize,
1311
        //        WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen,
1312
        //    };
1313
        //    StyleManager.SetTheme(CheckPop, new VisualStudio2013Theme());
1314

    
1315
        //    CheckPop.Closed += CheckPop_Closed;
1316
        //    CheckPop.ShowDialog();
1317
        //}
1318

    
1319
        private void PanoramaEvent(object sender, RoutedEventArgs e)
1320
        {
1321
            PanoramaShow();
1322
        }
1323

    
1324
        public void PanoramaShow()
1325
        {
1326
            Panorama check = new Panorama();
1327
            double screenWidth = System.Windows.SystemParameters.PrimaryScreenWidth;
1328
            double screenHeight = System.Windows.SystemParameters.PrimaryScreenHeight;
1329
            //double windowWidth = this.Width;
1330
            //double windowHeight = this.Height;
1331

    
1332
            var PanoramaPop = new RadWindow
1333
            {
1334
                //MinWidth = 600,
1335
                //MinHeight = 400,
1336
                //Header = "My Check List",
1337
                Header = "Document No : " + this.ParentOfType<MainWindow>().dzMainMenu._DocItem.DOCUMENT_NO + " / Revision :" + this.ParentOfType<MainWindow>().dzMainMenu._DocItem.REVISION,
1338
                Content = check,
1339
                Owner = this,
1340
                ResizeMode = System.Windows.ResizeMode.CanResizeWithGrip,
1341
                //ResizeMode = System.Windows.ResizeMode.NoResize,
1342
                WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen,
1343
                IsTopmost = false,
1344
                //Left = (screenWidth / 2) - (windowWidth / 2),
1345
                //Top = (screenHeight / 2) - (windowHeight / 2),
1346
                //Left = (screenWidth / 2),
1347
                //Top = (screenHeight / 2),
1348
                Width = screenWidth * 0.4,
1349
                Height = screenHeight * 0.4,
1350
            };
1351
            StyleManager.SetTheme(PanoramaPop, new VisualStudio2013Theme());
1352
            //CheckPop.ShowDialog();
1353
            PanoramaPop.Show();
1354
        }
1355

    
1356
        private void CheckEvent(object sender, RoutedEventArgs e)
1357
        {
1358
            //창이 떠있을 경우 재 실행 방지
1359
            if (isClosed)
1360
            {
1361
                //토글 및 마우스 상태 초기화
1362
                var toggleList = this.Parent.ChildrenOfType<RadToggleButton>();
1363
                foreach(var togle in toggleList)
1364
                {
1365
                    togle.IsChecked = false;
1366
                }
1367
                this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
1368

    
1369
                isClosed = false;
1370

    
1371
                
1372
                CheckList check = new CheckList();
1373

    
1374
                CheckPop = new RadWindow
1375
                {
1376
                    MinWidth = 1200,
1377
                    MinHeight = 500,
1378
                    //Header = "My Check List",
1379
                    Header = "Document No : " + this.ParentOfType<MainWindow>().dzMainMenu._DocItem.DOCUMENT_NO + " / Revision :" + this.ParentOfType<MainWindow>().dzMainMenu._DocItem.REVISION,
1380
                    Content = check,
1381
                    //Owner = this,
1382
                    //ResizeMode = System.Windows.ResizeMode.CanResizeWithGrip,
1383
                    ResizeMode = System.Windows.ResizeMode.NoResize,
1384
                    WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen,
1385
                    IsTopmost = true,
1386
                };
1387
                StyleManager.SetTheme(CheckPop, new Office2013Theme());
1388
                CheckPop.Closed += CheckPop_Closed;
1389
                
1390
                //CheckPop.ShowDialog();
1391
                CheckPop.Show();
1392
            }
1393
        }
1394

    
1395
        private void CheckPop_Closed(object sender, WindowClosedEventArgs e)
1396
        {
1397
            isClosed = true;
1398
            //this.ParentOfType<MainWindow>().dzMainMenu.PN_Navi.IsEnabled = true;
1399
            this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
1400
            ViewerDataModel.Instance.Capture_Opacity = 0;
1401
        }
1402

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

    
1441
        private void viewEvent(object sender, RoutedEventArgs e)
1442
        {
1443
            RadRibbonToggleButton viewButton = sender as RadRibbonToggleButton;
1444
            var instanceMain = this.ParentOfType<MainWindow>();
1445

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

    
1448
            //if ((sender as RadRibbonToggleButton) != null)
1449
            //{
1450
            //    Common.ViewerDataModel.Instance.ControlTag = (sender as RadRibbonToggleButton).Tag.ToString();
1451
            //    instanceToggle = (sender as RadRibbonToggleButton);
1452
            //}
1453

    
1454
            //instanceToggle.IsChecked = false;
1455

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

    
1497
                    }
1498
                    break;
1499
                case "Rotate_M":
1500
                    {
1501
                        drawingPannelRotate(false);
1502
                        viewButton.IsChecked = false;
1503
                    }
1504
                    break;
1505
                case "Rotate_P":
1506
                    {
1507
                        drawingPannelRotate(true);
1508
                        viewButton.IsChecked = false;
1509
                    }
1510
                    break;
1511
                case "Rotate_half":
1512
                    {
1513
                        drawingPannelRotate(true);
1514
                        drawingPannelRotate(true);
1515
                        viewButton.IsChecked = false;
1516
                    }
1517
                    break;
1518
            }
1519
        }
1520

    
1521
        private void Control_Event(object sender, RoutedEventArgs e)
1522
        {
1523

    
1524
        }
1525

    
1526
        #region 대기
1527

    
1528
        public void drawingPannelRotate(bool Flag)
1529
        {
1530
            var instanceMain = this.ParentOfType<MainWindow>();
1531

    
1532
            //if (rotateOffSet > 3)
1533
            //    rotateOffSet = 0;
1534

    
1535
            //if (rotateOffSet < 0)
1536
            //    rotateOffSet = 3;
1537

    
1538
            if(Flag)
1539
            {
1540
                if (instanceMain.dzMainMenu.rotate.Angle == 270)
1541
                {
1542
                    instanceMain.dzMainMenu.rotate.Angle = 0;
1543
                }
1544
                else
1545
                {
1546
                    instanceMain.dzMainMenu.rotate.Angle += 90;
1547
                }
1548
            }
1549
            else
1550
            {
1551
                if(instanceMain.dzMainMenu.rotate.Angle == 0)
1552
                {
1553
                    instanceMain.dzMainMenu.rotate.Angle = 270;
1554
                }
1555
                else
1556
                {
1557
                    instanceMain.dzMainMenu.rotate.Angle -= 90;
1558
                }
1559
            }
1560
            //double angle = (double)rotateValue.GetValue(rotateOffSet);
1561
            //instanceMain.dzMainMenu.rotate.Angle = angle;
1562
            var rotationNum = Math.Abs((instanceMain.dzMainMenu.rotate.Angle / 90));
1563

    
1564
            if (instanceMain.dzMainMenu.zoomAndPanCanvas.Width == ViewerDataModel.Instance.ContentWidth)
1565
            {
1566
                double emptySize = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
1567
                instanceMain.dzMainMenu.zoomAndPanCanvas.Width = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
1568
                instanceMain.dzMainMenu.zoomAndPanCanvas.Height = emptySize;
1569
            }
1570
            if (instanceMain.dzMainMenu.rotate.Angle == 0)
1571
            {
1572
                instanceMain.dzMainMenu.translate.X = 0;
1573
                instanceMain.dzMainMenu.translate.Y = 0;
1574
            }
1575
            else if (instanceMain.dzMainMenu.rotate.Angle == 90)
1576
            {
1577
                instanceMain.dzMainMenu.translate.X = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
1578
                instanceMain.dzMainMenu.translate.Y = 0;
1579
            }
1580
            else if (instanceMain.dzMainMenu.rotate.Angle == 180)
1581
            {
1582
                instanceMain.dzMainMenu.translate.X = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
1583
                instanceMain.dzMainMenu.translate.Y = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
1584
            }
1585
            else
1586
            {
1587
                instanceMain.dzMainMenu.translate.X = 0;
1588
                instanceMain.dzMainMenu.translate.Y = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
1589
            }
1590

    
1591
            //instanceMain.dzMainMenu.zoomAndPanControl.RenderTransformOrigin = new Point(0.5, 0.5);
1592
            instanceMain.dzMainMenu.zoomAndPanControl.RotationAngle = instanceMain.dzMainMenu.rotate.Angle;
1593
            //대기(강인구)
1594
            //instanceMain.dzMainMenu.imageViewer.RotateAngle = instanceMain.dzMainMenu.rotate.Angle;
1595

    
1596

    
1597
            //instanceMain.dzMainMenu.imageViewer.RenderTransformOrigin = new Point(0.5, 0.5);
1598
            //RotateTransform rotateTransform = new RotateTransform(instanceMain.dzMainMenu.rotate.Angle);
1599
            //instanceMain.dzMainMenu.imageViewer.RenderTransform = rotateTransform;
1600

    
1601

    
1602
            ViewerDataModel.Instance.ContentWidth = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
1603
            ViewerDataModel.Instance.ContentHeight = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
1604
            ViewerDataModel.Instance.AngleOffsetX = instanceMain.dzMainMenu.translate.X;
1605
            ViewerDataModel.Instance.AngleOffsetY = instanceMain.dzMainMenu.translate.Y;
1606
            ViewerDataModel.Instance.Angle = instanceMain.dzMainMenu.rotate.Angle;
1607
            //ViewerDataModel.Instance.Document_Info.Clear();
1608
            //ViewerDataModel.Instance.Document_Info.Where(i => i.PAGE_NUMBER == instanceMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber).ToList().ForEach(value =>
1609
            //{
1610
            //    value.PAGE_ANGLE = int.Parse(instanceMain.dzMainMenu.rotate.Angle.ToString());
1611
            //});
1612

    
1613

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

    
1619
                instanceMain.dzMainMenu.pageNavigator.ImgListbox.ItemsSource = instanceMain.dzMainMenu.pageNavigator._thumbnailItems;
1620
                var instance = instanceMain.dzMainMenu.CurrentDoc.docInfo.DOCPAGE.Where(p => p.PAGE_NUMBER == instanceMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber).FirstOrDefault();
1621
                instance.PAGE_ANGLE = int.Parse(instanceMain.dzMainMenu.rotate.Angle.ToString());
1622

    
1623
                instanceMain.dzMainMenu.pageNavigator.setPageChange(data);
1624

    
1625
                //rotation page add or update
1626
                var rotationdoc = ViewerDataModel.Instance.RotationDocs.Where(d => d.ID == instance.ID).FirstOrDefault();
1627
                if (rotationdoc != null)
1628
                {
1629
                    rotationdoc.PAGE_ANGLE = instance.PAGE_ANGLE;
1630
                }
1631
                else
1632
                {
1633
                    ViewerDataModel.Instance.RotationDocs.Add(instance);
1634
                }
1635
            });
1636
        }
1637
        #endregion
1638

    
1639
        private void ImageConverter()
1640
        {
1641
            var instanceMain = this.ParentOfType<MainWindow>();
1642
            //http://cloud.devdoftech.co.kr:5977/ImageUpload/FileUpload.asmx
1643

    
1644

    
1645
            Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
1646
            dlg.Filter = "All files (*.*)|*.*|PNG Images (*.png)|*.png";
1647
            Nullable<bool> result = dlg.ShowDialog();
1648
            if (result == true)
1649
            {
1650
                instanceMain.dzMainMenu.filename = dlg.FileName;
1651
                instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ImgControl;
1652

    
1653
                System.IO.FileInfo fileInfo = new System.IO.FileInfo(instanceMain.dzMainMenu.filename);
1654
                String strFile = System.IO.Path.GetFileName(instanceMain.dzMainMenu.filename);
1655
                long numByte = fileInfo.Length;
1656
                double dLen = Convert.ToDouble(fileInfo.Length / 1000000);
1657
                kr.co.devdoftech.cloud.FileUpload fileUploader = new kr.co.devdoftech.cloud.FileUpload();
1658

    
1659
                if (dLen < 4)
1660
                {
1661
                    System.IO.FileStream fStream = new System.IO.FileStream(instanceMain.dzMainMenu.filename, System.IO.FileMode.Open, System.IO.FileAccess.Read);
1662
                    System.IO.BinaryReader br = new System.IO.BinaryReader(fStream);
1663
                    byte[] data = br.ReadBytes((int)numByte);
1664
                    br.Close();
1665

    
1666
                    instanceMain.dzMainMenu.filename = fileUploader.Run(App.ViewInfo.ProjectNO, instanceMain.dzMainMenu._DocItem.DOCUMENT_NO, App.ViewInfo.UserID, strFile, data);
1667
                    fStream.Close();
1668
                    fStream.Dispose();
1669
                }
1670
                else
1671
                {
1672
                    this.ParentOfType<MainWindow>().DialogMessage_Alert("Available Memory less than 4 mega byte", "Alert");
1673
                }
1674
            }
1675
        }
1676

    
1677
        private void Control_Init(RadToggleButton instanceToggle, object sender)
1678
        {
1679

    
1680
        }
1681

    
1682
        private void ControlEvent(object sender, RoutedEventArgs e)
1683
        {
1684
            RadToggleButton instanceToggle = sender as RadToggleButton;
1685
            var instanceMain = this.ParentOfType<MainWindow>();
1686

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

    
1707
            //if (!instanceMain.IsFreeSelectionMode)
1708
            //{
1709
            //    instanceMain.IsSwingMode = true;
1710
            //}
1711

    
1712
            #region 다른 컨트롤 버튼 선택 해제
1713
            System.Reactive.Linq.Observable2.FromPropertyChangedPattern(Common.ViewerDataModel.Instance, temp => temp.SelectedControl).Subscribe(ControlState =>
1714
            {
1715
                if (ControlState == null)
1716
                {
1717
                    instanceToggle.IsChecked = false;
1718
                    HiddenControlHide();
1719
                }
1720
            });
1721
            #endregion
1722

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

    
1725
            if (instanceToggle != null)
1726
            {
1727
                Common.ViewerDataModel.Instance.ControlTag = instanceToggle.Tag.ToString();
1728
            }
1729
            else if ((sender as RadRibbonToggleButton) != null)
1730
            {
1731
                Common.ViewerDataModel.Instance.ControlTag = (sender as RadRibbonToggleButton).Tag.ToString();
1732
                instanceToggle = (sender as RadRibbonToggleButton);
1733
            }
1734
            else if ((sender as RadRibbonButton) != null)
1735
            {
1736
                RadRibbonButton instanceButton = sender as RadRibbonButton;
1737
                Common.ViewerDataModel.Instance.ControlTag = instanceButton.Tag.ToString();
1738
            }
1739
            else
1740
            {
1741
                RadButton instanceButton = sender as RadButton;
1742
                Common.ViewerDataModel.Instance.ControlTag = instanceButton.Tag.ToString();
1743
            }
1744

    
1745

    
1746

    
1747
            System.Reactive.Linq.Observable2.FromPropertyChangedPattern(Common.ViewerDataModel.Instance, temp => temp.AngleVisibility).Subscribe(isSee =>
1748
            {
1749
                instanceMain.dzMainMenu.MainAngle.Visibility = isSee;
1750
                System.Reactive.Linq.Observable2.FromPropertyChangedPattern(Common.ViewerDataModel.Instance, temp => temp.AngleValue).Subscribe(p =>
1751
                {
1752
                    instanceMain.dzMainMenu.MainAngle.AngleValue = p;
1753
                });
1754
            });
1755
            instanceMain.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Drawing;
1756

    
1757
            instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = false;
1758

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

    
1984
                        //instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = true;
1985

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

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

    
2124
                    default:
2125
                        break;
2126
                }
2127
                #endregion
2128
            }
2129
            else
2130
            {
2131

    
2132
                if (!instanceMain.dzMainMenu.IsFreeSelectionMode)
2133
                {
2134
                    instanceMain.dzMainMenu.IsSwingMode = false;
2135
                    Common.ViewerDataModel.Instance.SelectedControl = "";
2136
                    Common.ViewerDataModel.Instance.ControlTag = null;
2137
                    this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2138
                    this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2139
                }
2140
            }
2141
        }
2142

    
2143
        private void cbAutoSave_Checked(object sender, RoutedEventArgs e)
2144
        {            
2145
            if (cbAutoSave.IsChecked == true)
2146
            {
2147
                SaveTime(true, (int)cbSaveInterval.Value);
2148
            }
2149
            else
2150
            {
2151
                SaveTime(false, (int)cbSaveInterval.Value);
2152
            }
2153
        }
2154
        private void cbSaveInterval_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
2155
        {
2156
            if(string.IsNullOrEmpty(cbSaveInterval.Value.ToString()))
2157
            {
2158
                cbSaveInterval.Value = cbSaveInterval.Minimum;
2159
            }
2160
            if (cbAutoSave.IsChecked == true)
2161
            {
2162
                SaveTime(true, (int)cbSaveInterval.Value);
2163
            }
2164

    
2165
            KCOM.Properties.Settings.Default.SaveInterval = (double)cbSaveInterval.Value;
2166
            Properties.Settings.Default.Save();
2167
        }
2168
        //강인구 자동 저장 추가
2169
        private void AutoSave(object sender, RoutedEventArgs e)
2170
        {
2171
            RadToggleButton instanceToggle = sender as RadToggleButton;
2172

    
2173
            if(instanceToggle.IsChecked == true)
2174
            {
2175
                SaveTime(true);
2176
            }
2177
            else
2178
            {
2179
                SaveTime(false);
2180
            }
2181
        }
2182

    
2183
        public void Copy_Start()
2184
        {
2185
            if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
2186
            {
2187
                string MarkupData = "";
2188

    
2189
                foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
2190
                {
2191
                    if (item.GetType().Name == "AdornerFinal")
2192
                    {
2193
                        foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
2194

    
2195
                        {
2196
                            if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
2197
                            {
2198
                                markupReturn = layer.MarkupToString(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo, App.ViewInfo.UserID);
2199
                                MarkupData += "|OR|" + markupReturn.ConvertData;
2200
                            }
2201
                        }
2202
                        Clipboard.SetText(MarkupData);
2203
                    }
2204
                }
2205
            }
2206
        }
2207

    
2208
        public void Cut_Start()
2209
        {
2210
            if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
2211
            {
2212
                foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
2213
                {
2214
                    string MarkupData = "";
2215

    
2216
                    if (item.GetType().Name == "AdornerFinal")
2217
                    {
2218
                        foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
2219
                        {
2220
                            if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
2221
                            {
2222
                                markupReturn = layer.MarkupToString(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo, App.ViewInfo.UserID);
2223
                                MarkupData += "|OR|" + markupReturn.ConvertData;
2224
                            }
2225
                        }
2226
                        //클립보드에 넣음
2227
                        Clipboard.SetText(MarkupData);
2228
                    }
2229
                }
2230
                this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Clear();
2231
            }
2232
        }
2233

    
2234
        public void Paste_Start()
2235
        {
2236
            //마크업 붙여넣기
2237
            //if (Clipboard.GetText().Contains("|DZ|"))
2238
            if (Clipboard.GetText().Contains("|OR||DZ|"))
2239
            {
2240
                List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>();
2241

    
2242
                string[] delimiterChars = { "|OR|" };
2243
                string[] data = Clipboard.GetText().Split(delimiterChars, StringSplitOptions.RemoveEmptyEntries);
2244

    
2245
                this.ParentOfType<MainWindow>().dzMainMenu.ReleaseAdorner();
2246

    
2247
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
2248

    
2249
                //강인구 Undo/Redo 보류
2250
                UndoData = new Undo_data()
2251
                {
2252
                    IsUndo = false,
2253
                    Event = Event_Type.Create,
2254
                    EventTime = DateTime.Now,
2255
                    Markup_List = new List<Multi_Undo_data>()
2256
                };
2257

    
2258
                ViewerDataModel.Instance.UndoDataList.Where(data1 => data1.IsUndo == true).ToList().ForEach(i =>
2259
                {
2260
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
2261
                });
2262

    
2263
                foreach (string parse in data)
2264
                {
2265
                    if (parse != "")
2266
                    {
2267
                        System.Windows.Controls.Control item = layer.markupParse_Paste(parse, ViewerDataModel.Instance.MarkupControls_USER);
2268
                        (item as MarkupToPDF.Common.CommentUserInfo).CommentID = Events.Save.shortGuid();
2269

    
2270
                        ViewerDataModel.Instance.MarkupControls.Remove(item as MarkupToPDF.Common.CommentUserInfo);
2271
                        ViewerDataModel.Instance.MarkupControls_USER.Remove(item as MarkupToPDF.Common.CommentUserInfo);
2272

    
2273
                        adornerSet.Add(item as MarkupToPDF.Common.CommentUserInfo);
2274

    
2275
                        //Controls.AdornerFinal final = new Controls.AdornerFinal(item as MarkupToPDF.Common.CommentUserInfo);
2276
                        //this.dzMainMenu.SelectLayer.Children.Add(final);
2277

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

    
2280
                        UndoData.Markup_List.Add(multi_Undo_Data);
2281
                        ViewerDataModel.Instance.UndoDataList.Add(UndoData);                        
2282
                    }
2283
                }
2284
                Controls.AdornerFinal final = new Controls.AdornerFinal(adornerSet);
2285

    
2286
                if(this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.X < 0)
2287
                {
2288
                    Canvas.SetLeft(final, 0);
2289
                    Canvas.SetTop(final, 0);
2290
                }
2291
                else
2292
                {
2293
                    double realPointX = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.X - final.BorderSize.X - (final.BorderSize.Width / 2);
2294
                    double realPointY = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.Y - final.BorderSize.Y - (final.BorderSize.Height / 2);
2295
                    final.MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(realPointX, realPointY));
2296

    
2297
                    if (final.MemberSet.Where(type => type.Drawingtype == MarkupToPDF.Controls.Common.ControlType.TextControl).FirstOrDefault() != null)
2298
                    {
2299
                        final.MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(0.001, 0.001)); //dummy
2300
                    }
2301

    
2302
                }
2303
                
2304

    
2305
                this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Add(final);
2306

    
2307
                //붙여 넣을때 원본 컨트롤과 겹치지 않도록 설정
2308
                //Canvas.SetLeft(final, 50);
2309
                //Canvas.SetTop(final, 50);
2310
            }
2311
            //외부 이미지 붙여넣기
2312
            else if (Clipboard.GetImage() != null)
2313
            {
2314
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
2315

    
2316
                //강인구 Undo/Redo 보류
2317
                UndoData = new Undo_data()
2318
                {
2319
                    IsUndo = false,
2320
                    Event = Event_Type.Create,
2321
                    EventTime = DateTime.Now,
2322
                    Markup_List = new List<Multi_Undo_data>()
2323
                };
2324

    
2325

    
2326
                string temppath = System.IO.Path.GetTempPath();
2327
                //string filename = KCOM.Events.Save.shortCommentKey();
2328
                string filename = KCOM.Events.Save.shortFileKey();
2329

    
2330
                System.Drawing.Image clipboardImage = System.Windows.Forms.Clipboard.GetImage();
2331
                clipboardImage.Save(temppath + "\\" + filename);
2332

    
2333
                System.IO.FileInfo fileInfo = new System.IO.FileInfo(temppath + "\\" + filename);
2334
                String strFile = System.IO.Path.GetFileName(fileInfo.FullName);
2335
                long numByte = fileInfo.Length;
2336
                double dLen = Convert.ToDouble(fileInfo.Length / 1000000);
2337
                kr.co.devdoftech.cloud.FileUpload fileUploader = new kr.co.devdoftech.cloud.FileUpload();
2338

    
2339
                if (dLen < 4)
2340
                {
2341
                    System.IO.FileStream fStream = new System.IO.FileStream(fileInfo.FullName,
2342
                    System.IO.FileMode.Open, System.IO.FileAccess.Read);
2343
                    System.IO.BinaryReader br = new System.IO.BinaryReader(fStream);
2344
                    byte[] data = br.ReadBytes((int)numByte);
2345

    
2346
                    filename = fileUploader.Run(App.ViewInfo.ProjectNO, this.ParentOfType<MainWindow>().dzMainMenu._DocItem.DOCUMENT_NO, App.ViewInfo.UserID, strFile + ".png", data);
2347
                    br.Close();
2348
                    fStream.Close();
2349
                    fStream.Dispose();
2350
                }
2351
                else
2352
                {
2353
                    this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert("Available Memory less than 4 mega byte", "Alert");
2354
                    return;
2355
                }
2356

    
2357
                fileInfo.Delete();
2358

    
2359
                //System.Drawing.Image clipboardImage = System.Windows.Forms.Clipboard.GetImage();
2360
                System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(clipboardImage);
2361
                IntPtr hBitmap = bmp.GetHbitmap();
2362
                System.Windows.Media.ImageSource WpfBitmap = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(hBitmap, IntPtr.Zero, Int32Rect.Empty, System.Windows.Media.Imaging.BitmapSizeOptions.FromEmptyOptions());
2363
                Image img = new Image();
2364
                img.Source = new System.Windows.Media.Imaging.BitmapImage(new Uri(filename));
2365

    
2366

    
2367

    
2368

    
2369

    
2370
                var currentControl = new MarkupToPDF.Controls.Etc.ImgControl
2371
                {
2372
                    PointSet = new List<Point>(),
2373
                    FilePath = img.Source.ToString(),
2374
                    ImageData = img.Source,
2375
                    StartPoint = new Point(100, 100),
2376
                    EndPoint = new Point(200, 200),
2377
                    TopRightPoint = new Point(100, 200),
2378
                    LeftBottomPoint = new Point(200, 100)
2379
                };
2380

    
2381
                currentControl.TopRightPoint = new Point(currentControl.StartPoint.X + clipboardImage.Width, currentControl.StartPoint.Y);
2382
                currentControl.LeftBottomPoint = new Point(currentControl.StartPoint.X, currentControl.StartPoint.Y + clipboardImage.Height);
2383
                currentControl.EndPoint = new Point(currentControl.StartPoint.X + clipboardImage.Width, currentControl.StartPoint.Y + clipboardImage.Height);
2384

    
2385
                currentControl.PointSet = new List<Point>
2386
                                        {
2387
                                            currentControl.StartPoint,
2388
                                            currentControl.LeftBottomPoint,
2389
                                            currentControl.EndPoint,
2390
                                            currentControl.TopRightPoint,
2391
                                        };
2392

    
2393
                multi_Undo_Data = this.ParentOfType<MainWindow>().dzMainMenu.Control_Style(currentControl as MarkupToPDF.Common.CommentUserInfo);
2394
                UndoData.Markup_List.Add(multi_Undo_Data);
2395
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
2396

    
2397
                ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl as MarkupToPDF.Common.CommentUserInfo);
2398
                currentControl.CommentID = Events.Save.shortGuid();
2399

    
2400
                currentControl.ApplyTemplate();
2401
                currentControl.SetImage();
2402

    
2403
                ViewerDataModel.Instance.MarkupControls_USER.Remove(currentControl as MarkupToPDF.Common.CommentUserInfo);
2404
                Controls.AdornerFinal final = new Controls.AdornerFinal(currentControl as MarkupToPDF.Common.CommentUserInfo);
2405
                this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Add(final);
2406

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

    
2411
            }
2412
        }
2413

    
2414
        public void Delete_Start()
2415
        {
2416
            if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
2417
            {
2418
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
2419

    
2420
                UndoData = new Undo_data()
2421
                {
2422
                    IsUndo = false,
2423
                    Event = Event_Type.Delete,
2424
                    EventTime = DateTime.Now,
2425
                    Markup_List = new List<Multi_Undo_data>()
2426
                };
2427

    
2428
                foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
2429
                {
2430
                    if (item.GetType().Name == "AdornerFinal")
2431
                    {
2432
                        (item as Controls.AdornerFinal).unRegister();
2433

    
2434
                        foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
2435
                        {
2436
                            //if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
2437
                            if (!ViewerDataModel.Instance.MarkupControls_USER.Contains(InnerItem.DrawingData))
2438
                            {
2439

    
2440
                                multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
2441
                                UndoData.Markup_List.Add(multi_Undo_Data);
2442
                                multi_Undo_Data = new Multi_Undo_data();
2443

    
2444
                                ViewerDataModel.Instance.MarkupControls.Remove(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo);
2445

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

    
2448
                                ViewerDataModel.Instance.MarkupList_USER.Remove(Item_);
2449

    
2450
                                //임시파일에서도 삭제한다.
2451
                                temp.DelTemp((InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo).CommentID, this.ParentOfType<MainWindow>().dzMainMenu.pageNavigator.CurrentPage.PageNumber.ToString());
2452
                                
2453
                            }
2454
                        }
2455
                    }
2456

    
2457
                    ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
2458
                    {
2459
                        ViewerDataModel.Instance.UndoDataList.Remove(i);
2460
                    });
2461
                    ViewerDataModel.Instance.UndoDataList.Add(UndoData);
2462
                }
2463
            }
2464
            this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Clear();
2465
        }
2466

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