프로젝트

일반

사용자정보

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

markus / KCOM / Events / Event_KeyEvent.cs @ 19bc11bd

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

1 787a4489 KangIngu
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
13
namespace KCOM
14
{
15
    public partial class MainWindow : Window
16
    {
17
        public double CumulativeWheel = 0;
18
19
        public MarkupToPDF.Common.Undo_data UndoData;
20
21
        //강인구 추가
22
        KCOM.Views.MainMenu mainMenu = new Views.MainMenu();
23
        //강인구 추가
24
        MarkupToPDF.Controls.Parsing.LayerControl layer = new MarkupToPDF.Controls.Parsing.LayerControl();
25
        //강인구 추가
26
        MarkupToPDF.Controls.Parsing.LayerControl.MarkupReturn markupReturn = new MarkupToPDF.Controls.Parsing.LayerControl.MarkupReturn();
27
28
        public void KeyEventDownAction(object sender, KeyEventArgs e)
29
        {
30
31
            layer.ProjectNo = App.ViewInfo.ProjectNO;
32
            switch (e.Key)
33
            {
34
                //강인구 추가
35
                #region Ctrl
36
                case Key.LeftCtrl:
37
                    {
38
                        if (!ViewerDataModel.Instance.IsPressCtrl)
39
                        {
40
                            ViewerDataModel.Instance.IsPressCtrl = true;
41
                        }
42
                    }
43
                    break;
44
                case Key.RightCtrl:
45
                    {
46
47
                    }
48
                    break;
49
                #endregion
50
51
                #region Shift
52
                case Key.RightShift:
53
                    {
54
55
                    }
56
                    break;
57
                case Key.LeftShift:
58
                    {
59
                        if (!ViewerDataModel.Instance.IsPressShift)
60
                        {
61
                            ViewerDataModel.Instance.IsPressShift = true;
62
                        }
63
                        //if (dzMain.deepZoomObject._MouseHelper.isMouseOver && !dzMain.DeepLayer.Drawing)
64
                        //{
65
                        //    dzMain.deepZoomObject._MouseHelper.isPressShift = true;
66
                        //    CumulativeWheel += dzMain.deepZoomObject._MouseHelper.wheelDelta;
67
                        //    dzMain.deepZoomObject._MouseHelper.wheelDelta = 0;
68
                        //    System.Diagnostics.Debug.WriteLine(CumulativeWheel);
69
                        //    if (CumulativeWheel == 3 && CumulativeWheel >= 0)
70
                        //    {
71
                        //        this.dzMain.pageNavigator.pagebeforetMove();
72
                        //        CumulativeWheel = 0;
73
                        //    }
74
                        //    else if (CumulativeWheel == -3 && CumulativeWheel <= 0)
75
                        //    {
76
                        //        this.dzMain.pageNavigator.pageNextMove();
77
                        //        CumulativeWheel = 0;
78
                        //    }
79
                        //}
80
81
                    }
82
                    break;
83
                #endregion
84
85
                //강인구 추가
86
                #region 단축키 선택
87
88
                #region 전체 선택(Ctrl + A)
89
                case Key.A:
90
                    {
91 53393bae KangIngu
                        if (ViewerDataModel.Instance.IsPressCtrl && (App.ViewInfo.CreateFinalPDFPermission || App.ViewInfo.NewCommentPermission))
92 787a4489 KangIngu
                        {
93
                            this.dzMainMenu.InkControl_Convert();
94
95
                            if (Common.ViewerDataModel.Instance.MarkupControls_USER.Count > 0)
96
                            {
97
                                //전체 선택 시 선택된 토글 해제
98
                                var TogList = this.dzTopMenu.Parent.ChildrenOfType<RadToggleButton>();
99
                                this.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
100
                                this.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
101
102
                                //컨트롤을 그리는 도중일 경우 컨트롤 삭제
103
                                ViewerDataModel.Instance.MarkupControls_USER.Remove(this.dzMainMenu.currentControl);
104
                                this.dzMainMenu.currentControl = null;
105
106
                                foreach (var tog in TogList)
107
                                {
108
                                    tog.IsChecked = false;
109
                                }
110
                                
111
                                //선택된 어도너가 있을 시 취소하고 전체 선택
112
                                this.dzMainMenu.ReleaseAdorner();
113
114
                                UndoData = new Undo_data()
115
                                {
116
                                    IsUndo = false,
117
                                    Event = Event_Type.Select,
118
                                    EventTime = DateTime.Now,
119
                                    Markup_List = new List<Multi_Undo_data>()
120
                                };
121
122
                                List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>();
123
                                var control = ViewerDataModel.Instance.MarkupControls_USER.Where(data => data.GetType().Name != "").ToList();
124
                                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
125
126
                                foreach (var item in control)
127
                                {
128
                                    adornerSet.Add(item);
129
                                    //multi_Undo_Data.Markup = item;
130
                                    multi_Undo_Data = this.dzMainMenu.Control_Style(item);
131
                                    UndoData.Markup_List.Add(multi_Undo_Data);
132
133
                                    multi_Undo_Data = new Multi_Undo_data();
134
                                    ViewerDataModel.Instance.MarkupControls_USER.Remove(item);
135
                                    
136
                                }
137
138
                                if (adornerSet.Count > 0)
139
                                {
140
                                    Controls.AdornerFinal final = new Controls.AdornerFinal(adornerSet);
141
                                    this.dzMainMenu.SelectLayer.Children.Add(final);
142
                                }
143
144
                                ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
145
                                {
146
                                    ViewerDataModel.Instance.UndoDataList.Remove(i);
147
                                });
148
149
150
                                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
151
                            }
152
                        }
153
                    }
154
                    break;
155
                #endregion
156
157 992a98b4 KangIngu
                
158
159 787a4489 KangIngu
                #region 복사하기(Ctrl + C)
160
                case Key.C:
161
                    {
162
                        if (ViewerDataModel.Instance.IsPressCtrl)
163
                        {
164
                            if (this.dzMainMenu.SelectLayer.Children.Count > 0)
165
                            {
166
                                string MarkupData = "";
167
168
                                foreach (var item in this.dzMainMenu.SelectLayer.Children)
169
                                {
170
                                    if (item.GetType().Name == "AdornerFinal")
171
                                    {
172
                                        foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
173
174
                                        {
175
                                            if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
176
                                            {
177
                                                markupReturn = layer.MarkupToString(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo, App.ViewInfo.UserID);
178
                                                MarkupData += "|OR|" + markupReturn.ConvertData;
179
                                            }
180
                                        }
181
                                        Clipboard.SetText(MarkupData);
182
                                    }
183
                                }
184
                            }
185
                        }
186
                    }
187
                    break;
188
                #endregion
189
190
                #region 잘라내기(Ctrl + X)
191
                case Key.X:
192
                    {
193
                        if (ViewerDataModel.Instance.IsPressCtrl)
194
                        {
195
                            if (this.dzMainMenu.SelectLayer.Children.Count > 0)
196
                            {
197
                                foreach (var item in this.dzMainMenu.SelectLayer.Children)
198
                                {
199
                                    string MarkupData = "";
200
201
                                    if (item.GetType().Name == "AdornerFinal")
202
                                    {
203
                                        foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
204
                                        {
205
                                            if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
206
                                            {
207
                                                markupReturn = layer.MarkupToString(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo, App.ViewInfo.UserID);
208
                                                MarkupData += "|OR|" + markupReturn.ConvertData;
209
                                            }
210
                                        }
211
                                        Clipboard.SetText(MarkupData);
212
                                    }
213
                                }
214
                                this.dzMainMenu.SelectLayer.Children.Clear();
215
                            }
216
                        }
217
                    }
218
                    break;
219
                #endregion
220
221
                #region 붙여넣기(Ctrl + V)
222
                case Key.V:
223
                    {
224 53393bae KangIngu
                        if (ViewerDataModel.Instance.IsPressCtrl && (App.ViewInfo.CreateFinalPDFPermission || App.ViewInfo.NewCommentPermission))
225 787a4489 KangIngu
                        {
226
                            //마크업 붙여넣기
227
                            //if (Clipboard.GetText().Contains("|DZ|"))
228
                            if (Clipboard.GetText().Contains("|OR||DZ|"))
229
                            {
230
                                List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>();
231
232
                                string[] delimiterChars = { "|OR|" };
233
                                string[] data = Clipboard.GetText().Split(delimiterChars, StringSplitOptions.RemoveEmptyEntries);
234
235
                                this.dzMainMenu.ReleaseAdorner();
236
237
                                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
238
239
                                //강인구 Undo/Redo 보류
240
                                UndoData = new Undo_data()
241
                                {
242
                                    IsUndo = false,
243
                                    Event = Event_Type.Create,
244
                                    EventTime = DateTime.Now,
245
                                    Markup_List = new List<Multi_Undo_data>()
246
                                };
247
248
                                ViewerDataModel.Instance.UndoDataList.Where(data1 => data1.IsUndo == true).ToList().ForEach(i =>
249
                                {
250
                                    ViewerDataModel.Instance.UndoDataList.Remove(i);
251
                                });
252
253
                                foreach (string parse in data)
254
                                {
255
                                    if(parse != "")
256
                                    {
257
                                        System.Windows.Controls.Control item = layer.markupParse_Paste(parse, ViewerDataModel.Instance.MarkupControls_USER);
258
                                        (item as MarkupToPDF.Common.CommentUserInfo).CommentID = Events.Save.shortGuid();
259
260
                                        ViewerDataModel.Instance.MarkupControls.Remove(item as MarkupToPDF.Common.CommentUserInfo);
261
                                        ViewerDataModel.Instance.MarkupControls_USER.Remove(item as MarkupToPDF.Common.CommentUserInfo);
262
263
                                        adornerSet.Add(item as MarkupToPDF.Common.CommentUserInfo);
264
265
                                        //Controls.AdornerFinal final = new Controls.AdornerFinal(item as MarkupToPDF.Common.CommentUserInfo);
266
                                        //this.dzMainMenu.SelectLayer.Children.Add(final);
267
268
                                        multi_Undo_Data = dzMainMenu.Control_Style(item as MarkupToPDF.Common.CommentUserInfo);
269
270
                                        UndoData.Markup_List.Add(multi_Undo_Data);
271
                                        ViewerDataModel.Instance.UndoDataList.Add(UndoData);
272
                                    }
273
                                }
274
                                Controls.AdornerFinal final = new Controls.AdornerFinal(adornerSet);
275
276
                                double realPointX = this.dzMainMenu.getCurrentPoint.X - final.BorderSize.X - (final.BorderSize.Width / 2);
277
                                double realPointY = this.dzMainMenu.getCurrentPoint.Y - final.BorderSize.Y - (final.BorderSize.Height / 2);
278
                                final.MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(realPointX, realPointY));
279
280
                                if (final.MemberSet.Where(type => type.Drawingtype == MarkupToPDF.Controls.Common.ControlType.TextControl).FirstOrDefault() != null)
281
                                {
282
                                    final.MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(0.001, 0.001)); //dummy
283
                                }
284
285
                                this.dzMainMenu.SelectLayer.Children.Add(final);
286
287
                                //붙여 넣을때 원본 컨트롤과 겹치지 않도록 설정
288
                                //Canvas.SetLeft(final, 50);
289
                                //Canvas.SetTop(final, 50);
290
                            }
291
                            //외부 이미지 붙여넣기
292
                            else if (Clipboard.GetImage() != null)
293
                            {
294
                                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
295
296
                                //강인구 Undo/Redo 보류
297
                                UndoData = new Undo_data()
298
                                {
299
                                    IsUndo = false,
300
                                    Event = Event_Type.Create,
301
                                    EventTime = DateTime.Now,
302
                                    Markup_List = new List<Multi_Undo_data>()
303
                                };
304
305
306
                                string temppath = System.IO.Path.GetTempPath();
307
                                //string filename = KCOM.Events.Save.shortCommentKey();
308
                                string filename = KCOM.Events.Save.shortFileKey();
309
310
                                System.Drawing.Image clipboardImage = System.Windows.Forms.Clipboard.GetImage();
311
                                clipboardImage.Save(temppath + "\\" + filename);
312
313
                                System.IO.FileInfo fileInfo = new System.IO.FileInfo(temppath + "\\" + filename);
314
                                String strFile = System.IO.Path.GetFileName(fileInfo.FullName);
315
                                long numByte = fileInfo.Length;
316
                                double dLen = Convert.ToDouble(fileInfo.Length / 1000000);
317
                                kr.co.devdoftech.cloud.FileUpload fileUploader = new kr.co.devdoftech.cloud.FileUpload();
318
319
                                if (dLen < 4)
320
                                {
321
                                    System.IO.FileStream fStream = new System.IO.FileStream(fileInfo.FullName,
322
                                    System.IO.FileMode.Open, System.IO.FileAccess.Read);
323
                                    System.IO.BinaryReader br = new System.IO.BinaryReader(fStream);
324
                                    byte[] data = br.ReadBytes((int)numByte);
325
326
                                    filename = fileUploader.Run(App.ViewInfo.ProjectNO, this.dzMainMenu._DocItem.DOCUMENT_NO, App.ViewInfo.UserID, strFile + ".png", data);
327
                                    br.Close();
328
                                    fStream.Close();
329
                                    fStream.Dispose();
330
                                }
331
                                else
332
                                {
333
                                    dzMainMenu.DialogMessage_Alert("Available Memory less than 4 mega byte", "Alert");
334
                                    return;
335
                                }
336
337
                                fileInfo.Delete();
338
339
                                //System.Drawing.Image clipboardImage = System.Windows.Forms.Clipboard.GetImage();
340
                                System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(clipboardImage);
341
                                IntPtr hBitmap = bmp.GetHbitmap();
342
                                System.Windows.Media.ImageSource WpfBitmap = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(hBitmap, IntPtr.Zero, Int32Rect.Empty, System.Windows.Media.Imaging.BitmapSizeOptions.FromEmptyOptions());
343
                                Image img = new Image();
344
                                img.Source = new System.Windows.Media.Imaging.BitmapImage(new Uri(filename));
345
346
                                
347
348
349
350
                                var currentControl = new MarkupToPDF.Controls.Etc.ImgControl
351
                                {
352
                                    PointSet = new List<Point>(),
353
                                    FilePath = img.Source.ToString(),
354
                                    ImageData = img.Source,
355
                                    StartPoint = new Point(100, 100),
356
                                    EndPoint = new Point(200, 200),
357
                                    TopRightPoint = new Point(100, 200),
358
                                    LeftBottomPoint = new Point(200, 100)
359
                                };
360
361
                                currentControl.TopRightPoint = new Point(currentControl.StartPoint.X + clipboardImage.Width, currentControl.StartPoint.Y);
362
                                currentControl.LeftBottomPoint = new Point(currentControl.StartPoint.X, currentControl.StartPoint.Y + clipboardImage.Height);
363
                                currentControl.EndPoint = new Point(currentControl.StartPoint.X + clipboardImage.Width, currentControl.StartPoint.Y + clipboardImage.Height);
364
365
                                currentControl.PointSet = new List<Point>
366
                                        {
367
                                            currentControl.StartPoint,
368
                                            currentControl.LeftBottomPoint,
369
                                            currentControl.EndPoint,
370
                                            currentControl.TopRightPoint,
371
                                        };
372
373
                                multi_Undo_Data = dzMainMenu.Control_Style(currentControl as MarkupToPDF.Common.CommentUserInfo);
374
                                UndoData.Markup_List.Add(multi_Undo_Data);
375
                                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
376
377
                                ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl as MarkupToPDF.Common.CommentUserInfo);
378
                                currentControl.CommentID = Events.Save.shortGuid();
379
380
                                currentControl.ApplyTemplate();
381
                                currentControl.SetImage();
382
383
                                ViewerDataModel.Instance.MarkupControls_USER.Remove(currentControl as MarkupToPDF.Common.CommentUserInfo);
384
                                Controls.AdornerFinal final = new Controls.AdornerFinal(currentControl as MarkupToPDF.Common.CommentUserInfo);
385
                                this.dzMainMenu.SelectLayer.Children.Add(final);
386
387
                                double realPointX = this.dzMainMenu.getCurrentPoint.X - final.BorderSize.X - (final.BorderSize.Width / 2);
388
                                double realPointY = this.dzMainMenu.getCurrentPoint.Y - final.BorderSize.Y - (final.BorderSize.Height / 2);
389
                                final.MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(realPointX, realPointY));
390
391
392
                                #region 주석
393
394
                                //주석
395
                                //ViewerDataModel.Instance.MarkupControls_USER.Remove(currentControl as MarkupToPDF.Common.CommentUserInfo);
396
                                //Controls.AdornerFinal final = new Controls.AdornerFinal(currentControl as MarkupToPDF.Common.CommentUserInfo);
397
                                //this.dzMainMenu.SelectLayer.Children.Add(final);
398
399
                                //string MarkupData = "";
400
401
                                //if (!ViewerDataModel.Instance.MarkupControls.Contains(currentControl))
402
                                //{
403
                                //    markupReturn = layer.MarkupToString(currentControl, App.ViewInfo.UserID);
404
                                //    MarkupData += "|OR|" + markupReturn.ConvertData;
405
                                //}
406
                                //Clipboard.SetText(MarkupData);
407
                                //this.dzMainMenu.SelectLayer.Children.Clear();
408
409
                                //List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>();
410
411
                                //string[] delimiterChars = { "|OR|" };
412
                                //string[] data1 = Clipboard.GetText().Split(delimiterChars, StringSplitOptions.RemoveEmptyEntries);
413
414
                                //this.dzMainMenu.ReleaseAdorner();
415
416
                                //foreach (string parse in data1)
417
                                //{
418
                                //    if (parse != "")
419
                                //    {
420
                                //        System.Windows.Controls.Control item = layer.markupParse_Paste(parse, ViewerDataModel.Instance.MarkupControls_USER);
421
                                //        (item as MarkupToPDF.Common.CommentUserInfo).CommentID = Events.Save.shortGuid();
422
423
                                //        ViewerDataModel.Instance.MarkupControls.Remove(item as MarkupToPDF.Common.CommentUserInfo);
424
                                //        ViewerDataModel.Instance.MarkupControls_USER.Remove(item as MarkupToPDF.Common.CommentUserInfo);
425
426
                                //        adornerSet.Add(item as MarkupToPDF.Common.CommentUserInfo);
427
428
                                //        //Controls.AdornerFinal final = new Controls.AdornerFinal(item as MarkupToPDF.Common.CommentUserInfo);
429
                                //        //this.dzMainMenu.SelectLayer.Children.Add(final);
430
                                //    }
431
                                //}
432
                                //Controls.AdornerFinal final = new Controls.AdornerFinal(adornerSet);
433
434
                                //double realPointX = this.dzMainMenu.getCurrentPoint.X - final.BorderSize.X - (final.BorderSize.Width / 2);
435
                                //double realPointY = this.dzMainMenu.getCurrentPoint.Y - final.BorderSize.Y - (final.BorderSize.Height / 2);
436
                                //final.MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(realPointX, realPointY));
437
438
                                //if (final.MemberSet.Where(type => type.Drawingtype == MarkupToPDF.Controls.Common.ControlType.TextControl).FirstOrDefault() != null)
439
                                //{
440
                                //    final.MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(0.001, 0.001)); //dummy
441
                                //}
442
443
                                //this.dzMainMenu.SelectLayer.Children.Add(final); 
444
                                #endregion
445
446
447
                            }
448
                        }
