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