프로젝트

일반

사용자정보

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

markus / KCOM / Events / Event_KeyEvent.cs @ 038c77fd

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

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

    
18
namespace KCOM
19
{
20
    public partial class MainWindow : Window
21
    {
22
        public double CumulativeWheel = 0;
23

    
24
        public MarkupToPDF.Common.Undo_data UndoData;
25

    
26
        //20181108
27
        //강인구 추가
28
        //KCOM.Views.MainMenu mainMenu = new Views.MainMenu();
29

    
30
        MarkupToPDF.Controls.Parsing.MarkupParser.MarkupReturn markupReturn = new MarkupToPDF.Controls.Parsing.MarkupParser.MarkupReturn();
31
                
32

    
33
        public void KeyEventDownAction(object sender, KeyEventArgs e)
34
        {
35
            switch (e.Key)
36
            {
37
                //강인구 추가
38
                #region Ctrl
39
                case Key.LeftCtrl:
40
                    {
41
                        if (!ViewerDataModel.Instance.IsPressCtrl)
42
                        {
43
                            ViewerDataModel.Instance.IsPressCtrl = true;
44
                        }
45
                    }
46
                    break;
47
                case Key.RightCtrl:
48
                    {
49

    
50
                    }
51
                    break;
52
                #endregion
53

    
54
                #region Shift
55
                case Key.RightShift:
56
                    {
57

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

    
84
                    }
85
                    break;
86
                #endregion
87

    
88
                //강인구 추가
89
                #region 단축키 선택
90

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

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

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

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

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

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

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

    
136
                                    multi_Undo_Data = new Multi_Undo_data();
137
                                    ViewerDataModel.Instance.MarkupControls_USER.Remove(item);
138
                                    
139
                                }
140

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

    
147
                                ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
148
                                {
149
                                    ViewerDataModel.Instance.UndoDataList.Remove(i);
150
                                });
151

    
152

    
153
                                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
154
                            }
155
                        }
156
                    }
157
                    break;
158
                #endregion
159

    
160
                
161

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

    
171
                                foreach (var item in this.dzMainMenu.SelectLayer.Children)
172
                                {
173
                                    string id = "";
174
                                    if (item.GetType().Name == "AdornerFinal")
175
                                    {
176
                                        foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
177
                                        {        
178
                                            if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
179
                                            {
180
                                                markupReturn = MarkupParser.MarkupToString(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo, App.ViewInfo.UserID);
181

    
182
                                                var Item_ = ViewerDataModel.Instance.MarkupList_USER.Where(d => d.ID == (InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo).CommentID).FirstOrDefault();
183
                                                
184
                                                if (Item_ != null)
185
                                                {
186
                                                     id = "|SymbolID|" + ViewerDataModel.Instance.MarkupList_USER.Where
187
                                                         (d => d.ID == (InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo).CommentID).FirstOrDefault().Symbol_ID;
188
                                                }
189
                                                else
190
                                                {
191
                                                    if (InnerItem.Symbol_ID != null)
192
                                                    {
193
                                                        id = "|SymbolID|" + InnerItem.Symbol_ID;
194
                                                        
195
                                                    }
196
                                                    else
197
                                                    {
198
                                                        id = "";
199
                                                    }                                                   
200
                                                }
201
                                                MarkupData += "|OR|" + markupReturn.ConvertData + id;
202
                                            }
203
                                        }
204
                                        Clipboard.SetText(MarkupData);
205
                                    }
206
                                }
207
                            }
208
                        }
209
                    }
210
                    break;
211
                #endregion
212

    
213
                #region 잘라내기(Ctrl + X)
214
                case Key.X:
215
                    {
216
                        if (ViewerDataModel.Instance.IsPressCtrl)
217
                        {
218
                            if (this.dzMainMenu.SelectLayer.Children.Count > 0)
219
                            {
220
                                foreach (var item in this.dzMainMenu.SelectLayer.Children)
221
                                {
222
                                    string MarkupData = "";
223

    
224
                                    if (item.GetType().Name == "AdornerFinal")
225
                                    {
226
                                        foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
227
                                        {
228
                                            if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
229
                                            {
230
                                                markupReturn = MarkupParser.MarkupToString(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo, App.ViewInfo.UserID);
231
                                                MarkupData += "|OR|" + markupReturn.ConvertData;                                                
232
                                            }
233
                                        }
234
                                        Clipboard.SetText(MarkupData);
235
                                    }
236
                                }
237
                                this.dzMainMenu.SelectLayer.Children.Clear();
238
                            }
239
                        }
240
                        
241
                    }
