프로젝트

일반

사용자정보

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

markus / KCOM / Events / Event_KeyEvent.cs @ 65eb8dd6

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

1
using KCOM.Common;
2
using MarkupToPDF.Common;
3
using System;
4
using System.Collections.Generic;
5
using System.ComponentModel;
6
using System.Linq;
7
using System.Text;
8
using System.Windows;
9
using System.Windows.Controls;
10
using System.Windows.Input;
11
using Telerik.Windows.Controls;
12
//using static KCOM.Views.MainMenu;
13

    
14
namespace KCOM
15
{
16
    public partial class MainWindow : Window
17
    {
18
        public double CumulativeWheel = 0;
19

    
20
        public MarkupToPDF.Common.Undo_data UndoData;
21

    
22
        //20181108
23
        //강인구 추가
24
        //KCOM.Views.MainMenu mainMenu = new Views.MainMenu();
25

    
26
        //강인구 추가
27
        MarkupToPDF.Controls.Parsing.LayerControl layer = new MarkupToPDF.Controls.Parsing.LayerControl();
28
        //강인구 추가
29
        MarkupToPDF.Controls.Parsing.LayerControl.MarkupReturn markupReturn = new MarkupToPDF.Controls.Parsing.LayerControl.MarkupReturn();
30
                
31
        //임시파일관련
32
        TempFile temp = new TempFile();
33

    
34
        public void KeyEventDownAction(object sender, KeyEventArgs e)
35
        {
36

    
37
            layer.ProjectNo = App.ViewInfo.ProjectNO;
38
            switch (e.Key)
39
            {
40
                //강인구 추가
41
                #region Ctrl
42
                case Key.LeftCtrl:
43
                    {
44
                        if (!ViewerDataModel.Instance.IsPressCtrl)
45
                        {
46
                            ViewerDataModel.Instance.IsPressCtrl = true;
47
                        }
48
                    }
49
                    break;
50
                case Key.RightCtrl:
51
                    {
52

    
53
                    }
54
                    break;
55
                #endregion
56

    
57
                #region Shift
58
                case Key.RightShift:
59
                    {
60

    
61
                    }
62
                    break;
63
                case Key.LeftShift:
64
                    {
65
                        if (!ViewerDataModel.Instance.IsPressShift)
66
                        {
67
                            ViewerDataModel.Instance.IsPressShift = true;
68
                        }
69
                        //if (dzMain.deepZoomObject._MouseHelper.isMouseOver && !dzMain.DeepLayer.Drawing)
70
                        //{
71
                        //    dzMain.deepZoomObject._MouseHelper.isPressShift = true;
72
                        //    CumulativeWheel += dzMain.deepZoomObject._MouseHelper.wheelDelta;
73
                        //    dzMain.deepZoomObject._MouseHelper.wheelDelta = 0;
74
                        //    System.Diagnostics.Debug.WriteLine(CumulativeWheel);
75
                        //    if (CumulativeWheel == 3 && CumulativeWheel >= 0)
76
                        //    {
77
                        //        this.dzMain.pageNavigator.pagebeforetMove();
78
                        //        CumulativeWheel = 0;
79
                        //    }
80
                        //    else if (CumulativeWheel == -3 && CumulativeWheel <= 0)
81
                        //    {
82
                        //        this.dzMain.pageNavigator.pageNextMove();
83
                        //        CumulativeWheel = 0;
84
                        //    }
85
                        //}
86

    
87
                    }
88
                    break;
89
                #endregion
90

    
91
                //강인구 추가
92
                #region 단축키 선택
93

    
94
                #region 전체 선택(Ctrl + A)
95
                case Key.A:
96
                    {
97
                        if (ViewerDataModel.Instance.IsPressCtrl && (App.ViewInfo.CreateFinalPDFPermission || App.ViewInfo.NewCommentPermission))
98
                        {
99
                            this.dzMainMenu.InkControl_Convert();
100

    
101
                            if (Common.ViewerDataModel.Instance.MarkupControls_USER.Count > 0)
102
                            {
103
                                //전체 선택 시 선택된 토글 해제
104
                                var TogList = this.dzTopMenu.Parent.ChildrenOfType<RadToggleButton>();
105
                                this.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
106
                                this.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
107

    
108
                                //컨트롤을 그리는 도중일 경우 컨트롤 삭제
109
                                ViewerDataModel.Instance.MarkupControls_USER.Remove(this.dzMainMenu.currentControl);
110
                                this.dzMainMenu.currentControl = null;
111

    
112
                                foreach (var tog in TogList)
113
                                {
114
                                    tog.IsChecked = false;
115
                                }
116
                                
117
                                //선택된 어도너가 있을 시 취소하고 전체 선택
118
                                this.dzMainMenu.ReleaseAdorner();
119

    
120
                                UndoData = new Undo_data()
121
                                {
122
                                    IsUndo = false,
123
                                    Event = Event_Type.Select,
124
                                    EventTime = DateTime.Now,
125
                                    Markup_List = new List<Multi_Undo_data>()
126
                                };
127

    
128
                                List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>();
129
                                var control = ViewerDataModel.Instance.MarkupControls_USER.Where(data => data.GetType().Name != "").ToList();
130
                                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
131

    
132
                                foreach (var item in control)
133
                                {
134
                                    adornerSet.Add(item);
135
                                    //multi_Undo_Data.Markup = item;
136
                                    multi_Undo_Data = this.dzMainMenu.Control_Style(item);
137
                                    UndoData.Markup_List.Add(multi_Undo_Data);
138

    
139
                                    multi_Undo_Data = new Multi_Undo_data();
140
                                    ViewerDataModel.Instance.MarkupControls_USER.Remove(item);
141
                                    
142
                                }
143

    
144
                                if (adornerSet.Count > 0)
145
                                {
146
                                    Controls.AdornerFinal final = new Controls.AdornerFinal(adornerSet);
147
                                    this.dzMainMenu.SelectLayer.Children.Add(final);
148
                                }
149

    
150
                                ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
151
                                {
152
                                    ViewerDataModel.Instance.UndoDataList.Remove(i);
153
                                });
154

    
155

    
156
                                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
157
                            }
158
                        }
159
                    }
160
                    break;
161
                #endregion
162

    
163
                
164

    
165
                #region 복사하기(Ctrl + C)
166
                case Key.C:
167
                    {
168
                        if (ViewerDataModel.Instance.IsPressCtrl)
169
                        {
170
                            if (this.dzMainMenu.SelectLayer.Children.Count > 0)
171
                            {
172
                                string MarkupData = "";
173

    
174
                                foreach (var item in this.dzMainMenu.SelectLayer.Children)
175
                                {
176
                                    if (item.GetType().Name == "AdornerFinal")
177
                                    {
178
                                        foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
179

    
180
                                        {
181
                                            if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
182
                                            {
183
                                                markupReturn = layer.MarkupToString(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo, App.ViewInfo.UserID);
184
                                                MarkupData += "|OR|" + markupReturn.ConvertData;
185
                                            }
186
                                        }
187
                                        Clipboard.SetText(MarkupData);
188
                                    }
189
                                }
190
                            }
191
                        }
192
                    }
193
                    break;
194
                #endregion
195

    
196
                #region 잘라내기(Ctrl + X)
197
                case Key.X:
198
                    {
199
                        if (ViewerDataModel.Instance.IsPressCtrl)
200
                        {
201
                            if (this.dzMainMenu.SelectLayer.Children.Count > 0)
202
                            {
203
                                foreach (var item in this.dzMainMenu.SelectLayer.Children)
204
                                {
205
                                    string MarkupData = "";
206

    
207
                                    if (item.GetType().Name == "AdornerFinal")
208
                                    {
209
                                        foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
210
                                        {
211
                                            if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
212
                                            {
213
                                                markupReturn = layer.MarkupToString(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo, App.ViewInfo.UserID);
214
                                                MarkupData += "|OR|" + markupReturn.ConvertData;                                                
215
                                            }
216
                                        }
217
                                        Clipboard.SetText(MarkupData);
218
                                    }
219
                                }
220
                                this.dzMainMenu.SelectLayer.Children.Clear();
221
                            }
222
                        }
223
                        
224
                    }
225
                    break;
226
                #endregion
227

    
228
                #region 붙여넣기(Ctrl + V)
229
                case Key.V:
230
                    {
231
                        if (ViewerDataModel.Instance.IsPressCtrl && (App.ViewInfo.CreateFinalPDFPermission || App.ViewInfo.NewCommentPermission))
232
                        {
233
                            //마크업 붙여넣기
234
                            //if (Clipboard.GetText().Contains("|DZ|"))
235
                            if (Clipboard.GetText().Contains("|OR||DZ|"))
236
                            {
237
                                List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>();
238

    
239
                                string[] delimiterChars = { "|OR|" };
240
                                string[] data = Clipboard.GetText().Split(delimiterChars, StringSplitOptions.RemoveEmptyEntries);
241

    
242
                                this.dzMainMenu.ReleaseAdorner();
243

    
244
                                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
245

    
246
                                //강인구 Undo/Redo 보류
247
                                UndoData = new Undo_data()
248
                                {
249
                                    IsUndo = false,
250
                                    Event = Event_Type.Create,
251
                                    EventTime = DateTime.Now,
252
                                    Markup_List = new List<Multi_Undo_data>()
253
                                };
254

    
255
                                ViewerDataModel.Instance.UndoDataList.Where(data1 => data1.IsUndo == true).ToList().ForEach(i =>
256
                                {
257
                                    ViewerDataModel.Instance.UndoDataList.Remove(i);
258
                                });
259

    
260
                                foreach (string parse in data)
261
                                {
262
                                    if(parse != "")
263
                                    {
264
                                        System.Windows.Controls.Control item = layer.markupParse_Paste(parse, ViewerDataModel.Instance.MarkupControls_USER);
265
                                        (item as MarkupToPDF.Common.CommentUserInfo).CommentID = Events.Save.shortGuid();
266

    
267
                                        ViewerDataModel.Instance.MarkupControls.Remove(item as MarkupToPDF.Common.CommentUserInfo);
268
                                        ViewerDataModel.Instance.MarkupControls_USER.Remove(item as MarkupToPDF.Common.CommentUserInfo);
269

    
270
                                        adornerSet.Add(item as MarkupToPDF.Common.CommentUserInfo);
271

    
272
                                        //Controls.AdornerFinal final = new Controls.AdornerFinal(item as MarkupToPDF.Common.CommentUserInfo);
273
                                        //this.dzMainMenu.SelectLayer.Children.Add(final);
274

    
275
                                        multi_Undo_Data = dzMainMenu.Control_Style(item as MarkupToPDF.Common.CommentUserInfo);
276

    
277
                                        UndoData.Markup_List.Add(multi_Undo_Data);
278
                                        ViewerDataModel.Instance.UndoDataList.Add(UndoData);
279
                                    }
280
                                }
281
                                Controls.AdornerFinal final = new Controls.AdornerFinal(adornerSet);
282

    
283
                                double realPointX = this.dzMainMenu.getCurrentPoint.X - final.BorderSize.X - (final.BorderSize.Width / 2);
284
                                double realPointY = this.dzMainMenu.getCurrentPoint.Y - final.BorderSize.Y - (final.BorderSize.Height / 2);
285
                                final.MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(realPointX, realPointY));
286

    
287
                                if (final.MemberSet.Where(type => type.Drawingtype == MarkupToPDF.Controls.Common.ControlType.TextControl).FirstOrDefault() != null)
288
                                {
289
                                    final.MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(0.001, 0.001)); //dummy
290
                                }
291

    
292
                                this.dzMainMenu.SelectLayer.Children.Add(final);
293

    
294
                                //붙여 넣을때 원본 컨트롤과 겹치지 않도록 설정
295
                                //Canvas.SetLeft(final, 50);
296
                                //Canvas.SetTop(final, 50);
297

    
298
                            }
299
                            //외부 이미지 붙여넣기
300
                            else if (Clipboard.GetImage() != null)
301
                            {
302
                                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
303

    
304
                                //강인구 Undo/Redo 보류
305
                                UndoData = new Undo_data()
306
                                {
307
                                    IsUndo = false,
308
                                    Event = Event_Type.Create,
309
                                    EventTime = DateTime.Now,
310
                                    Markup_List = new List<Multi_Undo_data>()
311
                                };
312

    
313
                                string temppath = System.IO.Path.GetTempPath();
314
                                //string filename = KCOM.Events.Save.shortCommentKey();
315
                                string filename = KCOM.Events.Save.shortFileKey();
316

    
317
                                System.Drawing.Image clipboardImage = System.Windows.Forms.Clipboard.GetImage();
318
                                clipboardImage.Save(temppath + "\\" + filename);
319

    
320
                                System.IO.FileInfo fileInfo = new System.IO.FileInfo(temppath + "\\" + filename);
321
                                String strFile = System.IO.Path.GetFileName(fileInfo.FullName);
322
                                long numByte = fileInfo.Length;
323
                                double dLen = Convert.ToDouble(fileInfo.Length / 1000000);
324
                                kr.co.devdoftech.cloud.FileUpload fileUploader = new kr.co.devdoftech.cloud.FileUpload();
325

    
326
                                if (dLen < 4)
327
                                {
328
                                    System.IO.FileStream fStream = new System.IO.FileStream(fileInfo.FullName,
329
                                    System.IO.FileMode.Open, System.IO.FileAccess.Read);
330
                                    System.IO.BinaryReader br = new System.IO.BinaryReader(fStream);
331
                                    byte[] data = br.ReadBytes((int)numByte);
332

    
333
                                    filename = fileUploader.Run(App.ViewInfo.ProjectNO, this.dzMainMenu._DocItem.DOCUMENT_NO, App.ViewInfo.UserID, strFile + ".png", data);
334
                                    br.Close();
335
                                    fStream.Close();
336
                                    fStream.Dispose();
337
                                }
338
                                else
339
                                {
340
                                    dzMainMenu.DialogMessage_Alert("Available Memory less than 4 mega byte", "Alert");
341
                                    return;
342
                                }
343

    
344
                                fileInfo.Delete();
345

    
346
                                //System.Drawing.Image clipboardImage = System.Windows.Forms.Clipboard.GetImage();
347
                                System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(clipboardImage);
348
                                IntPtr hBitmap = bmp.GetHbitmap();
349
                                System.Windows.Media.ImageSource WpfBitmap = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(hBitmap, IntPtr.Zero, Int32Rect.Empty, System.Windows.Media.Imaging.BitmapSizeOptions.FromEmptyOptions());
350
                                Image img = new Image();
351
                                img.Source = new System.Windows.Media.Imaging.BitmapImage(new Uri(filename));                            
352
                                
353
                                var currentControl = new MarkupToPDF.Controls.Etc.ImgControl
354
                                {
355
                                    PointSet = new List<Point>(),
356
                                    FilePath = img.Source.ToString(),
357
                                    ImageData = img.Source,
358
                                    StartPoint = new Point(100, 100),
359
                                    EndPoint = new Point(200, 200),
360
                                    TopRightPoint = new Point(100, 200),
361
                                    LeftBottomPoint = new Point(200, 100)
362
                                };
363

    
364
                                currentControl.TopRightPoint = new Point(currentControl.StartPoint.X + clipboardImage.Width, currentControl.StartPoint.Y);
365
                                currentControl.LeftBottomPoint = new Point(currentControl.StartPoint.X, currentControl.StartPoint.Y + clipboardImage.Height);
366
                                currentControl.EndPoint = new Point(currentControl.StartPoint.X + clipboardImage.Width, currentControl.StartPoint.Y + clipboardImage.Height);
367

    
368
                                currentControl.PointSet = new List<Point>
369
                                        {
370
                                            currentControl.StartPoint,
371
                                            currentControl.LeftBottomPoint,
372
                                            currentControl.EndPoint,
373
                                            currentControl.TopRightPoint,
374
                                        };
375

    
376
                                multi_Undo_Data = dzMainMenu.Control_Style(currentControl as MarkupToPDF.Common.CommentUserInfo);
377
                                UndoData.Markup_List.Add(multi_Undo_Data);
378
                                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
379

    
380
                                ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl as MarkupToPDF.Common.CommentUserInfo);
381
                                currentControl.CommentID = Events.Save.shortGuid();
382

    
383
                                currentControl.ApplyTemplate();
384
                                currentControl.SetImage();
385

    
386
                                ViewerDataModel.Instance.MarkupControls_USER.Remove(currentControl as MarkupToPDF.Common.CommentUserInfo);
387
                                Controls.AdornerFinal final = new Controls.AdornerFinal(currentControl as MarkupToPDF.Common.CommentUserInfo);
388
                                this.dzMainMenu.SelectLayer.Children.Add(final);
389

    
390
                                double realPointX = this.dzMainMenu.getCurrentPoint.X - final.BorderSize.X - (final.BorderSize.Width / 2);
391
                                double realPointY = this.dzMainMenu.getCurrentPoint.Y - final.BorderSize.Y - (final.BorderSize.Height / 2);
392
                                final.MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(realPointX, realPointY));
393
                                                                
394
                                #region 주석
395

    
396
                                //주석
397
                                //ViewerDataModel.Instance.MarkupControls_USER.Remove(currentControl as MarkupToPDF.Common.CommentUserInfo);
398
                                //Controls.AdornerFinal final = new Controls.AdornerFinal(currentControl as MarkupToPDF.Common.CommentUserInfo);
399
                                //this.dzMainMenu.SelectLayer.Children.Add(final);
400

    
401
                                //string MarkupData = "";
402

    
403
                                //if (!ViewerDataModel.Instance.MarkupControls.Contains(currentControl))
404
                                //{
405
                                //    markupReturn = layer.MarkupToString(currentControl, App.ViewInfo.UserID);
406
                                //    MarkupData += "|OR|" + markupReturn.ConvertData;
407
                                //}
408
                                //Clipboard.SetText(MarkupData);
409
                                //this.dzMainMenu.SelectLayer.Children.Clear();
410

    
411
                                //List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>();
412

    
413
                                //string[] delimiterChars = { "|OR|" };
414
                                //string[] data1 = Clipboard.GetText().Split(delimiterChars, StringSplitOptions.RemoveEmptyEntries);
415

    
416
                                //this.dzMainMenu.ReleaseAdorner();
417

    
418
                                //foreach (string parse in data1)
419
                                //{
420
                                //    if (parse != "")
421
                                //    {
422
                                //        System.Windows.Controls.Control item = layer.markupParse_Paste(parse, ViewerDataModel.Instance.MarkupControls_USER);
423
                                //        (item as MarkupToPDF.Common.CommentUserInfo).CommentID = Events.Save.shortGuid();
424

    
425
                                //        ViewerDataModel.Instance.MarkupControls.Remove(item as MarkupToPDF.Common.CommentUserInfo);
426
                                //        ViewerDataModel.Instance.MarkupControls_USER.Remove(item as MarkupToPDF.Common.CommentUserInfo);
427

    
428
                                //        adornerSet.Add(item as MarkupToPDF.Common.CommentUserInfo);
429

    
430
                                //        //Controls.AdornerFinal final = new Controls.AdornerFinal(item as MarkupToPDF.Common.CommentUserInfo);
431
                                //        //this.dzMainMenu.SelectLayer.Children.Add(final);
432
                                //    }
433
                                //}
434
                                //Controls.AdornerFinal final = new Controls.AdornerFinal(adornerSet);
435

    
436
                                //double realPointX = this.dzMainMenu.getCurrentPoint.X - final.BorderSize.X - (final.BorderSize.Width / 2);
437
                                //double realPointY = this.dzMainMenu.getCurrentPoint.Y - final.BorderSize.Y - (final.BorderSize.Height / 2);
438
                                //final.MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(realPointX, realPointY));
439

    
440
                                //if (final.MemberSet.Where(type => type.Drawingtype == MarkupToPDF.Controls.Common.ControlType.TextControl).FirstOrDefault() != null)
441
                                //{
442
                                //    final.MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(0.001, 0.001)); //dummy
443
                                //}
444

    
445
                                //this.dzMainMenu.SelectLayer.Children.Add(final); 
446
                                #endregion
447

    
448
                            }
449
                        }
