프로젝트

일반

사용자정보

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

markus / KCOM / Events / Event_KeyEvent.cs @ ea6f99ec

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

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

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

    
24
        public MarkupToPDF.Common.Undo_data UndoData;
25

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

    
30
        MarkupToPDF.Controls.Parsing.MarkupParser.MarkupReturn markupReturn = new MarkupToPDF.Controls.Parsing.MarkupParser.MarkupReturn();
31
                
32
        public List<CommentUserInfo> SelectedItems
33
        {
34
            get
35
            {
36
                List<CommentUserInfo> res = new List<CommentUserInfo>();
37
                foreach (var item in this.dzMainMenu.SelectLayer.Children)
38
                {
39
                    if (item.GetType().Name == "AdornerFinal")
40
                    {
41
                        foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
42
                        {
43
                            res.Add(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo);
44
                        }
45
                    }
46
                }
47

    
48
                return res;
49
            }
50
        }
51

    
52
        public void KeyEventDownAction(object sender, KeyEventArgs e)
53
        {
54
            switch (e.Key)
55
            {
56
                //강인구 추가
57
                #region Ctrl
58
                case Key.LeftCtrl:
59
                    {
60
                        if (!ViewerDataModel.Instance.IsPressCtrl)
61
                        {
62
                            ViewerDataModel.Instance.IsPressCtrl = true;
63
                        }
64
                    }
65
                    break;
66
                case Key.RightCtrl:
67
                    {
68

    
69
                    }
70
                    break;
71
                #endregion
72

    
73
                #region Shift
74
                case Key.RightShift:
75
                    {
76

    
77
                    }
78
                    break;
79
                case Key.LeftShift:
80
                    {
81
                        if (!ViewerDataModel.Instance.IsPressShift)
82
                        {
83
                            ViewerDataModel.Instance.IsPressShift = true;
84
                        }
85
                        //if (dzMain.deepZoomObject._MouseHelper.isMouseOver && !dzMain.DeepLayer.Drawing)
86
                        //{
87
                        //    dzMain.deepZoomObject._MouseHelper.isPressShift = true;
88
                        //    CumulativeWheel += dzMain.deepZoomObject._MouseHelper.wheelDelta;
89
                        //    dzMain.deepZoomObject._MouseHelper.wheelDelta = 0;
90
                        //    System.Diagnostics.Debug.WriteLine(CumulativeWheel);
91
                        //    if (CumulativeWheel == 3 && CumulativeWheel >= 0)
92
                        //    {
93
                        //        this.dzMain.pageNavigator.pagebeforetMove();
94
                        //        CumulativeWheel = 0;
95
                        //    }
96
                        //    else if (CumulativeWheel == -3 && CumulativeWheel <= 0)
97
                        //    {
98
                        //        this.dzMain.pageNavigator.pageNextMove();
99
                        //        CumulativeWheel = 0;
100
                        //    }
101
                        //}
102

    
103
                    }
104
                    break;
105
                #endregion
106

    
107
                //강인구 추가
108
                #region 단축키 선택
109

    
110
                #region 전체 선택(Ctrl + A)
111
                case Key.A:
112
                    {
113
                        if (ViewerDataModel.Instance.IsPressCtrl && (App.ViewInfo.CreateFinalPDFPermission || App.ViewInfo.NewCommentPermission))
114
                        {
115
                            this.dzMainMenu.InkControl_Convert();
116

    
117
                            if (Common.ViewerDataModel.Instance.MarkupControls_USER.Count > 0)
118
                            {
119
                                //전체 선택 시 선택된 토글 해제
120
                                var TogList = this.dzTopMenu.Parent.ChildrenOfType<RadToggleButton>();
121
                                this.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
122
                                this.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
123

    
124
                                //컨트롤을 그리는 도중일 경우 컨트롤 삭제
125
                                ViewerDataModel.Instance.MarkupControls_USER.Remove(this.dzMainMenu.currentControl);
126
                                this.dzMainMenu.currentControl = null;
127

    
128
                                foreach (var tog in TogList)
129
                                {
130
                                    tog.IsChecked = false;
131
                                }
132

    
133
                                //선택된 어도너가 있을 시 취소하고 전체 선택
134
                                SelectionSet.Instance.UnSelect(this.dzMainMenu);
135

    
136
                                UndoData = new Undo_data()
137
                                {
138
                                    IsUndo = false,
139
                                    Event = Event_Type.Select,
140
                                    EventTime = DateTime.Now,
141
                                    Markup_List = new List<Multi_Undo_data>()
142
                                };
143

    
144
                                List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>();
145
                                var control = ViewerDataModel.Instance.MarkupControls_USER.Where(data => data.GetType().Name != ""
146
                                && data.Visibility != Visibility.Hidden).ToList();
147
                                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
148

    
149
                                foreach (var item in control)
150
                                {
151
                                    adornerSet.Add(item);
152
                                    //multi_Undo_Data.Markup = item;
153
                                    multi_Undo_Data = this.dzMainMenu.Control_Style(item);
154
                                    UndoData.Markup_List.Add(multi_Undo_Data);
155

    
156
                                    multi_Undo_Data = new Multi_Undo_data();
157
                                    ViewerDataModel.Instance.MarkupControls_USER.Remove(item);
158
                                    
159
                                }
160

    
161
                                if (adornerSet.Count > 0)
162
                                {
163
                                    Controls.AdornerFinal final = new Controls.AdornerFinal(adornerSet);
164
                                    this.dzMainMenu.SelectLayer.Children.Add(final);
165
                                }
166

    
167
                                ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
168
                                {
169
                                    ViewerDataModel.Instance.UndoDataList.Remove(i);
170
                                });
171

    
172

    
173
                                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
174
                            }
175
                        }
176
                    }
177
                    break;
178
                #endregion
179

    
180
                
181

    
182
                #region 복사하기(Ctrl + C)
183
                case Key.C:
184
                    {
185
                        if (ViewerDataModel.Instance.IsPressCtrl)
186
                        {
187
                            if (this.dzMainMenu.SelectLayer.Children.Count > 0)
188
                            {
189
                                string MarkupData = "";                               
190

    
191
                                foreach (var item in this.dzMainMenu.SelectLayer.Children)
192
                                {
193
                                    string id = "";
194
                                    if (item.GetType().Name == "AdornerFinal")
195
                                    {
196
                                        foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
197
                                        {        
198
                                            if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
199
                                            {
200
                                                markupReturn = MarkupParser.MarkupToString(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo, App.ViewInfo.UserID);
201

    
202
                                                var Item_ = ViewerDataModel.Instance.MarkupList_USER.Where(d => d.ID == (InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo).CommentID).FirstOrDefault();
203
                                                
204
                                                if (Item_ != null)
205
                                                {
206
                                                     id = "|SymbolID|" + ViewerDataModel.Instance.MarkupList_USER.Where
207
                                                         (d => d.ID == (InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo).CommentID).FirstOrDefault().Symbol_ID;
208
                                                }
209
                                                else
210
                                                {
211
                                                    if (InnerItem.Symbol_ID != null)
212
                                                    {
213
                                                        id = "|SymbolID|" + InnerItem.Symbol_ID;
214
                                                        
215
                                                    }
216
                                                    else
217
                                                    {
218
                                                        id = "";
219
                                                    }                                                   
220
                                                }
221
                                                MarkupData += "|OR|" + markupReturn.ConvertData + id;
222
                                            }
223
                                        }
224
                                        Clipboard.SetText(MarkupData);
225
                                    }
226
                                }
227
                            }
228
                        }
229
                    }
230
                    break;
231
                #endregion
232

    
233
                #region 잘라내기(Ctrl + X)
234
                case Key.X:
235
                    {
236
                        if (ViewerDataModel.Instance.IsPressCtrl)
237
                        {
238
                            if (this.dzMainMenu.SelectLayer.Children.Count > 0)
239
                            {
240
                                foreach (var item in this.dzMainMenu.SelectLayer.Children)
241
                                {
242
                                    string MarkupData = "";
243

    
244
                                    if (item.GetType().Name == "AdornerFinal")
245
                                    {
246
                                        foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
247
                                        {
248
                                            if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
249
                                            {
250
                                                markupReturn = MarkupParser.MarkupToString(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo, App.ViewInfo.UserID);
251
                                                MarkupData += "|OR|" + markupReturn.ConvertData;                                                
252
                                            }
253
                                        }
254
                                        Clipboard.SetText(MarkupData);
255
                                    }
256
                                }
257
                                this.dzMainMenu.SelectLayer.Children.Clear();
258
                            }
259
                        }
260
                        
261
                    }
262
                    break;
263
                #endregion
264

    
265
                #region 붙여넣기(Ctrl + V)
266
                case Key.V:
267
                    {
268
                        if (ViewerDataModel.Instance.IsPressCtrl && (App.ViewInfo.CreateFinalPDFPermission || App.ViewInfo.NewCommentPermission))
269
                        {
270
                            //마크업 붙여넣기
271
                            //if (Clipboard.GetText().Contains("|DZ|"))
272
                            if (Clipboard.GetText().Contains("|OR||DZ|"))
273
                            {
274
                                List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>();
275

    
276
                                string[] delimiterChars = { "|OR|" };
277
                                string[] delimiterChars2 = { "|OR|", "|SymbolID|" };
278
                                string[] data = Clipboard.GetText().Split(delimiterChars, StringSplitOptions.RemoveEmptyEntries);
279

    
280
                                SelectionSet.Instance.UnSelect(this.dzMainMenu);
281

    
282
                                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
283

    
284
                                //강인구 Undo/Redo 보류
285
                                UndoData = new Undo_data()
286
                                {
287
                                    IsUndo = false,
288
                                    Event = Event_Type.Create,
289
                                    EventTime = DateTime.Now,
290
                                    Markup_List = new List<Multi_Undo_data>()
291
                                };
292

    
293
                                ViewerDataModel.Instance.UndoDataList.Where(data1 => data1.IsUndo == true).ToList().ForEach(i =>
294
                                {
295
                                    ViewerDataModel.Instance.UndoDataList.Remove(i);
296
                                });
297
                                
298
                                foreach (string parse in data)
299
                                {                                    
300
                                    if(parse != "")
301
                                    {
302
                                        string[] data2 = new string[2];
303
                                        data2 = parse.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries);
304

    
305
                                        System.Windows.Controls.Control item =  MarkupParser.ParseEx(App.ViewInfo.ProjectNO, data2[0], ViewerDataModel.Instance.MarkupControls_USER, string.Empty, string.Empty);
306
                                        (item as MarkupToPDF.Common.CommentUserInfo).CommentID = Commons.shortGuid();
307
                                        if(data2.Length >= 2)
308
                                        {
309
                                            (item as MarkupToPDF.Common.CommentUserInfo).SymbolID = data2[1];
310
                                        }                                        
311
                                        ViewerDataModel.Instance.MarkupControls.Remove(item as MarkupToPDF.Common.CommentUserInfo);
312
                                        ViewerDataModel.Instance.MarkupControls_USER.Remove(item as MarkupToPDF.Common.CommentUserInfo);
313

    
314
                                        adornerSet.Add(item as MarkupToPDF.Common.CommentUserInfo);
315

    
316
                                        //Controls.AdornerFinal final = new Controls.AdornerFinal(item as MarkupToPDF.Common.CommentUserInfo);
317
                                        //this.dzMainMenu.SelectLayer.Children.Add(final);
318

    
319
                                        multi_Undo_Data = dzMainMenu.Control_Style(item as MarkupToPDF.Common.CommentUserInfo);
320

    
321
                                        UndoData.Markup_List.Add(multi_Undo_Data);
322
                                        ViewerDataModel.Instance.UndoDataList.Add(UndoData);                                                                               
323
                                    }
324
                                }
325
                                Controls.AdornerFinal final = new Controls.AdornerFinal(adornerSet);
326

    
327
                                double realPointX = this.dzMainMenu.getCurrentPoint.X - final.BorderSize.X - (final.BorderSize.Width / 2);
328
                                double realPointY = this.dzMainMenu.getCurrentPoint.Y - final.BorderSize.Y - (final.BorderSize.Height / 2);
329
                                final.MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(realPointX, realPointY));
330

    
331
                                if (final.MemberSet.Where(type => type.Drawingtype == MarkupToPDF.Controls.Common.ControlType.TextControl).FirstOrDefault() != null)
332
                                {
333
                                    final.MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(0.001, 0.001)); //dummy
334
                                }
335

    
336
                                this.dzMainMenu.SelectLayer.Children.Add(final);
337

    
338
                                //붙여 넣을때 원본 컨트롤과 겹치지 않도록 설정
339
                                //Canvas.SetLeft(final, 50);
340
                                //Canvas.SetTop(final, 50);
341

    
342
                            }
