markus / KCOM / Views / MainMenu.xaml.cs @ 66351e6d
이력 | 보기 | 이력해설 | 다운로드 (273 KB)
1 | 787a4489 | KangIngu | |
---|---|---|---|
2 | 2b9b3656 | taeseongkim | using IKCOM; |
3 | using KCOM.Common; |
||
4 | using KCOM.Controls; |
||
5 | using KCOM.Events; |
||
6 | using KCOMDataModel.DataModel; |
||
7 | using MarkupToPDF.Common; |
||
8 | using MarkupToPDF.Controls.Cad; |
||
9 | 787a4489 | KangIngu | using MarkupToPDF.Controls.Common; |
10 | 2b9b3656 | taeseongkim | using MarkupToPDF.Controls.Etc; |
11 | 787a4489 | KangIngu | using MarkupToPDF.Controls.Line; |
12 | 2b9b3656 | taeseongkim | using MarkupToPDF.Controls.Parsing; |
13 | 787a4489 | KangIngu | using MarkupToPDF.Controls.Polygon; |
14 | using MarkupToPDF.Controls.Shape; |
||
15 | using MarkupToPDF.Controls.Text; |
||
16 | 2b9b3656 | taeseongkim | using Svg2Xaml; |
17 | 787a4489 | KangIngu | using System; |
18 | using System.Collections.Generic; |
||
19 | 2b9b3656 | taeseongkim | using System.Diagnostics; |
20 | 787a4489 | KangIngu | using System.Linq; |
21 | 2b9b3656 | taeseongkim | using System.Reflection; |
22 | using System.Runtime.InteropServices; |
||
23 | 787a4489 | KangIngu | using System.Text; |
24 | 2b9b3656 | taeseongkim | using System.Threading; |
25 | using System.Threading.Tasks; |
||
26 | using System.Web; |
||
27 | 787a4489 | KangIngu | using System.Windows; |
28 | using System.Windows.Controls; |
||
29 | 2b9b3656 | taeseongkim | using System.Windows.Ink; |
30 | 787a4489 | KangIngu | using System.Windows.Input; |
31 | using System.Windows.Media; |
||
32 | using System.Windows.Media.Imaging; |
||
33 | using System.Windows.Shapes; |
||
34 | 6707a5c7 | ljiyeon | using System.Windows.Threading; |
35 | 2b9b3656 | taeseongkim | using Telerik.Windows.Controls; |
36 | fddb48f7 | ljiyeon | using Telerik.Windows.Data; |
37 | 2b9b3656 | taeseongkim | using static KCOM.TempFile; |
38 | 787a4489 | KangIngu | |
39 | namespace KCOM.Views |
||
40 | { |
||
41 | public static class ControlExtensions |
||
42 | { |
||
43 | public static T Clone<T>(this T controlToClone) |
||
44 | where T : System.Windows.Controls.Control |
||
45 | { |
||
46 | System.Reflection.PropertyInfo[] controlProperties = typeof(T).GetProperties(System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance); |
||
47 | |||
48 | T instance = Activator.CreateInstance<T>(); |
||
49 | |||
50 | foreach (PropertyInfo propInfo in controlProperties) |
||
51 | { |
||
52 | if (propInfo.CanWrite) |
||
53 | { |
||
54 | if (propInfo.Name != "WindowTarget") |
||
55 | propInfo.SetValue(instance, propInfo.GetValue(controlToClone, null), null); |
||
56 | } |
||
57 | } |
||
58 | return instance; |
||
59 | } |
||
60 | } |
||
61 | |||
62 | a0bab669 | KangIngu | public class MyConsole |
63 | { |
||
64 | private readonly System.Threading.ManualResetEvent _readLineSignal; |
||
65 | private string _lastLine; |
||
66 | public MyConsole() |
||
67 | { |
||
68 | _readLineSignal = new System.Threading.ManualResetEvent(false); |
||
69 | Gui = new TextBox(); |
||
70 | Gui.AcceptsReturn = true; |
||
71 | Gui.KeyUp += OnKeyUp; |
||
72 | } |
||
73 | |||
74 | private void OnKeyUp(object sender, KeyEventArgs e) |
||
75 | { |
||
76 | // this is always fired on UI thread |
||
77 | if (e.Key == Key.Enter) |
||
78 | { |
||
79 | // quick and dirty, but that is not relevant to your question |
||
80 | _lastLine = Gui.Text.Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries).Last(); |
||
81 | // now, when you detected that user typed a line, set signal |
||
82 | _readLineSignal.Set(); |
||
83 | } |
||
84 | } |
||
85 | |||
86 | public TextBox Gui { get; private set; } |
||
87 | |||
88 | public string ReadLine() |
||
89 | { |
||
90 | // that should always be called from non-ui thread |
||
91 | if (Gui.Dispatcher.CheckAccess()) |
||
92 | throw new Exception("Cannot be called on UI thread"); |
||
93 | // reset signal |
||
94 | _readLineSignal.Reset(); |
||
95 | // wait until signal is set. This call is blocking, but since we are on non-ui thread - there is no problem with that |
||
96 | _readLineSignal.WaitOne(); |
||
97 | // we got signalled - return line user typed. |
||
98 | return _lastLine; |
||
99 | } |
||
100 | |||
101 | public void WriteLine(string line) |
||
102 | { |
||
103 | if (!Gui.Dispatcher.CheckAccess()) |
||
104 | { |
||
105 | Gui.Dispatcher.Invoke(new Action(() => WriteLine(line))); |
||
106 | return; |
||
107 | } |
||
108 | |||
109 | Gui.Text += line + Environment.NewLine; |
||
110 | } |
||
111 | } |
||
112 | |||
113 | 787a4489 | KangIngu | /// <summary> |
114 | /// MainMenu.xaml에 대한 상호 작용 논리 |
||
115 | /// </summary> |
||
116 | public partial class MainMenu : UserControl |
||
117 | { |
||
118 | #region 프로퍼티 |
||
119 | public CommentUserInfo currentControl { get; set; } |
||
120 | public ControlType controlType { get; set; } |
||
121 | e6a9ddaf | humkyung | private Move move = new Move(); |
122 | 787a4489 | KangIngu | private double[] rotateValue = { 0, 90, 180, 270 }; |
123 | public MouseHandlingMode mouseHandlingMode = MouseHandlingMode.None; |
||
124 | private static readonly double DragThreshold = 5; |
||
125 | eb2b9248 | KangIngu | private System.Windows.Input.Cursor cursor { get; set; } |
126 | c7fde400 | taeseongkim | |
127 | /// <summary> |
||
128 | /// 문서의 마우스 위치 |
||
129 | /// </summary> |
||
130 | public Point CanvasDrawingMouseDownPoint; |
||
131 | |||
132 | 787a4489 | KangIngu | public string filename { get; set; } |
133 | private Point canvasZoomPanningMouseDownPoint; |
||
134 | public Point getCurrentPoint; |
||
135 | private Point canvasZoommovingMouseDownPoint; |
||
136 | List<object> ControlList = new List<object>(); |
||
137 | private ListBox listBox = new ListBox(); |
||
138 | private Dictionary<Geometry, string> selected_item = new Dictionary<Geometry, string>(); |
||
139 | private bool isDraggingSelectionRect = false; |
||
140 | DrawingAttributes inkDA = new DrawingAttributes(); |
||
141 | private VPRevision CurrentRev { get; set; } |
||
142 | public RadRibbonButton btnConsolidate { get; set; } |
||
143 | public RadRibbonButton btnFinalPDF { get; set; } |
||
144 | public RadRibbonButton btnTeamConsolidate { get; set; } |
||
145 | 80458c15 | ljiyeon | public RadRibbonButton btnConsolidateFinalPDF { get; set; } |
146 | |||
147 | 787a4489 | KangIngu | public string Filename_ { get; set; } |
148 | public double L_Size = 0; |
||
149 | public AdornerFinal adorner_; |
||
150 | public Multi_Undo_data multi_Undo_Data; |
||
151 | 5ce56a3a | KangIngu | public string Symbol_ID = ""; |
152 | 787a4489 | KangIngu | /// <summary> |
153 | /// Set to 'true' when the left mouse-button is down. |
||
154 | /// </summary> |
||
155 | 9f473fb7 | KangIngu | public bool isLeftMouseButtonDownOnWindow = false; |
156 | 787a4489 | KangIngu | |
157 | public InkPresenter _InkBoard = null; |
||
158 | Stroke stroke; |
||
159 | Boolean IsDrawing = false; |
||
160 | StylusPointCollection strokePoints; |
||
161 | 53880c83 | ljiyeon | //StylusPointCollection erasePoints; |
162 | 787a4489 | KangIngu | RenderTargetBitmap canvasImage; |
163 | Point Sync_Offset_Point; |
||
164 | |||
165 | //강인구 테스트 |
||
166 | private Path _SelectionPath { get; set; } |
||
167 | public Path SelectionPath |
||
168 | { |
||
169 | get |
||
170 | { |
||
171 | return _SelectionPath; |
||
172 | } |
||
173 | set |
||
174 | { |
||
175 | if (_SelectionPath != value) |
||
176 | { |
||
177 | _SelectionPath = value; |
||
178 | RaisePropertyChanged("SelectionPath"); |
||
179 | |||
180 | } |
||
181 | } |
||
182 | } |
||
183 | |||
184 | private System.Windows.Controls.Image _imageViewer { get; set; } |
||
185 | public System.Windows.Controls.Image imageViewer |
||
186 | { |
||
187 | get |
||
188 | { |
||
189 | if (_imageViewer == null) |
||
190 | { |
||
191 | _imageViewer = new System.Windows.Controls.Image(); |
||
192 | return _imageViewer; |
||
193 | } |
||
194 | else |
||
195 | { |
||
196 | return _imageViewer; |
||
197 | } |
||
198 | } |
||
199 | set |
||
200 | { |
||
201 | if (_imageViewer != value) |
||
202 | { |
||
203 | _imageViewer = value; |
||
204 | } |
||
205 | } |
||
206 | } |
||
207 | |||
208 | public bool IsSyncPDFMode { get; set; } |
||
209 | |||
210 | private System.Windows.Controls.Image _imageViewer_Compare { get; set; } |
||
211 | public System.Windows.Controls.Image imageViewer_Compare |
||
212 | { |
||
213 | get |
||
214 | { |
||
215 | if (_imageViewer_Compare == null) |
||
216 | { |
||
217 | _imageViewer_Compare = new System.Windows.Controls.Image(); |
||
218 | return _imageViewer_Compare; |
||
219 | } |
||
220 | else |
||
221 | { |
||
222 | return _imageViewer_Compare; |
||
223 | } |
||
224 | } |
||
225 | set |
||
226 | { |
||
227 | if (_imageViewer_Compare != value) |
||
228 | { |
||
229 | _imageViewer_Compare = value; |
||
230 | } |
||
231 | } |
||
232 | } |
||
233 | |||
234 | #endregion |
||
235 | 90e7968d | ljiyeon | |
236 | 787a4489 | KangIngu | public MainMenu() |
237 | { |
||
238 | f65e6c02 | taeseongkim | //App.splashString(ISplashMessage.MAINMENU_0); |
239 | InitializeComponent(); |
||
240 | |||
241 | dea506e2 | taeseongkim | //List<testItem> testItems = new List<testItem> |
242 | //{ |
||
243 | // new testItem{Title = "test1"}, |
||
244 | // new testItem{Title = "test2"}, |
||
245 | // new testItem{Title = "test3"}, |
||
246 | // new testItem{Title = "test4"}, |
||
247 | //}; |
||
248 | f65e6c02 | taeseongkim | |
249 | dea506e2 | taeseongkim | //lstSymbolPrivate.ItemsSource = testItems; |
250 | f65e6c02 | taeseongkim | |
251 | 90e7968d | ljiyeon | this.Loaded += MainMenu_Loaded; |
252 | 787a4489 | KangIngu | } |
253 | 6707a5c7 | ljiyeon | |
254 | public class TempDt |
||
255 | { |
||
256 | public int PageNumber { get; set; } |
||
257 | public string CommentID { get; set; } |
||
258 | public string ConvertData { get; set; } |
||
259 | public int DATA_TYPE { get; set; } |
||
260 | public string MarkupInfoID { get; set; } |
||
261 | public int IsUpdate { get; set; } |
||
262 | } |
||
263 | |||
264 | List<TempDt> tempDtList = new List<TempDt>(); |
||
265 | 90e7968d | ljiyeon | |
266 | 787a4489 | KangIngu | private void SetCursor() |
267 | { |
||
268 | this.Cursor = cursor; |
||
269 | } |
||
270 | |||
271 | 69f41aab | humkyung | /// <summary> |
272 | /// get image url |
||
273 | /// </summary> |
||
274 | /// <author>humkyung</author> |
||
275 | /// <param name="sDocumentID"></param> |
||
276 | /// <returns></returns> |
||
277 | 6dcbe4a7 | humkyung | public string GetImageURL(string sDocumentID, int iPageNo) |
278 | 69f41aab | humkyung | { |
279 | string uri = string.Empty; |
||
280 | |||
281 | string sFolder = sDocumentID.All(char.IsDigit) ? (Convert.ToUInt32(sDocumentID) / 100).ToString() : (sDocumentID.Length >= 5 ? sDocumentID.Substring(0, 5) : sDocumentID); |
||
282 | if (userData.COMPANY != "EXT") |
||
283 | { |
||
284 | uri = String.Format(CommonLib.Common.GetConfigString("mainServerImageWebPath", "URL", "", App.isExternal), _ViewInfo.ProjectNO, sFolder, sDocumentID, iPageNo); |
||
285 | } |
||
286 | else |
||
287 | { |
||
288 | uri = String.Format(CommonLib.Common.GetConfigString("subServerImageWebPath", "URL", "", App.isExternal), _ViewInfo.ProjectNO, sDocumentID, iPageNo); |
||
289 | } |
||
290 | |||
291 | return uri; |
||
292 | } |
||
293 | |||
294 | 52827a4c | djkim | /// <summary> |
295 | /// 외부망에서의 Original PDF Download 를 위한 리소스 web path 경로로 치환 |
||
296 | /// </summary> |
||
297 | /// <returns></returns> |
||
298 | public string GetOriginalPDFURL() |
||
299 | { |
||
300 | string uri = string.Empty; |
||
301 | string sDocumentID = this._DocItem.DOCUMENT_ID; |
||
302 | string filename = string.Empty; |
||
303 | if (this._DocInfo.ORIGINAL_FILE.Contains("fileName")) |
||
304 | { |
||
305 | filename = HttpUtility.ParseQueryString(this._DocInfo.ORIGINAL_FILE).Get("fileName"); |
||
306 | } |
||
307 | else |
||
308 | { |
||
309 | filename = System.IO.Path.GetFileName(this._DocInfo.ORIGINAL_FILE); |
||
310 | } |
||
311 | 0f26a9aa | taeseongkim | |
312 | 52827a4c | djkim | string sFolder = sDocumentID.All(char.IsDigit) ? (Convert.ToUInt32(sDocumentID) / 100).ToString() : (sDocumentID.Length >= 5 ? sDocumentID.Substring(0, 5) : sDocumentID); |
313 | if (userData.COMPANY != "EXT") |
||
314 | { |
||
315 | uri = String.Format(CommonLib.Common.GetConfigString("mainServerImageWebPath", "URL", "", App.isExternal), _ViewInfo.ProjectNO, sFolder, sDocumentID, filename); |
||
316 | } |
||
317 | else |
||
318 | { |
||
319 | uri = String.Format(CommonLib.Common.GetConfigString("subServerImageWebPath", "URL", "", App.isExternal), _ViewInfo.ProjectNO, sDocumentID, filename); |
||
320 | } |
||
321 | uri = uri.Replace(".png", ""); |
||
322 | return uri; |
||
323 | } |
||
324 | 0f26a9aa | taeseongkim | |
325 | 787a4489 | KangIngu | private bool IsDrawingEnable(Point _canvasZoomPanningMouseDownPoint) |
326 | { |
||
327 | if ((_canvasZoomPanningMouseDownPoint.X > 0 && |
||
328 | ca40e004 | ljiyeon | zoomAndPanCanvas.ActualWidth > _canvasZoomPanningMouseDownPoint.X) && |
329 | (_canvasZoomPanningMouseDownPoint.Y > 0 && |
||
330 | zoomAndPanCanvas.ActualHeight > _canvasZoomPanningMouseDownPoint.Y)) |
||
331 | 787a4489 | KangIngu | { |
332 | return true; |
||
333 | } |
||
334 | |||
335 | return false; |
||
336 | } |
||
337 | |||
338 | ca40e004 | ljiyeon | private bool IsRotationDrawingEnable(Point _canvasZoomPanningMouseDownPoint) |
339 | { |
||
340 | if (rotate.Angle == 90 || rotate.Angle == 270) |
||
341 | { |
||
342 | if ((_canvasZoomPanningMouseDownPoint.X > 0 && |
||
343 | zoomAndPanCanvas.ActualHeight > _canvasZoomPanningMouseDownPoint.X) && |
||
344 | (_canvasZoomPanningMouseDownPoint.Y > 0 && |
||
345 | zoomAndPanCanvas.ActualWidth > _canvasZoomPanningMouseDownPoint.Y)) |
||
346 | { |
||
347 | return true; |
||
348 | } |
||
349 | } |
||
350 | else |
||
351 | { |
||
352 | if ((_canvasZoomPanningMouseDownPoint.X > 0 && |
||
353 | zoomAndPanCanvas.ActualWidth > _canvasZoomPanningMouseDownPoint.X) && |
||
354 | (_canvasZoomPanningMouseDownPoint.Y > 0 && |
||
355 | zoomAndPanCanvas.ActualHeight > _canvasZoomPanningMouseDownPoint.Y)) |
||
356 | { |
||
357 | return true; |
||
358 | } |
||
359 | 90e7968d | ljiyeon | } |
360 | ca40e004 | ljiyeon | |
361 | return false; |
||
362 | } |
||
363 | |||
364 | 787a4489 | KangIngu | public void DeleteItem(MarkupInfoItem item) |
365 | { |
||
366 | if (PreviewUserMarkupInfoItem != null && item.Consolidate == 1 && item.AvoidConsolidate == 0) |
||
367 | { |
||
368 | 4eb052e4 | ljiyeon | App.Custom_ViewInfoId = PreviewUserMarkupInfoItem.MarkupInfoID; } |
369 | 787a4489 | KangIngu | |
370 | 4eb052e4 | ljiyeon | |
371 | 787a4489 | KangIngu | ViewerDataModel.Instance._markupInfoList.Remove(item); |
372 | |||
373 | ViewerDataModel.Instance.MarkupControls.Where(data => data.MarkupInfoID == item.MarkupInfoID).ToList().ForEach(a => |
||
374 | { |
||
375 | ViewerDataModel.Instance.MarkupControls.Remove(a); |
||
376 | }); |
||
377 | |||
378 | ViewerDataModel.Instance.MarkupControls_USER.Where(data => data.MarkupInfoID == item.MarkupInfoID).ToList().ForEach(a => |
||
379 | { |
||
380 | ViewerDataModel.Instance.MarkupControls_USER.Remove(a); |
||
381 | 39f0624f | ljiyeon | ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.MarkupListUpdate( |
382 | 4eb052e4 | ljiyeon | null, Event_Type.Delete, a.CommentID, null); |
383 | 787a4489 | KangIngu | }); |
384 | |||
385 | d62c0439 | humkyung | ViewerDataModel.Instance.MyMarkupList.Where(data => data.MarkupInfoID == item.MarkupInfoID).ToList().ForEach(a => |
386 | 787a4489 | KangIngu | { |
387 | d62c0439 | humkyung | ViewerDataModel.Instance.MyMarkupList.Remove(a); |
388 | 6707a5c7 | ljiyeon | //임시파일에서도 삭제 |
389 | 4eb052e4 | ljiyeon | TempFile.DelTemp(a.ID, this.ParentOfType<MainWindow>().dzMainMenu.pageNavigator.CurrentPage.PageNumber.ToString()); |
390 | 787a4489 | KangIngu | }); |
391 | |||
392 | gridViewMarkup.ItemsSource = ViewerDataModel.Instance._markupInfoList; |
||
393 | bb3a236d | ljiyeon | |
394 | 787a4489 | KangIngu | if (PreviewUserMarkupInfoItem == null && gridViewMarkup.SelectedItems.Where(d => (d as MarkupInfoItem).UserID == App.ViewInfo.UserID).FirstOrDefault() == null) |
395 | { |
||
396 | if (gridViewMarkup.Items.Cast<MarkupInfoItem>().ToList().Where(d => d.UserID == App.ViewInfo.UserID).Count() == 0) |
||
397 | { |
||
398 | 24678e06 | humkyung | var infoId = Commons.shortGuid(); |
399 | 787a4489 | KangIngu | PreviewUserMarkupInfoItem = new MarkupInfoItem |
400 | { |
||
401 | CreateTime = DateTime.Now, |
||
402 | Depatment = userData.DEPARTMENT, |
||
403 | 992a98b4 | KangIngu | UpdateTime = DateTime.Now, |
404 | 787a4489 | KangIngu | DisplayColor = "#FFFF0000", |
405 | UserID = userData.ID, |
||
406 | UserName = userData.NAME, |
||
407 | PageCount = 1, |
||
408 | Description = "", |
||
409 | MarkupInfoID = infoId, |
||
410 | MarkupList = null, |
||
411 | 24678e06 | humkyung | MarkupVersionID = Commons.shortGuid(), |
412 | 787a4489 | KangIngu | Consolidate = 0, |
413 | PartConsolidate = 0, |
||
414 | userDelete = true, |
||
415 | AvoidConsolidate = 0, |
||
416 | IsPreviewUser = true |
||
417 | }; |
||
418 | App.Custom_ViewInfoId = infoId; |
||
419 | } |
||
420 | } |
||
421 | 0f065e57 | ljiyeon | Logger.sendReqLog("DeleteMarkupAsync", App.ViewInfo.ProjectNO + "," + item.MarkupInfoID, 1); |
422 | 4eb052e4 | ljiyeon | BaseClient.DeleteMarkupAsync(App.ViewInfo.ProjectNO, item.MarkupInfoID); |
423 | 787a4489 | KangIngu | } |
424 | |||
425 | 959b3ef2 | humkyung | /// <summary> |
426 | /// delete selected comments |
||
427 | /// </summary> |
||
428 | /// <param name="sender"></param> |
||
429 | /// <param name="e"></param> |
||
430 | 787a4489 | KangIngu | public void DeleteCommentEvent(object sender, RoutedEventArgs e) |
431 | { |
||
432 | d7e20d2d | taeseongkim | //정말 삭제 하시겠습니까? |
433 | 17202508 | ljiyeon | DialogParameters parameters = new DialogParameters() |
434 | c35e49f5 | ljiyeon | { |
435 | 17202508 | ljiyeon | Owner = Application.Current.MainWindow, |
436 | 3d4d6da9 | ljiyeon | Content = new TextBlock() |
437 | { |
||
438 | MinWidth = 400, |
||
439 | FontSize = 11, |
||
440 | d7e20d2d | taeseongkim | Text = "Are you sure you want to delete?", |
441 | 3d4d6da9 | ljiyeon | TextWrapping = System.Windows.TextWrapping.Wrap |
442 | }, |
||
443 | 17202508 | ljiyeon | Header = "Confirm", |
444 | Theme = new VisualStudio2013Theme(), |
||
445 | ModalBackground = new SolidColorBrush { Color = Colors.Black, Opacity = 0.6 }, |
||
446 | OkButtonContent = "Yes", |
||
447 | CancelButtonContent = "No", |
||
448 | Closed = delegate (object windowSender, WindowClosedEventArgs wc) |
||
449 | { |
||
450 | if(wc.DialogResult == true) |
||
451 | { |
||
452 | //선택된 어도너가 있을시 삭제가 되지 않음 |
||
453 | SelectionSet.Instance.UnSelect(this); |
||
454 | 787a4489 | KangIngu | |
455 | 17202508 | ljiyeon | Button content = (sender as Button); |
456 | MarkupInfoItem item = content.CommandParameter as MarkupInfoItem; |
||
457 | 787a4489 | KangIngu | |
458 | 17202508 | ljiyeon | DeleteItem(item); |
459 | } |
||
460 | } |
||
461 | }; |
||
462 | RadWindow.Confirm(parameters); |
||
463 | 787a4489 | KangIngu | } |
464 | |||
465 | System.Windows.Media.Animation.DoubleAnimation da = new System.Windows.Media.Animation.DoubleAnimation(); |
||
466 | |||
467 | 6707a5c7 | ljiyeon | private static Timer timer; |
468 | private int InitInterval = KCOM.Properties.Settings.Default.InitInterval; |
||
469 | 787a4489 | KangIngu | private void MainMenu_Loaded(object sender, RoutedEventArgs e) |
470 | 90e7968d | ljiyeon | { |
471 | f65e6c02 | taeseongkim | //InitializeComponent(); |
472 | 90e7968d | ljiyeon | //System.Diagnostics.Debug.WriteLine("MainMenu() : " + sw.ElapsedMilliseconds.ToString() + "ms"); |
473 | |||
474 | 787a4489 | KangIngu | if (App.ParameterMode) |
475 | 6707a5c7 | ljiyeon | { |
476 | f7caaaaf | ljiyeon | App.splashString(ISplashMessage.MAINMENU_1); |
477 | 54a28343 | taeseongkim | this.pageNavigator.ThumbInitialized += pageNavigator_ThumbInitialized; |
478 | 6707a5c7 | ljiyeon | this.pageNavigator.PageChanging += pageNavigator_PageChanging; |
479 | afaa7c92 | djkim | this.pageNavigator.PageChanged += PageNavigator_PageChanged; |
480 | 6707a5c7 | ljiyeon | imageViewer_Compare = new Image(); |
481 | ViewerDataModel.Instance.Capture_Opacity = 0; |
||
482 | da.From = 0.8; |
||
483 | da.To = 0; |
||
484 | da.Duration = new Duration(TimeSpan.FromSeconds(1)); |
||
485 | da.AutoReverse = true; |
||
486 | e0204db0 | djkim | da.RepeatBehavior = System.Windows.Media.Animation.RepeatBehavior.Forever; |
487 | |||
488 | if (!App.ViewInfo.CreateFinalPDFPermission && !App.ViewInfo.NewCommentPermission) |
||
489 | 90e7968d | ljiyeon | { |
490 | e0204db0 | djkim | this.SymbolPane.Visibility = Visibility.Collapsed; |
491 | this.FavoritePane.Visibility = Visibility.Collapsed; |
||
492 | this.drawingRotateCanvas.IsHitTestVisible = false; |
||
493 | 90e7968d | ljiyeon | } |
494 | 8411f02d | ljiyeon | thumbnailPanel.Width = Convert.ToInt32(CommonLib.Common.GetConfigString("SetThumbnail", "WIDTH", "250")); |
495 | 6707a5c7 | ljiyeon | } |
496 | 6af42ff0 | taeseongkim | |
497 | 90e7968d | ljiyeon | timer = new Timer(timercallback, null, 0, InitInterval * 60000); |
498 | 6af42ff0 | taeseongkim | |
499 | ccf944bb | ljiyeon | } |
500 | |||
501 | 6af42ff0 | taeseongkim | private async Task DownloadOriginalFileAsync() |
502 | { |
||
503 | try |
||
504 | { |
||
505 | using (System.Net.WebClient client = new System.Net.WebClient()) |
||
506 | { |
||
507 | string instnaceFile = System.IO.Path.GetTempFileName().Replace(".pdf", ".tmp"); |
||
508 | string downloadurl = GetOriginalPDFURL(); |
||
509 | |||
510 | // canceltoken을 위해서 상위에 선언 |
||
511 | var task = client.DownloadFileTaskAsync(new Uri(downloadurl), instnaceFile); |
||
512 | |||
513 | client.DownloadProgressChanged += (snd, evt) => |
||
514 | { |
||
515 | ViewerDataModel.Instance.DownloadFileProgress = evt.ProgressPercentage; |
||
516 | |||
517 | //System.Diagnostics.Debug.WriteLine($"Download Progress {evt.ProgressPercentage}% {evt.BytesReceived}/{evt.TotalBytesToReceive}(Byte)"); |
||
518 | }; |
||
519 | |||
520 | await task; |
||
521 | |||
522 | ViewerDataModel.Instance.SystemMain.dzMainMenu.searchPanel_Instance.SetSerachPDFFile(instnaceFile); |
||
523 | ViewerDataModel.Instance.IsDownloadOriginal = true; |
||
524 | ViewerDataModel.Instance.OriginalTempFile = instnaceFile; |
||
525 | } |
||
526 | } |
||
527 | catch (Exception ex) |
||
528 | { |
||
529 | Logger.sendResLog("DownloadOriginalFileAsync", ex.Message, 0); |
||
530 | } |
||
531 | } |
||
532 | afaa7c92 | djkim | |
533 | 6707a5c7 | ljiyeon | private void timercallback(Object o) |
534 | ccf944bb | ljiyeon | { |
535 | 6707a5c7 | ljiyeon | Stopwatch sw = new Stopwatch(); |
536 | sw.Start(); |
||
537 | 3b484ebb | ljiyeon | TempFile.TempFileAdd(); |
538 | 6707a5c7 | ljiyeon | sw.Stop(); |
539 | ccf944bb | ljiyeon | |
540 | 90e7968d | ljiyeon | Dispatcher.InvokeAsync(new Action(delegate |
541 | ccf944bb | ljiyeon | { |
542 | 6707a5c7 | ljiyeon | if (this.ParentOfType<MainWindow>().dzTopMenu.cbAutoSave.IsChecked == true) //Auto Save Checked? |
543 | { |
||
544 | timer.Change(((int)this.ParentOfType<MainWindow>().dzTopMenu.cbSaveInterval.Value * 60000) / 2, sw.ElapsedMilliseconds); //Timer Setting |
||
545 | } |
||
546 | })); |
||
547 | ccf944bb | ljiyeon | |
548 | 90e7968d | ljiyeon | ////GC.Collect(); |
549 | 6707a5c7 | ljiyeon | } |
550 | 077896be | humkyung | |
551 | d62c0439 | humkyung | /// <summary> |
552 | /// update my markuplist |
||
553 | /// - update existing markup data if already exist |
||
554 | /// - add new markup data if control is new |
||
555 | /// </summary> |
||
556 | public void UpdateMyMarkupList() |
||
557 | 787a4489 | KangIngu | { |
558 | 548c696e | ljiyeon | Logger.sendCheckLog("pageNavigator_PageChanging_ChangeCommentReact", 1); |
559 | 787a4489 | KangIngu | |
560 | d62c0439 | humkyung | /// add or update markup list |
561 | foreach (var control in ViewerDataModel.Instance.MarkupControls_USER) |
||
562 | 787a4489 | KangIngu | { |
563 | d62c0439 | humkyung | var root = MarkupParser.MarkupToString(control, App.ViewInfo.UserID); |
564 | 90e7968d | ljiyeon | |
565 | d62c0439 | humkyung | var exist = ViewerDataModel.Instance.MyMarkupList.Where(data => data.ID == root.CommentID).FirstOrDefault(); |
566 | if (exist != null) //신규 추가 된 코멘트 |
||
567 | { |
||
568 | if (exist.Data != root.ConvertData) //코멘트가 같은지 |
||
569 | 6707a5c7 | ljiyeon | { |
570 | d62c0439 | humkyung | exist.Data = root.ConvertData; |
571 | exist.IsUpdate = true; |
||
572 | 6707a5c7 | ljiyeon | } |
573 | d62c0439 | humkyung | } |
574 | else if (root.CommentID != null) |
||
575 | { |
||
576 | ViewerDataModel.Instance.MyMarkupList.Add(new MarkupItemEx |
||
577 | 6707a5c7 | ljiyeon | { |
578 | d62c0439 | humkyung | ID = control.CommentID, |
579 | Data = root.ConvertData, |
||
580 | Data_Type = root.DATA_TYPE, |
||
581 | MarkupInfoID = App.Custom_ViewInfoId, |
||
582 | PageNumber = this.pageNavigator.CurrentPage.PageNumber, |
||
583 | Symbol_ID = control.SymbolID, |
||
584 | c0977e97 | djkim | //Group_ID = control.GroupID, |
585 | d62c0439 | humkyung | }); |
586 | 787a4489 | KangIngu | } |
587 | } |
||
588 | |||
589 | 0585d5cc | taeseongkim | if(this.pageNavigator.CurrentPage != null) |
590 | { |
||
591 | /// delete markup list |
||
592 | int iPageNo = this.pageNavigator.CurrentPage.PageNumber; |
||
593 | 6b6e937c | taeseongkim | |
594 | 0585d5cc | taeseongkim | var deleted = (from markup in ViewerDataModel.Instance.MyMarkupList |
595 | where (markup.PageNumber == iPageNo) |
||
596 | && (null == ViewerDataModel.Instance.MarkupControls_USER.Where(control => control.CommentID == markup.ID).FirstOrDefault()) |
||
597 | select markup).ToList(); |
||
598 | 6b6e937c | taeseongkim | |
599 | 0585d5cc | taeseongkim | foreach (var markup in deleted) |
600 | { |
||
601 | ViewerDataModel.Instance.MyMarkupList.Remove(markup); |
||
602 | } |
||
603 | } |
||
604 | else |
||
605 | 6b6e937c | taeseongkim | { |
606 | 0585d5cc | taeseongkim | System.Diagnostics.Debug.WriteLine("UpdateMyMarkupList : this.pageNavigator.CurrentPage null "); |
607 | 6b6e937c | taeseongkim | } |
608 | 0585d5cc | taeseongkim | |
609 | d62c0439 | humkyung | /// up to here |
610 | 6707a5c7 | ljiyeon | |
611 | 129ca191 | humkyung | //if (modified) |
612 | //{ |
||
613 | // if (ViewerDataModel.Instance._markupInfoList.Where(info => info.UserID == PreviewUserMarkupInfoItem.UserID).FirstOrDefault() == null) |
||
614 | // { |
||
615 | // ComingNewBieEnd = true; |
||
616 | // ViewerDataModel.Instance._markupInfoList.Insert(0, PreviewUserMarkupInfoItem); |
||
617 | // PreviewUserMarkupInfoItem.IsPreviewUser = false; |
||
618 | // gridViewMarkup.ItemsSource = null; |
||
619 | // gridViewMarkup.ItemsSource = ViewerDataModel.Instance._markupInfoList; |
||
620 | // gridViewMarkup.SelectedItem = PreviewUserMarkupInfoItem; |
||
621 | |||
622 | // GroupDescriptor descriptor = new GroupDescriptor(); |
||
623 | // descriptor.Member = "Depatment"; |
||
624 | // descriptor.DisplayContent = "DEPT"; |
||
625 | // descriptor.SortDirection = ListSortDirection.Ascending; |
||
626 | // gridViewMarkup.GroupDescriptors.Add(descriptor); |
||
627 | // } |
||
628 | //} |
||
629 | 787a4489 | KangIngu | } |
630 | |||
631 | cdfb57ff | taeseongkim | DispatcherTimer renderTesttimer; |
632 | |||
633 | cb5c7f06 | humkyung | /// <summary> |
634 | /// start page changing |
||
635 | /// - save controls if page is modified |
||
636 | /// - starting download page image |
||
637 | /// </summary> |
||
638 | /// <param name="sender"></param> |
||
639 | /// <param name="e"></param> |
||
640 | cdfb57ff | taeseongkim | private async void pageNavigator_PageChanging(object sender, Controls.Sample.PageChangeEventArgs e) |
641 | 548c696e | ljiyeon | { |
642 | 72424099 | taeseongkim | await Task.Delay(10); |
643 | d7e20d2d | taeseongkim | |
644 | 72424099 | taeseongkim | // 마크업 로드 |
645 | //await this.Dispatcher.InvokeAsync(()=>MarkupLoad(e.PageNumber)); |
||
646 | await MarkupLoadAsync(e.PageNumber); |
||
647 | e8557bd7 | taeseongkim | |
648 | dea506e2 | taeseongkim | // 페이지 이미지 변경 |
649 | d7e20d2d | taeseongkim | await PageChangingAsync(e.CurrentPage, e.PageNumber); |
650 | } |
||
651 | |||
652 | private async Task PageChangingAsync(DOCPAGE currentPage, int changePageNumber) |
||
653 | { |
||
654 | 787a4489 | KangIngu | CompareMode.IsChecked = false; |
655 | d7e20d2d | taeseongkim | var BalancePoint = ViewerDataModel.Instance.PageBalanceMode == true ? changePageNumber + ViewerDataModel.Instance.PageBalanceNumber : changePageNumber; |
656 | f4ec4218 | taeseongkim | |
657 | 787a4489 | KangIngu | #region 페이지가 벗어난 경우 |
658 | |||
659 | if (BalancePoint < 1) |
||
660 | { |
||
661 | BalancePoint = 1; |
||
662 | ViewerDataModel.Instance.PageBalanceNumber = 0; |
||
663 | } |
||
664 | |||
665 | if (pageNavigator.PageCount < BalancePoint) |
||
666 | { |
||
667 | BalancePoint = pageNavigator.PageCount; |
||
668 | ViewerDataModel.Instance.PageBalanceNumber = 0; |
||
669 | } |
||
670 | |||
671 | #endregion |
||
672 | |||
673 | ViewerDataModel.Instance.PageNumber = BalancePoint; |
||
674 | |||
675 | d7e20d2d | taeseongkim | var pageWidth = Convert.ToDouble(currentPage.PAGE_WIDTH); |
676 | var pageHeight = Convert.ToDouble(currentPage.PAGE_HEIGHT); |
||
677 | cdfb57ff | taeseongkim | var contentScale = zoomAndPanControl.ContentScale; |
678 | 8614f701 | taeseongkim | |
679 | 92442e4a | taeseongkim | #region 페이지 이미지 로딩 수정 |
680 | 8a9f6742 | djkim | |
681 | 54a28343 | taeseongkim | ViewerDataModel.Instance.ImageViewPath = await App.PageStorage.GetPageImageAsync(changePageNumber); |
682 | d7e20d2d | taeseongkim | |
683 | d48260a2 | djkim | ScaleImage(pageWidth, pageHeight); |
684 | |||
685 | ViewerDataModel.Instance.ImageViewWidth = pageWidth; |
||
686 | ViewerDataModel.Instance.ImageViewHeight = pageHeight; |
||
687 | |||
688 | zoomAndPanCanvas.Width = pageWidth; |
||
689 | zoomAndPanCanvas.Height = pageHeight; |
||
690 | |||
691 | Common.ViewerDataModel.Instance.ContentWidth = pageWidth; |
||
692 | Common.ViewerDataModel.Instance.ContentHeight = pageHeight; |
||
693 | |||
694 | inkBoard.Width = pageWidth; |
||
695 | inkBoard.Height = pageHeight; |
||
696 | cdfb57ff | taeseongkim | |
697 | #endregion |
||
698 | 90e7968d | ljiyeon | |
699 | 787a4489 | KangIngu | if (!testPanel2.IsHidden) |
700 | { |
||
701 | 548c696e | ljiyeon | Logger.sendCheckLog("pageNavigator_PageChanging_!testPanel2.IsHidden 일 때", 1); |
702 | 787a4489 | KangIngu | //PDF모드일때 잠시 대기(강인구) |
703 | if (IsSyncPDFMode) |
||
704 | { |
||
705 | Get_FinalImage.Get_PdfImage get_PdfImage = new Get_FinalImage.Get_PdfImage(); |
||
706 | var pdfpath = new BitmapImage(new Uri(get_PdfImage.Run(CurrentRev.TO_VENDOR, App.ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, ViewerDataModel.Instance.PageNumber))); |
||
707 | |||
708 | 548c696e | ljiyeon | Logger.sendCheckLog("pageNavigator_PageChanging_pdfpath Image Downloading", 1); |
709 | 787a4489 | KangIngu | if (pdfpath.IsDownloading) |
710 | { |
||
711 | pdfpath.DownloadCompleted += (ex, arg) => |
||
712 | { |
||
713 | 548c696e | ljiyeon | Logger.sendCheckLog("pageNavigator_PageChanging_pdfpath Image DownloadCompleted", 1); |
714 | 787a4489 | KangIngu | ViewerDataModel.Instance.ImageViewPath_C = pdfpath; |
715 | ViewerDataModel.Instance.ImageViewWidth_C = pdfpath.PixelWidth; |
||
716 | ViewerDataModel.Instance.ImageViewHeight_C = pdfpath.PixelHeight; |
||
717 | zoomAndPanCanvas2.Width = pdfpath.PixelWidth; |
||
718 | zoomAndPanCanvas2.Height = pdfpath.PixelHeight; |
||
719 | }; |
||
720 | } |
||
721 | else |
||
722 | { |
||
723 | 548c696e | ljiyeon | Logger.sendCheckLog("pageNavigator_PageChanging_pdfpath Image Page Setting", 1); |
724 | 787a4489 | KangIngu | ViewerDataModel.Instance.ImageViewPath_C = pdfpath; |
725 | ViewerDataModel.Instance.ImageViewWidth_C = pdfpath.PixelWidth; |
||
726 | ViewerDataModel.Instance.ImageViewHeight_C = pdfpath.PixelHeight; |
||
727 | |||
728 | zoomAndPanCanvas2.Width = pdfpath.PixelWidth; |
||
729 | zoomAndPanCanvas2.Height = pdfpath.PixelHeight; |
||
730 | } |
||
731 | } |
||
732 | else |
||
733 | { |
||
734 | 548c696e | ljiyeon | Logger.sendCheckLog("pageNavigator_PageChanging_uri2 값 설정", 1); |
735 | 69f41aab | humkyung | string uri2 = this.GetImageURL(CurrentRev.DOCUMENT_ID, BalancePoint); |
736 | a1716fa5 | KangIngu | |
737 | 548c696e | ljiyeon | Logger.sendCheckLog("pageNavigator_PageChanging_defaultBitmapImage_Compare BitmapImage 설정", 1); |
738 | 16f1ded9 | ljiyeon | var defaultBitmapImage_Compare = new BitmapImage(); |
739 | bb4e3ec4 | djkim | defaultBitmapImage_Compare.BeginInit(); |
740 | 94b7c12c | djkim | defaultBitmapImage_Compare.CreateOptions = BitmapCreateOptions.IgnoreImageCache; |
741 | bb4e3ec4 | djkim | defaultBitmapImage_Compare.CacheOption = BitmapCacheOption.OnLoad; |
742 | defaultBitmapImage_Compare.UriSource = new Uri(uri2); |
||
743 | 94b7c12c | djkim | //defaultBitmapImage_Compare.DecodePixelWidth = Int32.Parse(e.CurrentPage.PAGE_WIDTH); |
744 | //defaultBitmapImage_Compare.DecodePixelHeight = Int32.Parse(e.CurrentPage.PAGE_HEIGHT); |
||
745 | bb4e3ec4 | djkim | defaultBitmapImage_Compare.EndInit(); |
746 | 787a4489 | KangIngu | |
747 | bb4e3ec4 | djkim | ViewerDataModel.Instance.ImageViewPath_C = null; |
748 | 787a4489 | KangIngu | |
749 | 548c696e | ljiyeon | Logger.sendCheckLog("pageNavigator_PageChanging_zoomAndPanControl ZoomTo 설정", 1); |
750 | 787a4489 | KangIngu | zoomAndPanControl.ZoomTo(new Rect |
751 | { |
||
752 | X = 0, |
||
753 | Y = 0, |
||
754 | Width = Math.Max(zoomAndPanCanvas.Width, zoomAndPanCanvas2.Width), |
||
755 | Height = Math.Max(zoomAndPanCanvas.Height, zoomAndPanCanvas2.Height), |
||
756 | }); |
||
757 | |||
758 | 548c696e | ljiyeon | Logger.sendCheckLog("pageNavigator_PageChanging_defaultBitmapImage_Compare Downloading", 1); |
759 | 787a4489 | KangIngu | if (defaultBitmapImage_Compare.IsDownloading) |
760 | { |
||
761 | defaultBitmapImage_Compare.DownloadCompleted += (ex, arg) => |
||
762 | { |
||
763 | bb4e3ec4 | djkim | defaultBitmapImage_Compare.Freeze(); |
764 | 787a4489 | KangIngu | ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare; |
765 | ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth; |
||
766 | ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight; |
||
767 | 94b7c12c | djkim | ComparePanel.UpdateLayout(); |
768 | 787a4489 | KangIngu | zoomAndPanCanvas2.Width = defaultBitmapImage_Compare.PixelWidth; |
769 | zoomAndPanCanvas2.Height = defaultBitmapImage_Compare.PixelHeight; |
||
770 | |||
771 | zoomAndPanControl.ZoomTo(new Rect |
||
772 | { |
||
773 | X = 0, |
||
774 | Y = 0, |
||
775 | Width = Math.Max(zoomAndPanCanvas.Width, zoomAndPanCanvas2.Width), |
||
776 | Height = Math.Max(zoomAndPanCanvas.Height, zoomAndPanCanvas2.Height), |
||
777 | }); |
||
778 | bb4e3ec4 | djkim | |
779 | //defaultBitmapImage_Compare dispose |
||
780 | defaultBitmapImage_Compare = null; |
||
781 | GC.Collect(); |
||
782 | 787a4489 | KangIngu | }; |
783 | } |
||
784 | } |
||
785 | tlSyncPageNum.Text = String.Format("Current Page : {0}", BalancePoint); |
||
786 | } |
||
787 | |||
788 | f4ec4218 | taeseongkim | SearchFocusBorder.Visibility = Visibility.Collapsed; |
789 | |||
790 | d7e20d2d | taeseongkim | this.pageNavigator.ChangePage(changePageNumber); |
791 | cdfb57ff | taeseongkim | } |
792 | |||
793 | 3ffd4b2d | humkyung | /// <summary> |
794 | /// called after page is changed |
||
795 | /// </summary> |
||
796 | /// <param name="sender"></param> |
||
797 | /// <param name="e"></param> |
||
798 | a1142a6b | taeseongkim | private async void PageNavigator_PageChanged(object sender, Sample.PageChangeEventArgs e) |
799 | 3ffd4b2d | humkyung | { |
800 | a1142a6b | taeseongkim | //if (zoomAndPanCanvas.Width.IsNaN()) |
801 | //{ |
||
802 | d7e20d2d | taeseongkim | |
803 | await zoomAndPanControl.Dispatcher.InvokeAsync(() => |
||
804 | a1142a6b | taeseongkim | zoomAndPanControl.ZoomTo(new Rect { X = 0, Y = 0, Width = zoomAndPanCanvas.Width, Height = zoomAndPanCanvas.Height }) |
805 | ); |
||
806 | //} |
||
807 | 315ae55e | taeseongkim | |
808 | d7e20d2d | taeseongkim | var instanceMain = ViewerDataModel.Instance.SystemMain; |
809 | |||
810 | 315ae55e | taeseongkim | instanceMain.dzMainMenu.CanvasDrawingMouseDownPoint = new Point(ViewerDataModel.Instance.ImageViewWidth / 2, ViewerDataModel.Instance.ImageViewHeight / 2); |
811 | |||
812 | d7e20d2d | taeseongkim | instanceMain.dzTopMenu.tlcurrentPage.Text = e.CurrentPage.PAGE_NUMBER.ToString(); |
813 | instanceMain.dzTopMenu.tlcurrentPage_readonly.Text = e.CurrentPage.PAGE_NUMBER.ToString(); |
||
814 | |||
815 | instanceMain.dzTopMenu.rotateOffSet = 0; |
||
816 | var pageinfo = this.CurrentDoc.docInfo.DOCPAGE.Where(p => p.PAGE_NUMBER == e.CurrentPage.PAGE_NUMBER).FirstOrDefault(); |
||
817 | drawingPannelRotate(pageinfo.PAGE_ANGLE); |
||
818 | |||
819 | /// 페이지의 모든 마크업을 로드한 후 호출 |
||
820 | /// 좌측 마크업 list의 아이템을 클릭하는 경우 MarkupControls_USER가 0으로 나와서 추가함. |
||
821 | ViewerDataModel.Instance.LoadPageMarkup(); |
||
822 | e1c892f7 | taeseongkim | |
823 | //Point startPoint = new Point(15, 15); |
||
824 | |||
825 | |||
826 | //var markupinfo = ViewerDataModel.Instance._markupInfoList.Where(x => x.UserID == App.ViewInfo.UserID).First(); |
||
827 | |||
828 | ////var rect = GetRectControl(Convert.ToDouble(pageinfo.PAGE_WIDTH), Convert.ToDouble(pageinfo.PAGE_HEIGHT), markupinfo.UserID, markupinfo.MarkupInfoID, startPoint); |
||
829 | |||
830 | ////var txtApproved = GetTextControl(Convert.ToDouble(pageinfo.PAGE_WIDTH), Convert.ToDouble(pageinfo.PAGE_HEIGHT), markupinfo.UserID, markupinfo.MarkupInfoID, |
||
831 | //// "APPROVED",30, FontWeights.Bold, TextAlignment.Center, rect.ItemRect, 15); |
||
832 | |||
833 | ////var txtCreator = GetTextControl(Convert.ToDouble(pageinfo.PAGE_WIDTH), Convert.ToDouble(pageinfo.PAGE_HEIGHT), markupinfo.UserID, markupinfo.MarkupInfoID |
||
834 | //// , "By HYOSUNG", 18, FontWeights.Bold, TextAlignment.Center, rect.ItemRect, txtApproved.StartPoint.Y + txtApproved.BoxHeight + 3); |
||
835 | |||
836 | //var symCtrl = GetSymNControl(Convert.ToDouble(pageinfo.PAGE_WIDTH), Convert.ToDouble(pageinfo.PAGE_HEIGHT), markupinfo.UserID, markupinfo.MarkupInfoID, startPoint); |
||
837 | |||
838 | //var bottom = Rect.Offset(symCtrl.ItemRect, new Vector(0, symCtrl.ItemRect.Height)); |
||
839 | |||
840 | //var txtOriginator = GetTextControl(Convert.ToDouble(pageinfo.PAGE_WIDTH), Convert.ToDouble(pageinfo.PAGE_HEIGHT), markupinfo.UserID, markupinfo.MarkupInfoID |
||
841 | // , App.ViewInfo.UserID, 18, FontWeights.Bold, TextAlignment.Left, bottom, bottom.Top + 3); |
||
842 | |||
843 | //var dtfi = new System.Globalization.DateTimeFormatInfo { DateSeparator = "-", ShortDatePattern = @"yyyy/MM/dd" }; |
||
844 | |||
845 | //var txtDate = GetTextControl(Convert.ToDouble(pageinfo.PAGE_WIDTH), Convert.ToDouble(pageinfo.PAGE_HEIGHT), markupinfo.UserID, markupinfo.MarkupInfoID |
||
846 | // , DateTime.Now.ToString("d", dtfi), 18, FontWeights.Bold, TextAlignment.Left, bottom, txtOriginator.StartPoint.Y + txtOriginator.BoxHeight + 2); |
||
847 | |||
848 | //ViewerDataModel.Instance.MarkupControls_USER.Add(symCtrl); |
||
849 | ////ViewerDataModel.Instance.MarkupControls_USER.Add(txtApproved); |
||
850 | ////ViewerDataModel.Instance.MarkupControls_USER.Add(txtCreator); |
||
851 | //ViewerDataModel.Instance.MarkupControls_USER.Add(txtOriginator); |
||
852 | //ViewerDataModel.Instance.MarkupControls_USER.Add(txtDate); |
||
853 | |||
854 | //symCtrl.ApplyTemplate(); |
||
855 | ////txtApproved.ApplyTemplate(); |
||
856 | ////txtCreator.ApplyTemplate(); |
||
857 | //txtOriginator.ApplyTemplate(); |
||
858 | //txtDate.ApplyTemplate(); |
||
859 | |||
860 | ////SetTextControl(txtApproved); |
||
861 | ////SetTextControl(txtCreator); |
||
862 | //SetTextControl(txtOriginator); |
||
863 | //SetTextControl(txtDate); |
||
864 | |||
865 | //multi_Undo_Data = new Multi_Undo_data(); |
||
866 | |||
867 | //MarkupToPDF.Common.Undo_data UndoData = new Undo_data() |
||
868 | //{ |
||
869 | // IsUndo = false, |
||
870 | // Event = Event_Type.Create, |
||
871 | // EventTime = DateTime.Now, |
||
872 | // Markup_List = new List<Multi_Undo_data>() |
||
873 | //}; |
||
874 | |||
875 | //multi_Undo_Data = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.Control_Style(symCtrl as MarkupToPDF.Common.CommentUserInfo); |
||
876 | //UndoData.Markup_List.Add(multi_Undo_Data); |
||
877 | |||
878 | ////multi_Undo_Data = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.Control_Style(txtApproved as MarkupToPDF.Common.CommentUserInfo); |
||
879 | ////UndoData.Markup_List.Add(multi_Undo_Data); |
||
880 | |||
881 | ////multi_Undo_Data = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.Control_Style(txtCreator as MarkupToPDF.Common.CommentUserInfo); |
||
882 | ////UndoData.Markup_List.Add(multi_Undo_Data); |
||
883 | |||
884 | //multi_Undo_Data = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.Control_Style(txtOriginator as MarkupToPDF.Common.CommentUserInfo); |
||
885 | //UndoData.Markup_List.Add(multi_Undo_Data); |
||
886 | |||
887 | //multi_Undo_Data = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.Control_Style(txtDate as MarkupToPDF.Common.CommentUserInfo); |
||
888 | //UndoData.Markup_List.Add(multi_Undo_Data); |
||
889 | |||
890 | //ViewerDataModel.Instance.UndoDataList.Add(UndoData); |
||
891 | |||
892 | //System.Diagnostics.Debug.WriteLine(symCtrl.GetMarkupData(App.ViewInfo.UserID, 1, markupinfo.MarkupVersionID).DATA); |
||
893 | ////System.Diagnostics.Debug.WriteLine(txtApproved.GetMarkupData(App.ViewInfo.UserID, 1, markupinfo.MarkupVersionID).DATA); |
||
894 | ////System.Diagnostics.Debug.WriteLine(txtCreator.GetMarkupData(App.ViewInfo.UserID, 1, markupinfo.MarkupVersionID).DATA); |
||
895 | //System.Diagnostics.Debug.WriteLine(txtOriginator.GetMarkupData(App.ViewInfo.UserID, 1, markupinfo.MarkupVersionID).DATA); |
||
896 | //System.Diagnostics.Debug.WriteLine(txtDate.GetMarkupData(App.ViewInfo.UserID, 1, markupinfo.MarkupVersionID).DATA); |
||
897 | } |
||
898 | |||
899 | private void SetTextControl(TextControl textControl) |
||
900 | { |
||
901 | textControl.Base_TextBlock.Margin = new Thickness(0, 0, 10, 0); |
||
902 | textControl.Base_TextBox.Visibility = Visibility.Collapsed; |
||
903 | textControl.Base_TextBlock.Visibility = Visibility.Visible; |
||
904 | |||
905 | } |
||
906 | |||
907 | private SymControlN GetSymNControl(double PageWidth, double PageHeight, string userId, string markupInfoId, Point startPosition) |
||
908 | { |
||
909 | SymControlN result = null; |
||
910 | |||
911 | try |
||
912 | { |
||
913 | double height = 80; |
||
914 | double itemWidth = 180; |
||
915 | |||
916 | System.Windows.Point startPoint = new System.Windows.Point(startPosition.X, startPosition.Y); |
||
917 | System.Windows.Point endPoint = new System.Windows.Point(startPosition.X + itemWidth, startPosition.Y + height); |
||
918 | System.Windows.Point leftBottomPoint = new System.Windows.Point(startPosition.X, startPosition.Y + height); |
||
919 | System.Windows.Point topRightPoint = new System.Windows.Point(startPosition.X + itemWidth, startPosition.Y); |
||
920 | |||
921 | result = new SymControlN |
||
922 | { |
||
923 | CommentID = Commons.shortGuid(), |
||
924 | MarkupInfoID = markupInfoId, |
||
925 | UserID = userId, |
||
926 | PointSet = new List<Point> { startPoint, leftBottomPoint, endPoint, topRightPoint }, |
||
927 | StartPoint = startPoint, |
||
928 | EndPoint = endPoint, |
||
929 | CommentAngle = 0, |
||
930 | LeftBottomPoint = leftBottomPoint, |
||
931 | TopRightPoint = topRightPoint, |
||
932 | Opacity = 1, |
||
933 | PathXathData = "eJy1Ul1PwjAU/SvN9c3EdY5g1FAShyIxRgygxsemu7AbupZ0Vae/3g42/Azxxfuw9Z7Tnpx72t6lo4zdyAIFyHUBqwptSgG596tTzkuVYyHLqCDlbGnnPlK24C9k5hVP4viIV7LQfOWwROOlJ2ug36tVo1Sq5cLZJ5P1e1OrKRtYbV3qnsqcrZcC9oZNARuvpCL/KiCODoHxfo//EJmg8tIsNLKpd+hVLmBIWkPd2iU2cnGoFprlpJYGyzBOt8WuyeCVJSNgUstCM/1WHNgDZT5oJ3E4M0Ja5F7A8QmwgTTPIYlrnAfgIIm6W2hmVy3CN9M3GUzsyznOyVAdTBlG+NxvxffXx37nOlF3Fx3vppNd5P6nnL8bnWHlU23VktUrAWe3t5Px/cU5sKE1/qFRuKi8k6nV2Qae0ltIshPXncPNtX25lZF19BY2Sn2maWGK8GQEDMIXHbB7dJ7Ur1RrUcDmbXx3l76y0eN4endz+Qd/yX/663xk2v7eAQ==", |
||
934 | Memo = null |
||
935 | }; |
||
936 | |||
937 | } |
||
938 | catch (Exception ex) |
||
939 | { |
||
940 | System.Diagnostics.Debug.WriteLine(ex.ToString()); |
||
941 | } |
||
942 | |||
943 | return result; |
||
944 | } |
||
945 | |||
946 | private RectangleControl GetRectControl(double PageWidth, double PageHeight, string userId,string markupInfoId, Point startPosition) |
||
947 | { |
||
948 | RectangleControl result = null; |
||
949 | |||
950 | try |
||
951 | { |
||
952 | double height = 80; |
||
953 | double itemWidth = 180; |
||
954 | |||
955 | System.Windows.Point startPoint = new System.Windows.Point(startPosition.X, startPosition.Y); |
||
956 | System.Windows.Point endPoint = new System.Windows.Point(startPosition.X + itemWidth, startPosition.Y + height); |
||
957 | System.Windows.Point leftBottomPoint = new System.Windows.Point(startPosition.X, startPosition.Y + height); |
||
958 | System.Windows.Point topRightPoint = new System.Windows.Point(startPosition.X + itemWidth, startPosition.Y); |
||
959 | |||
960 | result = new RectangleControl |
||
961 | { |
||
962 | CommentID = Commons.shortGuid(), |
||
963 | MarkupInfoID = markupInfoId, |
||
964 | LineSize = 5, |
||
965 | Paint = MarkupToPDF.Controls.Common.PaintSet.None, |
||
966 | StartPoint = startPoint, |
||
967 | EndPoint = endPoint, |
||
968 | CommentAngle = 0, |
||
969 | StrokeColor = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromArgb(255, 255, 0x0, 0x0)), |
||
970 | //StrokeColor = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromArgb(255, 64, 224, 208)), |
||
971 | FillColor = null, |
||
972 | DashSize = new System.Windows.Media.DoubleCollection(new[] { 999999.0 }), |
||
973 | Opacity = 1, |
||
974 | LeftBottomPoint = leftBottomPoint, |
||
975 | TopRightPoint = topRightPoint, |
||
976 | PointSet = new List<Point> { startPoint,leftBottomPoint,endPoint,topRightPoint }, |
||
977 | UserID = userId, |
||
978 | Memo = null |
||
979 | }; |
||
980 | |||
981 | } |
||
982 | catch (Exception ex) |
||
983 | { |
||
984 | System.Diagnostics.Debug.WriteLine(ex.ToString()); |
||
985 | } |
||
986 | |||
987 | return result; |
||
988 | } |
||
989 | |||
990 | |||
991 | |||
992 | private TextControl GetTextControl(double PageWidth, double PageHeight, string userId, string markupInfoId, string Text,double fontSize, FontWeight fontWeight,TextAlignment textAlignment, Rect parentRect,double positionY) |
||
993 | { |
||
994 | TextControl result = null; |
||
995 | |||
996 | try |
||
997 | { |
||
998 | |||
999 | var txtSize = ShapeMeasure(new TextBlock { Text = Text, FontSize = fontSize, FontWeight = fontWeight,FontFamily = new FontFamily("Tahoma") }); |
||
1000 | |||
1001 | double startPositionX = parentRect.X; |
||
1002 | |||
1003 | switch (textAlignment) |
||
1004 | { |
||
1005 | case TextAlignment.Right: |
||
1006 | startPositionX = parentRect.X + parentRect.Width - txtSize.Width; |
||
1007 | break; |
||
1008 | case TextAlignment.Center: |
||
1009 | startPositionX = parentRect.X + parentRect.Width / 2 - txtSize.Width / 2 - 3; |
||
1010 | break; |
||
1011 | } |
||
1012 | |||
1013 | Point startPosition = new Point |
||
1014 | { |
||
1015 | X = startPositionX, |
||
1016 | Y = positionY |
||
1017 | }; |
||
1018 | |||
1019 | System.Windows.Point startPoint = new System.Windows.Point(startPosition.X, startPosition.Y); |
||
1020 | System.Windows.Point endPoint = new System.Windows.Point(startPosition.X + txtSize.Width, startPosition.Y + txtSize.Height); |
||
1021 | System.Windows.Point leftBottomPoint = new System.Windows.Point(startPosition.X, startPosition.Y + txtSize.Height); |
||
1022 | System.Windows.Point topRightPoint = new System.Windows.Point(startPosition.X + txtSize.Width, startPosition.Y); |
||
1023 | |||
1024 | result = new TextControl |
||
1025 | { |
||
1026 | CommentID = Commons.shortGuid(), |
||
1027 | MarkupInfoID = markupInfoId, |
||
1028 | Text = Text, |
||
1029 | StartPoint = startPoint, |
||
1030 | EndPoint = endPoint, |
||
1031 | CanvasX = startPosition.X, |
||
1032 | CanvasY = startPosition.Y, |
||
1033 | BoxWidth = txtSize.Width, |
||
1034 | BoxHeight = txtSize.Height, |
||
1035 | ControlType_No = 0, |
||
1036 | LineSize = new Thickness(5), |
||
1037 | TextSize = fontSize, |
||
1038 | Foreground = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromArgb(255, 255, 0, 0)), |
||
1039 | FontSize = 10, |
||
1040 | UserID = userId, |
||
1041 | IsHighLight = false, |
||
1042 | CommentAngle = 0, |
||
1043 | PointSet = new List<Point>(), |
||
1044 | Opacity = 1, |
||
1045 | IsSelected = false, |
||
1046 | TextFamily = new FontFamily("Tahoma"), |
||
1047 | TextStyle = FontStyles.Normal, |
||
1048 | TextWeight = FontWeights.Bold |
||
1049 | }; |
||
1050 | |||
1051 | } |
||
1052 | catch (Exception ex) |
||
1053 | { |
||
1054 | |||
1055 | } |
||
1056 | |||
1057 | return result; |
||
1058 | } |
||
1059 | public static Size ShapeMeasure(UIElement e) |
||
1060 | { |
||
1061 | // Measured Size is bounded to be less than maxSize |
||
1062 | Size maxSize = new Size( |
||
1063 | double.PositiveInfinity, |
||
1064 | double.PositiveInfinity); |
||
1065 | e.Measure(maxSize); |
||
1066 | return e.DesiredSize; |
||
1067 | d7e20d2d | taeseongkim | } |
1068 | |||
1069 | 72424099 | taeseongkim | private async Task MarkupLoadAsync(int pageNumber) |
1070 | ac4f1e13 | taeseongkim | { |
1071 | System.Diagnostics.Stopwatch stopwatch = new Stopwatch(); |
||
1072 | stopwatch.Start(); |
||
1073 | |||
1074 | 3ffd4b2d | humkyung | /// 컨트롤을 새로 생성한다. |
1075 | Common.ViewerDataModel.Instance.MarkupControls_USER.Clear(); //전체 제거 |
||
1076 | Common.ViewerDataModel.Instance.MarkupControls.Clear(); //전체 제거 |
||
1077 | e8557bd7 | taeseongkim | |
1078 | ac4f1e13 | taeseongkim | System.Diagnostics.Debug.WriteLine("MarkupLoad - Clear " + new TimeSpan(stopwatch.ElapsedTicks).ToString()); |
1079 | |||
1080 | d7e20d2d | taeseongkim | foreach (var markup in ViewerDataModel.Instance.MyMarkupList.Where(param => param.PageNumber == pageNumber)) |
1081 | 3ffd4b2d | humkyung | { |
1082 | 5ee1c547 | 송근호 | var info = ViewerDataModel.Instance._markupInfoList.Where(param => param.MarkupInfoID == markup.MarkupInfoID).FirstOrDefault(); |
1083 | 3ffd4b2d | humkyung | if (info != null) |
1084 | { |
||
1085 | string sColor = (info.UserID == App.ViewInfo.UserID) ? "#FFFF0000" : info.DisplayColor; |
||
1086 | if (info.UserID == App.ViewInfo.UserID) |
||
1087 | { |
||
1088 | ac4f1e13 | taeseongkim | var control = await MarkupParser.ParseExAsync(App.ViewInfo.ProjectNO, markup.Data, Common.ViewerDataModel.Instance.MarkupControls_USER, sColor, "", |
1089 | 3ffd4b2d | humkyung | markup.MarkupInfoID, markup.ID); |
1090 | control.Visibility = Visibility.Hidden; |
||
1091 | } |
||
1092 | else |
||
1093 | { |
||
1094 | ac4f1e13 | taeseongkim | var control = await MarkupParser.ParseExAsync(App.ViewInfo.ProjectNO, markup.Data, Common.ViewerDataModel.Instance.MarkupControls, sColor, "", |
1095 | 3ffd4b2d | humkyung | markup.MarkupInfoID, markup.ID); |
1096 | control.Visibility = Visibility.Hidden; |
||
1097 | } |
||
1098 | } |
||
1099 | }; |
||
1100 | /// up to here |
||
1101 | |||
1102 | ac4f1e13 | taeseongkim | System.Diagnostics.Debug.WriteLine("MarkupLoad - MarkupParser " + new TimeSpan(stopwatch.ElapsedTicks).ToString()); |
1103 | |||
1104 | 3ffd4b2d | humkyung | /// fire selection event |
1105 | List<MarkupInfoItem> gridSelectionItem = gridViewMarkup.SelectedItems.Cast<MarkupInfoItem>().ToList(); //선택 된 마크업 |
||
1106 | this.gridViewMarkup.UnselectAll(); |
||
1107 | this.gridViewMarkup.Select(gridSelectionItem); |
||
1108 | |||
1109 | if (!testPanel2.IsHidden) |
||
1110 | { |
||
1111 | ViewerDataModel.Instance.Sync_ContentOffsetX = zoomAndPanControl.ContentOffsetX; |
||
1112 | ViewerDataModel.Instance.Sync_ContentOffsetY = zoomAndPanControl.ContentOffsetY; |
||
1113 | ViewerDataModel.Instance.Sync_ContentScale = zoomAndPanControl.ContentScale; |
||
1114 | |||
1115 | Common.ViewerDataModel.Instance.MarkupControls_Sync.Clear(); |
||
1116 | List<MarkupInfoItem> gridSelectionRevItem = gridViewRevMarkup.SelectedItems.Cast<MarkupInfoItem>().ToList(); |
||
1117 | |||
1118 | |||
1119 | foreach (var item in gridSelectionRevItem) |
||
1120 | { |
||
1121 | ac4f1e13 | taeseongkim | var markupitems = item.MarkupList.Where(pageItem => pageItem.PageNumber == pageNumber).ToList(); |
1122 | |||
1123 | foreach (var markupitem in markupitems) |
||
1124 | 3ffd4b2d | humkyung | { |
1125 | ac4f1e13 | taeseongkim | await MarkupParser.ParseExAsync(App.ViewInfo.ProjectNO, markupitem.Data, Common.ViewerDataModel.Instance.MarkupControls_Sync, item.DisplayColor, "", item.MarkupInfoID); |
1126 | } |
||
1127 | 3ffd4b2d | humkyung | } |
1128 | } |
||
1129 | ac4f1e13 | taeseongkim | |
1130 | f65e6c02 | taeseongkim | SetCommentPages(); |
1131 | 3ffd4b2d | humkyung | } |
1132 | |||
1133 | f65e6c02 | taeseongkim | public void SetCommentPages() |
1134 | 787a4489 | KangIngu | { |
1135 | 548c696e | ljiyeon | Logger.sendCheckLog("pageNavigator_PageChanging_SetCommentPages Setting", 1); |
1136 | 787a4489 | KangIngu | List<UsersCommentPagesMember> _pages = new List<UsersCommentPagesMember>(); |
1137 | foreach (var item in ViewerDataModel.Instance._markupInfoList) |
||
1138 | ed3740c4 | djkim | { |
1139 | //Comment 가 존재할 경우에만 Thumbnail 에 추가 |
||
1140 | if(item.MarkupList != null) |
||
1141 | 787a4489 | KangIngu | { |
1142 | ed3740c4 | djkim | UsersCommentPagesMember instance = new UsersCommentPagesMember(); |
1143 | instance.UserName = item.UserName; |
||
1144 | instance.Depart = item.Depatment; |
||
1145 | instance.MarkupInfoID = item.MarkupInfoID; |
||
1146 | instance.IsSelected = true; |
||
1147 | instance.isConSolidation = item.Consolidate; |
||
1148 | instance.SetColor = item.DisplayColor; |
||
1149 | if (item.UserID == App.ViewInfo.UserID && item.MarkupInfoID == item.MarkupInfoID) |
||
1150 | { |
||
1151 | instance.PageNumber = ViewerDataModel.Instance.MyMarkupList.Select(d => d.PageNumber).ToList(); |
||
1152 | } |
||
1153 | else |
||
1154 | { |
||
1155 | instance.PageNumber = ViewerDataModel.Instance.MarkupList_Pre.Where(data => data.MarkupInfoID == item.MarkupInfoID).Select(d => d.PageNumber).ToList(); |
||
1156 | } |
||
1157 | _pages.Add(instance); |
||
1158 | } |
||
1159 | } |
||
1160 | |||
1161 | d18ea2bd | taeseongkim | this.pageNavigator.SetCommentList(_pages.ToList()); |
1162 | ed3740c4 | djkim | } |
1163 | |||
1164 | public void MarkupitemViewUpdate(string markupinfo_id) |
||
1165 | { |
||
1166 | //db에 업데이트 한 list 를 view 에 업데이트 |
||
1167 | string sDocID = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu._DocInfo.ID; |
||
1168 | List<MarkupInfoItem> results = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.GetMarkupInfoItems(App.ViewInfo.ProjectNO, sDocID); |
||
1169 | MarkupInfoItem dbinfo = results.Where(x => x.MarkupInfoID == markupinfo_id).FirstOrDefault(); |
||
1170 | MarkupInfoItem viewinfo = Common.ViewerDataModel.Instance._markupInfoList.Where(x => x.MarkupInfoID == markupinfo_id).FirstOrDefault(); |
||
1171 | if (dbinfo.MarkupList.Count > 0) |
||
1172 | { |
||
1173 | if (viewinfo.MarkupList != null) |
||
1174 | { |
||
1175 | viewinfo.MarkupList.Clear(); |
||
1176 | viewinfo.MarkupList = null; |
||
1177 | e05fe8ab | djkim | } |
1178 | ed3740c4 | djkim | viewinfo.MarkupList = new List<MarkupItem>(); |
1179 | foreach (var item in dbinfo.MarkupList) |
||
1180 | e05fe8ab | djkim | { |
1181 | ed3740c4 | djkim | viewinfo.MarkupList.Add(item); |
1182 | e05fe8ab | djkim | } |
1183 | 787a4489 | KangIngu | } |
1184 | } |
||
1185 | |||
1186 | a1142a6b | taeseongkim | private async void zoomAndPanControl_MouseWheel(object sender, MouseWheelEventArgs e) |
1187 | 787a4489 | KangIngu | { |
1188 | f06cce07 | taeseongkim | var instance = ViewerDataModel.Instance; |
1189 | |||
1190 | a1142a6b | taeseongkim | if(instance.IsWheelPageChanage) |
1191 | 787a4489 | KangIngu | { |
1192 | a1142a6b | taeseongkim | return; |
1193 | } |
||
1194 | |||
1195 | if (instance.IsPressCtrl) // && !instance.IsWheelPageChanage) |
||
1196 | { |
||
1197 | |||
1198 | int changePage = 0; |
||
1199 | |||
1200 | f87dfb18 | taeseongkim | if (e.Delta > 0) |
1201 | { |
||
1202 | a1142a6b | taeseongkim | if (0 < instance.ContentOffsetY) |
1203 | f06cce07 | taeseongkim | { |
1204 | Vector dragOffset = new Vector(0, e.Delta); |
||
1205 | MoveZoomAndPanControl(dragOffset); |
||
1206 | } |
||
1207 | //else |
||
1208 | //{ |
||
1209 | a1142a6b | taeseongkim | // if (instance.SystemMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber > 1) |
1210 | // { |
||
1211 | // instance.IsWheelPageChanage = true; |
||
1212 | // changePage -= 1; |
||
1213 | // } |
||
1214 | f06cce07 | taeseongkim | //} |
1215 | f87dfb18 | taeseongkim | } |
1216 | f06cce07 | taeseongkim | else if(e.Delta < 0) |
1217 | f87dfb18 | taeseongkim | { |
1218 | f06cce07 | taeseongkim | if (instance.ContentHeight > instance.ContentOffsetY + instance.ContentViewportHeight) |
1219 | { |
||
1220 | Vector dragOffset = new Vector(0,e.Delta); |
||
1221 | MoveZoomAndPanControl(dragOffset); |
||
1222 | } |
||
1223 | //else |
||
1224 | //{ |
||
1225 | a1142a6b | taeseongkim | // if (instance.SystemMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber < instance.SystemMain.dzMainMenu.pageNavigator.PageCount) |
1226 | // { |
||
1227 | // instance.IsWheelPageChanage = true; |
||
1228 | // changePage += 1; |
||
1229 | // } |
||
1230 | f06cce07 | taeseongkim | //} |
1231 | f87dfb18 | taeseongkim | } |
1232 | a1142a6b | taeseongkim | |
1233 | //if (changePage != 0) |
||
1234 | //{ |
||
1235 | // await Task.Factory.StartNew(() => |
||
1236 | // { |
||
1237 | // double beforeScale = instance.ContentScale; |
||
1238 | |||
1239 | // EventHandler<Sample.PageChangeEventArgs> handler = null; |
||
1240 | |||
1241 | // handler = (snd, evt) => |
||
1242 | // { |
||
1243 | // /// 최상단으로 이전 zoomScale로 위치한다 |
||
1244 | // //Point currentContentMousePoint = e.GetPosition(zoomAndPanCanvas); |
||
1245 | // //zoomAndPanControl.ZoomAboutPoint(beforeScale, new Point(currentContentMousePoint.X, 0)); |
||
1246 | // instance.IsWheelPageChanage = false; |
||
1247 | // pageNavigator.PageChanged -= handler; |
||
1248 | // }; |
||
1249 | |||
1250 | // pageNavigator.PageChanged += handler; |
||
1251 | |||
1252 | // pageNavigator.GotoPage(Convert.ToInt32(instance.SystemMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber) + changePage); |
||
1253 | // }); |
||
1254 | |||
1255 | |||
1256 | //} |
||
1257 | 787a4489 | KangIngu | } |
1258 | else |
||
1259 | { |
||
1260 | f87dfb18 | taeseongkim | e.Handled = true; |
1261 | if (e.Delta > 0) |
||
1262 | { |
||
1263 | Point currentContentMousePoint = e.GetPosition(zoomAndPanCanvas); |
||
1264 | ZoomIn(currentContentMousePoint); |
||
1265 | } |
||
1266 | else |
||
1267 | { |
||
1268 | Point currentContentMousePoint = e.GetPosition(zoomAndPanCanvas); |
||
1269 | ZoomOut(currentContentMousePoint); |
||
1270 | } |
||
1271 | 787a4489 | KangIngu | } |
1272 | } |
||
1273 | |||
1274 | a1716fa5 | KangIngu | private void zoomAndPanControl2_MouseWheel(object sender, MouseWheelEventArgs e) |
1275 | { |
||
1276 | e.Handled = true; |
||
1277 | if (e.Delta > 0) |
||
1278 | { |
||
1279 | Point currentContentMousePoint = e.GetPosition(zoomAndPanCanvas2); |
||
1280 | ZoomIn_Sync(currentContentMousePoint); |
||
1281 | } |
||
1282 | else |
||
1283 | { |
||
1284 | Point currentContentMousePoint = e.GetPosition(zoomAndPanCanvas2); |
||
1285 | ZoomOut_Sync(currentContentMousePoint); |
||
1286 | } |
||
1287 | } |
||
1288 | |||
1289 | 787a4489 | KangIngu | #region ZoomIn & ZoomOut |
1290 | |||
1291 | private void ZoomOut_Executed(object sender, ExecutedRoutedEventArgs e) |
||
1292 | { |
||
1293 | ZoomOut(new Point(zoomAndPanControl.ContentZoomFocusX, |
||
1294 | zoomAndPanControl.ContentZoomFocusY)); |
||
1295 | } |
||
1296 | |||
1297 | private void ZoomIn_Executed(object sender, ExecutedRoutedEventArgs e) |
||
1298 | { |
||
1299 | ZoomIn(new Point(zoomAndPanControl.ContentZoomFocusX, |
||
1300 | zoomAndPanControl.ContentZoomFocusY)); |
||
1301 | } |
||
1302 | |||
1303 | |||
1304 | //강인구 추가 (줌 인아웃 수치 변경) |
||
1305 | //큰해상도의 문서일 경우 줌 인 아웃시 사이즈 변동이 큼 |
||
1306 | private void ZoomOut(Point contentZoomCenter) |
||
1307 | { |
||
1308 | if (zoomAndPanControl.ContentScale > 0.39) |
||
1309 | { |
||
1310 | zoomAndPanControl.ZoomAboutPoint(zoomAndPanControl.ContentScale - 0.2, contentZoomCenter); |
||
1311 | } |
||
1312 | else |
||
1313 | { |
||
1314 | zoomAndPanControl.ZoomAboutPoint(zoomAndPanControl.ContentScale / 2, contentZoomCenter); |
||
1315 | } |
||
1316 | |||
1317 | 9cd2865b | KangIngu | if (zoomAndPanControl2 != null && Sync.IsChecked) |
1318 | 787a4489 | KangIngu | { |
1319 | 9cd2865b | KangIngu | zoomAndPanControl2.ZoomAboutPoint(zoomAndPanControl.ContentScale, contentZoomCenter); |
1320 | 787a4489 | KangIngu | } |
1321 | } |
||
1322 | |||
1323 | private void ZoomIn(Point contentZoomCenter) |
||
1324 | { |
||
1325 | if (zoomAndPanControl.ContentScale > 0.19) |
||
1326 | { |
||
1327 | zoomAndPanControl.ZoomAboutPoint(zoomAndPanControl.ContentScale + 0.2, contentZoomCenter); |
||
1328 | } |
||
1329 | else |
||
1330 | { |
||
1331 | zoomAndPanControl.ZoomAboutPoint(zoomAndPanControl.ContentScale * 2, contentZoomCenter); |
||
1332 | } |
||
1333 | |||
1334 | 9cd2865b | KangIngu | if (zoomAndPanControl2 != null && Sync.IsChecked) |
1335 | 787a4489 | KangIngu | { |
1336 | 9cd2865b | KangIngu | zoomAndPanControl2.ZoomAboutPoint(zoomAndPanControl.ContentScale, contentZoomCenter); |
1337 | 787a4489 | KangIngu | } |
1338 | a1716fa5 | KangIngu | |
1339 | } |
||
1340 | |||
1341 | private void ZoomOut_Sync(Point contentZoomCenter) |
||
1342 | { |
||
1343 | if (zoomAndPanControl2.ContentScale > 0.39) |
||
1344 | { |
||
1345 | zoomAndPanControl2.ZoomAboutPoint(zoomAndPanControl2.ContentScale - 0.2, contentZoomCenter); |
||
1346 | } |
||
1347 | else |
||
1348 | { |
||
1349 | zoomAndPanControl2.ZoomAboutPoint(zoomAndPanControl2.ContentScale / 2, contentZoomCenter); |
||
1350 | } |
||
1351 | |||
1352 | if (Sync.IsChecked) |
||
1353 | { |
||
1354 | zoomAndPanControl.ZoomAboutPoint(zoomAndPanControl2.ContentScale, contentZoomCenter); |
||
1355 | } |
||
1356 | } |
||
1357 | |||
1358 | private void ZoomIn_Sync(Point contentZoomCenter) |
||
1359 | { |
||
1360 | if (zoomAndPanControl2.ContentScale > 0.19) |
||
1361 | { |
||
1362 | zoomAndPanControl2.ZoomAboutPoint(zoomAndPanControl2.ContentScale + 0.2, contentZoomCenter); |
||
1363 | } |
||
1364 | else |
||
1365 | { |
||
1366 | zoomAndPanControl2.ZoomAboutPoint(zoomAndPanControl2.ContentScale * 2, contentZoomCenter); |
||
1367 | } |
||
1368 | |||
1369 | if (Sync.IsChecked) |
||
1370 | { |
||
1371 | zoomAndPanControl.ZoomAboutPoint(zoomAndPanControl2.ContentScale, contentZoomCenter); |
||
1372 | } |
||
1373 | 787a4489 | KangIngu | } |
1374 | |||
1375 | private void ZoomOut() |
||
1376 | { |
||
1377 | zoomAndPanControl.ContentScale -= 0.1; |
||
1378 | //if (zoomAndPanControl2 != null) |
||
1379 | //{ |
||
1380 | // zoomAndPanControl2.ContentScale -= 0.1; |
||
1381 | //} |
||
1382 | } |
||
1383 | |||
1384 | private void ZoomIn() |
||
1385 | { |
||
1386 | zoomAndPanControl.ContentScale += 0.1; |
||
1387 | //if (zoomAndPanControl2 != null) |
||
1388 | //{ |
||
1389 | // zoomAndPanControl2.ContentScale += 0.1; |
||
1390 | //} |
||
1391 | } |
||
1392 | |||
1393 | #endregion |
||
1394 | |||
1395 | private void init() |
||
1396 | { |
||
1397 | foreach (var item in ViewerDataModel.Instance.MarkupControls) |
||
1398 | { |
||
1399 | |||
1400 | ControlList.Clear(); |
||
1401 | listBox.Items.Clear(); |
||
1402 | selected_item.Clear(); |
||
1403 | |||
1404 | (item as IMarkupCommonData).IsSelected = false; |
||
1405 | } |
||
1406 | |||
1407 | } |
||
1408 | |||
1409 | private HitTestResultBehavior MyCallback(HitTestResult result) |
||
1410 | { |
||
1411 | //this.cursor = Cursors.UpArrow; |
||
1412 | var element = result.VisualHit; |
||
1413 | while (element != null && !(element is CommentUserInfo)) |
||
1414 | element = VisualTreeHelper.GetParent(element); |
||
1415 | |||
1416 | if (element == null) |
||
1417 | { |
||
1418 | return HitTestResultBehavior.Stop; |
||
1419 | } |
||
1420 | else |
||
1421 | { |
||
1422 | if (element is CommentUserInfo) |
||
1423 | { |
||
1424 | if (!hitList.Contains(element)) |
||
1425 | { |
||
1426 | hitList.Add((CommentUserInfo)element); |
||
1427 | } |
||
1428 | else |
||
1429 | { |
||
1430 | return HitTestResultBehavior.Stop; |
||
1431 | } |
||
1432 | } |
||
1433 | } |
||
1434 | return HitTestResultBehavior.Continue; |
||
1435 | } |
||
1436 | |||
1437 | public void ReleaseSelectPath() |
||
1438 | { |
||
1439 | if (SelectionPath == null) |
||
1440 | { |
||
1441 | SelectionPath = new Path(); |
||
1442 | SelectionPath.Name = ""; |
||
1443 | } |
||
1444 | if (SelectionPath.Name != "") |
||
1445 | { |
||
1446 | SelectionPath.Name = "None"; |
||
1447 | } |
||
1448 | SelectionPath.Opacity = 0.01; |
||
1449 | SelectionPath.RenderTransform = null; |
||
1450 | SelectionPath.RenderTransformOrigin = new Point(0, 0); |
||
1451 | } |
||
1452 | |||
1453 | #region 컨트롤 초기화 |
||
1454 | public void Control_Init(object control) |
||
1455 | { |
||
1456 | if (L_Size != 0 && (control as IPath) != null) |
||
1457 | { |
||
1458 | (control as IPath).LineSize = L_Size; |
||
1459 | L_Size = 0; |
||
1460 | } |
||
1461 | |||
1462 | switch (control.GetType().Name) |
||
1463 | { |
||
1464 | case "RectangleControl": |
||
1465 | { |
||
1466 | (control as RectangleControl).StrokeColor = Brushes.Red; |
||
1467 | } |
||
1468 | break; |
||
1469 | case "CircleControl": |
||
1470 | { |
||
1471 | (control as CircleControl).StrokeColor = Brushes.Red; |
||
1472 | } |
||
1473 | break; |
||
1474 | case "TriControl": |
||
1475 | { |
||
1476 | (control as TriControl).StrokeColor = Brushes.Red; |
||
1477 | } |
||
1478 | break; |
||
1479 | case "RectCloudControl": |
||
1480 | { |
||
1481 | (control as RectCloudControl).StrokeColor = Brushes.Red; |
||
1482 | } |
||
1483 | break; |
||
1484 | case "CloudControl": |
||
1485 | { |
||
1486 | (control as CloudControl).StrokeColor = Brushes.Red; |
||
1487 | } |
||
1488 | break; |
||
1489 | case "PolygonControl": |
||
1490 | { |
||
1491 | (control as PolygonControl).StrokeColor = Brushes.Red; |
||
1492 | } |
||
1493 | break; |
||
1494 | case "ArcControl": |
||
1495 | { |
||
1496 | (control as ArcControl).StrokeColor = Brushes.Red; |
||
1497 | } |
||
1498 | break; |
||
1499 | 40b3ce25 | ljiyeon | case "ArrowArcControl": |
1500 | { |
||
1501 | (control as ArrowArcControl).StrokeColor = Brushes.Red; |
||
1502 | } |
||
1503 | break; |
||
1504 | 787a4489 | KangIngu | case "LineControl": |
1505 | { |
||
1506 | (control as LineControl).StrokeColor = Brushes.Red; |
||
1507 | } |
||
1508 | break; |
||
1509 | case "ArrowControl_Multi": |
||
1510 | { |
||
1511 | (control as ArrowControl_Multi).StrokeColor = Brushes.Red; |
||
1512 | } |
||
1513 | break; |
||
1514 | case "TextControl": |
||
1515 | { |
||
1516 | (control as TextControl).BackInnerColor = new SolidColorBrush(Color.FromArgb(Convert.ToByte(255 * 0.6), Colors.White.R, Colors.White.G, Colors.White.B)); |
||
1517 | } |
||
1518 | break; |
||
1519 | case "ArrowTextControl": |
||
1520 | { |
||
1521 | (control as ArrowTextControl).BackInnerColor = new SolidColorBrush(Color.FromArgb(Convert.ToByte(255 * 0.6), Colors.White.R, Colors.White.G, Colors.White.B)); |
||
1522 | } |
||
1523 | break; |
||
1524 | 684ef11c | ljiyeon | case "InsideWhiteControl": |
1525 | { |
||
1526 | (control as InsideWhiteControl).StrokeColor = Brushes.White; |
||
1527 | } |
||
1528 | break; |
||
1529 | case "OverlapWhiteControl": |
||
1530 | { |
||
1531 | (control as OverlapWhiteControl).StrokeColor = Brushes.White; |
||
1532 | } |
||
1533 | break; |
||
1534 | case "ClipWhiteControl": |
||
1535 | { |
||
1536 | (control as ClipWhiteControl).StrokeColor = Brushes.White; |
||
1537 | } |
||
1538 | break; |
||
1539 | case "CoordinateControl": |
||
1540 | { |
||
1541 | (control as CoordinateControl).StrokeColor = Brushes.Black; |
||
1542 | } |
||
1543 | break; |
||
1544 | 787a4489 | KangIngu | } |
1545 | } |
||
1546 | #endregion |
||
1547 | |||
1548 | public void firstCondition_MouseLeave(object sender, MouseEventArgs e) |
||
1549 | { |
||
1550 | //Control_Init(e.Source); |
||
1551 | } |
||
1552 | 7211e0c2 | ljiyeon | //private Window _dragdropWindow = null; |
1553 | 53880c83 | ljiyeon | |
1554 | [DllImport("user32.dll")] |
||
1555 | [return: MarshalAs(UnmanagedType.Bool)] |
||
1556 | internal static extern bool GetCursorPos(ref Win32Point pt); |
||
1557 | |||
1558 | [StructLayout(LayoutKind.Sequential)] |
||
1559 | internal struct Win32Point |
||
1560 | { |
||
1561 | public Int32 X; |
||
1562 | public Int32 Y; |
||
1563 | }; |
||
1564 | 7211e0c2 | ljiyeon | /* |
1565 | public string symbol_id = null; |
||
1566 | public long symbol_group_id; |
||
1567 | public int symbol_SelectedIndex; |
||
1568 | public ImageSource symbol_img; |
||
1569 | public string symbol_Data = null; |
||
1570 | public void symboldata(string id, long group_id, int SelectedIndex, string Data_, ImageSource img) |
||
1571 | { |
||
1572 | PlaceImageSymbol(symbol_id, symbol_group_id, symbol_SelectedIndex, new Point(zoomAndPanCanvas.ActualWidth / 2, |
||
1573 | zoomAndPanCanvas.ActualHeight / 2)); |
||
1574 | |||
1575 | |||
1576 | if (this._dragdropWindow != null) |
||
1577 | { |
||
1578 | this._dragdropWindow.Close(); |
||
1579 | this._dragdropWindow = null; |
||
1580 | } |
||
1581 | |||
1582 | symbol_id = id; |
||
1583 | symbol_group_id = group_id; |
||
1584 | symbol_SelectedIndex = SelectedIndex; |
||
1585 | symbol_Data = Data_; |
||
1586 | symbol_img = img; |
||
1587 | |||
1588 | |||
1589 | CreateDragDropWindow2(img); |
||
1590 | |||
1591 | } |
||
1592 | 53880c83 | ljiyeon | |
1593 | 7211e0c2 | ljiyeon | private void CreateDragDropWindow2(ImageSource image) |
1594 | 53880c83 | ljiyeon | { |
1595 | this._dragdropWindow = new Window(); |
||
1596 | _dragdropWindow.Cursor = new Cursor(MainWindow.CursorChange().StreamSource); |
||
1597 | _dragdropWindow.WindowStyle = WindowStyle.None; |
||
1598 | _dragdropWindow.AllowsTransparency = true; |
||
1599 | _dragdropWindow.AllowDrop = false; |
||
1600 | _dragdropWindow.Background = null; |
||
1601 | _dragdropWindow.IsHitTestVisible = false; |
||
1602 | _dragdropWindow.SizeToContent = SizeToContent.WidthAndHeight; |
||
1603 | _dragdropWindow.Topmost = true; |
||
1604 | _dragdropWindow.ShowInTaskbar = false; |
||
1605 | |||
1606 | Rectangle r = new Rectangle(); |
||
1607 | r.Width = image.Width; |
||
1608 | r.Height = image.Height; |
||
1609 | r.Opacity = 0.5; |
||
1610 | r.Fill = new ImageBrush(image); |
||
1611 | this._dragdropWindow.Content = r; |
||
1612 | |||
1613 | Win32Point w32Mouse = new Win32Point(); |
||
1614 | GetCursorPos(ref w32Mouse); |
||
1615 | |||
1616 | //w32Mouse.X = getCurrentPoint.X; |
||
1617 | this._dragdropWindow.Left = w32Mouse.X - (image.Width / 2); |
||
1618 | this._dragdropWindow.Top = w32Mouse.Y - (image.Height / 2); |
||
1619 | this._dragdropWindow.Show(); |
||
1620 | } |
||
1621 | f87dfb18 | taeseongkim | |
1622 | |||
1623 | |||
1624 | 7211e0c2 | ljiyeon | */ |
1625 | f87dfb18 | taeseongkim | |
1626 | public void MoveZoomAndPanControl(Vector dragOffset) |
||
1627 | { |
||
1628 | |||
1629 | zoomAndPanControl.ContentOffsetX -= dragOffset.X; |
||
1630 | zoomAndPanControl.ContentOffsetY -= dragOffset.Y; |
||
1631 | |||
1632 | if (Sync.IsChecked) |
||
1633 | { |
||
1634 | ViewerDataModel.Instance.Sync_ContentOffsetX = zoomAndPanControl.ContentOffsetX; |
||
1635 | ViewerDataModel.Instance.Sync_ContentOffsetY = zoomAndPanControl.ContentOffsetY; |
||
1636 | } |
||
1637 | } |
||
1638 | |||
1639 | 787a4489 | KangIngu | private void zoomAndPanControl_MouseMove(object sender, MouseEventArgs e) |
1640 | { |
||
1641 | if (Common.ViewerDataModel.Instance.SelectedControl == "Batch") |
||
1642 | { |
||
1643 | if (!floatingTip.IsOpen) { floatingTip.IsOpen = true; } |
||
1644 | |||
1645 | Point currentPos = e.GetPosition(rect); |
||
1646 | d71ee575 | djkim | |
1647 | 787a4489 | KangIngu | floatingTip.HorizontalOffset = currentPos.X + 20; |
1648 | floatingTip.VerticalOffset = currentPos.Y; |
||
1649 | } |
||
1650 | |||
1651 | getCurrentPoint = e.GetPosition(drawingRotateCanvas); |
||
1652 | a36a37c3 | humkyung | |
1653 | e6a9ddaf | humkyung | if ((e.MiddleButton == MouseButtonState.Pressed) || (e.RightButton == MouseButtonState.Pressed)) |
1654 | 787a4489 | KangIngu | { |
1655 | e54660e8 | KangIngu | SetCursor(); |
1656 | 787a4489 | KangIngu | Point currentCanvasDrawingMouseMovePoint = e.GetPosition(drawingRotateCanvas); |
1657 | Point currentCanvasZoomPanningMouseMovePoint = e.GetPosition(zoomAndPanCanvas); |
||
1658 | |||
1659 | Vector dragOffset = currentCanvasZoomPanningMouseMovePoint - canvasZoommovingMouseDownPoint; |
||
1660 | 9cd2865b | KangIngu | |
1661 | f87dfb18 | taeseongkim | MoveZoomAndPanControl(dragOffset); |
1662 | 787a4489 | KangIngu | } |
1663 | 992a98b4 | KangIngu | |
1664 | e6a9ddaf | humkyung | if (mouseHandlingMode == MouseHandlingMode.Drawing && currentControl != null) |
1665 | 787a4489 | KangIngu | { |
1666 | Point currentCanvasDrawingMouseMovePoint = e.GetPosition(drawingRotateCanvas); |
||
1667 | Point currentCanvasZoomPanningMouseMovePoint = e.GetPosition(zoomAndPanCanvas); |
||
1668 | SetCursor(); |
||
1669 | |||
1670 | if (currentControl != null) |
||
1671 | { |
||
1672 | c7fde400 | taeseongkim | double moveX = currentCanvasDrawingMouseMovePoint.X - CanvasDrawingMouseDownPoint.X; |
1673 | double moveY = currentCanvasDrawingMouseMovePoint.Y - CanvasDrawingMouseDownPoint.Y; |
||
1674 | 787a4489 | KangIngu | //강인구 추가 |
1675 | currentControl.Opacity = ViewerDataModel.Instance.ControlOpacity; |
||
1676 | |||
1677 | if ((currentControl as IPath) != null) |
||
1678 | { |
||
1679 | (currentControl as IPath).LineSize = ViewerDataModel.Instance.LineSize; |
||
1680 | } |
||
1681 | 5ce56a3a | KangIngu | if ((currentControl as LineControl) != null) |
1682 | { |
||
1683 | (currentControl as LineControl).Interval = ViewerDataModel.Instance.Interval; |
||
1684 | } |
||
1685 | |||
1686 | 787a4489 | KangIngu | if ((currentControl as IShapeControl) != null) |
1687 | { |
||
1688 | (currentControl as IShapeControl).Paint = ViewerDataModel.Instance.paintSet; |
||
1689 | } |
||
1690 | if ((currentControl as TextControl) != null) |
||
1691 | { |
||
1692 | if (this.ParentOfType<MainWindow>().dzTopMenu.btnItalic.IsChecked == true) |
||
1693 | { |
||
1694 | (currentControl as TextControl).TextStyle = FontStyles.Italic; |
||
1695 | } |
||
1696 | if (this.ParentOfType<MainWindow>().dzTopMenu.btnBold.IsChecked == true) |
||
1697 | { |
||
1698 | d4b0c723 | KangIngu | (currentControl as TextControl).TextWeight = FontWeights.Bold; |
1699 | 787a4489 | KangIngu | } |
1700 | if (this.ParentOfType<MainWindow>().dzTopMenu.btnUnderLine.IsChecked == true) |
||
1701 | { |
||
1702 | (currentControl as TextControl).UnderLine = TextDecorations.Underline; |
||
1703 | } |
||
1704 | } |
||
1705 | else if ((currentControl as ArrowTextControl) != null) |
||
1706 | { |
||
1707 | if (this.ParentOfType<MainWindow>().dzTopMenu.btnItalic.IsChecked == true) |
||
1708 | { |
||
1709 | (currentControl as ArrowTextControl).TextStyle = FontStyles.Italic; |
||
1710 | } |
||
1711 | if (this.ParentOfType<MainWindow>().dzTopMenu.btnBold.IsChecked == true) |
||
1712 | { |
||
1713 | d4b0c723 | KangIngu | (currentControl as ArrowTextControl).TextWeight = FontWeights.Bold; |
1714 | 787a4489 | KangIngu | } |
1715 | if (this.ParentOfType<MainWindow>().dzTopMenu.btnUnderLine.IsChecked == true) |
||
1716 | { |
||
1717 | (currentControl as ArrowTextControl).UnderLine = TextDecorations.Underline; |
||
1718 | } |
||
1719 | } |
||
1720 | 9f473fb7 | KangIngu | else if ((currentControl as RectCloudControl) != null) |
1721 | { |
||
1722 | (currentControl as RectCloudControl).ArcLength = ViewerDataModel.Instance.ArcLength; |
||
1723 | } |
||
1724 | else if ((currentControl as CloudControl) != null) |
||
1725 | { |
||
1726 | (currentControl as CloudControl).ArcLength = ViewerDataModel.Instance.ArcLength; |
||
1727 | } |
||
1728 | 787a4489 | KangIngu | |
1729 | 168f8027 | taeseongkim | |
1730 | #region // 모든 컨트롤의 공통기능 제어 |
||
1731 | if (controlType != ControlType.PenControl) |
||
1732 | { |
||
1733 | currentControl.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift); |
||
1734 | } |
||
1735 | |||
1736 | |||
1737 | #endregion |
||
1738 | |||
1739 | #region // 각 컨트롤의 특별한 기능을 제어한다. |
||
1740 | |||
1741 | 787a4489 | KangIngu | switch (controlType) |
1742 | { |
||
1743 | 684ef11c | ljiyeon | case (ControlType.Coordinate): |
1744 | { |
||
1745 | var control = currentControl as CoordinateControl; |
||
1746 | if (control != null) |
||
1747 | { |
||
1748 | 168f8027 | taeseongkim | //control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift); |
1749 | 684ef11c | ljiyeon | control.DashSize = ViewerDataModel.Instance.DashSize; |
1750 | control.Paint = ViewerDataModel.Instance.paintSet; |
||
1751 | } |
||
1752 | } |
||
1753 | break; |
||
1754 | case (ControlType.InsideWhite): |
||
1755 | { |
||
1756 | var control = currentControl as InsideWhiteControl; |
||
1757 | if (control != null) |
||
1758 | { |
||
1759 | 168f8027 | taeseongkim | //control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift); |
1760 | 684ef11c | ljiyeon | control.DashSize = ViewerDataModel.Instance.DashSize; |
1761 | control.Paint = ViewerDataModel.Instance.paintSet; |
||
1762 | control.Paint = PaintSet.Fill; |
||
1763 | } |
||
1764 | } |
||
1765 | break; |
||
1766 | a6272c57 | humkyung | case ControlType.OverlapWhite: |
1767 | 684ef11c | ljiyeon | { |
1768 | var control = currentControl as OverlapWhiteControl; |
||
1769 | if (control != null) |
||
1770 | { |
||
1771 | 168f8027 | taeseongkim | //control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift); |
1772 | 684ef11c | ljiyeon | control.DashSize = ViewerDataModel.Instance.DashSize; |
1773 | control.Paint = ViewerDataModel.Instance.paintSet; |
||
1774 | control.Paint = PaintSet.Fill; |
||
1775 | } |
||
1776 | } |
||
1777 | break; |
||
1778 | a6272c57 | humkyung | case ControlType.ClipWhite: |
1779 | 684ef11c | ljiyeon | { |
1780 | var control = currentControl as ClipWhiteControl; |
||
1781 | if (control != null) |
||
1782 | { |
||
1783 | 168f8027 | taeseongkim | //control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift); |
1784 | 684ef11c | ljiyeon | control.DashSize = ViewerDataModel.Instance.DashSize; |
1785 | control.Paint = ViewerDataModel.Instance.paintSet; |
||
1786 | control.Paint = PaintSet.Fill; |
||
1787 | } |
||
1788 | } |
||
1789 | break; |
||
1790 | 787a4489 | KangIngu | case ControlType.RectCloud: |
1791 | { |
||
1792 | var control = currentControl as RectCloudControl; |
||
1793 | if (control != null) |
||
1794 | { |
||
1795 | 168f8027 | taeseongkim | //control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift); |
1796 | 787a4489 | KangIngu | control.DashSize = ViewerDataModel.Instance.DashSize; |
1797 | control.Paint = ViewerDataModel.Instance.paintSet; |
||
1798 | } |
||
1799 | } |
||
1800 | break; |
||
1801 | case ControlType.SingleLine: |
||
1802 | case ControlType.CancelLine: |
||
1803 | case ControlType.ArrowLine: |
||
1804 | case ControlType.TwinLine: |
||
1805 | case ControlType.DimLine: |
||
1806 | { |
||
1807 | d71ee575 | djkim | var control = currentControl as LineControl; |
1808 | if (control != null) |
||
1809 | 787a4489 | KangIngu | { |
1810 | 168f8027 | taeseongkim | //control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift); |
1811 | 787a4489 | KangIngu | control.DashSize = ViewerDataModel.Instance.DashSize; |
1812 | } |
||
1813 | 168f8027 | taeseongkim | |
1814 | 787a4489 | KangIngu | } |
1815 | break; |
||
1816 | |||
1817 | case ControlType.ArcLine: |
||
1818 | { |
||
1819 | d71ee575 | djkim | var control = currentControl as ArcControl; |
1820 | if (control != null) |
||
1821 | 787a4489 | KangIngu | { |
1822 | 168f8027 | taeseongkim | //control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift); |
1823 | 787a4489 | KangIngu | control.DashSize = ViewerDataModel.Instance.DashSize; |
1824 | } |
||
1825 | } |
||
1826 | break; |
||
1827 | |||
1828 | case ControlType.ArcArrow: |
||
1829 | { |
||
1830 | 40b3ce25 | ljiyeon | var control = currentControl as ArrowArcControl; |
1831 | d71ee575 | djkim | if (control != null) |
1832 | 787a4489 | KangIngu | { |
1833 | 168f8027 | taeseongkim | //control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift); |
1834 | 787a4489 | KangIngu | control.DashSize = ViewerDataModel.Instance.DashSize; |
1835 | } |
||
1836 | } |
||
1837 | break; |
||
1838 | |||
1839 | case ControlType.ArrowMultiLine: |
||
1840 | { |
||
1841 | d71ee575 | djkim | var control = currentControl as ArrowControl_Multi; |
1842 | if (control != null) |
||
1843 | 787a4489 | KangIngu | { |
1844 | 168f8027 | taeseongkim | //control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift); |
1845 | 787a4489 | KangIngu | control.DashSize = ViewerDataModel.Instance.DashSize; |
1846 | } |
||
1847 | } |
||
1848 | break; |
||
1849 | |||
1850 | case ControlType.Circle: |
||
1851 | { |
||
1852 | 168f8027 | taeseongkim | var control = currentControl as CircleControl; |
1853 | |||
1854 | if (control != null) |
||
1855 | 787a4489 | KangIngu | { |
1856 | 168f8027 | taeseongkim | //control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift); |
1857 | control.DashSize = ViewerDataModel.Instance.DashSize; |
||
1858 | control.Paint = ViewerDataModel.Instance.paintSet; |
||
1859 | 787a4489 | KangIngu | } |
1860 | } |
||
1861 | break; |
||
1862 | |||
1863 | case ControlType.PolygonCloud: |
||
1864 | { |
||
1865 | var control = currentControl as CloudControl; |
||
1866 | if (control != null) |
||
1867 | { |
||
1868 | 168f8027 | taeseongkim | //control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift); |
1869 | 787a4489 | KangIngu | control.DashSize = ViewerDataModel.Instance.DashSize; |
1870 | control.Paint = ViewerDataModel.Instance.paintSet; |
||
1871 | } |
||
1872 | } |
||
1873 | break; |
||
1874 | |||
1875 | case ControlType.Triangle: |
||
1876 | { |
||
1877 | var control = currentControl as TriControl; |
||
1878 | if (control != null) |
||
1879 | { |
||
1880 | 168f8027 | taeseongkim | //control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift); |
1881 | 787a4489 | KangIngu | control.DashSize = ViewerDataModel.Instance.DashSize; |
1882 | control.Paint = ViewerDataModel.Instance.paintSet; |
||
1883 | } |
||
1884 | } |
||
1885 | break; |
||
1886 | |||
1887 | case ControlType.ImgControl: |
||
1888 | { |
||
1889 | var control = currentControl as ImgControl; |
||
1890 | if (control != null) |
||
1891 | { |
||
1892 | 168f8027 | taeseongkim | //control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift); |
1893 | 787a4489 | KangIngu | } |
1894 | } |
||
1895 | break; |
||
1896 | |||
1897 | case ControlType.Date: |
||
1898 | { |
||
1899 | var control = currentControl as DateControl; |
||
1900 | if (control != null) |
||
1901 | { |
||
1902 | 168f8027 | taeseongkim | //control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift); |
1903 | 787a4489 | KangIngu | } |
1904 | } |
||
1905 | break; |
||
1906 | |||
1907 | case ControlType.ArrowTextControl: |
||
1908 | case ControlType.ArrowTransTextControl: |
||
1909 | case ControlType.ArrowTextBorderControl: |
||
1910 | case ControlType.ArrowTransTextBorderControl: |
||
1911 | case ControlType.ArrowTextCloudControl: |
||
1912 | case ControlType.ArrowTransTextCloudControl: |
||
1913 | { |
||
1914 | var control = currentControl as ArrowTextControl; |
||
1915 | if (control != null) |
||
1916 | { |
||
1917 | 168f8027 | taeseongkim | //control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift); |
1918 | 787a4489 | KangIngu | } |
1919 | } |
||
1920 | break; |
||
1921 | case ControlType.PolygonControl: |
||
1922 | e6a9ddaf | humkyung | case ControlType.ChainLine: |
1923 | 787a4489 | KangIngu | { |
1924 | var control = currentControl as PolygonControl; |
||
1925 | if (control != null) |
||
1926 | { |
||
1927 | 168f8027 | taeseongkim | //control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift); |
1928 | 787a4489 | KangIngu | control.DashSize = ViewerDataModel.Instance.DashSize; |
1929 | control.Paint = ViewerDataModel.Instance.paintSet; |
||
1930 | } |
||
1931 | } |
||
1932 | break; |
||
1933 | case ControlType.Sign: |
||
1934 | { |
||
1935 | var control = currentControl as SignControl; |
||
1936 | if (control != null) |
||
1937 | { |
||
1938 | 168f8027 | taeseongkim | //control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift); |
1939 | 787a4489 | KangIngu | } |
1940 | } |
||
1941 | break; |
||
1942 | case ControlType.Symbol: |
||
1943 | { |
||
1944 | var control = currentControl as SymControl; |
||
1945 | if (control != null) |
||
1946 | { |
||
1947 | 168f8027 | taeseongkim | //control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift); |
1948 | 787a4489 | KangIngu | } |
1949 | } |
||
1950 | break; |
||
1951 | case ControlType.Stamp: |
||
1952 | { |
||
1953 | cd988cd8 | djkim | var control = currentControl as SymControlN; |
1954 | if (control != null) |
||
1955 | 787a4489 | KangIngu | { |
1956 | cd988cd8 | djkim | if (control.STAMP != null) |
1957 | cbaa3c91 | ljiyeon | { |
1958 | 168f8027 | taeseongkim | //control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift); |
1959 | cbaa3c91 | ljiyeon | } |
1960 | cd988cd8 | djkim | else |
1961 | { |
||
1962 | currentControl = null; |
||
1963 | this.cursor = new Cursor(MainWindow.CursorChange().StreamSource); |
||
1964 | DialogMessage_Alert("Approved Stamp 가 등록되어 있지 않습니다. \n관리자에게 문의하세요.", "안내"); |
||
1965 | } |
||
1966 | 168f8027 | taeseongkim | } |
1967 | 787a4489 | KangIngu | } |
1968 | break; |
||
1969 | a6272c57 | humkyung | case ControlType.Rectangle: |
1970 | 787a4489 | KangIngu | case ControlType.Mark: |
1971 | { |
||
1972 | var control = currentControl as RectangleControl; |
||
1973 | if (control != null) |
||
1974 | { |
||
1975 | 168f8027 | taeseongkim | //control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift); |
1976 | if (control.ControlType == ControlType.Mark) control.Paint = PaintSet.Fill; |
||
1977 | 7a5210f1 | humkyung | control.DashSize = ViewerDataModel.Instance.DashSize; |
1978 | 787a4489 | KangIngu | } |
1979 | } |
||
1980 | break; |
||
1981 | case ControlType.PenControl: |
||
1982 | { |
||
1983 | stroke.StylusPoints.Add(new StylusPoint(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y)); |
||
1984 | //inkBoard.Strokes.Add(stroke); |
||
1985 | } |
||
1986 | break; |
||
1987 | default: |
||
1988 | break; |
||
1989 | } |
||
1990 | 168f8027 | taeseongkim | |
1991 | #endregion |
||
1992 | if (ViewerDataModel.Instance.AngleVisibility == Visibility.Visible) |
||
1993 | { |
||
1994 | fa48eb85 | taeseongkim | ViewerDataModel.Instance.Angle = currentControl.CommentAngle; |
1995 | 168f8027 | taeseongkim | } |
1996 | 787a4489 | KangIngu | } |
1997 | } |
||
1998 | 29cf2c0c | humkyung | else if(mouseHandlingMode == MouseHandlingMode.Drawing && e.LeftButton == MouseButtonState.Pressed) |
1999 | { |
||
2000 | Point currentCanvasDrawingMouseMovePoint = e.GetPosition(drawingRotateCanvas); |
||
2001 | Point currentCanvasZoomPanningMouseMovePoint = e.GetPosition(zoomAndPanCanvas); |
||
2002 | SetCursor(); |
||
2003 | if (currentControl == null) |
||
2004 | { |
||
2005 | switch (controlType) |
||
2006 | { |
||
2007 | case ControlType.PenControl: |
||
2008 | { |
||
2009 | if (inkBoard.Tag.ToString() == "Ink") |
||
2010 | { |
||
2011 | stroke.StylusPoints.Add(new StylusPoint(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y)); |
||
2012 | } |
||
2013 | else if (inkBoard.Tag.ToString() == "EraseByPoint") |
||
2014 | { |
||
2015 | RemovePointStroke(currentCanvasDrawingMouseMovePoint); |
||
2016 | } |
||
2017 | else if (inkBoard.Tag.ToString() == "EraseByStroke") |
||
2018 | { |
||
2019 | RemoveLineStroke(currentCanvasDrawingMouseMovePoint); |
||
2020 | } |
||
2021 | |||
2022 | //inkBoard.Strokes.Add(stroke); |
||
2023 | } |
||
2024 | break; |
||
2025 | } |
||
2026 | return; |
||
2027 | } |
||
2028 | } |
||
2029 | e6a9ddaf | humkyung | else if (((e.LeftButton == MouseButtonState.Pressed) && mouseHandlingMode == MouseHandlingMode.Selecting) || |
2030 | ((e.LeftButton == MouseButtonState.Pressed) && mouseHandlingMode == MouseHandlingMode.Capture) || |
||
2031 | ((e.LeftButton == MouseButtonState.Pressed) && mouseHandlingMode == MouseHandlingMode.DragZoom)) |
||
2032 | 787a4489 | KangIngu | { |
2033 | Point curMouseDownPoint = e.GetPosition(drawingRotateCanvas); |
||
2034 | |||
2035 | if (isDraggingSelectionRect) |
||
2036 | { |
||
2037 | c7fde400 | taeseongkim | UpdateDragSelectionRect(CanvasDrawingMouseDownPoint, curMouseDownPoint); |
2038 | 787a4489 | KangIngu | e.Handled = true; |
2039 | } |
||
2040 | else if (isLeftMouseButtonDownOnWindow) |
||
2041 | { |
||
2042 | c7fde400 | taeseongkim | var dragDelta = curMouseDownPoint - CanvasDrawingMouseDownPoint; |
2043 | 787a4489 | KangIngu | double dragDistance = Math.Abs(dragDelta.Length); |
2044 | |||
2045 | if (dragDistance > DragThreshold) |
||
2046 | { |
||
2047 | isDraggingSelectionRect = true; |
||
2048 | c7fde400 | taeseongkim | InitDragSelectionRect(CanvasDrawingMouseDownPoint, curMouseDownPoint); |
2049 | 787a4489 | KangIngu | } |
2050 | |||
2051 | e.Handled = true; |
||
2052 | } |
||
2053 | |||
2054 | c7fde400 | taeseongkim | if (CanvasDrawingMouseDownPoint == curMouseDownPoint) |
2055 | 787a4489 | KangIngu | { |
2056 | } |
||
2057 | else |
||
2058 | { |
||
2059 | e.Handled = true; |
||
2060 | } |
||
2061 | } |
||
2062 | 7211e0c2 | ljiyeon | /* |
2063 | e6a9ddaf | humkyung | else if ((e.LeftButton == MouseButtonState.Pressed) && mouseHandlingMode == MouseHandlingMode.DragSymbol) |
2064 | 53880c83 | ljiyeon | { //symbol |
2065 | if(_dragdropWindow != null) |
||
2066 | { |
||
2067 | Win32Point w32Mouse = new Win32Point(); |
||
2068 | GetCursorPos(ref w32Mouse); |
||
2069 | |||
2070 | this._dragdropWindow.Left = w32Mouse.X - (symbol_img.Width / 2); |
||
2071 | this._dragdropWindow.Top = w32Mouse.Y - (symbol_img.Height / 2); |
||
2072 | } |
||
2073 | } |
||
2074 | 7211e0c2 | ljiyeon | */ |
2075 | e6a9ddaf | humkyung | else if ((e.LeftButton == MouseButtonState.Released) && (e.MiddleButton == MouseButtonState.Released) && |
2076 | (e.RightButton == MouseButtonState.Released) && ViewerDataModel.Instance.MarkupControls_USER.Count > 0) |
||
2077 | 787a4489 | KangIngu | { |
2078 | 05009a0e | ljiyeon | var control = ViewerDataModel.Instance.MarkupControls_USER.Where(data => data.IsMouseOver).FirstOrDefault(); |
2079 | e6a9ddaf | humkyung | if(control != null) |
2080 | 787a4489 | KangIngu | { |
2081 | this.cursor = Cursors.Hand; |
||
2082 | SetCursor(); |
||
2083 | } |
||
2084 | else |
||
2085 | { |
||
2086 | 510cbd2a | ljiyeon | this.cursor = new Cursor(MainWindow.CursorChange().StreamSource); |
2087 | 787a4489 | KangIngu | SetCursor(); |
2088 | } |
||
2089 | } |
||
2090 | else |
||
2091 | { |
||
2092 | } |
||
2093 | } |
||
2094 | |||
2095 | a1716fa5 | KangIngu | private void zoomAndPanControl2_MouseMove(object sender, MouseEventArgs e) |
2096 | { |
||
2097 | e6a9ddaf | humkyung | if ((e.MiddleButton == MouseButtonState.Pressed) || (e.RightButton == MouseButtonState.Pressed)) |
2098 | a1716fa5 | KangIngu | { |
2099 | SetCursor(); |
||
2100 | Point currentCanvasDrawingMouseMovePoint = e.GetPosition(drawingRotateCanvas2); |
||
2101 | Point currentCanvasZoomPanningMouseMovePoint = e.GetPosition(zoomAndPanCanvas2); |
||
2102 | |||
2103 | Vector dragOffset = currentCanvasZoomPanningMouseMovePoint - canvasZoommovingMouseDownPoint; |
||
2104 | |||
2105 | ViewerDataModel.Instance.Sync_ContentOffsetX -= dragOffset.X; |
||
2106 | ViewerDataModel.Instance.Sync_ContentOffsetY -= dragOffset.Y; |
||
2107 | |||
2108 | if (Sync.IsChecked) |
||
2109 | { |
||
2110 | zoomAndPanControl.ContentOffsetX = ViewerDataModel.Instance.Sync_ContentOffsetX; |
||
2111 | zoomAndPanControl.ContentOffsetY = ViewerDataModel.Instance.Sync_ContentOffsetY; |
||
2112 | } |
||
2113 | } |
||
2114 | } |
||
2115 | |||
2116 | 787a4489 | KangIngu | private List<CommentUserInfo> hitList = new List<CommentUserInfo>(); |
2117 | |||
2118 | private EllipseGeometry hitArea = new EllipseGeometry(); |
||
2119 | |||
2120 | private void zoomAndPanControl_MouseUp(object sender, MouseButtonEventArgs e) |
||
2121 | { |
||
2122 | IsDrawing = false; |
||
2123 | d5e3aa15 | taeseongkim | |
2124 | 787a4489 | KangIngu | if (mouseHandlingMode != MouseHandlingMode.None) |
2125 | { |
||
2126 | if (mouseHandlingMode == MouseHandlingMode.Drawing) |
||
2127 | { |
||
2128 | 510cbd2a | ljiyeon | this.cursor = new Cursor(MainWindow.CursorChange().StreamSource); |
2129 | 787a4489 | KangIngu | |
2130 | SetCursor(); |
||
2131 | |||
2132 | switch (controlType) |
||
2133 | { |
||
2134 | case ControlType.None: |
||
2135 | break; |
||
2136 | case ControlType.Rectangle: |
||
2137 | { |
||
2138 | |||
2139 | } |
||
2140 | break; |
||
2141 | case ControlType.PenControl: |
||
2142 | { |
||
2143 | |||
2144 | } |
||
2145 | break; |
||
2146 | default: |
||
2147 | break; |
||
2148 | 4eb052e4 | ljiyeon | } |
2149 | 787a4489 | KangIngu | } |
2150 | 9f473fb7 | KangIngu | else if (mouseHandlingMode == MouseHandlingMode.Selecting && e.ChangedButton == MouseButton.Left || mouseHandlingMode == MouseHandlingMode.Capture && e.ChangedButton == MouseButton.Left || mouseHandlingMode == MouseHandlingMode.DragZoom && e.ChangedButton == MouseButton.Left) |
2151 | 787a4489 | KangIngu | { |
2152 | d5e3aa15 | taeseongkim | ViewerDataModel.Instance.AngleVisibility = Visibility.Collapsed; |
2153 | |||
2154 | 787a4489 | KangIngu | if (isLeftMouseButtonDownOnWindow) |
2155 | { |
||
2156 | bool wasDragSelectionApplied = false; |
||
2157 | |||
2158 | if (isDraggingSelectionRect) |
||
2159 | { |
||
2160 | 53880c83 | ljiyeon | if (mouseHandlingMode == MouseHandlingMode.Capture && controlType == ControlType.ImgControl) |
2161 | { |
||
2162 | dragCaptureBorder.Visibility = Visibility.Collapsed; |
||
2163 | mouseHandlingMode = MouseHandlingMode.None; |
||
2164 | Point endPoint = e.GetPosition(zoomAndPanCanvas); |
||
2165 | symbolselectindex = symbolPanel_Instance.RadTab.SelectedIndex; |
||
2166 | Set_Symbol_Capture(endPoint); |
||
2167 | ViewerDataModel.Instance.ViewVisible = Visibility.Collapsed; |
||
2168 | ViewerDataModel.Instance.ViewVisible = Visibility.Visible; |
||
2169 | ViewerDataModel.Instance.Capture_Opacity = 0; |
||
2170 | } |
||
2171 | else if (mouseHandlingMode == MouseHandlingMode.Capture) |
||
2172 | 787a4489 | KangIngu | { |
2173 | dragCaptureBorder.Visibility = Visibility.Collapsed; |
||
2174 | mouseHandlingMode = MouseHandlingMode.None; |
||
2175 | Set_Capture(); |
||
2176 | |||
2177 | ViewerDataModel.Instance.ViewVisible = Visibility.Collapsed; |
||
2178 | ViewerDataModel.Instance.ViewVisible = Visibility.Visible; |
||
2179 | ViewerDataModel.Instance.Capture_Opacity = 0; |
||
2180 | } |
||
2181 | 9f473fb7 | KangIngu | else if (mouseHandlingMode == MouseHandlingMode.Selecting) |
2182 | 787a4489 | KangIngu | { |
2183 | ApplyDragSelectionRect(); |
||
2184 | } |
||
2185 | 9f473fb7 | KangIngu | else |
2186 | { |
||
2187 | double x = Canvas.GetLeft(dragZoomBorder); |
||
2188 | double y = Canvas.GetTop(dragZoomBorder); |
||
2189 | double width = dragZoomBorder.Width; |
||
2190 | double height = dragZoomBorder.Height; |
||
2191 | Rect dragRect = new Rect(x, y, width, height); |
||
2192 | |||
2193 | ViewerDataModel.Instance.SystemMain.dzMainMenu.zoomAndPanControl.ZoomTo(dragRect); |
||
2194 | |||
2195 | dragZoomBorder.Visibility = Visibility.Collapsed; |
||
2196 | } |
||
2197 | 787a4489 | KangIngu | |
2198 | 9f473fb7 | KangIngu | isDraggingSelectionRect = false; |
2199 | 787a4489 | KangIngu | e.Handled = true; |
2200 | wasDragSelectionApplied = true; |
||
2201 | } |
||
2202 | |||
2203 | if (isLeftMouseButtonDownOnWindow) |
||
2204 | { |
||
2205 | isLeftMouseButtonDownOnWindow = false; |
||
2206 | this.ReleaseMouseCapture(); |
||
2207 | e.Handled = true; |
||
2208 | } |
||
2209 | |||
2210 | if (!wasDragSelectionApplied) |
||
2211 | { |
||
2212 | init(); |
||
2213 | } |
||
2214 | } |
||
2215 | } |
||
2216 | e6a9ddaf | humkyung | else if (e.RightButton == MouseButtonState.Pressed) |
2217 | 787a4489 | KangIngu | { |
2218 | 510cbd2a | ljiyeon | this.cursor = new Cursor(MainWindow.CursorChange().StreamSource); |
2219 | 787a4489 | KangIngu | SetCursor(); |
2220 | } |
||
2221 | |||
2222 | zoomAndPanControl.ReleaseMouseCapture(); |
||
2223 | |||
2224 | |||
2225 | e.Handled = true; |
||
2226 | } |
||
2227 | else |
||
2228 | { |
||
2229 | 510cbd2a | ljiyeon | this.cursor = new Cursor(MainWindow.CursorChange().StreamSource); |
2230 | 787a4489 | KangIngu | SetCursor(); |
2231 | } |
||
2232 | |||
2233 | e6a9ddaf | humkyung | ///mouseButtonDown = MouseButton.Left; |
2234 | 787a4489 | KangIngu | //controlType = ControlType.SingleLine; |
2235 | } |
||
2236 | |||
2237 | 53880c83 | ljiyeon | public void Set_Symbol_Capture(Point endPoint) |
2238 | { |
||
2239 | c7fde400 | taeseongkim | double x = CanvasDrawingMouseDownPoint.X; |
2240 | double y = CanvasDrawingMouseDownPoint.Y; |
||
2241 | 53880c83 | ljiyeon | if(x > endPoint.X) |
2242 | { |
||
2243 | x = endPoint.X; |
||
2244 | y = endPoint.Y; |
||
2245 | } |
||
2246 | |||
2247 | double width = dragCaptureBorder.Width; |
||
2248 | double height = dragCaptureBorder.Height; |
||
2249 | |||
2250 | canvasImage = ConverterBitmapImage(zoomAndPanCanvas); |
||
2251 | |||
2252 | if (x < 0) |
||
2253 | { |
||
2254 | width += x; |
||
2255 | x = 0; |
||
2256 | } |
||
2257 | if (y < 0) |
||
2258 | { |
||
2259 | height += y; |
||
2260 | y = 0; |
||
2261 | |||
2262 | width = (int)canvasImage.PixelWidth - x; |
||
2263 | } |
||
2264 | if (x + width > canvasImage.PixelWidth) |
||
2265 | { |
||
2266 | width = (int)canvasImage.PixelWidth - x; |
||
2267 | } |
||
2268 | if (y + height > canvasImage.PixelHeight) |
||
2269 | { |
||
2270 | height = (int)canvasImage.PixelHeight - y; |
||
2271 | } |
||
2272 | var rect = new Int32Rect((int)x, (int)y, (int)width, (int)height); |
||
2273 | |||
2274 | 69f41aab | humkyung | string uri = this.GetImageURL(_ViewInfo.DocumentItemID, Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber); |
2275 | 53880c83 | ljiyeon | var defaultBitmapImage = new BitmapImage(); |
2276 | defaultBitmapImage.BeginInit(); |
||
2277 | defaultBitmapImage.CreateOptions = BitmapCreateOptions.IgnoreImageCache; |
||
2278 | defaultBitmapImage.CacheOption = BitmapCacheOption.OnLoad; |
||
2279 | defaultBitmapImage.UriSource = new Uri(uri); |
||
2280 | defaultBitmapImage.EndInit(); |
||
2281 | |||
2282 | 90e7968d | ljiyeon | //GC.Collect(); |
2283 | 53880c83 | ljiyeon | |
2284 | if (defaultBitmapImage.IsDownloading) |
||
2285 | { |
||
2286 | defaultBitmapImage.DownloadCompleted += (ex, arg) => |
||
2287 | { |
||
2288 | defaultBitmapImage.Freeze(); |
||
2289 | 90e7968d | ljiyeon | //GC.Collect(); |
2290 | 53880c83 | ljiyeon | BitmapSource bs = new CroppedBitmap(defaultBitmapImage, rect); |
2291 | Save_Symbol_Capture(bs, (int)x, (int)y, (int)width, (int)height); |
||
2292 | }; |
||
2293 | } |
||
2294 | } |
||
2295 | |||
2296 | a1716fa5 | KangIngu | private void zoomAndPanControl2_MouseUp(object sender, MouseButtonEventArgs e) |
2297 | { |
||
2298 | e6a9ddaf | humkyung | ///mouseButtonDown = MouseButton.Left; |
2299 | a1716fa5 | KangIngu | } |
2300 | |||
2301 | 787a4489 | KangIngu | private void zoomAndPanControl_MouseLeave(object sender, MouseEventArgs e) |
2302 | { |
||
2303 | e6a9ddaf | humkyung | ///mouseButtonDown = MouseButton.Left; |
2304 | 53880c83 | ljiyeon | //this.cursor = new Cursor(MainWindow.CursorChange().StreamSource); |
2305 | 787a4489 | KangIngu | } |
2306 | |||
2307 | private void zoomAndPanControl_MouseDoubleClick(object sender, MouseButtonEventArgs e) |
||
2308 | { |
||
2309 | |||
2310 | } |
||
2311 | |||
2312 | 4804a4fb | humkyung | /// <summary> |
2313 | /// select items by dragging |
||
2314 | /// </summary> |
||
2315 | 787a4489 | KangIngu | private void ApplyDragSelectionRect() |
2316 | { |
||
2317 | dragSelectionBorder.Visibility = Visibility.Collapsed; |
||
2318 | |||
2319 | double x = Canvas.GetLeft(dragSelectionBorder); |
||
2320 | double y = Canvas.GetTop(dragSelectionBorder); |
||
2321 | double width = dragSelectionBorder.Width; |
||
2322 | double height = dragSelectionBorder.Height; |
||
2323 | Boolean Flag = false; |
||
2324 | List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>(); |
||
2325 | f87a00b1 | ljiyeon | var Items = ViewerDataModel.Instance.MarkupControls_USER.Where(d => d.Visibility != Visibility.Hidden).ToList(); |
2326 | 787a4489 | KangIngu | |
2327 | e6a9ddaf | humkyung | Rect dragRect = new Rect(x, y, width, height); |
2328 | ///dragRect.Inflate(width / 10, height / 10); |
||
2329 | 787a4489 | KangIngu | |
2330 | foreach (var item in Items) |
||
2331 | { |
||
2332 | 91efe37a | humkyung | Flag = SelectionSet.Instance.SelectControl(item, dragRect); |
2333 | 787a4489 | KangIngu | |
2334 | if (Flag) |
||
2335 | { |
||
2336 | adornerSet.Add(item); |
||
2337 | 05009a0e | ljiyeon | ViewerDataModel.Instance.MarkupControls_USER.Remove(item); |
2338 | 787a4489 | KangIngu | Control_Style(item); |
2339 | } |
||
2340 | } |
||
2341 | if (adornerSet.Count > 0) |
||
2342 | { |
||
2343 | Controls.AdornerFinal final = new Controls.AdornerFinal(adornerSet); |
||
2344 | SelectLayer.Children.Add(final); |
||
2345 | } |
||
2346 | } |
||
2347 | |||
2348 | private void InitDragSelectionRect(Point pt1, Point pt2) |
||
2349 | { |
||
2350 | 9f473fb7 | KangIngu | //캡쳐 중 |
2351 | if (mouseHandlingMode == MouseHandlingMode.Capture) |
||
2352 | { |
||
2353 | dragCaptureBorder.Visibility = Visibility.Visible; |
||
2354 | } |
||
2355 | 787a4489 | KangIngu | //선택 중 |
2356 | 9f473fb7 | KangIngu | else if (mouseHandlingMode == MouseHandlingMode.Selecting) |
2357 | 787a4489 | KangIngu | { |
2358 | e54660e8 | KangIngu | |
2359 | 787a4489 | KangIngu | dragSelectionBorder.Visibility = Visibility.Visible; |
2360 | } |
||
2361 | else |
||
2362 | { |
||
2363 | 9f473fb7 | KangIngu | dragZoomBorder.Visibility = Visibility.Visible; |
2364 | 787a4489 | KangIngu | } |
2365 | UpdateDragSelectionRect(pt1, pt2); |
||
2366 | } |
||
2367 | |||
2368 | /// <summary> |
||
2369 | /// Update the position and size of the rectangle used for drag selection. |
||
2370 | /// </summary> |
||
2371 | private void UpdateDragSelectionRect(Point pt1, Point pt2) |
||
2372 | { |
||
2373 | double x, y, width, height; |
||
2374 | |||
2375 | // |
||
2376 | // Determine x,y,width and height of the rect inverting the points if necessary. |
||
2377 | // |
||
2378 | |||
2379 | if (pt2.X < pt1.X) |
||
2380 | { |
||
2381 | x = pt2.X; |
||
2382 | width = pt1.X - pt2.X; |
||
2383 | } |
||
2384 | else |
||
2385 | { |
||
2386 | x = pt1.X; |
||
2387 | width = pt2.X - pt1.X; |
||
2388 | } |
||
2389 | |||
2390 | if (pt2.Y < pt1.Y) |
||
2391 | { |
||
2392 | y = pt2.Y; |
||
2393 | height = pt1.Y - pt2.Y; |
||
2394 | } |
||
2395 | else |
||
2396 | { |
||
2397 | y = pt1.Y; |
||
2398 | height = pt2.Y - pt1.Y; |
||
2399 | } |
||
2400 | |||
2401 | // |
||
2402 | // Update the coordinates of the rectangle used for drag selection. |
||
2403 | // |
||
2404 | 9f473fb7 | KangIngu | //캡쳐 중 |
2405 | if (mouseHandlingMode == MouseHandlingMode.Capture) |
||
2406 | { |
||
2407 | Canvas.SetLeft(dragCaptureBorder, x); |
||
2408 | Canvas.SetTop(dragCaptureBorder, y); |
||
2409 | dragCaptureBorder.Width = width; |
||
2410 | dragCaptureBorder.Height = height; |
||
2411 | } |
||
2412 | 787a4489 | KangIngu | //선택 중 |
2413 | a1716fa5 | KangIngu | else if (mouseHandlingMode == MouseHandlingMode.Selecting) |
2414 | 787a4489 | KangIngu | { |
2415 | Canvas.SetLeft(dragSelectionBorder, x); |
||
2416 | Canvas.SetTop(dragSelectionBorder, y); |
||
2417 | dragSelectionBorder.Width = width; |
||
2418 | dragSelectionBorder.Height = height; |
||
2419 | } |
||
2420 | else |
||
2421 | { |
||
2422 | 9f473fb7 | KangIngu | Canvas.SetLeft(dragZoomBorder, x); |
2423 | Canvas.SetTop(dragZoomBorder, y); |
||
2424 | dragZoomBorder.Width = width; |
||
2425 | dragZoomBorder.Height = height; |
||
2426 | 787a4489 | KangIngu | } |
2427 | } |
||
2428 | |||
2429 | private void drawingPannelRotate(double angle) |
||
2430 | { |
||
2431 | 548c696e | ljiyeon | Logger.sendCheckLog("pageNavigator_PageChanging_drawingPannelRotate Setting", 1); |
2432 | 787a4489 | KangIngu | rotate.Angle = angle; |
2433 | var rotationNum = Math.Abs((rotate.Angle / 90)); |
||
2434 | |||
2435 | if (angle == 90 || angle == 270) |
||
2436 | { |
||
2437 | double emptySize = zoomAndPanCanvas.Width; |
||
2438 | zoomAndPanCanvas.Width = zoomAndPanCanvas.Height; |
||
2439 | zoomAndPanCanvas.Height = emptySize; |
||
2440 | } |
||
2441 | if (angle == 0) |
||
2442 | { |
||
2443 | translate.X = 0; |
||
2444 | translate.Y = 0; |
||
2445 | } |
||
2446 | else if (angle == 90) |
||
2447 | { |
||
2448 | translate.X = zoomAndPanCanvas.Width; |
||
2449 | translate.Y = 0; |
||
2450 | } |
||
2451 | else if (angle == 180) |
||
2452 | { |
||
2453 | translate.X = zoomAndPanCanvas.Width; |
||
2454 | translate.Y = zoomAndPanCanvas.Height; |
||
2455 | } |
||
2456 | else |
||
2457 | { |
||
2458 | translate.X = 0; |
||
2459 | translate.Y = zoomAndPanCanvas.Height; |
||
2460 | } |
||
2461 | |||
2462 | zoomAndPanControl.RotationAngle = rotate.Angle; |
||
2463 | |||
2464 | |||
2465 | if (!testPanel2.IsHidden) |
||
2466 | { |
||
2467 | zoomAndPanControl2.RotationAngle = rotate.Angle; |
||
2468 | zoomAndPanCanvas2.Width = zoomAndPanCanvas.Width; |
||
2469 | zoomAndPanCanvas2.Height = zoomAndPanCanvas.Height; |
||
2470 | } |
||
2471 | |||
2472 | ViewerDataModel.Instance.ContentWidth = zoomAndPanCanvas.Width; |
||
2473 | ViewerDataModel.Instance.ContentHeight = zoomAndPanCanvas.Height; |
||
2474 | ViewerDataModel.Instance.AngleOffsetX = translate.X; |
||
2475 | ViewerDataModel.Instance.AngleOffsetY = translate.Y; |
||
2476 | ViewerDataModel.Instance.Angle = rotate.Angle; |
||
2477 | } |
||
2478 | |||
2479 | 497bbe52 | ljiyeon | private void syncPannelRotate(double angle) |
2480 | { |
||
2481 | //Logger.sendCheckLog("pageNavigator_PageChanging_drawingPannelRotate Setting", 1); |
||
2482 | rotate.Angle = angle; |
||
2483 | var rotationNum = Math.Abs((rotate.Angle / 90)); |
||
2484 | |||
2485 | if (angle == 90 || angle == 270) |
||
2486 | { |
||
2487 | double emptySize = zoomAndPanCanvas2.Width; |
||
2488 | zoomAndPanCanvas2.Width = zoomAndPanCanvas2.Height; |
||
2489 | zoomAndPanCanvas2.Height = emptySize; |
||
2490 | } |
||
2491 | if (angle == 0) |
||
2492 | { |
||
2493 | translate2.X = 0; |
||
2494 | translate2.Y = 0; |
||
2495 | } |
||
2496 | else if (angle == 90) |
||
2497 | { |
||
2498 | translate2.X = zoomAndPanCanvas2.Width; |
||
2499 | translate2.Y = 0; |
||
2500 | } |
||
2501 | else if (angle == 180) |
||
2502 | { |
||
2503 | translate2.X = zoomAndPanCanvas2.Width; |
||
2504 | translate2.Y = zoomAndPanCanvas2.Height; |
||
2505 | } |
||
2506 | else |
||
2507 | { |
||
2508 | translate2.X = 0; |
||
2509 | translate2.Y = zoomAndPanCanvas2.Height; |
||
2510 | } |
||
2511 | |||
2512 | zoomAndPanControl2.RotationAngle = rotate.Angle; |
||
2513 | } |
||
2514 | |||
2515 | 53880c83 | ljiyeon | public void PlaceImageSymbol(string id, long group_id, int SelectedIndex, Point canvasZoomPanningMouseDownPoint) |
2516 | 787a4489 | KangIngu | { |
2517 | 53880c83 | ljiyeon | string Data_ = ""; |
2518 | |||
2519 | try |
||
2520 | { |
||
2521 | Logger.sendReqLog("GetSymbolImageURL: ", id + "," + SelectedIndex, 1); |
||
2522 | Data_ = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.GetSymbolImageURL(id, SelectedIndex); |
||
2523 | if (Data_ != null || Data_ != "") |
||
2524 | { |
||
2525 | Logger.sendResLog("GetSymbolImageURL", "TRUE", 1); |
||
2526 | } |
||
2527 | else |
||
2528 | { |
||
2529 | Logger.sendResLog("GetSymbolImageURL", "FALSE", 1); |
||
2530 | } |
||
2531 | |||
2532 | c0977e97 | djkim | //MARKUP_DATA_GROUP mARKUP_DATA_GROUP = new MARKUP_DATA_GROUP |
2533 | //{ |
||
2534 | // SYMBOL_ID = id,//InnerItem.Symbol_ID |
||
2535 | // STATE = 0, |
||
2536 | //}; |
||
2537 | 53880c83 | ljiyeon | if (Data_ != null) |
2538 | { |
||
2539 | Image img = new Image(); |
||
2540 | //img.Source = new System.Windows.Media.Imaging.BitmapImage(new Uri(Data_)); |
||
2541 | if (Data_.Contains(".svg")) |
||
2542 | { |
||
2543 | byte[] imageData = null; |
||
2544 | DrawingImage image = null; |
||
2545 | using (System.Net.WebClient web = new System.Net.WebClient()) |
||
2546 | { |
||
2547 | imageData = web.DownloadData(new Uri(Data_)); |
||
2548 | System.IO.Stream stream = new System.IO.MemoryStream(imageData); |
||
2549 | image = SvgReader.Load(stream); |
||
2550 | } |
||
2551 | img.Source = image; |
||
2552 | } |
||
2553 | else |
||
2554 | { |
||
2555 | img.Source = new BitmapImage(new Uri(Data_)); |
||
2556 | } |
||
2557 | |||
2558 | var currentControl = new MarkupToPDF.Controls.Etc.ImgControl |
||
2559 | { |
||
2560 | PointSet = new List<Point>(), |
||
2561 | FilePath = Data_, |
||
2562 | ImageData = img.Source, |
||
2563 | StartPoint = canvasZoomPanningMouseDownPoint, |
||
2564 | EndPoint = new Point(canvasZoomPanningMouseDownPoint.X + img.Source.Width, |
||
2565 | canvasZoomPanningMouseDownPoint.Y + img.Source.Height), |
||
2566 | TopRightPoint = new Point(canvasZoomPanningMouseDownPoint.X+img.Source.Width, |
||
2567 | canvasZoomPanningMouseDownPoint.Y), |
||
2568 | LeftBottomPoint = new Point(canvasZoomPanningMouseDownPoint.X, |
||
2569 | canvasZoomPanningMouseDownPoint.Y + img.Source.Height) |
||
2570 | }; |
||
2571 | |||
2572 | currentControl.PointSet = new List<Point> |
||
2573 | { |
||
2574 | currentControl.StartPoint, |
||
2575 | currentControl.LeftBottomPoint, |
||
2576 | currentControl.EndPoint, |
||
2577 | currentControl.TopRightPoint, |
||
2578 | }; |
||
2579 | Multi_Undo_data multi_Undo_Data = new Multi_Undo_data(); |
||
2580 | UndoData = new Undo_data() |
||
2581 | { |
||
2582 | IsUndo = false, |
||
2583 | Event = Event_Type.Create, |
||
2584 | EventTime = DateTime.Now, |
||
2585 | Markup_List = new List<Multi_Undo_data>() |
||
2586 | }; |
||
2587 | ViewerDataModel.Instance.UndoDataList.Where(data1 => data1.IsUndo == true).ToList().ForEach(i => |
||
2588 | { |
||
2589 | ViewerDataModel.Instance.UndoDataList.Remove(i); |
||
2590 | }); |
||
2591 | |||
2592 | //multi_Undo_Data = dzMainMenu.Control_Style(currentControl as MarkupToPDF.Common.CommentUserInfo); |
||
2593 | multi_Undo_Data = Control_Style(currentControl as MarkupToPDF.Common.CommentUserInfo); |
||
2594 | UndoData.Markup_List.Add(multi_Undo_Data); |
||
2595 | ViewerDataModel.Instance.UndoDataList.Add(UndoData); |
||
2596 | |||
2597 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl as MarkupToPDF.Common.CommentUserInfo); |
||
2598 | 24678e06 | humkyung | currentControl.CommentID = Commons.shortGuid(); |
2599 | 53880c83 | ljiyeon | currentControl.SymbolID = id; |
2600 | currentControl.GroupID = group_id; |
||
2601 | currentControl.ApplyTemplate(); |
||
2602 | currentControl.SetImage(); |
||
2603 | |||
2604 | ViewerDataModel.Instance.MarkupControls_USER.Remove(currentControl as MarkupToPDF.Common.CommentUserInfo); |
||
2605 | Controls.AdornerFinal final = new Controls.AdornerFinal(currentControl as MarkupToPDF.Common.CommentUserInfo); |
||
2606 | SelectLayer.Children.Add(final); |
||
2607 | } |
||
2608 | } |
||
2609 | catch (Exception ex) |
||
2610 | { |
||
2611 | this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert(ex.Message, "Error"); |
||
2612 | } |
||
2613 | } |
||
2614 | |||
2615 | d7e20d2d | taeseongkim | private async void zoomAndPanControl_MouseDown(object sender, MouseButtonEventArgs e) |
2616 | 10de973b | taeseongkim | { |
2617 | 992a98b4 | KangIngu | var set_option = this.ParentOfType<MainWindow>().dzTopMenu.Parent.ChildrenOfType<RadNumericUpDown>().Where(item => item.IsKeyboardFocusWithin).FirstOrDefault(); |
2618 | be04d12c | djkim | if (set_option != null && !string.IsNullOrEmpty(set_option.ContentText)) |
2619 | 992a98b4 | KangIngu | { |
2620 | set_option.Value = double.Parse(set_option.ContentText); |
||
2621 | 5d55f6fb | ljiyeon | //set_option.Focusable = false; |
2622 | 3c71b3a5 | taeseongkim | zoomAndPanControl.Focus(); |
2623 | 992a98b4 | KangIngu | } |
2624 | |||
2625 | f959ea6f | humkyung | ConvertInkControlToPolygon(); |
2626 | 787a4489 | KangIngu | |
2627 | d62c0439 | humkyung | ///TODO: |
2628 | 787a4489 | KangIngu | var text_item = ViewerDataModel.Instance.MarkupControls_USER.Where(data => |
2629 | (data as TextControl) != null && (data as TextControl).Text == "" || (data as ArrowTextControl) != null && (data as ArrowTextControl).ArrowText == "").FirstOrDefault(); |
||
2630 | |||
2631 | a1716fa5 | KangIngu | if (text_item != null && (currentControl as ArrowTextControl) == null) |
2632 | 787a4489 | KangIngu | { |
2633 | ViewerDataModel.Instance.MarkupControls_USER.Remove(text_item); |
||
2634 | } |
||
2635 | d62c0439 | humkyung | /// up to here |
2636 | 787a4489 | KangIngu | |
2637 | b7813553 | djkim | foreach (var item in ViewerDataModel.Instance.MarkupControls_USER) |
2638 | 787a4489 | KangIngu | { |
2639 | b7813553 | djkim | if (item as ArrowTextControl != null) |
2640 | 787a4489 | KangIngu | { |
2641 | b7813553 | djkim | (item as ArrowTextControl).Base_TextBox.IsHitTestVisible = false; |
2642 | 787a4489 | KangIngu | } |
2643 | 76688e76 | djkim | else if (item as TextControl != null) |
2644 | { |
||
2645 | (item as TextControl).Base_TextBox.IsHitTestVisible = false; |
||
2646 | } |
||
2647 | 787a4489 | KangIngu | } |
2648 | |||
2649 | 49b217ad | humkyung | //if (currentControl != null) |
2650 | 787a4489 | KangIngu | { |
2651 | a6f7f9b6 | djkim | var text_item_ = ViewerDataModel.Instance.MarkupControls_USER.Where(data => (data as TextControl) != null && (data as TextControl).IsEditingMode == true).FirstOrDefault(); |
2652 | if (text_item_ != null) |
||
2653 | 787a4489 | KangIngu | { |
2654 | (text_item_ as TextControl).Base_TextBlock.Visibility = Visibility.Visible; |
||
2655 | (text_item_ as TextControl).Base_TextBox.Visibility = Visibility.Collapsed; |
||
2656 | a6f7f9b6 | djkim | (text_item_ as TextControl).IsEditingMode = false; |
2657 | 49b217ad | humkyung | currentControl = null; |
2658 | 787a4489 | KangIngu | } |
2659 | |||
2660 | var Arrowtext_item_ = ViewerDataModel.Instance.MarkupControls_USER.Where(data => (data as ArrowTextControl) != null && (data as ArrowTextControl).IsEditingMode == true).FirstOrDefault(); |
||
2661 | 49b217ad | humkyung | if (Arrowtext_item_ != null && ((Arrowtext_item_ as ArrowTextControl).IsNew == false)) |
2662 | 787a4489 | KangIngu | { |
2663 | (Arrowtext_item_ as ArrowTextControl).IsEditingMode = false; |
||
2664 | (Arrowtext_item_ as ArrowTextControl).Base_TextBox.Focusable = false; |
||
2665 | 49b217ad | humkyung | currentControl = null; |
2666 | 787a4489 | KangIngu | } |
2667 | } |
||
2668 | |||
2669 | ca40e004 | ljiyeon | double Ang = 0; |
2670 | 787a4489 | KangIngu | if (rotate.Angle != 0) |
2671 | { |
||
2672 | Ang = 360 - rotate.Angle; |
||
2673 | } |
||
2674 | |||
2675 | if (e.OriginalSource is System.Windows.Controls.Image) |
||
2676 | { |
||
2677 | (e.OriginalSource as System.Windows.Controls.Image).Focus(); |
||
2678 | } |
||
2679 | 7211e0c2 | ljiyeon | /* |
2680 | e6a9ddaf | humkyung | if (mouseHandlingMode == MouseHandlingMode.DragSymbol && e.LeftButton == MouseButtonState.Pressed) |
2681 | 53880c83 | ljiyeon | { |
2682 | canvasZoomPanningMouseDownPoint = e.GetPosition(zoomAndPanCanvas); |
||
2683 | if(symbol_id != null) |
||
2684 | { |
||
2685 | PlaceImageSymbol(symbol_id, symbol_group_id, symbol_SelectedIndex, canvasZoomPanningMouseDownPoint); |
||
2686 | } |
||
2687 | } |
||
2688 | |||
2689 | e6a9ddaf | humkyung | if (mouseHandlingMode == MouseHandlingMode.DragSymbol && e.RightButton == MouseButtonState.Pressed) |
2690 | 53880c83 | ljiyeon | { |
2691 | if (this._dragdropWindow != null) |
||
2692 | { |
||
2693 | this._dragdropWindow.Close(); |
||
2694 | this._dragdropWindow = null; |
||
2695 | symbol_id = null; |
||
2696 | } |
||
2697 | } |
||
2698 | 7211e0c2 | ljiyeon | */ |
2699 | 53880c83 | ljiyeon | |
2700 | e6a9ddaf | humkyung | if (e.LeftButton == MouseButtonState.Pressed) |
2701 | 787a4489 | KangIngu | { |
2702 | c7fde400 | taeseongkim | CanvasDrawingMouseDownPoint = e.GetPosition(drawingRotateCanvas); |
2703 | 787a4489 | KangIngu | canvasZoomPanningMouseDownPoint = e.GetPosition(zoomAndPanCanvas); |
2704 | |||
2705 | 510cbd2a | ljiyeon | this.cursor = new Cursor(MainWindow.CursorChange().StreamSource); |
2706 | 787a4489 | KangIngu | SetCursor(); |
2707 | |||
2708 | 315ae55e | taeseongkim | if (!ViewerDataModel.Instance.IsPressCtrl) |
2709 | { |
||
2710 | SelectionSet.Instance.UnSelect(this); |
||
2711 | } |
||
2712 | 787a4489 | KangIngu | } |
2713 | f513c215 | humkyung | |
2714 | e6a9ddaf | humkyung | if (e.MiddleButton == MouseButtonState.Pressed) |
2715 | 787a4489 | KangIngu | { |
2716 | canvasZoommovingMouseDownPoint = e.GetPosition(zoomAndPanCanvas); |
||
2717 | cursor = Cursors.SizeAll; |
||
2718 | SetCursor(); |
||
2719 | } |
||
2720 | e6a9ddaf | humkyung | if (e.RightButton == MouseButtonState.Pressed) |
2721 | 787a4489 | KangIngu | { |
2722 | canvasZoommovingMouseDownPoint = e.GetPosition(zoomAndPanCanvas); |
||
2723 | cursor = Cursors.SizeAll; |
||
2724 | SetCursor(); |
||
2725 | } |
||
2726 | e6a9ddaf | humkyung | else if (e.XButton1 == MouseButtonState.Pressed) |
2727 | 787a4489 | KangIngu | { |
2728 | if (this.pageNavigator.CurrentPage.PageNumber + 1 <= this.pageNavigator.PageCount) |
||
2729 | { |
||
2730 | 3908a575 | humkyung | this.pageNavigator.GotoPage(this.pageNavigator.CurrentPage.PageNumber + 1); |
2731 | 787a4489 | KangIngu | } |
2732 | |||
2733 | 3908a575 | humkyung | //this.pageNavigator.GotoPage(this.pageNavigator._NextPage.PageNumber); |
2734 | 787a4489 | KangIngu | |
2735 | } |
||
2736 | e6a9ddaf | humkyung | else if (e.XButton2 == MouseButtonState.Pressed) |
2737 | 787a4489 | KangIngu | { |
2738 | if (this.pageNavigator.CurrentPage.PageNumber > 1) |
||
2739 | { |
||
2740 | this.pageNavigator.GotoPage(this.pageNavigator.CurrentPage.PageNumber - 1); |
||
2741 | } |
||
2742 | } |
||
2743 | |||
2744 | e6a9ddaf | humkyung | if (e.LeftButton == MouseButtonState.Pressed && mouseHandlingMode != MouseHandlingMode.Drawing && currentControl == null) |
2745 | 787a4489 | KangIngu | { |
2746 | if (mouseHandlingMode == MouseHandlingMode.Selecting) |
||
2747 | { |
||
2748 | if (SelectLayer.Children.Count == 0) |
||
2749 | { |
||
2750 | isLeftMouseButtonDownOnWindow = true; |
||
2751 | mouseHandlingMode = MouseHandlingMode.Selecting; |
||
2752 | } |
||
2753 | |||
2754 | if (controlType == ControlType.None) |
||
2755 | { |
||
2756 | isLeftMouseButtonDownOnWindow = true; |
||
2757 | } |
||
2758 | } |
||
2759 | |||
2760 | f513c215 | humkyung | /// 캡쳐 모드 설정 |
2761 | 9f473fb7 | KangIngu | if (mouseHandlingMode == MouseHandlingMode.Capture) |
2762 | { |
||
2763 | dragCaptureBorder.Visibility = Visibility.Visible; |
||
2764 | isLeftMouseButtonDownOnWindow = true; |
||
2765 | } |
||
2766 | |||
2767 | f513c215 | humkyung | /// 줌 모드 설정 |
2768 | 9f473fb7 | KangIngu | if (mouseHandlingMode == MouseHandlingMode.DragZoom) |
2769 | { |
||
2770 | isLeftMouseButtonDownOnWindow = true; |
||
2771 | 1066bae3 | ljiyeon | } |
2772 | 787a4489 | KangIngu | |
2773 | 05009a0e | ljiyeon | var control = ViewerDataModel.Instance.MarkupControls_USER.Where(data => data.IsMouseOver).FirstOrDefault(); |
2774 | 787a4489 | KangIngu | if (control != null) |
2775 | { |
||
2776 | d62c0439 | humkyung | AdornerFinal final = null; |
2777 | 787a4489 | KangIngu | |
2778 | if (!ViewerDataModel.Instance.IsPressCtrl) |
||
2779 | { |
||
2780 | d62c0439 | humkyung | /// 기존 selection 해제 |
2781 | 077896be | humkyung | SelectionSet.Instance.UnSelect(this); |
2782 | d62c0439 | humkyung | |
2783 | 787a4489 | KangIngu | final = new AdornerFinal(control); |
2784 | |||
2785 | f513c215 | humkyung | this.Control_Style(control); |
2786 | 787a4489 | KangIngu | |
2787 | if ((control as IPath) != null) |
||
2788 | { |
||
2789 | if ((control as IPath).LineSize != 0) |
||
2790 | { |
||
2791 | ViewerDataModel.Instance.LineSize = (control as IPath).LineSize; |
||
2792 | } |
||
2793 | } |
||
2794 | if ((control as IShapeControl) != null) |
||
2795 | { |
||
2796 | if ((control as IShapeControl).Paint == PaintSet.Hatch) |
||
2797 | { |
||
2798 | ViewerDataModel.Instance.checkHatchShape = true; |
||
2799 | } |
||
2800 | else if ((control as IShapeControl).Paint == PaintSet.Fill) |
||
2801 | { |
||
2802 | ViewerDataModel.Instance.checkFillShape = true; |
||
2803 | } |
||
2804 | else |
||
2805 | { |
||
2806 | ViewerDataModel.Instance.checkHatchShape = false; |
||
2807 | ViewerDataModel.Instance.checkFillShape = false; |
||
2808 | } |
||
2809 | ViewerDataModel.Instance.paintSet = (control as IShapeControl).Paint; |
||
2810 | } |
||
2811 | 9f473fb7 | KangIngu | |
2812 | 787a4489 | KangIngu | ViewerDataModel.Instance.ControlOpacity = control.Opacity; |
2813 | d4b0c723 | KangIngu | |
2814 | if ((control as TextControl) != null) |
||
2815 | { |
||
2816 | 71d7e0bf | 송근호 | if(!((control as TextControl).EnableEditing)) { |
2817 | (control as TextControl).EnableEditing = true; |
||
2818 | } |
||
2819 | d4b0c723 | KangIngu | if ((control as TextControl).TextStyle == FontStyles.Italic) |
2820 | { |
||
2821 | ViewerDataModel.Instance.checkTextStyle = true; |
||
2822 | } |
||
2823 | else |
||
2824 | { |
||
2825 | ViewerDataModel.Instance.checkTextStyle = false; |
||
2826 | } |
||
2827 | if ((control as TextControl).TextWeight == FontWeights.Bold) |
||
2828 | { |
||
2829 | ViewerDataModel.Instance.checkTextWeight = true; |
||
2830 | } |
||
2831 | else |
||
2832 | { |
||
2833 | ViewerDataModel.Instance.checkTextWeight = false; |
||
2834 | } |
||
2835 | if ((control as TextControl).UnderLine == TextDecorations.Underline) |
||
2836 | { |
||
2837 | ViewerDataModel.Instance.checkUnderLine = true; |
||
2838 | } |
||
2839 | else |
||
2840 | { |
||
2841 | ViewerDataModel.Instance.checkUnderLine = false; |
||
2842 | } |
||
2843 | ViewerDataModel.Instance.TextSize = (control as TextControl).TextSize; |
||
2844 | ViewerDataModel.Instance.checkHighlight = (control as TextControl).IsHighLight; |
||
2845 | e54660e8 | KangIngu | |
2846 | d4b0c723 | KangIngu | } |
2847 | else if ((control as ArrowTextControl) != null) |
||
2848 | { |
||
2849 | 120b8b00 | 송근호 | if (!((control as ArrowTextControl).EnableEditing)) |
2850 | { |
||
2851 | 71d7e0bf | 송근호 | (control as ArrowTextControl).EnableEditing = true; |
2852 | } |
||
2853 | e17af42b | KangIngu | if ((control as ArrowTextControl).TextStyle == FontStyles.Italic) |
2854 | d4b0c723 | KangIngu | { |
2855 | e17af42b | KangIngu | ViewerDataModel.Instance.checkTextStyle = true; |
2856 | } |
||
2857 | else |
||
2858 | d4b0c723 | KangIngu | { |
2859 | e17af42b | KangIngu | ViewerDataModel.Instance.checkTextStyle = false; |
2860 | d4b0c723 | KangIngu | } |
2861 | e17af42b | KangIngu | if ((control as ArrowTextControl).TextWeight == FontWeights.Bold) |
2862 | d4b0c723 | KangIngu | { |
2863 | e17af42b | KangIngu | ViewerDataModel.Instance.checkTextWeight = true; |
2864 | } |
||
2865 | else |
||
2866 | { |
||
2867 | ViewerDataModel.Instance.checkTextWeight = false; |
||
2868 | } |
||
2869 | if ((control as ArrowTextControl).UnderLine == TextDecorations.Underline) |
||
2870 | { |
||
2871 | ViewerDataModel.Instance.checkUnderLine = true; |
||
2872 | } |
||
2873 | else |
||
2874 | { |
||
2875 | ViewerDataModel.Instance.checkUnderLine = false; |
||
2876 | d4b0c723 | KangIngu | } |
2877 | ViewerDataModel.Instance.checkHighlight = (control as ArrowTextControl).isHighLight; |
||
2878 | ViewerDataModel.Instance.TextSize = (control as ArrowTextControl).TextSize; |
||
2879 | } |
||
2880 | 9f473fb7 | KangIngu | else if ((control as RectCloudControl) != null) |
2881 | { |
||
2882 | ViewerDataModel.Instance.ArcLength = (control as RectCloudControl).ArcLength; |
||
2883 | } |
||
2884 | else if ((control as CloudControl) != null) |
||
2885 | { |
||
2886 | ViewerDataModel.Instance.ArcLength = (control as CloudControl).ArcLength; |
||
2887 | } |
||
2888 | 787a4489 | KangIngu | } |
2889 | else |
||
2890 | { |
||
2891 | d62c0439 | humkyung | List<CommentUserInfo> comment = SelectionSet.Instance.SelectedItems; |
2892 | SelectionSet.Instance.UnSelect(this); |
||
2893 | 787a4489 | KangIngu | comment.Add(control); |
2894 | |||
2895 | Control_Style(control); |
||
2896 | |||
2897 | final = new AdornerFinal(comment); |
||
2898 | } |
||
2899 | |||
2900 | f513c215 | humkyung | if (final != null) |
2901 | { |
||
2902 | this.SelectLayer.Children.Add(final); |
||
2903 | } |
||
2904 | 6707a5c7 | ljiyeon | } |
2905 | 787a4489 | KangIngu | } |
2906 | else if (mouseHandlingMode == MouseHandlingMode.Drawing) |
||
2907 | 6707a5c7 | ljiyeon | { |
2908 | 787a4489 | KangIngu | init(); |
2909 | //강인구 추가(우 클릭 일 경우 커서 변경 하지 않음) |
||
2910 | if (cursor != Cursors.SizeAll) |
||
2911 | { |
||
2912 | cursor = Cursors.Cross; |
||
2913 | SetCursor(); |
||
2914 | } |
||
2915 | bool init_user = false; |
||
2916 | foreach (var user in gridViewMarkup.Items) |
||
2917 | { |
||
2918 | if ((user as MarkupInfoItem).UserID == App.ViewInfo.UserID) |
||
2919 | { |
||
2920 | init_user = true; |
||
2921 | } |
||
2922 | } |
||
2923 | if (init_user && gridViewMarkup.SelectedItems.Where(d => (d as MarkupInfoItem).UserID == App.ViewInfo.UserID).FirstOrDefault() == null && e.LeftButton == MouseButtonState.Pressed) |
||
2924 | { |
||
2925 | d7e20d2d | taeseongkim | // 기존의 코멘트가 존재합니다. 사용자 리스트에서 먼저 선택해주세요 |
2926 | 787a4489 | KangIngu | RadWindow.Alert(new DialogParameters |
2927 | { |
||
2928 | b9b01f8e | ljiyeon | Owner = Application.Current.MainWindow, |
2929 | 787a4489 | KangIngu | Theme = new VisualStudio2013Theme(), |
2930 | d7e20d2d | taeseongkim | Header = "Info", |
2931 | Content = "Existing comments already existed. Select from the user list first", |
||
2932 | 787a4489 | KangIngu | }); |
2933 | return; |
||
2934 | } |
||
2935 | else |
||
2936 | { |
||
2937 | var item = gridViewMarkup.SelectedItems.Where(d => (d as MarkupInfoItem).UserID == App.ViewInfo.UserID).FirstOrDefault() as MarkupInfoItem; |
||
2938 | if (item != null) |
||
2939 | { |
||
2940 | App.Custom_ViewInfoId = item.MarkupInfoID; |
||
2941 | } |
||
2942 | } |
||
2943 | |||
2944 | 75448f5e | ljiyeon | switch (controlType) |
2945 | 787a4489 | KangIngu | { |
2946 | 684ef11c | ljiyeon | case ControlType.Coordinate: |
2947 | { |
||
2948 | e6a9ddaf | humkyung | if (e.LeftButton == MouseButtonState.Pressed) |
2949 | 684ef11c | ljiyeon | { |
2950 | if (currentControl is CoordinateControl) |
||
2951 | { |
||
2952 | if (IsGetoutpoint((currentControl as CoordinateControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
||
2953 | { |
||
2954 | return; |
||
2955 | } |
||
2956 | |||
2957 | f513c215 | humkyung | CreateCommand.Instance.Execute(currentControl); |
2958 | 684ef11c | ljiyeon | |
2959 | currentControl = null; |
||
2960 | this.cursor = Cursors.Arrow; |
||
2961 | } |
||
2962 | else |
||
2963 | { |
||
2964 | this.ParentOfType<MainWindow>().dzTopMenu._SaveEvent(null, null); |
||
2965 | d62c0439 | humkyung | if (ViewerDataModel.Instance.MyMarkupList.Where(d => d.PageNumber == Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber |
2966 | 684ef11c | ljiyeon | && d.Data_Type == Convert.ToInt32(MarkupToPDF.Controls.Common.ControlType.Coordinate)).Count() > 0) |
2967 | { |
||
2968 | currentControl = null; |
||
2969 | this.cursor = Cursors.Arrow; |
||
2970 | Common.ViewerDataModel.Instance.SystemMain.DialogMessage_Alert("이미 해당 페이지의 도면 영역을 설정하셨습니다.", "Notice"); |
||
2971 | return; |
||
2972 | } |
||
2973 | else |
||
2974 | { |
||
2975 | currentControl = new CoordinateControl |
||
2976 | { |
||
2977 | Background = new SolidColorBrush(Colors.Black), |
||
2978 | c7fde400 | taeseongkim | StartPoint = this.CanvasDrawingMouseDownPoint, |
2979 | 684ef11c | ljiyeon | ControlType = ControlType.Coordinate |
2980 | }; |
||
2981 | |||
2982 | 24678e06 | humkyung | currentControl.CommentID = Commons.shortGuid(); |
2983 | 684ef11c | ljiyeon | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
2984 | currentControl.IsNew = true; |
||
2985 | |||
2986 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
||
2987 | |||
2988 | currentControl.SetValue(Canvas.ZIndexProperty, 3); |
||
2989 | } |
||
2990 | } |
||
2991 | } |
||
2992 | } |
||
2993 | break; |
||
2994 | case ControlType.InsideWhite: |
||
2995 | { |
||
2996 | e6a9ddaf | humkyung | if (e.LeftButton == MouseButtonState.Pressed) |
2997 | 684ef11c | ljiyeon | { |
2998 | if (currentControl is InsideWhiteControl) |
||
2999 | { |
||
3000 | if (IsGetoutpoint((currentControl as InsideWhiteControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
||
3001 | { |
||
3002 | return; |
||
3003 | } |
||
3004 | |||
3005 | f513c215 | humkyung | CreateCommand.Instance.Execute(currentControl); |
3006 | 684ef11c | ljiyeon | |
3007 | currentControl = null; |
||
3008 | this.cursor = Cursors.Arrow; |
||
3009 | } |
||
3010 | else |
||
3011 | { |
||
3012 | currentControl = new InsideWhiteControl |
||
3013 | { |
||
3014 | Background = new SolidColorBrush(Colors.Black), |
||
3015 | c7fde400 | taeseongkim | StartPoint = this.CanvasDrawingMouseDownPoint, |
3016 | 684ef11c | ljiyeon | ControlType = ControlType.InsideWhite |
3017 | }; |
||
3018 | |||
3019 | 24678e06 | humkyung | currentControl.CommentID = Commons.shortGuid(); |
3020 | 684ef11c | ljiyeon | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
3021 | currentControl.IsNew = true; |
||
3022 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
||
3023 | |||
3024 | currentControl.SetValue(Canvas.ZIndexProperty, 3); |
||
3025 | } |
||
3026 | } |
||
3027 | } |
||
3028 | break; |
||
3029 | case ControlType.OverlapWhite: |
||
3030 | { |
||
3031 | e6a9ddaf | humkyung | if (e.LeftButton == MouseButtonState.Pressed) |
3032 | 684ef11c | ljiyeon | { |
3033 | if (currentControl is OverlapWhiteControl) |
||
3034 | { |
||
3035 | if (IsGetoutpoint((currentControl as OverlapWhiteControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
||
3036 | { |
||
3037 | return; |
||
3038 | } |
||
3039 | |||
3040 | f513c215 | humkyung | CreateCommand.Instance.Execute(currentControl); |
3041 | 684ef11c | ljiyeon | |
3042 | currentControl = null; |
||
3043 | this.cursor = Cursors.Arrow; |
||
3044 | } |
||
3045 | else |
||
3046 | { |
||
3047 | currentControl = new OverlapWhiteControl |
||
3048 | { |
||
3049 | Background = new SolidColorBrush(Colors.Black), |
||
3050 | c7fde400 | taeseongkim | StartPoint = this.CanvasDrawingMouseDownPoint, |
3051 | 684ef11c | ljiyeon | ControlType = ControlType.OverlapWhite |
3052 | }; |
||
3053 | |||
3054 | 24678e06 | humkyung | currentControl.CommentID = Commons.shortGuid(); |
3055 | 684ef11c | ljiyeon | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
3056 | currentControl.IsNew = true; |
||
3057 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
||
3058 | |||
3059 | currentControl.SetValue(Canvas.ZIndexProperty, 3); |
||
3060 | } |
||
3061 | } |
||
3062 | } |
||
3063 | break; |
||
3064 | case ControlType.ClipWhite: |
||
3065 | { |
||
3066 | e6a9ddaf | humkyung | if (e.LeftButton == MouseButtonState.Pressed) |
3067 | 684ef11c | ljiyeon | { |
3068 | if (currentControl is ClipWhiteControl) |
||
3069 | { |
||
3070 | if (IsGetoutpoint((currentControl as ClipWhiteControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
||
3071 | { |
||
3072 | return; |
||
3073 | } |
||
3074 | |||
3075 | f513c215 | humkyung | CreateCommand.Instance.Execute(currentControl); |
3076 | 684ef11c | ljiyeon | |
3077 | currentControl = null; |
||
3078 | this.cursor = Cursors.Arrow; |
||
3079 | } |
||
3080 | else |
||
3081 | { |
||
3082 | currentControl = new ClipWhiteControl |
||
3083 | { |
||
3084 | Background = new SolidColorBrush(Colors.Black), |
||
3085 | c7fde400 | taeseongkim | StartPoint = this.CanvasDrawingMouseDownPoint, |
3086 | 684ef11c | ljiyeon | ControlType = ControlType.ClipWhite |
3087 | }; |
||
3088 | |||
3089 | 24678e06 | humkyung | currentControl.CommentID = Commons.shortGuid(); |
3090 | 684ef11c | ljiyeon | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
3091 | currentControl.IsNew = true; |
||
3092 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
||
3093 | |||
3094 | currentControl.SetValue(Canvas.ZIndexProperty, 3); |
||
3095 | } |
||
3096 | } |
||
3097 | } |
||
3098 | break; |
||
3099 | 787a4489 | KangIngu | case ControlType.Rectangle: |
3100 | { |
||
3101 | e6a9ddaf | humkyung | if (e.LeftButton == MouseButtonState.Pressed) |
3102 | 787a4489 | KangIngu | { |
3103 | f67f164e | humkyung | if (currentControl is RectangleControl) |
3104 | { |
||
3105 | //20180906 LJY TEST IsRotationDrawingEnable |
||
3106 | if (IsGetoutpoint((currentControl as RectangleControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
||
3107 | 787a4489 | KangIngu | { |
3108 | f67f164e | humkyung | return; |
3109 | } |
||
3110 | 787a4489 | KangIngu | |
3111 | f67f164e | humkyung | CreateCommand.Instance.Execute(currentControl); |
3112 | currentControl = null; |
||
3113 | 510cbd2a | ljiyeon | this.cursor = new Cursor(MainWindow.CursorChange().StreamSource); |
3114 | f67f164e | humkyung | } |
3115 | else |
||
3116 | { |
||
3117 | currentControl = new RectangleControl |
||
3118 | 787a4489 | KangIngu | { |
3119 | f67f164e | humkyung | Background = new SolidColorBrush(Colors.Black), |
3120 | c7fde400 | taeseongkim | StartPoint = this.CanvasDrawingMouseDownPoint, |
3121 | f67f164e | humkyung | ControlType = ControlType.Rectangle |
3122 | }; |
||
3123 | 787a4489 | KangIngu | |
3124 | f67f164e | humkyung | currentControl.CommentID = Commons.shortGuid(); |
3125 | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
||
3126 | currentControl.IsNew = true; |
||
3127 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
||
3128 | 787a4489 | KangIngu | |
3129 | f67f164e | humkyung | currentControl.SetValue(Canvas.ZIndexProperty, 3); |
3130 | } |
||
3131 | 787a4489 | KangIngu | } |
3132 | } |
||
3133 | break; |
||
3134 | case ControlType.RectCloud: |
||
3135 | { |
||
3136 | e6a9ddaf | humkyung | if (e.LeftButton == MouseButtonState.Pressed) |
3137 | 787a4489 | KangIngu | { |
3138 | f67f164e | humkyung | if (currentControl is RectCloudControl) |
3139 | { |
||
3140 | //20180906 LJY TEST IsRotationDrawingEnable |
||
3141 | if (IsGetoutpoint((currentControl as RectCloudControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
||
3142 | 787a4489 | KangIngu | { |
3143 | f67f164e | humkyung | return; |
3144 | } |
||
3145 | e66f22eb | KangIngu | |
3146 | f67f164e | humkyung | CreateCommand.Instance.Execute(currentControl); |
3147 | 787a4489 | KangIngu | |
3148 | f67f164e | humkyung | currentControl = null; |
3149 | |||
3150 | this.cursor = new Cursor(MainWindow.CursorChange().StreamSource); |
||
3151 | } |
||
3152 | else |
||
3153 | { |
||
3154 | currentControl = new RectCloudControl |
||
3155 | 787a4489 | KangIngu | { |
3156 | c7fde400 | taeseongkim | StartPoint = this.CanvasDrawingMouseDownPoint, |
3157 | f67f164e | humkyung | ControlType = ControlType.RectCloud, |
3158 | Background = new SolidColorBrush(Colors.Black) |
||
3159 | }; |
||
3160 | 787a4489 | KangIngu | |
3161 | f67f164e | humkyung | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
3162 | currentControl.CommentID = Commons.shortGuid(); |
||
3163 | currentControl.IsNew = true; |
||
3164 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
||
3165 | } |
||
3166 | 787a4489 | KangIngu | } |
3167 | } |
||
3168 | break; |
||
3169 | case ControlType.Circle: |
||
3170 | { |
||
3171 | e6a9ddaf | humkyung | if (e.LeftButton == MouseButtonState.Pressed) |
3172 | 787a4489 | KangIngu | { |
3173 | f67f164e | humkyung | if (currentControl is CircleControl) |
3174 | { |
||
3175 | //20180906 LJY TEST IsRotationDrawingEnable |
||
3176 | if (IsGetoutpoint((currentControl as CircleControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
||
3177 | 787a4489 | KangIngu | { |
3178 | f67f164e | humkyung | return; |
3179 | } |
||
3180 | e66f22eb | KangIngu | |
3181 | f67f164e | humkyung | CreateCommand.Instance.Execute(currentControl); |
3182 | 787a4489 | KangIngu | |
3183 | f67f164e | humkyung | currentControl = null; |
3184 | } |
||
3185 | else |
||
3186 | { |
||
3187 | currentControl = new CircleControl |
||
3188 | 787a4489 | KangIngu | { |
3189 | c7fde400 | taeseongkim | StartPoint = this.CanvasDrawingMouseDownPoint, |
3190 | LeftBottomPoint = this.CanvasDrawingMouseDownPoint, |
||
3191 | f67f164e | humkyung | Background = new SolidColorBrush(Colors.Black) |
3192 | }; |
||
3193 | 787a4489 | KangIngu | |
3194 | f67f164e | humkyung | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
3195 | currentControl.CommentID = Commons.shortGuid(); |
||
3196 | currentControl.IsNew = true; |
||
3197 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
||
3198 | } |
||
3199 | 787a4489 | KangIngu | } |
3200 | } |
||
3201 | break; |
||
3202 | case ControlType.Triangle: |
||
3203 | { |
||
3204 | e6a9ddaf | humkyung | if (e.LeftButton == MouseButtonState.Pressed) |
3205 | 787a4489 | KangIngu | { |
3206 | f67f164e | humkyung | if (currentControl is TriControl) |
3207 | { |
||
3208 | var content = currentControl as TriControl; |
||
3209 | if (content.MidPoint == new Point(0, 0)) |
||
3210 | 787a4489 | KangIngu | { |
3211 | c7fde400 | taeseongkim | content.MidPoint = new Point(CanvasDrawingMouseDownPoint.X, CanvasDrawingMouseDownPoint.Y); |
3212 | 787a4489 | KangIngu | } |
3213 | else |
||
3214 | { |
||
3215 | ca40e004 | ljiyeon | //20180906 LJY TEST IsRotationDrawingEnable |
3216 | f67f164e | humkyung | if (IsGetoutpoint((currentControl as TriControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
3217 | e66f22eb | KangIngu | { |
3218 | return; |
||
3219 | } |
||
3220 | |||
3221 | f513c215 | humkyung | CreateCommand.Instance.Execute(currentControl); |
3222 | 787a4489 | KangIngu | |
3223 | currentControl = null; |
||
3224 | } |
||
3225 | f67f164e | humkyung | } |
3226 | else |
||
3227 | { |
||
3228 | currentControl = new TriControl |
||
3229 | 787a4489 | KangIngu | { |
3230 | c7fde400 | taeseongkim | StartPoint = new Point(CanvasDrawingMouseDownPoint.X, CanvasDrawingMouseDownPoint.Y), |
3231 | f67f164e | humkyung | Background = new SolidColorBrush(Colors.Black), |
3232 | }; |
||
3233 | 787a4489 | KangIngu | |
3234 | f67f164e | humkyung | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
3235 | currentControl.CommentID = Commons.shortGuid(); |
||
3236 | currentControl.IsNew = true; |
||
3237 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
||
3238 | } |
||
3239 | 787a4489 | KangIngu | } |
3240 | } |
||
3241 | break; |
||
3242 | case ControlType.CancelLine: |
||
3243 | f67f164e | humkyung | case ControlType.SingleLine: |
3244 | case ControlType.ArrowLine: |
||
3245 | case ControlType.TwinLine: |
||
3246 | case ControlType.DimLine: |
||
3247 | 787a4489 | KangIngu | { |
3248 | e6a9ddaf | humkyung | if (e.LeftButton == MouseButtonState.Pressed) |
3249 | 787a4489 | KangIngu | { |
3250 | f67f164e | humkyung | if (currentControl is LineControl) |
3251 | { |
||
3252 | //20180906 LJY TEST IsRotationDrawingEnable |
||
3253 | if (IsGetoutpoint((currentControl as LineControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
||
3254 | 787a4489 | KangIngu | { |
3255 | f67f164e | humkyung | return; |
3256 | 787a4489 | KangIngu | } |
3257 | f67f164e | humkyung | |
3258 | CreateCommand.Instance.Execute(currentControl); |
||
3259 | currentControl = null; |
||
3260 | 168f8027 | taeseongkim | ViewerDataModel.Instance.AngleVisibility = Visibility.Collapsed; |
3261 | f67f164e | humkyung | } |
3262 | else |
||
3263 | { |
||
3264 | currentControl = new LineControl |
||
3265 | 787a4489 | KangIngu | { |
3266 | f67f164e | humkyung | ControlType = this.controlType, |
3267 | c7fde400 | taeseongkim | StartPoint = new Point(CanvasDrawingMouseDownPoint.X, CanvasDrawingMouseDownPoint.Y), |
3268 | f67f164e | humkyung | Background = new SolidColorBrush(Colors.Black) |
3269 | }; |
||
3270 | 787a4489 | KangIngu | |
3271 | f67f164e | humkyung | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
3272 | currentControl.CommentID = Commons.shortGuid(); |
||
3273 | currentControl.IsNew = true; |
||
3274 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
||
3275 | 168f8027 | taeseongkim | ViewerDataModel.Instance.AngleVisibility = Visibility.Visible; |
3276 | f67f164e | humkyung | } |
3277 | 787a4489 | KangIngu | } |
3278 | } |
||
3279 | break; |
||
3280 | f67f164e | humkyung | case ControlType.PolygonControl: |
3281 | 787a4489 | KangIngu | { |
3282 | f67f164e | humkyung | if (currentControl is PolygonControl) |
3283 | 787a4489 | KangIngu | { |
3284 | f67f164e | humkyung | var control = currentControl as PolygonControl; |
3285 | e66f22eb | KangIngu | |
3286 | f67f164e | humkyung | if (e.RightButton == MouseButtonState.Pressed) |
3287 | { |
||
3288 | control.IsCompleted = true; |
||
3289 | } |
||
3290 | 787a4489 | KangIngu | |
3291 | f67f164e | humkyung | if (!control.IsCompleted) |
3292 | { |
||
3293 | control.PointSet.Add(control.EndPoint); |
||
3294 | } |
||
3295 | else |
||
3296 | { |
||
3297 | //20180906 LJY TEST IsRotationDrawingEnable |
||
3298 | if (IsGetoutpoint((currentControl as PolygonControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
||
3299 | 787a4489 | KangIngu | { |
3300 | f67f164e | humkyung | return; |
3301 | 787a4489 | KangIngu | } |
3302 | e66f22eb | KangIngu | |
3303 | f67f164e | humkyung | var firstPoint = control.PointSet.First(); |
3304 | control.DashSize = ViewerDataModel.Instance.DashSize; |
||
3305 | control.LineSize = ViewerDataModel.Instance.LineSize; |
||
3306 | control.PointSet.Add(firstPoint); |
||
3307 | 787a4489 | KangIngu | |
3308 | f67f164e | humkyung | control.ApplyOverViewData(); |
3309 | |||
3310 | CreateCommand.Instance.Execute(currentControl); |
||
3311 | 0d00f9c8 | humkyung | control.UpdateControl(); |
3312 | f67f164e | humkyung | currentControl = null; |
3313 | } |
||
3314 | 787a4489 | KangIngu | } |
3315 | f67f164e | humkyung | else |
3316 | 787a4489 | KangIngu | { |
3317 | f67f164e | humkyung | if (e.LeftButton == MouseButtonState.Pressed) |
3318 | { |
||
3319 | currentControl = new PolygonControl |
||
3320 | 787a4489 | KangIngu | { |
3321 | f67f164e | humkyung | PointSet = new List<Point>(), |
3322 | }; |
||
3323 | 787a4489 | KangIngu | |
3324 | f67f164e | humkyung | var polygonControl = (currentControl as PolygonControl); |
3325 | currentControl.CommentID = Commons.shortGuid(); |
||
3326 | currentControl.IsNew = true; |
||
3327 | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
||
3328 | c7fde400 | taeseongkim | polygonControl.StartPoint = CanvasDrawingMouseDownPoint; |
3329 | polygonControl.EndPoint = CanvasDrawingMouseDownPoint; |
||
3330 | polygonControl.PointSet.Add(CanvasDrawingMouseDownPoint); |
||
3331 | polygonControl.PointSet.Add(CanvasDrawingMouseDownPoint); |
||
3332 | f67f164e | humkyung | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
3333 | polygonControl.ApplyTemplate(); |
||
3334 | polygonControl.Visibility = Visibility.Visible; |
||
3335 | } |
||
3336 | 787a4489 | KangIngu | } |
3337 | } |
||
3338 | break; |
||
3339 | case ControlType.ChainLine: |
||
3340 | { |
||
3341 | if (currentControl is PolygonControl) |
||
3342 | { |
||
3343 | var control = currentControl as PolygonControl; |
||
3344 | |||
3345 | e6a9ddaf | humkyung | if (e.RightButton == MouseButtonState.Pressed) |
3346 | 787a4489 | KangIngu | { |
3347 | ca40e004 | ljiyeon | //20180906 LJY TEST IsRotationDrawingEnable |
3348 | if (IsGetoutpoint((currentControl as PolygonControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
||
3349 | e66f22eb | KangIngu | { |
3350 | return; |
||
3351 | } |
||
3352 | |||
3353 | f513c215 | humkyung | CreateCommand.Instance.Execute(currentControl); |
3354 | 787a4489 | KangIngu | |
3355 | currentControl = null; |
||
3356 | 168f8027 | taeseongkim | ViewerDataModel.Instance.AngleVisibility = Visibility.Collapsed; |
3357 | 787a4489 | KangIngu | return; |
3358 | } |
||
3359 | |||
3360 | if (!control.IsCompleted) |
||
3361 | { |
||
3362 | control.PointSet.Add(control.EndPoint); |
||
3363 | 168f8027 | taeseongkim | ViewerDataModel.Instance.AngleVisibility = Visibility.Visible; |
3364 | 787a4489 | KangIngu | } |
3365 | } |
||
3366 | else |
||
3367 | { |
||
3368 | e6a9ddaf | humkyung | if (e.LeftButton == MouseButtonState.Pressed) |
3369 | 787a4489 | KangIngu | { |
3370 | 2eac4f76 | KangIngu | MainAngle.Visibility = Visibility.Visible; |
3371 | 787a4489 | KangIngu | currentControl = new PolygonControl |
3372 | { |
||
3373 | PointSet = new List<Point>(), |
||
3374 | //강인구 추가(ChainLine일때는 채우기 스타일을 주지 않기 위해 설정) |
||
3375 | ControlType = ControlType.ChainLine, |
||
3376 | DashSize = ViewerDataModel.Instance.DashSize, |
||
3377 | LineSize = ViewerDataModel.Instance.LineSize, |
||
3378 | //PointC = new StylusPointSet() |
||
3379 | }; |
||
3380 | |||
3381 | e66f22eb | KangIngu | //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
3382 | //{ |
||
3383 | 787a4489 | KangIngu | var polygonControl = (currentControl as PolygonControl); |
3384 | 24678e06 | humkyung | currentControl.CommentID = Commons.shortGuid(); |
3385 | 787a4489 | KangIngu | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
3386 | currentControl.IsNew = true; |
||
3387 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
||
3388 | //currentControl.OnApplyTemplate(); |
||
3389 | //polygonControl.PointC.pointSet.Add(canvasDrawingMouseDownPoint); |
||
3390 | //polygonControl.PointC.pointSet.Add(canvasDrawingMouseDownPoint); |
||
3391 | c7fde400 | taeseongkim | polygonControl.PointSet.Add(CanvasDrawingMouseDownPoint); |
3392 | polygonControl.PointSet.Add(CanvasDrawingMouseDownPoint); |
||
3393 | e66f22eb | KangIngu | //} |
3394 | 787a4489 | KangIngu | } |
3395 | } |
||
3396 | } |
||
3397 | break; |
||
3398 | case ControlType.ArcLine: |
||
3399 | { |
||
3400 | e6a9ddaf | humkyung | if (e.LeftButton == MouseButtonState.Pressed) |
3401 | 787a4489 | KangIngu | { |
3402 | f67f164e | humkyung | if (currentControl is ArcControl) |
3403 | { |
||
3404 | //20180906 LJY TEST IsRotationDrawingEnable |
||
3405 | if (IsGetoutpoint((currentControl as ArcControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
||
3406 | 787a4489 | KangIngu | { |
3407 | f67f164e | humkyung | return; |
3408 | } |
||
3409 | e66f22eb | KangIngu | |
3410 | f67f164e | humkyung | CreateCommand.Instance.Execute(currentControl); |
3411 | 787a4489 | KangIngu | |
3412 | f67f164e | humkyung | currentControl = null; |
3413 | 168f8027 | taeseongkim | ViewerDataModel.Instance.AngleVisibility = Visibility.Collapsed; |
3414 | f67f164e | humkyung | } |
3415 | else |
||
3416 | { |
||
3417 | currentControl = new ArcControl |
||
3418 | 787a4489 | KangIngu | { |
3419 | c7fde400 | taeseongkim | StartPoint = new Point(CanvasDrawingMouseDownPoint.X, CanvasDrawingMouseDownPoint.Y), |
3420 | f67f164e | humkyung | Background = new SolidColorBrush(Colors.Black) |
3421 | }; |
||
3422 | currentControl.CommentID = Commons.shortGuid(); |
||
3423 | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
||
3424 | currentControl.IsNew = true; |
||
3425 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
||
3426 | 168f8027 | taeseongkim | ViewerDataModel.Instance.AngleVisibility = Visibility.Visible; |
3427 | f67f164e | humkyung | } |
3428 | 787a4489 | KangIngu | } |
3429 | e6a9ddaf | humkyung | else if (e.RightButton == MouseButtonState.Pressed) |
3430 | 787a4489 | KangIngu | { |
3431 | if (currentControl != null) |
||
3432 | { |
||
3433 | (currentControl as ArcControl).setClock(); |
||
3434 | 05f4d127 | KangIngu | (currentControl as ArcControl).MidPoint = new Point(0, 0); |
3435 | 787a4489 | KangIngu | } |
3436 | } |
||
3437 | } |
||
3438 | break; |
||
3439 | case ControlType.ArcArrow: |
||
3440 | { |
||
3441 | e6a9ddaf | humkyung | if (e.LeftButton == MouseButtonState.Pressed) |
3442 | 787a4489 | KangIngu | { |
3443 | e66f22eb | KangIngu | //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
3444 | //{ |
||
3445 | 40b3ce25 | ljiyeon | if (currentControl is ArrowArcControl) |
3446 | { |
||
3447 | //20180906 LJY TEST IsRotationDrawingEnable |
||
3448 | if (IsGetoutpoint((currentControl as ArrowArcControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
||
3449 | 787a4489 | KangIngu | { |
3450 | 40b3ce25 | ljiyeon | return; |
3451 | } |
||
3452 | e66f22eb | KangIngu | |
3453 | f513c215 | humkyung | CreateCommand.Instance.Execute(currentControl); |
3454 | 787a4489 | KangIngu | |
3455 | 40b3ce25 | ljiyeon | currentControl = null; |
3456 | 168f8027 | taeseongkim | ViewerDataModel.Instance.AngleVisibility = Visibility.Collapsed; |
3457 | 40b3ce25 | ljiyeon | } |
3458 | else |
||
3459 | { |
||
3460 | currentControl = new ArrowArcControl |
||
3461 | 787a4489 | KangIngu | { |
3462 | c7fde400 | taeseongkim | StartPoint = new Point(CanvasDrawingMouseDownPoint.X, CanvasDrawingMouseDownPoint.Y), |
3463 | 40b3ce25 | ljiyeon | Background = new SolidColorBrush(Colors.Black) |
3464 | }; |
||
3465 | 24678e06 | humkyung | currentControl.CommentID = Commons.shortGuid(); |
3466 | 40b3ce25 | ljiyeon | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
3467 | currentControl.IsNew = true; |
||
3468 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
||
3469 | 168f8027 | taeseongkim | ViewerDataModel.Instance.AngleVisibility = Visibility.Visible; |
3470 | 40b3ce25 | ljiyeon | } |
3471 | e66f22eb | KangIngu | //} |
3472 | 787a4489 | KangIngu | } |
3473 | e6a9ddaf | humkyung | else if (e.RightButton == MouseButtonState.Pressed) |
3474 | 787a4489 | KangIngu | { |
3475 | 40b3ce25 | ljiyeon | if (currentControl != null) |
3476 | { |
||
3477 | (currentControl as ArrowArcControl).setClock(); |
||
3478 | (currentControl as ArrowArcControl).MidPoint = new Point(0, 0); |
||
3479 | //(currentControl as ArcControl).ApplyTemplate(); |
||
3480 | } |
||
3481 | 787a4489 | KangIngu | } |
3482 | } |
||
3483 | break; |
||
3484 | case ControlType.ArrowMultiLine: |
||
3485 | { |
||
3486 | e6a9ddaf | humkyung | if (e.LeftButton == MouseButtonState.Pressed) |
3487 | 787a4489 | KangIngu | { |
3488 | e66f22eb | KangIngu | //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
3489 | //{ |
||
3490 | 787a4489 | KangIngu | |
3491 | if (currentControl is ArrowControl_Multi) |
||
3492 | { |
||
3493 | var content = currentControl as ArrowControl_Multi; |
||
3494 | if (content.MiddlePoint == new Point(0, 0)) |
||
3495 | { |
||
3496 | 2eac4f76 | KangIngu | if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift) |
3497 | { |
||
3498 | content.MiddlePoint = content.EndPoint; |
||
3499 | } |
||
3500 | else |
||
3501 | { |
||
3502 | c7fde400 | taeseongkim | content.MiddlePoint = new Point(CanvasDrawingMouseDownPoint.X, CanvasDrawingMouseDownPoint.Y); |
3503 | 2eac4f76 | KangIngu | } |
3504 | 787a4489 | KangIngu | } |
3505 | else |
||
3506 | { |
||
3507 | ca40e004 | ljiyeon | //20180906 LJY TEST IsRotationDrawingEnable |
3508 | if (IsGetoutpoint((currentControl as ArrowControl_Multi).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
||
3509 | e66f22eb | KangIngu | { |
3510 | return; |
||
3511 | } |
||
3512 | |||
3513 | f513c215 | humkyung | CreateCommand.Instance.Execute(currentControl); |
3514 | 787a4489 | KangIngu | |
3515 | currentControl = null; |
||
3516 | 168f8027 | taeseongkim | ViewerDataModel.Instance.AngleVisibility = Visibility.Collapsed; |
3517 | 787a4489 | KangIngu | } |
3518 | } |
||
3519 | else |
||
3520 | { |
||
3521 | currentControl = new ArrowControl_Multi |
||
3522 | { |
||
3523 | c7fde400 | taeseongkim | StartPoint = new Point(CanvasDrawingMouseDownPoint.X, CanvasDrawingMouseDownPoint.Y), |
3524 | 787a4489 | KangIngu | Background = new SolidColorBrush(Colors.Black) |
3525 | }; |
||
3526 | 24678e06 | humkyung | currentControl.CommentID = Commons.shortGuid(); |
3527 | 787a4489 | KangIngu | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
3528 | currentControl.IsNew = true; |
||
3529 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
||
3530 | 168f8027 | taeseongkim | ViewerDataModel.Instance.AngleVisibility = Visibility.Visible; |
3531 | 787a4489 | KangIngu | } |
3532 | e66f22eb | KangIngu | //} |
3533 | 787a4489 | KangIngu | } |
3534 | } |
||
3535 | break; |
||
3536 | case ControlType.PolygonCloud: |
||
3537 | { |
||
3538 | if (currentControl is CloudControl) |
||
3539 | { |
||
3540 | var control = currentControl as CloudControl; |
||
3541 | e6a9ddaf | humkyung | if (e.RightButton == MouseButtonState.Pressed) |
3542 | 787a4489 | KangIngu | { |
3543 | control.IsCompleted = true; |
||
3544 | } |
||
3545 | |||
3546 | if (!control.IsCompleted) |
||
3547 | { |
||
3548 | control.PointSet.Add(control.EndPoint); |
||
3549 | } |
||
3550 | else |
||
3551 | { |
||
3552 | ca40e004 | ljiyeon | //20180906 LJY TEST IsRotationDrawingEnable |
3553 | if (IsGetoutpoint((currentControl as CloudControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
||
3554 | e66f22eb | KangIngu | { |
3555 | return; |
||
3556 | } |
||
3557 | |||
3558 | f513c215 | humkyung | CreateCommand.Instance.Execute(currentControl); |
3559 | 787a4489 | KangIngu | |
3560 | control.isTransOn = true; |
||
3561 | var firstPoint = control.PointSet.First(); |
||
3562 | |||
3563 | control.PointSet.Add(firstPoint); |
||
3564 | control.DrawingCloud(); |
||
3565 | control.ApplyOverViewData(); |
||
3566 | |||
3567 | currentControl = null; |
||
3568 | } |
||
3569 | } |
||
3570 | else |
||
3571 | { |
||
3572 | e6a9ddaf | humkyung | if (e.LeftButton == MouseButtonState.Pressed) |
3573 | 787a4489 | KangIngu | { |
3574 | currentControl = new CloudControl |
||
3575 | { |
||
3576 | PointSet = new List<Point>(), |
||
3577 | PointC = new StylusPointSet() |
||
3578 | }; |
||
3579 | |||
3580 | e66f22eb | KangIngu | //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
3581 | //{ |
||
3582 | 787a4489 | KangIngu | var polygonControl = (currentControl as CloudControl); |
3583 | 24678e06 | humkyung | currentControl.CommentID = Commons.shortGuid(); |
3584 | 787a4489 | KangIngu | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
3585 | currentControl.IsNew = true; |
||
3586 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
||
3587 | |||
3588 | c7fde400 | taeseongkim | polygonControl.PointSet.Add(CanvasDrawingMouseDownPoint); |
3589 | polygonControl.PointSet.Add(CanvasDrawingMouseDownPoint); |
||
3590 | b9ce7aee | ljiyeon | |
3591 | e66f22eb | KangIngu | //} |
3592 | 787a4489 | KangIngu | } |
3593 | } |
||
3594 | } |
||
3595 | break; |
||
3596 | case ControlType.ImgControl: |
||
3597 | { |
||
3598 | e6a9ddaf | humkyung | if (e.LeftButton == MouseButtonState.Pressed) |
3599 | 787a4489 | KangIngu | { |
3600 | e66f22eb | KangIngu | //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
3601 | //{ |
||
3602 | 787a4489 | KangIngu | if (currentControl is ImgControl) |
3603 | { |
||
3604 | ca40e004 | ljiyeon | //20180906 LJY TEST IsRotationDrawingEnable |
3605 | if (IsGetoutpoint((currentControl as ImgControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
||
3606 | e66f22eb | KangIngu | { |
3607 | return; |
||
3608 | } |
||
3609 | |||
3610 | f513c215 | humkyung | CreateCommand.Instance.Execute(currentControl); |
3611 | 53880c83 | ljiyeon | controlType = ControlType.ImgControl; |
3612 | 787a4489 | KangIngu | currentControl = null; |
3613 | } |
||
3614 | else |
||
3615 | { |
||
3616 | c73426a9 | ljiyeon | |
3617 | 787a4489 | KangIngu | string extension = System.IO.Path.GetExtension(filename).ToUpper(); |
3618 | 53880c83 | ljiyeon | if (extension == ".PNG" || extension == ".JPEG" || extension == ".GIF" || extension == ".BMP" || extension == ".JPG" || extension == ".SVG") |
3619 | 787a4489 | KangIngu | { |
3620 | Image img = new Image(); |
||
3621 | 53880c83 | ljiyeon | if (filename.Contains(".svg")) |
3622 | { |
||
3623 | byte[] imageData = null; |
||
3624 | DrawingImage image = null; |
||
3625 | using (System.Net.WebClient web = new System.Net.WebClient()) |
||
3626 | { |
||
3627 | imageData = web.DownloadData(new Uri(filename)); |
||
3628 | System.IO.Stream stream = new System.IO.MemoryStream(imageData); |
||
3629 | image = SvgReader.Load(stream); |
||
3630 | } |
||
3631 | img.Source = image; |
||
3632 | } |
||
3633 | else |
||
3634 | { |
||
3635 | img.Source = new BitmapImage(new Uri(filename)); |
||
3636 | } |
||
3637 | 787a4489 | KangIngu | |
3638 | currentControl = new ImgControl |
||
3639 | { |
||
3640 | 53880c83 | ljiyeon | Background = new SolidColorBrush(Colors.Black), |
3641 | PointSet = new List<Point>(), |
||
3642 | FilePath = filename, |
||
3643 | ImageData = img.Source, |
||
3644 | c7fde400 | taeseongkim | StartPoint = CanvasDrawingMouseDownPoint, |
3645 | EndPoint = new Point(CanvasDrawingMouseDownPoint.X + 100, CanvasDrawingMouseDownPoint.Y + 100), |
||
3646 | TopRightPoint = new Point(CanvasDrawingMouseDownPoint.X, CanvasDrawingMouseDownPoint.Y + 100), |
||
3647 | LeftBottomPoint = new Point(CanvasDrawingMouseDownPoint.X + 100, CanvasDrawingMouseDownPoint.Y), |
||
3648 | 53880c83 | ljiyeon | ControlType = ControlType.ImgControl |
3649 | }; |
||
3650 | |||
3651 | |||
3652 | 24678e06 | humkyung | currentControl.CommentID = Commons.shortGuid(); |
3653 | 53880c83 | ljiyeon | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
3654 | currentControl.IsNew = true; |
||
3655 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
||
3656 | |||
3657 | fa48eb85 | taeseongkim | //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 |
3658 | (currentControl as ImgControl).CommentAngle -= rotate.Angle; |
||
3659 | } |
||
3660 | 787a4489 | KangIngu | } |
3661 | e66f22eb | KangIngu | //} |
3662 | 787a4489 | KangIngu | } |
3663 | } |
||
3664 | break; |
||
3665 | case ControlType.Date: |
||
3666 | { |
||
3667 | e6a9ddaf | humkyung | if (e.LeftButton == MouseButtonState.Pressed) |
3668 | 787a4489 | KangIngu | { |
3669 | e66f22eb | KangIngu | //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
3670 | //{ |
||
3671 | 6b6e937c | taeseongkim | if (currentControl is DateControl) |
3672 | { |
||
3673 | //20180906 LJY TEST IsRotationDrawingEnable |
||
3674 | if (IsGetoutpoint((currentControl as DateControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
||
3675 | 787a4489 | KangIngu | { |
3676 | 6b6e937c | taeseongkim | return; |
3677 | } |
||
3678 | e66f22eb | KangIngu | |
3679 | 6b6e937c | taeseongkim | CreateCommand.Instance.Execute(currentControl); |
3680 | currentControl = null; |
||
3681 | 787a4489 | KangIngu | |
3682 | 6b6e937c | taeseongkim | if (Common.ViewerDataModel.Instance.SelectedControl == "Batch") |
3683 | { |
||
3684 | controlType = ControlType.None; |
||
3685 | IsSwingMode = false; |
||
3686 | Common.ViewerDataModel.Instance.SelectedControl = ""; |
||
3687 | Common.ViewerDataModel.Instance.ControlTag = null; |
||
3688 | mouseHandlingMode = MouseHandlingMode.None; |
||
3689 | this.ParentOfType<MainWindow>().dzTopMenu.btn_Batch.IsChecked = false; |
||
3690 | txtBatch.Visibility = Visibility.Collapsed; |
||
3691 | 787a4489 | KangIngu | |
3692 | } |
||
3693 | 6b6e937c | taeseongkim | } |
3694 | else |
||
3695 | { |
||
3696 | currentControl = new DateControl |
||
3697 | 787a4489 | KangIngu | { |
3698 | 6b6e937c | taeseongkim | StartPoint = CanvasDrawingMouseDownPoint, |
3699 | Background = new SolidColorBrush(Colors.Black) |
||
3700 | }; |
||
3701 | currentControl.CommentID = Commons.shortGuid(); |
||
3702 | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
||
3703 | currentControl.IsNew = true; |
||
3704 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
||
3705 | ca40e004 | ljiyeon | |
3706 | 6b6e937c | taeseongkim | //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 |
3707 | if (currentControl is ImgControl) |
||
3708 | { |
||
3709 | fa48eb85 | taeseongkim | (currentControl as ImgControl).CommentAngle -= rotate.Angle; |
3710 | 6b6e937c | taeseongkim | } |
3711 | ca40e004 | ljiyeon | } |
3712 | e66f22eb | KangIngu | //} |
3713 | 787a4489 | KangIngu | } |
3714 | } |
||
3715 | break; |
||
3716 | case ControlType.TextControl: |
||
3717 | { |
||
3718 | e6a9ddaf | humkyung | if (e.LeftButton == MouseButtonState.Pressed) |
3719 | 787a4489 | KangIngu | { |
3720 | if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
||
3721 | { |
||
3722 | currentControl = new TextControl |
||
3723 | { |
||
3724 | ControlType = controlType |
||
3725 | }; |
||
3726 | 610a4b86 | KangIngu | (currentControl as TextControl).TextSize = ViewerDataModel.Instance.TextSize; |
3727 | 24678e06 | humkyung | currentControl.CommentID = Commons.shortGuid(); |
3728 | 8742caa5 | humkyung | currentControl.IsNew = true; |
3729 | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
||
3730 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
||
3731 | 1066bae3 | ljiyeon | currentControl.SetValue(Canvas.ZIndexProperty, 3); |
3732 | |||
3733 | c7fde400 | taeseongkim | currentControl.SetValue(TextControl.CanvasXProperty, CanvasDrawingMouseDownPoint.X); |
3734 | currentControl.SetValue(TextControl.CanvasYProperty, CanvasDrawingMouseDownPoint.Y); |
||
3735 | 6b5d33c6 | djkim | |
3736 | 8742caa5 | humkyung | (currentControl as TextControl).ControlType_No = 0; |
3737 | fa48eb85 | taeseongkim | (currentControl as TextControl).CommentAngle -= rotate.Angle; |
3738 | 8742caa5 | humkyung | (currentControl as TextControl).IsHighLight = ViewerDataModel.Instance.checkHighShape; |
3739 | 6b5d33c6 | djkim | (currentControl as TextControl).ApplyTemplate(); |
3740 | (currentControl as TextControl).Base_TextBox.Focus(); |
||
3741 | 55d4f382 | 송근호 | (currentControl as TextControl).SetFontFamily(new FontFamily(this.ParentOfType<MainWindow>().dzTopMenu.comboFontFamily.Text)); |
3742 | f513c215 | humkyung | CreateCommand.Instance.Execute(currentControl); |
3743 | 787a4489 | KangIngu | } |
3744 | } |
||
3745 | } |
||
3746 | break; |
||
3747 | case ControlType.TextBorder: |
||
3748 | { |
||
3749 | e6a9ddaf | humkyung | if (e.LeftButton == MouseButtonState.Pressed) |
3750 | 787a4489 | KangIngu | { |
3751 | if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
||
3752 | { |
||
3753 | currentControl = new TextControl |
||
3754 | { |
||
3755 | ControlType = controlType |
||
3756 | }; |
||
3757 | |||
3758 | 610a4b86 | KangIngu | (currentControl as TextControl).TextSize = ViewerDataModel.Instance.TextSize; |
3759 | 787a4489 | KangIngu | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
3760 | 24678e06 | humkyung | currentControl.CommentID = Commons.shortGuid(); |
3761 | 787a4489 | KangIngu | currentControl.IsNew = true; |
3762 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
||
3763 | currentControl.SetValue(Canvas.ZIndexProperty, 3); |
||
3764 | c7fde400 | taeseongkim | currentControl.SetValue(TextControl.CanvasXProperty, CanvasDrawingMouseDownPoint.X); |
3765 | currentControl.SetValue(TextControl.CanvasYProperty, CanvasDrawingMouseDownPoint.Y); |
||
3766 | 6b5d33c6 | djkim | |
3767 | 787a4489 | KangIngu | (currentControl as TextControl).ControlType_No = 1; |
3768 | fa48eb85 | taeseongkim | (currentControl as TextControl).CommentAngle = Ang; |
3769 | 787a4489 | KangIngu | (currentControl as TextControl).IsHighLight = ViewerDataModel.Instance.checkHighShape; |
3770 | 6b5d33c6 | djkim | (currentControl as TextControl).ApplyTemplate(); |
3771 | (currentControl as TextControl).Base_TextBox.Focus(); |
||
3772 | 55d4f382 | 송근호 | (currentControl as TextControl).SetFontFamily(new FontFamily(this.ParentOfType<MainWindow>().dzTopMenu.comboFontFamily.Text)); |
3773 | f513c215 | humkyung | CreateCommand.Instance.Execute(currentControl); |
3774 | 787a4489 | KangIngu | } |
3775 | } |
||
3776 | } |
||
3777 | break; |
||
3778 | case ControlType.TextCloud: |
||
3779 | { |
||
3780 | e6a9ddaf | humkyung | if (e.LeftButton == MouseButtonState.Pressed) |
3781 | 787a4489 | KangIngu | { |
3782 | if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
||
3783 | { |
||
3784 | currentControl = new TextControl |
||
3785 | { |
||
3786 | ControlType = controlType |
||
3787 | }; |
||
3788 | 610a4b86 | KangIngu | |
3789 | (currentControl as TextControl).TextSize = ViewerDataModel.Instance.TextSize; |
||
3790 | 24678e06 | humkyung | currentControl.CommentID = Commons.shortGuid(); |
3791 | 787a4489 | KangIngu | currentControl.IsNew = true; |
3792 | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
||
3793 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
||
3794 | |||
3795 | currentControl.SetValue(Canvas.ZIndexProperty, 3); |
||
3796 | c7fde400 | taeseongkim | currentControl.SetValue(TextControl.CanvasXProperty, CanvasDrawingMouseDownPoint.X); |
3797 | currentControl.SetValue(TextControl.CanvasYProperty, CanvasDrawingMouseDownPoint.Y); |
||
3798 | 787a4489 | KangIngu | |
3799 | fa48eb85 | taeseongkim | (currentControl as TextControl).CommentAngle = Ang; |
3800 | 787a4489 | KangIngu | (currentControl as TextControl).ControlType_No = 2; |
3801 | (currentControl as TextControl).IsHighLight = ViewerDataModel.Instance.checkHighShape; |
||
3802 | 6b5d33c6 | djkim | (currentControl as TextControl).ApplyTemplate(); |
3803 | (currentControl as TextControl).Base_TextBox.Focus(); |
||
3804 | f513c215 | humkyung | CreateCommand.Instance.Execute(currentControl); |
3805 | 55d4f382 | 송근호 | (currentControl as TextControl).SetFontFamily(new FontFamily(this.ParentOfType<MainWindow>().dzTopMenu.comboFontFamily.Text)); |
3806 | 49b217ad | humkyung | //currentControl = null; |
3807 | 787a4489 | KangIngu | } |
3808 | } |
||
3809 | } |
||
3810 | break; |
||
3811 | case ControlType.ArrowTextControl: |
||
3812 | ca40e004 | ljiyeon | { |
3813 | e6a9ddaf | humkyung | if (e.LeftButton == MouseButtonState.Pressed) |
3814 | 787a4489 | KangIngu | { |
3815 | if (currentControl is ArrowTextControl) |
||
3816 | { |
||
3817 | ca40e004 | ljiyeon | //20180906 LJY TEST IsRotationDrawingEnable |
3818 | if (IsGetoutpoint((currentControl as ArrowTextControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
||
3819 | e66f22eb | KangIngu | { |
3820 | return; |
||
3821 | f513c215 | humkyung | } |
3822 | e66f22eb | KangIngu | |
3823 | f513c215 | humkyung | CreateCommand.Instance.Execute(currentControl); |
3824 | 787a4489 | KangIngu | |
3825 | (currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false; |
||
3826 | (currentControl as ArrowTextControl).EnableEditing = false; |
||
3827 | 49b217ad | humkyung | (currentControl as ArrowTextControl).IsNew = false; |
3828 | 787a4489 | KangIngu | currentControl = null; |
3829 | } |
||
3830 | else |
||
3831 | { |
||
3832 | e66f22eb | KangIngu | //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
3833 | //{ |
||
3834 | 787a4489 | KangIngu | currentControl = new ArrowTextControl(); |
3835 | 24678e06 | humkyung | currentControl.CommentID = Commons.shortGuid(); |
3836 | 787a4489 | KangIngu | currentControl.IsNew = true; |
3837 | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
||
3838 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
||
3839 | |||
3840 | currentControl.SetValue(Canvas.ZIndexProperty, 3); |
||
3841 | c7fde400 | taeseongkim | currentControl.SetValue(ArrowTextControl.StartPointProperty, CanvasDrawingMouseDownPoint); |
3842 | currentControl.SetValue(ArrowTextControl.EndPointProperty, CanvasDrawingMouseDownPoint); |
||
3843 | 610a4b86 | KangIngu | (currentControl as ArrowTextControl).TextSize = ViewerDataModel.Instance.TextSize; |
3844 | 787a4489 | KangIngu | (currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape; |
3845 | |||
3846 | fa48eb85 | taeseongkim | //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 |
3847 | (currentControl as ArrowTextControl).CommentAngle -= rotate.Angle; |
||
3848 | 787a4489 | KangIngu | |
3849 | fa48eb85 | taeseongkim | (currentControl as ArrowTextControl).ApplyTemplate(); |
3850 | 787a4489 | KangIngu | (currentControl as ArrowTextControl).Base_TextBox.Focus(); |
3851 | 55d4f382 | 송근호 | (currentControl as ArrowTextControl).SetFontFamily(new FontFamily(this.ParentOfType<MainWindow>().dzTopMenu.comboFontFamily.Text)); |
3852 | 168f8027 | taeseongkim | ViewerDataModel.Instance.AngleVisibility = Visibility.Visible; |
3853 | ca40e004 | ljiyeon | |
3854 | |||
3855 | e66f22eb | KangIngu | //} |
3856 | 787a4489 | KangIngu | } |
3857 | } |
||
3858 | } |
||
3859 | break; |
||
3860 | case ControlType.ArrowTransTextControl: |
||
3861 | { |
||
3862 | e6a9ddaf | humkyung | if (e.LeftButton == MouseButtonState.Pressed) |
3863 | 787a4489 | KangIngu | { |
3864 | if (currentControl is ArrowTextControl) |
||
3865 | { |
||
3866 | ca40e004 | ljiyeon | //20180906 LJY TEST IsRotationDrawingEnable |
3867 | if (IsGetoutpoint((currentControl as ArrowTextControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
||
3868 | e66f22eb | KangIngu | { |
3869 | return; |
||
3870 | f513c215 | humkyung | } |
3871 | e66f22eb | KangIngu | |
3872 | f513c215 | humkyung | CreateCommand.Instance.Execute(currentControl); |
3873 | 55d4f382 | 송근호 | |
3874 | 787a4489 | KangIngu | (currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false; |
3875 | 55d4f382 | 송근호 | |
3876 | 49b217ad | humkyung | currentControl.IsNew = false; |
3877 | 787a4489 | KangIngu | currentControl = null; |
3878 | 168f8027 | taeseongkim | ViewerDataModel.Instance.AngleVisibility = Visibility.Collapsed; |
3879 | 787a4489 | KangIngu | } |
3880 | else |
||
3881 | { |
||
3882 | e66f22eb | KangIngu | //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
3883 | //{ |
||
3884 | 120b8b00 | 송근호 | currentControl = new ArrowTextControl() |
3885 | { |
||
3886 | ControlType = ControlType.ArrowTransTextControl |
||
3887 | }; |
||
3888 | currentControl.CommentID = Commons.shortGuid(); |
||
3889 | currentControl.IsNew = true; |
||
3890 | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
||
3891 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
||
3892 | currentControl.SetValue(Canvas.ZIndexProperty, 3); |
||
3893 | c7fde400 | taeseongkim | currentControl.SetValue(ArrowTextControl.StartPointProperty, CanvasDrawingMouseDownPoint); |
3894 | currentControl.SetValue(ArrowTextControl.EndPointProperty, CanvasDrawingMouseDownPoint); |
||
3895 | 120b8b00 | 송근호 | (currentControl as ArrowTextControl).TextSize = ViewerDataModel.Instance.TextSize; |
3896 | (currentControl as ArrowTextControl).isFixed = true; |
||
3897 | (currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape; |
||
3898 | 787a4489 | KangIngu | |
3899 | 120b8b00 | 송근호 | //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 |
3900 | fa48eb85 | taeseongkim | (currentControl as ArrowTextControl).CommentAngle -= rotate.Angle; |
3901 | ca40e004 | ljiyeon | |
3902 | 120b8b00 | 송근호 | (currentControl as ArrowTextControl).ApplyTemplate(); |
3903 | (currentControl as ArrowTextControl).Base_TextBox.Focus(); |
||
3904 | (currentControl as ArrowTextControl).isTrans = true; |
||
3905 | 55d4f382 | 송근호 | (currentControl as ArrowTextControl).SetFontFamily(new FontFamily(this.ParentOfType<MainWindow>().dzTopMenu.comboFontFamily.Text)); |
3906 | 787a4489 | KangIngu | } |
3907 | } |
||
3908 | } |
||
3909 | break; |
||
3910 | case ControlType.ArrowTextBorderControl: |
||
3911 | ca40e004 | ljiyeon | { |
3912 | e6a9ddaf | humkyung | if (e.LeftButton == MouseButtonState.Pressed) |
3913 | 787a4489 | KangIngu | { |
3914 | if (currentControl is ArrowTextControl) |
||
3915 | { |
||
3916 | ca40e004 | ljiyeon | //20180906 LJY TEST IsRotationDrawingEnable |
3917 | if (IsGetoutpoint((currentControl as ArrowTextControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
||
3918 | e66f22eb | KangIngu | { |
3919 | return; |
||
3920 | } |
||
3921 | |||
3922 | f513c215 | humkyung | CreateCommand.Instance.Execute(currentControl); |
3923 | 787a4489 | KangIngu | (currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false; |
3924 | 49b217ad | humkyung | currentControl.IsNew = false; |
3925 | 787a4489 | KangIngu | currentControl = null; |
3926 | 168f8027 | taeseongkim | ViewerDataModel.Instance.AngleVisibility = Visibility.Collapsed; |
3927 | 787a4489 | KangIngu | } |
3928 | else |
||
3929 | { |
||
3930 | e66f22eb | KangIngu | //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
3931 | //{ |
||
3932 | 787a4489 | KangIngu | currentControl = new ArrowTextControl() |
3933 | { |
||
3934 | ArrowTextStyle = MarkupToPDF.Controls.Text.ArrowTextControl.ArrowTextStyleSet.Rect |
||
3935 | }; |
||
3936 | 24678e06 | humkyung | currentControl.CommentID = Commons.shortGuid(); |
3937 | 787a4489 | KangIngu | currentControl.IsNew = true; |
3938 | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
||
3939 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
||
3940 | |||
3941 | currentControl.SetValue(Canvas.ZIndexProperty, 3); |
||
3942 | |||
3943 | c7fde400 | taeseongkim | currentControl.SetValue(ArrowTextControl.StartPointProperty, CanvasDrawingMouseDownPoint); |
3944 | 787a4489 | KangIngu | |
3945 | c7fde400 | taeseongkim | currentControl.SetValue(ArrowTextControl.EndPointProperty, CanvasDrawingMouseDownPoint); |
3946 | 787a4489 | KangIngu | (currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape; |
3947 | 610a4b86 | KangIngu | (currentControl as ArrowTextControl).TextSize = ViewerDataModel.Instance.TextSize; |
3948 | 55d4f382 | 송근호 | (currentControl as ArrowTextControl).SetFontFamily(new FontFamily(this.ParentOfType<MainWindow>().dzTopMenu.comboFontFamily.Text)); |
3949 | ca40e004 | ljiyeon | //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 |
3950 | fa48eb85 | taeseongkim | (currentControl as ArrowTextControl).CommentAngle -= rotate.Angle; |
3951 | ca40e004 | ljiyeon | (currentControl as ArrowTextControl).ApplyTemplate(); |
3952 | 787a4489 | KangIngu | (currentControl as ArrowTextControl).Base_TextBox.Focus(); |
3953 | 168f8027 | taeseongkim | ViewerDataModel.Instance.AngleVisibility = Visibility.Visible; |
3954 | e66f22eb | KangIngu | //} |
3955 | 787a4489 | KangIngu | } |
3956 | } |
||
3957 | } |
||
3958 | break; |
||
3959 | case ControlType.ArrowTransTextBorderControl: |
||
3960 | { |
||
3961 | e6a9ddaf | humkyung | if (e.LeftButton == MouseButtonState.Pressed) |
3962 | 787a4489 | KangIngu | { |
3963 | if (currentControl is ArrowTextControl) |
||
3964 | { |
||
3965 | ca40e004 | ljiyeon | //20180906 LJY TEST IsRotationDrawingEnable |
3966 | if (IsGetoutpoint((currentControl as ArrowTextControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
||
3967 | e66f22eb | KangIngu | { |
3968 | return; |
||
3969 | } |
||
3970 | f513c215 | humkyung | CreateCommand.Instance.Execute(currentControl); |
3971 | 787a4489 | KangIngu | (currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false; |
3972 | 49b217ad | humkyung | currentControl.IsNew = false; |
3973 | 787a4489 | KangIngu | currentControl = null; |
3974 | 55d4f382 | 송근호 | |
3975 | 168f8027 | taeseongkim | ViewerDataModel.Instance.AngleVisibility = Visibility.Collapsed; |
3976 | 787a4489 | KangIngu | } |
3977 | else |
||
3978 | { |
||
3979 | e66f22eb | KangIngu | //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
3980 | //{ |
||
3981 | ca40e004 | ljiyeon | |
3982 | |||
3983 | currentControl = new ArrowTextControl() |
||
3984 | 120b8b00 | 송근호 | { |
3985 | ArrowTextStyle = MarkupToPDF.Controls.Text.ArrowTextControl.ArrowTextStyleSet.Rect, |
||
3986 | ControlType = ControlType.ArrowTransTextBorderControl |
||
3987 | |||
3988 | }; |
||
3989 | 24678e06 | humkyung | currentControl.CommentID = Commons.shortGuid(); |
3990 | 787a4489 | KangIngu | currentControl.IsNew = true; |
3991 | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
||
3992 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
||
3993 | |||
3994 | currentControl.SetValue(Canvas.ZIndexProperty, 3); |
||
3995 | |||
3996 | c7fde400 | taeseongkim | currentControl.SetValue(ArrowTextControl.StartPointProperty, CanvasDrawingMouseDownPoint); |
3997 | currentControl.SetValue(ArrowTextControl.EndPointProperty, CanvasDrawingMouseDownPoint); |
||
3998 | 610a4b86 | KangIngu | (currentControl as ArrowTextControl).TextSize = ViewerDataModel.Instance.TextSize; |
3999 | 787a4489 | KangIngu | (currentControl as ArrowTextControl).isFixed = true; |
4000 | (currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape; |
||
4001 | ca40e004 | ljiyeon | |
4002 | //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 |
||
4003 | fa48eb85 | taeseongkim | (currentControl as ArrowTextControl).CommentAngle -= rotate.Angle; |
4004 | 787a4489 | KangIngu | (currentControl as ArrowTextControl).ApplyTemplate(); |
4005 | 55d4f382 | 송근호 | (currentControl as ArrowTextControl).SetFontFamily(new FontFamily(this.ParentOfType<MainWindow>().dzTopMenu.comboFontFamily.Text)); |
4006 | ca40e004 | ljiyeon | (currentControl as ArrowTextControl).Base_TextBox.Focus(); |
4007 | 168f8027 | taeseongkim | ViewerDataModel.Instance.AngleVisibility = Visibility.Visible; |
4008 | ca40e004 | ljiyeon | |
4009 | //20180911 LJY |
||
4010 | (currentControl as ArrowTextControl).isTrans = true; |
||
4011 | |||
4012 | |||
4013 | e66f22eb | KangIngu | //} |
4014 | 787a4489 | KangIngu | } |
4015 | } |
||
4016 | } |
||
4017 | break; |
||
4018 | case ControlType.ArrowTextCloudControl: |
||
4019 | { |
||
4020 | e6a9ddaf | humkyung | if (e.LeftButton == MouseButtonState.Pressed) |
4021 | 787a4489 | KangIngu | { |
4022 | if (currentControl is ArrowTextControl) |
||
4023 | { |
||
4024 | ca40e004 | ljiyeon | //20180906 LJY TEST IsRotationDrawingEnable |
4025 | if (IsGetoutpoint((currentControl as ArrowTextControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
||
4026 | e66f22eb | KangIngu | { |
4027 | return; |
||
4028 | } |
||
4029 | f513c215 | humkyung | CreateCommand.Instance.Execute(currentControl); |
4030 | 787a4489 | KangIngu | (currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false; |
4031 | 49b217ad | humkyung | currentControl.IsNew = false; |
4032 | 787a4489 | KangIngu | currentControl = null; |
4033 | 168f8027 | taeseongkim | ViewerDataModel.Instance.AngleVisibility = Visibility.Collapsed; |
4034 | 787a4489 | KangIngu | } |
4035 | else |
||
4036 | { |
||
4037 | e66f22eb | KangIngu | //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
4038 | //{ |
||
4039 | 787a4489 | KangIngu | currentControl = new ArrowTextControl() |
4040 | { |
||
4041 | ArrowTextStyle = MarkupToPDF.Controls.Text.ArrowTextControl.ArrowTextStyleSet.Cloud |
||
4042 | }; |
||
4043 | 24678e06 | humkyung | currentControl.CommentID = Commons.shortGuid(); |
4044 | 787a4489 | KangIngu | currentControl.IsNew = true; |
4045 | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
||
4046 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
||
4047 | |||
4048 | currentControl.SetValue(Canvas.ZIndexProperty, 3); |
||
4049 | c7fde400 | taeseongkim | currentControl.SetValue(ArrowTextControl.StartPointProperty, CanvasDrawingMouseDownPoint); |
4050 | currentControl.SetValue(ArrowTextControl.EndPointProperty, CanvasDrawingMouseDownPoint); |
||
4051 | 610a4b86 | KangIngu | (currentControl as ArrowTextControl).TextSize = ViewerDataModel.Instance.TextSize; |
4052 | 787a4489 | KangIngu | (currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape; |
4053 | 55d4f382 | 송근호 | (currentControl as ArrowTextControl).SetFontFamily(new FontFamily(this.ParentOfType<MainWindow>().dzTopMenu.comboFontFamily.Text)); |
4054 | ca40e004 | ljiyeon | //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 |
4055 | fa48eb85 | taeseongkim | (currentControl as ArrowTextControl).CommentAngle -= rotate.Angle; |
4056 | ca40e004 | ljiyeon | |
4057 | (currentControl as ArrowTextControl).ApplyTemplate(); |
||
4058 | 787a4489 | KangIngu | (currentControl as ArrowTextControl).Base_TextBox.Focus(); |
4059 | 168f8027 | taeseongkim | ViewerDataModel.Instance.AngleVisibility = Visibility.Visible; |
4060 | e66f22eb | KangIngu | //} |
4061 | 787a4489 | KangIngu | } |
4062 | } |
||
4063 | } |
||
4064 | break; |
||
4065 | case ControlType.ArrowTransTextCloudControl: |
||
4066 | { |
||
4067 | e6a9ddaf | humkyung | if (e.LeftButton == MouseButtonState.Pressed) |
4068 | 787a4489 | KangIngu | { |
4069 | if (currentControl is ArrowTextControl) |
||
4070 | { |
||
4071 | ca40e004 | ljiyeon | //20180906 LJY TEST IsRotationDrawingEnable |
4072 | if (IsGetoutpoint((currentControl as ArrowTextControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
||
4073 | e66f22eb | KangIngu | { |
4074 | return; |
||
4075 | } |
||
4076 | f513c215 | humkyung | CreateCommand.Instance.Execute(currentControl); |
4077 | 787a4489 | KangIngu | (currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false; |
4078 | 49b217ad | humkyung | currentControl.IsNew = false; |
4079 | 787a4489 | KangIngu | currentControl = null; |
4080 | 168f8027 | taeseongkim | ViewerDataModel.Instance.AngleVisibility = Visibility.Collapsed; |
4081 | 787a4489 | KangIngu | } |
4082 | else |
||
4083 | { |
||
4084 | e66f22eb | KangIngu | //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
4085 | //{ |
||
4086 | 787a4489 | KangIngu | currentControl = new ArrowTextControl() |
4087 | { |
||
4088 | 120b8b00 | 송근호 | ArrowTextStyle = MarkupToPDF.Controls.Text.ArrowTextControl.ArrowTextStyleSet.Cloud, |
4089 | ControlType = ControlType.ArrowTransTextCloudControl |
||
4090 | |||
4091 | 787a4489 | KangIngu | }; |
4092 | 24678e06 | humkyung | currentControl.CommentID = Commons.shortGuid(); |
4093 | ca40e004 | ljiyeon | currentControl.IsNew = true; |
4094 | 787a4489 | KangIngu | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
4095 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
||
4096 | currentControl.SetValue(Canvas.ZIndexProperty, 3); |
||
4097 | |||
4098 | c7fde400 | taeseongkim | currentControl.SetValue(ArrowTextControl.StartPointProperty, CanvasDrawingMouseDownPoint); |
4099 | currentControl.SetValue(ArrowTextControl.EndPointProperty, CanvasDrawingMouseDownPoint); |
||
4100 | 610a4b86 | KangIngu | (currentControl as ArrowTextControl).TextSize = ViewerDataModel.Instance.TextSize; |
4101 | 787a4489 | KangIngu | (currentControl as ArrowTextControl).isFixed = true; |
4102 | (currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape; |
||
4103 | |||
4104 | ca40e004 | ljiyeon | //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 |
4105 | fa48eb85 | taeseongkim | (currentControl as ArrowTextControl).CommentAngle -= rotate.Angle; |
4106 | 55d4f382 | 송근호 | (currentControl as ArrowTextControl).SetFontFamily(new FontFamily(this.ParentOfType<MainWindow>().dzTopMenu.comboFontFamily.Text)); |
4107 | ca40e004 | ljiyeon | (currentControl as ArrowTextControl).ApplyTemplate(); |
4108 | 787a4489 | KangIngu | (currentControl as ArrowTextControl).Base_TextBox.Focus(); |
4109 | 168f8027 | taeseongkim | ViewerDataModel.Instance.AngleVisibility = Visibility.Visible; |
4110 | ca40e004 | ljiyeon | |
4111 | //20180911 LJY |
||
4112 | (currentControl as ArrowTextControl).isTrans = true; |
||
4113 | e66f22eb | KangIngu | //} |
4114 | 787a4489 | KangIngu | } |
4115 | } |
||
4116 | } |
||
4117 | break; |
||
4118 | //강인구 추가 |
||
4119 | case ControlType.Sign: |
||
4120 | { |
||
4121 | e6a9ddaf | humkyung | if (e.LeftButton == MouseButtonState.Pressed) |
4122 | 787a4489 | KangIngu | { |
4123 | e66f22eb | KangIngu | //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
4124 | //{ |
||
4125 | d7e20d2d | taeseongkim | var _sign = await BaseTaskClient.GetSignDataAsync(App.ViewInfo.ProjectNO, App.ViewInfo.UserID); |
4126 | 992a98b4 | KangIngu | |
4127 | d7e20d2d | taeseongkim | if (_sign == null) |
4128 | 992a98b4 | KangIngu | { |
4129 | txtBatch.Visibility = Visibility.Collapsed; |
||
4130 | mouseHandlingMode = IKCOM.MouseHandlingMode.None; |
||
4131 | controlType = ControlType.None; |
||
4132 | |||
4133 | this.ParentOfType<MainWindow>().DialogMessage_Alert("등록된 Sign이 없습니다.", "Alert"); |
||
4134 | this.ParentOfType<MainWindow>().ChildrenOfType<RadToggleButton>().Where(data => data.IsChecked == true).FirstOrDefault().IsChecked = false; |
||
4135 | return; |
||
4136 | } |
||
4137 | |||
4138 | 787a4489 | KangIngu | if (currentControl is SignControl) |
4139 | { |
||
4140 | ca40e004 | ljiyeon | //20180906 LJY TEST IsRotationDrawingEnable |
4141 | if (IsGetoutpoint((currentControl as SignControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
||
4142 | e66f22eb | KangIngu | { |
4143 | return; |
||
4144 | } |
||
4145 | |||
4146 | f513c215 | humkyung | CreateCommand.Instance.Execute(currentControl); |
4147 | 787a4489 | KangIngu | currentControl = null; |
4148 | if (Common.ViewerDataModel.Instance.SelectedControl == "Batch") |
||
4149 | { |
||
4150 | 999c9e40 | humkyung | txtBatch.Text = "Place Date"; |
4151 | 787a4489 | KangIngu | controlType = ControlType.Date; |
4152 | } |
||
4153 | } |
||
4154 | else |
||
4155 | { |
||
4156 | currentControl = new SignControl |
||
4157 | { |
||
4158 | Background = new SolidColorBrush(Colors.Black), |
||
4159 | UserNumber = App.ViewInfo.UserID, |
||
4160 | a6272c57 | humkyung | ProjectNO = App.ViewInfo.ProjectNO, |
4161 | c7fde400 | taeseongkim | StartPoint = new Point(CanvasDrawingMouseDownPoint.X, CanvasDrawingMouseDownPoint.Y), |
4162 | EndPoint = new Point(CanvasDrawingMouseDownPoint.X, CanvasDrawingMouseDownPoint.Y), |
||
4163 | 787a4489 | KangIngu | ControlType = ControlType.Sign |
4164 | }; |
||
4165 | |||
4166 | 24678e06 | humkyung | currentControl.CommentID = Commons.shortGuid(); |
4167 | 787a4489 | KangIngu | currentControl.IsNew = true; |
4168 | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
||
4169 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
||
4170 | ca40e004 | ljiyeon | |
4171 | //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 |
||
4172 | fa48eb85 | taeseongkim | (currentControl as SignControl).CommentAngle -= rotate.Angle; |
4173 | ca40e004 | ljiyeon | } |
4174 | e66f22eb | KangIngu | //} |
4175 | 787a4489 | KangIngu | } |
4176 | } |
||
4177 | break; |
||
4178 | case ControlType.Mark: |
||
4179 | { |
||
4180 | e6a9ddaf | humkyung | if (e.LeftButton == MouseButtonState.Pressed) |
4181 | 787a4489 | KangIngu | { |
4182 | e66f22eb | KangIngu | //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
4183 | //{ |
||
4184 | 787a4489 | KangIngu | if (currentControl is RectangleControl) |
4185 | { |
||
4186 | ca40e004 | ljiyeon | //20180906 LJY TEST IsRotationDrawingEnable |
4187 | if (IsGetoutpoint((currentControl as RectangleControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
||
4188 | e66f22eb | KangIngu | { |
4189 | return; |
||
4190 | } |
||
4191 | |||
4192 | f513c215 | humkyung | CreateCommand.Instance.Execute(currentControl); |
4193 | 787a4489 | KangIngu | (currentControl as RectangleControl).ApplyOverViewData(); |
4194 | currentControl = null; |
||
4195 | 510cbd2a | ljiyeon | |
4196 | this.cursor = new Cursor(MainWindow.CursorChange().StreamSource); |
||
4197 | 787a4489 | KangIngu | |
4198 | if (Common.ViewerDataModel.Instance.SelectedControl == "Batch") |
||
4199 | { |
||
4200 | 999c9e40 | humkyung | txtBatch.Text = "Place Signature"; |
4201 | 787a4489 | KangIngu | controlType = ControlType.Sign; |
4202 | } |
||
4203 | } |
||
4204 | else |
||
4205 | { |
||
4206 | currentControl = new RectangleControl |
||
4207 | { |
||
4208 | c7fde400 | taeseongkim | StartPoint = new Point(CanvasDrawingMouseDownPoint.X, CanvasDrawingMouseDownPoint.Y), |
4209 | 787a4489 | KangIngu | Background = new SolidColorBrush(Colors.Black), |
4210 | a6272c57 | humkyung | ControlType = ControlType.Mark , |
4211 | 787a4489 | KangIngu | Paint = PaintSet.Fill |
4212 | }; |
||
4213 | |||
4214 | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
||
4215 | 24678e06 | humkyung | currentControl.CommentID = Commons.shortGuid(); |
4216 | 787a4489 | KangIngu | currentControl.IsNew = true; |
4217 | (currentControl as RectangleControl).DashSize = ViewerDataModel.Instance.DashSize; |
||
4218 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
||
4219 | } |
||
4220 | e66f22eb | KangIngu | //} |
4221 | 787a4489 | KangIngu | } |
4222 | } |
||
4223 | break; |
||
4224 | case ControlType.Symbol: |
||
4225 | { |
||
4226 | e6a9ddaf | humkyung | if (e.LeftButton == MouseButtonState.Pressed) |
4227 | 787a4489 | KangIngu | { |
4228 | a6272c57 | humkyung | if (currentControl is SymControl) |
4229 | { |
||
4230 | //20180906 LJY TEST IsRotationDrawingEnable |
||
4231 | if (IsGetoutpoint((currentControl as SymControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
||
4232 | 787a4489 | KangIngu | { |
4233 | a6272c57 | humkyung | return; |
4234 | 787a4489 | KangIngu | } |
4235 | a6272c57 | humkyung | CreateCommand.Instance.Execute(currentControl); |
4236 | currentControl = null; |
||
4237 | |||
4238 | this.cursor = new Cursor(MainWindow.CursorChange().StreamSource); |
||
4239 | } |
||
4240 | else |
||
4241 | { |
||
4242 | currentControl = new SymControl |
||
4243 | 787a4489 | KangIngu | { |
4244 | c7fde400 | taeseongkim | StartPoint = new Point(CanvasDrawingMouseDownPoint.X, CanvasDrawingMouseDownPoint.Y), |
4245 | a6272c57 | humkyung | Background = new SolidColorBrush(Colors.Black), |
4246 | LineSize = ViewerDataModel.Instance.LineSize + 3, |
||
4247 | ControlType = ControlType.Symbol |
||
4248 | }; |
||
4249 | 787a4489 | KangIngu | |
4250 | a6272c57 | humkyung | currentControl.IsNew = true; |
4251 | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
||
4252 | currentControl.CommentID = Commons.shortGuid(); |
||
4253 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
||
4254 | ca40e004 | ljiyeon | |
4255 | a6272c57 | humkyung | //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 |
4256 | fa48eb85 | taeseongkim | (currentControl as SymControl).CommentAngle -= rotate.Angle; |
4257 | ca40e004 | ljiyeon | } |
4258 | e66f22eb | KangIngu | //} |
4259 | 787a4489 | KangIngu | } |
4260 | } |
||
4261 | break; |
||
4262 | case ControlType.Stamp: |
||
4263 | { |
||
4264 | e6a9ddaf | humkyung | if (e.LeftButton == MouseButtonState.Pressed) |
4265 | 787a4489 | KangIngu | { |
4266 | e66f22eb | KangIngu | //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
4267 | //{ |
||
4268 | 787a4489 | KangIngu | if (currentControl is SymControlN) |
4269 | { |
||
4270 | ca40e004 | ljiyeon | //20180906 LJY TEST IsRotationDrawingEnable |
4271 | if (IsGetoutpoint((currentControl as SymControlN).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
||
4272 | e66f22eb | KangIngu | { |
4273 | return; |
||
4274 | } |
||
4275 | |||
4276 | f513c215 | humkyung | CreateCommand.Instance.Execute(currentControl); |
4277 | 787a4489 | KangIngu | currentControl = null; |
4278 | 510cbd2a | ljiyeon | |
4279 | |||
4280 | this.cursor = new Cursor(MainWindow.CursorChange().StreamSource); |
||
4281 | 787a4489 | KangIngu | } |
4282 | else |
||
4283 | { |
||
4284 | currentControl = new SymControlN |
||
4285 | { |
||
4286 | c7fde400 | taeseongkim | StartPoint = new Point(CanvasDrawingMouseDownPoint.X, CanvasDrawingMouseDownPoint.Y), |
4287 | 787a4489 | KangIngu | Background = new SolidColorBrush(Colors.Black), |
4288 | cd988cd8 | djkim | STAMP = App.SystemInfo.STAMP, |
4289 | 787a4489 | KangIngu | ControlType = ControlType.Stamp |
4290 | }; |
||
4291 | |||
4292 | currentControl.IsNew = true; |
||
4293 | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
||
4294 | 24678e06 | humkyung | currentControl.CommentID = Commons.shortGuid(); |
4295 | 787a4489 | KangIngu | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
4296 | ca40e004 | ljiyeon | //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 |
4297 | fa48eb85 | taeseongkim | (currentControl as SymControlN).CommentAngle -= rotate.Angle; |
4298 | ca40e004 | ljiyeon | } |
4299 | e66f22eb | KangIngu | //} |
4300 | 787a4489 | KangIngu | } |
4301 | } |
||
4302 | break; |
||
4303 | case ControlType.PenControl: |
||
4304 | { |
||
4305 | if (inkBoard.Tag.ToString() == "Ink") |
||
4306 | { |
||
4307 | inkBoard.IsEnabled = true; |
||
4308 | c7fde400 | taeseongkim | StartNewStroke(CanvasDrawingMouseDownPoint); |
4309 | 787a4489 | KangIngu | } |
4310 | else if (inkBoard.Tag.ToString() == "EraseByPoint") |
||
4311 | { |
||
4312 | c7fde400 | taeseongkim | RemovePointStroke(CanvasDrawingMouseDownPoint); |
4313 | 787a4489 | KangIngu | } |
4314 | else if (inkBoard.Tag.ToString() == "EraseByStroke") |
||
4315 | { |
||
4316 | c7fde400 | taeseongkim | RemoveLineStroke(CanvasDrawingMouseDownPoint); |
4317 | 787a4489 | KangIngu | } |
4318 | IsDrawing = true; |
||
4319 | return; |
||
4320 | } |
||
4321 | default: |
||
4322 | if (currentControl != null) |
||
4323 | { |
||
4324 | currentControl.CommentID = null; |
||
4325 | currentControl.IsNew = false; |
||
4326 | } |
||
4327 | break; |
||
4328 | } |
||
4329 | fa48eb85 | taeseongkim | |
4330 | if (currentControl != null) |
||
4331 | { |
||
4332 | currentControl.PageAngle = pageNavigator.CurrentPage.Angle; |
||
4333 | } |
||
4334 | 787a4489 | KangIngu | } |
4335 | e6a9ddaf | humkyung | if (mouseHandlingMode != MouseHandlingMode.None && e.LeftButton == MouseButtonState.Pressed) |
4336 | 787a4489 | KangIngu | { |
4337 | if (mouseHandlingMode == MouseHandlingMode.Adorner && SelectLayer.Children.Count > 0) |
||
4338 | { |
||
4339 | bool mouseOff = false; |
||
4340 | foreach (var item in SelectLayer.Children) |
||
4341 | { |
||
4342 | if (item is AdornerFinal) |
||
4343 | { |
||
4344 | |||
4345 | 4913851c | humkyung | var over = (item as AdornerFinal).Members.Where(data => data.DrawingData.IsMouseOver).FirstOrDefault(); |
4346 | 787a4489 | KangIngu | if (over != null) |
4347 | { |
||
4348 | mouseOff = true; |
||
4349 | } |
||
4350 | } |
||
4351 | } |
||
4352 | |||
4353 | if (!mouseOff) |
||
4354 | { |
||
4355 | 077896be | humkyung | SelectionSet.Instance.UnSelect(this); |
4356 | 787a4489 | KangIngu | } |
4357 | } |
||
4358 | zoomAndPanControl.CaptureMouse(); |
||
4359 | e.Handled = true; |
||
4360 | } |
||
4361 | 5d55f6fb | ljiyeon | |
4362 | 787a4489 | KangIngu | } |
4363 | e54660e8 | KangIngu | |
4364 | a1716fa5 | KangIngu | private void zoomAndPanControl2_MouseDown(object sender, MouseButtonEventArgs e) |
4365 | { |
||
4366 | e6a9ddaf | humkyung | ///mouseButtonDown = e.ChangedButton; |
4367 | a1716fa5 | KangIngu | canvasZoommovingMouseDownPoint = e.GetPosition(zoomAndPanCanvas2); |
4368 | } |
||
4369 | |||
4370 | 787a4489 | KangIngu | private void RemoveLineStroke(Point P) |
4371 | { |
||
4372 | 05009a0e | ljiyeon | var control = ViewerDataModel.Instance.MarkupControls_USER.Where(data => data.IsMouseOver).FirstOrDefault(); |
4373 | 787a4489 | KangIngu | if (control != null) |
4374 | { |
||
4375 | f729ef4e | humkyung | DeleteCommand.Instance.Execute(new List<CommentUserInfo>() { control }); |
4376 | 787a4489 | KangIngu | } |
4377 | } |
||
4378 | |||
4379 | private void RemovePointStroke(Point P) |
||
4380 | { |
||
4381 | foreach (Stroke hits in inkBoard.Strokes) |
||
4382 | { |
||
4383 | foreach (StylusPoint sty in hits.StylusPoints) |
||
4384 | { |
||
4385 | |||
4386 | } |
||
4387 | if (hits.HitTest(P)) |
||
4388 | { |
||
4389 | inkBoard.Strokes.Remove(hits); |
||
4390 | return; |
||
4391 | } |
||
4392 | } |
||
4393 | } |
||
4394 | |||
4395 | private void StartNewStroke(Point P) |
||
4396 | { |
||
4397 | strokePoints = new StylusPointCollection(); |
||
4398 | StylusPoint segment1Start = new StylusPoint(P.X, P.Y); |
||
4399 | strokePoints.Add(segment1Start); |
||
4400 | stroke = new Stroke(strokePoints); |
||
4401 | |||
4402 | stroke.DrawingAttributes.Color = Colors.Red; |
||
4403 | stroke.DrawingAttributes.Width = 4; |
||
4404 | stroke.DrawingAttributes.Height = 4; |
||
4405 | |||
4406 | inkBoard.Strokes.Add(stroke); |
||
4407 | } |
||
4408 | |||
4409 | private void btnConsolidate_Click(object sender, RoutedEventArgs e) |
||
4410 | { |
||
4411 | ConsolidationMethod(); |
||
4412 | } |
||
4413 | |||
4414 | 102476f6 | humkyung | /// <summary> |
4415 | /// execute TeamConsolidationCommand |
||
4416 | /// </summary> |
||
4417 | 04a7385a | djkim | public void TeamConsolidationMethod() |
4418 | { |
||
4419 | 102476f6 | humkyung | this.UpdateMyMarkupList(); |
4420 | 04a7385a | djkim | if (this.gridViewMarkup.SelectedItems.Count == 0) |
4421 | { |
||
4422 | this.ParentOfType<MainWindow>().DialogMessage_Alert("Please select at least one user", "Alert"); |
||
4423 | } |
||
4424 | else |
||
4425 | { |
||
4426 | 8129f2a5 | ljiyeon | |
4427 | ViewerDataModel.Instance.IsConsolidate = true; |
||
4428 | this.ParentOfType<MainWindow>().dzTopMenu._SaveEvent(null, null); |
||
4429 | |||
4430 | 04a7385a | djkim | foreach (MarkupInfoItem item in this.gridViewMarkup.SelectedItems) |
4431 | { |
||
4432 | if (!this.userData.DEPARTMENT.Equals(item.Depatment)) |
||
4433 | { |
||
4434 | this.ParentOfType<MainWindow>().DialogMessage_Alert("Please select at your department", "Alert"); |
||
4435 | return; |
||
4436 | } |
||
4437 | } |
||
4438 | 102476f6 | humkyung | List<MarkupInfoItem> MarkupInfoList = new List<MarkupInfoItem>(); |
4439 | 04a7385a | djkim | foreach (MarkupInfoItem item in this.gridViewMarkup.SelectedItems) |
4440 | 90e7968d | ljiyeon | { |
4441 | 102476f6 | humkyung | MarkupInfoList.Add(item); |
4442 | 04a7385a | djkim | } |
4443 | 102476f6 | humkyung | TeamConsolidateCommand.Instance.Execute(MarkupInfoList); |
4444 | 04a7385a | djkim | } |
4445 | } |
||
4446 | 102476f6 | humkyung | |
4447 | 787a4489 | KangIngu | public void ConsolidationMethod() |
4448 | { |
||
4449 | if (this.gridViewMarkup.SelectedItems.Count == 0) |
||
4450 | { |
||
4451 | this.ParentOfType<MainWindow>().DialogMessage_Alert("Please select at least one user", "Alert"); |
||
4452 | } |
||
4453 | else |
||
4454 | 90e7968d | ljiyeon | { |
4455 | 35a96e24 | humkyung | List<IKCOM.MarkupInfoItem> MySelectItem = new List<IKCOM.MarkupInfoItem>(); |
4456 | foreach (var item in this.gridViewMarkup.SelectedItems) |
||
4457 | { |
||
4458 | MySelectItem.Add(item as IKCOM.MarkupInfoItem); |
||
4459 | } |
||
4460 | int iPageNo = Convert.ToInt32(this.ParentOfType<MainWindow>().dzTopMenu.tlcurrentPage.Text); |
||
4461 | 8129f2a5 | ljiyeon | |
4462 | 35a96e24 | humkyung | ConsolidateCommand.Instance.Execute(MySelectItem, iPageNo); |
4463 | 787a4489 | KangIngu | } |
4464 | } |
||
4465 | |||
4466 | private void btnConsolidate_Loaded(object sender, RoutedEventArgs e) |
||
4467 | { |
||
4468 | if (App.ViewInfo != null) |
||
4469 | { |
||
4470 | btnConsolidate = (sender as RadRibbonButton); |
||
4471 | if (!App.ViewInfo.NewCommentPermission) |
||
4472 | { |
||
4473 | (sender as RadRibbonButton).Visibility = System.Windows.Visibility.Collapsed; |
||
4474 | } |
||
4475 | } |
||
4476 | } |
||
4477 | |||
4478 | private void btnTeamConsolidate_Click(object sender, RoutedEventArgs e) |
||
4479 | { |
||
4480 | 04a7385a | djkim | TeamConsolidationMethod(); |
4481 | 787a4489 | KangIngu | } |
4482 | |||
4483 | private void btnTeamConsolidate_Loaded(object sender, RoutedEventArgs e) |
||
4484 | { |
||
4485 | btnTeamConsolidate = sender as RadRibbonButton; |
||
4486 | if (App.ViewInfo != null) |
||
4487 | { |
||
4488 | if (!App.ViewInfo.CreateFinalPDFPermission) //파이널이 True가 아니면 |
||
4489 | { |
||
4490 | if (btnConsolidate != null) |
||
4491 | { |
||
4492 | btnConsolidate.Visibility = Visibility.Collapsed; |
||
4493 | } |
||
4494 | |||
4495 | if (!App.ViewInfo.NewCommentPermission) |
||
4496 | { |
||
4497 | btnTeamConsolidate.Visibility = Visibility.Collapsed; |
||
4498 | } |
||
4499 | } |
||
4500 | else |
||
4501 | { |
||
4502 | btnTeamConsolidate.Visibility = Visibility.Collapsed; |
||
4503 | } |
||
4504 | } |
||
4505 | } |
||
4506 | |||
4507 | private void FinalPDFEvent(object sender, RoutedEventArgs e) |
||
4508 | { |
||
4509 | 3b62305d | ljiyeon | var item = gridViewMarkup.Items.Cast<MarkupInfoItem>().Where(d => d.Consolidate == 1 && d.AvoidConsolidate == 0).FirstOrDefault(); |
4510 | 056e4dfd | djkim | if(item != null) |
4511 | 787a4489 | KangIngu | { |
4512 | 056e4dfd | djkim | if (BaseClient.FinalPDF_GetFinalPDFStatus(_DocInfo.ID, item.MarkupInfoID, _ViewInfo.UserID)) |
4513 | 81e3c9f6 | ljiyeon | { |
4514 | Logger.sendReqLog("SetFinalPDFAsync", _ViewInfo.ProjectNO + "," + _DocInfo.ID + "," + item.MarkupInfoID + "," + _ViewInfo.UserID, 1); |
||
4515 | BaseClient.SetFinalPDFAsync(_ViewInfo.ProjectNO, _DocInfo.ID, item.MarkupInfoID, _ViewInfo.UserID); |
||
4516 | } |
||
4517 | else |
||
4518 | { |
||
4519 | 056e4dfd | djkim | DialogMessage_Alert("Merged PDF가 수행중입니다", "안내"); |
4520 | 81e3c9f6 | ljiyeon | } |
4521 | 056e4dfd | djkim | }else{ |
4522 | //Consolidate 가 없는 경우 |
||
4523 | DialogMessage_Alert("Consolidation 된 코멘트가 존재하지 않습니다", "안내"); |
||
4524 | 787a4489 | KangIngu | } |
4525 | 056e4dfd | djkim | |
4526 | 787a4489 | KangIngu | } |
4527 | |||
4528 | private void btnFinalPDF_Loaded(object sender, RoutedEventArgs e) |
||
4529 | { |
||
4530 | btnFinalPDF = sender as RadRibbonButton; |
||
4531 | if (App.ViewInfo != null) |
||
4532 | { |
||
4533 | if (!App.ViewInfo.CreateFinalPDFPermission) //파이널이 True가 아니면 |
||
4534 | { |
||
4535 | btnFinalPDF.Visibility = System.Windows.Visibility.Collapsed; |
||
4536 | if (btnConsolidate != null) |
||
4537 | { |
||
4538 | btnConsolidate.Visibility = Visibility.Collapsed; |
||
4539 | } |
||
4540 | } |
||
4541 | } |
||
4542 | } |
||
4543 | |||
4544 | 80458c15 | ljiyeon | private void ConsolidateFinalPDFEvent(object sender, RoutedEventArgs e) |
4545 | { |
||
4546 | d62c0439 | humkyung | UpdateMyMarkupList(); |
4547 | 80458c15 | ljiyeon | |
4548 | if (this.gridViewMarkup.SelectedItems.Count == 0) |
||
4549 | { |
||
4550 | this.ParentOfType<MainWindow>().DialogMessage_Alert("Please select at least one user", "Alert"); |
||
4551 | } |
||
4552 | else |
||
4553 | { |
||
4554 | ViewerDataModel.Instance.IsConsolidate = true; |
||
4555 | this.ParentOfType<MainWindow>().dzTopMenu._SaveEvent(null, null); |
||
4556 | List<KCOMDataModel.DataModel.MARKUP_DATA> instanceDataSet = new List<KCOMDataModel.DataModel.MARKUP_DATA>(); |
||
4557 | |||
4558 | string project_no = App.ViewInfo.ProjectNO; |
||
4559 | string doc_id = _DocInfo.ID; |
||
4560 | string user_id = App.ViewInfo.UserID; |
||
4561 | List<MarkupInfoItem> markupInfoItems = new List<MarkupInfoItem>(); |
||
4562 | foreach (MarkupInfoItem item in this.gridViewMarkup.SelectedItems) |
||
4563 | { |
||
4564 | markupInfoItems.Add(item); |
||
4565 | } |
||
4566 | Logger.sendReqLog("Consolidate", project_no + "," + user_id + "," + doc_id + "," + markupInfoItems, 1); |
||
4567 | Logger.sendResLog("Consolidate", this.BaseClient.Consolidate(project_no, user_id, doc_id, markupInfoItems).ToString(), 1); |
||
4568 | Logger.sendReqLog("GetMarkupInfoItemsAsync", App.ViewInfo.ProjectNO + "," + _DocInfo.ID, 1); |
||
4569 | 1126281e | djkim | var items = this.BaseClient.GetMarkupInfoItems(App.ViewInfo.ProjectNO, _DocInfo.ID); |
4570 | 80458c15 | ljiyeon | |
4571 | 1126281e | djkim | var item2 = items.Where(d => d.Consolidate == 1 && d.AvoidConsolidate == 0).FirstOrDefault(); |
4572 | 80458c15 | ljiyeon | if (item2 != null) |
4573 | { |
||
4574 | Logger.sendReqLog("SetFinalPDFAsync", _ViewInfo.ProjectNO + "," + _DocInfo.ID + "," + item2.MarkupInfoID + "," + _ViewInfo.UserID, 1); |
||
4575 | |||
4576 | BaseClient.SetFinalPDFAsync(_ViewInfo.ProjectNO, _DocInfo.ID, item2.MarkupInfoID, _ViewInfo.UserID); |
||
4577 | 1126281e | djkim | BaseClient.GetMarkupInfoItemsAsync(App.ViewInfo.ProjectNO, _DocInfo.ID); |
4578 | 80458c15 | ljiyeon | } |
4579 | else |
||
4580 | { |
||
4581 | DialogMessage_Alert("Consolidation 된 코멘트가 존재하지 않습니다", "안내"); |
||
4582 | } |
||
4583 | 90e7968d | ljiyeon | } |
4584 | 80458c15 | ljiyeon | } |
4585 | |||
4586 | private void btnConsolidateFinalPDF_Loaded(object sender, RoutedEventArgs e) |
||
4587 | 90e7968d | ljiyeon | { |
4588 | 80458c15 | ljiyeon | btnConsolidateFinalPDF = (sender as RadRibbonButton); |
4589 | 84605c0c | taeseongkim | #if Hyosung |
4590 | btnConsolidateFinalPDF.Visibility = System.Windows.Visibility.Collapsed; |
||
4591 | #else |
||
4592 | 80458c15 | ljiyeon | if (App.ViewInfo != null) |
4593 | { |
||
4594 | if (!App.ViewInfo.NewCommentPermission || !App.ViewInfo.CreateFinalPDFPermission) |
||
4595 | { |
||
4596 | 90e7968d | ljiyeon | btnConsolidateFinalPDF.Visibility = System.Windows.Visibility.Collapsed; |
4597 | 80458c15 | ljiyeon | } |
4598 | 90e7968d | ljiyeon | } |
4599 | 84605c0c | taeseongkim | #endif |
4600 | 80458c15 | ljiyeon | } |
4601 | |||
4602 | 787a4489 | KangIngu | private void SyncCompare_Click(object sender, RoutedEventArgs e) |
4603 | { |
||
4604 | adce8360 | humkyung | SetCompareRect(); |
4605 | 787a4489 | KangIngu | } |
4606 | |||
4607 | 9cd2865b | KangIngu | private void Sync_Click(object sender, RoutedEventArgs e) |
4608 | { |
||
4609 | a1716fa5 | KangIngu | if (Sync.IsChecked) |
4610 | 9cd2865b | KangIngu | { |
4611 | ViewerDataModel.Instance.Sync_ContentOffsetX = zoomAndPanControl.ContentOffsetX; |
||
4612 | ViewerDataModel.Instance.Sync_ContentOffsetY = zoomAndPanControl.ContentOffsetY; |
||
4613 | ViewerDataModel.Instance.Sync_ContentScale = zoomAndPanControl.ContentScale; |
||
4614 | } |
||
4615 | } |
||
4616 | |||
4617 | 787a4489 | KangIngu | private void SyncUserListExpender_Click(object sender, RoutedEventArgs e) |
4618 | { |
||
4619 | if (UserList.IsChecked) |
||
4620 | { |
||
4621 | this.gridViewRevMarkup.Visibility = Visibility.Visible; |
||
4622 | } |
||
4623 | else |
||
4624 | { |
||
4625 | this.gridViewRevMarkup.Visibility = Visibility.Collapsed; |
||
4626 | } |
||
4627 | } |
||
4628 | |||
4629 | private void SyncPageBalance_Click(object sender, RoutedEventArgs e) |
||
4630 | { |
||
4631 | |||
4632 | if (BalanceMode.IsChecked) |
||
4633 | { |
||
4634 | ViewerDataModel.Instance.PageBalanceMode = true; |
||
4635 | } |
||
4636 | else |
||
4637 | { |
||
4638 | ViewerDataModel.Instance.PageBalanceMode = false; |
||
4639 | ViewerDataModel.Instance.PageBalanceNumber = 0; |
||
4640 | } |
||
4641 | } |
||
4642 | |||
4643 | private void SyncExit_Click(object sender, RoutedEventArgs e) |
||
4644 | { |
||
4645 | //초기화 |
||
4646 | testPanel2.IsHidden = true; |
||
4647 | ViewerDataModel.Instance.PageBalanceMode = false; |
||
4648 | ViewerDataModel.Instance.PageBalanceNumber = 0; |
||
4649 | ViewerDataModel.Instance.PageNumber = 0; |
||
4650 | ViewerDataModel.Instance.MarkupControls_Sync.Clear(); |
||
4651 | this.gridViewRevMarkup.Visibility = Visibility.Collapsed; |
||
4652 | UserList.IsChecked = false; |
||
4653 | BalanceMode.IsChecked = false; |
||
4654 | } |
||
4655 | |||
4656 | ac4f1e13 | taeseongkim | private async void SyncPageChange_Click(object sender, RoutedEventArgs e) |
4657 | 787a4489 | KangIngu | { |
4658 | if ((sender as System.Windows.Controls.Control).Tag != null) |
||
4659 | { |
||
4660 | //Compare 초기화 |
||
4661 | CompareMode.IsChecked = false; |
||
4662 | var balancePoint = Convert.ToInt32((sender as System.Windows.Controls.Control).Tag); |
||
4663 | |||
4664 | if (ViewerDataModel.Instance.PageNumber == 0) |
||
4665 | { |
||
4666 | ViewerDataModel.Instance.PageNumber = 1; |
||
4667 | } |
||
4668 | |||
4669 | if (ViewerDataModel.Instance.PageBalanceNumber == pageNavigator.PageCount) |
||
4670 | { |
||
4671 | } |
||
4672 | else |
||
4673 | { |
||
4674 | ViewerDataModel.Instance.PageBalanceNumber += balancePoint; |
||
4675 | } |
||
4676 | |||
4677 | 6b6e937c | taeseongkim | |
4678 | |||
4679 | 787a4489 | KangIngu | if (ViewerDataModel.Instance.PageNumber == pageNavigator.PageCount && balancePoint > 0) |
4680 | { |
||
4681 | |||
4682 | } |
||
4683 | else if ((ViewerDataModel.Instance.PageNumber + balancePoint) >= 1) |
||
4684 | { |
||
4685 | ViewerDataModel.Instance.PageNumber += balancePoint; |
||
4686 | } |
||
4687 | |||
4688 | d04e8ee9 | taeseongkim | //pageNavigator.GotoPage(ViewerDataModel.Instance.PageNumber); |
4689 | 6b6e937c | taeseongkim | |
4690 | 787a4489 | KangIngu | if (!testPanel2.IsHidden) |
4691 | { |
||
4692 | if (IsSyncPDFMode) |
||
4693 | { |
||
4694 | Get_FinalImage.Get_PdfImage get_PdfImage = new Get_FinalImage.Get_PdfImage(); |
||
4695 | var pdfpath = new BitmapImage(new Uri(get_PdfImage.Run(CurrentRev.TO_VENDOR, App.ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, ViewerDataModel.Instance.PageNumber))); |
||
4696 | |||
4697 | if (pdfpath.IsDownloading) |
||
4698 | { |
||
4699 | pdfpath.DownloadCompleted += (ex, arg) => |
||
4700 | { |
||
4701 | ViewerDataModel.Instance.ImageViewPath_C = pdfpath; |
||
4702 | ViewerDataModel.Instance.ImageViewWidth_C = pdfpath.PixelWidth; |
||
4703 | ViewerDataModel.Instance.ImageViewHeight_C = pdfpath.PixelHeight; |
||
4704 | zoomAndPanCanvas2.Width = pdfpath.PixelWidth; |
||
4705 | zoomAndPanCanvas2.Height = pdfpath.PixelHeight; |
||
4706 | }; |
||
4707 | } |
||
4708 | else |
||
4709 | { |
||
4710 | ViewerDataModel.Instance.ImageViewPath_C = pdfpath; |
||
4711 | ViewerDataModel.Instance.ImageViewWidth_C = pdfpath.PixelWidth; |
||
4712 | ViewerDataModel.Instance.ImageViewHeight_C = pdfpath.PixelHeight; |
||
4713 | |||
4714 | zoomAndPanCanvas2.Width = pdfpath.PixelWidth; |
||
4715 | zoomAndPanCanvas2.Height = pdfpath.PixelHeight; |
||
4716 | } |
||
4717 | |||
4718 | } |
||
4719 | else |
||
4720 | { |
||
4721 | 6b6e937c | taeseongkim | string uri = this.GetImageURL(CurrentRev.DOCUMENT_ID, ViewerDataModel.Instance.PageNumber); |
4722 | 787a4489 | KangIngu | |
4723 | var defaultBitmapImage_Compare = new BitmapImage(new Uri(uri)); |
||
4724 | |||
4725 | ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare; |
||
4726 | ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth; |
||
4727 | ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight; |
||
4728 | |||
4729 | zoomAndPanCanvas2.Width = defaultBitmapImage_Compare.PixelWidth; |
||
4730 | zoomAndPanCanvas2.Height = defaultBitmapImage_Compare.PixelHeight; |
||
4731 | |||
4732 | if (defaultBitmapImage_Compare.IsDownloading) |
||
4733 | { |
||
4734 | defaultBitmapImage_Compare.DownloadCompleted += (ex, arg) => |
||
4735 | { |
||
4736 | ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare; |
||
4737 | ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth; |
||
4738 | ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight; |
||
4739 | |||
4740 | zoomAndPanCanvas2.Width = defaultBitmapImage_Compare.PixelWidth; |
||
4741 | zoomAndPanCanvas2.Height = defaultBitmapImage_Compare.PixelHeight; |
||
4742 | }; |
||
4743 | } |
||
4744 | } |
||
4745 | |||
4746 | //강인구 추가(페이지 이동시 코멘트 재 호출) |
||
4747 | ViewerDataModel.Instance.MarkupControls_Sync.Clear(); |
||
4748 | List<MarkupInfoItem> gridSelectionRevItem = gridViewRevMarkup.SelectedItems.Cast<MarkupInfoItem>().ToList(); |
||
4749 | |||
4750 | foreach (var item in gridSelectionRevItem) |
||
4751 | { |
||
4752 | ac4f1e13 | taeseongkim | var markupitems = item.MarkupList.Where(pageItem => pageItem.PageNumber == ViewerDataModel.Instance.PageNumber).ToList(); |
4753 | foreach (var markupitem in markupitems) |
||
4754 | 787a4489 | KangIngu | { |
4755 | ac4f1e13 | taeseongkim | await MarkupParser.ParseExAsync(App.ViewInfo.ProjectNO, markupitem.Data, Common.ViewerDataModel.Instance.MarkupControls_Sync, item.DisplayColor, "", item.MarkupInfoID); |
4756 | } |
||
4757 | 787a4489 | KangIngu | } |
4758 | e54660e8 | KangIngu | |
4759 | 787a4489 | KangIngu | //강인구 추가 |
4760 | zoomAndPanControl2.ZoomTo(new Rect |
||
4761 | { |
||
4762 | X = 0, |
||
4763 | Y = 0, |
||
4764 | Width = Math.Max(zoomAndPanCanvas.Width, zoomAndPanCanvas2.Width), |
||
4765 | Height = Math.Max(zoomAndPanCanvas.Height, zoomAndPanCanvas2.Height), |
||
4766 | }); |
||
4767 | ae56d52d | KangIngu | |
4768 | 787a4489 | KangIngu | tlSyncPageNum.Text = String.Format("Current Page : {0}", ViewerDataModel.Instance.PageNumber); |
4769 | |||
4770 | } |
||
4771 | } |
||
4772 | } |
||
4773 | |||
4774 | private void SyncChange_Click(object sender, RoutedEventArgs e) |
||
4775 | { |
||
4776 | if (MarkupMode.IsChecked) |
||
4777 | { |
||
4778 | IsSyncPDFMode = true; |
||
4779 | |||
4780 | var uri = CurrentRev.TO_VENDOR; |
||
4781 | ae56d52d | KangIngu | |
4782 | 787a4489 | KangIngu | if (ViewerDataModel.Instance.PageNumber == 0) |
4783 | { |
||
4784 | ViewerDataModel.Instance.PageNumber = 1; |
||
4785 | } |
||
4786 | |||
4787 | //PDF모드 잠시 대기(강인구) |
||
4788 | Get_FinalImage.Get_PdfImage get_PdfImage = new Get_FinalImage.Get_PdfImage(); |
||
4789 | var pdfpath = new BitmapImage(new Uri(get_PdfImage.Run(CurrentRev.TO_VENDOR, App.ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, ViewerDataModel.Instance.PageNumber))); |
||
4790 | |||
4791 | if (pdfpath.IsDownloading) |
||
4792 | { |
||
4793 | pdfpath.DownloadCompleted += (ex, arg) => |
||
4794 | { |
||
4795 | ViewerDataModel.Instance.ImageViewPath_C = pdfpath; |
||
4796 | ViewerDataModel.Instance.ImageViewWidth_C = pdfpath.PixelWidth; |
||
4797 | ViewerDataModel.Instance.ImageViewHeight_C = pdfpath.PixelHeight; |
||
4798 | zoomAndPanCanvas2.Width = pdfpath.PixelWidth; |
||
4799 | zoomAndPanCanvas2.Height = pdfpath.PixelHeight; |
||
4800 | }; |
||
4801 | } |
||
4802 | else |
||
4803 | { |
||
4804 | ViewerDataModel.Instance.ImageViewPath_C = pdfpath; |
||
4805 | ViewerDataModel.Instance.ImageViewWidth_C = pdfpath.PixelWidth; |
||
4806 | ViewerDataModel.Instance.ImageViewHeight_C = pdfpath.PixelHeight; |
||
4807 | |||
4808 | zoomAndPanCanvas2.Width = pdfpath.PixelWidth; |
||
4809 | zoomAndPanCanvas2.Height = pdfpath.PixelHeight; |
||
4810 | } |
||
4811 | } |
||
4812 | else |
||
4813 | { |
||
4814 | IsSyncPDFMode = false; |
||
4815 | 69f41aab | humkyung | string uri = this.GetImageURL(CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber); |
4816 | 787a4489 | KangIngu | |
4817 | var defaultBitmapImage_Compare = new BitmapImage(new Uri(uri)); |
||
4818 | |||
4819 | ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare; |
||
4820 | ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth; |
||
4821 | ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight; |
||
4822 | |||
4823 | if (defaultBitmapImage_Compare.IsDownloading) |
||
4824 | { |
||
4825 | defaultBitmapImage_Compare.DownloadCompleted += (ex, arg) => |
||
4826 | { |
||
4827 | ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare; |
||
4828 | ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth; |
||
4829 | ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight; |
||
4830 | }; |
||
4831 | } |
||
4832 | zoomAndPanControl2.ApplyTemplate(); |
||
4833 | zoomAndPanControl2.UpdateLayout(); |
||
4834 | zoomAndPanCanvas2.Width = Convert.ToDouble(Common.ViewerDataModel.Instance.ContentWidth); |
||
4835 | zoomAndPanCanvas2.Height = Convert.ToDouble(Common.ViewerDataModel.Instance.ContentHeight); |
||
4836 | } |
||
4837 | } |
||
4838 | |||
4839 | adce8360 | humkyung | /// <summary> |
4840 | /// Compare된 영역을 초기화 |
||
4841 | /// </summary> |
||
4842 | private void ClearCompareRect() |
||
4843 | { |
||
4844 | da.From = 1; |
||
4845 | da.To = 1; |
||
4846 | da.Duration = new Duration(TimeSpan.FromSeconds(9999)); |
||
4847 | da.AutoReverse = false; |
||
4848 | canvas_compareBorder.Children.Clear(); |
||
4849 | canvas_compareBorder.BeginAnimation(OpacityProperty, da); |
||
4850 | } |
||
4851 | |||
4852 | /// <summary> |
||
4853 | /// 문서 Comprare |
||
4854 | /// </summary> |
||
4855 | private void SetCompareRect() |
||
4856 | { |
||
4857 | if (CompareMode.IsChecked) |
||
4858 | { |
||
4859 | if (ViewerDataModel.Instance.PageBalanceMode && ViewerDataModel.Instance.PageBalanceNumber == 0) |
||
4860 | { |
||
4861 | ViewerDataModel.Instance.PageBalanceNumber = 1; |
||
4862 | } |
||
4863 | if (ViewerDataModel.Instance.PageNumber == 0) |
||
4864 | { |
||
4865 | ViewerDataModel.Instance.PageNumber = 1; |
||
4866 | } |
||
4867 | |||
4868 | Logger.sendReqLog("GetCompareRectAsync", _ViewInfo.ProjectNO + "," + _ViewInfo.DocumentItemID + "," + CurrentRev.DOCUMENT_ID + |
||
4869 | "," + pageNavigator.CurrentPage.PageNumber.ToString() + "," + ViewerDataModel.Instance.PageNumber.ToString() + "," + |
||
4870 | userData.COMPANY != "EXT" ? "true" : "false", 1); |
||
4871 | |||
4872 | BaseClient.GetCompareRectAsync(_ViewInfo.ProjectNO, _ViewInfo.DocumentItemID, CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber.ToString(), ViewerDataModel.Instance.PageNumber.ToString(), userData.COMPANY != "EXT" ? "true" : "false"); |
||
4873 | } |
||
4874 | else |
||
4875 | { |
||
4876 | ClearCompareRect(); |
||
4877 | } |
||
4878 | } |
||
4879 | |||
4880 | 787a4489 | KangIngu | private void RadButton_Click(object sender, RoutedEventArgs e) |
4881 | { |
||
4882 | gridViewHistory_Busy.IsBusy = true; |
||
4883 | |||
4884 | RadButton instance = sender as RadButton; |
||
4885 | if (instance.CommandParameter != null) |
||
4886 | { |
||
4887 | CurrentRev = instance.CommandParameter as VPRevision; |
||
4888 | adce8360 | humkyung | System.EventHandler<ServiceDeepView.GetSyncMarkupInfoItemsCompletedEventArgs> GetSyncMarkupInfoItemshandler = null; |
4889 | |||
4890 | GetSyncMarkupInfoItemshandler = (sen, ea) => |
||
4891 | 787a4489 | KangIngu | { |
4892 | if (ea.Error == null && ea.Result != null) |
||
4893 | { |
||
4894 | testPanel2.IsHidden = false; |
||
4895 | |||
4896 | d128ceb2 | humkyung | ViewerDataModel.Instance._markupInfoRevList.Clear(); |
4897 | foreach(var info in ea.Result) |
||
4898 | { |
||
4899 | if(info.UserID == App.ViewInfo.UserID) |
||
4900 | { |
||
4901 | info.userDelete = true; |
||
4902 | info.DisplayColor = "FFFF0000"; |
||
4903 | } |
||
4904 | else |
||
4905 | { |
||
4906 | info.userDelete = false; |
||
4907 | } |
||
4908 | ViewerDataModel.Instance._markupInfoRevList.Add(info); |
||
4909 | } |
||
4910 | 787a4489 | KangIngu | gridViewRevMarkup.ItemsSource = ViewerDataModel.Instance._markupInfoRevList; |
4911 | |||
4912 | 69f41aab | humkyung | string uri = this.GetImageURL(CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber); |
4913 | 787a4489 | KangIngu | |
4914 | Sync_Offset_Point = new Point(zoomAndPanControl.ContentOffsetX, zoomAndPanControl.ContentOffsetY); |
||
4915 | |||
4916 | adce8360 | humkyung | var defaultBitmapImage_Compare = ImageSourceHelper.GetDownloadImage(uri); |
4917 | ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare; |
||
4918 | ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth; |
||
4919 | ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight; |
||
4920 | zoomAndPanCanvas2.Width = defaultBitmapImage_Compare.PixelWidth; |
||
4921 | zoomAndPanCanvas2.Height = defaultBitmapImage_Compare.PixelHeight; |
||
4922 | 787a4489 | KangIngu | |
4923 | zoomAndPanControl2.ApplyTemplate(); |
||
4924 | zoomAndPanControl2.UpdateLayout(); |
||
4925 | if (Sync_Offset_Point != new Point(zoomAndPanControl.ContentOffsetX, zoomAndPanControl.ContentOffsetY)) |
||
4926 | { |
||
4927 | zoomAndPanControl.ContentOffsetX = Sync_Offset_Point.X; |
||
4928 | zoomAndPanControl.ContentOffsetY = Sync_Offset_Point.Y; |
||
4929 | } |
||
4930 | |||
4931 | 9cd2865b | KangIngu | ViewerDataModel.Instance.Sync_ContentOffsetX = Sync_Offset_Point.X; |
4932 | ViewerDataModel.Instance.Sync_ContentOffsetY = Sync_Offset_Point.Y; |
||
4933 | ViewerDataModel.Instance.Sync_ContentScale = zoomAndPanControl.ContentScale; |
||
4934 | |||
4935 | 787a4489 | KangIngu | tlSyncRev.Text = String.Format("Rev. {0}", CurrentRev.RevNo); |
4936 | tlSyncPageNum.Text = String.Format("Current Page : {0}", pageNavigator.CurrentPage.PageNumber); |
||
4937 | gridViewHistory_Busy.IsBusy = false; |
||
4938 | } |
||
4939 | 0f065e57 | ljiyeon | |
4940 | Logger.sendResLog("GetSyncMarkupInfoItemsCompleted", "UserState : " + ea.UserState + "\r Result :" + ea.Result + "\r Cancelled :" + ea.Cancelled + "\r Error :" + ea.Error, 1); |
||
4941 | adce8360 | humkyung | |
4942 | if (GetSyncMarkupInfoItemshandler != null) |
||
4943 | { |
||
4944 | BaseClient.GetSyncMarkupInfoItemsCompleted -= GetSyncMarkupInfoItemshandler; |
||
4945 | } |
||
4946 | |||
4947 | ClearCompareRect(); |
||
4948 | SetCompareRect(); |
||
4949 | 90e7968d | ljiyeon | }; |
4950 | adce8360 | humkyung | |
4951 | /// 중복 실행이 발생하여 수정함. |
||
4952 | BaseClient.GetSyncMarkupInfoItemsCompleted += GetSyncMarkupInfoItemshandler; |
||
4953 | 787a4489 | KangIngu | BaseClient.GetSyncMarkupInfoItemsAsync(_ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, _ViewInfo.UserID); |
4954 | adce8360 | humkyung | |
4955 | 0f065e57 | ljiyeon | Logger.sendReqLog("GetSyncMarkupInfoItemsAsync", _ViewInfo.ProjectNO + "," + CurrentRev.DOCUMENT_ID + "," + _ViewInfo.UserID, 1); |
4956 | 787a4489 | KangIngu | } |
4957 | } |
||
4958 | 4eb052e4 | ljiyeon | |
4959 | 94b7c12c | djkim | private void EnsembleLink_Button_Click(object sender, RoutedEventArgs e) |
4960 | { |
||
4961 | try |
||
4962 | { |
||
4963 | if (sender is RadButton) |
||
4964 | { |
||
4965 | if ((sender as RadButton).Tag != null) |
||
4966 | { |
||
4967 | var url = (sender as RadButton).Tag.ToString(); |
||
4968 | System.Diagnostics.Process.Start(url); |
||
4969 | } |
||
4970 | else |
||
4971 | { |
||
4972 | this.ParentOfType<MainWindow>().DialogMessage_Alert("Link 정보가 잘못 되었습니다", "안내"); |
||
4973 | } |
||
4974 | } |
||
4975 | } |
||
4976 | catch (Exception ex) |
||
4977 | { |
||
4978 | Logger.sendResLog("EnsembleLink_Button_Click", ex.Message, 0); |
||
4979 | } |
||
4980 | } |
||
4981 | 787a4489 | KangIngu | |
4982 | public void Sync_Event(VPRevision Currnet_Rev) |
||
4983 | { |
||
4984 | CurrentRev = Currnet_Rev; |
||
4985 | |||
4986 | BaseClient.GetSyncMarkupInfoItemsCompleted += (sen, ea) => |
||
4987 | { |
||
4988 | if (ea.Error == null && ea.Result != null) |
||
4989 | { |
||
4990 | testPanel2.IsHidden = false; |
||
4991 | |||
4992 | d128ceb2 | humkyung | ViewerDataModel.Instance._markupInfoRevList.Clear(); |
4993 | foreach(var info in ea.Result) |
||
4994 | { |
||
4995 | if(info.UserID == App.ViewInfo.UserID) |
||
4996 | { |
||
4997 | info.userDelete = true; |
||
4998 | info.DisplayColor = "FFFF0000"; |
||
4999 | } |
||
5000 | else |
||
5001 | { |
||
5002 | info.userDelete = false; |
||
5003 | } |
||
5004 | ViewerDataModel.Instance._markupInfoRevList.Add(info); |
||
5005 | } |
||
5006 | 787a4489 | KangIngu | gridViewRevMarkup.ItemsSource = ViewerDataModel.Instance._markupInfoRevList; |
5007 | |||
5008 | 69f41aab | humkyung | string uri = this.GetImageURL(CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber); |
5009 | 787a4489 | KangIngu | |
5010 | Sync_Offset_Point = new Point(zoomAndPanControl.ContentOffsetX, zoomAndPanControl.ContentOffsetY); |
||
5011 | |||
5012 | var defaultBitmapImage_Compare = new BitmapImage(new Uri(uri)); |
||
5013 | |||
5014 | ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare; |
||
5015 | ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth; |
||
5016 | ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight; |
||
5017 | |||
5018 | if (defaultBitmapImage_Compare.IsDownloading) |
||
5019 | { |
||
5020 | defaultBitmapImage_Compare.DownloadCompleted += (ex, arg) => |
||
5021 | { |
||
5022 | ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare; |
||
5023 | ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth; |
||
5024 | ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight; |
||
5025 | }; |
||
5026 | } |
||
5027 | 90e7968d | ljiyeon | |
5028 | |||
5029 | 787a4489 | KangIngu | zoomAndPanCanvas2.Width = Convert.ToDouble(Common.ViewerDataModel.Instance.ContentWidth); |
5030 | zoomAndPanCanvas2.Height = Convert.ToDouble(Common.ViewerDataModel.Instance.ContentHeight); |
||
5031 | zoomAndPanControl2.ApplyTemplate(); |
||
5032 | zoomAndPanControl2.UpdateLayout(); |
||
5033 | |||
5034 | if (Sync_Offset_Point != new Point(zoomAndPanControl.ContentOffsetX, zoomAndPanControl.ContentOffsetY)) |
||
5035 | { |
||
5036 | zoomAndPanControl.ContentOffsetX = Sync_Offset_Point.X; |
||
5037 | zoomAndPanControl.ContentOffsetY = Sync_Offset_Point.Y; |
||
5038 | } |
||
5039 | //} |
||
5040 | |||
5041 | tlSyncRev.Text = String.Format("Rev. {0}", CurrentRev.RevNo); |
||
5042 | tlSyncPageNum.Text = String.Format("Current Page : {0}", pageNavigator.CurrentPage.PageNumber); |
||
5043 | 90e7968d | ljiyeon | gridViewHistory_Busy.IsBusy = false; |
5044 | 787a4489 | KangIngu | } |
5045 | 0f065e57 | ljiyeon | Logger.sendResLog("GetSyncMarkupInfoItemsCompleted", "UserState : " + ea.UserState + "\r Result :" + ea.Result + "\r Cancelled :" + ea.Cancelled + "\r Error :" + ea.Error, 1); |
5046 | 90e7968d | ljiyeon | |
5047 | 787a4489 | KangIngu | }; |
5048 | 0f065e57 | ljiyeon | Logger.sendReqLog("GetSyncMarkupInfoItemsAsync", _ViewInfo.ProjectNO + "," + CurrentRev.DOCUMENT_ID + "," + _ViewInfo.UserID, 1); |
5049 | 90e7968d | ljiyeon | BaseClient.GetSyncMarkupInfoItemsAsync(_ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, _ViewInfo.UserID); |
5050 | 787a4489 | KangIngu | } |
5051 | |||
5052 | private void PdfLink_ButtonDown(object sender, MouseButtonEventArgs e) |
||
5053 | { |
||
5054 | if (sender is Image) |
||
5055 | { |
||
5056 | if ((sender as Image).Tag != null) |
||
5057 | { |
||
5058 | var pdfUrl = (sender as Image).Tag.ToString(); |
||
5059 | System.Diagnostics.Process.Start(pdfUrl); |
||
5060 | } |
||
5061 | else |
||
5062 | { |
||
5063 | this.ParentOfType<MainWindow>().DialogMessage_Alert("문서 정보가 잘못 되었습니다", "안내"); |
||
5064 | } |
||
5065 | } |
||
5066 | } |
||
5067 | |||
5068 | private void Create_Symbol(object sender, RoutedEventArgs e) |
||
5069 | { |
||
5070 | 5529d2a2 | humkyung | MarkupToPDF.Controls.Parsing.MarkupParser.MarkupReturn markupReturn = new MarkupToPDF.Controls.Parsing.MarkupParser.MarkupReturn(); |
5071 | 787a4489 | KangIngu | |
5072 | if (SelectLayer.Children.Count < 1) //선택된 것이 없으면 |
||
5073 | { |
||
5074 | DialogMessage_Alert("Please Select Controls", "Alert"); |
||
5075 | } |
||
5076 | else //선택된 것이 있으면 |
||
5077 | { |
||
5078 | string MarkupData = ""; |
||
5079 | adorner_ = new AdornerFinal(); |
||
5080 | |||
5081 | foreach (var item in SelectLayer.Children) |
||
5082 | { |
||
5083 | if (item.GetType().Name == "AdornerFinal") |
||
5084 | { |
||
5085 | adorner_ = (item as Controls.AdornerFinal); |
||
5086 | 4913851c | humkyung | foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>()) |
5087 | 787a4489 | KangIngu | { |
5088 | if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData)) |
||
5089 | { |
||
5090 | 5529d2a2 | humkyung | markupReturn = MarkupParser.MarkupToString(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo, App.ViewInfo.UserID); |
5091 | 787a4489 | KangIngu | MarkupData += markupReturn.ConvertData; |
5092 | } |
||
5093 | } |
||
5094 | } |
||
5095 | } |
||
5096 | DialogParameters parameters = new DialogParameters() |
||
5097 | { |
||
5098 | b9b01f8e | ljiyeon | Owner = Application.Current.MainWindow, |
5099 | 787a4489 | KangIngu | Closed = (obj, args) => this.MarkupNamePromptClose(MarkupData, args), |
5100 | DefaultPromptResultValue = "Custom State", |
||
5101 | Content = "Name :", |
||
5102 | Header = "Insert Custom Symbol Name", |
||
5103 | Theme = new VisualStudio2013Theme(), |
||
5104 | ModalBackground = new SolidColorBrush { Color = Colors.Black, Opacity = 0.6 }, |
||
5105 | }; |
||
5106 | RadWindow.Prompt(parameters); |
||
5107 | } |
||
5108 | |||
5109 | } |
||
5110 | 53880c83 | ljiyeon | public int symbolselectindex = 0; |
5111 | private void SymbolMarkupNamePromptClose(byte[] Img_byte, string data, WindowClosedEventArgs args) |
||
5112 | { |
||
5113 | //Save save = new Save(); |
||
5114 | try |
||
5115 | { |
||
5116 | string svgfilename = null; |
||
5117 | if (symbolname != null) |
||
5118 | { |
||
5119 | if (symbolpng == true || symbolsvg == true) |
||
5120 | { |
||
5121 | kr.co.devdoftech.cloud.FileUpload fileUploader = new kr.co.devdoftech.cloud.FileUpload(); |
||
5122 | 24678e06 | humkyung | string guid = Commons.shortGuid(); |
5123 | 53880c83 | ljiyeon | |
5124 | fileUploader.RunAsync(App.ViewInfo.ProjectNO, _DocItem.DOCUMENT_NO, App.ViewInfo.UserID, guid + ".png", Img_byte); |
||
5125 | c73426a9 | ljiyeon | //Check_Uri.UriCheck(); |
5126 | 53880c83 | ljiyeon | fileUploader.RunCompleted += (ex, arg) => |
5127 | { |
||
5128 | filename = arg.Result; |
||
5129 | if (symbolpng == true) |
||
5130 | { |
||
5131 | if (filename != null) |
||
5132 | { |
||
5133 | if (symbolselectindex == 0) |
||
5134 | { |
||
5135 | SymbolSave(symbolname, filename, data); |
||
5136 | } |
||
5137 | else |
||
5138 | { |
||
5139 | SymbolSave_Public(symbolname, filename, data, ViewerDataModel.Instance.SystemMain.dzMainMenu.userData.DEPARTMENT); |
||
5140 | } |
||
5141 | DataBind(); |
||
5142 | } |
||
5143 | } |
||
5144 | |||
5145 | if (symbolsvg == true) |
||
5146 | { |
||
5147 | c73426a9 | ljiyeon | try |
5148 | 53880c83 | ljiyeon | { |
5149 | c73426a9 | ljiyeon | var defaultBitmapImage = new BitmapImage(); |
5150 | defaultBitmapImage.BeginInit(); |
||
5151 | defaultBitmapImage.CreateOptions = BitmapCreateOptions.IgnoreImageCache; |
||
5152 | defaultBitmapImage.CacheOption = BitmapCacheOption.OnLoad; |
||
5153 | Check_Uri.UriCheck(filename); |
||
5154 | defaultBitmapImage.UriSource = new Uri(filename); |
||
5155 | defaultBitmapImage.EndInit(); |
||
5156 | 53880c83 | ljiyeon | |
5157 | c73426a9 | ljiyeon | System.Drawing.Bitmap image; |
5158 | 53880c83 | ljiyeon | |
5159 | c73426a9 | ljiyeon | if (defaultBitmapImage.IsDownloading) |
5160 | { |
||
5161 | defaultBitmapImage.DownloadCompleted += (ex2, arg2) => |
||
5162 | 53880c83 | ljiyeon | { |
5163 | c73426a9 | ljiyeon | defaultBitmapImage.Freeze(); |
5164 | image = GetBitmap(defaultBitmapImage); |
||
5165 | image.Save(@AppDomain.CurrentDomain.BaseDirectory + "potrace.bmp", System.Drawing.Imaging.ImageFormat.Bmp); |
||
5166 | Process potrace = new Process |
||
5167 | 53880c83 | ljiyeon | { |
5168 | c73426a9 | ljiyeon | StartInfo = new ProcessStartInfo |
5169 | { |
||
5170 | FileName = @AppDomain.CurrentDomain.BaseDirectory + "potrace.exe", |
||
5171 | Arguments = "-b svg " + @AppDomain.CurrentDomain.BaseDirectory + "potrace.bmp", |
||
5172 | RedirectStandardInput = true, |
||
5173 | RedirectStandardOutput = true, |
||
5174 | RedirectStandardError = true, |
||
5175 | UseShellExecute = false, |
||
5176 | CreateNoWindow = true, |
||
5177 | WindowStyle = ProcessWindowStyle.Hidden |
||
5178 | }, |
||
5179 | }; |
||
5180 | 53880c83 | ljiyeon | |
5181 | c73426a9 | ljiyeon | StringBuilder svgBuilder = new StringBuilder(); |
5182 | potrace.OutputDataReceived += (object sender2, DataReceivedEventArgs e2) => |
||
5183 | 53880c83 | ljiyeon | { |
5184 | c73426a9 | ljiyeon | svgBuilder.AppendLine(e2.Data); |
5185 | }; |
||
5186 | |||
5187 | potrace.EnableRaisingEvents = true; |
||
5188 | potrace.Start(); |
||
5189 | potrace.Exited += (sender, e) => |
||
5190 | 53880c83 | ljiyeon | { |
5191 | c73426a9 | ljiyeon | byte[] bytes = System.IO.File.ReadAllBytes(@AppDomain.CurrentDomain.BaseDirectory + "potrace.svg"); |
5192 | svgfilename = fileUploader.Run(App.ViewInfo.ProjectNO, _DocItem.DOCUMENT_NO, App.ViewInfo.UserID, guid + ".svg", bytes); |
||
5193 | Check_Uri.UriCheck(svgfilename); |
||
5194 | if (symbolselectindex == 0) |
||
5195 | { |
||
5196 | SymbolSave(symbolname, svgfilename, data); |
||
5197 | } |
||
5198 | else |
||
5199 | { |
||
5200 | SymbolSave_Public(symbolname, svgfilename, data, ViewerDataModel.Instance.SystemMain.dzMainMenu.userData.DEPARTMENT); |
||
5201 | } |
||
5202 | 53880c83 | ljiyeon | |
5203 | c73426a9 | ljiyeon | DataBind(); |
5204 | }; |
||
5205 | potrace.WaitForExit(); |
||
5206 | 53880c83 | ljiyeon | }; |
5207 | c73426a9 | ljiyeon | } |
5208 | else |
||
5209 | { |
||
5210 | //GC.Collect(); |
||
5211 | } |
||
5212 | 53880c83 | ljiyeon | } |
5213 | c73426a9 | ljiyeon | catch(Exception ee) |
5214 | 90e7968d | ljiyeon | { |
5215 | c73426a9 | ljiyeon | DialogMessage_Alert("" + ee, "Alert"); |
5216 | 90e7968d | ljiyeon | } |
5217 | 53880c83 | ljiyeon | } |
5218 | }; |
||
5219 | } |
||
5220 | } |
||
5221 | } |
||
5222 | catch (Exception e) |
||
5223 | { |
||
5224 | //DialogMessage_Alert(e + "", "Alert"); |
||
5225 | } |
||
5226 | } |
||
5227 | |||
5228 | public void SymbolSave(string Name, string Url, string Data) |
||
5229 | { |
||
5230 | try |
||
5231 | { |
||
5232 | SYMBOL_PRIVATE symbol_private = new SYMBOL_PRIVATE |
||
5233 | { |
||
5234 | 24678e06 | humkyung | ID = Commons.shortGuid(), |
5235 | 53880c83 | ljiyeon | MEMBER_USER_ID = App.ViewInfo.UserID, |
5236 | NAME = Name, |
||
5237 | IMAGE_URL = Url, |
||
5238 | DATA = Data |
||
5239 | }; |
||
5240 | |||
5241 | Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.SaveSymbolCompleted += BaseClient_SaveSymbolCompleted; |
||
5242 | Logger.sendReqLog("SaveSymbolAsync: ", symbol_private.ID + "," + symbol_private.MEMBER_USER_ID + "," + symbol_private.NAME + "," + symbol_private.IMAGE_URL + "," + symbol_private.DATA, 1); |
||
5243 | Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.SaveSymbolAsync(symbol_private); |
||
5244 | } |
||
5245 | catch (Exception) |
||
5246 | { |
||
5247 | throw; |
||
5248 | } |
||
5249 | } |
||
5250 | |||
5251 | public void SymbolSave_Public(string Name, string Url, string Data, string Department) |
||
5252 | { |
||
5253 | try |
||
5254 | { |
||
5255 | SYMBOL_PUBLIC symbol_public = new SYMBOL_PUBLIC |
||
5256 | { |
||
5257 | 24678e06 | humkyung | ID = Commons.shortGuid(), |
5258 | 53880c83 | ljiyeon | DEPARTMENT = Department, |
5259 | NAME = Name, |
||
5260 | IMAGE_URL = Url, |
||
5261 | DATA = Data |
||
5262 | }; |
||
5263 | Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.AddPublicSymbolCompleted += BaseClient_AddPublicSymbolCompleted; |
||
5264 | Logger.sendReqLog("AddPublicSymbol: ", symbol_public.ID + "," + symbol_public.DEPARTMENT + "," + symbol_public.NAME + "," + symbol_public.IMAGE_URL + "," + symbol_public.DATA, 1); |
||
5265 | Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.AddPublicSymbol(symbol_public); |
||
5266 | } |
||
5267 | catch (Exception) |
||
5268 | { |
||
5269 | throw; |
||
5270 | } |
||
5271 | } |
||
5272 | |||
5273 | private void BaseClient_AddPublicSymbolCompleted(object sender, ServiceDeepView.AddPublicSymbolCompletedEventArgs e) |
||
5274 | { |
||
5275 | Logger.sendResLog("AddPublicSymbolCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1); |
||
5276 | DataBind(); |
||
5277 | } |
||
5278 | |||
5279 | private void BaseClient_SaveSymbolCompleted(object sender, ServiceDeepView.SaveSymbolCompletedEventArgs e) |
||
5280 | { |
||
5281 | Logger.sendResLog("RenameSymbolCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1); |
||
5282 | DataBind(); |
||
5283 | } |
||
5284 | private void DataBind() |
||
5285 | { |
||
5286 | try |
||
5287 | { |
||
5288 | Symbol_Custom Custom = new Symbol_Custom(); |
||
5289 | List<Symbol_Custom> Custom_List = new List<Symbol_Custom>(); |
||
5290 | 5928384e | djkim | |
5291 | bb3a236d | ljiyeon | var symbol_Private = BaseClient.GetSymbolList(App.ViewInfo.UserID); |
5292 | 53880c83 | ljiyeon | foreach (var item in symbol_Private) |
5293 | { |
||
5294 | Custom.Name = item.NAME; |
||
5295 | Custom.ImageUri = item.IMAGE_URL; |
||
5296 | Custom.ID = item.ID; |
||
5297 | Custom_List.Add(Custom); |
||
5298 | Custom = new Symbol_Custom(); |
||
5299 | } |
||
5300 | symbolPanel_Instance.lstSymbolPrivate.ItemsSource = Custom_List; |
||
5301 | |||
5302 | Custom = new Symbol_Custom(); |
||
5303 | Custom_List = new List<Symbol_Custom>(); |
||
5304 | |||
5305 | bb3a236d | ljiyeon | symbolPanel_Instance.deptlist.ItemsSource = BaseClient.GetPublicSymbolDeptList(); |
5306 | 53880c83 | ljiyeon | |
5307 | List<SYMBOL_PUBLIC> symbol_Public; |
||
5308 | 787a4489 | KangIngu | |
5309 | 53880c83 | ljiyeon | if (symbolPanel_Instance.deptlist.SelectedValue != null) |
5310 | { |
||
5311 | bb3a236d | ljiyeon | symbol_Public = BaseClient.GetPublicSymbolList(symbolPanel_Instance.deptlist.SelectedValue.ToString()); |
5312 | 53880c83 | ljiyeon | } |
5313 | else |
||
5314 | { |
||
5315 | bb3a236d | ljiyeon | symbol_Public = BaseClient.GetPublicSymbolList(null); |
5316 | 53880c83 | ljiyeon | } |
5317 | foreach (var item in symbol_Public) |
||
5318 | { |
||
5319 | Custom.Name = item.NAME; |
||
5320 | Custom.ImageUri = item.IMAGE_URL; |
||
5321 | Custom.ID = item.ID; |
||
5322 | Custom_List.Add(Custom); |
||
5323 | Custom = new Symbol_Custom(); |
||
5324 | } |
||
5325 | symbolPanel_Instance.lstSymbolPublic.ItemsSource = Custom_List; |
||
5326 | bb3a236d | ljiyeon | BaseClient.Close(); |
5327 | 53880c83 | ljiyeon | } |
5328 | catch(Exception e) |
||
5329 | { |
||
5330 | //DialogMessage_Alert("DataBind", "Alert"); |
||
5331 | } |
||
5332 | |||
5333 | } |
||
5334 | ac4f1e13 | taeseongkim | private async void MarkupNamePromptClose(string data, WindowClosedEventArgs args) |
5335 | 787a4489 | KangIngu | { |
5336 | c73426a9 | ljiyeon | try |
5337 | 787a4489 | KangIngu | { |
5338 | c73426a9 | ljiyeon | if (args.PromptResult != null) |
5339 | 53880c83 | ljiyeon | { |
5340 | c73426a9 | ljiyeon | if (args.DialogResult.Value) |
5341 | { |
||
5342 | ac4f1e13 | taeseongkim | PngBitmapEncoder _Encoder = await symImageAsync(data); |
5343 | 787a4489 | KangIngu | |
5344 | c73426a9 | ljiyeon | System.IO.MemoryStream fs = new System.IO.MemoryStream(); |
5345 | _Encoder.Save(fs); |
||
5346 | System.Drawing.Image ImgOut = System.Drawing.Image.FromStream(fs); |
||
5347 | 787a4489 | KangIngu | |
5348 | c73426a9 | ljiyeon | byte[] Img_byte = fs.ToArray(); |
5349 | 787a4489 | KangIngu | |
5350 | c73426a9 | ljiyeon | kr.co.devdoftech.cloud.FileUpload fileUploader = new kr.co.devdoftech.cloud.FileUpload(); |
5351 | 24678e06 | humkyung | filename = fileUploader.Run(App.ViewInfo.ProjectNO, _DocItem.DOCUMENT_NO, App.ViewInfo.UserID, Commons.shortGuid() + ".png", Img_byte); |
5352 | c73426a9 | ljiyeon | Check_Uri.UriCheck(filename); |
5353 | if (symbolPanel_Instance.RadTab.SelectedIndex == 0) |
||
5354 | { |
||
5355 | de6499db | humkyung | SaveCommand.Instance.SymbolSave(args.PromptResult, filename, data); |
5356 | c73426a9 | ljiyeon | } |
5357 | else |
||
5358 | { |
||
5359 | de6499db | humkyung | SaveCommand.Instance.SymbolSave_Public(args.PromptResult, filename, data, ViewerDataModel.Instance.SystemMain.dzMainMenu.userData.DEPARTMENT); |
5360 | c73426a9 | ljiyeon | } |
5361 | DataBind(); |
||
5362 | 53880c83 | ljiyeon | } |
5363 | } |
||
5364 | 787a4489 | KangIngu | } |
5365 | c73426a9 | ljiyeon | catch(Exception ex) |
5366 | { |
||
5367 | DialogMessage_Alert("" + ex, "Alert"); |
||
5368 | } |
||
5369 | 787a4489 | KangIngu | } |
5370 | |||
5371 | ac4f1e13 | taeseongkim | public async Task<PngBitmapEncoder> symImageAsync(string data) |
5372 | 787a4489 | KangIngu | { |
5373 | |||
5374 | Canvas _canvas = new Canvas(); |
||
5375 | _canvas.Background = Brushes.White; |
||
5376 | _canvas.Width = adorner_.BorderSize.Width; |
||
5377 | _canvas.Height = adorner_.BorderSize.Height; |
||
5378 | ac4f1e13 | taeseongkim | await MarkupParser.ParseAsync(App.ViewInfo.ProjectNO, data, _canvas, "#FFFF0000", ""); |
5379 | 787a4489 | KangIngu | |
5380 | BitmapEncoder encoder = new PngBitmapEncoder(); |
||
5381 | |||
5382 | |||
5383 | RenderTargetBitmap renderBitmap = new RenderTargetBitmap((int)_canvas.Width + 50, (int)_canvas.Height + 50, 96d, 96d, PixelFormats.Pbgra32); |
||
5384 | |||
5385 | DrawingVisual dv = new DrawingVisual(); |
||
5386 | |||
5387 | _canvas.Measure(new System.Windows.Size(adorner_.BorderSize.Width + 50, adorner_.BorderSize.Height + 50)); |
||
5388 | _canvas.Arrange(new Rect(new System.Windows.Point { X = -adorner_.BorderSize.X - 20, Y = -adorner_.BorderSize.Y - 20 }, new Point(adorner_.BorderSize.Width + 20, adorner_.BorderSize.Height + 20))); |
||
5389 | |||
5390 | using (DrawingContext ctx = dv.RenderOpen()) |
||
5391 | { |
||
5392 | VisualBrush vb = new VisualBrush(_canvas); |
||
5393 | ctx.DrawRectangle(vb, null, new Rect(new System.Windows.Point { X = -adorner_.BorderSize.X, Y = -adorner_.BorderSize.Y }, new Point(adorner_.BorderSize.Width + 20, adorner_.BorderSize.Height + 20))); |
||
5394 | } |
||
5395 | |||
5396 | try |
||
5397 | { |
||
5398 | renderBitmap.Render(dv); |
||
5399 | |||
5400 | 90e7968d | ljiyeon | //GC.Collect(); |
5401 | 787a4489 | KangIngu | GC.WaitForPendingFinalizers(); |
5402 | 90e7968d | ljiyeon | //GC.Collect(); |
5403 | 787a4489 | KangIngu | // encode png data |
5404 | PngBitmapEncoder pngEncoder = new PngBitmapEncoder(); |
||
5405 | // puch rendered bitmap into it |
||
5406 | pngEncoder.Interlace = PngInterlaceOption.Off; |
||
5407 | pngEncoder.Frames.Add(BitmapFrame.Create(renderBitmap)); |
||
5408 | return pngEncoder; |
||
5409 | |||
5410 | } |
||
5411 | 53880c83 | ljiyeon | catch //(Exception ex) |
5412 | 787a4489 | KangIngu | { |
5413 | return null; |
||
5414 | } |
||
5415 | |||
5416 | } |
||
5417 | |||
5418 | public void DialogMessage_Alert(string content, string header) |
||
5419 | { |
||
5420 | DialogParameters parameters = new DialogParameters() |
||
5421 | { |
||
5422 | 4279e717 | djkim | Owner = this.ParentOfType<MainWindow>(), |
5423 | 0d32593b | ljiyeon | Content = new TextBlock() |
5424 | { |
||
5425 | MinWidth = 400, |
||
5426 | FontSize = 11, |
||
5427 | Text = content, |
||
5428 | TextWrapping = System.Windows.TextWrapping.Wrap |
||
5429 | }, |
||
5430 | b79f786f | 송근호 | DialogStartupLocation = WindowStartupLocation.CenterOwner, |
5431 | 787a4489 | KangIngu | Header = header, |
5432 | Theme = new VisualStudio2013Theme(), |
||
5433 | ModalBackground = new SolidColorBrush { Color = Colors.Black, Opacity = 0.6 }, |
||
5434 | 90e7968d | ljiyeon | }; |
5435 | 787a4489 | KangIngu | RadWindow.Alert(parameters); |
5436 | } |
||
5437 | |||
5438 | 84605c0c | taeseongkim | #region 캡쳐 기능 |
5439 | 787a4489 | KangIngu | |
5440 | public BitmapSource CutAreaToImage(int x, int y, int width, int height) |
||
5441 | { |
||
5442 | if (x < 0) |
||
5443 | { |
||
5444 | width += x; |
||
5445 | x = 0; |
||
5446 | } |
||
5447 | if (y < 0) |
||
5448 | { |
||
5449 | height += y; |
||
5450 | y = 0; |
||
5451 | |||
5452 | width = (int)zoomAndPanCanvas.ActualWidth - x; |
||
5453 | } |
||
5454 | if (x + width > zoomAndPanCanvas.ActualWidth) |
||
5455 | { |
||
5456 | width = (int)zoomAndPanCanvas.ActualWidth - x; |
||
5457 | } |
||
5458 | if (y + height > zoomAndPanCanvas.ActualHeight) |
||
5459 | { |
||
5460 | height = (int)zoomAndPanCanvas.ActualHeight - y; |
||
5461 | } |
||
5462 | |||
5463 | byte[] pixels = CopyPixels(x, y, width, height); |
||
5464 | |||
5465 | int stride = (width * canvasImage.Format.BitsPerPixel + 7) / 8; |
||
5466 | |||
5467 | return BitmapSource.Create(width, height, 96, 96, PixelFormats.Pbgra32, null, pixels, stride); |
||
5468 | } |
||
5469 | |||
5470 | public byte[] CopyPixels(int x, int y, int width, int height) |
||
5471 | { |
||
5472 | byte[] pixels = new byte[width * height * 4]; |
||
5473 | int stride = (width * canvasImage.Format.BitsPerPixel + 7) / 8; |
||
5474 | |||
5475 | // Canvas 이미지에서 객체 역역만큼 픽셀로 복사 |
||
5476 | canvasImage.CopyPixels(new Int32Rect(x, y, width, height), pixels, stride, 0); |
||
5477 | |||
5478 | return pixels; |
||
5479 | } |
||
5480 | |||
5481 | public RenderTargetBitmap ConverterBitmapImage(FrameworkElement element) |
||
5482 | { |
||
5483 | DrawingVisual drawingVisual = new DrawingVisual(); |
||
5484 | DrawingContext drawingContext = drawingVisual.RenderOpen(); |
||
5485 | |||
5486 | // 해당 객체의 그래픽요소로 사각형의 그림을 그립니다. |
||
5487 | drawingContext.DrawRectangle(new VisualBrush(element), null, |
||
5488 | new Rect(new Point(0, 0), new Point(element.ActualWidth, element.ActualHeight))); |
||
5489 | drawingContext.Close(); |
||
5490 | |||
5491 | // 비트맵으로 변환합니다. |
||
5492 | RenderTargetBitmap target = |
||
5493 | new RenderTargetBitmap((int)element.ActualWidth, (int)element.ActualHeight, |
||
5494 | 96, 96, System.Windows.Media.PixelFormats.Pbgra32); |
||
5495 | |||
5496 | target.Render(drawingVisual); |
||
5497 | return target; |
||
5498 | } |
||
5499 | |||
5500 | 53880c83 | ljiyeon | System.Drawing.Bitmap GetBitmap(BitmapSource source) |
5501 | { |
||
5502 | System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(source.PixelWidth, source.PixelHeight, System.Drawing.Imaging.PixelFormat.Format32bppPArgb); |
||
5503 | System.Drawing.Imaging.BitmapData data = bmp.LockBits(new System.Drawing.Rectangle(System.Drawing.Point.Empty, bmp.Size), System.Drawing.Imaging.ImageLockMode.WriteOnly, System.Drawing.Imaging.PixelFormat.Format32bppPArgb); |
||
5504 | source.CopyPixels(Int32Rect.Empty, data.Scan0, data.Height * data.Stride, data.Stride); |
||
5505 | bmp.UnlockBits(data); |
||
5506 | return bmp; |
||
5507 | } |
||
5508 | public string symbolname = null; |
||
5509 | public bool symbolsvg = true; |
||
5510 | public bool symbolpng = true; |
||
5511 | |||
5512 | public void Save_Symbol_Capture(BitmapSource source, int x, int y, int width, int height) |
||
5513 | { |
||
5514 | System.Drawing.Bitmap image = GetBitmap(source); |
||
5515 | //흰색 제거 |
||
5516 | //image.MakeTransparent(System.Drawing.Color.White); |
||
5517 | |||
5518 | var imageStream = new System.IO.MemoryStream(); |
||
5519 | byte[] imageBytes = null; |
||
5520 | using (imageStream) |
||
5521 | { |
||
5522 | image.Save(imageStream, System.Drawing.Imaging.ImageFormat.Png); |
||
5523 | // test.Save(@"E:\test.png", System.Drawing.Imaging.ImageFormat.Png); |
||
5524 | imageStream.Position = 0; |
||
5525 | imageBytes = imageStream.ToArray(); |
||
5526 | } |
||
5527 | |||
5528 | SymbolPrompt symbolPrompt = new SymbolPrompt(); |
||
5529 | |||
5530 | RadWindow CheckPop = new RadWindow(); |
||
5531 | //Alert check = new Alert(Msg); |
||
5532 | |||
5533 | CheckPop = new RadWindow |
||
5534 | { |
||
5535 | MinWidth = 400, |
||
5536 | MinHeight = 100, |
||
5537 | // Closed = (obj, args) => this.SymbolMarkupNamePromptClose(imageBytes, "", args), |
||
5538 | Header = "Alert", |
||
5539 | Content = symbolPrompt, |
||
5540 | //DialogResult = |
||
5541 | ResizeMode = System.Windows.ResizeMode.NoResize, |
||
5542 | WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen, |
||
5543 | IsTopmost = true, |
||
5544 | }; |
||
5545 | CheckPop.Closed += (obj, args) => this.SymbolMarkupNamePromptClose(imageBytes, "", args); |
||
5546 | StyleManager.SetTheme(CheckPop, new Office2013Theme()); |
||
5547 | CheckPop.ShowDialog(); |
||
5548 | |||
5549 | /* |
||
5550 | DialogParameters parameters = new DialogParameters() |
||
5551 | { |
||
5552 | Owner = Application.Current.MainWindow, |
||
5553 | Closed = (obj, args) => this.SymbolMarkupNamePromptClose(imageBytes, "", args), |
||
5554 | DefaultPromptResultValue = "Custom State", |
||
5555 | Content = "Name :", |
||
5556 | Header = "Insert Custom Symbol Name", |
||
5557 | Theme = new VisualStudio2013Theme(), |
||
5558 | ModalBackground = new SolidColorBrush { Color = Colors.Black, Opacity = 0.6 }, |
||
5559 | }; |
||
5560 | RadWindow.Prompt(parameters); |
||
5561 | */ |
||
5562 | } |
||
5563 | |||
5564 | 787a4489 | KangIngu | public void Save_Capture(BitmapSource source, int x, int y, int width, int height) |
5565 | { |
||
5566 | KCOM.Common.Converter.FileStreamToBase64 streamToBase64 = new Common.Converter.FileStreamToBase64(); |
||
5567 | KCOMDataModel.DataModel.CHECK_LIST check_; |
||
5568 | string Result = streamToBase64.ImageToBase64(source); |
||
5569 | KCOMDataModel.DataModel.CHECK_LIST Item = new KCOMDataModel.DataModel.CHECK_LIST(); |
||
5570 | 6c781c0c | djkim | string projectno = App.ViewInfo.ProjectNO; |
5571 | string checklist_id = ViewerDataModel.Instance.CheckList_ID; |
||
5572 | 0f065e57 | ljiyeon | |
5573 | Logger.sendReqLog("GetCheckList", projectno + "," + checklist_id, 1); |
||
5574 | 6c781c0c | djkim | Item = this.BaseClient.GetCheckList(projectno, checklist_id); |
5575 | 90e7968d | ljiyeon | if (Item != null) |
5576 | 0f065e57 | ljiyeon | { |
5577 | Logger.sendResLog("GetCheckList", "TRUE", 1); |
||
5578 | } |
||
5579 | else |
||
5580 | { |
||
5581 | Logger.sendResLog("GetCheckList", "FALSE", 1); |
||
5582 | } |
||
5583 | 90e7968d | ljiyeon | |
5584 | 6c781c0c | djkim | if (Item == null) |
5585 | 787a4489 | KangIngu | { |
5586 | 6c781c0c | djkim | check_ = new KCOMDataModel.DataModel.CHECK_LIST |
5587 | 787a4489 | KangIngu | { |
5588 | 24678e06 | humkyung | ID = Commons.shortGuid(), |
5589 | 6c781c0c | djkim | USER_ID = App.ViewInfo.UserID, |
5590 | IMAGE_URL = Result, |
||
5591 | IMAGE_ANCHOR = x + "," + y + "," + width + "," + height, |
||
5592 | PAGENUMBER = this.pageNavigator.CurrentPage.PageNumber, |
||
5593 | REVISION = ViewerDataModel.Instance.SystemMain.dzMainMenu.CurrentDoc.Revision, |
||
5594 | DOCUMENT_ID = App.ViewInfo.DocumentItemID, |
||
5595 | PROJECT_NO = App.ViewInfo.ProjectNO, |
||
5596 | STATUS = "False", |
||
5597 | CREATE_TIME = DateTime.Now, |
||
5598 | UPDATE_TIME = DateTime.Now, |
||
5599 | DOCUMENT_NO = _DocItem.DOCUMENT_NO, |
||
5600 | STATUS_DESC_OPEN = "Vendor 반영 필요", |
||
5601 | }; |
||
5602 | 0f065e57 | ljiyeon | Logger.sendReqLog("AddCheckList", projectno + "," + check_, 1); |
5603 | Logger.sendResLog("AddCheckList", this.BaseClient.AddCheckList(projectno, check_).ToString(), 1); |
||
5604 | //this.BaseClient.AddCheckList(projectno, check_); |
||
5605 | 787a4489 | KangIngu | } |
5606 | 6c781c0c | djkim | else |
5607 | { |
||
5608 | Item.IMAGE_URL = Result; |
||
5609 | Item.IMAGE_ANCHOR = x + "," + y + "," + width + "," + height; |
||
5610 | 90e7968d | ljiyeon | Item.PAGENUMBER = this.pageNavigator.CurrentPage.PageNumber; |
5611 | 0f065e57 | ljiyeon | Logger.sendReqLog("SaveCheckList", projectno + "," + checklist_id + "," + Item, 1); |
5612 | Logger.sendResLog("SaveCheckList", this.BaseClient.SaveCheckList(projectno, checklist_id, Item).ToString(), 1); |
||
5613 | //this.BaseClient.SaveCheckList(projectno, checklist_id, Item); |
||
5614 | 6c781c0c | djkim | } |
5615 | 90e7968d | ljiyeon | |
5616 | 787a4489 | KangIngu | } |
5617 | |||
5618 | public void Set_Capture() |
||
5619 | 90e7968d | ljiyeon | { |
5620 | c7fde400 | taeseongkim | double x = CanvasDrawingMouseDownPoint.X; |
5621 | double y = CanvasDrawingMouseDownPoint.Y; |
||
5622 | 787a4489 | KangIngu | double width = dragCaptureBorder.Width; |
5623 | double height = dragCaptureBorder.Height; |
||
5624 | |||
5625 | if (width > 5 || height > 5) |
||
5626 | { |
||
5627 | canvasImage = ConverterBitmapImage(zoomAndPanCanvas); |
||
5628 | BitmapSource source = CutAreaToImage((int)x, (int)y, (int)width, (int)height); |
||
5629 | Save_Capture(source, (int)x, (int)y, (int)width, (int)height); |
||
5630 | } |
||
5631 | } |
||
5632 | 84605c0c | taeseongkim | #endregion |
5633 | 787a4489 | KangIngu | |
5634 | public Multi_Undo_data Control_Style(CommentUserInfo control) |
||
5635 | { |
||
5636 | multi_Undo_Data = new Multi_Undo_data(); |
||
5637 | |||
5638 | multi_Undo_Data.Markup = control; |
||
5639 | |||
5640 | if ((control as IShapeControl) != null) |
||
5641 | { |
||
5642 | multi_Undo_Data.paint = (control as IShapeControl).Paint; |
||
5643 | } |
||
5644 | if ((control as IDashControl) != null) |
||
5645 | { |
||
5646 | multi_Undo_Data.DashSize = (control as IDashControl).DashSize; |
||
5647 | } |
||
5648 | if ((control as IPath) != null) |
||
5649 | { |
||
5650 | multi_Undo_Data.LineSize = (control as IPath).LineSize; |
||
5651 | } |
||
5652 | if ((control as UIElement) != null) |
||
5653 | { |
||
5654 | multi_Undo_Data.Opacity = (control as UIElement).Opacity; |
||
5655 | } |
||
5656 | |||
5657 | return multi_Undo_Data; |
||
5658 | } |
||
5659 | |||
5660 | ac4f1e13 | taeseongkim | private async void Comment_Move(object sender, MouseButtonEventArgs e) |
5661 | 787a4489 | KangIngu | { |
5662 | string Select_ID = (((e.Source as Telerik.Windows.Controls.RadButton).DataContext) as IKCOM.MarkupInfoItem).UserID; |
||
5663 | foreach (var items in ViewerDataModel.Instance._markupInfoRevList) |
||
5664 | { |
||
5665 | if (items.UserID == Select_ID) |
||
5666 | { |
||
5667 | foreach (var item in items.MarkupList) |
||
5668 | { |
||
5669 | if (item.PageNumber == pageNavigator.CurrentPage.PageNumber) |
||
5670 | { |
||
5671 | ac4f1e13 | taeseongkim | await MarkupParser.ParseExAsync(App.ViewInfo.ProjectNO, item.Data, Common.ViewerDataModel.Instance.MarkupControls_USER, "#FFFF0000", "", |
5672 | 24678e06 | humkyung | items.MarkupInfoID, Commons.shortGuid()); |
5673 | 787a4489 | KangIngu | } |
5674 | } |
||
5675 | } |
||
5676 | } |
||
5677 | } |
||
5678 | d62c0439 | humkyung | |
5679 | f959ea6f | humkyung | /// <summary> |
5680 | /// convert inkcontrol to polygoncontrol |
||
5681 | /// </summary> |
||
5682 | public void ConvertInkControlToPolygon() |
||
5683 | 787a4489 | KangIngu | { |
5684 | if (inkBoard.Strokes.Count > 0) |
||
5685 | { |
||
5686 | inkBoard.Strokes.ToList().ForEach(stroke => |
||
5687 | { |
||
5688 | InkToPath ip = new InkToPath(); |
||
5689 | f959ea6f | humkyung | |
5690 | 787a4489 | KangIngu | List<Point> inkPointSet = new List<Point>(); |
5691 | f959ea6f | humkyung | inkPointSet.AddRange(ip.GetPointsFrom(stroke)); |
5692 | |||
5693 | PolygonControl pc = new PolygonControl() |
||
5694 | 787a4489 | KangIngu | { |
5695 | fa48eb85 | taeseongkim | CommentAngle = 0, |
5696 | f959ea6f | humkyung | PointSet = inkPointSet, |
5697 | 787a4489 | KangIngu | ControlType = ControlType.Ink |
5698 | }; |
||
5699 | f959ea6f | humkyung | pc.StartPoint = inkPointSet[0]; |
5700 | pc.EndPoint = inkPointSet[inkPointSet.Count - 1]; |
||
5701 | pc.LineSize = 3; |
||
5702 | pc.CommentID = Commons.shortGuid(); |
||
5703 | pc.StrokeColor = new SolidColorBrush(Colors.Red); |
||
5704 | 787a4489 | KangIngu | |
5705 | f959ea6f | humkyung | if (pc.PointSet.Count > 0) |
5706 | { |
||
5707 | CreateCommand.Instance.Execute(pc); |
||
5708 | 787a4489 | KangIngu | ViewerDataModel.Instance.MarkupControls_USER.Add(pc); |
5709 | } |
||
5710 | }); |
||
5711 | f959ea6f | humkyung | inkBoard.Strokes.Clear(); |
5712 | 787a4489 | KangIngu | } |
5713 | } |
||
5714 | 17a22987 | KangIngu | |
5715 | 4318fdeb | KangIngu | /// <summary> |
5716 | e66f22eb | KangIngu | /// 캔버스에 그릴때 모든 포인트가 캔버스를 벗어 났는지 체크하여 넘겨줌 |
5717 | /// </summary> |
||
5718 | /// <author>ingu</author> |
||
5719 | /// <date>2018.06.05</date> |
||
5720 | /// <param name="getPoint"></param> |
||
5721 | /// <returns></returns> |
||
5722 | private bool IsGetoutpoint(Point getPoint) |
||
5723 | 670a4be2 | humkyung | { |
5724 | e66f22eb | KangIngu | if (getPoint == new Point()) |
5725 | 670a4be2 | humkyung | { |
5726 | e66f22eb | KangIngu | ViewerDataModel.Instance.MarkupControls_USER.Remove(currentControl); |
5727 | currentControl = null; |
||
5728 | return true; |
||
5729 | 670a4be2 | humkyung | } |
5730 | |||
5731 | e66f22eb | KangIngu | return false; |
5732 | 670a4be2 | humkyung | } |
5733 | e66f22eb | KangIngu | |
5734 | 5b46312f | djkim | private void zoomAndPanControl_DragOver(object sender, DragEventArgs e) |
5735 | { |
||
5736 | e.Effects = DragDropEffects.Copy; |
||
5737 | } |
||
5738 | |||
5739 | private void zoomAndPanControl_DragEnter(object sender, DragEventArgs e) |
||
5740 | { |
||
5741 | e.Effects = DragDropEffects.Copy; |
||
5742 | } |
||
5743 | |||
5744 | private void zoomAndPanControl_DragLeave(object sender, DragEventArgs e) |
||
5745 | { |
||
5746 | e.Effects = DragDropEffects.None; |
||
5747 | } |
||
5748 | |||
5749 | 92442e4a | taeseongkim | private void ZoomAndPanControl_ScaleChanged(object sender, RoutedEventArgs e) |
5750 | cdfb57ff | taeseongkim | { |
5751 | var pageWidth = ViewerDataModel.Instance.ImageViewWidth; |
||
5752 | var pageHeight = ViewerDataModel.Instance.ImageViewHeight; |
||
5753 | |||
5754 | 92442e4a | taeseongkim | ScaleImage(pageWidth, pageHeight); |
5755 | } |
||
5756 | |||
5757 | /// <summary> |
||
5758 | /// 페이지를 scale의 변화에 맞춰서 DecodePixel을 변경한다. |
||
5759 | /// </summary> |
||
5760 | /// <param name="pageWidth">원본 사이즈</param> |
||
5761 | /// <param name="pageHeight">원본 사이즈</param> |
||
5762 | /// <returns></returns> |
||
5763 | private void ScaleImage(double pageWidth,double pageHeight) |
||
5764 | { |
||
5765 | 7e2d682c | taeseongkim | //mainPanel.Scale = zoomAndPanControl.ContentScale;// (zoomAndPanControl.ContentScale >= 0.1) ? 1 : zoomAndPanControl.ContentScale; |
5766 | cdfb57ff | taeseongkim | } |
5767 | |||
5768 | d0eda156 | ljiyeon | private void thumbnailPanel_SizeChanged(object sender, SizeChangedEventArgs e) |
5769 | { |
||
5770 | CommonLib.Common.WriteConfigString("SetThumbnail", "WIDTH", thumbnailPanel.Width.ToString()); |
||
5771 | } |
||
5772 | |||
5773 | 53deabaf | taeseongkim | private void gridViewMarkupAllSelect_Click(object sender, RoutedEventArgs e) |
5774 | { |
||
5775 | var checkbox = (sender as CheckBox); |
||
5776 | |||
5777 | if (checkbox != null) |
||
5778 | { |
||
5779 | if (checkbox.IsChecked.GetValueOrDefault()) |
||
5780 | { |
||
5781 | gridViewMarkup.SelectAll(); |
||
5782 | } |
||
5783 | else |
||
5784 | { |
||
5785 | gridViewMarkup.UnselectAll(); |
||
5786 | } |
||
5787 | } |
||
5788 | } |
||
5789 | |||
5790 | e6a9ddaf | humkyung | /* |
5791 | 5b46312f | djkim | private void zoomAndPanControl_Drop(object sender, DragEventArgs e) |
5792 | { |
||
5793 | 90e7968d | ljiyeon | try |
5794 | 5b46312f | djkim | { |
5795 | 90e7968d | ljiyeon | if (e.Data.GetDataPresent(typeof(string))) |
5796 | { |
||
5797 | this.getCurrentPoint = e.GetPosition(drawingRotateCanvas); |
||
5798 | string dragData = e.Data.GetData(typeof(string)) as string; |
||
5799 | Move_Symbol(sender, dragData); |
||
5800 | } |
||
5801 | 5b46312f | djkim | } |
5802 | 90e7968d | ljiyeon | catch (Exception ex) |
5803 | { |
||
5804 | Logger.sendResLog("zoomAndPanControl_Drop", ex.ToString(), 0); |
||
5805 | } |
||
5806 | 5b46312f | djkim | } |
5807 | e6a9ddaf | humkyung | */ |
5808 | 787a4489 | KangIngu | } |
5809 | f65e6c02 | taeseongkim | |
5810 | public class testItem |
||
5811 | { |
||
5812 | public string Title { get; set; } |
||
5813 | } |
||
5814 | 5a6a5dd1 | humkyung | } |