프로젝트

일반

사용자정보

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

markus / KCOM / Events / Implementation / TopMenuEvent.cs @ 2b19f5f2

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

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

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

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

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

    
57
        private void CheckShapeState()
58
        {
59

    
60

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

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

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

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

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

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

    
107
                    temp.DELADDTemp(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo, this.ParentOfType<MainWindow>().dzMainMenu.pageNavigator.CurrentPage.PageNumber);
108
                }
109

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

    
117
            }
118

    
119
        }
120

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

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

    
145
        }
146

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

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

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

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

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

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

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

    
253
        }
254

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

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

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

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

    
307
            this.ParentOfType<MainWindow>().dzMainMenu.busyIndicator.IsBusy = true;
308

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

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

    
329
                this.ParentOfType<MainWindow>().dzMainMenu.InkControl_Convert();
330

    
331
                var menu = this.ParentOfType<MainWindow>().dzMainMenu;
332

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

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

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

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

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

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

    
399
                    menu.ChangeCommentReact();
400

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

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

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

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

    
465
            Save save = new Save();
466

    
467
            //강인구 추가
468
            List<IKCOM.MarkupInfoItem> MySelectItem = new List<IKCOM.MarkupInfoItem>();
469

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

    
478
            //MySelectItem = (menu.gridViewMarkup.SelectedItems.FirstOrDefault() as IKCOM.MarkupInfoItem);
479

    
480

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

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

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

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

    
547
                }
548
                else
549
                {
550
                    RefactoryCommentReact(menu);
551
                }
552
            }
553

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

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

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

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

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

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

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

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

    
606
        private List<AdornerMember> GetAdornerItem()
607
        {
608
            List<AdornerMember> AdonerList = new List<AdornerMember>();
609

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

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

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

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

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

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

    
738
                    //임시파일에 해당 commentid가 있으면 삭제후 다시 생성
739
                    temp.DELADDTemp(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo, this.ParentOfType<MainWindow>().dzMainMenu.pageNavigator.CurrentPage.PageNumber);
740
                }
741

    
742
                ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
743
                {
744
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
745
                });
746
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
747
            }
748
        }
749

    
750

    
751
        private void cbIntervalSize_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
752
        {
753
            List<AdornerMember> AdonerList = GetAdornerItem();
754
            if (AdonerList.Count > 0)
755
            {
756

    
757
                Undo_data UndoData = new Undo_data()
758
                {
759
                    IsUndo = false,
760
                    Event = Event_Type.Option,
761
                    EventTime = DateTime.Now,
762
                    Interval = ViewerDataModel.Instance.Interval,
763
                    Markup_List = new List<Multi_Undo_data>()
764
                };
765
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
766

    
767
                foreach (AdornerMember InnerItem in AdonerList)
768
                {
769
                    switch (InnerItem.DrawingData.GetType().Name)
770
                    {
771
                        case ("LineControl"):
772
                            {
773
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Line.LineControl).Interval = ViewerDataModel.Instance.Interval;
774

    
775
                                multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
776
                                UndoData.Markup_List.Add(multi_Undo_Data);
777
                                multi_Undo_Data = new Multi_Undo_data();
778
                            }
779
                            break;
780
                    }
781
                }
782

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

    
797
                //Undo_data UndoData = new Undo_data()
798
                //{
799
                //    IsUndo = false,
800
                //    Event = Event_Type.Option,
801
                //    EventTime = DateTime.Now,
802
                //    Interval = ViewerDataModel.Instance.Interval,
803
                //    Markup_List = new List<Multi_Undo_data>()
804
                //};
805
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
806

    
807
                foreach (AdornerMember InnerItem in AdonerList)
808
                {
809
                    switch (InnerItem.DrawingData.GetType().Name)
810
                    {
811
                        case ("RectCloudControl"):
812
                            {
813
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.RectCloudControl).ArcLength = ViewerDataModel.Instance.ArcLength;
814

    
815
                                //multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
816
                                //UndoData.Markup_List.Add(multi_Undo_Data);
817
                                //multi_Undo_Data = new Multi_Undo_data();
818
                            }
819
                            break;
820
                        case ("CloudControl"):
821
                            {
822
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Polygon.CloudControl).ArcLength = ViewerDataModel.Instance.ArcLength;
823

    
824
                                //multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
825
                                //UndoData.Markup_List.Add(multi_Undo_Data);
826
                                //multi_Undo_Data = new Multi_Undo_data();
827
                            }
828
                            break;
829
                    }