450
                        
451
                    }
452
                    break;
453
                #endregion
454

    
455
                #region 저장하기(Ctrl + S)
456
                case Key.S:
457
                    {
458
                        if (ViewerDataModel.Instance.IsPressCtrl  && (App.ViewInfo.CreateFinalPDFPermission || App.ViewInfo.NewCommentPermission))
459
                        {
460
                            //컨트롤을 그리는 도중일 경우 컨트롤 삭제
461
                            ViewerDataModel.Instance.MarkupControls_USER.Remove(this.dzMainMenu.currentControl);
462
                            this.dzMainMenu.currentControl = null;
463

    
464
                            //this.dzTopMenu.SaveEvent(null, null);
465
                            if (App.ViewInfo.CreateFinalPDFPermission || App.ViewInfo.NewCommentPermission)
466
                            {
467
                                this.dzTopMenu.SaveEvent(new object(), null);
468
                            }
469

    
470
                            //저장완료후 임시파일 삭제
471
                            temp.Remove();
472
                        }                       
473
                    }
474
                    break;
475
                #endregion
476

    
477
                #region 프린트하기(Ctrl + P)
478
                case Key.P:
479
                    {
480
                        if (ViewerDataModel.Instance.IsPressCtrl)
481
                        {
482
                            this.dzTopMenu.Print_Start("Print");
483
                        }
484
                    }
