프로젝트

일반

사용자정보

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

markus / KCOM / Events / Event_KeyEvent.cs @ 53880c83

이력 | 보기 | 이력해설 | 다운로드 (43.2 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
                                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
334

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

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

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

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

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

    
364
                                    filename = fileUploader.Run(App.ViewInfo.ProjectNO, this.dzMainMenu._DocItem.DOCUMENT_NO, App.ViewInfo.UserID, strFile + ".png", data);
365
                                    br.Close();
366
                                    fStream.Close();
367
                                    fStream.Dispose();
368
                                }
369
                                else
370
                                {
371
                                    dzMainMenu.DialogMessage_Alert("Available Memory less than 4 mega byte", "Alert");
372
                                    return;
373
                                }
374

    
375
                                fileInfo.Delete();
376

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

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

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

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

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

    
430
                                currentControl.ApplyTemplate();
431
                                currentControl.SetImage();
432

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

    
437
                                double realPointX = this.dzMainMenu.getCurrentPoint.X - final.BorderSize.X - (final.BorderSize.Width / 2);
438
                                double realPointY = this.dzMainMenu.getCurrentPoint.Y - final.BorderSize.Y - (final.BorderSize.Height / 2);
439
                                final.MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(realPointX, realPointY));
440
                                                                
441
                                #region 주석
442

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

    
448
                                //string MarkupData = "";
449

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

    
458
                                //List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>();
459

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

    
463
                                //this.dzMainMenu.ReleaseAdorner();
464

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

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

    
475
                                //        adornerSet.Add(item as MarkupToPDF.Common.CommentUserInfo);
476

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

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

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

    
492
                                //this.dzMainMenu.SelectLayer.Children.Add(final); 
493
                                #endregion
494

    
495
                            }
496
                        }
497
                        
498
                    }
499
                    break;
500
                #endregion
501

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

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

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

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

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

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

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

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

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

    
578
                                    (item as Controls.AdornerFinal).unRegister();
579

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

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

    
591
                                            ViewerDataModel.Instance.MarkupControls.Remove(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo);
592

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

    
596
                                            ViewerDataModel.Instance.MarkupList_USER.Remove(Item_);
597

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

    
603
                                        }
604
                                    }
605
                                }
606

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

    
613
                                
614
                            }
615
                        }
616

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

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

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

    
645
                        this.dzMainMenu.ReleaseAdorner();
646

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

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

    
658
                        var toggleList = this.ChildrenOfType<RadToggleButton>();
659
                        var toggleList2 = this.ChildrenOfType<RadRibbonToggleButton>();
660

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

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

    
709
                #endregion
710

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

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

    
755

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

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

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

    
802
                    }
803
                    break;
804
                #endregion
805

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