449
                    }
450
                    break;
451
                #endregion
452
453
                #region 저장하기(Ctrl + S)
454
                case Key.S:
455
                    {
456 53393bae KangIngu
                        if (ViewerDataModel.Instance.IsPressCtrl  && (App.ViewInfo.CreateFinalPDFPermission || App.ViewInfo.NewCommentPermission))
457 787a4489 KangIngu
                        {
458
                            //컨트롤을 그리는 도중일 경우 컨트롤 삭제
459
                            ViewerDataModel.Instance.MarkupControls_USER.Remove(this.dzMainMenu.currentControl);
460
                            this.dzMainMenu.currentControl = null;
461
462 316d0f5c KangIngu
                            //this.dzTopMenu.SaveEvent(null, null);
463
464
                            this.dzTopMenu.SaveEvent(new object(), null);
465 787a4489 KangIngu
                        }
466
                    }
467
                    break;
468
                #endregion
469
470
                #region 프린트하기(Ctrl + P)
471
                case Key.P:
472
                    {
473
                        if (ViewerDataModel.Instance.IsPressCtrl)
474
                        {
475
                            this.dzTopMenu.Print_Start("Print");
476
                        }
477
                    }
478
                    break;
479
                #endregion
480
481
                #region Undo(Ctrl + Z)
