프로젝트

일반

사용자정보

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

markus / KCOM / Events / Implementation / TopMenuEvent.cs @ 53880c83

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

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

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

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

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

    
61
        private void CheckShapeState()
62
        {
63

    
64

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

    
81
        //강인구 추가(Undo End)
82
        private void SetPaintEvent()
83
        {
84
            List<AdornerMember> AdonerList = GetAdornerItem();
85

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

    
98
                foreach (AdornerMember InnerItem in AdonerList)
99
                {
100
                    multi_Undo_Data.PointSet = new List<Point>();
101

    
102
                    if ((InnerItem.DrawingData as MarkupToPDF.Controls.Common.IShapeControl) != null)
103
                    {
104
                        (InnerItem.DrawingData as MarkupToPDF.Controls.Common.IShapeControl).Paint = ViewerDataModel.Instance.paintSet;
105
                    }
106

    
107
                    multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
108
                    UndoData.Markup_List.Add(multi_Undo_Data);
109
                    multi_Undo_Data = new Multi_Undo_data();
110
                }
111

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

    
119
            }
120

    
121
        }
122

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

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

    
147
        }
148

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

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

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

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

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

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

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

    
255
        }
256

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

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

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

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

    
309
            this.ParentOfType<MainWindow>().dzMainMenu.busyIndicator.IsBusy = true;
310

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

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

    
331
                this.ParentOfType<MainWindow>().dzMainMenu.InkControl_Convert();
332

    
333
                var menu = this.ParentOfType<MainWindow>().dzMainMenu;
334

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

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

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

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

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

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

    
401
                    menu.ChangeCommentReact();
402

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

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

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

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

    
467
            Save save = new Save();
468

    
469
            //추가
470
            List<IKCOM.MarkupInfoItem> MySelectItem = new List<IKCOM.MarkupInfoItem>();
471

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

    
480
            //MySelectItem = (menu.gridViewMarkup.SelectedItems.FirstOrDefault() as IKCOM.MarkupInfoItem);
481

    
482

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

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

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

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

    
549
                }
550
                else
551
                {
552
                    RefactoryCommentReact(menu);
553
                }
554
            }
555

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

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

    
570
            List<IKCOM.MarkupInfoItem> markupinfo = new List<IKCOM.MarkupInfoItem>();
571

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

    
575
            if (markupinfo.Count() > 0)
576
            {
577
                Logger.sendResLog("GetPrintDocItemList", "TRUE", 1);
578
            }
579
            else
580
            {
581
                Logger.sendResLog("GetPrintDocItemList", "FALSE", 1);
582
            }
583

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

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

    
600
            //프린트 팝업 옵션
601
            //PrintWindow.BorderThickness = new Thickness(3);
602
            //PrintWindow.BorderBrush = new SolidColorBrush(Color.FromArgb(255, 37, 160, 218));
603
            PrintWindow.ResizeMode = System.Windows.ResizeMode.NoResize;
604
            PrintWindow.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
605
            PrintWindow.Background = new SolidColorBrush(Colors.Black);
606
            PrintWindow.Background.Opacity = 0.6;
607
            PrintWindow.Owner = Application.Current.MainWindow;
608
            Telerik.Windows.Controls.StyleManager.SetTheme(PrintWindow, new Telerik.Windows.Controls.VisualStudio2013Theme());
609
            PrintWindow.ShowDialog();
610
        }
611

    
612
        //강인구 추가
613
        private void PrintEvent(object sender, RoutedEventArgs e)
614
        {
615
            RadRibbonButton button = sender as RadRibbonButton;
616
            Print_Start(button.Content.ToString());
617
        }
618

    
619
        private List<AdornerMember> GetAdornerItem()
620
        {
621
            List<AdornerMember> AdonerList = new List<AdornerMember>();
622

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

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

    
671
                ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
672
                {
673
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
674
                });
675
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
676
            }
677
        }
678

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

    
699
                foreach (AdornerMember InnerItem in AdonerList)
700
                {
701
                    switch (InnerItem.DrawingData.GetType().Name)
702
                    {
703
                        case ("LineControl"):
704
                            {
705
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Line.LineControl).LineSize = ViewerDataModel.Instance.LineSize;
706
                            }
707
                            break;
708
                        case ("ArcControl"):
709
                            {
710
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Line.ArcControl).LineSize = ViewerDataModel.Instance.LineSize;
711
                            }
712
                            break;
713
                        case ("ArrowArcControl"):
714
                            {
715
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Line.ArrowArcControl).LineSize = ViewerDataModel.Instance.LineSize;
716
                            }
717
                            break;
718
                        case ("ArrowControl_Multi"):
719
                            {
720
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Line.ArrowControl_Multi).LineSize = ViewerDataModel.Instance.LineSize;
721
                            }
722
                            break;
723
                        case ("CloudControl"):
724
                            {
725
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Polygon.CloudControl).LineSize = ViewerDataModel.Instance.LineSize;
726
                            }
727
                            break;
728
                        case ("PolygonControl"):
729
                            {
730
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Polygon.PolygonControl).LineSize = ViewerDataModel.Instance.LineSize;
731
                            }
732
                            break;
733
                        case ("RectangleControl"):
734
                            {
735
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.RectangleControl).LineSize = ViewerDataModel.Instance.LineSize;
736
                            }
737
                            break;
738
                        case ("RectCloudControl"):
739
                            {
740
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.RectCloudControl).LineSize = ViewerDataModel.Instance.LineSize;
741
                            }
742
                            break;
743
                        case ("TriControl"):
744
                            {
745
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.TriControl).LineSize = ViewerDataModel.Instance.LineSize;
746
                            }
747
                            break;
748
                        case ("CircleControl"):
749
                            {
750
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.CircleControl).LineSize = ViewerDataModel.Instance.LineSize;
751
                            }
752
                            break;
753
                        case ("ArrowTextControl"):
754
                            {
755
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).LineSize = ViewerDataModel.Instance.LineSize;
756
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).BorderSize = new Thickness(ViewerDataModel.Instance.LineSize);
757
                            }
758
                            break;
759
                        case ("TextControl"):
760
                            {
761
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).LineSize = new Thickness(ViewerDataModel.Instance.LineSize);
762
                            }
763
                            break;
764
                    }
765
                    
766

    
767
                    multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
768
                    UndoData.Markup_List.Add(multi_Undo_Data);
769
                    multi_Undo_Data = new Multi_Undo_data();
770
                }
771

    
772
                ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
773
                {
774
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
775
                });
776
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
777

    
778
                
779
            }
780
            KCOM.Properties.Settings.Default.LineSize = (double)cbLineSize.Value;
781
            Properties.Settings.Default.Save();
782
        }
783

    
784

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

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

    
805
                foreach (AdornerMember InnerItem in AdonerList)
806
                {
807
                    switch (InnerItem.DrawingData.GetType().Name)
808
                    {
809
                        case ("LineControl"):
810
                            {
811
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Line.LineControl).Interval = ViewerDataModel.Instance.Interval;
812

    
813
                                multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
814
                                UndoData.Markup_List.Add(multi_Undo_Data);
815
                                multi_Undo_Data = new Multi_Undo_data();
816
                            }
817
                            break;
818
                    }
819
                }
820

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

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

    
851
                foreach (AdornerMember InnerItem in AdonerList)
852
                {
853
                    switch (InnerItem.DrawingData.GetType().Name)
854
                    {
855
                        case ("RectCloudControl"):
856
                            {
857
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.RectCloudControl).ArcLength = ViewerDataModel.Instance.ArcLength;
858

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

    
868
                                //multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
869
                                //UndoData.Markup_List.Add(multi_Undo_Data);
870
                                //multi_Undo_Data = new Multi_Undo_data();
871
                            }
872
                            break;
873
                    }
