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