482
                case Key.Z:
483
                    {
484
                        if (ViewerDataModel.Instance.IsPressCtrl)
485
                        {
486
                            this.dzMainMenu.Undo();
487
                        }
488
                    }
489
                    break;
490
                #endregion
491
492
                #region Redo(Ctrl + Y)
493
                case Key.Y:
494
                    {
495
                        if (ViewerDataModel.Instance.IsPressCtrl)
496
                        {
497
                            this.dzMainMenu.Redo();
498
                        }
499
                    }
500
                    break;
501
                #endregion
502
503
                #region 삭제하기(Delete)
504
                case Key.Delete:
505
                    {
506
                        if (this.dzMainMenu.SelectLayer.Children.Count > 0)
507
                        {
508
                            Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
509
510
                            UndoData = new Undo_data()
511
                            {
512
                                IsUndo = false,
513
                                Event = Event_Type.Delete,
514
                                EventTime = DateTime.Now,
515
                                Markup_List = new List<Multi_Undo_data>()
516
                            };
517
518
                            foreach (var item in this.dzMainMenu.SelectLayer.Children)
519
                            {
520
                                if (item.GetType().Name == "AdornerFinal")
521
                                {
522
                                    //List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>();
523
524
                                    (item as Controls.AdornerFinal).unRegister();
525
526
                                    foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
527
                                    {
528
                                        //if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
529
                                        if (!ViewerDataModel.Instance.MarkupControls_USER.Contains(InnerItem.DrawingData))
530
                                        {
531
                                            //this.dzMainMenu.ReleaseAdorner();
532
533
                                            multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
534
                                            UndoData.Markup_List.Add(multi_Undo_Data);
535
                                            multi_Undo_Data = new Multi_Undo_data();
536
537
                                            ViewerDataModel.Instance.MarkupControls.Remove(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo);
538
539
                                            var Item_ = ViewerDataModel.Instance.MarkupList_USER.Where(d => d.ID == (InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo).CommentID).FirstOrDefault();
540
                                            //var Item_ = ViewerDataModel.Instance.MarkupList_USER.Where(d => d.MarkupInfoID == (InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo).MarkupInfoID).FirstOrDefault();
541
542
                                            ViewerDataModel.Instance.MarkupList_USER.Remove(Item_);
543
544
                                            //adornerSet.Add((InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo));
545
                                        }
546
                                    }
547
                                }
548
549
                                ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
550
                                {
551
                                    ViewerDataModel.Instance.UndoDataList.Remove(i);
552
                                });
553
                                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
554
                            }
555
                        }