242
                    break;
243
                #endregion
244

    
245
                #region 붙여넣기(Ctrl + V)
246
                case Key.V:
247
                    {
248
                        if (ViewerDataModel.Instance.IsPressCtrl && (App.ViewInfo.CreateFinalPDFPermission || App.ViewInfo.NewCommentPermission))
249
                        {
250
                            //마크업 붙여넣기
251
                            //if (Clipboard.GetText().Contains("|DZ|"))
252
                            if (Clipboard.GetText().Contains("|OR||DZ|"))
253
                            {
254
                                List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>();
255

    
256
                                string[] delimiterChars = { "|OR|" };
257
                                string[] delimiterChars2 = { "|OR|", "|SymbolID|" };
258
                                string[] data = Clipboard.GetText().Split(delimiterChars, StringSplitOptions.RemoveEmptyEntries);
259

    
260
                                this.dzMainMenu.ReleaseAdorner();
261

    
262
                                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
263

    
264
                                //강인구 Undo/Redo 보류
265
                                UndoData = new Undo_data()
266
                                {
267
                                    IsUndo = false,
268
                                    Event = Event_Type.Create,
269
                                    EventTime = DateTime.Now,
270
                                    Markup_List = new List<Multi_Undo_data>()
271
                                };
272

    
273
                                ViewerDataModel.Instance.UndoDataList.Where(data1 => data1.IsUndo == true).ToList().ForEach(i =>
274
                                {
275
                                    ViewerDataModel.Instance.UndoDataList.Remove(i);
276
                                });
277
                                
278
                                foreach (string parse in data)
279
                                {                                    
280
                                    if(parse != "")
281
                                    {
282
                                        string[] data2 = new string[2];
283
                                        data2 = parse.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries);
284

    
285
                                        System.Windows.Controls.Control item =  MarkupParser.ParseEx(App.ViewInfo.ProjectNO, data2[0], ViewerDataModel.Instance.MarkupControls_USER, string.Empty, string.Empty);
286
                                        (item as MarkupToPDF.Common.CommentUserInfo).CommentID = Events.Save.shortGuid();
287
                                        if(data2.Length >= 2)
288
                                        {
289
                                            (item as MarkupToPDF.Common.CommentUserInfo).SymbolID = data2[1];
290
                                        }                                        
291
                                        ViewerDataModel.Instance.MarkupControls.Remove(item as MarkupToPDF.Common.CommentUserInfo);
292
                                        ViewerDataModel.Instance.MarkupControls_USER.Remove(item as MarkupToPDF.Common.CommentUserInfo);
293

    
294
                                        adornerSet.Add(item as MarkupToPDF.Common.CommentUserInfo);
295

    
296
                                        //Controls.AdornerFinal final = new Controls.AdornerFinal(item as MarkupToPDF.Common.CommentUserInfo);
297
                                        //this.dzMainMenu.SelectLayer.Children.Add(final);
298

    
299
                                        multi_Undo_Data = dzMainMenu.Control_Style(item as MarkupToPDF.Common.CommentUserInfo);
300

    
301
                                        UndoData.Markup_List.Add(multi_Undo_Data);
302
                                        ViewerDataModel.Instance.UndoDataList.Add(UndoData);                                                                               
303
                                    }
304
                                }
305
                                Controls.AdornerFinal final = new Controls.AdornerFinal(adornerSet);
306

    
307
                                double realPointX = this.dzMainMenu.getCurrentPoint.X - final.BorderSize.X - (final.BorderSize.Width / 2);
308
                                double realPointY = this.dzMainMenu.getCurrentPoint.Y - final.BorderSize.Y - (final.BorderSize.Height / 2);
309
                                final.MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(realPointX, realPointY));
310

    
311
                                if (final.MemberSet.Where(type => type.Drawingtype == MarkupToPDF.Controls.Common.ControlType.TextControl).FirstOrDefault() != null)
312
                                {
313
                                    final.MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(0.001, 0.001)); //dummy
314
                                }
