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