485
                    break;
486
                #endregion
487

    
488
                #region Undo(Ctrl + Z)
489
                case Key.Z:
490
                    {
491
                        if (ViewerDataModel.Instance.IsPressCtrl)
492
                        {
493
                            this.dzMainMenu.Undo();
494
                        }                        
495
                    }
496
                    break;
497
                #endregion
498

    
499
                #region Redo(Ctrl + Y)
500
                case Key.Y:
501
                    {
502
                        if (ViewerDataModel.Instance.IsPressCtrl)
503
                        {
504
                            this.dzMainMenu.Redo();
505
                        }
506
                    }
507
                    break;
508
                #endregion
509

    
510
                #region 삭제하기(Delete)
511
                case Key.Delete:
512
                    {
513
                        if (this.dzMainMenu.SelectLayer.Children.Count > 0)
514
                        {
515
                            Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
516

    
517
                            UndoData = new Undo_data()
518
                            {
519
                                IsUndo = false,
520
                                Event = Event_Type.Delete,
521
                                EventTime = DateTime.Now,
522
                                Markup_List = new List<Multi_Undo_data>()
523
                            };
524

    
525
                            foreach (var item in this.dzMainMenu.SelectLayer.Children)
526
                            {
527
                                if (item.GetType().Name == "AdornerFinal")
528
                                {
529
                                    //List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>();
530

    
531
                                    (item as Controls.AdornerFinal).unRegister();
532

    
533
                                    foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
534
                                    {
535
                                        //if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
536
                                        if (!ViewerDataModel.Instance.MarkupControls_USER.Contains(InnerItem.DrawingData))
537
                                        {
538
                                            //this.dzMainMenu.ReleaseAdorner();
539

    
540
                                            multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
541
                                            UndoData.Markup_List.Add(multi_Undo_Data);
542
                                            multi_Undo_Data = new Multi_Undo_data();
543

    
544
                                            ViewerDataModel.Instance.MarkupControls.Remove(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo);
545

    
546
                                            var Item_ = ViewerDataModel.Instance.MarkupList_USER.Where(d => d.ID == (InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo).CommentID).FirstOrDefault();
547
                                            //var Item_ = ViewerDataModel.Instance.MarkupList_USER.Where(d => d.MarkupInfoID == (InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo).MarkupInfoID).FirstOrDefault();
548

    
549
                                            ViewerDataModel.Instance.MarkupList_USER.Remove(Item_);
550

    
551
                                            //임시파일에서도 삭제한다.
552
                                            temp.DelTemp((InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo).CommentID, dzMainMenu.pageNavigator.CurrentPage.PageNumber.ToString());
553
                                                     
554
                                            //adornerSet.Add((InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo));                                           
555

    
556
                                        }
557
                                    }
558
                                }
559

    
560
                                ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
561
                                {
562
                                    ViewerDataModel.Instance.UndoDataList.Remove(i);                                    
563
                                });
564
                                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
565

    
566
                                
567
                            }
568
                        }
