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