874
                }
875

    
876
                //ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
877
                //{
878
                //    ViewerDataModel.Instance.UndoDataList.Remove(i);
879
                //});
880
                //ViewerDataModel.Instance.UndoDataList.Add(UndoData);
881
            }
882

    
883
            KCOM.Properties.Settings.Default.ArcLength = (double)cbArcLength.Value;
884
            Properties.Settings.Default.Save();
885
        }
886

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

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

    
966
                                multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
967
                                UndoData.Markup_List.Add(multi_Undo_Data);
968
                                multi_Undo_Data = new Multi_Undo_data();
969
                            }
970

    
971
                            ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
972
                            {
973
                                ViewerDataModel.Instance.UndoDataList.Remove(i);
974
                            });
975
                            ViewerDataModel.Instance.UndoDataList.Add(UndoData);
976
                        }
977
                    }
978
                }
979
            }
980
        }
981

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

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

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

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

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

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

    
1158
        private void AxisLockEvent(object sender, RoutedEventArgs e)
1159
        {
1160
            ViewerDataModel.Instance.checkAxis = cbAxisLock.IsChecked.Value;
1161
        }
1162

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

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

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

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

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

    
1301
        private void tlcurrentPage_readonly_KeyDown(object sender, KeyEventArgs e)
1302
        {
1303
            //강인구 추가 tlcurrentPage을 이상하게 입력할수 있기때문에 Try Catch
1304
            if (e.Key == Key.Enter)
1305
            {
1306
                try
1307
                {
1308
                    var instanceMain = this.ParentOfType<MainWindow>();
1309
                    instanceMain.dzMainMenu.pageNavigator.GotoPage(Convert.ToInt32(tlcurrentPage_readonly.Text));
1310
                }
1311
                catch (Exception)
1312
                {
1313
                    RadWindow.Alert(new DialogParameters
1314
                    {
1315
                        Owner = Application.Current.MainWindow,
1316
                        Theme = new VisualStudio2013Theme(),
1317
                        Header = "안내",
1318
                        Content = "페이지 번호를 정확하게 입력해 주세요",
1319
                    });
1320
                }
1321

    
1322
            }
1323
        }
1324
        
1325

    
1326
        //public event EventHandler<WindowClosedEventArgs> Closed;
1327

    
1328
        //private void CheckEvent(object sender, RoutedEventArgs e)
1329
        //{
1330
        //    RadWindow CheckPop = new RadWindow();
1331
        //    test check = new test();
1332

    
1333
        //    CheckPop = new RadWindow
1334
        //    {
1335
        //        Width = 1700,
1336
        //        Height = 510,
1337
        //        Header = "My Check List",
1338
        //        Content = check,
1339
        //        Owner = this,
1340
        //        ResizeMode = System.Windows.ResizeMode.NoResize,
1341
        //        WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen,
1342
        //    };
1343
        //    StyleManager.SetTheme(CheckPop, new VisualStudio2013Theme());
1344

    
1345
        //    CheckPop.Closed += CheckPop_Closed;
1346
        //    CheckPop.ShowDialog();
1347
        //}
1348

    
1349
        private void PanoramaEvent(object sender, RoutedEventArgs e)
1350
        {
1351
            PanoramaShow();
1352
        }
1353

    
1354
        public void PanoramaShow()
1355
        {
1356
            Panorama check = new Panorama();
1357
            double screenWidth = System.Windows.SystemParameters.PrimaryScreenWidth;
1358
            double screenHeight = System.Windows.SystemParameters.PrimaryScreenHeight;
1359
            //double windowWidth = this.Width;
1360
            //double windowHeight = this.Height;
1361

    
1362
            var PanoramaPop = new RadWindow
1363
            {
1364
                //MinWidth = 600,
1365
                //MinHeight = 400,
1366
                //Header = "My Check List",
1367
                Header = "Document No : " + this.ParentOfType<MainWindow>().dzMainMenu._DocItem.DOCUMENT_NO + " / Revision :" + this.ParentOfType<MainWindow>().dzMainMenu._DocItem.REVISION,
1368
                Content = check,
1369
                Owner = this,
1370
                ResizeMode = System.Windows.ResizeMode.CanResizeWithGrip,
1371
                //ResizeMode = System.Windows.ResizeMode.NoResize,
1372
                WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen,
1373
                IsTopmost = false,
1374
                //Left = (screenWidth / 2) - (windowWidth / 2),
1375
                //Top = (screenHeight / 2) - (windowHeight / 2),
1376
                //Left = (screenWidth / 2),
1377
                //Top = (screenHeight / 2),
1378
                Width = screenWidth * 0.4,
1379
                Height = screenHeight * 0.4,
1380
            };
1381
            StyleManager.SetTheme(PanoramaPop, new VisualStudio2013Theme());
1382
            //CheckPop.ShowDialog();
1383
            PanoramaPop.Owner = Application.Current.MainWindow;
1384
            PanoramaPop.Show();
1385
        }
1386

    
1387
        private void CheckEvent(object sender, RoutedEventArgs e)
1388
        {
1389
            //창이 떠있을 경우 재 실행 방지
1390
            if (isClosed)
1391
            {
1392
                //토글 및 마우스 상태 초기화
1393
                var toggleList = this.Parent.ChildrenOfType<RadToggleButton>();
1394
                foreach(var togle in toggleList)
1395
                {
1396
                    togle.IsChecked = false;
1397
                }
1398
                this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
1399

    
1400
                isClosed = false;
1401

    
1402
                
1403
                CheckList check = new CheckList();
1404

    
1405
                CheckPop = new RadWindow
1406
                {
1407
                    MinWidth = 1200,
1408
                    MinHeight = 500,
1409
                    //Header = "My Check List",
1410
                    Header = "Document No : " + this.ParentOfType<MainWindow>().dzMainMenu._DocItem.DOCUMENT_NO + " / Revision :" + this.ParentOfType<MainWindow>().dzMainMenu._DocItem.REVISION,
1411
                    Content = check,
1412
                    //Owner = this,
1413
                    //ResizeMode = System.Windows.ResizeMode.CanResizeWithGrip,
1414
                    ResizeMode = System.Windows.ResizeMode.NoResize,
1415
                    WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen,
1416
                    IsTopmost = true,
1417
                };
1418
                StyleManager.SetTheme(CheckPop, new Office2013Theme());
1419
                CheckPop.Closed += CheckPop_Closed;
1420
                //CheckPop.Owner = Application.Current.MainWindow;
1421
                //CheckPop.ShowDialog();
1422
                CheckPop.Show();
1423
            }
1424
        }
1425

    
1426
        private void OptionPop_Closed(object sender, WindowClosedEventArgs e)
1427
        {
1428
            isClosed = true;
1429
            //this.ParentOfType<MainWindow>().dzMainMenu.PN_Navi.IsEnabled = true;
1430
            this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
1431
            ViewerDataModel.Instance.Capture_Opacity = 0;
1432
        }
1433

    
1434
        private void CheckPop_Closed(object sender, WindowClosedEventArgs e)
1435
        {
1436
            isClosed = true;
1437
            //this.ParentOfType<MainWindow>().dzMainMenu.PN_Navi.IsEnabled = true;
1438
            this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
1439
            ViewerDataModel.Instance.Capture_Opacity = 0;
1440
        }
1441

    
1442
        /// <summary>
1443
        /// 사용자가 선택한 페이지로 이동(썸네일 동기화 시킴)
1444
        /// </summary>
1445
        /// <param name="sender"></param>
1446
        /// <param name="e"></param>
1447
        private void PageGoEvent(object sender, RoutedEventArgs e)