315

    
316
                                this.dzMainMenu.SelectLayer.Children.Add(final);
317

    
318
                                //붙여 넣을때 원본 컨트롤과 겹치지 않도록 설정
319
                                //Canvas.SetLeft(final, 50);
320
                                //Canvas.SetTop(final, 50);
321

    
322
                            }
323
                            //외부 이미지 붙여넣기
324
                            else if (Clipboard.GetImage() != null)
325
                            {
326
                                try
327
                                {
328
                                    Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
329

    
330
                                    //강인구 Undo/Redo 보류
331
                                    UndoData = new Undo_data()
332
                                    {
333
                                        IsUndo = false,
334
                                        Event = Event_Type.Create,
335
                                        EventTime = DateTime.Now,
336
                                        Markup_List = new List<Multi_Undo_data>()
337
                                    };
338

    
339
                                    string temppath = System.IO.Path.GetTempPath();
340
                                    //string filename = KCOM.Events.Save.shortCommentKey();
341
                                    string filename = KCOM.Events.Save.shortFileKey();
342

    
343
                                    System.Drawing.Image clipboardImage = System.Windows.Forms.Clipboard.GetImage();
344
                                    clipboardImage.Save(temppath + "\\" + filename);
345

    
346
                                    System.IO.FileInfo fileInfo = new System.IO.FileInfo(temppath + "\\" + filename);
347
                                    String strFile = System.IO.Path.GetFileName(fileInfo.FullName);
348
                                    long numByte = fileInfo.Length;
349
                                    double dLen = Convert.ToDouble(fileInfo.Length / 1000000);
350
                                    kr.co.devdoftech.cloud.FileUpload fileUploader = new kr.co.devdoftech.cloud.FileUpload();
351

    
352
                                    if (dLen < 4)
353
                                    {
354
                                        System.IO.FileStream fStream = new System.IO.FileStream(fileInfo.FullName,
355
                                        System.IO.FileMode.Open, System.IO.FileAccess.Read);
356
                                        System.IO.BinaryReader br = new System.IO.BinaryReader(fStream);
357
                                        byte[] data = br.ReadBytes((int)numByte);
358

    
359
                                        filename = fileUploader.Run(App.ViewInfo.ProjectNO, this.dzMainMenu._DocItem.DOCUMENT_NO, App.ViewInfo.UserID, strFile + ".png", data);
360

    
361
                                        Check_Uri.UriCheck(filename);
362

    
363
                                        br.Close();
364
                                        fStream.Close();
365
                                        fStream.Dispose();
366
                                    }
367
                                    else
368
                                    {
369
                                        dzMainMenu.DialogMessage_Alert("Available Memory less than 4 mega byte", "Alert");
370
                                        return;
371
                                    }
372

    
373
                                    fileInfo.Delete();
374

    
375
                                    //System.Drawing.Image clipboardImage = System.Windows.Forms.Clipboard.GetImage();
376
                                    System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(clipboardImage);
377
                                    IntPtr hBitmap = bmp.GetHbitmap();
378
                                    System.Windows.Media.ImageSource WpfBitmap = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(hBitmap, IntPtr.Zero, Int32Rect.Empty, System.Windows.Media.Imaging.BitmapSizeOptions.FromEmptyOptions());
379
                                    Image img = new Image();
380
                                    //img.Source = new System.Windows.Media.Imaging.BitmapImage(new Uri(filename));                            
381
                                    if (filename.Contains(".svg"))
382
                                    {
383
                                        byte[] imageData = null;
384
                                        DrawingImage image = null;
385
                                        using (System.Net.WebClient web = new System.Net.WebClient())
386
                                        {
387
                                            imageData = web.DownloadData(new Uri(filename));
388
                                            System.IO.Stream stream = new System.IO.MemoryStream(imageData);
389
                                            image = SvgReader.Load(stream);
390
                                        }
391
                                        img.Source = image;
392
                                    }
393
                                    else
394
                                    {
395
                                        img.Source = new BitmapImage(new Uri(filename));
396
                                    }
397
                                    var currentControl = new MarkupToPDF.Controls.Etc.ImgControl
398
                                    {
399
                                        PointSet = new List<Point>(),
400
                                        //FilePath = img.Source.ToString(),
401
                                        FilePath = filename,
402
                                        ImageData = img.Source,
403
                                        StartPoint = new Point(100, 100),
404
                                        EndPoint = new Point(200, 200),
405
                                        TopRightPoint = new Point(100, 200),
406
                                        LeftBottomPoint = new Point(200, 100)
407
                                    };
408

    
409
                                    currentControl.TopRightPoint = new Point(currentControl.StartPoint.X + clipboardImage.Width, currentControl.StartPoint.Y);
410
                                    currentControl.LeftBottomPoint = new Point(currentControl.StartPoint.X, currentControl.StartPoint.Y + clipboardImage.Height);
411
                                    currentControl.EndPoint = new Point(currentControl.StartPoint.X + clipboardImage.Width, currentControl.StartPoint.Y + clipboardImage.Height);
412

    
413
                                    currentControl.PointSet = new List<Point>
414
                                        {
415
                                            currentControl.StartPoint,
416
                                            currentControl.LeftBottomPoint,
417
                                            currentControl.EndPoint,
418
                                            currentControl.TopRightPoint,
419
                                        };
420

    
421
                                    multi_Undo_Data = dzMainMenu.Control_Style(currentControl as MarkupToPDF.Common.CommentUserInfo);
422
                                    UndoData.Markup_List.Add(multi_Undo_Data);
423
                                    ViewerDataModel.Instance.UndoDataList.Add(UndoData);
424

    
425
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl as MarkupToPDF.Common.CommentUserInfo);
426
                                    currentControl.CommentID = Events.Save.shortGuid();
427

    
428
                                    currentControl.ApplyTemplate();
429
                                    currentControl.SetImage();
430

    
431
                                    ViewerDataModel.Instance.MarkupControls_USER.Remove(currentControl as MarkupToPDF.Common.CommentUserInfo);
432
                                    Controls.AdornerFinal final = new Controls.AdornerFinal(currentControl as MarkupToPDF.Common.CommentUserInfo);
433
                                    this.dzMainMenu.SelectLayer.Children.Add(final);
434

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

    
439
                                    #region 주석
440

    
441
                                    //주석
442
                                    //ViewerDataModel.Instance.MarkupControls_USER.Remove(currentControl as MarkupToPDF.Common.CommentUserInfo);
443
                                    //Controls.AdornerFinal final = new Controls.AdornerFinal(currentControl as MarkupToPDF.Common.CommentUserInfo);
444
                                    //this.dzMainMenu.SelectLayer.Children.Add(final);
445

    
446
                                    //string MarkupData = "";
447

    
448
                                    //if (!ViewerDataModel.Instance.MarkupControls.Contains(currentControl))
449
                                    //{
450
                                    //    markupReturn = layer.MarkupToString(currentControl, App.ViewInfo.UserID);
451
                                    //    MarkupData += "|OR|" + markupReturn.ConvertData;
452
                                    //}
453
                                    //Clipboard.SetText(MarkupData);
454
                                    //this.dzMainMenu.SelectLayer.Children.Clear();
455

    
456
                                    //List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>();
457

    
458
                                    //string[] delimiterChars = { "|OR|" };
459
                                    //string[] data1 = Clipboard.GetText().Split(delimiterChars, StringSplitOptions.RemoveEmptyEntries);
460

    
461
                                    //this.dzMainMenu.ReleaseAdorner();
462

    
463
                                    //foreach (string parse in data1)
464
                                    //{
465
                                    //    if (parse != "")
466
                                    //    {
467
                                    //        System.Windows.Controls.Control item = layer.markupParse_Paste(parse, ViewerDataModel.Instance.MarkupControls_USER);
468
                                    //        (item as MarkupToPDF.Common.CommentUserInfo).CommentID = Events.Save.shortGuid();
469

    
470
                                    //        ViewerDataModel.Instance.MarkupControls.Remove(item as MarkupToPDF.Common.CommentUserInfo);
471
                                    //        ViewerDataModel.Instance.MarkupControls_USER.Remove(item as MarkupToPDF.Common.CommentUserInfo);
472

    
473
                                    //        adornerSet.Add(item as MarkupToPDF.Common.CommentUserInfo);
474

    
475
                                    //        //Controls.AdornerFinal final = new Controls.AdornerFinal(item as MarkupToPDF.Common.CommentUserInfo);
476
                                    //        //this.dzMainMenu.SelectLayer.Children.Add(final);
477
                                    //    }
478
                                    //}
479
                                    //Controls.AdornerFinal final = new Controls.AdornerFinal(adornerSet);
480

    
481
                                    //double realPointX = this.dzMainMenu.getCurrentPoint.X - final.BorderSize.X - (final.BorderSize.Width / 2);
482
                                    //double realPointY = this.dzMainMenu.getCurrentPoint.Y - final.BorderSize.Y - (final.BorderSize.Height / 2);
483
                                    //final.MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(realPointX, realPointY));
484

    
485
                                    //if (final.MemberSet.Where(type => type.Drawingtype == MarkupToPDF.Controls.Common.ControlType.TextControl).FirstOrDefault() != null)
486
                                    //{
487
                                    //    final.MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(0.001, 0.001)); //dummy
488
                                    //}
489

    
490
                                    //this.dzMainMenu.SelectLayer.Children.Add(final); 
491
                                    #endregion
492

    
493
                                }