343
                            //외부 이미지 붙여넣기
344
                            else if (Clipboard.GetImage() != null)
345
                            {
346
                                try
347
                                {
348
                                    Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
349

    
350
                                    //강인구 Undo/Redo 보류
351
                                    UndoData = new Undo_data()
352
                                    {
353
                                        IsUndo = false,
354
                                        Event = Event_Type.Create,
355
                                        EventTime = DateTime.Now,
356
                                        Markup_List = new List<Multi_Undo_data>()
357
                                    };
358

    
359
                                    string temppath = System.IO.Path.GetTempPath();
360
                                    //string filename = KCOM.Events.Save.shortCommentKey();
361
                                    string filename = Commons.shortFileKey();
362

    
363
                                    System.Drawing.Image clipboardImage = System.Windows.Forms.Clipboard.GetImage();
364
                                    clipboardImage.Save(temppath + "\\" + filename);
365

    
366
                                    System.IO.FileInfo fileInfo = new System.IO.FileInfo(temppath + "\\" + filename);
367
                                    String strFile = System.IO.Path.GetFileName(fileInfo.FullName);
368
                                    long numByte = fileInfo.Length;
369
                                    double dLen = Convert.ToDouble(fileInfo.Length / 1000000);
370
                                    kr.co.devdoftech.cloud.FileUpload fileUploader = new kr.co.devdoftech.cloud.FileUpload();
371

    
372
                                    if (dLen < 4)
373
                                    {
374
                                        System.IO.FileStream fStream = new System.IO.FileStream(fileInfo.FullName,
375
                                        System.IO.FileMode.Open, System.IO.FileAccess.Read);
376
                                        System.IO.BinaryReader br = new System.IO.BinaryReader(fStream);
377
                                        byte[] data = br.ReadBytes((int)numByte);
378

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

    
381
                                        Check_Uri.UriCheck(filename);
382

    
383
                                        br.Close();
384
                                        fStream.Close();
385
                                        fStream.Dispose();
386
                                    }
387
                                    else
388
                                    {
389
                                        dzMainMenu.DialogMessage_Alert("Available Memory less than 4 mega byte", "Alert");
390
                                        return;
391
                                    }
392

    
393
                                    fileInfo.Delete();
394

    
395
                                    //System.Drawing.Image clipboardImage = System.Windows.Forms.Clipboard.GetImage();
396
                                    System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(clipboardImage);
397
                                    IntPtr hBitmap = bmp.GetHbitmap();
398
                                    System.Windows.Media.ImageSource WpfBitmap = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(hBitmap, IntPtr.Zero, Int32Rect.Empty, System.Windows.Media.Imaging.BitmapSizeOptions.FromEmptyOptions());
399
                                    Image img = new Image();
400
                                    //img.Source = new System.Windows.Media.Imaging.BitmapImage(new Uri(filename));                            
401
                                    if (filename.Contains(".svg"))
402
                                    {
403
                                        byte[] imageData = null;
404
                                        DrawingImage image = null;
405
                                        using (System.Net.WebClient web = new System.Net.WebClient())
406
                                        {
407
                                            imageData = web.DownloadData(new Uri(filename));
408
                                            System.IO.Stream stream = new System.IO.MemoryStream(imageData);
409
                                            image = SvgReader.Load(stream);
410
                                        }
411
                                        img.Source = image;
412
                                    }
413
                                    else
414
                                    {
415
                                        img.Source = new BitmapImage(new Uri(filename));
416
                                    }
417
                                    var currentControl = new MarkupToPDF.Controls.Etc.ImgControl
418
                                    {
419
                                        PointSet = new List<Point>(),
420
                                        //FilePath = img.Source.ToString(),
421
                                        FilePath = filename,
422
                                        ImageData = img.Source,
423
                                        StartPoint = new Point(100, 100),
424
                                        EndPoint = new Point(200, 200),
425
                                        TopRightPoint = new Point(100, 200),
426
                                        LeftBottomPoint = new Point(200, 100)
427
                                    };
428

    
429
                                    currentControl.TopRightPoint = new Point(currentControl.StartPoint.X + clipboardImage.Width, currentControl.StartPoint.Y);
430
                                    currentControl.LeftBottomPoint = new Point(currentControl.StartPoint.X, currentControl.StartPoint.Y + clipboardImage.Height);
431
                                    currentControl.EndPoint = new Point(currentControl.StartPoint.X + clipboardImage.Width, currentControl.StartPoint.Y + clipboardImage.Height);
432

    
433
                                    currentControl.PointSet = new List<Point>
434
                                        {
435
                                            currentControl.StartPoint,
436
                                            currentControl.LeftBottomPoint,
437
                                            currentControl.EndPoint,
438
                                            currentControl.TopRightPoint,
439
                                        };
440

    
441
                                    multi_Undo_Data = dzMainMenu.Control_Style(currentControl as MarkupToPDF.Common.CommentUserInfo);
442
                                    UndoData.Markup_List.Add(multi_Undo_Data);
443
                                    ViewerDataModel.Instance.UndoDataList.Add(UndoData);
444

    
445
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl as MarkupToPDF.Common.CommentUserInfo);
446
                                    currentControl.CommentID = Commons.shortGuid();
447

    
448
                                    currentControl.ApplyTemplate();
449
                                    currentControl.SetImage();
450

    
451
                                    ViewerDataModel.Instance.MarkupControls_USER.Remove(currentControl as MarkupToPDF.Common.CommentUserInfo);
452
                                    Controls.AdornerFinal final = new Controls.AdornerFinal(currentControl as MarkupToPDF.Common.CommentUserInfo);
453
                                    this.dzMainMenu.SelectLayer.Children.Add(final);
454

    
455
                                    double realPointX = this.dzMainMenu.getCurrentPoint.X - final.BorderSize.X - (final.BorderSize.Width / 2);
456
                                    double realPointY = this.dzMainMenu.getCurrentPoint.Y - final.BorderSize.Y - (final.BorderSize.Height / 2);
457
                                    final.MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(realPointX, realPointY));