556
557
                        this.dzMainMenu.SelectLayer.Children.Clear();
558
                    }
559
                    break;
560
                #endregion
561
562
                #region 선택된 컨트롤 모두 해제 하기(ESC)
563
                case Key.Escape:
564
                    {
565
                        //캡쳐모드 일 경우 초기화
566
                        if(this.dzMainMenu.mouseHandlingMode == IKCOM.MouseHandlingMode.Capture)
567
                        {
568
                            //dzMainMenu.PN_Navi.IsEnabled = true;
569
                            this.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
570
                            ViewerDataModel.Instance.Capture_Opacity = 0;
571
                        }
572
573
                        if(Common.ViewerDataModel.Instance.SelectedControl == "Batch")
574
                        {
575
                            this.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
576
                            this.dzMainMenu.txtBatch.Visibility = Visibility.Collapsed;
577
                            this.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
578
                            var TogList = this.dzTopMenu.Parent.ChildrenOfType<RadToggleButton>();
579
                            foreach (var tog in TogList)
580
                            {
581
                                tog.IsChecked = false;
582
                            }
583
                        }
584
585
                        this.dzMainMenu.ReleaseAdorner();
586
587
                        //코멘트 그리는 도중일 경우 코멘트 삭제 및 초기화
588 49b217ad humkyung
                        if (this.dzMainMenu.currentControl != null)
589
                        {
590
                            ViewerDataModel.Instance.MarkupControls_USER.Remove(this.dzMainMenu.currentControl);
591
                            this.dzMainMenu.currentControl = null;
592
                        }
593 787a4489 KangIngu
594 2eac4f76 KangIngu
                        //모든 컨트롤 초기화 하고 Selection모드로 변경
595
                        dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Selecting;
596
                        dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
597
598
                        var toggleList = this.ChildrenOfType<RadToggleButton>();
599
                        var toggleList2 = this.ChildrenOfType<RadRibbonToggleButton>();
600
601 17a22987 KangIngu
                        foreach (var item in toggleList)
602
                        {
603
                            if (item.Name == "btnSelection")
604 2eac4f76 KangIngu
                            {
605
                                item.IsChecked = true;
606
                            }
607 17a22987 KangIngu
                            else
608 2eac4f76 KangIngu
                            {
609
                                item.IsChecked = false;
610
                            }
611 17a22987 KangIngu
                        }
612 9f473fb7 KangIngu
                        dzMainMenu.isLeftMouseButtonDownOnWindow = false;
613 17a22987 KangIngu
                        //foreach (var item in toggleList2)
614
                        //{
615
                        //    item.IsChecked = false;
616
                        //}
617 787a4489 KangIngu
                    }