494
                                catch(Exception ex)
495
                                {
496
                                    Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.DialogMessage_Alert("" + ex, "Alert");
497
                                }
498
                            }
499
                        }                        
500
                    }
501
                    break;
502
                #endregion
503

    
504
                #region 저장하기(Ctrl + S)
505
                case Key.S:
506
                    {
507
                        if (ViewerDataModel.Instance.IsPressCtrl  && (App.ViewInfo.CreateFinalPDFPermission || App.ViewInfo.NewCommentPermission))
508
                        {
509
                            //컨트롤을 그리는 도중일 경우 컨트롤 삭제
510
                            ViewerDataModel.Instance.MarkupControls_USER.Remove(this.dzMainMenu.currentControl);
511
                            this.dzMainMenu.currentControl = null;
512

    
513
                            //this.dzTopMenu.SaveEvent(null, null);
514
                            if (App.ViewInfo.CreateFinalPDFPermission || App.ViewInfo.NewCommentPermission)
515
                            {
516
                                this.dzTopMenu.SaveEvent(new object(), null);
517
                            }
518

    
519
                            //저장완료후 임시파일 삭제
520
                            TempFile.Remove();
521
                        }                       
522
                    }
523
                    break;
524
                #endregion
525

    
526
                #region 프린트하기(Ctrl + P)
