프로젝트

일반

사용자정보

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

markus / KCOM / Events / Event_KeyEvent.cs @ c73426a9

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

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

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

    
23
        public MarkupToPDF.Common.Undo_data UndoData;
24

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

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

    
37
        public void KeyEventDownAction(object sender, KeyEventArgs e)
38
        {
39

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

    
57
                    }
58
                    break;
59
                #endregion
60

    
61
                #region Shift
62
                case Key.RightShift:
63
                    {
64

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

    
91
                    }
92
                    break;
93
                #endregion
94

    
95
                //강인구 추가
96
                #region 단축키 선택
97

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

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

    
112
                                //컨트롤을 그리는 도중일 경우 컨트롤 삭제
113
                                ViewerDataModel.Instance.MarkupControls_USER.Remove(this.dzMainMenu.currentControl);
114
                                this.dzMainMenu.currentControl = null;
115

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

    
124
                                UndoData = new Undo_data()
125
                                {
126
                                    IsUndo = false,
127
                                    Event = Event_Type.Select,
128
                                    EventTime = DateTime.Now,
129
                                    Markup_List = new List<Multi_Undo_data>()
130
                                };
131

    
132
                                List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>();
133
                                var control = ViewerDataModel.Instance.MarkupControls_USER.Where(data => data.GetType().Name != "").ToList();
134
                                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
135

    
136
                                foreach (var item in control)
137
                                {
138
                                    adornerSet.Add(item);
139
                                    //multi_Undo_Data.Markup = item;
140
                                    multi_Undo_Data = this.dzMainMenu.Control_Style(item);
141
                                    UndoData.Markup_List.Add(multi_Undo_Data);
142

    
143
                                    multi_Undo_Data = new Multi_Undo_data();
144
                                    ViewerDataModel.Instance.MarkupControls_USER.Remove(item);
145
                                    
146
                                }
147

    
148
                                if (adornerSet.Count > 0)
149
                                {
150
                                    Controls.AdornerFinal final = new Controls.AdornerFinal(adornerSet);
151
                                    this.dzMainMenu.SelectLayer.Children.Add(final);
152
                                }
153

    
154
                                ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
155
                                {
156
                                    ViewerDataModel.Instance.UndoDataList.Remove(i);
157
                                });
158

    
159

    
160
                                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
161
                            }
162
                        }
163
                    }
164
                    break;
165
                #endregion
166

    
167
                
168

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

    
178
                                foreach (var item in this.dzMainMenu.SelectLayer.Children)