1448
        {
1449
            RadButton button = sender as RadButton;
1450
            var instanceMain = this.ParentOfType<MainWindow>();
1451
            
1452
            //강인구 추가 tlcurrentPage을 이상하게 입력할수 있기때문에 Try Catch
1453
            try
1454
            {
1455
                switch (button.CommandParameter.ToString())
1456
                {
1457
                    case "Down":
1458
                        {
1459
                            instanceMain.dzMainMenu.pageNavigator.GotoPage(Convert.ToInt32(tlcurrentPage.Text) + 1);
1460
                        }
1461
                        break;
1462
                    case "Up":
1463
                        {
1464
                            instanceMain.dzMainMenu.pageNavigator.GotoPage(Convert.ToInt32(tlcurrentPage.Text) - 1);
1465
                        }
1466
                        break;
1467
                }
1468
            }
1469
            catch (Exception)
1470
            {
1471
                RadWindow.Alert(new DialogParameters
1472
                {
1473
                    Owner = Application.Current.MainWindow,
1474
                    Theme = new VisualStudio2013Theme(),
1475
                    Header = "안내",
1476
                    Content = "페이지 번호를 정확하게 입력해 주세요",
1477
                });
1478
            }
1479
        }
1480

    
1481
        private void viewEvent(object sender, RoutedEventArgs e)
1482
        {
1483
            RadRibbonToggleButton viewButton = sender as RadRibbonToggleButton;
1484
            var instanceMain = this.ParentOfType<MainWindow>();
1485

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

    
1488
            //if ((sender as RadRibbonToggleButton) != null)
1489
            //{
1490
            //    Common.ViewerDataModel.Instance.ControlTag = (sender as RadRibbonToggleButton).Tag.ToString();
1491
            //    instanceToggle = (sender as RadRibbonToggleButton);
1492
            //}
1493

    
1494
            //instanceToggle.IsChecked = false;
1495

    
1496
            switch (viewButton.CommandParameter.ToString())
1497
            {
1498
                case "zoomout":
1499
                    {
1500
                        //장원
1501
                        //instanceMain.dzMainMenu.zoomAndPanControl.ZoomTo(new Rect(0, 0, instanceMain.dzMainMenu.zoomAndPanCanvas.ActualWidth, instanceMain.dzMainMenu.zoomAndPanCanvas.ActualHeight));
1502
                        instanceMain.dzMainMenu.zoomAndPanControl.ZoomPointToViewportCenter(ViewerDataModel.Instance.ContentScale -= 0.1, point);
1503
                        viewButton.IsChecked = false;
1504
                        //Common.ViewerDataModel.Instance.zom
1505
                    }
1506
                    break;
1507
                case "zoomin":
1508
                    {
1509
                        instanceMain.dzMainMenu.zoomAndPanControl.ZoomPointToViewportCenter(ViewerDataModel.Instance.ContentScale += 0.1, point);
1510
                        viewButton.IsChecked = false;
1511
                    }
1512
                    break;
1513
                case "fullscreen":
1514
                    {
1515
                        instanceMain.WindowState = WindowState.Maximized;
1516
                        //Sizemode 대기(강인구)
1517
                        //instanceMain.dzMainMenu.imageViewer.SizeMode = Leadtools.Windows.Controls.SizeMode.Fit;
1518
                        instanceMain.dzMainMenu.zoomAndPanControl.ScaleToFit();
1519
                        viewButton.IsChecked = false;
1520
                    }
1521
                    break;
1522
                case "fitWidth":
1523
                    {
1524
                        instanceMain.dzMainMenu.zoomAndPanControl.ScaleToFit();
1525
                        viewButton.IsChecked = false;
1526
                    }
1527
                    break;
1528
                case "fitHeight":
1529
                    {
1530
                        instanceMain.dzMainMenu.zoomAndPanControl.ScaleToFit();
1531
                        viewButton.IsChecked = false;
1532
                    }
1533
                    break;
1534
                case "boundzoom":
1535
                    {
1536

    
1537
                    }
1538
                    break;
1539
                case "Rotate_M":
1540
                    {
1541
                        drawingPannelRotate(false);
1542
                        viewButton.IsChecked = false;
1543
                    }
1544
                    break;
1545
                case "Rotate_P":
1546
                    {
1547
                        drawingPannelRotate(true);
1548
                        viewButton.IsChecked = false;
1549
                    }
1550
                    break;
1551
                case "Rotate_half":
1552
                    {
1553
                        drawingPannelRotate(true);
1554
                        drawingPannelRotate(true);
1555
                        viewButton.IsChecked = false;
1556
                    }
1557
                    break;
1558
            }
1559
        }
1560

    
1561
        private void Control_Event(object sender, RoutedEventArgs e)
1562
        {
1563

    
1564
        }
1565

    
1566
        #region 대기
1567

    
1568
        public void drawingPannelRotate(bool Flag)
1569
        {
1570
            var instanceMain = this.ParentOfType<MainWindow>();
1571

    
1572
            //if (rotateOffSet > 3)
1573
            //    rotateOffSet = 0;
1574

    
1575
            //if (rotateOffSet < 0)
1576
            //    rotateOffSet = 3;
1577

    
1578
            if(Flag)
1579
            {
1580
                if (instanceMain.dzMainMenu.rotate.Angle == 270)
1581
                {
1582
                    instanceMain.dzMainMenu.rotate.Angle = 0;
1583
                }
1584
                else
1585
                {
1586
                    instanceMain.dzMainMenu.rotate.Angle += 90;
1587
                }
1588
            }
1589
            else
1590
            {
1591
                if(instanceMain.dzMainMenu.rotate.Angle == 0)
1592
                {
1593
                    instanceMain.dzMainMenu.rotate.Angle = 270;
1594
                }
1595
                else
1596
                {
1597
                    instanceMain.dzMainMenu.rotate.Angle -= 90;
1598
                }
1599
            }
1600
            //double angle = (double)rotateValue.GetValue(rotateOffSet);
1601
            //instanceMain.dzMainMenu.rotate.Angle = angle;
1602
            var rotationNum = Math.Abs((instanceMain.dzMainMenu.rotate.Angle / 90));
1603

    
1604
            if (instanceMain.dzMainMenu.zoomAndPanCanvas.Width == ViewerDataModel.Instance.ContentWidth)
1605
            {
1606
                double emptySize = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
1607
                instanceMain.dzMainMenu.zoomAndPanCanvas.Width = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
1608
                instanceMain.dzMainMenu.zoomAndPanCanvas.Height = emptySize;
1609
            }
1610
            if (instanceMain.dzMainMenu.rotate.Angle == 0)
1611
            {
1612
                instanceMain.dzMainMenu.translate.X = 0;
1613
                instanceMain.dzMainMenu.translate.Y = 0;
1614
            }
1615
            else if (instanceMain.dzMainMenu.rotate.Angle == 90)
1616
            {
1617
                instanceMain.dzMainMenu.translate.X = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
1618
                instanceMain.dzMainMenu.translate.Y = 0;
1619
            }
1620
            else if (instanceMain.dzMainMenu.rotate.Angle == 180)
1621
            {
1622
                instanceMain.dzMainMenu.translate.X = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
1623
                instanceMain.dzMainMenu.translate.Y = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
1624
            }
1625
            else
1626
            {
1627
                instanceMain.dzMainMenu.translate.X = 0;
1628
                instanceMain.dzMainMenu.translate.Y = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
1629
            }
1630

    
1631
            //instanceMain.dzMainMenu.zoomAndPanControl.RenderTransformOrigin = new Point(0.5, 0.5);
1632
            instanceMain.dzMainMenu.zoomAndPanControl.RotationAngle = instanceMain.dzMainMenu.rotate.Angle;
1633
            //대기(강인구)
1634
            //instanceMain.dzMainMenu.imageViewer.RotateAngle = instanceMain.dzMainMenu.rotate.Angle;
1635

    
1636

    
1637
            //instanceMain.dzMainMenu.imageViewer.RenderTransformOrigin = new Point(0.5, 0.5);
1638
            //RotateTransform rotateTransform = new RotateTransform(instanceMain.dzMainMenu.rotate.Angle);
1639
            //instanceMain.dzMainMenu.imageViewer.RenderTransform = rotateTransform;
1640

    
1641

    
1642
            ViewerDataModel.Instance.ContentWidth = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
1643
            ViewerDataModel.Instance.ContentHeight = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
1644
            ViewerDataModel.Instance.AngleOffsetX = instanceMain.dzMainMenu.translate.X;
1645
            ViewerDataModel.Instance.AngleOffsetY = instanceMain.dzMainMenu.translate.Y;
1646
            ViewerDataModel.Instance.Angle = instanceMain.dzMainMenu.rotate.Angle;
1647
            //ViewerDataModel.Instance.Document_Info.Clear();
1648
            //ViewerDataModel.Instance.Document_Info.Where(i => i.PAGE_NUMBER == instanceMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber).ToList().ForEach(value =>
1649
            //{
1650
            //    value.PAGE_ANGLE = int.Parse(instanceMain.dzMainMenu.rotate.Angle.ToString());
1651
            //});
1652

    
1653

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

    
1659
                instanceMain.dzMainMenu.pageNavigator.ImgListbox.ItemsSource = instanceMain.dzMainMenu.pageNavigator._thumbnailItems;
1660
                var instance = instanceMain.dzMainMenu.CurrentDoc.docInfo.DOCPAGE.Where(p => p.PAGE_NUMBER == instanceMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber).FirstOrDefault();
1661
                instance.PAGE_ANGLE = int.Parse(instanceMain.dzMainMenu.rotate.Angle.ToString());
1662

    
1663
                instanceMain.dzMainMenu.pageNavigator.setPageChange(data);
1664

    
1665
                //rotation page add or update
1666
                var rotationdoc = ViewerDataModel.Instance.RotationDocs.Where(d => d.ID == instance.ID).FirstOrDefault();
1667
                if (rotationdoc != null)
1668
                {
1669
                    rotationdoc.PAGE_ANGLE = instance.PAGE_ANGLE;
1670
                }
1671
                else
1672
                {
1673
                    ViewerDataModel.Instance.RotationDocs.Add(instance);
1674
                }
1675
            });
