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