527
                case Key.P:
528
                    {
529
                        if (ViewerDataModel.Instance.IsPressCtrl)
530
                        {
531
                            this.dzTopMenu.Print_Start("Print");
532
                        }
533
                    }
534
                    break;
535
                #endregion
536

    
537
                #region Undo(Ctrl + Z)
538
                case Key.Z:
539
                    {
540
                        if (ViewerDataModel.Instance.IsPressCtrl)
541
                        {
542
                            this.dzMainMenu.Undo();
543
                        }                        
544
                    }
545
                    break;
546
                #endregion
547

    
548
                #region Redo(Ctrl + Y)
549
                case Key.Y:
550
                    {
551
                        if (ViewerDataModel.Instance.IsPressCtrl)
552
                        {
553
                            this.dzMainMenu.Redo();
554
                        }
555
                    }
556
                    break;
557
                #endregion
558

    
559
                #region 삭제하기(Delete)
560
                case Key.Delete:
561
                    {
562
                        if (this.dzMainMenu.SelectLayer.Children.Count > 0)
563
                        {
564
                            Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
565

    
566
                            UndoData = new Undo_data()
567
                            {
568
                                IsUndo = false,
569
                                Event = Event_Type.Delete,
570
                                EventTime = DateTime.Now,
571
                                Markup_List = new List<Multi_Undo_data>()
572
                            };
573

    
574
                            foreach (var item in this.dzMainMenu.SelectLayer.Children)
575
                            {
576
                                if (item.GetType().Name == "AdornerFinal")
577
                                {
578
                                    //List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>();
579

    
580
                                    (item as Controls.AdornerFinal).unRegister();
581

    
582
                                    foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
583
                                    {
584
                                        //if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
585
                                        if (!ViewerDataModel.Instance.MarkupControls_USER.Contains(InnerItem.DrawingData))
586
                                        {
587
                                            //this.dzMainMenu.ReleaseAdorner();
588

    
589
                                            multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
590
                                            UndoData.Markup_List.Add(multi_Undo_Data);
591
                                            multi_Undo_Data = new Multi_Undo_data();
592

    
593
                                            ViewerDataModel.Instance.MarkupControls.Remove(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo);
594

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

    
598
                                            ViewerDataModel.Instance.MarkupList_USER.Remove(Item_);
599

    
600
                                            //임시파일에서도 삭제한다.
601
                                            TempFile.DelTemp((InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo).CommentID, dzMainMenu.pageNavigator.CurrentPage.PageNumber.ToString());
602
                                                     
603
                                            //adornerSet.Add((InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo));                                           
604

    
605
                                        }
606
                                    }
607
                                }
608

    
609
                                ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
610
                                {
611
                                    ViewerDataModel.Instance.UndoDataList.Remove(i);                                    
612
                                });
613
                                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
614

    
615
                                
616
                            }
617
                        }