458

    
459
                                    #region 주석
460

    
461
                                    //주석
462
                                    //ViewerDataModel.Instance.MarkupControls_USER.Remove(currentControl as MarkupToPDF.Common.CommentUserInfo);
463
                                    //Controls.AdornerFinal final = new Controls.AdornerFinal(currentControl as MarkupToPDF.Common.CommentUserInfo);
464
                                    //this.dzMainMenu.SelectLayer.Children.Add(final);
465

    
466
                                    //string MarkupData = "";
467

    
468
                                    //if (!ViewerDataModel.Instance.MarkupControls.Contains(currentControl))
469
                                    //{
470
                                    //    markupReturn = layer.MarkupToString(currentControl, App.ViewInfo.UserID);
471
                                    //    MarkupData += "|OR|" + markupReturn.ConvertData;
472
                                    //}
473
                                    //Clipboard.SetText(MarkupData);
474
                                    //this.dzMainMenu.SelectLayer.Children.Clear();
475

    
476
                                    //List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>();
477

    
478
                                    //string[] delimiterChars = { "|OR|" };
479
                                    //string[] data1 = Clipboard.GetText().Split(delimiterChars, StringSplitOptions.RemoveEmptyEntries);
480

    
481
                                    //this.dzMainMenu.ReleaseAdorner();