569

    
570
                        this.dzMainMenu.SelectLayer.Children.Clear();                        
571
                    }
572
                    break;
573
                #endregion
574

    
575
                #region 선택된 컨트롤 모두 해제 하기(ESC)
576
                case Key.Escape:
577
                    {
578
                        //캡쳐모드 일 경우 초기화
579
                        if(this.dzMainMenu.mouseHandlingMode == IKCOM.MouseHandlingMode.Capture)
580
                        {
581
                            //dzMainMenu.PN_Navi.IsEnabled = true;
582
                            this.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
583
                            ViewerDataModel.Instance.Capture_Opacity = 0;
584
                        }
585

    
586
                        if(Common.ViewerDataModel.Instance.SelectedControl == "Batch")
587
                        {
588
                            this.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
589
                            this.dzMainMenu.txtBatch.Visibility = Visibility.Collapsed;
590
                            this.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
591
                            var TogList = this.dzTopMenu.Parent.ChildrenOfType<RadToggleButton>();
592
                            foreach (var tog in TogList)
593
                            {
594
                                tog.IsChecked = false;
595
                            }
596
                        }
597

    
598
                        this.dzMainMenu.ReleaseAdorner();
599

    
600
                        //코멘트 그리는 도중일 경우 코멘트 삭제 및 초기화
601
                        if (this.dzMainMenu.currentControl != null)
602
                        {
603
                            ViewerDataModel.Instance.MarkupControls_USER.Remove(this.dzMainMenu.currentControl);
604
                            this.dzMainMenu.currentControl = null;
605
                        }
606

    
607
                        //모든 컨트롤 초기화 하고 Selection모드로 변경
608
                        dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Selecting;
609
                        dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
610

    
611
                        var toggleList = this.ChildrenOfType<RadToggleButton>();
612
                        var toggleList2 = this.ChildrenOfType<RadRibbonToggleButton>();
613

    
614
                        foreach (var item in toggleList)
615
                        {
616
                            if (item.Name == "btnSelection")
617
                            {
618
                                item.IsChecked = true;
619
                            }
620
                            else
621
                            {
622
                                item.IsChecked = false;
623
                            }
624
                        }
625
                        dzMainMenu.isLeftMouseButtonDownOnWindow = false;
626
                        //foreach (var item in toggleList2)
627
                        //{
628
                        //    item.IsChecked = false;
629
                        //}
630
                    }