1676
        }
1677
        #endregion
1678

    
1679
        private void ImageConverter()
1680
        {
1681
            var instanceMain = this.ParentOfType<MainWindow>();
1682
            //http://cloud.devdoftech.co.kr:5977/ImageUpload/FileUpload.asmx
1683

    
1684

    
1685
            Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
1686
            dlg.Filter = "All files (*.*)|*.*|PNG Images (*.png)|*.png";
1687
            Nullable<bool> result = dlg.ShowDialog();
1688
            if (result == true)
1689
            {
1690
                instanceMain.dzMainMenu.filename = dlg.FileName;
1691
                instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ImgControl;
1692

    
1693
                System.IO.FileInfo fileInfo = new System.IO.FileInfo(instanceMain.dzMainMenu.filename);
1694
                String strFile = System.IO.Path.GetFileName(instanceMain.dzMainMenu.filename);
1695
                long numByte = fileInfo.Length;
1696
                double dLen = Convert.ToDouble(fileInfo.Length / 1000000);
1697
                kr.co.devdoftech.cloud.FileUpload fileUploader = new kr.co.devdoftech.cloud.FileUpload();
1698

    
1699
                if (dLen < 4)
1700
                {
1701
                    System.IO.FileStream fStream = new System.IO.FileStream(instanceMain.dzMainMenu.filename, System.IO.FileMode.Open, System.IO.FileAccess.Read);
1702
                    System.IO.BinaryReader br = new System.IO.BinaryReader(fStream);
1703
                    byte[] data = br.ReadBytes((int)numByte);
1704
                    br.Close();
1705
                    
1706
                    
1707

    
1708
                    instanceMain.dzMainMenu.filename = fileUploader.Run(App.ViewInfo.ProjectNO, instanceMain.dzMainMenu._DocItem.DOCUMENT_NO, App.ViewInfo.UserID, strFile, data);
1709
                    fStream.Close();
1710
                    fStream.Dispose();
1711
                }
1712
                else
1713
                {
1714
                    this.ParentOfType<MainWindow>().DialogMessage_Alert("Available Memory less than 4 mega byte", "Alert");
1715
                }
1716
            }
1717
        }
1718

    
1719
        private void Control_Init(RadToggleButton instanceToggle, object sender)
1720
        {
1721

    
1722
        }
1723

    
1724
        private void ControlEvent(object sender, RoutedEventArgs e)