618

    
619
                        this.dzMainMenu.SelectLayer.Children.Clear();                        
620
                    }
621
                    break;
622
                #endregion
623

    
624
                #region 선택된 컨트롤 모두 해제 하기(ESC)
625
                case Key.Escape:
626
                    {
627
                        //캡쳐모드 일 경우 초기화
628
                        if(this.dzMainMenu.mouseHandlingMode == IKCOM.MouseHandlingMode.Capture)
629
                        {
630
                            //dzMainMenu.PN_Navi.IsEnabled = true;
631
                            this.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
632
                            ViewerDataModel.Instance.Capture_Opacity = 0;
633
                        }
634

    
635
                        if(Common.ViewerDataModel.Instance.SelectedControl == "Batch")
636
                        {
637
                            this.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
638
                            this.dzMainMenu.txtBatch.Visibility = Visibility.Collapsed;
639
                            this.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
640
                            var TogList = this.dzTopMenu.Parent.ChildrenOfType<RadToggleButton>();
641
                            foreach (var tog in TogList)
642
                            {
643
                                tog.IsChecked = false;
644
                            }
645
                        }
646

    
647
                        this.dzMainMenu.ReleaseAdorner();
648

    
649
                        //코멘트 그리는 도중일 경우 코멘트 삭제 및 초기화
650
                        if (this.dzMainMenu.currentControl != null)
651
                        {
652
                            ViewerDataModel.Instance.MarkupControls_USER.Remove(this.dzMainMenu.currentControl);
653
                            this.dzMainMenu.currentControl = null;
654
                        }
655

    
656
                        //모든 컨트롤 초기화 하고 Selection모드로 변경
657
                        dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Selecting;
658
                        dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
659

    
660
                        var toggleList = this.ChildrenOfType<RadToggleButton>();
661
                        var toggleList2 = this.ChildrenOfType<RadRibbonToggleButton>();
662

    
663
                        foreach (var item in toggleList)
664
                        {
665
                            if (item.Name == "btnSelection")
666
                            {
667
                                item.IsChecked = true;
668
                            }
669
                            else
670
                            {
671
                                item.IsChecked = false;
672
                            }
673
                        }
674
                        dzMainMenu.isLeftMouseButtonDownOnWindow = false;
675
                        //foreach (var item in toggleList2)
676
                        //{
677
                        //    item.IsChecked = false;
678
                        //}
679
                    }
680
                    break;
681
                #endregion
682

    
683
                #region FIND(Ctrl + F)
684
                case Key.F:
685
                    {
686
                        if (ViewerDataModel.Instance.IsPressCtrl)
687
                        {
688
                            if (!this.dzMainMenu.searchPane.IsPinned)
689
                            {
690
                                this.dzMainMenu.searchPane.IsPinned = true;
691
                                if (ViewerDataModel.Instance.searchPDF != null)
692
                                {
693
                                    this.dzMainMenu.searchPanel_Instance.tbSearch.Focus();
694
                                }
695
                                else
696
                                {
697
                                    this.dzMainMenu.searchPanel_Instance.btnSearch.Focus();
698
                                }
699
                            }
700
                            else
701
                            {
702
                                this.dzMainMenu.searchPane.IsPinned = false;
703
                                this.dzMainMenu.searchPane.IsActive = false;
704
                                //this.dzMainMenu.searchPane.IsHidden = true;
705
                            }
706
                        }
707
                    }
708
                    break;
709
                #endregion