482

    
483
                                    //foreach (string parse in data1)
484
                                    //{
485
                                    //    if (parse != "")
486
                                    //    {
487
                                    //        System.Windows.Controls.Control item = layer.markupParse_Paste(parse, ViewerDataModel.Instance.MarkupControls_USER);
488
                                    //        (item as MarkupToPDF.Common.CommentUserInfo).CommentID = Commons.shortGuid();
489

    
490
                                    //        ViewerDataModel.Instance.MarkupControls.Remove(item as MarkupToPDF.Common.CommentUserInfo);
491
                                    //        ViewerDataModel.Instance.MarkupControls_USER.Remove(item as MarkupToPDF.Common.CommentUserInfo);
492

    
493
                                    //        adornerSet.Add(item as MarkupToPDF.Common.CommentUserInfo);
494

    
495
                                    //        //Controls.AdornerFinal final = new Controls.AdornerFinal(item as MarkupToPDF.Common.CommentUserInfo);
496
                                    //        //this.dzMainMenu.SelectLayer.Children.Add(final);
497
                                    //    }
498
                                    //}
499
                                    //Controls.AdornerFinal final = new Controls.AdornerFinal(adornerSet);
500

    
501
                                    //double realPointX = this.dzMainMenu.getCurrentPoint.X - final.BorderSize.X - (final.BorderSize.Width / 2);