1725
        {
1726
            RadToggleButton instanceToggle = sender as RadToggleButton;
1727
            var instanceMain = this.ParentOfType<MainWindow>();
1728

    
1729
            #region Ctrl + A 눌렀을 때 대처 방법 
1730
            //원인 : Ctrl + A를 누르면 UIElementSet에 등록을 시키지 않는다(이유는 한꺼번에 많은 양의 컨트롤의 동작이 유입되기 때문에
1731
            //       시스템의 성능저하를 불러올 수 있기 때문이다. 그래서 선택 후 다른 컨트롤을 누르면 등록되지 않은 컨트롤이기 때문에 삭제된다
1732
            //       이를 대처하는 방법으로 아래 코드를 사용한다.
1733
            if (Common.ViewerDataModel.Instance.MarkupControls.Count == 0 && Common.ViewerDataModel.Instance.MarkupControls.Count >= 1)
1734
            {
1735
                //var lstItem = instanceMain.DeepLayer._SelectLayer.ChildrenOfType<AdornerFinal>().ToList();
1736
                //foreach (var item in lstItem)
1737
                //{
1738
                //    foreach (var member in item.MemberSet)
1739
                //    {
1740
                //        if (!instanceMain.DeepLayer.UIElementSet.Contains(member.DrawingData))
1741
                //        {
1742
                //            instanceMain.DeepLayer.UIElementSet.Add(member.DrawingData);
1743
                //        }
1744
                //    }
1745
                //}
1746
            }
1747
            #endregion
1748

    
1749
            //if (!instanceMain.IsFreeSelectionMode)
1750
            //{
1751
            //    instanceMain.IsSwingMode = true;
1752
            //}
1753

    
1754
            #region 다른 컨트롤 버튼 선택 해제
1755
            System.Reactive.Linq.Observable2.FromPropertyChangedPattern(Common.ViewerDataModel.Instance, temp => temp.SelectedControl).Subscribe(ControlState =>
1756
            {
1757
                if (ControlState == null)
1758
                {
1759
                    instanceToggle.IsChecked = false;
1760
                    HiddenControlHide();
1761
                }
1762
            });
1763
            #endregion
1764

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

    
1767
            if (instanceToggle != null)
1768
            {
1769
                Common.ViewerDataModel.Instance.ControlTag = instanceToggle.Tag.ToString();
1770
            }
1771
            else if ((sender as RadRibbonToggleButton) != null)
1772
            {
1773
                Common.ViewerDataModel.Instance.ControlTag = (sender as RadRibbonToggleButton).Tag.ToString();
1774
                instanceToggle = (sender as RadRibbonToggleButton);
1775
            }
1776
            else if ((sender as RadRibbonButton) != null)
1777
            {
1778
                RadRibbonButton instanceButton = sender as RadRibbonButton;
1779
                Common.ViewerDataModel.Instance.ControlTag = instanceButton.Tag.ToString();
1780
            }
1781
            else
1782
            {
1783
                RadButton instanceButton = sender as RadButton;
1784
                Common.ViewerDataModel.Instance.ControlTag = instanceButton.Tag.ToString();
1785
            }
1786

    
1787

    
1788

    
1789
            System.Reactive.Linq.Observable2.FromPropertyChangedPattern(Common.ViewerDataModel.Instance, temp => temp.AngleVisibility).Subscribe(isSee =>
1790
            {
1791
                instanceMain.dzMainMenu.MainAngle.Visibility = isSee;
1792
                System.Reactive.Linq.Observable2.FromPropertyChangedPattern(Common.ViewerDataModel.Instance, temp => temp.AngleValue).Subscribe(p =>
1793
                {
1794
                    instanceMain.dzMainMenu.MainAngle.AngleValue = p;
1795
                });
1796
            });
1797
            instanceMain.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Drawing;
1798

    
1799
            instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = false;
1800

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

    
2026
                        //instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = true;
2027

    
2028
                        Common.ViewerDataModel.Instance.SelectedControl = "Ink";
2029
                        Common.ViewerDataModel.Instance.LineSize = (double)cbLineSize.Value;
2030
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.PenControl;
2031
                        break;
2032
                    #endregion
2033
                    #region Select
2034
                    case "Select":
2035
                        if(this.ParentOfType<MainWindow>().dzMainMenu.currentControl != null)
2036
                        {
2037
                            ViewerDataModel.Instance.MarkupControls_USER.Remove(this.ParentOfType<MainWindow>().dzMainMenu.currentControl);
2038
                            this.ParentOfType<MainWindow>().dzMainMenu.currentControl = null;
2039
                        }
2040
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Selecting;
2041
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2042
                        instanceMain.dzMainMenu.isLeftMouseButtonDownOnWindow = false;
2043
                        break;
2044
                    #endregion
2045
                    #region Image
2046
                    case "Image":
2047
                        Common.ViewerDataModel.Instance.SelectedControl = "ImgControl";
2048
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ImgControl;
2049
                        ImageConverter();
2050
                        break;
2051
                    #endregion
2052
                    #region Sign
2053
                    case "Sign":
2054
                        Common.ViewerDataModel.Instance.SelectedControl = "Sign";
2055
                        Common.ViewerDataModel.Instance.ControlTag = instanceMain.dzMainMenu._ViewInfo.UserID; //사번
2056
                        //강인구 추가
2057
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Sign;
2058
                        //instanceMain.BaseClient.GetUserSignCompleted += (sen, ea) =>
2059
                        //{
2060
                        //    if (ea.Result == null)
2061
                        //    {
2062

    
2063
                        //        this.ParentOfType<MainPage>().DialogMessage_Alert("You Don't Have Sign Data", "Alert");
2064
                        //    }
2065
                        //    else
2066
                        //    {
2067
                        //        byte[] imageBytes = System.Convert.FromBase64String(ea.Result);
2068
                        //        using (MemoryStream ms = new MemoryStream(imageBytes))
2069
                        //        {
2070
                        //            BitmapImage im = new BitmapImage();
2071
                        //            im.SetSource(ms);
2072
                        //            instanceMain.DeepLayer.SignImage = im;
2073
                        //            ms.Close();
2074
                        //        }
2075
                        //    }
2076
                        //};
2077
                        //instanceMain.BaseClient.GetUserSignAsync(instanceMain._ViewInfo.UserID);
2078
                        break;
2079
                    #endregion
2080
                    #region Check
2081
                    case "Check":
2082
                        Common.ViewerDataModel.Instance.SelectedControl = "Check";
2083
                        Common.ViewerDataModel.Instance.ControlTag = instanceMain.dzMainMenu._ViewInfo.UserID; //사번
2084
                        //강인구 추가
2085
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Symbol;
2086
                        break;
2087
                    #endregion
2088
                    #region Batch
2089
                    case "Batch":
2090
                        Common.ViewerDataModel.Instance.SelectedControl = "Batch";
2091
                        Common.ViewerDataModel.Instance.ControlTag = instanceMain.dzMainMenu._ViewInfo.UserID; //사번
2092
                        //강인구 추가
2093
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Mark;
2094
                        instanceMain.dzMainMenu.txtBatch.Visibility = Visibility.Visible;
2095
                        instanceMain.dzMainMenu.txtBatch.Text = "Place Mark";
2096
                        break;
2097
                    #endregion
2098
                    #region Copy
2099
                    case "Copy":
2100
                        Copy_Start();
2101
                        instanceToggle.IsChecked = false;
2102
                        ViewerDataModel.Instance.SelectedControl = "";
2103
                        ViewerDataModel.Instance.ControlTag = null;
2104
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2105
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2106
                        break;
2107
                    #endregion
2108
                    #region Cut
2109
                    case "Cut":
2110
                        Cut_Start();
2111
                        instanceToggle.IsChecked = false;
2112
                        ViewerDataModel.Instance.SelectedControl = "";
2113
                        ViewerDataModel.Instance.ControlTag = null;
2114
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2115
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2116
                        break;
2117
                    #endregion
2118
                    #region Paste
2119
                    case "Paste":
2120
                        Paste_Start();
2121
                        instanceToggle.IsChecked = false;
2122
                        ViewerDataModel.Instance.SelectedControl = "";
2123
                        ViewerDataModel.Instance.ControlTag = null;
2124
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2125
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;                        
2126
                        break;
2127
                    #endregion
2128
                    #region Delete
2129
                    case "Delete":
2130
                        Delete_Start();
2131
                        instanceToggle.IsChecked = false;
2132
                        ViewerDataModel.Instance.SelectedControl = "";
2133
                        ViewerDataModel.Instance.ControlTag = null;
2134
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2135
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2136
                        break;
2137
                    #endregion
2138
                    #region Undo
2139
                    case "Undo":
2140
                        this.ParentOfType<MainWindow>().dzMainMenu.Undo();
2141
                        instanceToggle.IsChecked = false;
2142
                        ViewerDataModel.Instance.SelectedControl = "";
2143
                        ViewerDataModel.Instance.ControlTag = null;
2144
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2145
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2146
                        break;
2147
                    #endregion
2148
                    #region Redo
2149
                    case "Redo":
2150
                        this.ParentOfType<MainWindow>().dzMainMenu.Redo();
2151
                        instanceToggle.IsChecked = false;
2152
                        ViewerDataModel.Instance.SelectedControl = "";
2153
                        ViewerDataModel.Instance.ControlTag = null;
2154
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2155
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2156
                        break;
2157
                    #endregion
2158
                    #region DragZoom
2159
                    case "DragZoom":
2160
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.DragZoom;
2161
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2162
                        instanceMain.dzMainMenu.isLeftMouseButtonDownOnWindow = false;
2163
                        break;
2164
                    #endregion
2165
                    #region Grouping
2166
                    case "Group":
2167
                        var GrouptoggleList = this.Parent.ChildrenOfType<RadRibbonToggleButton>();
2168
                        foreach (var togle in GrouptoggleList)
2169
                        {
2170
                            togle.IsChecked = false;
2171
                        }
2172

    
2173
                        if (this.ParentOfType<MainWindow>().dzMainMenu.currentControl != null)
2174
                        {
2175
                            ViewerDataModel.Instance.MarkupControls_USER.Remove(this.ParentOfType<MainWindow>().dzMainMenu.currentControl);
2176
                            this.ParentOfType<MainWindow>().dzMainMenu.currentControl = null;
2177
                        }
2178
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2179
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2180
                        instanceMain.dzMainMenu.isLeftMouseButtonDownOnWindow = false;
2181
                        if (ViewerDataModel.Instance.SystemMain.dzMainMenu.SelectLayer.Children.Count < 1) //선택된 것이 없으면
2182
                        {
2183
                            this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert("Please Select Controls", "Alert");
2184
                        }
2185
                        else//if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
2186
                        {
2187
                            // string MarkupData = "";
2188
                            foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
2189
                            {
2190
                                if (item.GetType().Name == "AdornerFinal" && (item as AdornerFinal).MemberSet.Count >= 2) // 얘가 2개 이상이여야 그룹가능 버튼도 막을거긴하지만 일단..
2191
                                {
2192
                                    //MARKUP_DATA_GROUP INSERT
2193
                                    MARKUP_DATA_GROUP mARKUP_DATA_GROUP = new MARKUP_DATA_GROUP
2194
                                    {
2195
                                        SYMBOL_ID = null,//InnerItem.Symbol_ID
2196
                                        STATE = 0,
2197
                                    };
2198
                                    long group_id = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.AddMarkupDataGroup(mARKUP_DATA_GROUP, App.ViewInfo.ProjectNO);
2199
                                    Logger.sendReqLog("AddMarkupDataGroup: ", "", 1);
2200
                                    if (group_id > 0)
2201
                                    {
2202
                                        foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
2203
                                        {
2204
                                            if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
2205
                                            {
2206
                                                //MARKUP_DATA UPDATE
2207
                                                //Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.UpdateMarkupData((InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo).CommentID, group_id, App.ViewInfo.ProjectNO);
2208
                                                //Logger.sendReqLog("UpdateMarkupData: ", "", 1);
2209
                                                ViewerDataModel.Instance.MarkupList_USER.Where(d => d.ID == (InnerItem.DrawingData as CommentUserInfo).CommentID).FirstOrDefault().Group_ID = group_id;
2210
                                                ViewerDataModel.Instance.MarkupList_USER.Where(d => d.ID == (InnerItem.DrawingData as CommentUserInfo).CommentID).FirstOrDefault().IsUpdate = true;
2211
                                            }
2212
                                        }
2213
                                    }
2214
                                }
2215
                            }
2216
                        }
2217
                        break;
2218
                    case "UnGroup":
2219
                        var UnGrouptoggleList = this.Parent.ChildrenOfType<RadRibbonToggleButton>();
2220
                        foreach (var togle in UnGrouptoggleList)
2221
                        {
2222
                            togle.IsChecked = false;
2223
                        }
2224
                        if (this.ParentOfType<MainWindow>().dzMainMenu.currentControl != null)
2225
                        {
2226
                            ViewerDataModel.Instance.MarkupControls_USER.Remove(this.ParentOfType<MainWindow>().dzMainMenu.currentControl);
2227
                            this.ParentOfType<MainWindow>().dzMainMenu.currentControl = null;
2228
                        }
2229
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2230
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2231
                        instanceMain.dzMainMenu.isLeftMouseButtonDownOnWindow = false;
2232

    
2233
                        if (ViewerDataModel.Instance.SystemMain.dzMainMenu.SelectLayer.Children.Count < 1) //선택된 것이 없으면
2234
                        {
2235
                            this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert("Please Select Controls", "Alert");
2236
                        }
2237
                        else//if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
2238
                        {
2239
                            // string MarkupData = "";
2240
                            foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
2241
                            {
2242
                                if (item.GetType().Name == "AdornerFinal" && (item as AdornerFinal).MemberSet.Count >= 1) // 1개 이상 
2243
                                {
2244
                                    //MARKUP_DATA UPDATE
2245
                                    foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
2246
                                    {
2247
                                        if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
2248
                                        {
2249
                                            long group_id = ViewerDataModel.Instance.MarkupList_USER.Where(d => d.ID == (InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo).CommentID).FirstOrDefault().Group_ID;
2250
                                            //MARKUP_DATA UPDATE
2251
                                            //Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.UpdateMarkupData((InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo).CommentID, 0, App.ViewInfo.ProjectNO);
2252
                                            //Logger.sendReqLog("UpdateMarkupData: ", "", 1);
2253
                                            ViewerDataModel.Instance.MarkupList_USER.Where(d => d.ID == (InnerItem.DrawingData as CommentUserInfo).CommentID).FirstOrDefault().Group_ID = 0;
2254
                                            ViewerDataModel.Instance.MarkupList_USER.Where(d => d.ID == (InnerItem.DrawingData as CommentUserInfo).CommentID).FirstOrDefault().IsUpdate = true;
2255

    
2256

    
2257
                                            //MARKUP_DATA_GROUP UPDATE
2258
                                            bool value = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.UpdateMarkupDataGroup(group_id, App.ViewInfo.ProjectNO);
2259
                                            Logger.sendReqLog("AddMarkupDataGroup: ", value.ToString(), 1);
2260
                                        }
2261
                                    }
2262
                                }
2263
                            }
2264
                        }
2265
                        break;
2266
                    #endregion
2267
                    #region Capture
2268
                    case "Capture":
2269
                        SyncInit();
2270
                        //   instanceToggle.IsChecked = false;
2271
                        var CaptureList = this.Parent.ChildrenOfType<RadRibbonToggleButton>();
2272
                        foreach (var togle in CaptureList)
2273
                        {
2274
                            togle.IsChecked = false;
2275
                        }
2276

    
2277
                        if (this.ParentOfType<MainWindow>().dzMainMenu.currentControl != null)
2278
                        {
2279
                            ViewerDataModel.Instance.MarkupControls_USER.Remove(this.ParentOfType<MainWindow>().dzMainMenu.currentControl);
2280
                            this.ParentOfType<MainWindow>().dzMainMenu.currentControl = null;
2281
                        }
2282

    
2283
                        ViewerDataModel.Instance.SelectedControl = "ImgControl";
2284
                   //     ViewerDataModel.Instance.ControlTag = null;
2285
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ImgControl;
2286

    
2287
                        /*
2288
                        //캡쳐 하기 전에 코멘트 저장
2289
                        if (Common.ViewerDataModel.Instance.MarkupControls_USER.Count > 0 || (Application.Current.MainWindow as MainWindow).dzMainMenu.SelectLayer.Children.Count > 0)
2290
                        {
2291
                            var menu = (Application.Current.MainWindow as MainWindow).dzMainMenu;
2292
                            menu.ReleaseAdorner();
2293
                            if (menu.PreviewUserMarkupInfoItem != null && menu.PreviewUserMarkupInfoItem.IsPreviewUser == true)
2294
                            {
2295
                                (Application.Current.MainWindow as MainWindow).dzTopMenu.RefactoryCommentReact(menu);
2296
                            }
2297
                            else if (menu.gridViewMarkup.SelectedItems.Count == 0 || (menu.gridViewMarkup.SelectedItems.FirstOrDefault() as IKCOM.MarkupInfoItem).UserID != App.ViewInfo.UserID)
2298
                            {
2299

    
2300
                            }
2301
                            else
2302
                            {
2303
                                (Application.Current.MainWindow as MainWindow).dzTopMenu.RefactoryCommentReact(menu);
2304
                            }
2305
                        }*/
2306

    
2307
                        //Common.ViewerDataModel.Instance.CheckList_ID = ((e.Source as Telerik.Windows.Controls.RadButton).DataContext as Customer).ID;
2308
                        //Common.ViewerDataModel.Instance.CheckList_ID = ((e.Source as Image).DataContext as Customer).ID;
2309
                        //Common.ViewerDataModel.Instance.PageNumber = ((e.Source as Image).DataContext as Customer).PAGENUMBER;
2310
                        Application.Current.MainWindow.Focus();
2311
                        Common.ViewerDataModel.Instance.Capture_Opacity = 0.49;
2312
                        (Application.Current.MainWindow as MainWindow).dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Capture;
2313
                        break;
2314
                    #endregion
2315
                    default:
2316
                        break;
2317
                }
