프로젝트

일반

사용자정보

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

markus / KCOM / Events / Event_KeyEvent.cs @ 959b3ef2

이력 | 보기 | 이력해설 | 다운로드 (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
        private 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
                                this.dzMainMenu.ReleaseAdorner();
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 != "").ToList();
146
                                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
147

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

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

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

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

    
171

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

    
179
                
180

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

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

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

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

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

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

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

    
279
                                this.dzMainMenu.ReleaseAdorner();
280

    
281
                                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
282

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
380
                                        Check_Uri.UriCheck(filename);
381

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

    
392
                                    fileInfo.Delete();
393

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

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

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

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

    
444
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl as MarkupToPDF.Common.CommentUserInfo);
445
                                    currentControl.CommentID = Events.Save.shortGuid();
446

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

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

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

    
458
                                    #region 주석
459

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

    
465
                                    //string MarkupData = "";
466

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
654
                        this.dzMainMenu.ReleaseAdorner();
655

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

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

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

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

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

    
718
                #endregion
719

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

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

    
764

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

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

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

    
811
                    }
812
                    break;
813
                #endregion
814

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