502
                                    //double realPointY = this.dzMainMenu.getCurrentPoint.Y - final.BorderSize.Y - (final.BorderSize.Height / 2);
503
                                    //final.MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(realPointX, realPointY));
504

    
505
                                    //if (final.MemberSet.Where(type => type.Drawingtype == MarkupToPDF.Controls.Common.ControlType.TextControl).FirstOrDefault() != null)
506
                                    //{
507
                                    //    final.MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(0.001, 0.001)); //dummy
508
                                    //}
509

    
510
                                    //this.dzMainMenu.SelectLayer.Children.Add(final); 
511
                                    #endregion
512

    
513
                                }
514
                                catch(Exception ex)
515
                                {
516
                                    Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.DialogMessage_Alert("" + ex, "Alert");
517
                                }
518
                            }
519
                        }                        
520
                    }
521
                    break;
522
                #endregion
523

    
524
                #region 저장하기(Ctrl + S)
525
                case Key.S:
526
                    {
527
                        if (ViewerDataModel.Instance.IsPressCtrl  && (App.ViewInfo.CreateFinalPDFPermission || App.ViewInfo.NewCommentPermission))
528
                        {
529
                            //컨트롤을 그리는 도중일 경우 컨트롤 삭제
530
                            ViewerDataModel.Instance.MarkupControls_USER.Remove(this.dzMainMenu.currentControl);
531
                            this.dzMainMenu.currentControl = null;
532

    
533
                            //this.dzTopMenu.SaveEvent(null, null);
534
                            if (App.ViewInfo.CreateFinalPDFPermission || App.ViewInfo.NewCommentPermission)
535
                            {
536
                                this.dzTopMenu.SaveEvent(new object(), null);
537
                            }
538

    
539
                            //저장완료후 임시파일 삭제
540
                            TempFile.Remove();
541
                        }                       
542
                    }