2318
                #endregion
2319
            }
2320
            else
2321
            {
2322

    
2323
                if (!instanceMain.dzMainMenu.IsFreeSelectionMode)
2324
                {
2325
                    instanceMain.dzMainMenu.IsSwingMode = false;
2326
                    Common.ViewerDataModel.Instance.SelectedControl = "";
2327
                    Common.ViewerDataModel.Instance.ControlTag = null;
2328
                    this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2329
                    this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2330
                }
2331
            }
2332
        }
2333

    
2334
        private void SyncInit()
2335
        {
2336
            try
2337
            {
2338
                if (!ViewerDataModel.Instance.SystemMain.dzMainMenu.testPanel2.IsHidden)
2339
                {
2340
                    ViewerDataModel.Instance.SystemMain.dzMainMenu.testPanel2.IsHidden = true;
2341
                    ViewerDataModel.Instance.PageBalanceMode = false;
2342
                    ViewerDataModel.Instance.PageBalanceNumber = 0;
2343
                    ViewerDataModel.Instance.PageNumber = 0;
2344
                    ViewerDataModel.Instance.MarkupControls_Sync.Clear();
2345
                    ViewerDataModel.Instance.SystemMain.dzMainMenu.gridViewRevMarkup.Visibility = Visibility.Collapsed;
2346
                    ViewerDataModel.Instance.SystemMain.dzMainMenu.UserList.IsChecked = false;
2347
                    ViewerDataModel.Instance.SystemMain.dzMainMenu.BalanceMode.IsChecked = false;
2348
                }
2349
            }
2350
            catch (Exception ex)
2351
            {
2352
                Logger.sendResLog("SyncInit", ex.Message, 0);
2353
            }
2354

    
2355
        }
