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