179
                                {
180
                                    string id = "";
181
                                    if (item.GetType().Name == "AdornerFinal")
182
                                    {
183
                                        foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
184
                                        {        
185
                                            if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
186
                                            {
187
                                                markupReturn = layer.MarkupToString(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo, App.ViewInfo.UserID);
188

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

    
220
                #region 잘라내기(Ctrl + X)
221
                case Key.X:
222
                    {
223
                        if (ViewerDataModel.Instance.IsPressCtrl)
224
                        {
225
                            if (this.dzMainMenu.SelectLayer.Children.Count > 0)
226
                            {
227
                                foreach (var item in this.dzMainMenu.SelectLayer.Children)
228
                                {
229
                                    string MarkupData = "";
230

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

    
252
                #region 붙여넣기(Ctrl + V)
253
                case Key.V:
254
                    {
255
                        if (ViewerDataModel.Instance.IsPressCtrl && (App.ViewInfo.CreateFinalPDFPermission || App.ViewInfo.NewCommentPermission))
256
                        {
257
                            //마크업 붙여넣기
258
                            //if (Clipboard.GetText().Contains("|DZ|"))
259
                            if (Clipboard.GetText().Contains("|OR||DZ|"))
260
                            {
261
                                List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>();
262

    
263
                                string[] delimiterChars = { "|OR|" };
264
                                string[] delimiterChars2 = { "|OR|", "|SymbolID|" };
265
                                string[] data = Clipboard.GetText().Split(delimiterChars, StringSplitOptions.RemoveEmptyEntries);
266

    
267
                                this.dzMainMenu.ReleaseAdorner();
268

    
269
                                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
270

    
271
                                //강인구 Undo/Redo 보류
272
                                UndoData = new Undo_data()
273
                                {
274
                                    IsUndo = false,
275
                                    Event = Event_Type.Create,
276
                                    EventTime = DateTime.Now,
277
                                    Markup_List = new List<Multi_Undo_data>()
278
                                };
279

    
280
                                ViewerDataModel.Instance.UndoDataList.Where(data1 => data1.IsUndo == true).ToList().ForEach(i =>
281
                                {
282
                                    ViewerDataModel.Instance.UndoDataList.Remove(i);
283
                                });
284
                                
285
                                foreach (string parse in data)
286
                                {                                    
287
                                    if(parse != "")
288
                                    {
289
                                        string[] data2 = new string[2];
290
                                        data2 = parse.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries);
291

    
292
                                        System.Windows.Controls.Control item =  layer.markupParse_Paste(data2[0], ViewerDataModel.Instance.MarkupControls_USER);
293
                                        (item as MarkupToPDF.Common.CommentUserInfo).CommentID = Events.Save.shortGuid();
294
                                        if(data2.Length >= 2)
295
                                        {
296
                                            (item as MarkupToPDF.Common.CommentUserInfo).SymbolID = data2[1];
297
                                        }                                        
298
                                        ViewerDataModel.Instance.MarkupControls.Remove(item as MarkupToPDF.Common.CommentUserInfo);
299
                                        ViewerDataModel.Instance.MarkupControls_USER.Remove(item as MarkupToPDF.Common.CommentUserInfo);
300

    
301
                                        adornerSet.Add(item as MarkupToPDF.Common.CommentUserInfo);
302

    
303
                                        //Controls.AdornerFinal final = new Controls.AdornerFinal(item as MarkupToPDF.Common.CommentUserInfo);
304
                                        //this.dzMainMenu.SelectLayer.Children.Add(final);
305

    
306
                                        multi_Undo_Data = dzMainMenu.Control_Style(item as MarkupToPDF.Common.CommentUserInfo);
307

    
308
                                        UndoData.Markup_List.Add(multi_Undo_Data);
309
                                        ViewerDataModel.Instance.UndoDataList.Add(UndoData);                                                                               
310
                                    }
311
                                }
312
                                Controls.AdornerFinal final = new Controls.AdornerFinal(adornerSet);
313

    
314
                                double realPointX = this.dzMainMenu.getCurrentPoint.X - final.BorderSize.X - (final.BorderSize.Width / 2);
315
                                double realPointY = this.dzMainMenu.getCurrentPoint.Y - final.BorderSize.Y - (final.BorderSize.Height / 2);
316
                                final.MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(realPointX, realPointY));
317

    
318
                                if (final.MemberSet.Where(type => type.Drawingtype == MarkupToPDF.Controls.Common.ControlType.TextControl).FirstOrDefault() != null)
319
                                {
320
                                    final.MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(0.001, 0.001)); //dummy
321
                                }
322

    
323
                                this.dzMainMenu.SelectLayer.Children.Add(final);
324

    
325
                                //붙여 넣을때 원본 컨트롤과 겹치지 않도록 설정
326
                                //Canvas.SetLeft(final, 50);
327
                                //Canvas.SetTop(final, 50);
328

    
329
                            }
330
                            //외부 이미지 붙여넣기
331
                            else if (Clipboard.GetImage() != null)
332
                            {
333
                                try
334
                                {
335
                                    Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
336

    
337
                                    //강인구 Undo/Redo 보류
338
                                    UndoData = new Undo_data()
339
                                    {
340
                                        IsUndo = false,
341
                                        Event = Event_Type.Create,
342
                                        EventTime = DateTime.Now,
343
                                        Markup_List = new List<Multi_Undo_data>()
344
                                    };
345

    
346
                                    string temppath = System.IO.Path.GetTempPath();
347
                                    //string filename = KCOM.Events.Save.shortCommentKey();
348
                                    string filename = KCOM.Events.Save.shortFileKey();
349

    
350
                                    System.Drawing.Image clipboardImage = System.Windows.Forms.Clipboard.GetImage();
351
                                    clipboardImage.Save(temppath + "\\" + filename);
352

    
353
                                    System.IO.FileInfo fileInfo = new System.IO.FileInfo(temppath + "\\" + filename);
354
                                    String strFile = System.IO.Path.GetFileName(fileInfo.FullName);
355
                                    long numByte = fileInfo.Length;
356
                                    double dLen = Convert.ToDouble(fileInfo.Length / 1000000);
357
                                    kr.co.devdoftech.cloud.FileUpload fileUploader = new kr.co.devdoftech.cloud.FileUpload();
358

    
359
                                    if (dLen < 4)
360
                                    {
361
                                        System.IO.FileStream fStream = new System.IO.FileStream(fileInfo.FullName,
362
                                        System.IO.FileMode.Open, System.IO.FileAccess.Read);
363
                                        System.IO.BinaryReader br = new System.IO.BinaryReader(fStream);
364
                                        byte[] data = br.ReadBytes((int)numByte);
365

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

    
368
                                        Check_Uri.UriCheck(filename);
369

    
370
                                        br.Close();
371
                                        fStream.Close();
372
                                        fStream.Dispose();
373
                                    }
374
                                    else
375
                                    {
376
                                        dzMainMenu.DialogMessage_Alert("Available Memory less than 4 mega byte", "Alert");
377
                                        return;
378
                                    }
379

    
380
                                    fileInfo.Delete();
381

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

    
416
                                    currentControl.TopRightPoint = new Point(currentControl.StartPoint.X + clipboardImage.Width, currentControl.StartPoint.Y);
417
                                    currentControl.LeftBottomPoint = new Point(currentControl.StartPoint.X, currentControl.StartPoint.Y + clipboardImage.Height);
418
                                    currentControl.EndPoint = new Point(currentControl.StartPoint.X + clipboardImage.Width, currentControl.StartPoint.Y + clipboardImage.Height);
419

    
420
                                    currentControl.PointSet = new List<Point>
421
                                        {
422
                                            currentControl.StartPoint,
423
                                            currentControl.LeftBottomPoint,
424
                                            currentControl.EndPoint,
425
                                            currentControl.TopRightPoint,
426
                                        };
427

    
428
                                    multi_Undo_Data = dzMainMenu.Control_Style(currentControl as MarkupToPDF.Common.CommentUserInfo);
429
                                    UndoData.Markup_List.Add(multi_Undo_Data);
430
                                    ViewerDataModel.Instance.UndoDataList.Add(UndoData);
431

    
432
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl as MarkupToPDF.Common.CommentUserInfo);
433
                                    currentControl.CommentID = Events.Save.shortGuid();
434

    
435
                                    currentControl.ApplyTemplate();
436
                                    currentControl.SetImage();
437

    
438
                                    ViewerDataModel.Instance.MarkupControls_USER.Remove(currentControl as MarkupToPDF.Common.CommentUserInfo);
439
                                    Controls.AdornerFinal final = new Controls.AdornerFinal(currentControl as MarkupToPDF.Common.CommentUserInfo);
440
                                    this.dzMainMenu.SelectLayer.Children.Add(final);
441

    
442
                                    double realPointX = this.dzMainMenu.getCurrentPoint.X - final.BorderSize.X - (final.BorderSize.Width / 2);
443
                                    double realPointY = this.dzMainMenu.getCurrentPoint.Y - final.BorderSize.Y - (final.BorderSize.Height / 2);
444
                                    final.MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(realPointX, realPointY));
445

    
446
                                    #region 주석
447

    
448
                                    //주석
449
                                    //ViewerDataModel.Instance.MarkupControls_USER.Remove(currentControl as MarkupToPDF.Common.CommentUserInfo);
450
                                    //Controls.AdornerFinal final = new Controls.AdornerFinal(currentControl as MarkupToPDF.Common.CommentUserInfo);
451
                                    //this.dzMainMenu.SelectLayer.Children.Add(final);
452

    
453
                                    //string MarkupData = "";
454

    
455
                                    //if (!ViewerDataModel.Instance.MarkupControls.Contains(currentControl))
456
                                    //{
457
                                    //    markupReturn = layer.MarkupToString(currentControl, App.ViewInfo.UserID);
458
                                    //    MarkupData += "|OR|" + markupReturn.ConvertData;
459
                                    //}
460
                                    //Clipboard.SetText(MarkupData);
461
                                    //this.dzMainMenu.SelectLayer.Children.Clear();
462

    
463
                                    //List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>();
464

    
465
                                    //string[] delimiterChars = { "|OR|" };
466
                                    //string[] data1 = Clipboard.GetText().Split(delimiterChars, StringSplitOptions.RemoveEmptyEntries);
467

    
468
                                    //this.dzMainMenu.ReleaseAdorner();
469

    
470
                                    //foreach (string parse in data1)
471
                                    //{
472
                                    //    if (parse != "")
473
                                    //    {
474
                                    //        System.Windows.Controls.Control item = layer.markupParse_Paste(parse, ViewerDataModel.Instance.MarkupControls_USER);
475
                                    //        (item as MarkupToPDF.Common.CommentUserInfo).CommentID = Events.Save.shortGuid();
476

    
477
                                    //        ViewerDataModel.Instance.MarkupControls.Remove(item as MarkupToPDF.Common.CommentUserInfo);
478
                                    //        ViewerDataModel.Instance.MarkupControls_USER.Remove(item as MarkupToPDF.Common.CommentUserInfo);
479

    
480
                                    //        adornerSet.Add(item as MarkupToPDF.Common.CommentUserInfo);
481

    
482
                                    //        //Controls.AdornerFinal final = new Controls.AdornerFinal(item as MarkupToPDF.Common.CommentUserInfo);
483
                                    //        //this.dzMainMenu.SelectLayer.Children.Add(final);
484
                                    //    }
485
                                    //}
486
                                    //Controls.AdornerFinal final = new Controls.AdornerFinal(adornerSet);
487

    
488
                                    //double realPointX = this.dzMainMenu.getCurrentPoint.X - final.BorderSize.X - (final.BorderSize.Width / 2);
489
                                    //double realPointY = this.dzMainMenu.getCurrentPoint.Y - final.BorderSize.Y - (final.BorderSize.Height / 2);
490
                                    //final.MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(realPointX, realPointY));
491

    
492
                                    //if (final.MemberSet.Where(type => type.Drawingtype == MarkupToPDF.Controls.Common.ControlType.TextControl).FirstOrDefault() != null)
493
                                    //{
494
                                    //    final.MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(0.001, 0.001)); //dummy
495
                                    //}
496

    
497
                                    //this.dzMainMenu.SelectLayer.Children.Add(final); 
498
                                    #endregion
499

    
500
                                }
501
                                catch(Exception ex)
502
                                {
503
                                    Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.DialogMessage_Alert("" + ex, "Alert");
504
                                }
505
                            }
506
                        }                        
507
                    }
508
                    break;
509
                #endregion
510

    
511
                #region 저장하기(Ctrl + S)
512
                case Key.S:
513
                    {
514
                        if (ViewerDataModel.Instance.IsPressCtrl  && (App.ViewInfo.CreateFinalPDFPermission || App.ViewInfo.NewCommentPermission))
515
                        {
516
                            //컨트롤을 그리는 도중일 경우 컨트롤 삭제
517
                            ViewerDataModel.Instance.MarkupControls_USER.Remove(this.dzMainMenu.currentControl);
518
                            this.dzMainMenu.currentControl = null;
519

    
520
                            //this.dzTopMenu.SaveEvent(null, null);
521
                            if (App.ViewInfo.CreateFinalPDFPermission || App.ViewInfo.NewCommentPermission)
522
                            {
523
                                this.dzTopMenu.SaveEvent(new object(), null);
524
                            }
525

    
526
                            //저장완료후 임시파일 삭제
527
                            temp.Remove();
528
                        }                       
529
                    }
530
                    break;
531
                #endregion
532

    
533
                #region 프린트하기(Ctrl + P)
534
                case Key.P:
535
                    {
536
                        if (ViewerDataModel.Instance.IsPressCtrl)
537
                        {
538
                            this.dzTopMenu.Print_Start("Print");
539
                        }
540
                    }
541
                    break;
542
                #endregion
543

    
544
                #region Undo(Ctrl + Z)
545
                case Key.Z:
546
                    {
547
                        if (ViewerDataModel.Instance.IsPressCtrl)
548
                        {
549
                            this.dzMainMenu.Undo();
550
                        }                        
551
                    }
552
                    break;
553
                #endregion
554

    
555
                #region Redo(Ctrl + Y)
556
                case Key.Y:
557
                    {
558
                        if (ViewerDataModel.Instance.IsPressCtrl)
559
                        {
560
                            this.dzMainMenu.Redo();
561
                        }
562
                    }
563
                    break;
564
                #endregion
565

    
566
                #region 삭제하기(Delete)
567
                case Key.Delete:
568
                    {
569
                        if (this.dzMainMenu.SelectLayer.Children.Count > 0)
570
                        {
571
                            Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
572

    
573
                            UndoData = new Undo_data()
574
                            {
575
                                IsUndo = false,
576
                                Event = Event_Type.Delete,
577
                                EventTime = DateTime.Now,
578
                                Markup_List = new List<Multi_Undo_data>()
579
                            };
580

    
581
                            foreach (var item in this.dzMainMenu.SelectLayer.Children)
582
                            {
583
                                if (item.GetType().Name == "AdornerFinal")
584
                                {
585
                                    //List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>();
586

    
587
                                    (item as Controls.AdornerFinal).unRegister();
588

    
589
                                    foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
590
                                    {
591
                                        //if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
592
                                        if (!ViewerDataModel.Instance.MarkupControls_USER.Contains(InnerItem.DrawingData))
593
                                        {
594
                                            //this.dzMainMenu.ReleaseAdorner();
595

    
596
                                            multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
597
                                            UndoData.Markup_List.Add(multi_Undo_Data);
598
                                            multi_Undo_Data = new Multi_Undo_data();
599

    
600
                                            ViewerDataModel.Instance.MarkupControls.Remove(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo);
601

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

    
605
                                            ViewerDataModel.Instance.MarkupList_USER.Remove(Item_);
606

    
607
                                            //임시파일에서도 삭제한다.
608
                                            temp.DelTemp((InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo).CommentID, dzMainMenu.pageNavigator.CurrentPage.PageNumber.ToString());
609
                                                     
610
                                            //adornerSet.Add((InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo));                                           
611

    
612
                                        }
613
                                    }
614
                                }
615

    
616
                                ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
617
                                {
618
                                    ViewerDataModel.Instance.UndoDataList.Remove(i);                                    
619
                                });
620
                                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
621

    
622
                                
623
                            }
624
                        }
625

    
626
                        this.dzMainMenu.SelectLayer.Children.Clear();                        
627
                    }
628
                    break;
629
                #endregion
630

    
631
                #region 선택된 컨트롤 모두 해제 하기(ESC)
632
                case Key.Escape:
633
                    {
634
                        //캡쳐모드 일 경우 초기화
635
                        if(this.dzMainMenu.mouseHandlingMode == IKCOM.MouseHandlingMode.Capture)
636
                        {
637
                            //dzMainMenu.PN_Navi.IsEnabled = true;
638
                            this.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
639
                            ViewerDataModel.Instance.Capture_Opacity = 0;
640
                        }
641

    
642
                        if(Common.ViewerDataModel.Instance.SelectedControl == "Batch")
643
                        {
644
                            this.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
645
                            this.dzMainMenu.txtBatch.Visibility = Visibility.Collapsed;
646
                            this.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
647
                            var TogList = this.dzTopMenu.Parent.ChildrenOfType<RadToggleButton>();
648
                            foreach (var tog in TogList)
649
                            {
650
                                tog.IsChecked = false;
651
                            }
652
                        }
653

    
654
                        this.dzMainMenu.ReleaseAdorner();
655

    
656
                        //코멘트 그리는 도중일 경우 코멘트 삭제 및 초기화
657
                        if (this.dzMainMenu.currentControl != null)
658
                        {
659
                            ViewerDataModel.Instance.MarkupControls_USER.Remove(this.dzMainMenu.currentControl);
660
                            this.dzMainMenu.currentControl = null;
661
                        }
662

    
663
                        //모든 컨트롤 초기화 하고 Selection모드로 변경
664
                        dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Selecting;
665
                        dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
666

    
667
                        var toggleList = this.ChildrenOfType<RadToggleButton>();
668
                        var toggleList2 = this.ChildrenOfType<RadRibbonToggleButton>();
669

    
670
                        foreach (var item in toggleList)
671
                        {
672
                            if (item.Name == "btnSelection")
673
                            {
674
                                item.IsChecked = true;
675
                            }
676
                            else
677
                            {
678
                                item.IsChecked = false;
679
                            }
680
                        }
681
                        dzMainMenu.isLeftMouseButtonDownOnWindow = false;
682
                        //foreach (var item in toggleList2)
683
                        //{
684
                        //    item.IsChecked = false;
685
                        //}
686
                    }
687
                    break;
688
                #endregion
689

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

    
718
                #endregion
719

    
720
                //강인구 추가
721
                #region Control Move
722
                case Key.NumPad4:
723
                case Key.NumPad5:
724
                case Key.NumPad6:
725
                case Key.NumPad8:
726
                    {
727
                        if(ViewerDataModel.Instance.IsPressShift)
728
                        {
729
                            if (this.dzMainMenu.SelectLayer.Children.Count > 0)
730
                            {
731
                                Point control = new Point(0, 0);
732
                                double resultAngle = this.dzMainMenu.rotate.Angle;
733

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

    
764

    
765
                                foreach (var item in this.dzMainMenu.SelectLayer.Children)
766
                                {
767
                                    if (item.GetType().Name == "AdornerFinal")
768
                                    {
769
                                        if ((Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control)
770
                                        {
771
                                            (item as Controls.AdornerFinal).MoveRotate(new System.Windows.Controls.Primitives.DragDeltaEventArgs(control.X * 2, control.Y * 2));
772
                                        }
773
                                        else
774
                                        {
775
                                            (item as Controls.AdornerFinal).MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(control.X, control.Y));
776
                                        }
777

    
778
                                    }
779
                                }
780
                            }
781
                        }
782
                    }
783
                    break;
784
                #endregion
785
                case Key.PageUp:
786
                    this.dzMainMenu.pageNavigator.GotoPage(Convert.ToInt32(Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber) - 1);
787
                    break;
788
                case Key.PageDown:
789
                    this.dzMainMenu.pageNavigator.GotoPage(Convert.ToInt32(Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber) + 1);
790
                    break;
791
            }
792
        }
793

    
794
        public void KeyEventUpAction(object sender, KeyEventArgs e)
795
        {
796
            switch (e.Key)
797
            {
798
                //강인구 추가
799
                #region Ctrl
800
                case Key.LeftCtrl:
801
                    {
802
                        if (ViewerDataModel.Instance.IsPressCtrl)
803
                        {
804
                            ViewerDataModel.Instance.IsPressCtrl = false;
805
                        }
806
                    }
807
                    break;
808
                case Key.RightCtrl:
809
                    {
810

    
811
                    }
812
                    break;
813
                #endregion
814

    
815
                #region Shift
816
                case Key.RightShift:
817
                case Key.LeftShift:
818
                    {
819
                        ViewerDataModel.Instance.IsPressShift = false;
820
                    }
821
                    break;
822
                    #endregion
823
            }
824
        }
825
    }
826
}
클립보드 이미지 추가 (최대 크기: 500 MB)