2356

    
2357
        private void cbAutoSave_Checked(object sender, RoutedEventArgs e)
2358
        {            
2359
            if (cbAutoSave.IsChecked == true)
2360
            {
2361
                SaveTime(true, (int)cbSaveInterval.Value);
2362
            }
2363
            else
2364
            {
2365
                SaveTime(false, (int)cbSaveInterval.Value);
2366
            }
2367
        }
2368
        private void cbSaveInterval_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
2369
        {
2370
            if(string.IsNullOrEmpty(cbSaveInterval.Value.ToString()))
2371
            {
2372
                cbSaveInterval.Value = cbSaveInterval.Minimum;
2373
            }
2374
            if (cbAutoSave.IsChecked == true)
2375
            {
2376
                SaveTime(true, (int)cbSaveInterval.Value);
2377
            }
2378

    
2379
            KCOM.Properties.Settings.Default.SaveInterval = (double)cbSaveInterval.Value;
2380
            Properties.Settings.Default.Save();
2381
        }
2382
        //강인구 자동 저장 추가
2383
        private void AutoSave(object sender, RoutedEventArgs e)
2384
        {
2385
            RadToggleButton instanceToggle = sender as RadToggleButton;
2386

    
2387
            if(instanceToggle.IsChecked == true)
2388
            {
2389
                SaveTime(true);
2390
            }
2391
            else
2392
            {
2393
                SaveTime(false);
2394
            }
2395
        }
2396

    
2397
        public void Copy_Start()
2398
        {
2399
            if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
2400
            {
2401
                string MarkupData = "";
2402

    
2403
                foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
2404
                {
2405
                    if (item.GetType().Name == "AdornerFinal")
2406
                    {
2407
                        foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
2408

    
2409
                        {
2410
                            if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
2411
                            {
2412
                                markupReturn = layer.MarkupToString(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo, App.ViewInfo.UserID);
2413
                                MarkupData += "|OR|" + markupReturn.ConvertData;
2414
                            }
2415
                        }
2416
                        Clipboard.SetText(MarkupData);
2417
                    }
2418
                }
2419
            }
2420
        }
2421

    
2422
        public void Cut_Start()
2423
        {
2424
            if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
2425
            {
2426
                foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
2427
                {
2428
                    string MarkupData = "";
2429

    
2430
                    if (item.GetType().Name == "AdornerFinal")
2431
                    {
2432
                        foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
2433
                        {
2434
                            if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
2435
                            {
2436
                                markupReturn = layer.MarkupToString(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo, App.ViewInfo.UserID);
2437
                                MarkupData += "|OR|" + markupReturn.ConvertData;
2438
                            }
2439
                        }
2440
                        //클립보드에 넣음
2441
                        Clipboard.SetText(MarkupData);
2442
                    }
2443
                }
2444
                this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Clear();
2445
            }
2446
        }
2447

    
2448
        public void Paste_Start()
2449
        {
2450
            //마크업 붙여넣기
2451
            //if (Clipboard.GetText().Contains("|DZ|"))
2452
            if (Clipboard.GetText().Contains("|OR||DZ|"))
2453
            {
2454
                List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>();
2455

    
2456
                string[] delimiterChars = { "|OR|" };
2457
                string[] data = Clipboard.GetText().Split(delimiterChars, StringSplitOptions.RemoveEmptyEntries);
2458

    
2459
                this.ParentOfType<MainWindow>().dzMainMenu.ReleaseAdorner();
2460

    
2461
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
2462

    
2463
                //강인구 Undo/Redo 보류
2464
                UndoData = new Undo_data()
2465
                {
2466
                    IsUndo = false,
2467
                    Event = Event_Type.Create,
2468
                    EventTime = DateTime.Now,
2469
                    Markup_List = new List<Multi_Undo_data>()
2470
                };
2471

    
2472
                ViewerDataModel.Instance.UndoDataList.Where(data1 => data1.IsUndo == true).ToList().ForEach(i =>
2473
                {
2474
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
2475
                });
2476

    
2477
                foreach (string parse in data)
2478
                {
2479
                    if (parse != "")
2480
                    {
2481
                        System.Windows.Controls.Control item = layer.markupParse_Paste(parse, ViewerDataModel.Instance.MarkupControls_USER);
2482
                        (item as MarkupToPDF.Common.CommentUserInfo).CommentID = Events.Save.shortGuid();
2483

    
2484
                        ViewerDataModel.Instance.MarkupControls.Remove(item as MarkupToPDF.Common.CommentUserInfo);
2485
                        ViewerDataModel.Instance.MarkupControls_USER.Remove(item as MarkupToPDF.Common.CommentUserInfo);
2486

    
2487
                        adornerSet.Add(item as MarkupToPDF.Common.CommentUserInfo);
2488

    
2489
                        //Controls.AdornerFinal final = new Controls.AdornerFinal(item as MarkupToPDF.Common.CommentUserInfo);
2490
                        //this.dzMainMenu.SelectLayer.Children.Add(final);
2491

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

    
2494
                        UndoData.Markup_List.Add(multi_Undo_Data);
2495
                        ViewerDataModel.Instance.UndoDataList.Add(UndoData);                        
2496
                    }
2497
                }
2498
                Controls.AdornerFinal final = new Controls.AdornerFinal(adornerSet);
2499

    
2500
                if(this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.X < 0)
2501
                {
2502
                    Canvas.SetLeft(final, 0);
2503
                    Canvas.SetTop(final, 0);
2504
                }
2505
                else
2506
                {
2507
                    double realPointX = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.X - final.BorderSize.X - (final.BorderSize.Width / 2);
2508
                    double realPointY = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.Y - final.BorderSize.Y - (final.BorderSize.Height / 2);
2509
                    final.MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(realPointX, realPointY));
2510

    
2511
                    if (final.MemberSet.Where(type => type.Drawingtype == MarkupToPDF.Controls.Common.ControlType.TextControl).FirstOrDefault() != null)
2512
                    {
2513
                        final.MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(0.001, 0.001)); //dummy
2514
                    }
2515

    
2516
                }
2517
                
