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