631
                    break;
632
                #endregion
633

    
634
                #region FIND(Ctrl + F)
635
                case Key.F:
636
                    {
637
                        if (ViewerDataModel.Instance.IsPressCtrl)
638
                        {
639
                            if (!this.dzMainMenu.searchPane.IsPinned)
640
                            {
641
                                this.dzMainMenu.searchPane.IsPinned = true;
642
                                if (ViewerDataModel.Instance.searchPDF != null)
643
                                {
644
                                    this.dzMainMenu.searchPanel_Instance.tbSearch.Focus();
645
                                }
646
                                else
647
                                {
648
                                    this.dzMainMenu.searchPanel_Instance.btnSearch.Focus();
649
                                }
650
                            }
651
                            else
652
                            {
653
                                this.dzMainMenu.searchPane.IsPinned = false;
654
                                this.dzMainMenu.searchPane.IsActive = false;
655
                                //this.dzMainMenu.searchPane.IsHidden = true;
656
                            }
657
                        }
658
                    }
659
                    break;
660
                #endregion
661

    
662
                #endregion
663

    
664
                //강인구 추가
665
                #region Control Move
666
                case Key.Right:
667
                case Key.Left:
668
                case Key.Up:
669
                case Key.Down:
670
                    {
671
                        if (this.dzMainMenu.SelectLayer.Children.Count > 0)
672
                        {
673
                            Point control = new Point(0, 0);
674
                            double resultAngle = this.dzMainMenu.rotate.Angle;
675

    
676
                            switch (e.Key)
677
                            {
678
                                case Key.Down:
679
                                    if (resultAngle == 0) control = new Point(control.X, control.Y + 5);
680
                                    if (resultAngle == 90) control = new Point(control.X + 5, control.Y);
681
                                    if (resultAngle == 180) control = new Point(control.X, control.Y - 5);
682
                                    if (resultAngle == 270) control = new Point(control.X - 5, control.Y);
683
                                    break;
684
                                case Key.Up:
685
                                    if (resultAngle == 0) control = new Point(control.X, control.Y - 5);
686
                                    if (resultAngle == 90) control = new Point(control.X - 5, control.Y);
687
                                    if (resultAngle == 180) control = new Point(control.X, control.Y + 5);
688
                                    if (resultAngle == 270) control = new Point(control.X + 5, control.Y);
689
                                    break;
690
                                case Key.Left:
691
                                    if (resultAngle == 0) control = new Point(control.X - 5, control.Y);
692
                                    if (resultAngle == 90) control = new Point(control.X, control.Y + 5);
693
                                    if (resultAngle == 180) control = new Point(control.X + 5, control.Y);
694
                                    if (resultAngle == 270) control = new Point(control.X, control.Y - 5);
695
                                    break;
696
                                case Key.Right:
697
                                    if (resultAngle == 0) control = new Point(control.X + 5, control.Y);
698
                                    if (resultAngle == 90) control = new Point(control.X, control.Y - 5);
699
                                    if (resultAngle == 180) control = new Point(control.X - 5, control.Y);
700
                                    if (resultAngle == 270) control = new Point(control.X, control.Y + 5);
701
                                    break;
702
                                default:
703
                                    break;
704
                            }
705

    
706

    
707
                            foreach (var item in this.dzMainMenu.SelectLayer.Children)
708
                            {
709
                                if (item.GetType().Name == "AdornerFinal")
710
                                {
711
                                    if ((Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control)
712
                                    {
713
                                        (item as Controls.AdornerFinal).MoveRotate(new System.Windows.Controls.Primitives.DragDeltaEventArgs(control.X * 2, control.Y * 2));
714
                                    }
715
                                    else
716
                                    {
717
                                        (item as Controls.AdornerFinal).MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(control.X, control.Y));
718
                                    }
719

    
720
                                }
721
                            }
722
                        }
723
                    }