2518

    
2519
                this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Add(final);
2520

    
2521
                //붙여 넣을때 원본 컨트롤과 겹치지 않도록 설정
2522
                //Canvas.SetLeft(final, 50);
2523
                //Canvas.SetTop(final, 50);
2524
            }
2525
            //외부 이미지 붙여넣기
2526
            else if (Clipboard.GetImage() != null)
2527
            {
2528
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
2529

    
2530
                //강인구 Undo/Redo 보류
2531
                UndoData = new Undo_data()
2532
                {
2533
                    IsUndo = false,
2534
                    Event = Event_Type.Create,
2535
                    EventTime = DateTime.Now,
2536
                    Markup_List = new List<Multi_Undo_data>()
2537
                };
2538

    
2539

    
2540
                string temppath = System.IO.Path.GetTempPath();
2541
                //string filename = KCOM.Events.Save.shortCommentKey();
2542
                string filename = KCOM.Events.Save.shortFileKey();
2543

    
2544
                System.Drawing.Image clipboardImage = System.Windows.Forms.Clipboard.GetImage();
2545
                clipboardImage.Save(temppath + "\\" + filename);
2546

    
2547
                System.IO.FileInfo fileInfo = new System.IO.FileInfo(temppath + "\\" + filename);
2548
                String strFile = System.IO.Path.GetFileName(fileInfo.FullName);
2549
                long numByte = fileInfo.Length;
2550
                double dLen = Convert.ToDouble(fileInfo.Length / 1000000);
2551
                kr.co.devdoftech.cloud.FileUpload fileUploader = new kr.co.devdoftech.cloud.FileUpload();
2552

    
2553
                if (dLen < 4)
2554
                {
2555
                    System.IO.FileStream fStream = new System.IO.FileStream(fileInfo.FullName,
2556
                    System.IO.FileMode.Open, System.IO.FileAccess.Read);
2557
                    System.IO.BinaryReader br = new System.IO.BinaryReader(fStream);
2558
                    byte[] data = br.ReadBytes((int)numByte);
2559

    
2560
                    filename = fileUploader.Run(App.ViewInfo.ProjectNO, this.ParentOfType<MainWindow>().dzMainMenu._DocItem.DOCUMENT_NO, App.ViewInfo.UserID, strFile + ".png", data);
2561
                    br.Close();
2562
                    fStream.Close();
2563
                    fStream.Dispose();
2564
                }
2565
                else
2566
                {
2567
                    this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert("Available Memory less than 4 mega byte", "Alert");
2568
                    return;
2569
                }
2570

    
2571
                fileInfo.Delete();
2572

    
2573
                //System.Drawing.Image clipboardImage = System.Windows.Forms.Clipboard.GetImage();
2574
                System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(clipboardImage);
2575
                IntPtr hBitmap = bmp.GetHbitmap();
2576
                System.Windows.Media.ImageSource WpfBitmap = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(hBitmap, IntPtr.Zero, Int32Rect.Empty, System.Windows.Media.Imaging.BitmapSizeOptions.FromEmptyOptions());
2577
                Image img = new Image();
2578
                //img.Source = new System.Windows.Media.Imaging.BitmapImage(new Uri(filename));
2579
                if (filename.Contains(".svg"))
2580
                {
2581
                    byte[] imageData = null;
2582
                    DrawingImage image = null;
2583
                    using (System.Net.WebClient web = new System.Net.WebClient())
2584
                    {
2585
                        imageData = web.DownloadData(new Uri(filename));
2586
                        System.IO.Stream stream = new System.IO.MemoryStream(imageData);
2587
                        image = SvgReader.Load(stream);
2588
                    }
2589
                    img.Source = image;
2590
                }
2591
                else
2592
                {
2593
                    img.Source = new BitmapImage(new Uri(filename));
2594
                }
2595

    
2596
                var currentControl = new MarkupToPDF.Controls.Etc.ImgControl
2597
                {
2598
                    PointSet = new List<Point>(),
2599
                    //FilePath = img.Source.ToString(),
2600
                    FilePath = filename,
2601
                    ImageData = img.Source,
2602
                    StartPoint = new Point(100, 100),
2603
                    EndPoint = new Point(200, 200),
2604
                    TopRightPoint = new Point(100, 200),
2605
                    LeftBottomPoint = new Point(200, 100)
2606
                };
2607

    
2608
                currentControl.TopRightPoint = new Point(currentControl.StartPoint.X + clipboardImage.Width, currentControl.StartPoint.Y);
2609
                currentControl.LeftBottomPoint = new Point(currentControl.StartPoint.X, currentControl.StartPoint.Y + clipboardImage.Height);
2610
                currentControl.EndPoint = new Point(currentControl.StartPoint.X + clipboardImage.Width, currentControl.StartPoint.Y + clipboardImage.Height);
2611

    
2612
                currentControl.PointSet = new List<Point>
2613
                                        {
2614
                                            currentControl.StartPoint,
2615
                                            currentControl.LeftBottomPoint,
2616
                                            currentControl.EndPoint,
2617
                                            currentControl.TopRightPoint,
2618
                                        };
2619

    
2620
                multi_Undo_Data = this.ParentOfType<MainWindow>().dzMainMenu.Control_Style(currentControl as MarkupToPDF.Common.CommentUserInfo);
2621
                UndoData.Markup_List.Add(multi_Undo_Data);
2622
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
2623

    
2624
                ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl as MarkupToPDF.Common.CommentUserInfo);
2625
                currentControl.CommentID = Events.Save.shortGuid();
2626

    
2627
                currentControl.ApplyTemplate();
2628
                currentControl.SetImage();
2629

    
2630
                ViewerDataModel.Instance.MarkupControls_USER.Remove(currentControl as MarkupToPDF.Common.CommentUserInfo);
2631
                Controls.AdornerFinal final = new Controls.AdornerFinal(currentControl as MarkupToPDF.Common.CommentUserInfo);
2632
                this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Add(final);
2633

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

    
2638
            }
2639
        }
2640

    
2641
        public void Delete_Start()
2642
        {
2643
            if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
2644
            {
2645
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
2646

    
2647
                UndoData = new Undo_data()
2648
                {
2649
                    IsUndo = false,
2650
                    Event = Event_Type.Delete,
2651
                    EventTime = DateTime.Now,
2652
                    Markup_List = new List<Multi_Undo_data>()
2653
                };
2654

    
2655
                foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
2656
                {
2657
                    if (item.GetType().Name == "AdornerFinal")
2658
                    {
2659
                        (item as Controls.AdornerFinal).unRegister();
2660

    
2661
                        foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
2662
                        {
2663
                            //if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
2664
                            if (!ViewerDataModel.Instance.MarkupControls_USER.Contains(InnerItem.DrawingData))
2665
                            {
2666

    
2667
                                multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
2668
                                UndoData.Markup_List.Add(multi_Undo_Data);
2669
                                multi_Undo_Data = new Multi_Undo_data();
2670

    
2671
                                ViewerDataModel.Instance.MarkupControls.Remove(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo);
2672

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

    
2675
                                ViewerDataModel.Instance.MarkupList_USER.Remove(Item_);
2676

    
2677
                                //임시파일에서도 삭제한다.
2678
                                temp.DelTemp((InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo).CommentID, this.ParentOfType<MainWindow>().dzMainMenu.pageNavigator.CurrentPage.PageNumber.ToString());
2679
                                
2680
                            }
2681
                        }
2682
                    }
2683

    
2684
                    ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
2685
                    {
2686
                        ViewerDataModel.Instance.UndoDataList.Remove(i);
2687
                    });
2688
                    ViewerDataModel.Instance.UndoDataList.Add(UndoData);
2689
                }
2690
            }
2691
            this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Clear();
2692
        }
2693

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