markus / KCOM / Events / Event_KeyEvent.cs.bak @ c73426a9
이력 | 보기 | 이력해설 | 다운로드 (30.6 KB)
1 | 787a4489 | KangIngu | using KCOM.Common; |
---|---|---|---|
2 | using MarkupToPDF.Common; |
||
3 | using System; |
||
4 | using System.Collections.Generic; |
||
5 | using System.ComponentModel; |
||
6 | using System.Linq; |
||
7 | using System.Text; |
||
8 | using System.Windows; |
||
9 | using System.Windows.Controls; |
||
10 | using System.Windows.Input; |
||
11 | using Telerik.Windows.Controls; |
||
12 | |||
13 | namespace KCOM |
||
14 | { |
||
15 | public partial class MainWindow : Window |
||
16 | { |
||
17 | public double CumulativeWheel = 0; |
||
18 | |||
19 | public MarkupToPDF.Common.Undo_data UndoData; |
||
20 | |||
21 | //강인구 추가 |
||
22 | KCOM.Views.MainMenu mainMenu = new Views.MainMenu(); |
||
23 | //강인구 추가 |
||
24 | MarkupToPDF.Controls.Parsing.LayerControl layer = new MarkupToPDF.Controls.Parsing.LayerControl(); |
||
25 | //강인구 추가 |
||
26 | MarkupToPDF.Controls.Parsing.LayerControl.MarkupReturn markupReturn = new MarkupToPDF.Controls.Parsing.LayerControl.MarkupReturn(); |
||
27 | |||
28 | public void KeyEventDownAction(object sender, KeyEventArgs e) |
||
29 | { |
||
30 | |||
31 | layer.ProjectNo = App.ViewInfo.ProjectNO; |
||
32 | switch (e.Key) |
||
33 | { |
||
34 | //강인구 추가 |
||
35 | #region Ctrl |
||
36 | case Key.LeftCtrl: |
||
37 | { |
||
38 | if (!ViewerDataModel.Instance.IsPressCtrl) |
||
39 | { |
||
40 | ViewerDataModel.Instance.IsPressCtrl = true; |
||
41 | } |
||
42 | } |
||
43 | break; |
||
44 | case Key.RightCtrl: |
||
45 | { |
||
46 | |||
47 | } |
||
48 | break; |
||
49 | #endregion |
||
50 | |||
51 | #region Shift |
||
52 | case Key.RightShift: |
||
53 | { |
||
54 | |||
55 | } |
||
56 | break; |
||
57 | case Key.LeftShift: |
||
58 | { |
||
59 | if (!ViewerDataModel.Instance.IsPressShift) |
||
60 | { |
||
61 | ViewerDataModel.Instance.IsPressShift = true; |
||
62 | } |
||
63 | //if (dzMain.deepZoomObject._MouseHelper.isMouseOver && !dzMain.DeepLayer.Drawing) |
||
64 | //{ |
||
65 | // dzMain.deepZoomObject._MouseHelper.isPressShift = true; |
||
66 | // CumulativeWheel += dzMain.deepZoomObject._MouseHelper.wheelDelta; |
||
67 | // dzMain.deepZoomObject._MouseHelper.wheelDelta = 0; |
||
68 | // System.Diagnostics.Debug.WriteLine(CumulativeWheel); |
||
69 | // if (CumulativeWheel == 3 && CumulativeWheel >= 0) |
||
70 | // { |
||
71 | // this.dzMain.pageNavigator.pagebeforetMove(); |
||
72 | // CumulativeWheel = 0; |
||
73 | // } |
||
74 | // else if (CumulativeWheel == -3 && CumulativeWheel <= 0) |
||
75 | // { |
||
76 | // this.dzMain.pageNavigator.pageNextMove(); |
||
77 | // CumulativeWheel = 0; |
||
78 | // } |
||
79 | //} |
||
80 | |||
81 | } |
||
82 | break; |
||
83 | #endregion |
||
84 | |||
85 | //강인구 추가 |
||
86 | #region 단축키 선택 |
||
87 | |||
88 | #region 전체 선택(Ctrl + A) |
||
89 | case Key.A: |
||
90 | { |
||
91 | if (ViewerDataModel.Instance.IsPressCtrl) |
||
92 | { |
||
93 | this.dzMainMenu.InkControl_Convert(); |
||
94 | |||
95 | if (Common.ViewerDataModel.Instance.MarkupControls_USER.Count > 0) |
||
96 | { |
||
97 | //전체 선택 시 선택된 토글 해제 |
||
98 | var TogList = this.dzTopMenu.Parent.ChildrenOfType<RadToggleButton>(); |
||
99 | this.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None; |
||
100 | this.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None; |
||
101 | |||
102 | //컨트롤을 그리는 도중일 경우 컨트롤 삭제 |
||
103 | ViewerDataModel.Instance.MarkupControls_USER.Remove(this.dzMainMenu.currentControl); |
||
104 | this.dzMainMenu.currentControl = null; |
||
105 | |||
106 | foreach (var tog in TogList) |
||
107 | { |
||
108 | tog.IsChecked = false; |
||
109 | } |
||
110 | |||
111 | //선택된 어도너가 있을 시 취소하고 전체 선택 |
||
112 | this.dzMainMenu.ReleaseAdorner(); |
||
113 | |||
114 | UndoData = new Undo_data() |
||
115 | { |
||
116 | IsUndo = false, |
||
117 | Event = Event_Type.Select, |
||
118 | EventTime = DateTime.Now, |
||
119 | Markup_List = new List<Multi_Undo_data>() |
||
120 | }; |
||
121 | |||
122 | List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>(); |
||
123 | var control = ViewerDataModel.Instance.MarkupControls_USER.Where(data => data.GetType().Name != "").ToList(); |
||
124 | Multi_Undo_data multi_Undo_Data = new Multi_Undo_data(); |
||
125 | |||
126 | foreach (var item in control) |
||
127 | { |
||
128 | adornerSet.Add(item); |
||
129 | //multi_Undo_Data.Markup = item; |
||
130 | multi_Undo_Data = this.dzMainMenu.Control_Style(item); |
||
131 | UndoData.Markup_List.Add(multi_Undo_Data); |
||
132 | |||
133 | multi_Undo_Data = new Multi_Undo_data(); |
||
134 | ViewerDataModel.Instance.MarkupControls_USER.Remove(item); |
||
135 | |||
136 | } |
||
137 | |||
138 | if (adornerSet.Count > 0) |
||
139 | { |
||
140 | Controls.AdornerFinal final = new Controls.AdornerFinal(adornerSet); |
||
141 | this.dzMainMenu.SelectLayer.Children.Add(final); |
||
142 | } |
||
143 | |||
144 | ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i => |
||
145 | { |
||
146 | ViewerDataModel.Instance.UndoDataList.Remove(i); |
||
147 | }); |
||
148 | |||
149 | |||
150 | ViewerDataModel.Instance.UndoDataList.Add(UndoData); |
||
151 | } |
||
152 | } |
||
153 | } |
||
154 | break; |
||
155 | #endregion |
||
156 | |||
157 | #region 복사하기(Ctrl + C) |
||
158 | case Key.C: |
||
159 | { |
||
160 | if (ViewerDataModel.Instance.IsPressCtrl) |
||
161 | { |
||
162 | if (this.dzMainMenu.SelectLayer.Children.Count > 0) |
||
163 | { |
||
164 | string MarkupData = ""; |
||
165 | |||
166 | foreach (var item in this.dzMainMenu.SelectLayer.Children) |
||
167 | { |
||
168 | if (item.GetType().Name == "AdornerFinal") |
||
169 | { |
||
170 | foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>()) |
||
171 | |||
172 | { |
||
173 | if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData)) |
||
174 | { |
||
175 | markupReturn = layer.MarkupToString(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo, App.ViewInfo.UserID); |
||
176 | MarkupData += "|OR|" + markupReturn.ConvertData; |
||
177 | } |
||
178 | } |
||
179 | Clipboard.SetText(MarkupData); |
||
180 | } |
||
181 | } |
||
182 | } |
||
183 | } |
||
184 | } |
||
185 | break; |
||
186 | #endregion |
||
187 | |||
188 | #region 잘라내기(Ctrl + X) |
||
189 | case Key.X: |
||
190 | { |
||
191 | if (ViewerDataModel.Instance.IsPressCtrl) |
||
192 | { |
||
193 | if (this.dzMainMenu.SelectLayer.Children.Count > 0) |
||
194 | { |
||
195 | foreach (var item in this.dzMainMenu.SelectLayer.Children) |
||
196 | { |
||
197 | string MarkupData = ""; |
||
198 | |||
199 | if (item.GetType().Name == "AdornerFinal") |
||
200 | { |
||
201 | foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>()) |
||
202 | { |
||
203 | if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData)) |
||
204 | { |
||
205 | markupReturn = layer.MarkupToString(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo, App.ViewInfo.UserID); |
||
206 | MarkupData += "|OR|" + markupReturn.ConvertData; |
||
207 | } |
||
208 | } |
||
209 | Clipboard.SetText(MarkupData); |
||
210 | } |
||
211 | } |
||
212 | this.dzMainMenu.SelectLayer.Children.Clear(); |
||
213 | } |
||
214 | } |
||
215 | } |
||
216 | break; |
||
217 | #endregion |
||
218 | |||
219 | #region 붙여넣기(Ctrl + V) |
||
220 | case Key.V: |
||
221 | { |
||
222 | if (ViewerDataModel.Instance.IsPressCtrl) |
||
223 | { |
||
224 | //마크업 붙여넣기 |
||
225 | if (Clipboard.GetText().Contains("|DZ|")) |
||
226 | { |
||
227 | List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>(); |
||
228 | |||
229 | string[] delimiterChars = { "|OR|" }; |
||
230 | string[] data = Clipboard.GetText().Split(delimiterChars, StringSplitOptions.RemoveEmptyEntries); |
||
231 | |||
232 | this.dzMainMenu.ReleaseAdorner(); |
||
233 | |||
234 | Multi_Undo_data multi_Undo_Data = new Multi_Undo_data(); |
||
235 | |||
236 | //강인구 Undo/Redo 보류 |
||
237 | UndoData = new Undo_data() |
||
238 | { |
||
239 | IsUndo = false, |
||
240 | Event = Event_Type.Create, |
||
241 | EventTime = DateTime.Now, |
||
242 | Markup_List = new List<Multi_Undo_data>() |
||
243 | }; |
||
244 | |||
245 | ViewerDataModel.Instance.UndoDataList.Where(data1 => data1.IsUndo == true).ToList().ForEach(i => |
||
246 | { |
||
247 | ViewerDataModel.Instance.UndoDataList.Remove(i); |
||
248 | }); |
||
249 | |||
250 | foreach (string parse in data) |
||
251 | { |
||
252 | if(parse != "") |
||
253 | { |
||
254 | System.Windows.Controls.Control item = layer.markupParse_Paste(parse, ViewerDataModel.Instance.MarkupControls_USER); |
||
255 | (item as MarkupToPDF.Common.CommentUserInfo).CommentID = Events.Save.shortGuid(); |
||
256 | |||
257 | ViewerDataModel.Instance.MarkupControls.Remove(item as MarkupToPDF.Common.CommentUserInfo); |
||
258 | ViewerDataModel.Instance.MarkupControls_USER.Remove(item as MarkupToPDF.Common.CommentUserInfo); |
||
259 | |||
260 | adornerSet.Add(item as MarkupToPDF.Common.CommentUserInfo); |
||
261 | |||
262 | //Controls.AdornerFinal final = new Controls.AdornerFinal(item as MarkupToPDF.Common.CommentUserInfo); |
||
263 | //this.dzMainMenu.SelectLayer.Children.Add(final); |
||
264 | |||
265 | multi_Undo_Data = dzMainMenu.Control_Style(item as MarkupToPDF.Common.CommentUserInfo); |
||
266 | |||
267 | UndoData.Markup_List.Add(multi_Undo_Data); |
||
268 | ViewerDataModel.Instance.UndoDataList.Add(UndoData); |
||
269 | } |
||
270 | } |
||
271 | Controls.AdornerFinal final = new Controls.AdornerFinal(adornerSet); |
||
272 | |||
273 | double realPointX = this.dzMainMenu.getCurrentPoint.X - final.BorderSize.X - (final.BorderSize.Width / 2); |
||
274 | double realPointY = this.dzMainMenu.getCurrentPoint.Y - final.BorderSize.Y - (final.BorderSize.Height / 2); |
||
275 | final.MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(realPointX, realPointY)); |
||
276 | |||
277 | if (final.MemberSet.Where(type => type.Drawingtype == MarkupToPDF.Controls.Common.ControlType.TextControl).FirstOrDefault() != null) |
||
278 | { |
||
279 | final.MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(0.001, 0.001)); //dummy |
||
280 | } |
||
281 | |||
282 | this.dzMainMenu.SelectLayer.Children.Add(final); |
||
283 | |||
284 | //붙여 넣을때 원본 컨트롤과 겹치지 않도록 설정 |
||
285 | //Canvas.SetLeft(final, 50); |
||
286 | //Canvas.SetTop(final, 50); |
||
287 | } |
||
288 | //외부 이미지 붙여넣기 |
||
289 | else if (Clipboard.GetImage() != null) |
||
290 | { |
||
291 | Multi_Undo_data multi_Undo_Data = new Multi_Undo_data(); |
||
292 | |||
293 | //강인구 Undo/Redo 보류 |
||
294 | UndoData = new Undo_data() |
||
295 | { |
||
296 | IsUndo = false, |
||
297 | Event = Event_Type.Create, |
||
298 | EventTime = DateTime.Now, |
||
299 | Markup_List = new List<Multi_Undo_data>() |
||
300 | }; |
||
301 | |||
302 | |||
303 | string temppath = System.IO.Path.GetTempPath(); |
||
304 | //string filename = KCOM.Events.Save.shortCommentKey(); |
||
305 | string filename = KCOM.Events.Save.shortFileKey(); |
||
306 | |||
307 | System.Drawing.Image clipboardImage = System.Windows.Forms.Clipboard.GetImage(); |
||
308 | clipboardImage.Save(temppath + "\\" + filename); |
||
309 | |||
310 | System.IO.FileInfo fileInfo = new System.IO.FileInfo(temppath + "\\" + filename); |
||
311 | String strFile = System.IO.Path.GetFileName(fileInfo.FullName); |
||
312 | long numByte = fileInfo.Length; |
||
313 | double dLen = Convert.ToDouble(fileInfo.Length / 1000000); |
||
314 | kr.co.devdoftech.cloud.FileUpload fileUploader = new kr.co.devdoftech.cloud.FileUpload(); |
||
315 | |||
316 | if (dLen < 4) |
||
317 | { |
||
318 | System.IO.FileStream fStream = new System.IO.FileStream(fileInfo.FullName, |
||
319 | System.IO.FileMode.Open, System.IO.FileAccess.Read); |
||
320 | System.IO.BinaryReader br = new System.IO.BinaryReader(fStream); |
||
321 | byte[] data = br.ReadBytes((int)numByte); |
||
322 | |||
323 | filename = fileUploader.Run(App.ViewInfo.ProjectNO, this.dzMainMenu._DocItem.DOCUMENT_NO, App.ViewInfo.UserID, strFile + ".png", data); |
||
324 | br.Close(); |
||
325 | fStream.Close(); |
||
326 | fStream.Dispose(); |
||
327 | } |
||
328 | |||
329 | fileInfo.Delete(); |
||
330 | |||
331 | //System.Drawing.Image clipboardImage = System.Windows.Forms.Clipboard.GetImage(); |
||
332 | System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(clipboardImage); |
||
333 | IntPtr hBitmap = bmp.GetHbitmap(); |
||
334 | System.Windows.Media.ImageSource WpfBitmap = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(hBitmap, IntPtr.Zero, Int32Rect.Empty, System.Windows.Media.Imaging.BitmapSizeOptions.FromEmptyOptions()); |
||
335 | Image img = new Image(); |
||
336 | img.Source = new System.Windows.Media.Imaging.BitmapImage(new Uri(filename)); |
||
337 | |||
338 | |||
339 | |||
340 | |||
341 | |||
342 | var currentControl = new MarkupToPDF.Controls.Etc.ImgControl |
||
343 | { |
||
344 | PointSet = new List<Point>(), |
||
345 | FilePath = img.Source.ToString(), |
||
346 | ImageData = img.Source, |
||
347 | StartPoint = new Point(100, 100), |
||
348 | EndPoint = new Point(200, 200), |
||
349 | TopRightPoint = new Point(100, 200), |
||
350 | LeftBottomPoint = new Point(200, 100) |
||
351 | }; |
||
352 | |||
353 | currentControl.TopRightPoint = new Point(currentControl.StartPoint.X + clipboardImage.Width, currentControl.StartPoint.Y); |
||
354 | currentControl.LeftBottomPoint = new Point(currentControl.StartPoint.X, currentControl.StartPoint.Y + clipboardImage.Height); |
||
355 | currentControl.EndPoint = new Point(currentControl.StartPoint.X + clipboardImage.Width, currentControl.StartPoint.Y + clipboardImage.Height); |
||
356 | |||
357 | currentControl.PointSet = new List<Point> |
||
358 | { |
||
359 | currentControl.StartPoint, |
||
360 | currentControl.LeftBottomPoint, |
||
361 | currentControl.EndPoint, |
||
362 | currentControl.TopRightPoint, |
||
363 | }; |
||
364 | |||
365 | multi_Undo_Data = dzMainMenu.Control_Style(currentControl as MarkupToPDF.Common.CommentUserInfo); |
||
366 | UndoData.Markup_List.Add(multi_Undo_Data); |
||
367 | ViewerDataModel.Instance.UndoDataList.Add(UndoData); |
||
368 | |||
369 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl as MarkupToPDF.Common.CommentUserInfo); |
||
370 | currentControl.CommentID = Events.Save.shortGuid(); |
||
371 | |||
372 | currentControl.ApplyTemplate(); |
||
373 | currentControl.SetImage(); |
||
374 | |||
375 | ViewerDataModel.Instance.MarkupControls_USER.Remove(currentControl as MarkupToPDF.Common.CommentUserInfo); |
||
376 | Controls.AdornerFinal final = new Controls.AdornerFinal(currentControl as MarkupToPDF.Common.CommentUserInfo); |
||
377 | this.dzMainMenu.SelectLayer.Children.Add(final); |
||
378 | |||
379 | double realPointX = this.dzMainMenu.getCurrentPoint.X - final.BorderSize.X - (final.BorderSize.Width / 2); |
||
380 | double realPointY = this.dzMainMenu.getCurrentPoint.Y - final.BorderSize.Y - (final.BorderSize.Height / 2); |
||
381 | final.MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(realPointX, realPointY)); |
||
382 | |||
383 | |||
384 | #region 주석 |
||
385 | |||
386 | //주석 |
||
387 | //ViewerDataModel.Instance.MarkupControls_USER.Remove(currentControl as MarkupToPDF.Common.CommentUserInfo); |
||
388 | //Controls.AdornerFinal final = new Controls.AdornerFinal(currentControl as MarkupToPDF.Common.CommentUserInfo); |
||
389 | //this.dzMainMenu.SelectLayer.Children.Add(final); |
||
390 | |||
391 | //string MarkupData = ""; |
||
392 | |||
393 | //if (!ViewerDataModel.Instance.MarkupControls.Contains(currentControl)) |
||
394 | //{ |
||
395 | // markupReturn = layer.MarkupToString(currentControl, App.ViewInfo.UserID); |
||
396 | // MarkupData += "|OR|" + markupReturn.ConvertData; |
||
397 | //} |
||
398 | //Clipboard.SetText(MarkupData); |
||
399 | //this.dzMainMenu.SelectLayer.Children.Clear(); |
||
400 | |||
401 | //List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>(); |
||
402 | |||
403 | //string[] delimiterChars = { "|OR|" }; |
||
404 | //string[] data1 = Clipboard.GetText().Split(delimiterChars, StringSplitOptions.RemoveEmptyEntries); |
||
405 | |||
406 | //this.dzMainMenu.ReleaseAdorner(); |
||
407 | |||
408 | //foreach (string parse in data1) |
||
409 | //{ |
||
410 | // if (parse != "") |
||
411 | // { |
||
412 | // System.Windows.Controls.Control item = layer.markupParse_Paste(parse, ViewerDataModel.Instance.MarkupControls_USER); |
||
413 | // (item as MarkupToPDF.Common.CommentUserInfo).CommentID = Events.Save.shortGuid(); |
||
414 | |||
415 | // ViewerDataModel.Instance.MarkupControls.Remove(item as MarkupToPDF.Common.CommentUserInfo); |
||
416 | // ViewerDataModel.Instance.MarkupControls_USER.Remove(item as MarkupToPDF.Common.CommentUserInfo); |
||
417 | |||
418 | // adornerSet.Add(item as MarkupToPDF.Common.CommentUserInfo); |
||
419 | |||
420 | // //Controls.AdornerFinal final = new Controls.AdornerFinal(item as MarkupToPDF.Common.CommentUserInfo); |
||
421 | // //this.dzMainMenu.SelectLayer.Children.Add(final); |
||
422 | // } |
||
423 | //} |
||
424 | //Controls.AdornerFinal final = new Controls.AdornerFinal(adornerSet); |
||
425 | |||
426 | //double realPointX = this.dzMainMenu.getCurrentPoint.X - final.BorderSize.X - (final.BorderSize.Width / 2); |
||
427 | //double realPointY = this.dzMainMenu.getCurrentPoint.Y - final.BorderSize.Y - (final.BorderSize.Height / 2); |
||
428 | //final.MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(realPointX, realPointY)); |
||
429 | |||
430 | //if (final.MemberSet.Where(type => type.Drawingtype == MarkupToPDF.Controls.Common.ControlType.TextControl).FirstOrDefault() != null) |
||
431 | //{ |
||
432 | // final.MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(0.001, 0.001)); //dummy |
||
433 | //} |
||
434 | |||
435 | //this.dzMainMenu.SelectLayer.Children.Add(final); |
||
436 | #endregion |
||
437 | |||
438 | |||
439 | } |
||
440 | } |
||
441 | } |
||
442 | break; |
||
443 | #endregion |
||
444 | |||
445 | #region 저장하기(Ctrl + S) |
||
446 | case Key.S: |
||
447 | { |
||
448 | if (ViewerDataModel.Instance.IsPressCtrl) |
||
449 | { |
||
450 | //컨트롤을 그리는 도중일 경우 컨트롤 삭제 |
||
451 | ViewerDataModel.Instance.MarkupControls_USER.Remove(this.dzMainMenu.currentControl); |
||
452 | this.dzMainMenu.currentControl = null; |
||
453 | |||
454 | this.dzTopMenu.SaveEvent(null, null); |
||
455 | } |
||
456 | } |
||
457 | break; |
||
458 | #endregion |
||
459 | |||
460 | #region 프린트하기(Ctrl + P) |
||
461 | case Key.P: |
||
462 | { |
||
463 | if (ViewerDataModel.Instance.IsPressCtrl) |
||
464 | { |
||
465 | this.dzTopMenu.Print_Start("Print"); |
||
466 | } |
||
467 | } |
||
468 | break; |
||
469 | #endregion |
||
470 | |||
471 | #region Undo(Ctrl + Z) |
||
472 | case Key.Z: |
||
473 | { |
||
474 | if (ViewerDataModel.Instance.IsPressCtrl) |
||
475 | { |
||
476 | this.dzMainMenu.Undo(); |
||
477 | } |
||
478 | } |
||
479 | break; |
||
480 | #endregion |
||
481 | |||
482 | #region Redo(Ctrl + Y) |
||
483 | case Key.Y: |
||
484 | { |
||
485 | if (ViewerDataModel.Instance.IsPressCtrl) |
||
486 | { |
||
487 | this.dzMainMenu.Redo(); |
||
488 | } |
||
489 | } |
||
490 | break; |
||
491 | #endregion |
||
492 | |||
493 | #region 삭제하기(Delete) |
||
494 | case Key.Delete: |
||
495 | { |
||
496 | if (this.dzMainMenu.SelectLayer.Children.Count > 0) |
||
497 | { |
||
498 | Multi_Undo_data multi_Undo_Data = new Multi_Undo_data(); |
||
499 | |||
500 | UndoData = new Undo_data() |
||
501 | { |
||
502 | IsUndo = false, |
||
503 | Event = Event_Type.Delete, |
||
504 | EventTime = DateTime.Now, |
||
505 | Markup_List = new List<Multi_Undo_data>() |
||
506 | }; |
||
507 | |||
508 | foreach (var item in this.dzMainMenu.SelectLayer.Children) |
||
509 | { |
||
510 | if (item.GetType().Name == "AdornerFinal") |
||
511 | { |
||
512 | //List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>(); |
||
513 | |||
514 | foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>()) |
||
515 | { |
||
516 | if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData)) |
||
517 | { |
||
518 | //this.dzMainMenu.ReleaseAdorner(); |
||
519 | |||
520 | ViewerDataModel.Instance.MarkupControls.Remove(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo); |
||
521 | |||
522 | var Item_ = ViewerDataModel.Instance.MarkupList_USER.Where(d => d.ID == (InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo).CommentID).FirstOrDefault(); |
||
523 | //var Item_ = ViewerDataModel.Instance.MarkupList_USER.Where(d => d.MarkupInfoID == (InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo).MarkupInfoID).FirstOrDefault(); |
||
524 | |||
525 | ViewerDataModel.Instance.MarkupList_USER.Remove(Item_); |
||
526 | |||
527 | //adornerSet.Add((InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo)); |
||
528 | multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo; |
||
529 | UndoData.Markup_List.Add(multi_Undo_Data); |
||
530 | } |
||
531 | } |
||
532 | } |
||
533 | |||
534 | ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i => |
||
535 | { |
||
536 | ViewerDataModel.Instance.UndoDataList.Remove(i); |
||
537 | }); |
||
538 | ViewerDataModel.Instance.UndoDataList.Add(UndoData); |
||
539 | } |
||
540 | } |
||
541 | |||
542 | this.dzMainMenu.SelectLayer.Children.Clear(); |
||
543 | } |
||
544 | break; |
||
545 | #endregion |
||
546 | |||
547 | #region 선택된 컨트롤 모두 해제 하기(ESC) |
||
548 | case Key.Escape: |
||
549 | { |
||
550 | //캡쳐모드 일 경우 초기화 |
||
551 | if(this.dzMainMenu.mouseHandlingMode == IKCOM.MouseHandlingMode.Capture) |
||
552 | { |
||
553 | //dzMainMenu.PN_Navi.IsEnabled = true; |
||
554 | this.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None; |
||
555 | ViewerDataModel.Instance.Capture_Opacity = 0; |
||
556 | } |
||
557 | |||
558 | this.dzMainMenu.ReleaseAdorner(); |
||
559 | |||
560 | //코멘트 그리는 도중일 경우 코멘트 삭제 및 초기화 |
||
561 | ViewerDataModel.Instance.MarkupControls_USER.Remove(this.dzMainMenu.currentControl); |
||
562 | this.dzMainMenu.currentControl = null; |
||
563 | |||
564 | } |
||
565 | break; |
||
566 | #endregion |
||
567 | |||
568 | |||
569 | #endregion |
||
570 | |||
571 | //강인구 추가 |
||
572 | #region Control Move |
||
573 | case Key.Right: |
||
574 | { |
||
575 | |||
576 | } |
||
577 | break; |
||
578 | case Key.Left: |
||
579 | { |
||
580 | |||
581 | } |
||
582 | break; |
||
583 | #endregion |
||
584 | } |
||
585 | } |
||
586 | |||
587 | public void KeyEventUpAction(object sender, KeyEventArgs e) |
||
588 | { |
||
589 | switch (e.Key) |
||
590 | { |
||
591 | //강인구 추가 |
||
592 | #region Ctrl |
||
593 | case Key.LeftCtrl: |
||
594 | { |
||
595 | if (ViewerDataModel.Instance.IsPressCtrl) |
||
596 | { |
||
597 | ViewerDataModel.Instance.IsPressCtrl = false; |
||
598 | } |
||
599 | } |
||
600 | break; |
||
601 | case Key.RightCtrl: |
||
602 | { |
||
603 | |||
604 | } |
||
605 | break; |
||
606 | #endregion |
||
607 | |||
608 | #region Shift |
||
609 | case Key.RightShift: |
||
610 | case Key.LeftShift: |
||
611 | { |
||
612 | ViewerDataModel.Instance.IsPressShift = false; |
||
613 | } |
||
614 | break; |
||
615 | #endregion |
||
616 | } |
||
617 | } |
||
618 | } |
||
619 | } |