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