710

    
711
                #endregion
712

    
713
                //강인구 추가
714
                #region Control Move
715
                case Key.NumPad4:
716
                case Key.NumPad5:
717
                case Key.NumPad6:
718
                case Key.NumPad8:
719
                    {
720
                        if(ViewerDataModel.Instance.IsPressShift)
721
                        {
722
                            if (this.dzMainMenu.SelectLayer.Children.Count > 0)
723
                            {
724
                                Point control = new Point(0, 0);
725
                                double resultAngle = this.dzMainMenu.rotate.Angle;
726

    
727
                                switch (e.Key)
728
                                {
729
                                    case Key.NumPad5:
730
                                        if (resultAngle == 0) control = new Point(control.X, control.Y + 5);
731
                                        if (resultAngle == 90) control = new Point(control.X + 5, control.Y);
732
                                        if (resultAngle == 180) control = new Point(control.X, control.Y - 5);
733
                                        if (resultAngle == 270) control = new Point(control.X - 5, control.Y);
734
                                        break;
735
                                    case Key.NumPad8:
736
                                        if (resultAngle == 0) control = new Point(control.X, control.Y - 5);
737
                                        if (resultAngle == 90) control = new Point(control.X - 5, control.Y);
738
                                        if (resultAngle == 180) control = new Point(control.X, control.Y + 5);
739
                                        if (resultAngle == 270) control = new Point(control.X + 5, control.Y);
740
                                        break;
741
                                    case Key.NumPad4:
742
                                        if (resultAngle == 0) control = new Point(control.X - 5, control.Y);
743
                                        if (resultAngle == 90) control = new Point(control.X, control.Y + 5);
744
                                        if (resultAngle == 180) control = new Point(control.X + 5, control.Y);
745
                                        if (resultAngle == 270) control = new Point(control.X, control.Y - 5);
746
                                        break;
747
                                    case Key.NumPad6:
748
                                        if (resultAngle == 0) control = new Point(control.X + 5, control.Y);
749
                                        if (resultAngle == 90) control = new Point(control.X, control.Y - 5);
750
                                        if (resultAngle == 180) control = new Point(control.X - 5, control.Y);
751
                                        if (resultAngle == 270) control = new Point(control.X, control.Y + 5);
752
                                        break;
753
                                    default:
754
                                        break;
755
                                }
756

    
757

    
758
                                foreach (var item in this.dzMainMenu.SelectLayer.Children)
759
                                {
760
                                    if (item.GetType().Name == "AdornerFinal")
761
                                    {
762
                                        if ((Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control)
763
                                        {
764
                                            (item as Controls.AdornerFinal).MoveRotate(new System.Windows.Controls.Primitives.DragDeltaEventArgs(control.X * 2, control.Y * 2));
765
                                        }
766
                                        else
767
                                        {
768
                                            (item as Controls.AdornerFinal).MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(control.X, control.Y));
769
                                        }
770

    
771
                                    }
772
                                }
773
                            }
774
                        }
775
                    }
776
                    break;
777
                #endregion
778
                case Key.PageUp:
779
                    this.dzMainMenu.pageNavigator.GotoPage(Convert.ToInt32(Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber) - 1);
780
                    break;
781
                case Key.PageDown:
782
                    this.dzMainMenu.pageNavigator.GotoPage(Convert.ToInt32(Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber) + 1);
783
                    break;
784
            }
785
        }
786

    
787
        public void KeyEventUpAction(object sender, KeyEventArgs e)
788
        {
789
            switch (e.Key)
790
            {
791
                //강인구 추가
792
                #region Ctrl
793
                case Key.LeftCtrl:
794
                    {
795
                        if (ViewerDataModel.Instance.IsPressCtrl)
796
                        {
797
                            ViewerDataModel.Instance.IsPressCtrl = false;
798
                        }
799
                    }
800
                    break;
801
                case Key.RightCtrl:
802
                    {
803

    
804
                    }
805
                    break;
806
                #endregion
807

    
808
                #region Shift
809
                case Key.RightShift:
810
                case Key.LeftShift:
811
                    {
812
                        ViewerDataModel.Instance.IsPressShift = false;
813
                    }
814
                    break;
815
                    #endregion
816
            }
817
        }
818
    }
819
}
클립보드 이미지 추가 (최대 크기: 500 MB)