724
                    break;
725
                #endregion
726
                case Key.PageUp:
727
                    this.dzMainMenu.pageNavigator.GotoPage(Convert.ToInt32(Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber) - 1);
728
                    break;
729
                case Key.PageDown:
730
                    this.dzMainMenu.pageNavigator.GotoPage(Convert.ToInt32(Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber) + 1);
731
                    break;
732
            }
733
        }
734

    
735
        public void KeyEventUpAction(object sender, KeyEventArgs e)
736
        {
737
            switch (e.Key)
738
            {
739
                //강인구 추가
740
                #region Ctrl
741
                case Key.LeftCtrl:
742
                    {
743
                        if (ViewerDataModel.Instance.IsPressCtrl)
744
                        {
745
                            ViewerDataModel.Instance.IsPressCtrl = false;
746
                        }
747
                    }
748
                    break;
749
                case Key.RightCtrl:
750
                    {
751

    
752
                    }
753
                    break;
754
                #endregion
755

    
756
                #region Shift
757
                case Key.RightShift:
758
                case Key.LeftShift:
759
                    {
760
                        ViewerDataModel.Instance.IsPressShift = false;
761
                    }
762
                    break;
763
                    #endregion
764
            }
765
        }
766
    }
767
}
클립보드 이미지 추가 (최대 크기: 500 MB)