830
                }
831

    
832
                //ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
833
                //{
834
                //    ViewerDataModel.Instance.UndoDataList.Remove(i);
835
                //});
836
                //ViewerDataModel.Instance.UndoDataList.Add(UndoData);
837
            }
838
        }
839

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

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

    
914
                                multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
915
                                UndoData.Markup_List.Add(multi_Undo_Data);
916
                                multi_Undo_Data = new Multi_Undo_data();
917
                            }
918

    
919
                            ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
920
                            {
921
                                ViewerDataModel.Instance.UndoDataList.Remove(i);
922
                            });
923
                            ViewerDataModel.Instance.UndoDataList.Add(UndoData);
924
                        }
925
                    }
926
                }
927
            }
928
        }
929

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

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

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

    
1011
        //강인구 추가
1012
        private void btnItalic_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).TextStyle == FontStyles.Italic)
1029
                                            {
1030
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextStyle = System.Windows.FontStyles.Normal;
1031
                                            }
1032
                                            else
1033
                                            {
1034
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextStyle = FontStyles.Italic;
1035
                                            }
1036

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

    
1059
        //강인구 추가
1060
        private void btnUnderLine_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).UnderLine == TextDecorations.Underline)
1077
                                            {
1078
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).UnderLine = null;
1079
                                            }
1080
                                            else
1081
                                            {
1082
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).UnderLine = TextDecorations.Underline;
1083
                                            }
1084
                                        }
1085
                                        break;
1086
                                    case ("ArrowTextControl"):
1087
                                        {
1088
                                            if ((InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).UnderLine == TextDecorations.Underline)
1089
                                            {
1090
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).UnderLine = null;
1091
                                            }
1092
                                            else
1093
                                            {
1094
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).UnderLine = TextDecorations.Underline;
1095
                                            }
1096
                                        }
1097
                                        break;
1098
                                }
1099
                            }
1100
                        }
1101
                    }
1102
                }
1103
            }
1104
        }
1105

    
1106
        private void AxisLockEvent(object sender, RoutedEventArgs e)
1107
        {
1108
            ViewerDataModel.Instance.checkAxis = cbAxisLock.IsChecked.Value;
1109
        }
1110

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

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

    
1192
        /// <summary>
1193
        /// 텍스트 컨트롤 하일라이트 처리
1194
        /// </summary>
1195
        /// <param name="sender"></param>
1196
        /// <param name="e"></param>
1197
        private void HighlightEvent(object sender, RoutedEventArgs e)
