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