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