1198
        {
1199

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

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

    
1242
        public event EventHandler<WindowClosedEventArgs> Closed;
1243

    
1244
        //private void CheckEvent(object sender, RoutedEventArgs e)
1245
        //{
1246
        //    RadWindow CheckPop = new RadWindow();
1247
        //    test check = new test();
1248

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

    
1261
        //    CheckPop.Closed += CheckPop_Closed;
1262
        //    CheckPop.ShowDialog();
1263
        //}
1264

    
1265
        private void PanoramaEvent(object sender, RoutedEventArgs e)
1266
        {
1267
            PanoramaShow();
1268
        }
1269

    
1270
        public void PanoramaShow()
1271
        {
1272
            Panorama check = new Panorama();
1273
            double screenWidth = System.Windows.SystemParameters.PrimaryScreenWidth;
1274
            double screenHeight = System.Windows.SystemParameters.PrimaryScreenHeight;
1275
            //double windowWidth = this.Width;
1276
            //double windowHeight = this.Height;
1277

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

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

    
1315
                isClosed = false;
1316

    
1317
                
1318
                CheckList check = new CheckList();
1319

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

    
1341
        private void CheckPop_Closed(object sender, WindowClosedEventArgs e)
1342
        {
1343
            isClosed = true;
1344
            //this.ParentOfType<MainWindow>().dzMainMenu.PN_Navi.IsEnabled = true;
1345
            this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
1346
            ViewerDataModel.Instance.Capture_Opacity = 0;
1347
        }
1348

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

    
1387
        private void viewEvent(object sender, RoutedEventArgs e)
1388
        {
1389
            RadRibbonToggleButton viewButton = sender as RadRibbonToggleButton;
1390
            var instanceMain = this.ParentOfType<MainWindow>();
1391

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

    
1394
            //if ((sender as RadRibbonToggleButton) != null)
1395
            //{
1396
            //    Common.ViewerDataModel.Instance.ControlTag = (sender as RadRibbonToggleButton).Tag.ToString();
1397
            //    instanceToggle = (sender as RadRibbonToggleButton);
1398
            //}
1399

    
1400
            //instanceToggle.IsChecked = false;
1401

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

    
1443
                    }
1444
                    break;
1445
                case "Rotate_M":
1446
                    {
1447
                        drawingPannelRotate(false);
1448
                        viewButton.IsChecked = false;
1449
                    }
1450
                    break;
1451
                case "Rotate_P":
1452
                    {
1453
                        drawingPannelRotate(true);
1454
                        viewButton.IsChecked = false;
1455
                    }
1456
                    break;
1457
                case "Rotate_half":
1458
                    {
1459
                        drawingPannelRotate(true);
1460
                        drawingPannelRotate(true);
1461
                        viewButton.IsChecked = false;
1462
                    }
1463
                    break;
1464
            }
1465
        }
1466

    
1467
        private void Control_Event(object sender, RoutedEventArgs e)
1468
        {
1469

    
1470
        }
1471

    
1472
        #region 대기
1473

    
1474
        public void drawingPannelRotate(bool Flag)
