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