618
                    break;
619 992a98b4 KangIngu
                #endregion
620
621
                #region FIND(Ctrl + F)
622
                case Key.F:
623
                    {
624 469b2bbf KangIngu
                        if (ViewerDataModel.Instance.IsPressCtrl)
625 992a98b4 KangIngu
                        {
626 469b2bbf KangIngu
                            if (!this.dzMainMenu.searchPane.IsPinned)
627 992a98b4 KangIngu
                            {
628 469b2bbf KangIngu
                                this.dzMainMenu.searchPane.IsPinned = true;
629
                                if (ViewerDataModel.Instance.searchPDF != null)
630
                                {
631
                                    this.dzMainMenu.searchPanel_Instance.tbSearch.Focus();
632
                                }
633
                                else
634
                                {
635
                                    this.dzMainMenu.searchPanel_Instance.btnSearch.Focus();
636
                                }
637 992a98b4 KangIngu
                            }
638
                            else
639
                            {
640 469b2bbf KangIngu
                                this.dzMainMenu.searchPane.IsPinned = false;
641
                                this.dzMainMenu.searchPane.IsActive = false;
642
                                //this.dzMainMenu.searchPane.IsHidden = true;
643 992a98b4 KangIngu
                            }
644
                        }
645
                    }
646
                    break;