1475
        {
1476
            var instanceMain = this.ParentOfType<MainWindow>();
1477

    
1478
            //if (rotateOffSet > 3)
1479
            //    rotateOffSet = 0;
1480

    
1481
            //if (rotateOffSet < 0)
1482
            //    rotateOffSet = 3;
1483

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

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

    
1537
            //instanceMain.dzMainMenu.zoomAndPanControl.RenderTransformOrigin = new Point(0.5, 0.5);
1538
            instanceMain.dzMainMenu.zoomAndPanControl.RotationAngle = instanceMain.dzMainMenu.rotate.Angle;
1539
            //대기(강인구)
1540
            //instanceMain.dzMainMenu.imageViewer.RotateAngle = instanceMain.dzMainMenu.rotate.Angle;
1541

    
1542

    
1543
            //instanceMain.dzMainMenu.imageViewer.RenderTransformOrigin = new Point(0.5, 0.5);
1544
            //RotateTransform rotateTransform = new RotateTransform(instanceMain.dzMainMenu.rotate.Angle);
1545
            //instanceMain.dzMainMenu.imageViewer.RenderTransform = rotateTransform;
1546

    
1547

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

    
1559

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

    
1565
                instanceMain.dzMainMenu.pageNavigator.ImgListbox.ItemsSource = instanceMain.dzMainMenu.pageNavigator._thumbnailItems;
1566
                var instance = instanceMain.dzMainMenu.CurrentDoc.docInfo.DOCPAGE.Where(p => p.PAGE_NUMBER == instanceMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber).FirstOrDefault();
1567
                instance.PAGE_ANGLE = int.Parse(instanceMain.dzMainMenu.rotate.Angle.ToString());
1568

    
1569
                instanceMain.dzMainMenu.pageNavigator.setPageChange(data);
1570

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

    
1585
        private void ImageConverter()
1586
        {
1587
            var instanceMain = this.ParentOfType<MainWindow>();
1588
            //http://cloud.devdoftech.co.kr:5977/ImageUpload/FileUpload.asmx
1589

    
1590

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

    
1599
                System.IO.FileInfo fileInfo = new System.IO.FileInfo(instanceMain.dzMainMenu.filename);
1600
                String strFile = System.IO.Path.GetFileName(instanceMain.dzMainMenu.filename);
1601
                long numByte = fileInfo.Length;
1602
                double dLen = Convert.ToDouble(fileInfo.Length / 1000000);
1603
                kr.co.devdoftech.cloud.FileUpload fileUploader = new kr.co.devdoftech.cloud.FileUpload();
1604

    
1605
                if (dLen < 4)
1606
                {
1607
                    System.IO.FileStream fStream = new System.IO.FileStream(instanceMain.dzMainMenu.filename, System.IO.FileMode.Open, System.IO.FileAccess.Read);
1608
                    System.IO.BinaryReader br = new System.IO.BinaryReader(fStream);
1609
                    byte[] data = br.ReadBytes((int)numByte);
1610
                    br.Close();
1611

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

    
1623
        private void Control_Init(RadToggleButton instanceToggle, object sender)
1624
        {
1625

    
1626
        }
1627

    
1628
        private void ControlEvent(object sender, RoutedEventArgs e)
1629
        {
1630
            RadToggleButton instanceToggle = sender as RadToggleButton;
1631
            var instanceMain = this.ParentOfType<MainWindow>();
1632

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

    
1653
            //if (!instanceMain.IsFreeSelectionMode)
1654
            //{
1655
            //    instanceMain.IsSwingMode = true;
1656
            //}
1657

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

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

    
1671
            if (instanceToggle != null)
1672
            {
1673
                Common.ViewerDataModel.Instance.ControlTag = instanceToggle.Tag.ToString();
1674
            }
1675
            else if ((sender as RadRibbonToggleButton) != null)
1676
            {
1677
                Common.ViewerDataModel.Instance.ControlTag = (sender as RadRibbonToggleButton).Tag.ToString();
1678
                instanceToggle = (sender as RadRibbonToggleButton);
1679
            }
1680
            else if ((sender as RadRibbonButton) != null)
1681
            {
1682
                RadRibbonButton instanceButton = sender as RadRibbonButton;
1683
                Common.ViewerDataModel.Instance.ControlTag = instanceButton.Tag.ToString();
1684
            }
1685
            else
1686
            {
1687
                RadButton instanceButton = sender as RadButton;
1688
                Common.ViewerDataModel.Instance.ControlTag = instanceButton.Tag.ToString();
1689
            }
1690

    
1691

    
1692

    
1693
            System.Reactive.Linq.Observable2.FromPropertyChangedPattern(Common.ViewerDataModel.Instance, temp => temp.AngleVisibility).Subscribe(isSee =>
1694
            {
1695
                instanceMain.dzMainMenu.MainAngle.Visibility = isSee;
1696
                System.Reactive.Linq.Observable2.FromPropertyChangedPattern(Common.ViewerDataModel.Instance, temp => temp.AngleValue).Subscribe(p =>
1697
                {
1698
                    instanceMain.dzMainMenu.MainAngle.AngleValue = p;
1699
                });
1700
            });
1701
            instanceMain.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Drawing;
1702

    
1703
            instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = false;
1704

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

    
1922
                        //instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = true;
1923

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

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

    
2062
                    default:
2063
                        break;
2064
                }
2065
                #endregion
2066
            }
2067
            else
2068
            {
2069

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

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

    
2104
            if(instanceToggle.IsChecked == true)
2105
            {
2106
                SaveTime(true);
2107
            }
2108
            else
2109
            {
2110
                SaveTime(false);
2111
            }
2112
        }
2113

    
2114
        public void Copy_Start()
2115
        {
2116
            if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
2117
            {
2118
                string MarkupData = "";
2119

    
2120
                foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
2121
                {
2122
                    if (item.GetType().Name == "AdornerFinal")
2123
                    {
2124
                        foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
2125

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

    
2139
        public void Cut_Start()
2140
        {
2141
            if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
2142
            {
2143
                foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
2144
                {
2145
                    string MarkupData = "";
2146

    
2147
                    if (item.GetType().Name == "AdornerFinal")
2148
                    {
2149
                        foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
2150
                        {
2151
                            if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
2152
                            {
2153
                                markupReturn = layer.MarkupToString(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo, App.ViewInfo.UserID);
2154
                                MarkupData += "|OR|" + markupReturn.ConvertData;
2155
                            }
2156
                        }
2157
                        //클립보드에 넣음
2158
                        Clipboard.SetText(MarkupData);
2159
                        //임시 파일에서 삭제
2160
                        temp.DataDel(markupReturn.CommentID);
2161
                    }
2162
                }
2163
                this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Clear();
2164
            }
2165
        }
2166

    
2167
        public void Paste_Start()
2168
        {
2169
            //마크업 붙여넣기
2170
            //if (Clipboard.GetText().Contains("|DZ|"))
2171
            if (Clipboard.GetText().Contains("|OR||DZ|"))
2172
            {
2173
                List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>();
2174

    
2175
                string[] delimiterChars = { "|OR|" };
2176
                string[] data = Clipboard.GetText().Split(delimiterChars, StringSplitOptions.RemoveEmptyEntries);
2177

    
2178
                this.ParentOfType<MainWindow>().dzMainMenu.ReleaseAdorner();
2179

    
2180
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
2181

    
2182
                //강인구 Undo/Redo 보류
2183
                UndoData = new Undo_data()
2184
                {
2185
                    IsUndo = false,
2186
                    Event = Event_Type.Create,
2187
                    EventTime = DateTime.Now,
2188
                    Markup_List = new List<Multi_Undo_data>()
2189
                };
2190

    
2191
                ViewerDataModel.Instance.UndoDataList.Where(data1 => data1.IsUndo == true).ToList().ForEach(i =>
2192
                {
2193
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
2194
                });
2195

    
2196
                foreach (string parse in data)
2197
                {
2198
                    if (parse != "")
2199
                    {
2200
                        System.Windows.Controls.Control item = layer.markupParse_Paste(parse, ViewerDataModel.Instance.MarkupControls_USER);
2201
                        (item as MarkupToPDF.Common.CommentUserInfo).CommentID = Events.Save.shortGuid();
2202

    
2203
                        ViewerDataModel.Instance.MarkupControls.Remove(item as MarkupToPDF.Common.CommentUserInfo);
2204
                        ViewerDataModel.Instance.MarkupControls_USER.Remove(item as MarkupToPDF.Common.CommentUserInfo);
2205

    
2206
                        adornerSet.Add(item as MarkupToPDF.Common.CommentUserInfo);
2207

    
2208
                        //Controls.AdornerFinal final = new Controls.AdornerFinal(item as MarkupToPDF.Common.CommentUserInfo);
2209
                        //this.dzMainMenu.SelectLayer.Children.Add(final);
2210

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

    
2213
                        UndoData.Markup_List.Add(multi_Undo_Data);
2214
                        ViewerDataModel.Instance.UndoDataList.Add(UndoData);
2215

    
2216
                        //임시파일에저장
2217
                        temp.AddTemp(item as MarkupToPDF.Common.CommentUserInfo, this.ParentOfType<MainWindow>().dzMainMenu.pageNavigator.CurrentPage.PageNumber);
2218
                    }
2219
                }
2220
                Controls.AdornerFinal final = new Controls.AdornerFinal(adornerSet);
2221

    
2222
                if(this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.X < 0)
2223
                {
2224
                    Canvas.SetLeft(final, 0);
2225
                    Canvas.SetTop(final, 0);
2226
                }
2227
                else
2228
                {
2229
                    double realPointX = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.X - final.BorderSize.X - (final.BorderSize.Width / 2);
2230
                    double realPointY = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.Y - final.BorderSize.Y - (final.BorderSize.Height / 2);
2231
                    final.MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(realPointX, realPointY));
2232

    
2233
                    if (final.MemberSet.Where(type => type.Drawingtype == MarkupToPDF.Controls.Common.ControlType.TextControl).FirstOrDefault() != null)
2234
                    {
2235
                        final.MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(0.001, 0.001)); //dummy
2236
                    }
2237
                }
2238
                
2239

    
2240
                this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Add(final);
2241

    
2242
                //붙여 넣을때 원본 컨트롤과 겹치지 않도록 설정
2243
                //Canvas.SetLeft(final, 50);
2244
                //Canvas.SetTop(final, 50);
2245
            }
2246
            //외부 이미지 붙여넣기
2247
            else if (Clipboard.GetImage() != null)
2248
            {
2249
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
2250

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

    
2260

    
2261
                string temppath = System.IO.Path.GetTempPath();
2262
                //string filename = KCOM.Events.Save.shortCommentKey();
2263
                string filename = KCOM.Events.Save.shortFileKey();
2264

    
2265
                System.Drawing.Image clipboardImage = System.Windows.Forms.Clipboard.GetImage();
2266
                clipboardImage.Save(temppath + "\\" + filename);
2267

    
2268
                System.IO.FileInfo fileInfo = new System.IO.FileInfo(temppath + "\\" + filename);
2269
                String strFile = System.IO.Path.GetFileName(fileInfo.FullName);
2270
                long numByte = fileInfo.Length;
2271
                double dLen = Convert.ToDouble(fileInfo.Length / 1000000);
2272
                kr.co.devdoftech.cloud.FileUpload fileUploader = new kr.co.devdoftech.cloud.FileUpload();
2273

    
2274
                if (dLen < 4)
2275
                {
2276
                    System.IO.FileStream fStream = new System.IO.FileStream(fileInfo.FullName,
2277
                    System.IO.FileMode.Open, System.IO.FileAccess.Read);
2278
                    System.IO.BinaryReader br = new System.IO.BinaryReader(fStream);
2279
                    byte[] data = br.ReadBytes((int)numByte);
2280

    
2281
                    filename = fileUploader.Run(App.ViewInfo.ProjectNO, this.ParentOfType<MainWindow>().dzMainMenu._DocItem.DOCUMENT_NO, App.ViewInfo.UserID, strFile + ".png", data);
2282
                    br.Close();
2283
                    fStream.Close();
2284
                    fStream.Dispose();
2285
                }
2286
                else
2287
                {
2288
                    this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert("Available Memory less than 4 mega byte", "Alert");
2289
                    return;
2290
                }
2291

    
2292
                fileInfo.Delete();
2293

    
2294
                //System.Drawing.Image clipboardImage = System.Windows.Forms.Clipboard.GetImage();
2295
                System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(clipboardImage);
2296
                IntPtr hBitmap = bmp.GetHbitmap();
2297
                System.Windows.Media.ImageSource WpfBitmap = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(hBitmap, IntPtr.Zero, Int32Rect.Empty, System.Windows.Media.Imaging.BitmapSizeOptions.FromEmptyOptions());
2298
                Image img = new Image();
2299
                img.Source = new System.Windows.Media.Imaging.BitmapImage(new Uri(filename));
2300

    
2301

    
2302

    
2303

    
2304

    
2305
                var currentControl = new MarkupToPDF.Controls.Etc.ImgControl
2306
                {
2307
                    PointSet = new List<Point>(),
2308
                    FilePath = img.Source.ToString(),
2309
                    ImageData = img.Source,
2310
                    StartPoint = new Point(100, 100),
2311
                    EndPoint = new Point(200, 200),
2312
                    TopRightPoint = new Point(100, 200),
2313
                    LeftBottomPoint = new Point(200, 100)
2314
                };
2315

    
2316
                currentControl.TopRightPoint = new Point(currentControl.StartPoint.X + clipboardImage.Width, currentControl.StartPoint.Y);
2317
                currentControl.LeftBottomPoint = new Point(currentControl.StartPoint.X, currentControl.StartPoint.Y + clipboardImage.Height);
2318
                currentControl.EndPoint = new Point(currentControl.StartPoint.X + clipboardImage.Width, currentControl.StartPoint.Y + clipboardImage.Height);
2319

    
2320
                currentControl.PointSet = new List<Point>
2321
                                        {
2322
                                            currentControl.StartPoint,
2323
                                            currentControl.LeftBottomPoint,
2324
                                            currentControl.EndPoint,
2325
                                            currentControl.TopRightPoint,
2326
                                        };
2327

    
2328
                multi_Undo_Data = this.ParentOfType<MainWindow>().dzMainMenu.Control_Style(currentControl as MarkupToPDF.Common.CommentUserInfo);
2329
                UndoData.Markup_List.Add(multi_Undo_Data);
2330
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
2331

    
2332
                ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl as MarkupToPDF.Common.CommentUserInfo);
2333
                currentControl.CommentID = Events.Save.shortGuid();
2334

    
2335
                currentControl.ApplyTemplate();
2336
                currentControl.SetImage();
2337

    
2338
                ViewerDataModel.Instance.MarkupControls_USER.Remove(currentControl as MarkupToPDF.Common.CommentUserInfo);
2339
                Controls.AdornerFinal final = new Controls.AdornerFinal(currentControl as MarkupToPDF.Common.CommentUserInfo);
2340
                this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Add(final);
2341

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

    
2346
                //임시파일에저장
2347
                temp.AddTemp(currentControl, this.ParentOfType<MainWindow>().dzMainMenu.pageNavigator.CurrentPage.PageNumber);
2348
            }
2349
        }
2350

    
2351
        public void Delete_Start()
2352
        {
2353
            if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
2354
            {
2355
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
2356

    
2357
                UndoData = new Undo_data()
2358
                {
2359
                    IsUndo = false,
2360
                    Event = Event_Type.Delete,
2361
                    EventTime = DateTime.Now,
2362
                    Markup_List = new List<Multi_Undo_data>()
2363
                };
2364

    
2365
                foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
2366
                {
2367
                    if (item.GetType().Name == "AdornerFinal")
2368
                    {
2369
                        (item as Controls.AdornerFinal).unRegister();
2370

    
2371
                        foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
2372
                        {
2373
                            //if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
2374
                            if (!ViewerDataModel.Instance.MarkupControls_USER.Contains(InnerItem.DrawingData))
2375
                            {
2376

    
2377
                                multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
2378
                                UndoData.Markup_List.Add(multi_Undo_Data);
2379
                                multi_Undo_Data = new Multi_Undo_data();
2380

    
2381
                                ViewerDataModel.Instance.MarkupControls.Remove(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo);
2382

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

    
2385
                                ViewerDataModel.Instance.MarkupList_USER.Remove(Item_);
2386
                            }
2387

    
2388
                            //임시 파일에서 삭제
2389
                            temp.DataDel((InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo).CommentID);
2390
                        }
2391
                    }
2392

    
2393
                    ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
2394
                    {
2395
                        ViewerDataModel.Instance.UndoDataList.Remove(i);
2396
                    });
2397
                    ViewerDataModel.Instance.UndoDataList.Add(UndoData);
2398
                }
2399
            }
2400
            this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Clear();
2401
        }
2402

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