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