647
                #endregion
648 787a4489 KangIngu
649
                #endregion
650
651
                //강인구 추가
652
                #region Control Move
653
                case Key.Right:
654
                case Key.Left:
655 a0bab669 KangIngu
                case Key.Up:
656
                case Key.Down:
657 787a4489 KangIngu
                    {
658 a0bab669 KangIngu
                        if (this.dzMainMenu.SelectLayer.Children.Count > 0)
659
                        {
660
                            Point control = new Point(0, 0);
661
                            double resultAngle = this.dzMainMenu.rotate.Angle;
662
663
                            switch (e.Key)
664
                            {
665
                                case Key.Down:
666
                                    if (resultAngle == 0) control = new Point(control.X, control.Y + 5);
667
                                    if (resultAngle == 90) control = new Point(control.X + 5, control.Y);
668
                                    if (resultAngle == 180) control = new Point(control.X, control.Y - 5);
669
                                    if (resultAngle == 270) control = new Point(control.X - 5, control.Y);
670
                                    break;
671
                                case Key.Up:
672
                                    if (resultAngle == 0) control = new Point(control.X, control.Y - 5);
673
                                    if (resultAngle == 90) control = new Point(control.X - 5, control.Y);
674
                                    if (resultAngle == 180) control = new Point(control.X, control.Y + 5);
675
                                    if (resultAngle == 270) control = new Point(control.X + 5, control.Y);
676
                                    break;
677
                                case Key.Left:
678
                                    if (resultAngle == 0) control = new Point(control.X - 5, control.Y);
679
                                    if (resultAngle == 90) control = new Point(control.X, control.Y + 5);
680
                                    if (resultAngle == 180) control = new Point(control.X + 5, control.Y);
681
                                    if (resultAngle == 270) control = new Point(control.X, control.Y - 5);
682
                                    break;
683
                                case Key.Right:
684
                                    if (resultAngle == 0) control = new Point(control.X + 5, control.Y);
685
                                    if (resultAngle == 90) control = new Point(control.X, control.Y - 5);
686
                                    if (resultAngle == 180) control = new Point(control.X - 5, control.Y);
687
                                    if (resultAngle == 270) control = new Point(control.X, control.Y + 5);
688
                                    break;
689
                                default:
690
                                    break;
691
                            }
692
693
694
                            foreach (var item in this.dzMainMenu.SelectLayer.Children)
695
                            {
696
                                if (item.GetType().Name == "AdornerFinal")
697
                                {
698
                                    if ((Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control)
699
                                    {
700
                                        (item as Controls.AdornerFinal).MoveRotate(new System.Windows.Controls.Primitives.DragDeltaEventArgs(control.X * 2, control.Y * 2));
701
                                    }
702
                                    else
703
                                    {
704
                                        (item as Controls.AdornerFinal).MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(control.X, control.Y));
705
                                    }
706 787a4489 KangIngu
707 a0bab669 KangIngu
                                }
708
                            }
709
                        }
710 787a4489 KangIngu
                    }
711
                    break;
712
                    #endregion
713
            }
714
        }
715
716
        public void KeyEventUpAction(object sender, KeyEventArgs e)
717
        {
718
            switch (e.Key)
719
            {
720
                //강인구 추가
721
                #region Ctrl
722
                case Key.LeftCtrl:
723
                    {
724
                        if (ViewerDataModel.Instance.IsPressCtrl)
725
                        {
726
                            ViewerDataModel.Instance.IsPressCtrl = false;
727
                        }
728
                    }
729
                    break;
730
                case Key.RightCtrl:
731
                    {
732
733
                    }
734
                    break;
735
                #endregion
736
737
                #region Shift
738
                case Key.RightShift:
739
                case Key.LeftShift:
740
                    {
741
                        ViewerDataModel.Instance.IsPressShift = false;
742
                    }
743
                    break;
744
                    #endregion
745
            }
746
        }
747
    }
748
}
클립보드 이미지 추가 (최대 크기: 500 MB)