543
                    break;
544
                #endregion
545

    
546
                #region 프린트하기(Ctrl + P)
547
                case Key.P:
548
                    {
549
                        if (ViewerDataModel.Instance.IsPressCtrl)
550
                        {
551
                            this.dzTopMenu.Print_Start("Print");
552
                        }
553
                    }
554
                    break;
555
                #endregion
556

    
557
                #region Undo(Ctrl + Z)
558
                case Key.Z:
559
                    {
560
                        if (ViewerDataModel.Instance.IsPressCtrl)
561
                        {
562
                            this.dzMainMenu.Undo();
563
                        }                        
564
                    }
565
                    break;
566
                #endregion
567

    
568
                #region Redo(Ctrl + Y)
569
                case Key.Y:
570
                    {
571
                        if (ViewerDataModel.Instance.IsPressCtrl)
572
                        {
573
                            this.dzMainMenu.Redo();
574
                        }
575
                    }
576
                    break;
577
                #endregion
578

    
579
                #region 삭제하기(Delete)
580
                case Key.Delete:
581
                    {
582
                        DeleteCommand.Instance.Execute(this.SelectedItems);
583
                        /*
584
                        if (this.dzMainMenu.SelectLayer.Children.Count > 0)
585
                        {
586
                            UndoData = new Undo_data()
587
                            {
588
                                IsUndo = false,
589
                                Event = Event_Type.Delete,
590
                                EventTime = DateTime.Now,
591
                                Markup_List = new List<Multi_Undo_data>()
592
                            };
593

    
594
                            foreach (var item in this.dzMainMenu.SelectLayer.Children)
595
                            {
596
                                if (item.GetType().Name == "AdornerFinal")
597
                                {
598
                                    (item as Controls.AdornerFinal).unRegister();
599
                                    foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
600
                                    {
601
                                        Multi_Undo_data multi_Undo_Data = new Multi_Undo_data()
602
                                        {
603
                                            Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo
604
                                        };
605
                                        UndoData.Markup_List.Add(multi_Undo_Data);
606

    
607
                                        ViewerDataModel.Instance.MarkupControls_USER.Remove(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo);
608
                                        ViewerDataModel.Instance.MarkupControls.Remove(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo);
609

    
610
                                        var Item_ = ViewerDataModel.Instance.MarkupList_USER.Where(d => d.ID == (InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo).CommentID).FirstOrDefault();
611
                                        ViewerDataModel.Instance.MarkupList_USER.Remove(Item_);
612

    
613
                                        //임시파일에서도 삭제한다.
614
                                        TempFile.DelTemp((InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo).CommentID, dzMainMenu.pageNavigator.CurrentPage.PageNumber.ToString());
615
                                    }
616
                                }
617

    
618
                                ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
619
                                {
620
                                    ViewerDataModel.Instance.UndoDataList.Remove(i);                                    
621
                                });
622
                                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
623
                            }
624
                        }
625
                        */
626

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

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

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

    
655
                        SelectionSet.Instance.UnSelect(this.dzMainMenu);
656

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

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

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

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

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

    
719
                #endregion
720

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

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

    
765

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

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

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

    
812
                    }
813
                    break;
814
                #endregion
815

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